aboutsummaryrefslogtreecommitdiff
path: root/stmhal/usbdev/class/cdc_msc/src/usbd_cdc_msc.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/usbdev/class/cdc_msc/src/usbd_cdc_msc.c')
-rw-r--r--stmhal/usbdev/class/cdc_msc/src/usbd_cdc_msc.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/stmhal/usbdev/class/cdc_msc/src/usbd_cdc_msc.c b/stmhal/usbdev/class/cdc_msc/src/usbd_cdc_msc.c
index df080ee4f..07e801e9b 100644
--- a/stmhal/usbdev/class/cdc_msc/src/usbd_cdc_msc.c
+++ b/stmhal/usbdev/class/cdc_msc/src/usbd_cdc_msc.c
@@ -287,30 +287,33 @@ static uint8_t USBD_CDC_MSC_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
switch (req->bmRequest & USB_REQ_TYPE_MASK) {
- /* Class request */
- case USB_REQ_TYPE_CLASS :
- // req->wIndex is the recipient interface number
- if (0) {
+ // Class request
+ case USB_REQ_TYPE_CLASS:
+ // req->wIndex is the recipient interface number
+ if (0) {
#if USE_CDC
- } else if (req->wIndex == CDC_IFACE_NUM) {
- // CDC component
- if (req->wLength) {
- if (req->bmRequest & 0x80)
- {
- CDC_fops->Control(req->bRequest, (uint8_t *)CDC_ClassData.data, req->wLength);
- USBD_CtlSendData (pdev, (uint8_t *)CDC_ClassData.data, req->wLength);
- }
- else
- {
- CDC_ClassData.CmdOpCode = req->bRequest;
- CDC_ClassData.CmdLength = req->wLength;
- USBD_CtlPrepareRx (pdev, (uint8_t *)CDC_ClassData.data, req->wLength);
- }
- break;
- }
+ } else if (req->wIndex == CDC_IFACE_NUM) {
+ // CDC component
+ if (req->wLength) {
+ if (req->bmRequest & 0x80) {
+ // device-to-host request
+ CDC_fops->Control(req->bRequest, (uint8_t*)CDC_ClassData.data, req->wLength);
+ USBD_CtlSendData(pdev, (uint8_t*)CDC_ClassData.data, req->wLength);
+ } else {
+ // host-to-device request
+ CDC_ClassData.CmdOpCode = req->bRequest;
+ CDC_ClassData.CmdLength = req->wLength;
+ USBD_CtlPrepareRx(pdev, (uint8_t*)CDC_ClassData.data, req->wLength);
+ }
+ } else {
+ // Not a Data request
+ // Transfer the command to the interface layer
+ return CDC_fops->Control(req->bRequest, NULL, req->wValue);
+ }
+ break;
#endif
#if USE_MSC
- } else if (req->wIndex == MSC_IFACE_NUM) {
+ } else if (req->wIndex == MSC_IFACE_NUM) {
// MSC component
switch (req->bRequest) {
case BOT_GET_MAX_LUN :