From: Niko Huuskonen <niko.huuskonen.00@gmail.com>
To: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
Daniel Mack <zonque@gmail.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Niko Huuskonen <niko.huuskonen.00@gmail.com>
Subject: [PATCH 2/4] ALSA: caiaq: Fix the Kore controller key map
Date: Sun, 27 Sep 2026 03:35:30 +0300 [thread overview]
Message-ID: <20260927003532.289468-3-niko.huuskonen.00@gmail.com> (raw)
In-Reply-To: <20260927003532.289468-1-niko.huuskonen.00@gmail.com>
keycode_kore does not match the hardware in two places:
- Softkeys 5 to 8 are listed in reverse order, so pressing the fifth
softkey reports BTN_8, the sixth BTN_7 and so on. Softkeys 1 to 4 are
correct. The OpenKoreBridge project, which drives a Kore 2 through
this driver, works around the same reversal in userspace.
- On the first Kore controller the touch sensors of the eight knobs are
scrambled: touching knob 1 reports KEY_BRL_DOT6, knob 2 KEY_BRL_DOT8,
knob 3 KEY_BRL_DOT2, knob 6 KEY_BRL_DOT7, knob 7 KEY_BRL_DOT1 and
knob 8 KEY_BRL_DOT3. Only knobs 4 and 5 are right.
Put the softkeys in order for both controllers, and give the first Kore
controller its own touch sensor order, so that BTN_n and KEY_BRL_DOTn
belong to the n-th knob. The touch sensor order of the Kore 2 is left
alone, as it could not be checked.
Userspace that compensates for the old order needs to follow. It can
read the key map with EVIOCGKEYCODE, which also makes it possible to
support kernels with and without this change.
Tested on a Kore controller (USB ID 17cc:4711).
Link: https://github.com/OpenKoreBridge/OpenKoreBridge
Fixes: 8e3cd08ed8e5 ("[ALSA] caiaq - add control API and more input features")
Assisted-by: LLM
Signed-off-by: Niko Huuskonen <niko.huuskonen.00@gmail.com>
---
sound/usb/caiaq/input.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c
index 8d924330c54c..856235c3398e 100644
--- a/sound/usb/caiaq/input.c
+++ b/sound/usb/caiaq/input.c
@@ -41,11 +41,11 @@ static const unsigned short keycode_kore[] = {
BTN_3,
BTN_2,
BTN_1,
- BTN_8,
- BTN_7,
- BTN_6,
BTN_5,
- KEY_BRL_DOT4, /* touch sensitive knobs */
+ BTN_6,
+ BTN_7,
+ BTN_8,
+ KEY_BRL_DOT4, /* touch sensitive knobs (Kore 2 order) */
KEY_BRL_DOT3,
KEY_BRL_DOT2,
KEY_BRL_DOT1,
@@ -55,6 +55,21 @@ static const unsigned short keycode_kore[] = {
KEY_BRL_DOT5
};
+/* index of the first touch sensor in keycode_kore */
+#define KORE_TOUCH_KEYS 24
+
+/* the first Kore controller reports its touch sensors in this order */
+static const unsigned short keycode_kore1_touch[] = {
+ KEY_BRL_DOT4,
+ KEY_BRL_DOT8,
+ KEY_BRL_DOT3,
+ KEY_BRL_DOT7,
+ KEY_BRL_DOT2,
+ KEY_BRL_DOT6,
+ KEY_BRL_DOT1,
+ KEY_BRL_DOT5
+};
+
#define MASCHINE_BUTTONS (42)
#define MASCHINE_BUTTON(X) ((X) + BTN_MISC)
#define MASCHINE_PADS (16)
@@ -666,6 +681,12 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev)
input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC);
BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_kore));
memcpy(cdev->keycode, keycode_kore, sizeof(keycode_kore));
+ BUILD_BUG_ON(KORE_TOUCH_KEYS + ARRAY_SIZE(keycode_kore1_touch) >
+ ARRAY_SIZE(keycode_kore));
+ if (cdev->chip.usb_id ==
+ USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER))
+ memcpy(cdev->keycode + KORE_TOUCH_KEYS, keycode_kore1_touch,
+ sizeof(keycode_kore1_touch));
input->keycodemax = ARRAY_SIZE(keycode_kore);
input_set_abs_params(input, ABS_HAT0X, 0, 999, 0, 10);
input_set_abs_params(input, ABS_HAT0Y, 0, 999, 0, 10);
--
2.55.0
next prev parent reply other threads:[~2026-09-27 0:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 0:35 [PATCH 0/4] ALSA: caiaq: Kore controller fixes and LCD support Niko Huuskonen
2026-09-27 0:35 ` [PATCH 1/4] ALSA: caiaq: Serialize access to the EP1 command buffer Niko Huuskonen
2026-09-27 0:35 ` Niko Huuskonen [this message]
2026-09-27 0:35 ` [PATCH 3/4] ALSA: uapi: Add hwdep interface ID for caiaq devices Niko Huuskonen
2026-09-27 0:35 ` [PATCH 4/4] ALSA: caiaq: Add LCD support for the Kore controllers Niko Huuskonen
2026-09-28 16:12 ` [PATCH 0/4] ALSA: caiaq: Kore controller fixes and LCD support Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260927003532.289468-3-niko.huuskonen.00@gmail.com \
--to=niko.huuskonen.00@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=zonque@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®