diff mbox

HID: input: call input_sync() when automatically releasing a key

Message ID 20150709213321.GA9268@dtor-ws (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Dmitry Torokhov July 9, 2015, 9:33 p.m. UTC
We need to emit EV_SYN/SYN_REPORT between key press and release, otherwise
userspace is allowed to "swallow" the event.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

Observed this with Plantronics headsets...

 drivers/hid/hid-input.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jiri Kosina July 10, 2015, 9:35 a.m. UTC | #1
On Thu, 9 Jul 2015, Dmitry Torokhov wrote:

> We need to emit EV_SYN/SYN_REPORT between key press and release, otherwise
> userspace is allowed to "swallow" the event.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

I've applied this to for-4.3/upstream.

Thanks,
diff mbox

Patch

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 008e89b..50caf14 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1162,8 +1162,11 @@  void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 
 	input_event(input, usage->type, usage->code, value);
 
-	if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY))
+	if ((field->flags & HID_MAIN_ITEM_RELATIVE) &&
+	    usage->type == EV_KEY && value) {
+		input_sync(input);
 		input_event(input, usage->type, usage->code, 0);
+	}
 }
 
 void hidinput_report_event(struct hid_device *hid, struct hid_report *report)