Skip to content

Commit

Permalink
HID: input: call input_sync() when automatically releasing a key
Browse files Browse the repository at this point in the history
We need to emit EV_SYN/SYN_REPORT between key press and release, otherwise
userspace is allowed to "swallow" the event.

[jkosina@suse.com: Dmitry says that he's observing this behavior with
 Plantronics headset]

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
  • Loading branch information
Dmitry Torokhov authored and Jiri Kosina committed Jul 10, 2015
1 parent 67e123f commit 3eb4351
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,8 +1163,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)
Expand Down

0 comments on commit 3eb4351

Please sign in to comment.