diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-07-15 13:10:15 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-07-31 04:33:05 -0400 |
commit | bdb829e1dd710029a075b5f86d4053e7715beb06 (patch) | |
tree | 8cb82ceb65bf40e4966cea99d4a29576ae24e8b8 | |
parent | ac126f46cbab355d045772c1ecce899b683b2745 (diff) |
HID: uhid: use generic hidinput_input_event()
HID core provides the same functionality and can convert the input event
to a raw output report. We can thus drop UHID_OUTPUT_EV and rely on the
mandatory UHID_OUTPUT.
User-space wasn't able to do anything with UHID_OUTPUT_EV, anyway. They
don't have access to the report fields.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | Documentation/hid/uhid.txt | 4 | ||||
-rw-r--r-- | drivers/hid/uhid.c | 25 | ||||
-rw-r--r-- | include/uapi/linux/uhid.h | 4 |
3 files changed, 6 insertions, 27 deletions
diff --git a/Documentation/hid/uhid.txt b/Documentation/hid/uhid.txt index 3c741214dfbb..dc35a2b75eee 100644 --- a/Documentation/hid/uhid.txt +++ b/Documentation/hid/uhid.txt | |||
@@ -149,11 +149,13 @@ needs. Only UHID_OUTPUT and UHID_OUTPUT_EV have payloads. | |||
149 | is of type "struct uhid_data_req". | 149 | is of type "struct uhid_data_req". |
150 | This may be received even though you haven't received UHID_OPEN, yet. | 150 | This may be received even though you haven't received UHID_OPEN, yet. |
151 | 151 | ||
152 | UHID_OUTPUT_EV: | 152 | UHID_OUTPUT_EV (obsolete): |
153 | Same as UHID_OUTPUT but this contains a "struct input_event" as payload. This | 153 | Same as UHID_OUTPUT but this contains a "struct input_event" as payload. This |
154 | is called for force-feedback, LED or similar events which are received through | 154 | is called for force-feedback, LED or similar events which are received through |
155 | an input device by the HID subsystem. You should convert this into raw reports | 155 | an input device by the HID subsystem. You should convert this into raw reports |
156 | and send them to your device similar to events of type UHID_OUTPUT. | 156 | and send them to your device similar to events of type UHID_OUTPUT. |
157 | This is no longer sent by newer kernels. Instead, HID core converts it into a | ||
158 | raw output report and sends it via UHID_OUTPUT. | ||
157 | 159 | ||
158 | UHID_FEATURE: | 160 | UHID_FEATURE: |
159 | This event is sent if the kernel driver wants to perform a feature request as | 161 | This event is sent if the kernel driver wants to perform a feature request as |
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index fc307e0422af..f53f2d52e677 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
@@ -116,30 +116,6 @@ static void uhid_hid_close(struct hid_device *hid) | |||
116 | uhid_queue_event(uhid, UHID_CLOSE); | 116 | uhid_queue_event(uhid, UHID_CLOSE); |
117 | } | 117 | } |
118 | 118 | ||
119 | static int uhid_hid_input(struct input_dev *input, unsigned int type, | ||
120 | unsigned int code, int value) | ||
121 | { | ||
122 | struct hid_device *hid = input_get_drvdata(input); | ||
123 | struct uhid_device *uhid = hid->driver_data; | ||
124 | unsigned long flags; | ||
125 | struct uhid_event *ev; | ||
126 | |||
127 | ev = kzalloc(sizeof(*ev), GFP_ATOMIC); | ||
128 | if (!ev) | ||
129 | return -ENOMEM; | ||
130 | |||
131 | ev->type = UHID_OUTPUT_EV; | ||
132 | ev->u.output_ev.type = type; | ||
133 | ev->u.output_ev.code = code; | ||
134 | ev->u.output_ev.value = value; | ||
135 | |||
136 | spin_lock_irqsave(&uhid->qlock, flags); | ||
137 | uhid_queue(uhid, ev); | ||
138 | spin_unlock_irqrestore(&uhid->qlock, flags); | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static int uhid_hid_parse(struct hid_device *hid) | 119 | static int uhid_hid_parse(struct hid_device *hid) |
144 | { | 120 | { |
145 | struct uhid_device *uhid = hid->driver_data; | 121 | struct uhid_device *uhid = hid->driver_data; |
@@ -273,7 +249,6 @@ static struct hid_ll_driver uhid_hid_driver = { | |||
273 | .stop = uhid_hid_stop, | 249 | .stop = uhid_hid_stop, |
274 | .open = uhid_hid_open, | 250 | .open = uhid_hid_open, |
275 | .close = uhid_hid_close, | 251 | .close = uhid_hid_close, |
276 | .hidinput_input_event = uhid_hid_input, | ||
277 | .parse = uhid_hid_parse, | 252 | .parse = uhid_hid_parse, |
278 | }; | 253 | }; |
279 | 254 | ||
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h index e9ed951e2b09..414b74be4da1 100644 --- a/include/uapi/linux/uhid.h +++ b/include/uapi/linux/uhid.h | |||
@@ -30,7 +30,7 @@ enum uhid_event_type { | |||
30 | UHID_OPEN, | 30 | UHID_OPEN, |
31 | UHID_CLOSE, | 31 | UHID_CLOSE, |
32 | UHID_OUTPUT, | 32 | UHID_OUTPUT, |
33 | UHID_OUTPUT_EV, | 33 | UHID_OUTPUT_EV, /* obsolete! */ |
34 | UHID_INPUT, | 34 | UHID_INPUT, |
35 | UHID_FEATURE, | 35 | UHID_FEATURE, |
36 | UHID_FEATURE_ANSWER, | 36 | UHID_FEATURE_ANSWER, |
@@ -69,6 +69,8 @@ struct uhid_output_req { | |||
69 | __u8 rtype; | 69 | __u8 rtype; |
70 | } __attribute__((__packed__)); | 70 | } __attribute__((__packed__)); |
71 | 71 | ||
72 | /* Obsolete! Newer kernels will no longer send these events but instead convert | ||
73 | * it into raw output reports via UHID_OUTPUT. */ | ||
72 | struct uhid_output_ev_req { | 74 | struct uhid_output_ev_req { |
73 | __u16 type; | 75 | __u16 type; |
74 | __u16 code; | 76 | __u16 code; |