pi400kb icon indicating copy to clipboard operation
pi400kb copied to clipboard

Request: dump your official Pi Keyboard USB HID descriptors

Open Gadgetoid opened this issue 3 years ago • 4 comments

Ahoy folks,

If you've got an official Pi Keyboard or a Pi 400 handy I'd appreciate you dumping the HID descriptor and posting it here.

I'm interested in colour and region variations, just in case the HID descriptors need some variation to support this better.

From a Linux computer or Raspberry Pi, use lsusb to list USB devices, eg:

pi@bullseye:~/ $ lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 04d9:0007 Holtek Semiconductor, Inc. Raspberry Pi Internal Keyboard
Bus 001 Device 004: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Then run sudo usbhid-dump -d 04d9:0007 (replacing the numbers with the device you want to dump), eg:

pi@bullseye:~/ $ sudo usbhid-dump -d 04d9:0007
001:003:001:DESCRIPTOR         1634138968.109157
 05 0C 09 01 A1 01 05 0C 75 01 95 01 15 00 25 01
 09 CD 81 06 09 B5 81 02 09 B6 81 02 09 B8 81 06
 09 E2 81 06 09 EA 81 02 09 E9 81 02 0A 23 02 81
 02 0A 92 01 81 02 95 07 81 01 C0

001:003:000:DESCRIPTOR         1634138968.129603
 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
 75 01 95 08 81 02 95 01 75 08 81 01 95 03 75 01
 05 08 19 01 29 03 91 02 95 05 75 01 91 01 95 06
 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00
 C0

You can parse these into a slightly more readable format using: https://eleccelerator.com/usbdescreqparser/

Just paste the table of hexadecimal numbers and hit "I do not know, make a guess for me", eg:

 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
 75 01 95 08 81 02 95 01 75 08 81 01 95 03 75 01
 05 08 19 01 29 03 91 02 95 05 75 01 91 01 95 06
 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00
 C0

becomes:

0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x06,        // Usage (Keyboard)
0xA1, 0x01,        // Collection (Application)
0x05, 0x07,        //   Usage Page (Kbrd/Keypad)
0x19, 0xE0,        //   Usage Minimum (0xE0)
0x29, 0xE7,        //   Usage Maximum (0xE7)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x08,        //   Report Count (8)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x95, 0x01,        //   Report Count (1)
0x75, 0x08,        //   Report Size (8)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x95, 0x03,        //   Report Count (3)
0x75, 0x01,        //   Report Size (1)
0x05, 0x08,        //   Usage Page (LEDs)
0x19, 0x01,        //   Usage Minimum (Num Lock)
0x29, 0x03,        //   Usage Maximum (Scroll Lock)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x95, 0x05,        //   Report Count (5)
0x75, 0x01,        //   Report Size (1)
0x91, 0x01,        //   Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x95, 0x06,        //   Report Count (6)
0x75, 0x08,        //   Report Size (8)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x05, 0x07,        //   Usage Page (Kbrd/Keypad)
0x19, 0x00,        //   Usage Minimum (0x00)
0x2A, 0xFF, 0x00,  //   Usage Maximum (0xFF)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection

// 65 bytes

// best guess: USB HID Report Descriptor

Gadgetoid avatar Oct 13 '21 15:10 Gadgetoid

I connected my Logitech K400+ wireless keyboard to Pi400:

pi@raspberrypi400:~ $ lsusb | grep Logitech
Bus 001 Device 006: ID 046d:c52b Logitech, Inc. Unifying Receiver
pi@raspberrypi400:~ $ sudo usbhid-dump --model=046d:c52b
001:006:002:DESCRIPTOR         1634154169.468716
 06 00 FF 09 01 A1 01 85 10 75 08 95 06 15 00 26
 FF 00 09 01 81 00 09 01 91 00 C0 06 00 FF 09 02
 A1 01 85 11 75 08 95 13 15 00 26 FF 00 09 02 81
 00 09 02 91 00 C0 06 00 FF 09 04 A1 01 85 20 75
 08 95 0E 15 00 26 FF 00 09 41 81 00 09 41 91 00
 85 21 95 1F 15 00 26 FF 00 09 42 81 00 09 42 91
 00 C0

