[usb] Handle GET_STATUS request.

Change-Id: I4c9d8cbe7241dfd6fbb986253122a74d0ddb0e2c
This commit is contained in:
Léa Saviot
2018-02-14 15:51:02 +01:00
parent 10f7e222f0
commit 59f4fee05b
2 changed files with 11 additions and 1 deletions

View File

@@ -420,6 +420,15 @@ int controlSetupGetDescriptor() {
return (int) RequestReturnCodes::USBD_REQ_NOTSUPP;
}
int controlSetupGetStatus() {
if (sControlBufferLength > 2) {
sControlBufferLength = 2;
}
sControlBuffer[0] = 0;
sControlBuffer[1] = 0;
return (int) RequestReturnCodes::USBD_REQ_HANDLED;
}
int controlSetupSetConfiguration() {
/* We support one configuration only */
if (sSetupData.wValue != 0 || sSetupData.wValue != USB_DFU_CONFIGURATION_VALUE) {
@@ -444,7 +453,7 @@ int controlRequestDispatch() {
int controlStandardRequest() {
switch (sSetupData.bRequest) {
case USB_REQ_GET_STATUS:
//TODO Not needed for enumeration?
return controlSetupGetStatus();
break;
case USB_REQ_CLEAR_FEATURE:
case USB_REQ_SET_FEATURE:

View File

@@ -164,6 +164,7 @@ void controlSetup();
void controlSetupIn();
void controlSetupOut();
int controlSetupGetDescriptor();
int controlSetupGetStatus();
int controlSetupSetConfiguration();
int controlRequestDispatch();
int controlStandardRequest();