Skip to contentSkip to conversation

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

PATCH Applied Dmitry Torokhov 2 participants 2 messages Jul 9, 2015 – Jul 10, 2015 HID

lore
Share & tools
lore
#0 lore raw

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

We need to emit EV_SYN/SYN_REPORT between key press and release, otherwise userspace is allowed to "swallow" the event.

---

Observed this with Plantronics headsets...

 drivers/hid/hid-input.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-input.c +4 -1
index 008e89b..50caf14 100644
@@ -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)
Signature · 5 lines
2.4.3.573.g4eafbef


-- 
Dmitry
Applied
#1 lore raw
Quoted 4 lines · Dmitry Torokhov

We need to emit EV_SYN/SYN_REPORT between key press and release, otherwise userspace is allowed to "swallow" the event.

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

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs