diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 19:24:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 19:24:28 -0400 |
commit | 0f1b1e6d73cb989ce2c071edc57deade3b084dfe (patch) | |
tree | 1bd8f2d3ea66dbc3fadd9a9ca522caa99d9b5277 /include | |
parent | 159d8133d0b54a501a41a66fe3a0e7d16405e36d (diff) | |
parent | 3ae821effdfea47dcb36b52e0a8dffd9757a96a6 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:
- substantial cleanup of the generic and transport layers, in the
direction of an ultimate goal of making struct hid_device completely
transport independent, by Benjamin Tissoires
- cp2112 driver from David Barksdale
- a lot of fixes and new hardware support (Dualshock 4) to hid-sony
driver, by Frank Praznik
- support for Win 8.1 multitouch protocol by Andrew Duggan
- other smaller fixes / device ID additions
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (75 commits)
HID: sony: fix force feedback mismerge
HID: sony: Set the quriks flag for Bluetooth controllers
HID: sony: Fix Sixaxis cable state detection
HID: uhid: Add UHID_CREATE2 + UHID_INPUT2
HID: hyperv: fix _raw_request() prototype
HID: hyperv: Implement a stub raw_request() entry point
HID: hid-sensor-hub: fix sleeping function called from invalid context
HID: multitouch: add support for Win 8.1 multitouch touchpads
HID: remove hid_output_raw_report transport implementations
HID: sony: do not rely on hid_output_raw_report
HID: cp2112: remove the last hid_output_raw_report() call
HID: cp2112: remove various hid_out_raw_report calls
HID: multitouch: add support of other generic collections in hid-mt
HID: multitouch: remove pen special handling
HID: multitouch: remove registered devices with default behavior
HID: hidp: Add a comment that some devices depend on the current behavior of uniq
HID: sony: Prevent duplicate controller connections.
HID: sony: Perform a boundry check on the sixaxis battery level index.
HID: sony: Fix work queue issues
HID: sony: Fix multi-line comment styling
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/hid-sensor-hub.h | 9 | ||||
-rw-r--r-- | include/linux/hid-sensor-ids.h | 16 | ||||
-rw-r--r-- | include/linux/hid.h | 76 | ||||
-rw-r--r-- | include/uapi/linux/uhid.h | 23 |
4 files changed, 102 insertions, 22 deletions
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index b914ca3f57ba..b70cfd7ff29c 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h | |||
@@ -51,13 +51,15 @@ struct hid_sensor_hub_attribute_info { | |||
51 | * @hdev: Stores the hid instance. | 51 | * @hdev: Stores the hid instance. |
52 | * @vendor_id: Vendor id of hub device. | 52 | * @vendor_id: Vendor id of hub device. |
53 | * @product_id: Product id of hub device. | 53 | * @product_id: Product id of hub device. |
54 | * @ref_cnt: Number of MFD clients have opened this device | 54 | * @start_collection_index: Starting index for a phy type collection |
55 | * @end_collection_index: Last index for a phy type collection | ||
55 | */ | 56 | */ |
56 | struct hid_sensor_hub_device { | 57 | struct hid_sensor_hub_device { |
57 | struct hid_device *hdev; | 58 | struct hid_device *hdev; |
58 | u32 vendor_id; | 59 | u32 vendor_id; |
59 | u32 product_id; | 60 | u32 product_id; |
60 | int ref_cnt; | 61 | int start_collection_index; |
62 | int end_collection_index; | ||
61 | }; | 63 | }; |
62 | 64 | ||
63 | /** | 65 | /** |
@@ -218,4 +220,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st, | |||
218 | int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, | 220 | int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, |
219 | int *val1, int *val2); | 221 | int *val1, int *val2); |
220 | 222 | ||
223 | int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev, | ||
224 | u32 report_id, int field_index, u32 usage_id); | ||
225 | |||
221 | #endif | 226 | #endif |
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h index 537161a997ab..14ead9e8eda8 100644 --- a/include/linux/hid-sensor-ids.h +++ b/include/linux/hid-sensor-ids.h | |||
@@ -140,15 +140,15 @@ | |||
140 | #define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000 | 140 | #define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000 |
141 | 141 | ||
142 | /* Power state enumerations */ | 142 | /* Power state enumerations */ |
143 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00 | 143 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x200850 |
144 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01 | 144 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x200851 |
145 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x02 | 145 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x200852 |
146 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x03 | 146 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x200853 |
147 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x04 | 147 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x200854 |
148 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x05 | 148 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x200855 |
149 | 149 | ||
150 | /* Report State enumerations */ | 150 | /* Report State enumerations */ |
151 | #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x00 | 151 | #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x200840 |
152 | #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x01 | 152 | #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x200841 |
153 | 153 | ||
154 | #endif | 154 | #endif |
diff --git a/include/linux/hid.h b/include/linux/hid.h index 31b9d299ef6c..720e3a10608c 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -201,6 +201,7 @@ struct hid_item { | |||
201 | #define HID_GD_VBRZ 0x00010045 | 201 | #define HID_GD_VBRZ 0x00010045 |
202 | #define HID_GD_VNO 0x00010046 | 202 | #define HID_GD_VNO 0x00010046 |
203 | #define HID_GD_FEATURE 0x00010047 | 203 | #define HID_GD_FEATURE 0x00010047 |
204 | #define HID_GD_SYSTEM_CONTROL 0x00010080 | ||
204 | #define HID_GD_UP 0x00010090 | 205 | #define HID_GD_UP 0x00010090 |
205 | #define HID_GD_DOWN 0x00010091 | 206 | #define HID_GD_DOWN 0x00010091 |
206 | #define HID_GD_RIGHT 0x00010092 | 207 | #define HID_GD_RIGHT 0x00010092 |
@@ -208,6 +209,8 @@ struct hid_item { | |||
208 | 209 | ||
209 | #define HID_DC_BATTERYSTRENGTH 0x00060020 | 210 | #define HID_DC_BATTERYSTRENGTH 0x00060020 |
210 | 211 | ||
212 | #define HID_CP_CONSUMER_CONTROL 0x000c0001 | ||
213 | |||
211 | #define HID_DG_DIGITIZER 0x000d0001 | 214 | #define HID_DG_DIGITIZER 0x000d0001 |
212 | #define HID_DG_PEN 0x000d0002 | 215 | #define HID_DG_PEN 0x000d0002 |
213 | #define HID_DG_LIGHTPEN 0x000d0003 | 216 | #define HID_DG_LIGHTPEN 0x000d0003 |
@@ -287,6 +290,8 @@ struct hid_item { | |||
287 | #define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 | 290 | #define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 |
288 | #define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 | 291 | #define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 |
289 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 292 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
293 | #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000 | ||
294 | #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000 | ||
290 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 295 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
291 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | 296 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 |
292 | #define HID_QUIRK_NO_IGNORE 0x40000000 | 297 | #define HID_QUIRK_NO_IGNORE 0x40000000 |
@@ -508,12 +513,6 @@ struct hid_device { /* device report descriptor */ | |||
508 | struct hid_usage *, __s32); | 513 | struct hid_usage *, __s32); |
509 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 514 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
510 | 515 | ||
511 | /* handler for raw input (Get_Report) data, used by hidraw */ | ||
512 | int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char); | ||
513 | |||
514 | /* handler for raw output data, used by hidraw */ | ||
515 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); | ||
516 | |||
517 | /* debugging support via debugfs */ | 516 | /* debugging support via debugfs */ |
518 | unsigned short debug; | 517 | unsigned short debug; |
519 | struct dentry *debug_dir; | 518 | struct dentry *debug_dir; |
@@ -675,11 +674,12 @@ struct hid_driver { | |||
675 | * @stop: called on remove | 674 | * @stop: called on remove |
676 | * @open: called by input layer on open | 675 | * @open: called by input layer on open |
677 | * @close: called by input layer on close | 676 | * @close: called by input layer on close |
678 | * @hidinput_input_event: event input event (e.g. ff or leds) | ||
679 | * @parse: this method is called only once to parse the device data, | 677 | * @parse: this method is called only once to parse the device data, |
680 | * shouldn't allocate anything to not leak memory | 678 | * shouldn't allocate anything to not leak memory |
681 | * @request: send report request to device (e.g. feature report) | 679 | * @request: send report request to device (e.g. feature report) |
682 | * @wait: wait for buffered io to complete (send/recv reports) | 680 | * @wait: wait for buffered io to complete (send/recv reports) |
681 | * @raw_request: send raw report request to device (e.g. feature report) | ||
682 | * @output_report: send output report to device | ||
683 | * @idle: send idle request to device | 683 | * @idle: send idle request to device |
684 | */ | 684 | */ |
685 | struct hid_ll_driver { | 685 | struct hid_ll_driver { |
@@ -691,17 +691,20 @@ struct hid_ll_driver { | |||
691 | 691 | ||
692 | int (*power)(struct hid_device *hdev, int level); | 692 | int (*power)(struct hid_device *hdev, int level); |
693 | 693 | ||
694 | int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, | ||
695 | unsigned int code, int value); | ||
696 | |||
697 | int (*parse)(struct hid_device *hdev); | 694 | int (*parse)(struct hid_device *hdev); |
698 | 695 | ||
699 | void (*request)(struct hid_device *hdev, | 696 | void (*request)(struct hid_device *hdev, |
700 | struct hid_report *report, int reqtype); | 697 | struct hid_report *report, int reqtype); |
701 | 698 | ||
702 | int (*wait)(struct hid_device *hdev); | 699 | int (*wait)(struct hid_device *hdev); |
703 | int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype); | ||
704 | 700 | ||
701 | int (*raw_request) (struct hid_device *hdev, unsigned char reportnum, | ||
702 | __u8 *buf, size_t len, unsigned char rtype, | ||
703 | int reqtype); | ||
704 | |||
705 | int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len); | ||
706 | |||
707 | int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype); | ||
705 | }; | 708 | }; |
706 | 709 | ||
707 | #define PM_HINT_FULLON 1<<5 | 710 | #define PM_HINT_FULLON 1<<5 |
@@ -752,6 +755,7 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid); | |||
752 | unsigned int hidinput_count_leds(struct hid_device *hid); | 755 | unsigned int hidinput_count_leds(struct hid_device *hid); |
753 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); | 756 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); |
754 | void hid_output_report(struct hid_report *report, __u8 *data); | 757 | void hid_output_report(struct hid_report *report, __u8 *data); |
758 | void __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype); | ||
755 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); | 759 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); |
756 | struct hid_device *hid_allocate_device(void); | 760 | struct hid_device *hid_allocate_device(void); |
757 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); | 761 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); |
@@ -964,7 +968,55 @@ static inline void hid_hw_request(struct hid_device *hdev, | |||
964 | struct hid_report *report, int reqtype) | 968 | struct hid_report *report, int reqtype) |
965 | { | 969 | { |
966 | if (hdev->ll_driver->request) | 970 | if (hdev->ll_driver->request) |
967 | hdev->ll_driver->request(hdev, report, reqtype); | 971 | return hdev->ll_driver->request(hdev, report, reqtype); |
972 | |||
973 | __hid_request(hdev, report, reqtype); | ||
974 | } | ||
975 | |||
976 | /** | ||
977 | * hid_hw_raw_request - send report request to device | ||
978 | * | ||
979 | * @hdev: hid device | ||
980 | * @reportnum: report ID | ||
981 | * @buf: in/out data to transfer | ||
982 | * @len: length of buf | ||
983 | * @rtype: HID report type | ||
984 | * @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT | ||
985 | * | ||
986 | * @return: count of data transfered, negative if error | ||
987 | * | ||
988 | * Same behavior as hid_hw_request, but with raw buffers instead. | ||
989 | */ | ||
990 | static inline int hid_hw_raw_request(struct hid_device *hdev, | ||
991 | unsigned char reportnum, __u8 *buf, | ||
992 | size_t len, unsigned char rtype, int reqtype) | ||
993 | { | ||
994 | if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf) | ||
995 | return -EINVAL; | ||
996 | |||
997 | return hdev->ll_driver->raw_request(hdev, reportnum, buf, len, | ||
998 | rtype, reqtype); | ||
999 | } | ||
1000 | |||
1001 | /** | ||
1002 | * hid_hw_output_report - send output report to device | ||
1003 | * | ||
1004 | * @hdev: hid device | ||
1005 | * @buf: raw data to transfer | ||
1006 | * @len: length of buf | ||
1007 | * | ||
1008 | * @return: count of data transfered, negative if error | ||
1009 | */ | ||
1010 | static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, | ||
1011 | size_t len) | ||
1012 | { | ||
1013 | if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf) | ||
1014 | return -EINVAL; | ||
1015 | |||
1016 | if (hdev->ll_driver->output_report) | ||
1017 | return hdev->ll_driver->output_report(hdev, buf, len); | ||
1018 | |||
1019 | return -ENOSYS; | ||
968 | } | 1020 | } |
969 | 1021 | ||
970 | /** | 1022 | /** |
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h index 414b74be4da1..1e3b09c191cd 100644 --- a/include/uapi/linux/uhid.h +++ b/include/uapi/linux/uhid.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/input.h> | 22 | #include <linux/input.h> |
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <linux/hid.h> | ||
24 | 25 | ||
25 | enum uhid_event_type { | 26 | enum uhid_event_type { |
26 | UHID_CREATE, | 27 | UHID_CREATE, |
@@ -34,6 +35,8 @@ enum uhid_event_type { | |||
34 | UHID_INPUT, | 35 | UHID_INPUT, |
35 | UHID_FEATURE, | 36 | UHID_FEATURE, |
36 | UHID_FEATURE_ANSWER, | 37 | UHID_FEATURE_ANSWER, |
38 | UHID_CREATE2, | ||
39 | UHID_INPUT2, | ||
37 | }; | 40 | }; |
38 | 41 | ||
39 | struct uhid_create_req { | 42 | struct uhid_create_req { |
@@ -50,6 +53,19 @@ struct uhid_create_req { | |||
50 | __u32 country; | 53 | __u32 country; |
51 | } __attribute__((__packed__)); | 54 | } __attribute__((__packed__)); |
52 | 55 | ||
56 | struct uhid_create2_req { | ||
57 | __u8 name[128]; | ||
58 | __u8 phys[64]; | ||
59 | __u8 uniq[64]; | ||
60 | __u16 rd_size; | ||
61 | __u16 bus; | ||
62 | __u32 vendor; | ||
63 | __u32 product; | ||
64 | __u32 version; | ||
65 | __u32 country; | ||
66 | __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE]; | ||
67 | } __attribute__((__packed__)); | ||
68 | |||
53 | #define UHID_DATA_MAX 4096 | 69 | #define UHID_DATA_MAX 4096 |
54 | 70 | ||
55 | enum uhid_report_type { | 71 | enum uhid_report_type { |
@@ -63,6 +79,11 @@ struct uhid_input_req { | |||
63 | __u16 size; | 79 | __u16 size; |
64 | } __attribute__((__packed__)); | 80 | } __attribute__((__packed__)); |
65 | 81 | ||
82 | struct uhid_input2_req { | ||
83 | __u16 size; | ||
84 | __u8 data[UHID_DATA_MAX]; | ||
85 | } __attribute__((__packed__)); | ||
86 | |||
66 | struct uhid_output_req { | 87 | struct uhid_output_req { |
67 | __u8 data[UHID_DATA_MAX]; | 88 | __u8 data[UHID_DATA_MAX]; |
68 | __u16 size; | 89 | __u16 size; |
@@ -100,6 +121,8 @@ struct uhid_event { | |||
100 | struct uhid_output_ev_req output_ev; | 121 | struct uhid_output_ev_req output_ev; |
101 | struct uhid_feature_req feature; | 122 | struct uhid_feature_req feature; |
102 | struct uhid_feature_answer_req feature_answer; | 123 | struct uhid_feature_answer_req feature_answer; |
124 | struct uhid_create2_req create2; | ||
125 | struct uhid_input2_req input2; | ||
103 | } u; | 126 | } u; |
104 | } __attribute__((__packed__)); | 127 | } __attribute__((__packed__)); |
105 | 128 | ||