diff options
author | Jason Gerecke <killertofu@gmail.com> | 2015-07-21 11:07:25 -0700 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2015-07-23 14:02:44 +0200 |
commit | 488abb5c70c19fd37264101d2b6ebee507e1f265 (patch) | |
tree | 52d950b20ffadb4c12a486b06eac5dfde1436223 /drivers | |
parent | 1b5d514a3d24996ddbe7c75685af9dfdeff125b5 (diff) | |
download | linux-stable-488abb5c70c19fd37264101d2b6ebee507e1f265.tar.gz linux-stable-488abb5c70c19fd37264101d2b6ebee507e1f265.tar.bz2 linux-stable-488abb5c70c19fd37264101d2b6ebee507e1f265.zip |
HID: wacom: Report touch width/height/orientation for GENERIC devices
The HID_DG_WIDTH and HID_DG_HEIGHT usages report with width and height of
contacts. From this information, a crude determination of orientation is
also possible. This patch reports all three to userspace if a device
reports this usage.
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/wacom_wac.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 09fe5d604c97..280deb293ae2 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1497,6 +1497,13 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev, wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_POSITION_Y, 4); break; + case HID_DG_WIDTH: + case HID_DG_HEIGHT: + features->last_slot_field = usage->hid; + wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); + wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); + input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); + break; case HID_DG_CONTACTID: features->last_slot_field = usage->hid; break; @@ -1545,6 +1552,13 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, hid_data->x); input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y, hid_data->y); + + if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { + input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); + input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); + if (hid_data->width != hid_data->height) + input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); + } } } @@ -1561,6 +1575,12 @@ static int wacom_wac_finger_event(struct hid_device *hdev, case HID_GD_Y: wacom_wac->hid_data.y = value; break; + case HID_DG_WIDTH: + wacom_wac->hid_data.width = value; + break; + case HID_DG_HEIGHT: + wacom_wac->hid_data.height = value; + break; case HID_DG_CONTACTID: wacom_wac->hid_data.id = value; break; |