Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement the fwupd firmware version extension
  • Loading branch information
hughsie committed Apr 29, 2015
1 parent 8f1fa9e commit 5e1bb64
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion usb_config.h
Expand Up @@ -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 */
Expand Down
27 changes: 24 additions & 3 deletions usb_descriptors.c
Expand Up @@ -61,13 +61,24 @@ 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 */
Expand Down Expand Up @@ -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={
{
Expand Down Expand Up @@ -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.