Skip to content

Commit 67fd71b

Browse files
Mizuho MoriJiri Kosina
authored andcommitted
HID: apple: Fix logical maximum and usage maximum of Magic Keyboard JIS
Apple Magic Keyboard(JIS)'s Logical Maximum and Usage Maximum are wrong. Below is a report descriptor. 0x05, 0x01, /* Usage Page (Desktop), */ 0x09, 0x06, /* Usage (Keyboard), */ 0xA1, 0x01, /* Collection (Application), */ 0x85, 0x01, /* Report ID (1), */ 0x05, 0x07, /* Usage Page (Keyboard), */ 0x15, 0x00, /* Logical Minimum (0), */ 0x25, 0x01, /* Logical Maximum (1), */ 0x19, 0xE0, /* Usage Minimum (KB Leftcontrol), */ 0x29, 0xE7, /* Usage Maximum (KB Right GUI), */ 0x75, 0x01, /* Report Size (1), */ 0x95, 0x08, /* Report Count (8), */ 0x81, 0x02, /* Input (Variable), */ 0x95, 0x05, /* Report Count (5), */ 0x75, 0x01, /* Report Size (1), */ 0x05, 0x08, /* Usage Page (LED), */ 0x19, 0x01, /* Usage Minimum (01h), */ 0x29, 0x05, /* Usage Maximum (05h), */ 0x91, 0x02, /* Output (Variable), */ 0x95, 0x01, /* Report Count (1), */ 0x75, 0x03, /* Report Size (3), */ 0x91, 0x03, /* Output (Constant, Variable), */ 0x95, 0x08, /* Report Count (8), */ 0x75, 0x01, /* Report Size (1), */ 0x15, 0x00, /* Logical Minimum (0), */ 0x25, 0x01, /* Logical Maximum (1), */ here is a report descriptor which is parsed one in kernel. see sys/kernel/debug/hid/<dev>/rdesc 05 01 09 06 a1 01 85 01 05 07 15 00 25 01 19 e0 29 e7 75 01 95 08 81 02 95 05 75 01 05 08 19 01 29 05 91 02 95 01 75 03 91 03 95 08 75 01 15 00 25 01 06 00 ff 09 03 81 03 95 06 75 08 15 00 25 [65] 05 07 19 00 29 [65] 81 00 95 01 75 01 15 00 25 01 05 0c 09 b8 81 02 95 01 75 01 06 01 ff 09 03 81 02 95 01 75 06 81 03 06 02 ff 09 55 85 55 15 00 26 ff 00 75 08 95 40 b1 a2 c0 06 00 ff 09 14 a1 01 85 90 05 84 75 01 95 03 15 00 25 01 09 61 05 85 09 44 09 46 81 02 95 05 81 01 75 08 95 01 15 00 26 ff 00 09 65 81 02 c0 00 Position 64(Logical Maximum) and 70(Usage Maximum) are 101. Both should be 0xE7 to support JIS specific keys(ろ, Eisu, Kana, |) support. position 117 is also 101 but not related(it is Usage 65h). There are no difference of product id between JIS and ANSI. They are same 0x0267. Signed-off-by: Mizuho Mori <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 1e4ce41 commit 67fd71b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/hid/hid-apple.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,19 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field,
336336

337337
/*
338338
* MacBook JIS keyboard has wrong logical maximum
339+
* Magic Keyboard JIS has wrong logical maximum
339340
*/
340341
static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
341342
unsigned int *rsize)
342343
{
343344
struct apple_sc *asc = hid_get_drvdata(hdev);
344345

346+
if(*rsize >=71 && rdesc[70] == 0x65 && rdesc[64] == 0x65) {
347+
hid_info(hdev,
348+
"fixing up Magic Keyboard JIS report descriptor\n");
349+
rdesc[64] = rdesc[70] = 0xe7;
350+
}
351+
345352
if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
346353
rdesc[53] == 0x65 && rdesc[59] == 0x65) {
347354
hid_info(hdev,

0 commit comments

Comments
 (0)