History

HID: uhid: add ABI compatible UHID_GET_REPORT replacing UHID_FEATURE

The old hdev->hid_get_raw_report() was broken by design. It was never clear what kind of HW request it should trigger. Benjamin fixed that with the core HID cleanup, though we never really adjusted uhid. Unfortunately, our old UHID_FEATURE command was modelled around the broken hid_get_raw_report(). We converted it silently to the new GET_REPORT and nothing broke. Make this explicit by renaming UHID_FEATURE to UHID_GET_REPORT and UHID_FEATURE_ANSWER to UHID_GET_REPORT_REPLY. Note that this is 100% ABI compatible to UHID_FEATURE. This is just a rename. But we have to keep the old definitions around to not break API. >From now on, UHID_GET_REPORT must trigger a GET_REPORT request on the user-space hardware layer. All the ambiguity due to the weird "feature" name should be gone now.

David Herrmann committed 12 years ago

Commit fa71f321 parent 5942b842 files · +35 −16Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/uhid.h+21−2
@@ -33,8 +33,10 @@ enum uhid_event_type { · 32 unmodified lines
3333 UHID_OUTPUT,
3434 UHID_OUTPUT_EV, /* obsolete! */
3535 UHID_INPUT,
36− UHID_FEATURE,
37− UHID_FEATURE_ANSWER,
36+ UHID_FEATURE, /* obsolete! use UHID_GET_REPORT */
37+ UHID_GET_REPORT = UHID_FEATURE,
38+ UHID_FEATURE_ANSWER, /* obsolete! use UHID_GET_REPORT_REPLY */
39+ UHID_GET_REPORT_REPLY = UHID_FEATURE_ANSWER,
3840 UHID_CREATE2,
3941 UHID_INPUT2,
4042 };
@@ -98,12 +100,20 @@ struct uhid_output_ev_req { · 57 unmodified lines
98100 __s32 value;
99101 } __attribute__((__packed__));
100102
103+/* Obsolete! Kernel uses ABI compatible UHID_GET_REPORT. */
101104 struct uhid_feature_req {
102105 __u32 id;
103106 __u8 rnum;
104107 __u8 rtype;
105108 } __attribute__((__packed__));
106109
110+struct uhid_get_report_req {
111+ __u32 id;
112+ __u8 rnum;
113+ __u8 rtype;
114+} __attribute__((__packed__));
115+
116+/* Obsolete! Use ABI compatible UHID_GET_REPORT_REPLY. */
107117 struct uhid_feature_answer_req {
108118 __u32 id;
109119 __u16 err;
@@ -111,6 +121,13 @@ struct uhid_feature_answer_req { · 1 unmodified line
111121 __u8 data[UHID_DATA_MAX];
112122 } __attribute__((__packed__));
113123
124+struct uhid_get_report_reply_req {
125+ __u32 id;
126+ __u16 err;
127+ __u16 size;
128+ __u8 data[UHID_DATA_MAX];
129+} __attribute__((__packed__));
130+
114131 struct uhid_event {
115132 __u32 type;
116133
@@ -120,7 +137,9 @@ struct uhid_event { · 3 unmodified lines
120137 struct uhid_output_req output;
121138 struct uhid_output_ev_req output_ev;
122139 struct uhid_feature_req feature;
140+ struct uhid_get_report_req get_report;
123141 struct uhid_feature_answer_req feature_answer;
142+ struct uhid_get_report_reply_req get_report_reply;
124143 struct uhid_create2_req create2;
125144 struct uhid_input2_req input2;
126145 } u;