G'day,
I have looked at the HID code, and there are some applications where it may
not be necessary to include the hid input code (for example, embedded
monitoring of a hid device).
The attached patch introduces an additional option CONFIG_USB_HIDINPUT, that
determines whether the hid module includes input support, or not. If not
defined (and CONFIG_USB_HIDDEV is defined), then devices get mapped to
/dev/usb/hiddevX.
With both CONFIG_USB_HIDDEV and CONFIG_USB_HIDINPUT:
-rw-rw-r-- 1 bradh bradh 25824 Mar 31 21:08 drivers/usb/hid.o
With just CONFIG_USB_HIDDEV:
-rw-rw-r-- 1 bradh bradh 20384 Mar 31 21:40 drivers/usb/hid.o
With just CONFIG_USB_HIDINPUT:
-rw-rw-r-- 1 bradh bradh 18554 Mar 31 21:43 drivers/usb/hid.o
I originally did this while looking for ways to demonstrate how to do hiddev
output testing. One of the few devices that everyone has is a usb keyboard
with LEDs.
If this patch goes in, a lot of people (who don't bother to "make oldconfig")
are going to find that their USB keyboard and mouse don't work. I recommend
we add the FAQ when the patch goes in.
<quote>
Q. I upgraded to 2.4.X, and my USB keyboard/mouse/joystick doesn't work. It
worked fine in a previous version!
A. You need to enable "HID input layer support" in "USB support", and rebuild
the kernel.
</quote>
Let me know what you think.
Brad
diff -Naur -X dontdiff linux-2.4.19-pre5-clean/Documentation/Configure.help linux-2.4.19-pre5-hidinputconfig/Documentation/Configure.help
--- linux-2.4.19-pre5-clean/Documentation/Configure.help Sat Mar 30 21:42:40 2002
+++ linux-2.4.19-pre5-hidinputconfig/Documentation/Configure.help Sat Mar 30 21:52:43 2002
@@ -12922,9 +12922,13 @@
CONFIG_USB_HID
Say Y here if you want full HID support to connect keyboards,
mice, joysticks, graphic tablets, or any other HID based devices
- to your computer via USB. You can't use this driver and the
- HIDBP (Boot Protocol) keyboard and mouse drivers at the same time.
- More information is available: <file:Documentation/input/input.txt>.
+ to your computer via USB. You also need to select HID Input layer
+ support (below) if you want to use keyboards, mice, joysticks and
+ the like.
+
+ You can't use this driver and the HIDBP (Boot Protocol) keyboard
+ and mouse drivers at the same time. More information is available:
+ <file:Documentation/input/input.txt>.
If unsure, say Y.
@@ -12933,6 +12937,14 @@
The module will be called hid.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
+USB HID Input layer support
+CONFIG_USB_HIDINPUT
+ Say Y here if you want to use a USB keyboard, mouse or joystick,
+ or any other HID input device. You also need Input layer support,
+ (CONFIG_INPUT) which you select under "Input core support".
+
+ If unsure, say Y.
+
/dev/usb/hiddev raw HID device support
CONFIG_USB_HIDDEV
Say Y here if you want to support HID devices (from the USB
@@ -12943,33 +12955,37 @@
event interface on /dev/usb/hiddevX (char 180:96 to 180:111).
This driver requires CONFIG_USB_HID.
- If unsure, say N.
+ If unsure, say Y.
USB HIDBP Keyboard (basic) support
CONFIG_USB_KBD
- Say Y here if you don't want to use the generic HID driver for your
- USB keyboard and prefer to use the keyboard in its limited Boot
- Protocol mode instead. This driver is much smaller than the HID one.
+ Say Y here only if you are absolutely sure that you don't want
+ to use the generic HID driver for your USB keyboard and prefer
+ to use the keyboard in its limited Boot Protocol mode instead.
+
+ This is almost certainly not what you want.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usbkbd.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
- If unsure, say N.
+ If even remotely unsure, say N.
USB HIDBP Mouse (basic) support
CONFIG_USB_MOUSE
- Say Y here if you don't want to use the generic HID driver for your
- USB mouse and prefer to use the mouse in its limited Boot Protocol
- mode instead. This driver is much smaller than the HID one.
+ Say Y here only if you are absolutely sure that you don't want
+ to use the generic HID driver for your USB keyboard and prefer
+ to use the keyboard in its limited Boot Protocol mode instead.
+
+ This is almost certainly not what you want.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usbmouse.o. If you want to compile it as
a module, say M here and read <file:Documentation/modules.txt>.
- If unsure, say N.
+ If even remotely unsure, say N.
Wacom Intuos/Graphire tablet support
CONFIG_USB_WACOM
diff -Naur -X dontdiff linux-2.4.19-pre5-clean/drivers/usb/Config.in linux-2.4.19-pre5-hidinputconfig/drivers/usb/Config.in
--- linux-2.4.19-pre5-clean/drivers/usb/Config.in Sat Mar 30 21:43:30 2002
+++ linux-2.4.19-pre5-hidinputconfig/drivers/usb/Config.in Sat Mar 30 21:59:23 2002
@@ -49,17 +49,21 @@
dep_tristate ' USB Printer support' CONFIG_USB_PRINTER $CONFIG_USB
comment 'USB Human Interface Devices (HID)'
+ dep_tristate ' USB Human Interface Device (full HID) support' CONFIG_USB_HID $CONFIG_USB
if [ "$CONFIG_INPUT" = "n" ]; then
- comment ' Input core support is needed for USB HID'
- else
- dep_tristate ' USB Human Interface Device (full HID) support' CONFIG_USB_HID $CONFIG_USB $CONFIG_INPUT
- dep_mbool ' /dev/hiddev raw HID device support (EXPERIMENTAL)' CONFIG_USB_HIDDEV $CONFIG_USB_HID
- if [ "$CONFIG_USB_HID" != "y" ]; then
- dep_tristate ' USB HIDBP Keyboard (basic) support' CONFIG_USB_KBD $CONFIG_USB $CONFIG_INPUT
- dep_tristate ' USB HIDBP Mouse (basic) support' CONFIG_USB_MOUSE $CONFIG_USB $CONFIG_INPUT
- fi
- dep_tristate ' Wacom Intuos/Graphire tablet support' CONFIG_USB_WACOM $CONFIG_USB $CONFIG_INPUT
+ comment ' Input core support is needed for USB HID input layer support'
fi
+ dep_mbool ' HID input layer support' CONFIG_USB_HIDINPUT $CONFIG_INPUT $CONFIG_USB_HID
+ dep_mbool ' /dev/hiddev raw HID device support' CONFIG_USB_HIDDEV $CONFIG_USB_HID
+
+ if [ "$CONFIG_INPUT" = "n" ]; then
+ comment ' Input core support is needed for USB HIDBP'
+ fi
+ if [ "$CONFIG_USB_HID" != "y" ]; then
+ dep_tristate ' USB HIDBP Keyboard (basic) support' CONFIG_USB_KBD $CONFIG_USB $CONFIG_INPUT
+ dep_tristate ' USB HIDBP Mouse (basic) support' CONFIG_USB_MOUSE $CONFIG_USB $CONFIG_INPUT
+ fi
+ dep_tristate ' Wacom Intuos/Graphire tablet support' CONFIG_USB_WACOM $CONFIG_USB $CONFIG_INPUT
comment 'USB Imaging devices'
dep_tristate ' USB Kodak DC-2xx Camera support' CONFIG_USB_DC2XX $CONFIG_USB
diff -Naur -X dontdiff linux-2.4.19-pre5-clean/drivers/usb/Makefile linux-2.4.19-pre5-hidinputconfig/drivers/usb/Makefile
--- linux-2.4.19-pre5-clean/drivers/usb/Makefile Sat Mar 30 21:43:30 2002
+++ linux-2.4.19-pre5-hidinputconfig/drivers/usb/Makefile Sat Mar 30 21:52:44 2002
@@ -16,7 +16,7 @@
list-multi := usbcore.o hid.o pwc.o
usbcore-objs := usb.o usb-debug.o hub.o
-hid-objs := hid-core.o hid-input.o
+hid-objs := hid-core.o
pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
@@ -30,6 +30,10 @@
hid-objs += hiddev.o
endif
+ifeq ($(CONFIG_USB_HIDINPUT),y)
+ hid-objs += hid-input.o
+endif
+
# Object file lists.
obj-y :=
diff -Naur -X dontdiff linux-2.4.19-pre5-clean/drivers/usb/hid-core.c linux-2.4.19-pre5-hidinputconfig/drivers/usb/hid-core.c
--- linux-2.4.19-pre5-clean/drivers/usb/hid-core.c Sat Mar 30 21:43:30 2002
+++ linux-2.4.19-pre5-hidinputconfig/drivers/usb/hid-core.c Sun Mar 31 19:12:56 2002
@@ -733,8 +733,10 @@
static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)
{
hid_dump_input(usage, value);
+#ifdef CONFIG_USB_HIDINPUT
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_hid_event(hid, field, usage, value);
+#endif
#ifdef CONFIG_USB_HIDDEV
if (hid->claimed & HID_CLAIMED_HIDDEV)
hiddev_hid_event(hid, usage->hid, value);
@@ -1236,9 +1238,10 @@
hid_init_reports(hid);
hid_dump_device(hid);
-
+#ifdef CONFIG_USB_HIDINPUT
if (!hidinput_connect(hid))
hid->claimed |= HID_CLAIMED_INPUT;
+#endif
#ifdef CONFIG_USB_HIDDEV
if (!hiddev_connect(hid))
hid->claimed |= HID_CLAIMED_HIDDEV;
@@ -1272,9 +1275,10 @@
dbg("cleanup called");
usb_unlink_urb(&hid->urb);
-
+#ifdef CONFIG_USB_HIDINPUT
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_disconnect(hid);
+#endif
#ifdef CONFIG_USB_HIDDEV
if (hid->claimed & HID_CLAIMED_HIDDEV)
hiddev_disconnect(hid);
diff -Naur -X dontdiff linux-2.4.19-pre5-clean/drivers/usb/hid.h linux-2.4.19-pre5-hidinputconfig/drivers/usb/hid.h
--- linux-2.4.19-pre5-clean/drivers/usb/hid.h Sun Mar 31 18:25:48 2002
+++ linux-2.4.19-pre5-hidinputconfig/drivers/usb/hid.h Sun Mar 31 18:49:26 2002
@@ -365,7 +365,11 @@
#endif
+#ifdef CONFIG_USB_HIDINPUT
#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || ( a == 0x000c0001))
+#else
+#define IS_INPUT_APPLICATION(a) (0)
+#endif
int hid_open(struct hid_device *);
void hid_close(struct hid_device *);