[PATCH] Generic HID layer - hiddev
authorJiri Kosina <jkosina@suse.cz>
Fri, 8 Dec 2006 17:41:10 +0000 (18:41 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Dec 2006 18:43:15 +0000 (10:43 -0800)
- hiddev is USB-only (agreed with Marcel Holtmann that Bluetooth currently
  doesn't need it, and future planned interface (rawhid) will be more flexible
  and usable)
- both HID and USB-hid can be now compiled as modules (wasn't possible before
  hiddev was fully separated from generic HID layer)

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/hid/hid-core.c
drivers/usb/input/hid-core.c
include/linux/hid.h

index 8474a7923322186e6da86ad5ef07456443f2c693..1dd9e4f0df1eb2cee1ee7a097f499b9ac9013ab7 100644 (file)
@@ -819,8 +819,8 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s
        hid_dump_input(usage, value);
        if (hid->claimed & HID_CLAIMED_INPUT)
                hidinput_hid_event(hid, field, usage, value);
-       if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt)
-               hiddev_hid_event(hid, field, usage, value);
+       if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
 }
 
 /*
@@ -940,3 +940,5 @@ int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
 }
 EXPORT_SYMBOL_GPL(hid_set_field);
 
+MODULE_LICENSE(DRIVER_LICENSE);
+
index 0991c4b751a6491667eb12b284570c7a9ba08322..4fc828041d0f96c03c03d6f7c159905f612367d9 100644 (file)
@@ -1284,6 +1284,9 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
        hid->hidinput_input_event = usb_hidinput_input_event;
        hid->hidinput_open = hidinput_open;
        hid->hidinput_close = hidinput_close;
+#ifdef CONFIG_USB_HIDDEV
+       hid->hiddev_hid_event = hiddev_hid_event;
+#endif
 
        return hid;
 
index fc6f74228da36640e155dfd797d4a4f258adab1d..5a969a137b8573064f361ba9028015b544492d38 100644 (file)
@@ -433,6 +433,10 @@ struct hid_device {                                                        /* device report descriptor */
        int (*hidinput_open) (struct input_dev *);
        void (*hidinput_close) (struct input_dev *);
 
+       /* hiddev event handler */
+       void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
+                                 struct hid_usage *, __s32);
+
 #ifdef CONFIG_USB_HIDINPUT_POWERBOOK
        unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
        unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
@@ -477,13 +481,9 @@ struct hid_descriptor {
 #define resolv_event(a,b)      do { } while (0)
 #endif
 
-#ifdef CONFIG_HID
 /* Applications from HID Usage Tables 4/8/99 Version 1.1 */
 /* We ignore a few input applications that are not widely used */
 #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001))
-#else
-#define IS_INPUT_APPLICATION(a) (0)
-#endif
 
 /* HID core API */
 extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);