diff --git a/share/man/man4/usbhid.4 b/share/man/man4/usbhid.4 --- a/share/man/man4/usbhid.4 +++ b/share/man/man4/usbhid.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 21, 2020 +.Dd January 12, 2021 .Dt USBHID 4 .Os .Sh NAME @@ -54,6 +54,13 @@ .Xr loader 8 tunables: .Bl -tag -width indent +.It Va hw.usb.usbhid.enable +Enable +.Nm +and make its priority greater than other USB HID drivers have. +Default is 0. +.El +.Bl -tag -width indent .It Va hw.usb.usbhid.debug Debug output level, where 0 is debugging disabled and larger values increase debug message verbosity. diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -385,6 +385,3 @@ options HID_DEBUG # enable debug msgs device hid # Generic HID support options IICHID_SAMPLING # Workaround missing GPIO INTR support -#device usbhid # USB transport support. -#device hidbus # HID bus (required by usbhid/iichid) -#options USBHID_ENABLED # Prefer usbhid to other USB drivers diff --git a/sys/conf/NOTES b/sys/conf/NOTES --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2594,9 +2594,6 @@ options UVSCOM_INTR_INTERVAL=100 # interrupt pipe interval # in milliseconds -# options for usbhid: -options USBHID_ENABLED # Prefer usbhid to other USBHID drivers - ##################################################################### # FireWire support diff --git a/sys/conf/options b/sys/conf/options --- a/sys/conf/options +++ b/sys/conf/options @@ -669,7 +669,6 @@ UPLCOM_INTR_INTERVAL opt_uplcom.h UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h UVSCOM_INTR_INTERVAL opt_uvscom.h -USBHID_ENABLED opt_usb.h # options for the Realtek rtwn driver RTWN_DEBUG opt_rtwn.h diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -923,6 +923,4 @@ MODULE_DEPEND(uhid, usb, 1, 1, 1); MODULE_DEPEND(uhid, hid, 1, 1, 1); MODULE_VERSION(uhid, 1); -#ifndef USBHID_ENABLED USB_PNP_HOST_INFO(uhid_devs); -#endif diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -2192,6 +2192,4 @@ MODULE_DEPEND(ukbd, evdev, 1, 1, 1); #endif MODULE_VERSION(ukbd, 1); -#ifndef USBHID_ENABLED USB_PNP_HOST_INFO(ukbd_devs); -#endif diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -1220,6 +1220,4 @@ MODULE_DEPEND(ums, evdev, 1, 1, 1); #endif MODULE_VERSION(ums, 1); -#ifndef USBHID_ENABLED USB_PNP_HOST_INFO(ums_devs); -#endif diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c --- a/sys/dev/usb/input/usbhid.c +++ b/sys/dev/usb/input/usbhid.c @@ -75,10 +75,12 @@ #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 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, &usbhid_debug, 0, "Debug level"); #endif @@ -664,6 +666,9 @@ DPRINTFN(11, "\n"); + if (usbhid_enable == 0) + return (ENXIO); + if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -683,11 +688,7 @@ if (hid_test_quirk(&sc->sc_hw, HQ_HID_IGNORE)) return (ENXIO); -#ifdef USBHID_ENABLED return (BUS_PROBE_GENERIC + 1); -#else - return (BUS_PROBE_GENERIC - 1); -#endif } static int @@ -781,6 +782,4 @@ MODULE_DEPEND(usbhid, hid, 1, 1, 1); MODULE_DEPEND(usbhid, hidbus, 1, 1, 1); MODULE_VERSION(usbhid, 1); -#ifdef USBHID_ENABLED USB_PNP_HOST_INFO(usbhid_devs); -#endif diff --git a/sys/dev/usb/input/wmt.c b/sys/dev/usb/input/wmt.c --- a/sys/dev/usb/input/wmt.c +++ b/sys/dev/usb/input/wmt.c @@ -1009,13 +1009,11 @@ return (err); } -#ifndef USBHID_ENABLED static const STRUCT_USB_HOST_ID wmt_devs[] = { /* generic HID class w/o boot interface */ {USB_IFACE_CLASS(UICLASS_HID), USB_IFACE_SUBCLASS(0),}, }; -#endif static devclass_t wmt_devclass; @@ -1038,6 +1036,4 @@ MODULE_DEPEND(wmt, hid, 1, 1, 1); MODULE_DEPEND(wmt, evdev, 1, 1, 1); MODULE_VERSION(wmt, 1); -#ifndef USBHID_ENABLED USB_PNP_HOST_INFO(wmt_devs); -#endif diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -354,6 +354,3 @@ options HID_DEBUG # enable debug msgs device hid # Generic HID support options IICHID_SAMPLING # Workaround missing GPIO INTR support -#device usbhid # USB transport support. -#device hidbus # HID bus (required by usbhid/iichid) -#options USBHID_ENABLED # Prefer usbhid to other USB drivers