Example #1
0
static int
cdce_probe(device_t dev)
{
	struct usb_attach_arg *uaa = device_get_ivars(dev);
	int error;

	error = usbd_lookup_id_by_uaa(cdce_host_devs, sizeof(cdce_host_devs), uaa);
	if (error)
		error = usbd_lookup_id_by_uaa(cdce_dual_devs, sizeof(cdce_dual_devs), uaa);
	return (error);
}
Example #2
0
static int
uhso_probe(device_t self)
{
	struct usb_attach_arg *uaa = device_get_ivars(self);
	int error;

	if (uaa->usb_mode != USB_MODE_HOST)
		return (ENXIO);
	if (uaa->info.bConfigIndex != 0)
		return (ENXIO);
	if (uaa->info.bDeviceClass != 0xff)
		return (ENXIO);

	error = usbd_lookup_id_by_uaa(uhso_devs, sizeof(uhso_devs), uaa);
	if (error != 0)
		return (error);

	/*
	 * Probe device to see if we are able to attach
	 * to this interface or not.
	 */
	if (USB_GET_DRIVER_INFO(uaa) == UHSO_AUTO_IFACE) {
		if (uhso_probe_iface_auto(uaa->device,
		    uaa->info.bIfaceNum) == 0)
			return (ENXIO);
	}
	return (error);
}
Example #3
0
static int
uhid_probe(device_t dev)
{
	struct usb_attach_arg *uaa = device_get_ivars(dev);
	int error;

	DPRINTFN(11, "\n");

	if (uaa->usb_mode != USB_MODE_HOST)
		return (ENXIO);

	error = usbd_lookup_id_by_uaa(uhid_devs, sizeof(uhid_devs), uaa);
	if (error)
		return (error);

	if (usb_test_quirk(uaa, UQ_HID_IGNORE))
		return (ENXIO);

	/*
	 * Don't attach to mouse and keyboard devices, hence then no
	 * "nomatch" event is generated and then ums and ukbd won't
	 * attach properly when loaded.
	 */
	if ((uaa->info.bInterfaceClass == UICLASS_HID) &&
	    (uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
	    (((uaa->info.bInterfaceProtocol == UIPROTO_BOOT_KEYBOARD) &&
	      !usb_test_quirk(uaa, UQ_KBD_IGNORE)) ||
	     ((uaa->info.bInterfaceProtocol == UIPROTO_MOUSE) &&
	      !usb_test_quirk(uaa, UQ_UMS_IGNORE))))
		return (ENXIO);

	return (BUS_PROBE_GENERIC);
}
Example #4
0
static int
ipheth_probe(device_t dev)
{
	struct usb_attach_arg *uaa = device_get_ivars(dev);

	if (uaa->usb_mode != USB_MODE_HOST)
		return (ENXIO);

	return (usbd_lookup_id_by_uaa(ipheth_devs, sizeof(ipheth_devs), uaa));
}
static int
ubt_probe(device_t dev)
{
	struct usb_attach_arg	*uaa = device_get_ivars(dev);

	if (uaa->usb_mode != USB_MODE_HOST)
		return (ENXIO);

	if (uaa->info.bIfaceIndex != 0)
		return (ENXIO);

	if (uaa->use_generic == 0)
		return (ENXIO);

	if (usbd_lookup_id_by_uaa(ubt_ignore_devs,
			sizeof(ubt_ignore_devs), uaa) == 0)
		return (ENXIO);

	return (usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa));
} /* ubt_probe */
Example #6
0
static int
ubt_probe(device_t dev)
{
	struct usb_attach_arg	*uaa = device_get_ivars(dev);
	int error;

	if (uaa->usb_mode != USB_MODE_HOST)
		return (ENXIO);

	if (uaa->info.bIfaceIndex != 0)
		return (ENXIO);

	if (usbd_lookup_id_by_uaa(ubt_ignore_devs,
			sizeof(ubt_ignore_devs), uaa) == 0)
		return (ENXIO);

	error = usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa);
	if (error == 0)
		return (BUS_PROBE_GENERIC);
	return (error);
} /* ubt_probe */
Example #7
0
static int
rtwn_usb_match(device_t self)
{
	struct usb_attach_arg *uaa = device_get_ivars(self);

	if (uaa->usb_mode != USB_MODE_HOST)
		return (ENXIO);
	if (uaa->info.bConfigIndex != RTWN_CONFIG_INDEX)
		return (ENXIO);
	if (uaa->info.bIfaceIndex != RTWN_IFACE_INDEX)
		return (ENXIO);

	return (usbd_lookup_id_by_uaa(rtwn_devs, sizeof(rtwn_devs), uaa));
}
Example #8
0
static int
usie_probe(device_t self)
{
	struct usb_attach_arg *uaa = device_get_ivars(self);

	if (uaa->usb_mode != USB_MODE_HOST)
		return (ENXIO);
	if (uaa->info.bConfigIndex != USIE_CNFG_INDEX)
		return (ENXIO);
	if (uaa->info.bIfaceIndex != USIE_IFACE_INDEX)
		return (ENXIO);
	if (uaa->info.bInterfaceClass != UICLASS_VENDOR)
		return (ENXIO);

	return (usbd_lookup_id_by_uaa(usie_devs, sizeof(usie_devs), uaa));
}
Example #9
0
static void
usie_autoinst(void *arg, struct usb_device *udev,
    struct usb_attach_arg *uaa)
{
	struct usb_interface *iface;
	struct usb_interface_descriptor *id;
	struct usb_device_request req;
	int err;

	if (uaa->dev_state != UAA_DEV_READY)
		return;

	iface = usbd_get_iface(udev, 0);
	if (iface == NULL)
		return;

	id = iface->idesc;
	if (id == NULL || id->bInterfaceClass != UICLASS_MASS)
		return;

	if (usbd_lookup_id_by_uaa(usie_devs, sizeof(usie_devs), uaa) != 0)
		return;			/* no device match */

	if (bootverbose) {
		DPRINTF("Ejecting %s %s\n",
		    usb_get_manufacturer(udev),
		    usb_get_product(udev));
	}
	req.bmRequestType = UT_VENDOR;
	req.bRequest = UR_SET_INTERFACE;
	USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP);
	USETW(req.wIndex, UHF_PORT_CONNECTION);
	USETW(req.wLength, 0);

	/* at this moment there is no mutex */
	err = usbd_do_request_flags(udev, NULL, &req,
	    NULL, 0, NULL, 250 /* ms */ );

	/* success, mark the udev as disappearing */
	if (err == 0)
		uaa->dev_state = UAA_DEV_EJECTING;
}
Example #10
0
static void
uhso_test_autoinst(void *arg, struct usb_device *udev,
    struct usb_attach_arg *uaa)
{
	struct usb_interface *iface;
	struct usb_interface_descriptor *id;

	if (uaa->dev_state != UAA_DEV_READY || !uhso_autoswitch)
		return;

	iface = usbd_get_iface(udev, 0);
	if (iface == NULL)
		return;
	id = iface->idesc;
	if (id == NULL || id->bInterfaceClass != UICLASS_MASS)
		return;
	if (usbd_lookup_id_by_uaa(uhso_devs, sizeof(uhso_devs), uaa))
		return;		/* no device match */

	if (usb_msc_eject(udev, 0, MSC_EJECT_REZERO) == 0) {
		/* success, mark the udev as disappearing */
		uaa->dev_state = UAA_DEV_EJECTING;
	}
}