mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Use usb_lookup instead of rolling our own.
Suggested by: Lennart Augustsson <lennart@augustsson.net>
This commit is contained in:
parent
3be63aef6f
commit
990e9fea48
1 changed files with 4 additions and 13 deletions
|
|
@ -211,16 +211,13 @@ struct ucom_callback uvscom_callback = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static const struct uvscom_product {
|
||||
uint16_t vendor;
|
||||
uint16_t product;
|
||||
} uvscom_products [] = {
|
||||
static const struct usb_devno uvscom_devs [] = {
|
||||
/* SUNTAC U-Cable type P1 */
|
||||
{ USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_PS64P1 },
|
||||
/* SUNTAC Slipper U */
|
||||
{ USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_VS10U },
|
||||
{ 0, 0 }
|
||||
};
|
||||
#define uvscom_lookup(v, p) usb_lookup(uvscom_devs, v, p)
|
||||
|
||||
Static device_probe_t uvscom_match;
|
||||
Static device_attach_t uvscom_attach;
|
||||
|
|
@ -247,18 +244,12 @@ MODULE_VERSION(uvscom, UVSCOM_MODVER);
|
|||
USB_MATCH(uvscom)
|
||||
{
|
||||
USB_MATCH_START(uvscom, uaa);
|
||||
int i;
|
||||
|
||||
if (uaa->iface != NULL)
|
||||
return (UMATCH_NONE);
|
||||
|
||||
for (i = 0; uvscom_products[i].vendor != 0; i++) {
|
||||
if (uvscom_products[i].vendor == uaa->vendor &&
|
||||
uvscom_products[i].product == uaa->product) {
|
||||
return (UMATCH_VENDOR_PRODUCT);
|
||||
}
|
||||
}
|
||||
return (UMATCH_NONE);
|
||||
return (uvscom_lookup(uaa->vendor, uaa->product) != NULL ?
|
||||
UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
|
||||
}
|
||||
|
||||
USB_ATTACH(uvscom)
|
||||
|
|
|
|||
Loading…
Reference in a new issue