2 * drivers/usb/core/otg_whitelist.h
4 * Copyright (C) 2004 Texas Instruments
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
13 * This OTG Whitelist is the OTG "Targeted Peripheral List". It should
14 * mostly use of USB_DEVICE() or USB_DEVICE_VER() entries..
16 * YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING!
19 static struct usb_device_id whitelist_table
[] = {
21 /* hubs are optional in OTG, but very handy ... */
22 { USB_DEVICE_INFO(USB_CLASS_HUB
, 0, 0), },
23 { USB_DEVICE_INFO(USB_CLASS_HUB
, 0, 1), },
25 #ifdef CONFIG_USB_PRINTER /* ignoring nonstatic linkage! */
26 { USB_DEVICE_INFO(7, 1, 1) },
27 { USB_DEVICE_INFO(7, 1, 2) },
28 { USB_DEVICE_INFO(7, 1, 3) },
31 #ifdef CONFIG_USB_NET_CDCETHER
32 /* Linux-USB CDC Ethernet gadget */
33 { USB_DEVICE(0x0525, 0xa4a1), },
34 /* Linux-USB CDC Ethernet + RNDIS gadget */
35 { USB_DEVICE(0x0525, 0xa4a2), },
38 #if defined(CONFIG_USB_TEST) || defined(CONFIG_USB_TEST_MODULE)
39 /* gadget zero, for testing */
40 { USB_DEVICE(0x0525, 0xa4a0), },
43 { } /* Terminating entry */
46 static int is_targeted(struct usb_device
*dev
)
48 struct usb_device_id
*id
= whitelist_table
;
50 /* possible in developer configs only! */
51 if (!dev
->bus
->otg_port
)
54 /* HNP test device is _never_ targeted (see OTG spec 6.6.6) */
55 if ((le16_to_cpu(dev
->descriptor
.idVendor
) == 0x1a0a &&
56 le16_to_cpu(dev
->descriptor
.idProduct
) == 0xbadd))
59 /* NOTE: can't use usb_match_id() since interface caches
60 * aren't set up yet. this is cut/paste from that code.
62 for (id
= whitelist_table
; id
->match_flags
; id
++) {
63 if ((id
->match_flags
& USB_DEVICE_ID_MATCH_VENDOR
) &&
64 id
->idVendor
!= le16_to_cpu(dev
->descriptor
.idVendor
))
67 if ((id
->match_flags
& USB_DEVICE_ID_MATCH_PRODUCT
) &&
68 id
->idProduct
!= le16_to_cpu(dev
->descriptor
.idProduct
))
71 /* No need to test id->bcdDevice_lo != 0, since 0 is never
72 greater than any unsigned number. */
73 if ((id
->match_flags
& USB_DEVICE_ID_MATCH_DEV_LO
) &&
74 (id
->bcdDevice_lo
> le16_to_cpu(dev
->descriptor
.bcdDevice
)))
77 if ((id
->match_flags
& USB_DEVICE_ID_MATCH_DEV_HI
) &&
78 (id
->bcdDevice_hi
< le16_to_cpu(dev
->descriptor
.bcdDevice
)))
81 if ((id
->match_flags
& USB_DEVICE_ID_MATCH_DEV_CLASS
) &&
82 (id
->bDeviceClass
!= dev
->descriptor
.bDeviceClass
))
85 if ((id
->match_flags
& USB_DEVICE_ID_MATCH_DEV_SUBCLASS
) &&
86 (id
->bDeviceSubClass
!= dev
->descriptor
.bDeviceSubClass
))
89 if ((id
->match_flags
& USB_DEVICE_ID_MATCH_DEV_PROTOCOL
) &&
90 (id
->bDeviceProtocol
!= dev
->descriptor
.bDeviceProtocol
))
96 /* add other match criteria here ... */
99 /* OTG MESSAGE: report errors here, customize to match your product */
100 dev_err(&dev
->dev
, "device v%04x p%04x is not supported\n",
101 le16_to_cpu(dev
->descriptor
.idVendor
),
102 le16_to_cpu(dev
->descriptor
.idProduct
));
103 #ifdef CONFIG_USB_OTG_WHITELIST