Ejemplo n.º 1
0
static int
ugensa_match(device_t self)
{
	struct usb_attach_arg *uaa = device_get_ivars(self);

	if (uaa->iface == NULL)
		return UMATCH_NONE;

	/*
	 * Some devices have mass storage interfaces. What we do with these
	 * is telling them that we don't need the mass storage and then
	 * just treat them the way we should.
	 *
	 * These devices, most notably Huawei (vendor id 0x12d1) have only
	 * one interface in mass storage, and after sending them magic,
	 * they have more than one and are in the correct operating mode.
	 */

	if (uaa->vendor == 0x12d1) {
		if (uaa->nifaces > 1) {
			/*
			 * XXX: we might want to let the normal lookup handle
			 * these cases. Right now we just claim we know the
			 * device if it isn't in mass storage mode anymore.
			 */
			return UMATCH_VENDOR_IFACESUBCLASS;
		} else {
			ugensa_e220_changemode(uaa->device);
			return -1; // avoid umass to reattach (UMATCH_HIGHEST)
		}
	}

	return (usb_lookup(ugensa_devs, uaa->vendor, uaa->product) != NULL) ?
	    UMATCH_VENDOR_IFACESUBCLASS : UMATCH_NONE;
}
Ejemplo n.º 2
0
static int
u3g_match(device_t parent, cfdata_t match, void *aux)
{
	struct usbif_attach_arg *uaa = aux;
	usbd_interface_handle iface;
	usb_interface_descriptor_t *id;
	usbd_status error;

	if (!usb_lookup(u3g_devs, uaa->vendor, uaa->product))
		return (UMATCH_NONE);

	error = usbd_device2interface_handle(uaa->device, uaa->ifaceno, &iface);
	if (error) {
		printf("u3g_match: failed to get interface, err=%s\n",
		    usbd_errstr(error));
		return (UMATCH_NONE);
	}

	id = usbd_get_interface_descriptor(iface);
	if (id == NULL) {
		printf("u3g_match: failed to get interface descriptor\n");
		return (UMATCH_NONE);
	}

	/*
	 * 3G modems generally report vendor-specific class
	 *
	 * XXX: this may be too generalised.
	 */
	return ((id->bInterfaceClass == UICLASS_VENDOR) ?
	    UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
Ejemplo n.º 3
0
int
smsc_match(device_t parent, cfdata_t match, void *aux)
{
    struct usb_attach_arg *uaa = aux;

    return (usb_lookup(smsc_devs, uaa->vendor, uaa->product) != NULL) ?
           UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
}
Ejemplo n.º 4
0
int
utwitch_match(struct device *parent, void *match, void *aux)
{
	struct usb_attach_arg *uaa = aux;
	struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)uaa;

	return (usb_lookup(utwitch_devs, uha->uaa->vendor, uha->uaa->product) != NULL ?
	    UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
Ejemplo n.º 5
0
static int
ubsa_match(device_t self)
{
	struct usb_attach_arg *uaa = device_get_ivars(self);

	if (uaa->iface != NULL)
		return (UMATCH_NONE);

	return (usb_lookup(ubsa_devs, uaa->vendor, uaa->product) != NULL ?
	    UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
Ejemplo n.º 6
0
int
smsc_match(struct device *parent, void *match, void *aux)
{
	struct usb_attach_arg *uaa = aux;

	if (uaa->iface != NULL)
		return UMATCH_NONE;

	return (usb_lookup(smsc_devs, uaa->vendor, uaa->product) != NULL) ?
	    UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
}
Ejemplo n.º 7
0
int
utwitch_match(struct device *parent, void *match, void *aux)
{
	struct uhidev_attach_arg *uha = aux;

	if (uha->reportid == UHIDEV_CLAIM_ALLREPORTID)
		return (UMATCH_NONE);

	return (usb_lookup(utwitch_devs, uha->uaa->vendor, uha->uaa->product) != NULL ?
	    UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
Ejemplo n.º 8
0
static int
urio_match(device_t self)
{
    struct usb_attach_arg *uaa = device_get_ivars(self);

    DPRINTFN(10,("urio_match\n"));
    if (uaa->iface == NULL)
        return (UMATCH_NONE);

    return (usb_lookup(urio_devs, uaa->vendor, uaa->product) != NULL ?
            UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
Ejemplo n.º 9
0
int
urio_match(struct device *parent, void *match, void *aux)
{
	struct usb_attach_arg	*uaa = aux;

	DPRINTFN(50,("urio_match\n"));

	if (uaa->iface != NULL)
		return (UMATCH_NONE);

	return (usb_lookup(urio_devs, uaa->vendor, uaa->product) != NULL ?
	    UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
Ejemplo n.º 10
0
int
uslhcom_match(struct device *parent, void *match, void *aux)
{
	struct uhidev_attach_arg *uha = aux;

	/* use all report IDs */
	if (uha->reportid != UHIDEV_CLAIM_ALLREPORTID)
		return UMATCH_NONE;

	return (usb_lookup(uslhcom_devs,
			   uha->uaa->vendor, uha->uaa->product) != NULL ?
		UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
Ejemplo n.º 11
0
int
uts_match(struct device *parent, void *match, void *aux)
{
    struct usb_attach_arg *uaa = aux;
    usb_interface_descriptor_t *id;

    if (uaa->iface == NULL)
        return (UMATCH_NONE);

    /* Some eGalax touch screens are HID devices. ignore them */
    id = usbd_get_interface_descriptor(uaa->iface);
    if (id != NULL && id->bInterfaceClass == UICLASS_HID)
        return (UMATCH_NONE);

    return (usb_lookup(uts_devs, uaa->vendor, uaa->product) != NULL) ?
           UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
}
Ejemplo n.º 12
0
static int
ubt_match(device_t self)
{
	struct usb_attach_arg *uaa = device_get_ivars(self);
	usb_device_descriptor_t *dd = usbd_get_device_descriptor(uaa->device);

	DPRINTFN(50, "ubt_match\n");

	if (usb_lookup(ubt_ignore, uaa->vendor, uaa->product))
		return UMATCH_NONE;

	if (dd->bDeviceClass == UDCLASS_WIRELESS
	    && dd->bDeviceSubClass == UDSUBCLASS_RF
	    && dd->bDeviceProtocol == UDPROTO_BLUETOOTH)
		return UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO;
	return UMATCH_NONE;
}
Ejemplo n.º 13
0
/*
 * Probe chip
 */
static int
lgue_match(device_t dev)
{
	struct usb_attach_arg *uaa;
	usb_interface_descriptor_t *id;

	uaa = device_get_ivars(dev);
	if (uaa->iface == NULL)
		return(UMATCH_NONE);

	if (usb_lookup(lgue_devs, uaa->vendor, uaa->product) != NULL) {
		id = usbd_get_interface_descriptor(uaa->iface);
		if (id != NULL &&
		    id->bInterfaceClass == UICLASS_CDC &&
		    id->bInterfaceSubClass == UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL)
			return(UMATCH_VENDOR_PRODUCT);
	}
	return(UMATCH_NONE);
}
Ejemplo n.º 14
0
static int
u3g_match(device_t parent, cfdata_t match, void *aux)
{
	struct usb_attach_arg *uaa = aux;

	if (uaa->vendor == USB_VENDOR_HUAWEI)
		return u3g_huawei_reinit(uaa->device);

	if (uaa->vendor == USB_VENDOR_NOVATEL2 &&
	    uaa->product == USB_PRODUCT_NOVATEL2_MC950D_DRIVER)
		return u3g_novatel_reinit(uaa);

	if (uaa->vendor == USB_VENDOR_SIERRA &&
	    uaa->product == USB_PRODUCT_SIERRA_INSTALLER)
		return u3g_sierra_reinit(uaa->device);

	if (usb_lookup(u3g_devs, uaa->vendor, uaa->product))
		return UMATCH_VENDOR_PRODUCT;

	return UMATCH_NONE;
}
Ejemplo n.º 15
0
int
uftdi_match(struct device *parent, void *match, void *aux)
{
	struct usb_attach_arg *uaa = aux;
	int err;
	u_int8_t nifaces;

	if (usb_lookup(uftdi_devs, uaa->vendor, uaa->product) == NULL)
		return (UMATCH_NONE);

	/* Get the number of interfaces. */
	if (uaa->iface != NULL) {
		nifaces = uaa->nifaces;
	} else {
		err = usbd_set_config_index(uaa->device, UFTDI_CONFIG_INDEX, 1);
		if (err)
			return (UMATCH_NONE);
		err = usbd_interface_count(uaa->device, &nifaces);
		if (err)
			return (UMATCH_NONE);
		usbd_set_config_index(uaa->device, USB_UNCONFIG_INDEX, 1);
	}

	/* JTAG on USB interface 0 */
	if (uaa->vendor == USB_VENDOR_FTDI &&
	    uaa->product == USB_PRODUCT_FTDI_OPENRD &&
	    uaa->ifaceno == 0)
		return (UMATCH_NONE);

	if (nifaces <= 1)
		return (UMATCH_VENDOR_PRODUCT);

	/* Dual UART chip */
	if (uaa->iface != NULL)
		return (UMATCH_VENDOR_IFACESUBCLASS);
	else
		return (UMATCH_NONE);
}
Ejemplo n.º 16
0
const struct umass_quirk *
umass_lookup(u_int16_t vendor, u_int16_t product)
{
	return ((const struct umass_quirk *)
		usb_lookup(umass_quirks, vendor, product));
}