mirror of
https://github.com/jetkvm/rv1106-system.git
synced 2026-05-21 05:20:41 +00:00
a8141daaca
* usb: gadget: f_hid: add wakeup_on_write support Add an opt-in wakeup_on_write configfs attribute to the HID function driver. When enabled, each write to /dev/hidgN calls usb_gadget_wakeup() before queuing the USB request, allowing HID input to wake a suspended host. The configuration descriptor must also advertise remote wakeup capability (bmAttributes bit 5) for the host to arm the feature during enumeration. This is useful for KVM-over-IP devices that need to wake a sleeping host machine by sending keyboard or mouse input. Tested on JetKVM v2 (RV1106 SoC, DWC3 v3.30a) waking a Windows 11 host from S3 sleep via Intel xHCI USB 3.1 controller. Host wakes in ~4 seconds from HID keystroke. Closes: https://github.com/jetkvm/kvm/issues/120 Closes: https://github.com/jetkvm/kvm/issues/674 * fix: guard func.config dereference in f_hidg_write Move the hidg->func.config->cdev dereference inside the wakeup_on_write guard block and add a NULL check on func.config before accessing cdev. This prevents a potential NULL pointer dereference if f_hidg_write races with unbind, where func.config can be NULL before the spinlock is acquired. The cdev variable was only used for the wakeup call, so scoping it to the guard block is safe.