Repository navigation
EHCI driver: USB keyboards and mice on Intel 6-series and older chipsets (fixes #113) - #115
Merged
Merged
Conversation
… and older) Fixes #113. On an ASUS P8Z68-V LX (Intel Z68) USB mice did not work and a keyboard stopped working after it was plugged in again. Intel chipsets up to the 6 series have no xHCI: their USB ports belong to EHCI controllers, which OSyx did not drive. The keyboard only worked through the firmware's emulation of a PS/2 keyboard, which does not survive plugging, and there was no mouse at all. The new driver (kernel/src/drivers/ehci.rs) takes each EHCI controller from the firmware at boot (USBLEGSUP handoff, USB SMIs off), before the PS/2 driver starts, and runs it in its own thread: - control transfers on the asynchronous schedule, unlinked with the async advance doorbell before their memory is reused - HID interrupt endpoints on the periodic schedule, polled every frame - root ports and hubs, including Intel's rate matching hub behind each root port: low and full-speed keyboards and mice behind it get split transactions through its transaction translator; a hub's status change endpoint reports plugging, so control traffic only happens then - plugging and unplugging at root ports and hub ports - keyboard LEDs Register layouts, queue heads, qTDs and split masks are in osyx-usb (drivers/usb/src/ehci.rs) with host tests. The HID setup (boot keyboards, mice, tablets) moves from the xHCI driver to drivers/usbhid.rs and is shared by both drivers. `usb.ehci=off` on the kernel command line leaves the controllers to the firmware, as before. Checked in QEMU with usb-ehci and ich9-usb-ehci1 (alone and beside qemu-xhci): keyboard and tablet work, and work again after QMP device_del/device_add. The xHCI keyboard also works after the same replug. QEMU cannot model split transactions behind a high-speed hub, so the path Intel's rate matching hub needs has host tests only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Wky8K22juFHFi5Lsqrq5dG
Contributor
v3nn7
marked this pull request as ready for review
November 10, 2026 10:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Fixes #113: on an ASUS P8Z68-V LX (Intel Z68, i5-2500K) the USB mouse did not work, and the keyboard stopped working once it was plugged in again.
Root cause. Intel chipsets up to the 6 series have no xHCI: their USB ports belong to EHCI controllers, and OSyx only drove xHCI. The keyboard worked only through the firmware's emulation of a PS/2 keyboard, which does not survive plugging in again. The firmware emulates no mouse, so there was none.
Fix: an EHCI driver (
kernel/src/drivers/ehci.rs):usb.ehci=offon the kernel command line leaves the controllers to the firmware, as beforeRegister layouts, queue heads, qTDs and split masks are in
osyx-usb(drivers/usb/src/ehci.rs) with host tests. The HID setup (boot keyboards, mice, tablets) moves out of the xHCI driver intokernel/src/drivers/usbhid.rs, shared by both drivers.pci::Address::write8was added for the firmware semaphore byte.How was it tested?
cargo test -p osyx-usb: 50 passed (5 new EHCI tests)cargo clippyonosyx-usb(-D warnings) and the kernel: no findings in the new codescripts/build-linux.sh:usb-ehciwithusb-kbd+usb-tabletas the only input devices: typing and clicking work; QMPdevice_del/device_addof both, then typing opens Filesich9-usb-ehci1besideqemu-xhci: devices on both controllers workqemu-xhcikeyboard replug after the HID refactor: worksusb.ehci=off: controllers left to the firmwareLimitations or screenshots
usb-hubis full-speed, so the split transactions Intel's rate matching hub needs (the reporter's case) are covered only by host tests of the queue head encoding. A run on the reporter's machine is needed.bInterval.Labels
Labels: bug, drivers, kernel
Generated by Claude Code