Permalink
Browse files

Implement the fwupd firmware version extension

  • Loading branch information...
1 parent 8f1fa9e commit 5e1bb64ad722a9d2d95927e305fd869b4a3a46a8 @hughsie hughsie committed Apr 29, 2015
Showing with 25 additions and 4 deletions.
  1. +1 −1 usb_config.h
  2. +24 −3 usb_descriptors.c
View
@@ -49,7 +49,7 @@
#define USB_PULLUP_OPTION USB_PULLUP_ENABLE
#define USB_TRANSCEIVER_OPTION USB_INTERNAL_TRANSCEIVER
#define USB_SPEED_OPTION USB_FULL_SPEED
-#define USB_NUM_STRING_DESCRIPTORS 3
+#define USB_NUM_STRING_DESCRIPTORS 4
#define USB_ENABLE_ALL_HANDLERS
/* device class */
View
@@ -61,14 +61,25 @@ ROM BYTE configDescriptor1[]={
/* Configuration Descriptor */
0x09,// sizeof(USB_CFG_DSC), /* Size of this descriptor in bytes */
USB_DESCRIPTOR_CONFIGURATION, /* CONFIGURATION descriptor type */
- 0x29,0x00, /* Total length of data */
- 1, /* Number of interfaces */
+ 0x32,0x00, /* Total length of data */
+ 2, /* Number of interfaces */
1, /* Index value of this configuration */
0, /* Configuration string index */
_DEFAULT | _SELF, /* Attributes (this device is self-powered, but has no remote wakeup), see usb_device.h */
150, /* Max power consumption (2X mA)
/* Interface Descriptor */
+ 0x09, /* Size of this descriptor in bytes */
+ USB_DESCRIPTOR_INTERFACE, /* INTERFACE descriptor type */
+ 1, /* Interface Number */
+ 0, /* Alternate Setting Number */
+ 0, /* Number of endpoints in this intf */
+ 0xff, /* Class code */
+ 'F', /* Subclass code */
+ 'W', /* Protocol code */
+ 0x03, /* Interface string index */
+
+ /* Interface Descriptor */
0x09,// sizeof(USB_INTF_DSC), /* Size of this descriptor in bytes */
USB_DESCRIPTOR_INTERFACE, /* INTERFACE descriptor type */
0, /* Interface Number */
@@ -134,6 +145,15 @@ sizeof(sd002),USB_DESCRIPTOR_STRING,
#endif
+/* Firmware version string descriptor (unicode) */
+ROM struct{BYTE bLength;BYTE bDscType;WORD string[5];}sd003={
+sizeof(sd003),USB_DESCRIPTOR_STRING,
+{
+ 0x30 + CH_VERSION_MAJOR,'.',
+ 0x30 + CH_VERSION_MINOR,'.',
+ 0x30 + CH_VERSION_MICRO
+}};
+
/* HID descriptor -- see http://www.usb.org/developers/hidpage#HID%20Descriptor%20Tool */
ROM struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={
{
@@ -164,5 +184,6 @@ ROM BYTE *ROM USB_SD_Ptr[]=
{
(ROM BYTE *ROM)&sd000,
(ROM BYTE *ROM)&sd001,
- (ROM BYTE *ROM)&sd002
+ (ROM BYTE *ROM)&sd002,
+ (ROM BYTE *ROM)&sd003
};

0 comments on commit 5e1bb64

Please sign in to comment.