|
11 | 11 | static struct usb_device_id productlist_table[] = {
|
12 | 12 |
|
13 | 13 | /* hubs are optional in OTG, but very handy ... */
|
| 14 | +#define CERT_WITHOUT_HUBS |
| 15 | +#if defined(CERT_WITHOUT_HUBS) |
| 16 | +{ USB_DEVICE( 0x0000, 0x0000 ), }, /* Root HUB Only*/ |
| 17 | +#else |
14 | 18 | { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 0), },
|
15 | 19 | { USB_DEVICE_INFO(USB_CLASS_HUB, 0, 1), },
|
| 20 | +{ USB_DEVICE_INFO(USB_CLASS_HUB, 0, 2), }, |
| 21 | +#endif |
16 | 22 |
|
17 | 23 | #ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */
|
18 | 24 | /* FIXME actually, printers are NOT supposed to use device classes;
|
19 | 25 | * they're supposed to use interface classes...
|
20 | 26 | */
|
21 |
| -{ USB_DEVICE_INFO(7, 1, 1) }, |
22 |
| -{ USB_DEVICE_INFO(7, 1, 2) }, |
23 |
| -{ USB_DEVICE_INFO(7, 1, 3) }, |
| 27 | +//{ USB_DEVICE_INFO(7, 1, 1) }, |
| 28 | +//{ USB_DEVICE_INFO(7, 1, 2) }, |
| 29 | +//{ USB_DEVICE_INFO(7, 1, 3) }, |
24 | 30 | #endif
|
25 | 31 |
|
26 | 32 | #ifdef CONFIG_USB_NET_CDCETHER
|
27 | 33 | /* Linux-USB CDC Ethernet gadget */
|
28 |
| -{ USB_DEVICE(0x0525, 0xa4a1), }, |
| 34 | +//{ USB_DEVICE(0x0525, 0xa4a1), }, |
29 | 35 | /* Linux-USB CDC Ethernet + RNDIS gadget */
|
30 |
| -{ USB_DEVICE(0x0525, 0xa4a2), }, |
| 36 | +//{ USB_DEVICE(0x0525, 0xa4a2), }, |
31 | 37 | #endif
|
32 | 38 |
|
33 | 39 | #if IS_ENABLED(CONFIG_USB_TEST)
|
34 | 40 | /* gadget zero, for testing */
|
35 |
| -{ USB_DEVICE(0x0525, 0xa4a0), }, |
| 41 | +//{ USB_DEVICE(0x0525, 0xa4a0), }, |
36 | 42 | #endif
|
37 | 43 |
|
| 44 | +/* OPT Tester */ |
| 45 | +{ USB_DEVICE( 0x1a0a, 0x0101 ), }, /* TEST_SE0_NAK */ |
| 46 | +{ USB_DEVICE( 0x1a0a, 0x0102 ), }, /* Test_J */ |
| 47 | +{ USB_DEVICE( 0x1a0a, 0x0103 ), }, /* Test_K */ |
| 48 | +{ USB_DEVICE( 0x1a0a, 0x0104 ), }, /* Test_PACKET */ |
| 49 | +{ USB_DEVICE( 0x1a0a, 0x0105 ), }, /* Test_FORCE_ENABLE */ |
| 50 | +{ USB_DEVICE( 0x1a0a, 0x0106 ), }, /* HS_PORT_SUSPEND_RESUME */ |
| 51 | +{ USB_DEVICE( 0x1a0a, 0x0107 ), }, /* SINGLE_STEP_GET_DESCRIPTOR setup */ |
| 52 | +{ USB_DEVICE( 0x1a0a, 0x0108 ), }, /* SINGLE_STEP_GET_DESCRIPTOR execute */ |
| 53 | + |
| 54 | +/* Sony cameras */ |
| 55 | +{ USB_DEVICE_VER(0x054c,0x0010,0x0410, 0x0500), }, |
| 56 | + |
| 57 | +/* Memory Devices */ |
| 58 | +//{ USB_DEVICE( 0x0781, 0x5150 ), }, /* SanDisk */ |
| 59 | +//{ USB_DEVICE( 0x05DC, 0x0080 ), }, /* Lexar */ |
| 60 | +//{ USB_DEVICE( 0x4146, 0x9281 ), }, /* IOMEGA */ |
| 61 | +//{ USB_DEVICE( 0x067b, 0x2507 ), }, /* Hammer 20GB External HD */ |
| 62 | +{ USB_DEVICE( 0x0EA0, 0x2168 ), }, /* Ours Technology Inc. (BUFFALO ClipDrive)*/ |
| 63 | +//{ USB_DEVICE( 0x0457, 0x0150 ), }, /* Silicon Integrated Systems Corp. */ |
| 64 | + |
| 65 | +/* HP Printers */ |
| 66 | +//{ USB_DEVICE( 0x03F0, 0x1102 ), }, /* HP Photosmart 245 */ |
| 67 | +//{ USB_DEVICE( 0x03F0, 0x1302 ), }, /* HP Photosmart 370 Series */ |
| 68 | + |
| 69 | +/* Speakers */ |
| 70 | +//{ USB_DEVICE( 0x0499, 0x3002 ), }, /* YAMAHA YST-MS35D USB Speakers */ |
| 71 | +//{ USB_DEVICE( 0x0672, 0x1041 ), }, /* Labtec USB Headset */ |
| 72 | + |
38 | 73 | { } /* Terminating entry */
|
39 | 74 | };
|
40 | 75 |
|
| 76 | +static inline void report_errors(struct usb_device *dev) |
| 77 | +{ |
| 78 | + /* OTG MESSAGE: report errors here, customize to match your product */ |
| 79 | + dev_info(&dev->dev, "device Vendor:%04x Product:%04x is not supported\n", |
| 80 | + le16_to_cpu(dev->descriptor.idVendor), |
| 81 | + le16_to_cpu(dev->descriptor.idProduct)); |
| 82 | + if (USB_CLASS_HUB == dev->descriptor.bDeviceClass){ |
| 83 | + dev_printk(KERN_CRIT, &dev->dev, "Unsupported Hub Topology\n"); |
| 84 | + } else { |
| 85 | + dev_printk(KERN_CRIT, &dev->dev, "Attached Device is not Supported\n"); |
| 86 | + } |
| 87 | +} |
| 88 | + |
| 89 | + |
41 | 90 | static int is_targeted(struct usb_device *dev)
|
42 | 91 | {
|
43 | 92 | struct usb_device_id *id = productlist_table;
|
@@ -87,16 +136,57 @@ static int is_targeted(struct usb_device *dev)
|
87 | 136 | continue;
|
88 | 137 |
|
89 | 138 | return 1;
|
90 |
| - } |
| 139 | + /* NOTE: can't use usb_match_id() since interface caches |
| 140 | + * aren't set up yet. this is cut/paste from that code. |
| 141 | + */ |
| 142 | + for (id = productlist_table; id->match_flags; id++) { |
| 143 | +#ifdef DEBUG |
| 144 | + dev_dbg(&dev->dev, |
| 145 | + "ID: V:%04x P:%04x DC:%04x SC:%04x PR:%04x \n", |
| 146 | + id->idVendor, |
| 147 | + id->idProduct, |
| 148 | + id->bDeviceClass, |
| 149 | + id->bDeviceSubClass, |
| 150 | + id->bDeviceProtocol); |
| 151 | +#endif |
91 | 152 |
|
92 |
| - /* add other match criteria here ... */ |
| 153 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && |
| 154 | + id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) |
| 155 | + continue; |
93 | 156 |
|
| 157 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) && |
| 158 | + id->idProduct != le16_to_cpu(dev->descriptor.idProduct)) |
| 159 | + continue; |
94 | 160 |
|
95 |
| - /* OTG MESSAGE: report errors here, customize to match your product */ |
96 |
| - dev_err(&dev->dev, "device v%04x p%04x is not supported\n", |
97 |
| - le16_to_cpu(dev->descriptor.idVendor), |
98 |
| - le16_to_cpu(dev->descriptor.idProduct)); |
| 161 | + /* No need to test id->bcdDevice_lo != 0, since 0 is never |
| 162 | + greater than any unsigned number. */ |
| 163 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) && |
| 164 | + (id->bcdDevice_lo > le16_to_cpu(dev->descriptor.bcdDevice))) |
| 165 | + continue; |
| 166 | + |
| 167 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) && |
| 168 | + (id->bcdDevice_hi < le16_to_cpu(dev->descriptor.bcdDevice))) |
| 169 | + continue; |
| 170 | + |
| 171 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) && |
| 172 | + (id->bDeviceClass != dev->descriptor.bDeviceClass)) |
| 173 | + continue; |
| 174 | + |
| 175 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && |
| 176 | + (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) |
| 177 | + continue; |
| 178 | + |
| 179 | + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && |
| 180 | + (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) |
| 181 | + continue; |
| 182 | + |
| 183 | + return 1; |
| 184 | + } |
| 185 | + } |
| 186 | + |
| 187 | + /* add other match criteria here ... */ |
99 | 188 |
|
| 189 | + report_errors(dev); |
100 | 190 | return 0;
|
101 | 191 | }
|
102 | 192 |
|
0 commit comments