diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2015-02-25 11:43:39 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-02-27 02:37:52 -0500 |
commit | a97ac10401fe86fa30ef73315241e31d8594a651 (patch) | |
tree | 1644066336b329cef62b8a77c00ff3b224ea818e /drivers/hid | |
parent | eef23a8441432960c89ee5bd034ad822ccd6658e (diff) |
HID: wacom: store the hid_device pointers of the sibling devices
The Bamboo PAD in debug mode needs to re-route events from the debug
interface to the Pen interface. This can be easily done with
hid_input_report(), but that means that we need to keep a reference to
the various hid_devices.
There should be only one touch and one pen interface per physical tablet,
so there is no need to keep a list of hid-devices, plain pointers are
sufficient.
Tested-by: Josep Sanchez Ferreres <josep.sanchez.ferreres@est.fib.upc.edu>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/wacom_sys.c | 25 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.h | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index f0568a7e6de9..b3c2395aef3b 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -524,6 +524,11 @@ static int wacom_add_shared_data(struct hid_device *hdev) | |||
524 | 524 | ||
525 | wacom_wac->shared = &data->shared; | 525 | wacom_wac->shared = &data->shared; |
526 | 526 | ||
527 | if (wacom_wac->features.device_type == BTN_TOOL_FINGER) | ||
528 | wacom_wac->shared->touch = hdev; | ||
529 | else if (wacom_wac->features.device_type == BTN_TOOL_PEN) | ||
530 | wacom_wac->shared->pen = hdev; | ||
531 | |||
527 | out: | 532 | out: |
528 | mutex_unlock(&wacom_udev_list_lock); | 533 | mutex_unlock(&wacom_udev_list_lock); |
529 | return retval; | 534 | return retval; |
@@ -541,14 +546,22 @@ static void wacom_release_shared_data(struct kref *kref) | |||
541 | kfree(data); | 546 | kfree(data); |
542 | } | 547 | } |
543 | 548 | ||
544 | static void wacom_remove_shared_data(struct wacom_wac *wacom) | 549 | static void wacom_remove_shared_data(struct wacom *wacom) |
545 | { | 550 | { |
546 | struct wacom_hdev_data *data; | 551 | struct wacom_hdev_data *data; |
552 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | ||
553 | |||
554 | if (wacom_wac->shared) { | ||
555 | data = container_of(wacom_wac->shared, struct wacom_hdev_data, | ||
556 | shared); | ||
557 | |||
558 | if (wacom_wac->shared->touch == wacom->hdev) | ||
559 | wacom_wac->shared->touch = NULL; | ||
560 | else if (wacom_wac->shared->pen == wacom->hdev) | ||
561 | wacom_wac->shared->pen = NULL; | ||
547 | 562 | ||
548 | if (wacom->shared) { | ||
549 | data = container_of(wacom->shared, struct wacom_hdev_data, shared); | ||
550 | kref_put(&data->kref, wacom_release_shared_data); | 563 | kref_put(&data->kref, wacom_release_shared_data); |
551 | wacom->shared = NULL; | 564 | wacom_wac->shared = NULL; |
552 | } | 565 | } |
553 | } | 566 | } |
554 | 567 | ||
@@ -1527,7 +1540,7 @@ fail_register_inputs: | |||
1527 | wacom_clean_inputs(wacom); | 1540 | wacom_clean_inputs(wacom); |
1528 | wacom_destroy_battery(wacom); | 1541 | wacom_destroy_battery(wacom); |
1529 | fail_battery: | 1542 | fail_battery: |
1530 | wacom_remove_shared_data(wacom_wac); | 1543 | wacom_remove_shared_data(wacom); |
1531 | fail_shared_data: | 1544 | fail_shared_data: |
1532 | wacom_clean_inputs(wacom); | 1545 | wacom_clean_inputs(wacom); |
1533 | fail_allocate_inputs: | 1546 | fail_allocate_inputs: |
@@ -1550,7 +1563,7 @@ static void wacom_remove(struct hid_device *hdev) | |||
1550 | if (hdev->bus == BUS_BLUETOOTH) | 1563 | if (hdev->bus == BUS_BLUETOOTH) |
1551 | device_remove_file(&hdev->dev, &dev_attr_speed); | 1564 | device_remove_file(&hdev->dev, &dev_attr_speed); |
1552 | wacom_destroy_battery(wacom); | 1565 | wacom_destroy_battery(wacom); |
1553 | wacom_remove_shared_data(&wacom->wacom_wac); | 1566 | wacom_remove_shared_data(wacom); |
1554 | 1567 | ||
1555 | hid_set_drvdata(hdev, NULL); | 1568 | hid_set_drvdata(hdev, NULL); |
1556 | kfree(wacom); | 1569 | kfree(wacom); |
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 021ee1c1980a..e42efbe3338c 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h | |||
@@ -169,6 +169,8 @@ struct wacom_shared { | |||
169 | unsigned touch_max; | 169 | unsigned touch_max; |
170 | int type; | 170 | int type; |
171 | struct input_dev *touch_input; | 171 | struct input_dev *touch_input; |
172 | struct hid_device *pen; | ||
173 | struct hid_device *touch; | ||
172 | }; | 174 | }; |
173 | 175 | ||
174 | struct hid_data { | 176 | struct hid_data { |