Browse Source

usb: Handle GET_REQUEST (Device) as required by USB specification.

Fixes greaseweazle issue 282
Keir Fraser 2 years ago
parent
commit
71dc5838bf
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/usb/core.c

+ 7 - 0
src/usb/core.c

@@ -35,6 +35,13 @@ static bool_t handle_control_request(void)
         WARN("Ctl OUT too long: %u>%u\n", req->wLength, sizeof(ep0.data));
         WARN("Ctl OUT too long: %u>%u\n", req->wLength, sizeof(ep0.data));
         handled = FALSE;
         handled = FALSE;
 
 
+    } else if ((req->bmRequestType == 0x80)
+               && (req->bRequest == GET_STATUS)) {
+
+        /* GET_STATUS (Device) */
+        ep0.data_len = 2;
+        memset(ep0.data, 0, ep0.data_len);
+
     } else if ((req->bmRequestType == 0x80)
     } else if ((req->bmRequestType == 0x80)
                && (req->bRequest == GET_DESCRIPTOR)) {
                && (req->bRequest == GET_DESCRIPTOR)) {