Skip to content

Commit 79364d8

Browse files
aduggan-synaJiri Kosina
authored andcommitted
HID: rmi: Support touchpads with external buttons
The external buttons on HID touchpads are connected as pass through devices and button events are not reported in the rmi registers. As a result on these devices we need to allow the HID generic desktop button events to be processed by hid-input. Unfortunately, there is no way to query the touchpad to determine that it has pass through buttons so the RMI_DEVICE_HAS_PHYS_BUTTONS should be set manually when adding the device to rmi_id[]. Signed-off-by: Andrew Duggan <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent b8aed6e commit 79364d8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

drivers/hid/hid-rmi.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
/* device flags */
3737
#define RMI_DEVICE BIT(0)
38+
#define RMI_DEVICE_HAS_PHYS_BUTTONS BIT(1)
3839

3940
enum rmi_mode_type {
4041
RMI_MODE_OFF = 0,
@@ -472,6 +473,15 @@ static int rmi_event(struct hid_device *hdev, struct hid_field *field,
472473
if ((data->device_flags & RMI_DEVICE) &&
473474
(field->application == HID_GD_POINTER ||
474475
field->application == HID_GD_MOUSE)) {
476+
if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) {
477+
if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
478+
return 0;
479+
480+
if ((usage->hid == HID_GD_X || usage->hid == HID_GD_Y)
481+
&& !value)
482+
return 1;
483+
}
484+
475485
rmi_schedule_reset(hdev);
476486
return 1;
477487
}
@@ -942,8 +952,13 @@ static int rmi_input_mapping(struct hid_device *hdev,
942952
* we want to make HID ignore the advertised HID collection
943953
* for RMI deivces
944954
*/
945-
if (data->device_flags & RMI_DEVICE)
955+
if (data->device_flags & RMI_DEVICE) {
956+
if ((data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) &&
957+
((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON))
958+
return 0;
959+
946960
return -1;
961+
}
947962

948963
return 0;
949964
}
@@ -991,6 +1006,9 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
9911006
return ret;
9921007
}
9931008

1009+
if (id->driver_data)
1010+
data->device_flags = id->driver_data;
1011+
9941012
/*
9951013
* Check for the RMI specific report ids. If they are misisng
9961014
* simply return and let the events be processed by hid-input

0 commit comments

Comments
 (0)