Skip to content

Instantly share code, notes, and snippets.

@tmk
Created November 17, 2021 13:16
Show Gist options
  • Save tmk/34ba298598aa376346ded28144f99a9c to your computer and use it in GitHub Desktop.
Save tmk/34ba298598aa376346ded28144f99a9c to your computer and use it in GitHub Desktop.
Apple Aluminium Keyboard A1243 - USB Descriptor
Waiting for device:
Listening:
usb_state: 20
usb_state: 40
usb_state: 50
usb_state: 51
usb_state: 90
// Hub: To dump descriptor of hub see NOTE in code
//////////////////////////////////////////////////////////////////////
// USB_desc_dump
// Address: 0A
// Lowspeed: 01
// Devicer dump:
12 01 00 02 00 00 00 08 AC 05 50 02 74 00 01 02
00 01
// Device:
bLength: 12
bDescriptorType: 01
bcdUSB: 0200
bDeviceClass: 00
bDeviceSubClass: 00
bDeviceProtocol: 00
bMaxPacketSize0: 08
idVendor: 05AC
idProduct: 0250
bcdDevice: 0074
iManufacturer: 01
iProduct: 02
iSerialNumber: 00
bNumConfigurations: 01
// String Zero: len: 04
// 04 03 09 04
// LangId: 0409
// iManufacturer: String1(0409): len: 16
// 16 03 41 00 70 00 70 00 6C 00 65 00 20 00 49 00
// 6E 00 63 00 2E 00
// Apple Inc.
// iProduct: String2(0409): len: 1E
// 1E 03 41 00 70 00 70 00 6C 00 65 00 20 00 4B 00
// 65 00 79 00 62 00 6F 00 61 00 72 00 64 00
// Apple Keyboard
// Config0 dump: len: 003B
09 02 3B 00 02 01 00 A0 0A 09 04 00 00 01 03 01
01 00 09 21 11 01 0D 01 22 4B 00 07 05 81 03 08
00 0A 09 04 01 00 01 03 00 00 00 09 21 11 01 00
01 22 2F 00 07 05 82 03 01 00 0A
// Config:
bLength: 09
bDescriptorType: 02
wTotalLength: 003B
bNumInterfaces: 02
bConfigurationValue: 01
iConfiguration: 00
bmAttributes: A0
bMaxPower: 0A
// Interface0.0:
bLength: 09
bDescriptorType: 04
bInterfaceNumber: 00
bAlternateSetting: 00
bNumEndpoints: 01
bInterfaceClass: 03
bInterfaceSubClass: 01
bInterfaceProtocol: 01
iInterface: 00
// HID:
bLength: 09
bDescriptorType: 21
bcdHID: 0111
bCountryCode: 0D
bNumDescriptors: 01
bDescrType: 22
wDescriptorLength: 004B
// Report0 dump: len: 004B
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 05 08 19 01
29 05 95 05 75 01 91 02 95 01 75 03 91 01 05 07
19 00 2A FF 00 95 05 75 08 15 00 26 FF 00 81 00
05 FF 09 03 75 08 95 01 81 02 C0
// Endpoint:
bLength: 07
bDescriptorType: 05
bEndpointAddress: 81
bmAttributes: 03
wMaxPacketSize: 0008
bInterval: 0A
// Interface1.0:
bLength: 09
bDescriptorType: 04
bInterfaceNumber: 01
bAlternateSetting: 00
bNumEndpoints: 01
bInterfaceClass: 03
bInterfaceSubClass: 00
bInterfaceProtocol: 00
iInterface: 00
// HID:
bLength: 09
bDescriptorType: 21
bcdHID: 0111
bCountryCode: 00
bNumDescriptors: 01
bDescrType: 22
wDescriptorLength: 002F
// Report0 dump: len: 002F
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 81 01 C0
// Endpoint:
bLength: 07
bDescriptorType: 05
bEndpointAddress: 82
bmAttributes: 03
wMaxPacketSize: 0001
bInterval: 0A
// Parse data here: http://eleccelerator.com/usbdescreqparser/
0x12, // bLength
0x01, // bDescriptorType (Device)
0x00, 0x02, // bcdUSB 2.00
0x00, // bDeviceClass (Use class information in the Interface Descriptors)
0x00, // bDeviceSubClass
0x00, // bDeviceProtocol
0x08, // bMaxPacketSize0 8
0xAC, 0x05, // idVendor 0x05AC
0x50, 0x02, // idProduct 0x0250
0x74, 0x00, // bcdDevice 0.74
0x01, // iManufacturer (String Index)
0x02, // iProduct (String Index)
0x00, // iSerialNumber (String Index)
0x01, // bNumConfigurations 1
0x09, // bLength
0x02, // bDescriptorType (Configuration)
0x3B, 0x00, // wTotalLength 59
0x02, // bNumInterfaces 2
0x01, // bConfigurationValue
0x00, // iConfiguration (String Index)
0xA0, // bmAttributes Remote Wakeup
0x0A, // bMaxPower 20mA
0x09, // bLength
0x04, // bDescriptorType (Interface)
0x00, // bInterfaceNumber 0
0x00, // bAlternateSetting
0x01, // bNumEndpoints 1
0x03, // bInterfaceClass
0x01, // bInterfaceSubClass
0x01, // bInterfaceProtocol
0x00, // iInterface (String Index)
0x09, // bLength
0x21, // bDescriptorType (HID)
0x11, 0x01, // bcdHID 1.11
0x0D, // bCountryCode
0x01, // bNumDescriptors
0x22, // bDescriptorType[0] (HID)
0x4B, 0x00, // wDescriptorLength[0] 75
0x07, // bLength
0x05, // bDescriptorType (Endpoint)
0x81, // bEndpointAddress (IN/D2H)
0x03, // bmAttributes (Interrupt)
0x08, 0x00, // wMaxPacketSize 8
0x0A, // bInterval 10 (unit depends on device speed)
0x09, // bLength
0x04, // bDescriptorType (Interface)
0x01, // bInterfaceNumber 1
0x00, // bAlternateSetting
0x01, // bNumEndpoints 1
0x03, // bInterfaceClass
0x00, // bInterfaceSubClass
0x00, // bInterfaceProtocol
0x00, // iInterface (String Index)
0x09, // bLength
0x21, // bDescriptorType (HID)
0x11, 0x01, // bcdHID 1.11
0x00, // bCountryCode
0x01, // bNumDescriptors
0x22, // bDescriptorType[0] (HID)
0x2F, 0x00, // wDescriptorLength[0] 47
0x07, // bLength
0x05, // bDescriptorType (Endpoint)
0x82, // bEndpointAddress (IN/D2H)
0x03, // bmAttributes (Interrupt)
0x01, 0x00, // wMaxPacketSize 1
0x0A, // bInterval 10 (unit depends on device speed)
// 77 bytes
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)
0x05, 0x08, // Usage Page (LEDs)
0x19, 0x01, // Usage Minimum (Num Lock)
0x29, 0x05, // Usage Maximum (Kana)
0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)
0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x05, 0x07, // Usage Page (Kbrd/Keypad)
0x19, 0x00, // Usage Minimum (0x00)
0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
0x95, 0x05, // Report Count (5)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0xFF, // Usage Page (Reserved 0xFF)
0x09, 0x03, // Usage (0x03)
0x75, 0x08, // Report Size (8)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection
// 75 bytes
0x05, 0x0C, // Usage Page (Consumer)
0x09, 0x01, // Usage (Consumer Control)
0xA1, 0x01, // Collection (Application)
0x05, 0x0C, // Usage Page (Consumer)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x09, 0xCD, // Usage (Play/Pause)
0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xB5, // Usage (Scan Next Track)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xB6, // Usage (Scan Previous Track)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xB8, // Usage (Eject)
0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xE2, // Usage (Mute)
0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xEA, // Usage (Volume Decrement)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xE9, // Usage (Volume Increment)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection
// 47 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment