linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: input: call input_sync() when automatically releasing a key
@ 2015-07-09 21:33 Dmitry Torokhov
  2015-07-10  9:35 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2015-07-09 21:33 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, linux-kernel

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(-)

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)
-- 
2.4.3.573.g4eafbef


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-10  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09 21:33 [PATCH] HID: input: call input_sync() when automatically releasing a key Dmitry Torokhov
2015-07-10  9:35 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).