diff options
Diffstat (limited to 'include/linux/hid.h')
| -rw-r--r-- | include/linux/hid.h | 102 |
1 files changed, 91 insertions, 11 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index 87093652dda8..d91c25e253c8 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -308,11 +308,15 @@ struct hid_item { | |||
| 308 | #define HID_QUIRK_NOTOUCH 0x00000002 | 308 | #define HID_QUIRK_NOTOUCH 0x00000002 |
| 309 | #define HID_QUIRK_IGNORE 0x00000004 | 309 | #define HID_QUIRK_IGNORE 0x00000004 |
| 310 | #define HID_QUIRK_NOGET 0x00000008 | 310 | #define HID_QUIRK_NOGET 0x00000008 |
| 311 | #define HID_QUIRK_HIDDEV_FORCE 0x00000010 | ||
| 311 | #define HID_QUIRK_BADPAD 0x00000020 | 312 | #define HID_QUIRK_BADPAD 0x00000020 |
| 312 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 313 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
| 314 | #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 | ||
| 313 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 315 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
| 314 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 316 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
| 315 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | 317 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 |
| 318 | #define HID_QUIRK_NO_IGNORE 0x40000000 | ||
| 319 | #define HID_QUIRK_NO_INPUT_SYNC 0x80000000 | ||
| 316 | 320 | ||
| 317 | /* | 321 | /* |
| 318 | * This is the global environment of the parser. This information is | 322 | * This is the global environment of the parser. This information is |
| @@ -398,7 +402,7 @@ struct hid_field { | |||
| 398 | __u16 dpad; /* dpad input code */ | 402 | __u16 dpad; /* dpad input code */ |
| 399 | }; | 403 | }; |
| 400 | 404 | ||
| 401 | #define HID_MAX_FIELDS 64 | 405 | #define HID_MAX_FIELDS 128 |
| 402 | 406 | ||
| 403 | struct hid_report { | 407 | struct hid_report { |
| 404 | struct list_head list; | 408 | struct list_head list; |
| @@ -501,7 +505,7 @@ struct hid_device { /* device report descriptor */ | |||
| 501 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 505 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
| 502 | 506 | ||
| 503 | /* handler for raw output data, used by hidraw */ | 507 | /* handler for raw output data, used by hidraw */ |
| 504 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); | 508 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); |
| 505 | 509 | ||
| 506 | /* debugging support via debugfs */ | 510 | /* debugging support via debugfs */ |
| 507 | unsigned short debug; | 511 | unsigned short debug; |
| @@ -589,6 +593,10 @@ struct hid_usage_id { | |||
| 589 | * @report_fixup: called before report descriptor parsing (NULL means nop) | 593 | * @report_fixup: called before report descriptor parsing (NULL means nop) |
| 590 | * @input_mapping: invoked on input registering before mapping an usage | 594 | * @input_mapping: invoked on input registering before mapping an usage |
| 591 | * @input_mapped: invoked on input registering after mapping an usage | 595 | * @input_mapped: invoked on input registering after mapping an usage |
| 596 | * @feature_mapping: invoked on feature registering | ||
| 597 | * @suspend: invoked on suspend (NULL means nop) | ||
| 598 | * @resume: invoked on resume if device was not reset (NULL means nop) | ||
| 599 | * @reset_resume: invoked on resume if device was reset (NULL means nop) | ||
| 592 | * | 600 | * |
| 593 | * raw_event and event should return 0 on no action performed, 1 when no | 601 | * raw_event and event should return 0 on no action performed, 1 when no |
| 594 | * further processing should be done and negative on error | 602 | * further processing should be done and negative on error |
| @@ -620,8 +628,8 @@ struct hid_driver { | |||
| 620 | int (*event)(struct hid_device *hdev, struct hid_field *field, | 628 | int (*event)(struct hid_device *hdev, struct hid_field *field, |
| 621 | struct hid_usage *usage, __s32 value); | 629 | struct hid_usage *usage, __s32 value); |
| 622 | 630 | ||
| 623 | void (*report_fixup)(struct hid_device *hdev, __u8 *buf, | 631 | __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf, |
| 624 | unsigned int size); | 632 | unsigned int *size); |
| 625 | 633 | ||
| 626 | int (*input_mapping)(struct hid_device *hdev, | 634 | int (*input_mapping)(struct hid_device *hdev, |
| 627 | struct hid_input *hidinput, struct hid_field *field, | 635 | struct hid_input *hidinput, struct hid_field *field, |
| @@ -629,6 +637,14 @@ struct hid_driver { | |||
| 629 | int (*input_mapped)(struct hid_device *hdev, | 637 | int (*input_mapped)(struct hid_device *hdev, |
| 630 | struct hid_input *hidinput, struct hid_field *field, | 638 | struct hid_input *hidinput, struct hid_field *field, |
| 631 | struct hid_usage *usage, unsigned long **bit, int *max); | 639 | struct hid_usage *usage, unsigned long **bit, int *max); |
| 640 | void (*feature_mapping)(struct hid_device *hdev, | ||
| 641 | struct hid_input *hidinput, struct hid_field *field, | ||
| 642 | struct hid_usage *usage); | ||
| 643 | #ifdef CONFIG_PM | ||
| 644 | int (*suspend)(struct hid_device *hdev, pm_message_t message); | ||
| 645 | int (*resume)(struct hid_device *hdev); | ||
| 646 | int (*reset_resume)(struct hid_device *hdev); | ||
| 647 | #endif | ||
| 632 | /* private: */ | 648 | /* private: */ |
| 633 | struct device_driver driver; | 649 | struct device_driver driver; |
| 634 | }; | 650 | }; |
| @@ -663,7 +679,7 @@ struct hid_ll_driver { | |||
| 663 | 679 | ||
| 664 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ | 680 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
| 665 | /* We ignore a few input applications that are not widely used */ | 681 | /* We ignore a few input applications that are not widely used */ |
| 666 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) | 682 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006))) |
| 667 | 683 | ||
| 668 | /* HID core API */ | 684 | /* HID core API */ |
| 669 | 685 | ||
| @@ -690,6 +706,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int); | |||
| 690 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); | 706 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); |
| 691 | void hid_output_report(struct hid_report *report, __u8 *data); | 707 | void hid_output_report(struct hid_report *report, __u8 *data); |
| 692 | struct hid_device *hid_allocate_device(void); | 708 | struct hid_device *hid_allocate_device(void); |
| 709 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); | ||
| 693 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); | 710 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
| 694 | int hid_check_keys_pressed(struct hid_device *hid); | 711 | int hid_check_keys_pressed(struct hid_device *hid); |
| 695 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | 712 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |
| @@ -807,6 +824,49 @@ static inline void hid_hw_stop(struct hid_device *hdev) | |||
| 807 | hdev->ll_driver->stop(hdev); | 824 | hdev->ll_driver->stop(hdev); |
| 808 | } | 825 | } |
| 809 | 826 | ||
| 827 | /** | ||
| 828 | * hid_hw_open - signal underlaying HW to start delivering events | ||
| 829 | * | ||
| 830 | * @hdev: hid device | ||
| 831 | * | ||
| 832 | * Tell underlying HW to start delivering events from the device. | ||
| 833 | * This function should be called sometime after successful call | ||
| 834 | * to hid_hiw_start(). | ||
| 835 | */ | ||
| 836 | static inline int __must_check hid_hw_open(struct hid_device *hdev) | ||
| 837 | { | ||
| 838 | return hdev->ll_driver->open(hdev); | ||
| 839 | } | ||
| 840 | |||
| 841 | /** | ||
| 842 | * hid_hw_close - signal underlaying HW to stop delivering events | ||
| 843 | * | ||
| 844 | * @hdev: hid device | ||
| 845 | * | ||
| 846 | * This function indicates that we are not interested in the events | ||
| 847 | * from this device anymore. Delivery of events may or may not stop, | ||
| 848 | * depending on the number of users still outstanding. | ||
| 849 | */ | ||
| 850 | static inline void hid_hw_close(struct hid_device *hdev) | ||
| 851 | { | ||
| 852 | hdev->ll_driver->close(hdev); | ||
| 853 | } | ||
| 854 | |||
| 855 | /** | ||
| 856 | * hid_hw_power - requests underlying HW to go into given power mode | ||
| 857 | * | ||
| 858 | * @hdev: hid device | ||
| 859 | * @level: requested power level (one of %PM_HINT_* defines) | ||
| 860 | * | ||
| 861 | * This function requests underlying hardware to enter requested power | ||
| 862 | * mode. | ||
| 863 | */ | ||
| 864 | |||
| 865 | static inline int hid_hw_power(struct hid_device *hdev, int level) | ||
| 866 | { | ||
| 867 | return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; | ||
| 868 | } | ||
| 869 | |||
| 810 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | 870 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
| 811 | int interrupt); | 871 | int interrupt); |
| 812 | 872 | ||
| @@ -825,12 +885,32 @@ int hid_pidff_init(struct hid_device *hid); | |||
| 825 | #define hid_pidff_init NULL | 885 | #define hid_pidff_init NULL |
| 826 | #endif | 886 | #endif |
| 827 | 887 | ||
| 828 | #define dbg_hid(format, arg...) if (hid_debug) \ | 888 | #define dbg_hid(format, arg...) \ |
| 829 | printk(KERN_DEBUG "%s: " format ,\ | 889 | do { \ |
| 830 | __FILE__ , ## arg) | 890 | if (hid_debug) \ |
| 831 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ | 891 | printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ |
| 832 | __FILE__ , ## arg) | 892 | } while (0) |
| 833 | #endif /* HID_FF */ | 893 | |
| 894 | #define hid_printk(level, hid, fmt, arg...) \ | ||
| 895 | dev_printk(level, &(hid)->dev, fmt, ##arg) | ||
| 896 | #define hid_emerg(hid, fmt, arg...) \ | ||
| 897 | dev_emerg(&(hid)->dev, fmt, ##arg) | ||
| 898 | #define hid_crit(hid, fmt, arg...) \ | ||
| 899 | dev_crit(&(hid)->dev, fmt, ##arg) | ||
| 900 | #define hid_alert(hid, fmt, arg...) \ | ||
| 901 | dev_alert(&(hid)->dev, fmt, ##arg) | ||
| 902 | #define hid_err(hid, fmt, arg...) \ | ||
| 903 | dev_err(&(hid)->dev, fmt, ##arg) | ||
| 904 | #define hid_notice(hid, fmt, arg...) \ | ||
| 905 | dev_notice(&(hid)->dev, fmt, ##arg) | ||
| 906 | #define hid_warn(hid, fmt, arg...) \ | ||
| 907 | dev_warn(&(hid)->dev, fmt, ##arg) | ||
| 908 | #define hid_info(hid, fmt, arg...) \ | ||
| 909 | dev_info(&(hid)->dev, fmt, ##arg) | ||
| 910 | #define hid_dbg(hid, fmt, arg...) \ | ||
| 911 | dev_dbg(&(hid)->dev, fmt, ##arg) | ||
| 912 | |||
| 913 | #endif /* __KERNEL__ */ | ||
| 834 | 914 | ||
| 835 | #endif | 915 | #endif |
| 836 | 916 | ||
