Skip to content

Commit 2ebc7c8

Browse files
authored
feat: Add Japanese 106/109 key minimum mappings and extend HID usage range (#1036)
1 parent 96f0a5c commit 2ebc7c8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

internal/usbgadget/hid_keyboard.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ var keyboardConfig = gadgetConfigItem{
2727
}
2828

2929
// Source: https://www.kernel.org/doc/Documentation/usb/gadget_hid.txt
30+
// Note: Original kernel doc used 0x65 (101 keys) for both LOGICAL_MAXIMUM and USAGE_MAXIMUM,
31+
// but we use 0xff to support international keys like RO (0x87), Yen (0x89), Henkan (0x8a), Muhenkan (0x8b), etc.
3032
var keyboardReportDesc = []byte{
3133
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
3234
0x09, 0x06, /* USAGE (Keyboard) */
@@ -55,10 +57,10 @@ var keyboardReportDesc = []byte{
5557
0x95, 0x06, /* REPORT_COUNT (6) */
5658
0x75, 0x08, /* REPORT_SIZE (8) */
5759
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
58-
0x25, 0x65, /* LOGICAL_MAXIMUM (101) */
60+
0x25, 0xff, /* LOGICAL_MAXIMUM (255) */
5961
0x05, 0x07, /* USAGE_PAGE (Keyboard) */
6062
0x19, 0x00, /* USAGE_MINIMUM (Reserved) */
61-
0x29, 0x65, /* USAGE_MAXIMUM (Keyboard Application) */
63+
0x29, 0xff, /* USAGE_MAXIMUM (Keyboard Application) */
6264
0x81, 0x00, /* INPUT (Data,Ary,Abs) */
6365
0xc0, /* END_COLLECTION */
6466
}

ui/src/components/WebRTCVideo.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,17 @@ export default function WebRTCVideo({ hasConnectionIssues }: { hasConnectionIssu
244244
} else if (code == "Backquote" && ["§", "±"].includes(key)) {
245245
code = "IntlBackslash";
246246
}
247+
// For Japanese 106/109
248+
else if (code === "IntlYen") {
249+
code = "Yen";
250+
} else if (code === "IntlRo") {
251+
code = "KeyRO";
252+
} else if (code === "Convert") {
253+
code = "Henkan";
254+
} else if (code === "NonConvert") {
255+
code = "Muhenkan";
256+
}
257+
247258
return code;
248259
}
249260

0 commit comments

Comments
 (0)