Repository navigation
Conversation
The server answers an interrupt IN poll with the device's last report when no new one arrived within bInterval. That is right for devices that report state, but wrong for a device that forwards another device's reports: some of those are one-shot events, and repeating them invents input. A device can now implement usb.NoInRepeatDevice to have its IN polls wait for a new report. Claude-Session: https://claude.ai/code/session_016H3ByhXeSc7eq3UDmPXo8s
New device type `hidproxy`: it enumerates with the descriptors the client supplies (device, configuration, strings, HID report descriptors) and passes reports between the host and the client. The client reads and writes the real device itself and decides what passes; VIIPER never talks to the real device. - Input reports come from the client and are not repeated (NoInRepeatDevice). - OUT transfers, HID GET/SET_REPORT, vendor and unknown class requests go to the client, which answers control requests within 1 s. - HID idle/protocol and CDC line coding/control line state are answered by the device itself. Docs: docs/devices/hidproxy.md. Tests: unit tests with the descriptors of a Steam Controller puck, an end-to-end test over the API, and the device in TestDeviceAttach. Claude-Session: https://claude.ai/code/session_016H3ByhXeSc7eq3UDmPXo8s Changelog(feat)
|
Could the reconnect test also cover input already queued by the previous client? At this revision, Given the one-shot-event motivation for no-repeat, it would help to define and test whether that backlog intentionally survives a stream reconnection, or whether a new owner requires a new device/queue lifecycle. Keeping or discarding queued key/button transitions can each affect state, so an explicit documented policy seems useful here. Disclosure: I maintain Windows HID/QA tools. This is AI-assisted source-review feedback; I haven't executed this case or tested the PR on hardware. |
A client that leaves could leave reports the host hadn't read yet in the IN queues, and the next client's input came after them. Those reports may be one-shot events (a press without its release), so a later client now starts with empty queues and is expected to send the current state first. Documented in docs/devices/hidproxy.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016H3BygJUeQxU6epov8YidF
Requested by jc-sw-git · project thread
Description
Two commits:
usb/device.go,internal/server/usb/server.go): a new optional interfaceusb.NoInRepeatDevice. When a device implements it and returns true, the server doesn't resend its last report on an interrupt IN poll; the poll waits for a new one. Devices that don't implement it behave as before.device/hidproxy): a device type that enumerates with descriptors the client supplies and passes reports between the host and the client.deviceSpecific): device, configuration, string and HID report descriptors as hex, plus the speed. USB 2.01 is served as 2.00 so Windows doesn't ask for a BOS descriptor.internal/registry, docs indocs/devices/hidproxy.md, listed in the README,docs/index.mdandmkdocs.yml.Not included: a libVIIPER wrapper (
lib/viiper) and client-library bindings for the new device. I can add them if you want them in this PR.Related Issue
Closes #43
Motivation and Context
See the issue: a launcher hides a real HID device (here the Steam Controller puck) from Steam with HidHide and shows Steam a copy, so it decides what passes between Steam and the real device. Beyond that case, the device is generic: any HID-style USB device the client describes (wheels, flight sticks, other pads, dongles) can be served without a new device type in VIIPER; the issue lists the limits (no isochronous, SuperSpeed or bulk-heavy devices). The no-repeat interface is needed because the copy forwards another device's reports, some of which are events, not state.
How Has This Been Tested?
go vet ./...andgo test ./...pass on Linux (Go 1.27.2). New tests:device/hidproxy(enumeration with the descriptors of a real Steam Controller puck, frame round trips, routing of control requests, timeouts, late and foreign replies, one client at a time) andTestTheHostReadsEachReportOncethrough the real server; the device is also inTestDeviceAttach. A run on Windows with a real puck is still pending on our side; I'll report the result here.Type of Change
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_016H3ByhXeSc7eq3UDmPXo8s