001:006:001:DESCRIPTOR         1634154169.473909
 05 01 09 02 A1 01 85 02 09 01 A1 00 05 09 19 01
 29 10 15 00 25 01 95 10 75 01 81 02 05 01 16 01
 F8 26 FF 07 75 0C 95 02 09 30 09 31 81 06 15 81
 25 7F 75 08 95 01 09 38 81 06 05 0C 0A 38 02 95
 01 81 06 C0 C0 05 0C 09 01 A1 01 85 03 75 10 95
 02 15 01 26 FF 02 19 01 2A FF 02 81 00 C0 05 01
 09 80 A1 01 85 04 75 02 95 01 15 01 25 03 09 82
 09 81 09 83 81 60 75 06 81 03 C0 06 BC FF 09 88
 A1 01 85 08 19 01 29 FF 15 01 26 FF 00 75 08 95
 01 81 00 C0

001:006:000:DESCRIPTOR         1634154169.477723
 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
 75 01 95 08 81 02 81 03 95 05 05 08 19 01 29 05
 91 02 95 01 75 03 91 01 95 06 75 08 15 00 26 A4
 00 05 07 19 00 2A A4 00 81 00 C0

pi@raspberrypi400:~ $ 

Hermann-SW avatar Oct 13 '21 19:10 Hermann-SW

My Pi400 German white keyboard:

pi@raspberrypi400:~ $ lsusb | grep Holtek
Bus 001 Device 004: ID 04d9:0007 Holtek Semiconductor, Inc. 
pi@raspberrypi400:~ $ sudo usbhid-dump --model=04d9:0007
001:004:001:DESCRIPTOR         1634154254.173961
 05 0C 09 01 A1 01 05 0C 75 01 95 01 15 00 25 01
 09 CD 81 06 09 B5 81 02 09 B6 81 02 09 B8 81 06
 09 E2 81 06 09 EA 81 02 09 E9 81 02 0A 23 02 81
 02 0A 92 01 81 02 95 07 81 01 C0

001:004:000:DESCRIPTOR         1634154254.194390
 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
 75 01 95 08 81 02 95 01 75 08 81 01 95 03 75 01
 05 08 19 01 29 03 91 02 95 05 75 01 91 01 95 06
 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00
 C0

pi@raspberrypi400:~ $ 

Although German Pi400 keyboard, looks identical to what you dumped for your Pi400 keyboard.

Hermann-SW avatar Oct 13 '21 19:10 Hermann-SW

IIRC they encoded the language into the keyboard descriptor somehow but I can't remember where I found that.

If the whole pass-through is language agnostic, though, that's pretty cool!

Edit: Ah the language is encoded in the last number of the idProduct string which I currently do not pass through - https://gist.github.com/probonopd/9646c69f876ff2b4b879aeb1c1cbc532

Gadgetoid avatar Oct 13 '21 21:10 Gadgetoid

My Pi 400 US white keyboard

001:004:001:DESCRIPTOR 1688864148.036853 05 0C 09 01 A1 01 05 0C 75 01 95 01 15 00 25 01 09 CD 81 06 09 B5 81 02 09 B6 81 02 09 B8 81 06 09 E2 81 06 09 EA 81 02 09 E9 81 02 0A 23 02 81 02 0A 92 01 81 02 95 07 81 01 C0

001:004:000:DESCRIPTOR 1688864148.057322 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01 75 01 95 08 81 02 95 01 75 08 81 01 95 03 75 01 05 08 19 01 29 03 91 02 95 05 75 01 91 01 95 06 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00 C0

Dogleader6 avatar Jul 09 '23 00:07 Dogleader6