From 06f5a1d3ec3f54a4a6ec9bbe6b9e7c45d9c18c7c Mon Sep 17 00:00:00 2001 From: AJM Date: Mon, 19 Apr 2010 17:06:25 -0400 Subject: added the string descriptors to the descriptor set so that when you plug in the device it can actually report "LeafLabs Maple R3" --- core/usb/descriptors.c | 41 ++++++++++++++++++++++++++++++++++++++++- core/usb/descriptors.h | 10 +++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/usb/descriptors.c b/core/usb/descriptors.c index eca3f3f..522b8d6 100644 --- a/core/usb/descriptors.c +++ b/core/usb/descriptors.c @@ -1,5 +1,6 @@ /* insert license */ + #include "descriptors.h" USB_Descriptor_Device usbVcomDescriptor_Device = { @@ -118,5 +119,43 @@ USB_Descriptor_Configuration usbVcomDescriptor_Config = { bmAttributes: EP_TYPE_BULK, wMaxPacketSize: VCOM_TX_EPSIZE, bInterval: 0x00 - }, + } }; + +/* + String Identifiers: + + we may choose to specify any or none of the following string + identifiers: + + iManufacturer: LeafLabs + iProduct: Maple R3 + iSerialNumber: NONE + iConfiguration: NONE + iInterface(CCI): NONE + iInterface(DCI): NONE + + additionally we must provide the unicode language identifier, + which is 0x0409 for US English +*/ + +USB_Descriptor_String usbVcomDescriptor_LangID = + { + bLength: USB_DESCRIPTOR_STRING_LEN(1), + bDescriptorType: USB_DESCRIPTOR_TYPE_STRING, + bString: 0x0409 + }; + +USB_Descriptor_String usbVcomDescriptor_iManufacturer = + { + bLength: USB_DESCRIPTOR_STRING_LEN(8), + bDescriptorType: USB_DESCRIPTOR_TYPE_STRING, + bString: L"LeafLabs" + }; + +USB_Descriptor_String usbVcomDescriptor_iProduct = + { + bLength: USB_DESCRIPTOR_STRING_LEN(8), + bDescriptorType: USB_DESCRIPTOR_TYPE_STRING, + bString: L"Maple R3" + }; diff --git a/core/usb/descriptors.h b/core/usb/descriptors.h index 1463221..1beabcc 100644 --- a/core/usb/descriptors.h +++ b/core/usb/descriptors.h @@ -18,6 +18,8 @@ uint8 Data[DataSize]; \ } +#define USB_DESCRIPTOR_STRING_LEN(x) (2 + (x << 1)) + typedef struct { uint8 bLength; uint8 bDescriptorType; @@ -78,7 +80,13 @@ typedef struct { USB_Descriptor_Interface DCI_Interface; USB_Descriptor_Endpoint DataOutEndpoint; USB_Descriptor_Endpoint DataInEndpoint; -} USB_Descriptor_Configuration; +}USB_Descriptor_Configuration; + +typedef struct { + uint8 bLength; + uint8 bDescriptorType; + uint16 bString[]; +} USB_Descriptor_String; #if defined(__cplusplus) -- cgit v1.2.3