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 <aduggan@synaptics.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
b8aed6ea39
commit
79364d87af
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
/* device flags */
|
/* device flags */
|
||||||
#define RMI_DEVICE BIT(0)
|
#define RMI_DEVICE BIT(0)
|
||||||
|
#define RMI_DEVICE_HAS_PHYS_BUTTONS BIT(1)
|
||||||
|
|
||||||
enum rmi_mode_type {
|
enum rmi_mode_type {
|
||||||
RMI_MODE_OFF = 0,
|
RMI_MODE_OFF = 0,
|
||||||
@ -472,6 +473,15 @@ static int rmi_event(struct hid_device *hdev, struct hid_field *field,
|
|||||||
if ((data->device_flags & RMI_DEVICE) &&
|
if ((data->device_flags & RMI_DEVICE) &&
|
||||||
(field->application == HID_GD_POINTER ||
|
(field->application == HID_GD_POINTER ||
|
||||||
field->application == HID_GD_MOUSE)) {
|
field->application == HID_GD_MOUSE)) {
|
||||||
|
if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) {
|
||||||
|
if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ((usage->hid == HID_GD_X || usage->hid == HID_GD_Y)
|
||||||
|
&& !value)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
rmi_schedule_reset(hdev);
|
rmi_schedule_reset(hdev);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -942,8 +952,13 @@ static int rmi_input_mapping(struct hid_device *hdev,
|
|||||||
* we want to make HID ignore the advertised HID collection
|
* we want to make HID ignore the advertised HID collection
|
||||||
* for RMI deivces
|
* for RMI deivces
|
||||||
*/
|
*/
|
||||||
if (data->device_flags & RMI_DEVICE)
|
if (data->device_flags & RMI_DEVICE) {
|
||||||
|
if ((data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS) &&
|
||||||
|
((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -991,6 +1006,9 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (id->driver_data)
|
||||||
|
data->device_flags = id->driver_data;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for the RMI specific report ids. If they are misisng
|
* Check for the RMI specific report ids. If they are misisng
|
||||||
* simply return and let the events be processed by hid-input
|
* simply return and let the events be processed by hid-input
|
||||||
|
Loading…
Reference in New Issue
Block a user