mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-22 04:55:14 +00:00
func_wakeup_bm was write-only. Interface GET_STATUS returned a hardcoded zero, so a wake-capable function reported itself incapable even though USB 3.2 9.2.5.4 makes that the host's discovery mechanism; it now reports D0 Function Remote Wake Capable from the configuration's REMOTE_WAKEUP attribute and D1 Function Remote Wakeup from the per-interface bit, keeping the two reserved zero bytes at USB 2.0 speeds. The state also survived SET_INTERFACE, a same-value SET_CONFIGURATION (which Linux's usb_reset_configuration() sends, and which the "only process if different" guard skipped) and SetAddress(0) - all of which USB 3.2 Table 9-10 marks as resetting FUNCTION REMOTE WAKEUP, leaving tud_remote_wakeup() armed after the host revoked it. remote_wakeup_support is deliberately not part of dev_state_bm: GET_STATUS(Device) returns that byte wholesale, so a bit added there leaks into the device status - caught by test_usbd_get_status_u1_enable. Two tests cover it, using a one-interface configuration because every interface-recipient request needs itf2drv bound and the existing fixture declares zero interfaces.