Commit c94ba060 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

HID: rmi: use HID_QUIRK_NO_INPUT_SYNC

When we receive a RMI4 report, we should not unconditionally send an
input_sync event. Instead, we should let the rmi4 transport layer do it
for us.

This fixes a situation where we might receive X in a report and the rest
in a subsequent one. And this messes up user space.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=100436Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
Tested-by: default avatarOscar Morante <spacepluk@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 008464a9
...@@ -413,6 +413,24 @@ static int rmi_event(struct hid_device *hdev, struct hid_field *field, ...@@ -413,6 +413,24 @@ static int rmi_event(struct hid_device *hdev, struct hid_field *field,
return 0; return 0;
} }
static void rmi_report(struct hid_device *hid, struct hid_report *report)
{
struct hid_field *field = report->field[0];
if (!(hid->claimed & HID_CLAIMED_INPUT))
return;
switch (report->id) {
case RMI_READ_DATA_REPORT_ID:
/* fall-through */
case RMI_ATTN_REPORT_ID:
return;
}
if (field && field->hidinput && field->hidinput->input)
input_sync(field->hidinput->input);
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int rmi_suspend(struct hid_device *hdev, pm_message_t message) static int rmi_suspend(struct hid_device *hdev, pm_message_t message)
{ {
...@@ -637,6 +655,7 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -637,6 +655,7 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
hid_set_drvdata(hdev, data); hid_set_drvdata(hdev, data);
hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
ret = hid_parse(hdev); ret = hid_parse(hdev);
if (ret) { if (ret) {
...@@ -744,6 +763,7 @@ static struct hid_driver rmi_driver = { ...@@ -744,6 +763,7 @@ static struct hid_driver rmi_driver = {
.remove = rmi_remove, .remove = rmi_remove,
.event = rmi_event, .event = rmi_event,
.raw_event = rmi_raw_event, .raw_event = rmi_raw_event,
.report = rmi_report,
.input_mapping = rmi_input_mapping, .input_mapping = rmi_input_mapping,
.input_configured = rmi_input_configured, .input_configured = rmi_input_configured,
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment