diff options
author | Jason Gerecke <killertofu@gmail.com> | 2015-07-21 14:07:25 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2015-07-23 08:02:44 -0400 |
commit | 488abb5c70c19fd37264101d2b6ebee507e1f265 (patch) | |
tree | 52d950b20ffadb4c12a486b06eac5dfde1436223 | |
parent | 1b5d514a3d24996ddbe7c75685af9dfdeff125b5 (diff) |
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>
-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, | |||
1497 | wacom_map_usage(input, usage, field, EV_ABS, | 1497 | wacom_map_usage(input, usage, field, EV_ABS, |
1498 | ABS_MT_POSITION_Y, 4); | 1498 | ABS_MT_POSITION_Y, 4); |
1499 | break; | 1499 | break; |
1500 | case HID_DG_WIDTH: | ||
1501 | case HID_DG_HEIGHT: | ||
1502 | features->last_slot_field = usage->hid; | ||
1503 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); | ||
1504 | wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); | ||
1505 | input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); | ||
1506 | break; | ||
1500 | case HID_DG_CONTACTID: | 1507 | case HID_DG_CONTACTID: |
1501 | features->last_slot_field = usage->hid; | 1508 | features->last_slot_field = usage->hid; |
1502 | break; | 1509 | break; |
@@ -1545,6 +1552,13 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, | |||
1545 | hid_data->x); | 1552 | hid_data->x); |
1546 | input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y, | 1553 | input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y, |
1547 | hid_data->y); | 1554 | hid_data->y); |
1555 | |||
1556 | if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { | ||
1557 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); | ||
1558 | input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); | ||
1559 | if (hid_data->width != hid_data->height) | ||
1560 | input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); | ||
1561 | } | ||
1548 | } | 1562 | } |
1549 | } | 1563 | } |
1550 | 1564 | ||
@@ -1561,6 +1575,12 @@ static int wacom_wac_finger_event(struct hid_device *hdev, | |||
1561 | case HID_GD_Y: | 1575 | case HID_GD_Y: |
1562 | wacom_wac->hid_data.y = value; | 1576 | wacom_wac->hid_data.y = value; |
1563 | break; | 1577 | break; |
1578 | case HID_DG_WIDTH: | ||
1579 | wacom_wac->hid_data.width = value; | ||
1580 | break; | ||
1581 | case HID_DG_HEIGHT: | ||
1582 | wacom_wac->hid_data.height = value; | ||
1583 | break; | ||
1564 | case HID_DG_CONTACTID: | 1584 | case HID_DG_CONTACTID: |
1565 | wacom_wac->hid_data.id = value; | 1585 | wacom_wac->hid_data.id = value; |
1566 | break; | 1586 | break; |