11
2- #include <stddef.h>
3- #include <linux/ch9.h>
4- #include <linux/ch9-extra.h>
2+ #include "descriptors.h"
53
6-
7- struct usb_section {
8- struct usb_config_descriptor config ;
9- struct usb_interface_descriptor interface ;
10- struct usb_endpoint_descriptor endpoints [2 ];
11- };
12-
13- struct usb_str {
14- __u8 bLength ;
15- __u8 bDescriptorType ;
16-
17- __le16 wData []; /* UTF-16LE encoded */
18- };
19-
20- struct usb_descriptor {
21- struct usb_device_descriptor device ;
22- struct usb_qualifier_descriptor qualifier ;
23- struct usb_section highspeed ;
24- struct usb_section fullspeed ;
25- };
26-
27- __xdata struct usb_descriptor descriptor = {
4+ __code __at (DSCR_AREA ) struct usb_descriptors code_descriptors = {
285 .device = {
296 .bLength = USB_DT_DEVICE_SIZE ,
307 .bDescriptorType = USB_DT_DEVICE ,
@@ -36,10 +13,10 @@ __xdata struct usb_descriptor descriptor = {
3613 .idVendor = 0x04B4 ,
3714 .idProduct = 0x1004 ,
3815 .bcdDevice = 0x0001 ,
39- .iManufacturer = 1 ,
40- .iProduct = 2 ,
41- .iSerialNumber = 0 ,
42- .bNumConfigurations = 1
16+ .iManufacturer = USB_STRING_INDEX ( 0 ) ,
17+ .iProduct = USB_STRING_INDEX ( 1 ) ,
18+ .iSerialNumber = USB_STRING_INDEX_NONE ,
19+ .bNumConfigurations = 1 ,
4320 },
4421 .qualifier = {
4522 .bLength = USB_DT_DEVICE_QUALIFIER_SIZE ,
@@ -56,7 +33,7 @@ __xdata struct usb_descriptor descriptor = {
5633 .config = {
5734 .bLength = USB_DT_CONFIG_SIZE ,
5835 .bDescriptorType = USB_DT_CONFIG ,
59- .wTotalLength = sizeof (descriptor .highspeed ),
36+ .wTotalLength = sizeof (descriptors .highspeed ),
6037 .bNumInterfaces = 1 ,
6138 .bConfigurationValue = 1 ,
6239 .iConfiguration = 0 ,
@@ -71,8 +48,8 @@ __xdata struct usb_descriptor descriptor = {
7148 .bNumEndpoints = 2 ,
7249 .bInterfaceClass = USB_CLASS_VENDOR_SPEC ,
7350 .bInterfaceSubClass = USB_SUBCLASS_VENDOR_SPEC ,
74- .bInterfaceProtocol = 0xff ,
75- .iInterface = 3 ,
51+ .bInterfaceProtocol = USB_PROTOCOL_VENDOR_SPEC ,
52+ .iInterface = USB_STRING_INDEX ( 2 ) ,
7653 },
7754 .endpoints = {
7855 {
@@ -97,7 +74,7 @@ __xdata struct usb_descriptor descriptor = {
9774 .config = {
9875 .bLength = USB_DT_CONFIG_SIZE ,
9976 .bDescriptorType = USB_DT_CONFIG ,
100- .wTotalLength = sizeof (descriptor .fullspeed ),
77+ .wTotalLength = sizeof (descriptors .fullspeed ),
10178 .bNumInterfaces = 1 ,
10279 .bConfigurationValue = 1 ,
10380 .iConfiguration = 0 ,
@@ -134,4 +111,5 @@ __xdata struct usb_descriptor descriptor = {
134111 },
135112 },
136113 },
114+ #include "build/descriptors_stringtable.inc"
137115};
0 commit comments