From 59f4fee05b2a09e74e55d04f5cafa5ca3d0a55ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 14 Feb 2018 15:51:02 +0100 Subject: [PATCH] [usb] Handle GET_STATUS request. Change-Id: I4c9d8cbe7241dfd6fbb986253122a74d0ddb0e2c --- ion/src/device/usb.cpp | 11 ++++++++++- ion/src/device/usb.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ion/src/device/usb.cpp b/ion/src/device/usb.cpp index 2f7e7686f..87ef03c34 100644 --- a/ion/src/device/usb.cpp +++ b/ion/src/device/usb.cpp @@ -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: diff --git a/ion/src/device/usb.h b/ion/src/device/usb.h index c3f4be2c6..2d4ee17c2 100644 --- a/ion/src/device/usb.h +++ b/ion/src/device/usb.h @@ -164,6 +164,7 @@ void controlSetup(); void controlSetupIn(); void controlSetupOut(); int controlSetupGetDescriptor(); +int controlSetupGetStatus(); int controlSetupSetConfiguration(); int controlRequestDispatch(); int controlStandardRequest();