Fork of https://developer.mbed.org/users/bscott/code/STM32_USBDevice/

Fork of STM32_USBDevice by Bradley Scott

Branch:
feature_WebUSB
Revision:
76:eef92651f52f
Parent:
74:8e2832c1046a
--- a/USBDevice/USBDevice.cpp	Fri Oct 27 17:22:45 2017 +0200
+++ b/USBDevice/USBDevice.cpp	Thu Jul 19 12:57:27 2018 +0200
@@ -155,6 +155,24 @@
 #endif
             /* TODO: Support is optional, not implemented here */
             break;
+
+        case BOS_DESCRIPTOR:
+#ifdef DEBUG
+            printf("BOS descr\r\n");
+#endif
+            {
+                uint8_t *descriptor = bosDesc();
+                if (descriptor)
+                {
+                    /* Get wTotalLength */
+                    transfer.remaining = descriptor[2] | (descriptor[3] << 8);
+                    transfer.ptr = descriptor;
+                    transfer.direction = DEVICE_TO_HOST;
+                    success = true;
+                }
+            }
+            break;
+
         default:
 #ifdef DEBUG
             printf("ERROR\r\n");
@@ -835,7 +853,7 @@
 }
 
 
-bool USBDevice::write(uint8_t endpoint, uint8_t * buffer, uint32_t size, uint32_t maxSize)
+bool USBDevice::write(uint8_t endpoint, const uint8_t * buffer, uint32_t size, uint32_t maxSize)
 {
     EP_STATUS result;
 
@@ -876,7 +894,7 @@
 }
 
 
-bool USBDevice::writeNB(uint8_t endpoint, uint8_t * buffer, uint32_t size, uint32_t maxSize)
+bool USBDevice::writeNB(uint8_t endpoint, const uint8_t * buffer, uint32_t size, uint32_t maxSize)
 {
     EP_STATUS result;