aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-14 19:35:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-14 19:35:43 -0400
commite413b210c541acac1a194085627db28a122f3bdf (patch)
tree87e0e4b338e59709b357144cc7574d67692938b9 /include/linux
parentacd15a836053ff6b48e78dc6de388b225ba9e40d (diff)
parent9be7bbd54df3c9c393ccd19acc49f90c517d1291 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (55 commits) HID: build drivers for all quirky devices by default HID: add missing blacklist entry for Apple ATV ircontrol HID: add support for Bright ABNT2 brazilian device HID: Don't let Avermedia Radio FM800 be handled by usb hid drivers HID: fix numlock led on Dell device 0x413c/0x2105 HID: remove warn() macro from usb hid drivers HID: remove info() macro from usb HID drivers HID: add appletv IR receiver quirk HID: fix a lockup regression when using force feedback on a PID device HID: hiddev.h: Fix example code. HID: hiddev.h: Fix mixed space and tabs in example code. HID: convert to dev_* prints HID: remove hid-ff HID: move zeroplus FF processing HID: move thrustmaster FF processing HID: move pantherlord FF processing HID: fix incorrent length condition in hidraw_write() HID: fix tty<->hid deadlock HID: ignore iBuddy devices HID: report descriptor fix for remaining MacBook JIS keyboards ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hid.h373
-rw-r--r--include/linux/hiddev.h46
-rw-r--r--include/linux/mod_devicetable.h10
3 files changed, 333 insertions, 96 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ac4e678a04ed..f13bca2dd53b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -67,6 +67,7 @@
67#include <linux/types.h> 67#include <linux/types.h>
68#include <linux/slab.h> 68#include <linux/slab.h>
69#include <linux/list.h> 69#include <linux/list.h>
70#include <linux/mod_devicetable.h> /* hid_device_id */
70#include <linux/timer.h> 71#include <linux/timer.h>
71#include <linux/workqueue.h> 72#include <linux/workqueue.h>
72#include <linux/input.h> 73#include <linux/input.h>
@@ -246,6 +247,19 @@ struct hid_item {
246#define HID_FEATURE_REPORT 2 247#define HID_FEATURE_REPORT 2
247 248
248/* 249/*
250 * HID connect requests
251 */
252
253#define HID_CONNECT_HIDINPUT 0x01
254#define HID_CONNECT_HIDINPUT_FORCE 0x02
255#define HID_CONNECT_HIDRAW 0x04
256#define HID_CONNECT_HIDDEV 0x08
257#define HID_CONNECT_HIDDEV_FORCE 0x10
258#define HID_CONNECT_FF 0x20
259#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \
260 HID_CONNECT_HIDDEV|HID_CONNECT_FF)
261
262/*
249 * HID device quirks. 263 * HID device quirks.
250 */ 264 */
251 265
@@ -256,48 +270,11 @@ struct hid_item {
256 270
257#define HID_QUIRK_INVERT 0x00000001 271#define HID_QUIRK_INVERT 0x00000001
258#define HID_QUIRK_NOTOUCH 0x00000002 272#define HID_QUIRK_NOTOUCH 0x00000002
259#define HID_QUIRK_IGNORE 0x00000004
260#define HID_QUIRK_NOGET 0x00000008 273#define HID_QUIRK_NOGET 0x00000008
261#define HID_QUIRK_HIDDEV 0x00000010
262#define HID_QUIRK_BADPAD 0x00000020 274#define HID_QUIRK_BADPAD 0x00000020
263#define HID_QUIRK_MULTI_INPUT 0x00000040 275#define HID_QUIRK_MULTI_INPUT 0x00000040
264#define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x00000080
265#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100
266#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200
267#define HID_QUIRK_MIGHTYMOUSE 0x00000400
268#define HID_QUIRK_APPLE_HAS_FN 0x00000800
269#define HID_QUIRK_APPLE_FN_ON 0x00001000
270#define HID_QUIRK_INVERT_HWHEEL 0x00002000
271#define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000
272#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000
273#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 276#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
274#define HID_QUIRK_IGNORE_MOUSE 0x00020000
275#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00040000
276#define HID_QUIRK_DUPLICATE_USAGES 0x00080000
277#define HID_QUIRK_RESET_LEDS 0x00100000
278#define HID_QUIRK_HIDINPUT 0x00200000
279#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
280#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
281#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
282#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
283#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
284#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
285#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 277#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
286#define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000
287
288/*
289 * Separate quirks for runtime report descriptor fixup
290 */
291
292#define HID_QUIRK_RDESC_CYMOTION 0x00000001
293#define HID_QUIRK_RDESC_LOGITECH 0x00000002
294#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
295#define HID_QUIRK_RDESC_PETALYNX 0x00000008
296#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
297#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
298#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
299#define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080
300#define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100
301 278
302/* 279/*
303 * This is the global environment of the parser. This information is 280 * This is the global environment of the parser. This information is
@@ -411,12 +388,21 @@ struct hid_report_enum {
411struct hid_control_fifo { 388struct hid_control_fifo {
412 unsigned char dir; 389 unsigned char dir;
413 struct hid_report *report; 390 struct hid_report *report;
391 char *raw_report;
392};
393
394struct hid_output_fifo {
395 struct hid_report *report;
396 char *raw_report;
414}; 397};
415 398
416#define HID_CLAIMED_INPUT 1 399#define HID_CLAIMED_INPUT 1
417#define HID_CLAIMED_HIDDEV 2 400#define HID_CLAIMED_HIDDEV 2
418#define HID_CLAIMED_HIDRAW 4 401#define HID_CLAIMED_HIDRAW 4
419 402
403#define HID_STAT_ADDED 1
404#define HID_STAT_PARSED 2
405
420#define HID_CTRL_RUNNING 1 406#define HID_CTRL_RUNNING 1
421#define HID_OUT_RUNNING 2 407#define HID_OUT_RUNNING 2
422#define HID_IN_RUNNING 3 408#define HID_IN_RUNNING 3
@@ -431,22 +417,28 @@ struct hid_input {
431 struct input_dev *input; 417 struct input_dev *input;
432}; 418};
433 419
420struct hid_driver;
421struct hid_ll_driver;
422
434struct hid_device { /* device report descriptor */ 423struct hid_device { /* device report descriptor */
435 __u8 *rdesc; 424 __u8 *rdesc;
436 unsigned rsize; 425 unsigned rsize;
437 struct hid_collection *collection; /* List of HID collections */ 426 struct hid_collection *collection; /* List of HID collections */
438 unsigned collection_size; /* Number of allocated hid_collections */ 427 unsigned collection_size; /* Number of allocated hid_collections */
439 unsigned maxcollection; /* Number of parsed collections */ 428 unsigned maxcollection; /* Number of parsed collections */
440 unsigned maxapplication; /* Number of applications */ 429 unsigned maxapplication; /* Number of applications */
441 unsigned short bus; /* BUS ID */ 430 __u16 bus; /* BUS ID */
442 unsigned short vendor; /* Vendor ID */ 431 __u32 vendor; /* Vendor ID */
443 unsigned short product; /* Product ID */ 432 __u32 product; /* Product ID */
444 unsigned version; /* HID version */ 433 __u32 version; /* HID version */
445 unsigned country; /* HID country */ 434 unsigned country; /* HID country */
446 struct hid_report_enum report_enum[HID_REPORT_TYPES]; 435 struct hid_report_enum report_enum[HID_REPORT_TYPES];
447 436
448 struct device *dev; /* device */ 437 struct device dev; /* device */
438 struct hid_driver *driver;
439 struct hid_ll_driver *ll_driver;
449 440
441 unsigned int status; /* see STAT flags above */
450 unsigned claimed; /* Claimed by hidinput, hiddev? */ 442 unsigned claimed; /* Claimed by hidinput, hiddev? */
451 unsigned quirks; /* Various quirks the device can pull on us */ 443 unsigned quirks; /* Various quirks the device can pull on us */
452 444
@@ -462,26 +454,29 @@ struct hid_device { /* device report descriptor */
462 454
463 void *driver_data; 455 void *driver_data;
464 456
465 __s32 delayed_value; /* For A4 Tech mice hwheel quirk */ 457 /* temporary hid_ff handling (until moved to the drivers) */
466 458 int (*ff_init)(struct hid_device *);
467 /* device-specific function pointers */
468 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
469 int (*hid_open) (struct hid_device *);
470 void (*hid_close) (struct hid_device *);
471 459
472 /* hiddev event handler */ 460 /* hiddev event handler */
461 int (*hiddev_connect)(struct hid_device *, unsigned int);
473 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 462 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
474 struct hid_usage *, __s32); 463 struct hid_usage *, __s32);
475 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 464 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
476 465
477 /* handler for raw output data, used by hidraw */ 466 /* handler for raw output data, used by hidraw */
478 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 467 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
479#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
480 unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
481 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];
482#endif
483}; 468};
484 469
470static inline void *hid_get_drvdata(struct hid_device *hdev)
471{
472 return dev_get_drvdata(&hdev->dev);
473}
474
475static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
476{
477 dev_set_drvdata(&hdev->dev, data);
478}
479
485#define HID_GLOBAL_STACK_SIZE 4 480#define HID_GLOBAL_STACK_SIZE 4
486#define HID_COLLECTION_STACK_SIZE 4 481#define HID_COLLECTION_STACK_SIZE 4
487 482
@@ -510,6 +505,107 @@ struct hid_descriptor {
510 struct hid_class_descriptor desc[1]; 505 struct hid_class_descriptor desc[1];
511} __attribute__ ((packed)); 506} __attribute__ ((packed));
512 507
508#define HID_DEVICE(b, ven, prod) \
509 .bus = (b), \
510 .vendor = (ven), .product = (prod)
511
512#define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod)
513#define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod)
514
515#define HID_REPORT_ID(rep) \
516 .report_type = (rep)
517#define HID_USAGE_ID(uhid, utype, ucode) \
518 .usage_hid = (uhid), .usage_type = (utype), .usage_code = (ucode)
519/* we don't want to catch types and codes equal to 0 */
520#define HID_TERMINATOR (HID_ANY_ID - 1)
521
522struct hid_report_id {
523 __u32 report_type;
524};
525struct hid_usage_id {
526 __u32 usage_hid;
527 __u32 usage_type;
528 __u32 usage_code;
529};
530
531/**
532 * struct hid_driver
533 * @name: driver name (e.g. "Footech_bar-wheel")
534 * @id_table: which devices is this driver for (must be non-NULL for probe
535 * to be called)
536 * @probe: new device inserted
537 * @remove: device removed (NULL if not a hot-plug capable driver)
538 * @report_table: on which reports to call raw_event (NULL means all)
539 * @raw_event: if report in report_table, this hook is called (NULL means nop)
540 * @usage_table: on which events to call event (NULL means all)
541 * @event: if usage in usage_table, this hook is called (NULL means nop)
542 * @report_fixup: called before report descriptor parsing (NULL means nop)
543 * @input_mapping: invoked on input registering before mapping an usage
544 * @input_mapped: invoked on input registering after mapping an usage
545 *
546 * raw_event and event should return 0 on no action performed, 1 when no
547 * further processing should be done and negative on error
548 *
549 * input_mapping shall return a negative value to completely ignore this usage
550 * (e.g. doubled or invalid usage), zero to continue with parsing of this
551 * usage by generic code (no special handling needed) or positive to skip
552 * generic parsing (needed special handling which was done in the hook already)
553 * input_mapped shall return negative to inform the layer that this usage
554 * should not be considered for further processing or zero to notify that
555 * no processing was performed and should be done in a generic manner
556 * Both these functions may be NULL which means the same behavior as returning
557 * zero from them.
558 */
559struct hid_driver {
560 char *name;
561 const struct hid_device_id *id_table;
562
563 int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
564 void (*remove)(struct hid_device *dev);
565
566 const struct hid_report_id *report_table;
567 int (*raw_event)(struct hid_device *hdev, struct hid_report *report,
568 u8 *data, int size);
569 const struct hid_usage_id *usage_table;
570 int (*event)(struct hid_device *hdev, struct hid_field *field,
571 struct hid_usage *usage, __s32 value);
572
573 void (*report_fixup)(struct hid_device *hdev, __u8 *buf,
574 unsigned int size);
575
576 int (*input_mapping)(struct hid_device *hdev,
577 struct hid_input *hidinput, struct hid_field *field,
578 struct hid_usage *usage, unsigned long **bit, int *max);
579 int (*input_mapped)(struct hid_device *hdev,
580 struct hid_input *hidinput, struct hid_field *field,
581 struct hid_usage *usage, unsigned long **bit, int *max);
582/* private: */
583 struct device_driver driver;
584};
585
586/**
587 * hid_ll_driver - low level driver callbacks
588 * @start: called on probe to start the device
589 * @stop: called on remove
590 * @open: called by input layer on open
591 * @close: called by input layer on close
592 * @hidinput_input_event: event input event (e.g. ff or leds)
593 * @parse: this method is called only once to parse the device data,
594 * shouldn't allocate anything to not leak memory
595 */
596struct hid_ll_driver {
597 int (*start)(struct hid_device *hdev);
598 void (*stop)(struct hid_device *hdev);
599
600 int (*open)(struct hid_device *hdev);
601 void (*close)(struct hid_device *hdev);
602
603 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
604 unsigned int code, int value);
605
606 int (*parse)(struct hid_device *hdev);
607};
608
513/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 609/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
514/* We ignore a few input applications that are not widely used */ 610/* We ignore a few input applications that are not widely used */
515#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) 611#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
@@ -520,43 +616,157 @@ struct hid_descriptor {
520extern int hid_debug; 616extern int hid_debug;
521#endif 617#endif
522 618
619extern int hid_add_device(struct hid_device *);
620extern void hid_destroy_device(struct hid_device *);
621
622extern int __must_check __hid_register_driver(struct hid_driver *,
623 struct module *, const char *mod_name);
624static inline int __must_check hid_register_driver(struct hid_driver *driver)
625{
626 return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
627}
628extern void hid_unregister_driver(struct hid_driver *);
629
523extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 630extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
524extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); 631extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
525extern int hidinput_connect(struct hid_device *); 632extern int hidinput_connect(struct hid_device *hid, unsigned int force);
526extern void hidinput_disconnect(struct hid_device *); 633extern void hidinput_disconnect(struct hid_device *);
527 634
528int hid_set_field(struct hid_field *, unsigned, __s32); 635int hid_set_field(struct hid_field *, unsigned, __s32);
529int hid_input_report(struct hid_device *, int type, u8 *, int, int); 636int hid_input_report(struct hid_device *, int type, u8 *, int, int);
530int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 637int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
531int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
532int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
533int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
534void hid_output_report(struct hid_report *report, __u8 *data); 638void hid_output_report(struct hid_report *report, __u8 *data);
535void hid_free_device(struct hid_device *device); 639struct hid_device *hid_allocate_device(void);
536struct hid_device *hid_parse_report(__u8 *start, unsigned size); 640int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
641int hid_connect(struct hid_device *hid, unsigned int connect_mask);
642
643/**
644 * hid_map_usage - map usage input bits
645 *
646 * @hidinput: hidinput which we are interested in
647 * @usage: usage to fill in
648 * @bit: pointer to input->{}bit (out parameter)
649 * @max: maximal valid usage->code to consider later (out parameter)
650 * @type: input event type (EV_KEY, EV_REL, ...)
651 * @c: code which corresponds to this usage and type
652 */
653static inline void hid_map_usage(struct hid_input *hidinput,
654 struct hid_usage *usage, unsigned long **bit, int *max,
655 __u8 type, __u16 c)
656{
657 struct input_dev *input = hidinput->input;
658
659 usage->type = type;
660 usage->code = c;
661
662 switch (type) {
663 case EV_ABS:
664 *bit = input->absbit;
665 *max = ABS_MAX;
666 break;
667 case EV_REL:
668 *bit = input->relbit;
669 *max = REL_MAX;
670 break;
671 case EV_KEY:
672 *bit = input->keybit;
673 *max = KEY_MAX;
674 break;
675 case EV_LED:
676 *bit = input->ledbit;
677 *max = LED_MAX;
678 break;
679 }
680}
681
682/**
683 * hid_map_usage_clear - map usage input bits and clear the input bit
684 *
685 * The same as hid_map_usage, except the @c bit is also cleared in supported
686 * bits (@bit).
687 */
688static inline void hid_map_usage_clear(struct hid_input *hidinput,
689 struct hid_usage *usage, unsigned long **bit, int *max,
690 __u8 type, __u16 c)
691{
692 hid_map_usage(hidinput, usage, bit, max, type, c);
693 clear_bit(c, *bit);
694}
695
696/**
697 * hid_parse - parse HW reports
698 *
699 * @hdev: hid device
700 *
701 * Call this from probe after you set up the device (if needed). Your
702 * report_fixup will be called (if non-NULL) after reading raw report from
703 * device before passing it to hid layer for real parsing.
704 */
705static inline int __must_check hid_parse(struct hid_device *hdev)
706{
707 int ret;
708
709 if (hdev->status & HID_STAT_PARSED)
710 return 0;
711
712 ret = hdev->ll_driver->parse(hdev);
713 if (!ret)
714 hdev->status |= HID_STAT_PARSED;
715
716 return ret;
717}
718
719/**
720 * hid_hw_start - start underlaying HW
721 *
722 * @hdev: hid device
723 * @connect_mask: which outputs to connect, see HID_CONNECT_*
724 *
725 * Call this in probe function *after* hid_parse. This will setup HW buffers
726 * and start the device (if not deffered to device open). hid_hw_stop must be
727 * called if this was successfull.
728 */
729static inline int __must_check hid_hw_start(struct hid_device *hdev,
730 unsigned int connect_mask)
731{
732 int ret = hdev->ll_driver->start(hdev);
733 if (ret || !connect_mask)
734 return ret;
735 ret = hid_connect(hdev, connect_mask);
736 if (ret)
737 hdev->ll_driver->stop(hdev);
738 return ret;
739}
740
741/**
742 * hid_hw_stop - stop underlaying HW
743 *
744 * @hdev: hid device
745 *
746 * This is usually called from remove function or from probe when something
747 * failed and hid_hw_start was called already.
748 */
749static inline void hid_hw_stop(struct hid_device *hdev)
750{
751 hdev->ll_driver->stop(hdev);
752}
753
754void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
755 int interrupt);
756
757extern int hid_generic_init(void);
758extern void hid_generic_exit(void);
537 759
538/* HID quirks API */ 760/* HID quirks API */
539u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 761u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
540int usbhid_quirks_init(char **quirks_param); 762int usbhid_quirks_init(char **quirks_param);
541void usbhid_quirks_exit(void); 763void usbhid_quirks_exit(void);
542void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); 764void usbhid_set_leds(struct hid_device *hid);
543
544#ifdef CONFIG_HID_FF
545int hid_ff_init(struct hid_device *hid);
546 765
547int hid_lgff_init(struct hid_device *hid);
548int hid_lg2ff_init(struct hid_device *hid);
549int hid_plff_init(struct hid_device *hid);
550int hid_tmff_init(struct hid_device *hid);
551int hid_zpff_init(struct hid_device *hid);
552#ifdef CONFIG_HID_PID 766#ifdef CONFIG_HID_PID
553int hid_pidff_init(struct hid_device *hid); 767int hid_pidff_init(struct hid_device *hid);
554#else 768#else
555static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } 769#define hid_pidff_init NULL
556#endif
557
558#else
559static inline int hid_ff_init(struct hid_device *hid) { return -1; }
560#endif 770#endif
561 771
562#ifdef CONFIG_HID_DEBUG 772#ifdef CONFIG_HID_DEBUG
@@ -572,10 +782,23 @@ dbg_hid(const char *fmt, ...)
572 return 0; 782 return 0;
573} 783}
574#define dbg_hid_line dbg_hid 784#define dbg_hid_line dbg_hid
575#endif 785#endif /* HID_DEBUG */
576 786
577#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 787#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
578 __FILE__ , ## arg) 788 __FILE__ , ## arg)
579#endif 789#endif /* HID_FF */
790
791#ifdef CONFIG_HID_COMPAT
792#define HID_COMPAT_LOAD_DRIVER(name) \
793void hid_compat_##name(void) { } \
794EXPORT_SYMBOL(hid_compat_##name)
795#else
796#define HID_COMPAT_LOAD_DRIVER(name)
797#endif /* HID_COMPAT */
798#define HID_COMPAT_CALL_DRIVER(name) do { \
799 extern void hid_compat_##name(void); \
800 hid_compat_##name(); \
801} while (0)
802
580#endif 803#endif
581 804
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index a416b904ba90..c760ae0eb6a1 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -182,26 +182,28 @@ struct hiddev_usage_ref_multi {
182/* To traverse the input report descriptor info for a HID device, perform the 182/* To traverse the input report descriptor info for a HID device, perform the
183 * following: 183 * following:
184 * 184 *
185 * rinfo.report_type = HID_REPORT_TYPE_INPUT; 185 * rinfo.report_type = HID_REPORT_TYPE_INPUT;
186 * rinfo.report_id = HID_REPORT_ID_FIRST; 186 * rinfo.report_id = HID_REPORT_ID_FIRST;
187 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); 187 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
188 * 188 *
189 * while (ret >= 0) { 189 * while (ret >= 0) {
190 * for (i = 0; i < rinfo.num_fields; i++) { 190 * for (i = 0; i < rinfo.num_fields; i++) {
191 * finfo.report_type = rinfo.report_type; 191 * finfo.report_type = rinfo.report_type;
192 * finfo.report_id = rinfo.report_id; 192 * finfo.report_id = rinfo.report_id;
193 * finfo.field_index = i; 193 * finfo.field_index = i;
194 * ioctl(fd, HIDIOCGFIELDINFO, &finfo); 194 * ioctl(fd, HIDIOCGFIELDINFO, &finfo);
195 * for (j = 0; j < finfo.maxusage; j++) { 195 * for (j = 0; j < finfo.maxusage; j++) {
196 * uref.field_index = i; 196 * uref.report_type = rinfo.report_type;
197 * uref.usage_index = j; 197 * uref.report_id = rinfo.report_id;
198 * ioctl(fd, HIDIOCGUCODE, &uref); 198 * uref.field_index = i;
199 * ioctl(fd, HIDIOCGUSAGE, &uref); 199 * uref.usage_index = j;
200 * } 200 * ioctl(fd, HIDIOCGUCODE, &uref);
201 * } 201 * ioctl(fd, HIDIOCGUSAGE, &uref);
202 * rinfo.report_id |= HID_REPORT_ID_NEXT; 202 * }
203 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); 203 * }
204 * } 204 * rinfo.report_id |= HID_REPORT_ID_NEXT;
205 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
206 * }
205 */ 207 */
206 208
207 209
@@ -217,7 +219,7 @@ struct hid_field;
217struct hid_report; 219struct hid_report;
218 220
219#ifdef CONFIG_USB_HIDDEV 221#ifdef CONFIG_USB_HIDDEV
220int hiddev_connect(struct hid_device *); 222int hiddev_connect(struct hid_device *hid, unsigned int force);
221void hiddev_disconnect(struct hid_device *); 223void hiddev_disconnect(struct hid_device *);
222void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 224void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
223 struct hid_usage *usage, __s32 value); 225 struct hid_usage *usage, __s32 value);
@@ -225,7 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report);
225int __init hiddev_init(void); 227int __init hiddev_init(void);
226void hiddev_exit(void); 228void hiddev_exit(void);
227#else 229#else
228static inline int hiddev_connect(struct hid_device *hid) { return -1; } 230static inline int hiddev_connect(struct hid_device *hid,
231 unsigned int force)
232{ return -1; }
229static inline void hiddev_disconnect(struct hid_device *hid) { } 233static inline void hiddev_disconnect(struct hid_device *hid) { }
230static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 234static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
231 struct hid_usage *usage, __s32 value) { } 235 struct hid_usage *usage, __s32 value) { }
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 3481a7d5bc0a..d6a3f47e95cb 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,16 @@ struct usb_device_id {
131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
133 133
134#define HID_ANY_ID (~0)
135
136struct hid_device_id {
137 __u16 bus;
138 __u32 vendor;
139 __u32 product;
140 kernel_ulong_t driver_data
141 __attribute__((aligned(sizeof(kernel_ulong_t))));
142};
143
134/* s390 CCW devices */ 144/* s390 CCW devices */
135struct ccw_device_id { 145struct ccw_device_id {
136 __u16 match_flags; /* which fields to match against */ 146 __u16 match_flags; /* which fields to match against */