Skip to content

Instantly share code, notes, and snippets.

@sjmf
Created May 5, 2026 23:21
Show Gist options
  • Select an option

  • Save sjmf/ef69e44e554cb5aaf422fe7f1dcad29f to your computer and use it in GitHub Desktop.

Select an option

Save sjmf/ef69e44e554cb5aaf422fe7f1dcad29f to your computer and use it in GitHub Desktop.
CH9329 USB HID Descriptor
# Combined composite descriptor read from CH9329 (359 bytes, verified
# from 0x81 capture). As CH9329 is a composite device, it presents a
# convenient HID descriptor to emulate.
#
# Contains Report IDs: 1=keyboard, 2=system-ctrl, 3=consumer-ctrl,
# 4=relative-mouse (RID 0x04, range -127..127), 5=absolute-mouse (RID 0x05,
# range 0..4095 for both X and Y), 6=vendor-HID.
# Wire capture confirms the real LC announces the CH9329 composite descriptor
# on PORT=0x01 (HP/HM, P2 in the UC 0x12 keepalive).
# Use as: CH9350Comm(port, state=STATE_0, kbd_desc=CH9329_DESC,
# kbd_pid=CH9329_PID, mouse_desc=None)
CH9329_DESC = bytes.fromhex(
# ---- Report ID 1: Keyboard ----
"05010906a101" # Generic Desktop / Keyboard
"8501050719e029e7150025017501950881029501750881019503"
"7501050819012903910295017505910195067508150026ff00050719002aff00"
"8100c0"
# ---- Report ID 2: System Control ----
"05010980a101" # Generic Desktop / System Control
"850219812983150025019503750181029501750581"
"01c0"
# ---- Report ID 3: Consumer Control ----
"050c0901a101" # Consumer / Consumer Control
"850315002501"
"09e909ea09e209cd19b529b87501950881020a8a"
"010a21020a2a021a23022a270281020a83010a96010a92010a9e010a94010a06"
"0209b209b48102c0"
# ---- Report ID 4: Relative Mouse (±127 per axis) ----
"05010902a101" # Generic Desktop / Mouse
"8504050919012905150025019505750181029501750381"
"0305010901a100093009311581257f750895028106c00938158125"
"7f750895018106c0"
# ---- Report ID 5: Absolute Mouse (13-bit, 0-4095) ----
"05010902a101" # Generic Desktop / Mouse
"8505050919012905150025019505750181029501750381"
"0305010930150026ff0f750d9501810275039501810309311"
"50026ff0f750d9501810275039501810309381581257f750895018106c0c0"
# ---- Report ID 6: Vendor-specific ----
"06a0ff0901" # Vendor-defined
"a10185060901150026ff0075089540810209027508954091020903750895"
"40b102c0"
)
# PID reflected in UC 0x12 keep-alive after processing the CH9329 0x81 frame.
CH9329_PID = bytes.fromhex("29e1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment