Browse Source

Add support for the firmware version extension

This commit adds support for the firmware version extension, as
described at http://www.fwupd.org/developers S. USB Firmware Version
Extensions.  This gives a new way of reading the firmware version, which
is apparently preferred by fwupd.  I'd kinda like to be able to use
fwupd to update the device's firmware starting with the new minor
version, so this is a first step towards that.
Clara Hobbs 7 years ago
parent
commit
7eca43f74e
1 changed files with 16 additions and 4 deletions
  1. 16
    4
      src/usbcfg.c

+ 16
- 4
src/usbcfg.c View File

@@ -72,10 +72,10 @@ static const USBDescriptor vcom_device_descriptor = {
72 72
 };
73 73
 
74 74
 /* Configuration Descriptor tree for a CDC.*/
75
-static const uint8_t vcom_configuration_descriptor_data[67] = {
75
+static const uint8_t vcom_configuration_descriptor_data[76] = {
76 76
     /* Configuration Descriptor.*/
77
-    USB_DESC_CONFIGURATION(67,            /* wTotalLength.                    */
78
-            0x02,          /* bNumInterfaces.                  */
77
+    USB_DESC_CONFIGURATION(76,            /* wTotalLength.                    */
78
+            0x03,          /* bNumInterfaces.                  */
79 79
             0x01,          /* bConfigurationValue.             */
80 80
             0,             /* iConfiguration.                  */
81 81
             0xC0,          /* bmAttributes (self powered).     */
@@ -145,7 +145,19 @@ static const uint8_t vcom_configuration_descriptor_data[67] = {
145 145
     USB_DESC_ENDPOINT     (USBD1_DATA_REQUEST_EP|0x80,    /* bEndpointAddress.*/
146 146
             0x02,          /* bmAttributes (Bulk).             */
147 147
             0x0040,        /* wMaxPacketSize.                  */
148
-            0x00)          /* bInterval.                       */
148
+            0x00),         /* bInterval.                       */
149
+    /* Interface Descriptor.*/
150
+    USB_DESC_INTERFACE    (0x02,          /* bInterfaceNumber.                */
151
+            0x00,          /* bAlternateSetting.               */
152
+            0x00,          /* bNumEndpoints.                   */
153
+            0xFF,          /* bInterfaceClass (Communications
154
+                              Interface Class, CDC section
155
+                              4.2).                            */
156
+            'F',           /* bInterfaceSubClass (Abstract
157
+                              Control Model, CDC section 4.3).   */
158
+            'W',           /* bInterfaceProtocol (AT commands,
159
+                              CDC section 4.4).                */
160
+            3),            /* iInterface.                      */
149 161
 };
150 162
 
151 163
 /*

Loading…
Cancel
Save