Skip to content

Fix x360 packet len and keychron - #373

Open
thor27 wants to merge 2 commits into
paroj:masterfrom
thor27:fix-x360-packet-len-and-keychron
Open

thor27 wants to merge 2 commits into
paroj:masterfrom
thor27:fix-x360-packet-len-and-keychron

Conversation

@thor27

@thor27 thor27 commented Sep 13, 2026

Copy link
Copy Markdown

Fix: #374

Add support for Keychron keyboards running in Xbox gamepad emulation mode.

Besides adding the id support, to get proper button working, we also need to change the packet size to 32bits.

I think 64bits package, as per git history, is only for Xbox One controller, so this fix should improve compatibility with previous and older non standard controller:

Modern xpad hardcodes XPAD_PKT_LEN = 64 for all incoming interrupt URBs
to accommodate Xbox One controllers. However, Xbox 360 and classic Xbox
devices communicate using 32-byte frames (wMaxPacketSize = 32).

On USB endpoints that emit 32-byte reports without Zero-Length Packets
(such as high-polling composite devices), requesting 64 bytes causes
the host controller to defer URB completion until two 32-byte packets
accumulate. This leads to paired/lagged inputs and unreleased button
states while stationary.

Separate the buffer allocation size (kept at 64 bytes for DMA safety)
from the transfer buffer length, setting in_len to 32 bytes for
non-Xbox-One devices.

I used Gemini to help me identify the problem and write commit messages.
Testing and coding was done by me.

Modern xpad hardcodes XPAD_PKT_LEN = 64 for all incoming interrupt URBs
to accommodate Xbox One controllers. However, Xbox 360 and classic Xbox
devices communicate using 32-byte frames (wMaxPacketSize = 32).

On USB endpoints that emit 32-byte reports without Zero-Length Packets
(such as high-polling composite devices), requesting 64 bytes causes
the host controller to defer URB completion until two 32-byte packets
accumulate. This leads to paired/lagged inputs and unreleased button
states while stationary.

Separate the buffer allocation size (kept at 64 bytes for DMA safety)
from the transfer buffer length, setting in_len to 32 bytes for
non-Xbox-One devices.

Signed-off-by: Thomaz Reis <thor27@gmail.com>
@thor27
thor27 force-pushed the fix-x360-packet-len-and-keychron branch from 88e0acf to 6a976cd Compare September 13, 2026 22:30
Add VID 0x3434 and PID 0x1030 for the Keychron Q3 HE 8K keyboard
running in Xbox gamepad emulation mode.

Signed-off-by: Thomaz Reis <thor27@gmail.com>
@thor27
thor27 force-pushed the fix-x360-packet-len-and-keychron branch from 6a976cd to cd692ea Compare September 13, 2026 22:32
@thor27
thor27 marked this pull request as ready for review September 13, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keychron Q3 HE 8K - Xbox mode compatibility issue

1 participant