summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-04-15 23:08:49 +0700
committerhathach <[email protected]>2020-04-15 23:08:49 +0700
commit0ddbda08cba7895d4710f787c230af074c25cb0f (patch)
treee941a38141399b60c7808078f78cdad4deafde5b /src
parentae9f01fe95cb32c77fa5c0ab17acda278d1b0eba (diff)
always response if GET_INTERFACE even if class driver does not support alt interface
Diffstat (limited to 'src')
-rw-r--r--src/device/usbd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 1df850165..cf16b28c8 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -573,7 +573,16 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
// all requests to Interface (STD or Class) is forwarded to class driver.
// notable requests are: GET HID REPORT DESCRIPTOR, SET_INTERFACE, GET_INTERFACE
- TU_VERIFY(invoke_class_control(rhport, drvid, p_request));
+ if ( !invoke_class_control(rhport, drvid, p_request) )
+ {
+ // For STD GET_INTERFACE even if class driver doesn't support alternate setting
+ // It is still mandatory to response with value of zero
+ TU_VERIFY( TUSB_REQ_TYPE_STANDARD == p_request->bmRequestType_bit.type &&
+ TUSB_REQ_GET_INTERFACE == p_request->bRequest);
+
+ uint8_t alternate = 0;
+ tud_control_xfer(rhport, p_request, &alternate, 1);
+ }
}
break;