Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/input/usbhid.c
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
#define USB_DEBUG_VAR usbhid_debug | #define USB_DEBUG_VAR usbhid_debug | ||||
#include <dev/usb/usb_debug.h> | #include <dev/usb/usb_debug.h> | ||||
#include <dev/usb/quirk/usb_quirk.h> | #include <dev/usb/quirk/usb_quirk.h> | ||||
#include "hid_if.h" | #include "hid_if.h" | ||||
static SYSCTL_NODE(_hw_usb, OID_AUTO, usbhid, CTLFLAG_RW, 0, "USB usbhid"); | |||||
static int usbhid_enable = 0; | |||||
SYSCTL_INT(_hw_usb_usbhid, OID_AUTO, enable, CTLFLAG_RWTUN, | |||||
&usbhid_enable, 0, "Enable usbhid and prefer it to other USB HID drivers"); | |||||
#ifdef USB_DEBUG | #ifdef USB_DEBUG | ||||
static int usbhid_debug = 0; | static int usbhid_debug = 0; | ||||
static SYSCTL_NODE(_hw_usb, OID_AUTO, usbhid, CTLFLAG_RW, 0, "USB usbhid"); | |||||
SYSCTL_INT(_hw_usb_usbhid, OID_AUTO, debug, CTLFLAG_RWTUN, | SYSCTL_INT(_hw_usb_usbhid, OID_AUTO, debug, CTLFLAG_RWTUN, | ||||
&usbhid_debug, 0, "Debug level"); | &usbhid_debug, 0, "Debug level"); | ||||
#endif | #endif | ||||
enum { | enum { | ||||
USBHID_INTR_OUT_DT, | USBHID_INTR_OUT_DT, | ||||
USBHID_INTR_IN_DT, | USBHID_INTR_IN_DT, | ||||
USBHID_CTRL_DT, | USBHID_CTRL_DT, | ||||
▲ Show 20 Lines • Show All 569 Lines • ▼ Show 20 Lines | |||||
usbhid_probe(device_t dev) | usbhid_probe(device_t dev) | ||||
{ | { | ||||
struct usb_attach_arg *uaa = device_get_ivars(dev); | struct usb_attach_arg *uaa = device_get_ivars(dev); | ||||
struct usbhid_softc *sc = device_get_softc(dev); | struct usbhid_softc *sc = device_get_softc(dev); | ||||
int error; | int error; | ||||
DPRINTFN(11, "\n"); | DPRINTFN(11, "\n"); | ||||
if (usbhid_enable == 0) | |||||
return (ENXIO); | |||||
if (uaa->usb_mode != USB_MODE_HOST) | if (uaa->usb_mode != USB_MODE_HOST) | ||||
return (ENXIO); | return (ENXIO); | ||||
error = usbd_lookup_id_by_uaa(usbhid_devs, sizeof(usbhid_devs), uaa); | error = usbd_lookup_id_by_uaa(usbhid_devs, sizeof(usbhid_devs), uaa); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
if (usb_test_quirk(uaa, UQ_HID_IGNORE)) | if (usb_test_quirk(uaa, UQ_HID_IGNORE)) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* | /* | ||||
* Setup temporary hid_device_info so that we can figure out some | * Setup temporary hid_device_info so that we can figure out some | ||||
* basic quirks for this device. | * basic quirks for this device. | ||||
*/ | */ | ||||
usbhid_init_device_info(uaa, &sc->sc_hw); | usbhid_init_device_info(uaa, &sc->sc_hw); | ||||
if (hid_test_quirk(&sc->sc_hw, HQ_HID_IGNORE)) | if (hid_test_quirk(&sc->sc_hw, HQ_HID_IGNORE)) | ||||
return (ENXIO); | return (ENXIO); | ||||
#ifdef USBHID_ENABLED | |||||
return (BUS_PROBE_GENERIC + 1); | return (BUS_PROBE_GENERIC + 1); | ||||
#else | |||||
return (BUS_PROBE_GENERIC - 1); | |||||
#endif | |||||
} | } | ||||
static int | static int | ||||
usbhid_attach(device_t dev) | usbhid_attach(device_t dev) | ||||
{ | { | ||||
struct usb_attach_arg *uaa = device_get_ivars(dev); | struct usb_attach_arg *uaa = device_get_ivars(dev); | ||||
struct usbhid_softc *sc = device_get_softc(dev); | struct usbhid_softc *sc = device_get_softc(dev); | ||||
device_t child; | device_t child; | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | static driver_t usbhid_driver = { | ||||
.size = sizeof(struct usbhid_softc), | .size = sizeof(struct usbhid_softc), | ||||
}; | }; | ||||
DRIVER_MODULE(usbhid, uhub, usbhid_driver, usbhid_devclass, NULL, 0); | DRIVER_MODULE(usbhid, uhub, usbhid_driver, usbhid_devclass, NULL, 0); | ||||
MODULE_DEPEND(usbhid, usb, 1, 1, 1); | MODULE_DEPEND(usbhid, usb, 1, 1, 1); | ||||
MODULE_DEPEND(usbhid, hid, 1, 1, 1); | MODULE_DEPEND(usbhid, hid, 1, 1, 1); | ||||
MODULE_DEPEND(usbhid, hidbus, 1, 1, 1); | MODULE_DEPEND(usbhid, hidbus, 1, 1, 1); | ||||
MODULE_VERSION(usbhid, 1); | MODULE_VERSION(usbhid, 1); | ||||
#ifdef USBHID_ENABLED | |||||
USB_PNP_HOST_INFO(usbhid_devs); | USB_PNP_HOST_INFO(usbhid_devs); | ||||
#endif |