diff options
author | Vladimir Kondratyev <wulf@FreeBSD.org> | 2021-01-12 19:36:21 +0000 |
---|---|---|
committer | Vladimir Kondratyev <wulf@FreeBSD.org> | 2021-01-14 20:04:47 +0000 |
commit | b62f6dfaed3d0189c1853f26b773c3afed203463 (patch) | |
tree | 0948e3cf32d0de0766ebd25567b30e44ce9a2260 | |
parent | d2b3ceddccac60b563f642898e3a314647666a10 (diff) | |
download | src-b62f6dfaed3d.tar.gz src-b62f6dfaed3d.zip |
hid: Replace USBHID_ENABLED kernel config option with loader tunable
usbhid(4) is disabled by default to avoid conflicts with existing USB HID
drivers. To enable it place following lines to /boot/loader.conf:
hw.usb.usbhid.enable=1
usbhid_load="YES"
Suggested by: jhb
Reviewed by: hselasky
Differential revision: https://reviews.freebsd.org/D28124
-rw-r--r-- | share/man/man4/usbhid.4 | 9 | ||||
-rw-r--r-- | sys/amd64/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/conf/NOTES | 3 | ||||
-rw-r--r-- | sys/conf/options | 1 | ||||
-rw-r--r-- | sys/dev/usb/input/uhid.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/input/ukbd.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/input/ums.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/input/usbhid.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/input/wmt.c | 4 | ||||
-rw-r--r-- | sys/i386/conf/GENERIC | 3 |
10 files changed, 15 insertions, 29 deletions
diff --git a/share/man/man4/usbhid.4 b/share/man/man4/usbhid.4 index a8905dc76ea8..1b9e61ce1cad 100644 --- 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 @@ variables and .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 index 393fec26d423..c9ab23bb91b5 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -385,6 +385,3 @@ device uinput # install /dev/uinput cdev 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 index b377f845e793..1a8059a2e5c0 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2594,9 +2594,6 @@ options UVSCOM_DEFAULT_OPKTSIZE=8 # default output packet size 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 index e69ee92d1136..77979b72fe58 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -669,7 +669,6 @@ UKBD_DFLT_KEYMAP opt_ukbd.h 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 index e5eae534a6d0..97f9b1c8edea 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -923,6 +923,4 @@ DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); 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 index 0edacbefcbfc..3314a3b3e70f 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -2192,6 +2192,4 @@ MODULE_DEPEND(ukbd, hid, 1, 1, 1); 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 index 248478770942..6b7c3d526ad0 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -1220,6 +1220,4 @@ MODULE_DEPEND(ums, hid, 1, 1, 1); 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 index ab856dc14d75..70b1f4ae99c2 100644 --- a/sys/dev/usb/input/usbhid.c +++ b/sys/dev/usb/input/usbhid.c @@ -75,10 +75,12 @@ __FBSDID("$FreeBSD$"); #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 @@ usbhid_probe(device_t dev) DPRINTFN(11, "\n"); + if (usbhid_enable == 0) + return (ENXIO); + if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); @@ -683,11 +688,7 @@ usbhid_probe(device_t dev) 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, usb, 1, 1, 1); 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 index 79ed5a2b8f82..8191c6ff9369 100644 --- a/sys/dev/usb/input/wmt.c +++ b/sys/dev/usb/input/wmt.c @@ -1009,13 +1009,11 @@ wmt_set_input_mode(struct wmt_softc *sc, enum wmt_input_mode mode) 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, usb, 1, 1, 1); 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 index b65235ca9668..9ce338f5a181 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -354,6 +354,3 @@ device uinput # install /dev/uinput cdev 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 |