Repository navigation
Migrate USB v3 discovery while preserving Windows HID mouse support - #109
Merged
Merged
Conversation
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.
USB v3 removes
getDeviceList(), which the application aliases aslistDevices; a dependency-only upgrade breaks discovery. It also replaces libusb with nusb, which cannot claim standard Windows HID interfaces. This migration handles both changes without bundling USB v2.Runtime selection and the read-only startup probe now await
usb.getDevices()through a descriptor-only adapter. It avoids native serial/configuration getters that can open devices and preserves the serial-free identities used by Windows Raw Input presentation recovery. Device classification, Razer priority, active-mouse overrides and wired CrazyLight preference remain intact.Windows CrazyLight retains its existing HID bridge. Windows Razer devices use node-hid for the same 90-byte feature reports, with report-ID prefix/strip and validated HID collection sizes; WinUSB-bound Razer devices and other platforms retain WebUSB. The existing Razer command construction, timing, retries, two-stage rate writes and readback stay in the original backend.
Validation: 246 tests pass with 3 platform skips under
TZ=UTC. New tests cover asynchronous discovery, reconnects, unknown devices, errors, native getter avoidance, Windows HID byte alignment, exact product/serial/interface selection, rate readback, short replies, reopen and WinUSB fallback. Dependency audit reports zero vulnerabilities; syntax and YAML checks pass. Native USB enumeration is unavailable in the local container because/sys/bus/usb/devicesis absent.Windows CI smoke-tests real USB and HID enumeration from source and from packaged Electron, then uploads a portable Windows test artifact. USB's shipped N-API binary is excluded from recompilation while node-hid's rebuild behavior is retained.
All applicable PR checks passed, including Windows packaging and native USB/HID smoke tests from the packaged executable. The user reported that the portable test build works and confirmed testing the Razer HyperPolling hardware as well. The test checklist remains in
docs/usb-v3-hardware-test.md.