diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/hid.h | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index a837ede65ec6..01a90b8d53bb 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -287,6 +287,8 @@ struct hid_item { | |||
| 287 | #define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 | 287 | #define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 |
| 288 | #define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 | 288 | #define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 |
| 289 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 289 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
| 290 | #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000 | ||
| 291 | #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000 | ||
| 290 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 292 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
| 291 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | 293 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 |
| 292 | #define HID_QUIRK_NO_IGNORE 0x40000000 | 294 | #define HID_QUIRK_NO_IGNORE 0x40000000 |
| @@ -508,9 +510,6 @@ struct hid_device { /* device report descriptor */ | |||
| 508 | struct hid_usage *, __s32); | 510 | struct hid_usage *, __s32); |
| 509 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 511 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
| 510 | 512 | ||
| 511 | /* handler for raw output data, used by hidraw */ | ||
| 512 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); | ||
| 513 | |||
| 514 | /* debugging support via debugfs */ | 513 | /* debugging support via debugfs */ |
| 515 | unsigned short debug; | 514 | unsigned short debug; |
| 516 | struct dentry *debug_dir; | 515 | struct dentry *debug_dir; |
| @@ -753,6 +752,7 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid); | |||
| 753 | unsigned int hidinput_count_leds(struct hid_device *hid); | 752 | unsigned int hidinput_count_leds(struct hid_device *hid); |
| 754 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); | 753 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); |
| 755 | void hid_output_report(struct hid_report *report, __u8 *data); | 754 | void hid_output_report(struct hid_report *report, __u8 *data); |
| 755 | void __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype); | ||
| 756 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); | 756 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); |
| 757 | struct hid_device *hid_allocate_device(void); | 757 | struct hid_device *hid_allocate_device(void); |
| 758 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); | 758 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); |
| @@ -965,7 +965,9 @@ static inline void hid_hw_request(struct hid_device *hdev, | |||
| 965 | struct hid_report *report, int reqtype) | 965 | struct hid_report *report, int reqtype) |
| 966 | { | 966 | { |
| 967 | if (hdev->ll_driver->request) | 967 | if (hdev->ll_driver->request) |
| 968 | hdev->ll_driver->request(hdev, report, reqtype); | 968 | return hdev->ll_driver->request(hdev, report, reqtype); |
| 969 | |||
| 970 | __hid_request(hdev, report, reqtype); | ||
| 969 | } | 971 | } |
| 970 | 972 | ||
| 971 | /** | 973 | /** |
| @@ -986,11 +988,11 @@ static inline int hid_hw_raw_request(struct hid_device *hdev, | |||
| 986 | unsigned char reportnum, __u8 *buf, | 988 | unsigned char reportnum, __u8 *buf, |
| 987 | size_t len, unsigned char rtype, int reqtype) | 989 | size_t len, unsigned char rtype, int reqtype) |
| 988 | { | 990 | { |
| 989 | if (hdev->ll_driver->raw_request) | 991 | if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf) |
| 990 | return hdev->ll_driver->raw_request(hdev, reportnum, buf, len, | 992 | return -EINVAL; |
| 991 | rtype, reqtype); | ||
| 992 | 993 | ||
| 993 | return -ENOSYS; | 994 | return hdev->ll_driver->raw_request(hdev, reportnum, buf, len, |
| 995 | rtype, reqtype); | ||
| 994 | } | 996 | } |
| 995 | 997 | ||
| 996 | /** | 998 | /** |
| @@ -1005,6 +1007,9 @@ static inline int hid_hw_raw_request(struct hid_device *hdev, | |||
| 1005 | static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, | 1007 | static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, |
| 1006 | size_t len) | 1008 | size_t len) |
| 1007 | { | 1009 | { |
| 1010 | if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf) | ||
| 1011 | return -EINVAL; | ||
| 1012 | |||
| 1008 | if (hdev->ll_driver->output_report) | 1013 | if (hdev->ll_driver->output_report) |
| 1009 | return hdev->ll_driver->output_report(hdev, buf, len); | 1014 | return hdev->ll_driver->output_report(hdev, buf, len); |
| 1010 | 1015 | ||
| @@ -1012,22 +1017,6 @@ static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, | |||
| 1012 | } | 1017 | } |
| 1013 | 1018 | ||
| 1014 | /** | 1019 | /** |
| 1015 | * hid_output_raw_report - send an output or a feature report to the device | ||
| 1016 | * | ||
| 1017 | * @hdev: hid device | ||
| 1018 | * @buf: raw data to transfer | ||
| 1019 | * @len: length of buf | ||
| 1020 | * @report_type: HID_FEATURE_REPORT or HID_OUTPUT_REPORT | ||
| 1021 | * | ||
| 1022 | * @return: count of data transfered, negative if error | ||
| 1023 | */ | ||
| 1024 | static inline int hid_output_raw_report(struct hid_device *hdev, __u8 *buf, | ||
| 1025 | size_t len, unsigned char report_type) | ||
| 1026 | { | ||
| 1027 | return hdev->hid_output_raw_report(hdev, buf, len, report_type); | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | /** | ||
| 1031 | * hid_hw_idle - send idle request to device | 1020 | * hid_hw_idle - send idle request to device |
| 1032 | * | 1021 | * |
| 1033 | * @hdev: hid device | 1022 | * @hdev: hid device |
