summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-06-24 19:32:29 +0000
committerhselasky <hselasky@FreeBSD.org>2011-06-24 19:32:29 +0000
commit72142e46137809c92085360ce8a3ea21853b1424 (patch)
tree2ec744bbb1552f2eaa31ef5ae3f7c81bf740db7c /sys/dev
parentccf732af88ac42a2b291b4e8139c70efbca3494f (diff)
downloadFreeBSD-src-72142e46137809c92085360ce8a3ea21853b1424.zip
FreeBSD-src-72142e46137809c92085360ce8a3ea21853b1424.tar.gz
- Export more USB device ID's.
MFC after: 3 days
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/misc/udbp.c41
-rw-r--r--sys/dev/usb/misc/ufm.c18
-rw-r--r--sys/dev/usb/serial/ufoma.c30
-rw-r--r--sys/dev/usb/serial/umodem.c9
4 files changed, 49 insertions, 49 deletions
diff --git a/sys/dev/usb/misc/udbp.c b/sys/dev/usb/misc/udbp.c
index 38a4fee..1a72cae 100644
--- a/sys/dev/usb/misc/udbp.c
+++ b/sys/dev/usb/misc/udbp.c
@@ -288,40 +288,27 @@ udbp_modload(module_t mod, int event, void *data)
return (error);
}
+static const STRUCT_USB_HOST_ID udbp_devs[] = {
+ {USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_TURBOCONNECT, 0)},
+ {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2301, 0)},
+ {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2302, 0)},
+ {USB_VPI(USB_VENDOR_ANCHOR, USB_PRODUCT_ANCHOR_EZLINK, 0)},
+ {USB_VPI(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL620USB, 0)},
+};
+
static int
udbp_probe(device_t dev)
{
struct usb_attach_arg *uaa = device_get_ivars(dev);
- if (uaa->usb_mode != USB_MODE_HOST) {
+ if (uaa->usb_mode != USB_MODE_HOST)
+ return (ENXIO);
+ if (uaa->info.bConfigIndex != 0)
+ return (ENXIO);
+ if (uaa->info.bIfaceIndex != 0)
return (ENXIO);
- }
- /*
- * XXX Julian, add the id of the device if you have one to test
- * things with. run 'usbdevs -v' and note the 3 ID's that appear.
- * The Vendor Id and Product Id are in hex and the Revision Id is in
- * bcd. But as usual if the revision is 0x101 then you should
- * compare the revision id in the device descriptor with 0x101 Or go
- * search the file usbdevs.h. Maybe the device is already in there.
- */
- if (((uaa->info.idVendor == USB_VENDOR_NETCHIP) &&
- (uaa->info.idProduct == USB_PRODUCT_NETCHIP_TURBOCONNECT)))
- return (0);
-
- if (((uaa->info.idVendor == USB_VENDOR_PROLIFIC) &&
- ((uaa->info.idProduct == USB_PRODUCT_PROLIFIC_PL2301) ||
- (uaa->info.idProduct == USB_PRODUCT_PROLIFIC_PL2302))))
- return (0);
-
- if ((uaa->info.idVendor == USB_VENDOR_ANCHOR) &&
- (uaa->info.idProduct == USB_PRODUCT_ANCHOR_EZLINK))
- return (0);
-
- if ((uaa->info.idVendor == USB_VENDOR_GENESYS) &&
- (uaa->info.idProduct == USB_PRODUCT_GENESYS_GL620USB))
- return (0);
- return (ENXIO);
+ return (usbd_lookup_id_by_uaa(udbp_devs, sizeof(udbp_devs), uaa));
}
static int
diff --git a/sys/dev/usb/misc/ufm.c b/sys/dev/usb/misc/ufm.c
index 75e2b7f..11bea65 100644
--- a/sys/dev/usb/misc/ufm.c
+++ b/sys/dev/usb/misc/ufm.c
@@ -118,19 +118,23 @@ DRIVER_MODULE(ufm, uhub, ufm_driver, ufm_devclass, NULL, 0);
MODULE_DEPEND(ufm, usb, 1, 1, 1);
MODULE_VERSION(ufm, 1);
+static const STRUCT_USB_HOST_ID ufm_devs[] = {
+ {USB_VPI(USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_FMRADIO, 0)},
+};
+
static int
ufm_probe(device_t dev)
{
struct usb_attach_arg *uaa = device_get_ivars(dev);
- if (uaa->usb_mode != USB_MODE_HOST) {
+ if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
- }
- if ((uaa->info.idVendor == USB_VENDOR_CYPRESS) &&
- (uaa->info.idProduct == USB_PRODUCT_CYPRESS_FMRADIO)) {
- return (0);
- }
- return (ENXIO);
+ if (uaa->info.bConfigIndex != 0)
+ return (ENXIO);
+ if (uaa->info.bIfaceIndex != 0)
+ return (ENXIO);
+
+ return (usbd_lookup_id_by_uaa(ufm_devs, sizeof(ufm_devs), uaa));
}
static int
diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c
index a32fd47..31be85c 100644
--- a/sys/dev/usb/serial/ufoma.c
+++ b/sys/dev/usb/serial/ufoma.c
@@ -327,6 +327,11 @@ MODULE_DEPEND(ufoma, ucom, 1, 1, 1);
MODULE_DEPEND(ufoma, usb, 1, 1, 1);
MODULE_VERSION(ufoma, 1);
+static const STRUCT_USB_HOST_ID ufoma_devs[] = {
+ {USB_IFACE_CLASS(UICLASS_CDC),
+ USB_IFACE_SUBCLASS(UISUBCLASS_MCPC),},
+};
+
static int
ufoma_probe(device_t dev)
{
@@ -334,30 +339,31 @@ ufoma_probe(device_t dev)
struct usb_interface_descriptor *id;
struct usb_config_descriptor *cd;
usb_mcpc_acm_descriptor *mad;
+ int error;
- if (uaa->usb_mode != USB_MODE_HOST) {
+ if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
- }
+
+ error = usbd_lookup_id_by_uaa(ufoma_devs, sizeof(ufoma_devs), uaa);
+ if (error)
+ return (error);
+
id = usbd_get_interface_descriptor(uaa->iface);
cd = usbd_get_config_descriptor(uaa->device);
- if ((id == NULL) ||
- (cd == NULL) ||
- (id->bInterfaceClass != UICLASS_CDC) ||
- (id->bInterfaceSubClass != UISUBCLASS_MCPC)) {
+ if (id == NULL || cd == NULL)
return (ENXIO);
- }
+
mad = ufoma_get_intconf(cd, id, UDESC_VS_INTERFACE, UDESCSUB_MCPC_ACM);
- if (mad == NULL) {
+ if (mad == NULL)
return (ENXIO);
- }
+
#ifndef UFOMA_HANDSFREE
if ((mad->bType == UMCPC_ACM_TYPE_AB5) ||
- (mad->bType == UMCPC_ACM_TYPE_AB6)) {
+ (mad->bType == UMCPC_ACM_TYPE_AB6))
return (ENXIO);
- }
#endif
- return (0);
+ return (BUS_PROBE_GENERIC);
}
static int
diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c
index 92bfe93..ed5162f 100644
--- a/sys/dev/usb/serial/umodem.c
+++ b/sys/dev/usb/serial/umodem.c
@@ -276,11 +276,14 @@ umodem_probe(device_t dev)
DPRINTFN(11, "\n");
- if (uaa->usb_mode != USB_MODE_HOST) {
+ if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
- }
+
error = usbd_lookup_id_by_uaa(umodem_devs, sizeof(umodem_devs), uaa);
- return (error);
+ if (error)
+ return (error);
+
+ return (BUS_PROBE_GENERIC);
}
static int
OpenPOWER on IntegriCloud