diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2014-10-01 11:59:47 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-10-01 14:58:46 -0400 |
commit | 8493ecca74a7b4a66e19676de1a0f14194179941 (patch) | |
tree | 9c6af6d86f4cb17ea8d76f1c54a37c3a69c525bd /drivers/hid/uhid.c | |
parent | 76c7c4916e96e55e637943bc03aaaf2e9b43ef73 (diff) |
HID: uHID: fix excepted report type
When uhid_get_report() or uhid_set_report() are called, they emit on the
char device a UHID_GET_REPORT or UHID_SET_REPORT message. Then, the
protocol says that the user space asnwers with UHID_GET_REPORT_REPLY
or UHID_SET_REPORT_REPLY.
Unfortunatelly, the current code waits for an event of type UHID_GET_REPORT
or UHID_SET_REPORT instead of the reply one.
Add 1 to UHID_GET_REPORT or UHID_SET_REPORT to actually wait for the
reply, and validate the reply.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/uhid.c')
-rw-r--r-- | drivers/hid/uhid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index f6ec5eaf6b89..e094c572b86e 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
@@ -154,7 +154,7 @@ static int __uhid_report_queue_and_wait(struct uhid_device *uhid, | |||
154 | 154 | ||
155 | spin_lock_irqsave(&uhid->qlock, flags); | 155 | spin_lock_irqsave(&uhid->qlock, flags); |
156 | *report_id = ++uhid->report_id; | 156 | *report_id = ++uhid->report_id; |
157 | uhid->report_type = ev->type; | 157 | uhid->report_type = ev->type + 1; |
158 | uhid->report_running = true; | 158 | uhid->report_running = true; |
159 | uhid_queue(uhid, ev); | 159 | uhid_queue(uhid, ev); |
160 | spin_unlock_irqrestore(&uhid->qlock, flags); | 160 | spin_unlock_irqrestore(&uhid->qlock, flags); |