mirror of
https://github.com/jiegec/usbip.git
synced 2026-11-19 00:59:38 -05:00
The server used to answer every interrupt IN poll immediately, replying with an empty buffer whenever the device had no data. Clients that poll aggressively (e.g. usbip-win2) therefore receive a flood of empty completions. Add an opt-in pending model: a UsbInterfaceHandler may expose a Notify through the new pending_notify(); while a handler has no data, the matching interrupt IN URB is kept pending and completed only once the handler signals the Notify. USBIP_CMD_UNLINK now cancels a still-pending transfer, and pending tasks are cleaned up when the connection closes. UsbHidKeyboardHandler gains new_keyboard_with_pending() and press() to opt into this behaviour, while new_keyboard() is unchanged. A new example (examples/hid_keyboard_pending.rs) demonstrates the new API; the original hid_keyboard example is preserved unchanged.