- Export more USB device ID's.

MFC after:	3 days
This commit is contained in:
Hans Petter Selasky 2011-06-24 19:32:29 +00:00
parent d43ffe9465
commit 9cfbe3e76b
4 changed files with 49 additions and 49 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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