aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2012-10-21 03:38:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-25 19:02:36 -0400
commitaea2bf6a57a9e4596bfad164f986ba10ddc6adf3 (patch)
tree00429471214d5c987b1e40fcd5018599454588d0
parent2008713c7174e5c0f207bac684c6df0939047009 (diff)
Input: wacom - handle split-sensor devices with internal hubs
Like our other pen-and-touch products, the Cintiq 24HD touch needs data to be shared between its two sensors to facilitate proximity-based palm rejection. Unlike other tablets that report sensor data through separate interfaces of the same USB device, the Cintiq 24HD touch has separate USB devices that are connected to an internal USB hub. This patch makes it possible to designate the USB VID/PID of the other device so that the two may share data. To ensure we don't accidentally link to a sensor from a physically separate device (if several have been plugged in), we limit the search to siblings (i.e., devices directly connected to the same hub). Signed-off-by: Jason Gerecke <killertofu@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/input/tablet/wacom_sys.c32
-rw-r--r--drivers/input/tablet/wacom_wac.c3
-rw-r--r--drivers/input/tablet/wacom_wac.h2
3 files changed, 35 insertions, 2 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 9edf9806cff9..8b89e15bcf32 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -613,6 +613,30 @@ struct wacom_usbdev_data {
613static LIST_HEAD(wacom_udev_list); 613static LIST_HEAD(wacom_udev_list);
614static DEFINE_MUTEX(wacom_udev_list_lock); 614static DEFINE_MUTEX(wacom_udev_list_lock);
615 615
616static struct usb_device *wacom_get_sibling(struct usb_device *dev, int vendor, int product)
617{
618 int port1;
619 struct usb_device *sibling;
620
621 if (vendor == 0 && product == 0)
622 return dev;
623
624 if (dev->parent == NULL)
625 return NULL;
626
627 usb_hub_for_each_child(dev->parent, port1, sibling) {
628 struct usb_device_descriptor *d;
629 if (sibling == NULL)
630 continue;
631
632 d = &sibling->descriptor;
633 if (d->idVendor == vendor && d->idProduct == product)
634 return sibling;
635 }
636
637 return NULL;
638}
639
616static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) 640static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev)
617{ 641{
618 struct wacom_usbdev_data *data; 642 struct wacom_usbdev_data *data;
@@ -1257,13 +1281,19 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
1257 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); 1281 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
1258 1282
1259 if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { 1283 if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
1284 struct usb_device *other_dev;
1285
1260 /* Append the device type to the name */ 1286 /* Append the device type to the name */
1261 strlcat(wacom_wac->name, 1287 strlcat(wacom_wac->name,
1262 features->device_type == BTN_TOOL_PEN ? 1288 features->device_type == BTN_TOOL_PEN ?
1263 " Pen" : " Finger", 1289 " Pen" : " Finger",
1264 sizeof(wacom_wac->name)); 1290 sizeof(wacom_wac->name));
1265 1291
1266 error = wacom_add_shared_data(wacom_wac, dev); 1292
1293 other_dev = wacom_get_sibling(dev, features->oVid, features->oPid);
1294 if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL)
1295 other_dev = dev;
1296 error = wacom_add_shared_data(wacom_wac, other_dev);
1267 if (error) 1297 if (error)
1268 goto fail3; 1298 goto fail3;
1269 } 1299 }
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index c3468c8dbd89..21d1f4eaff53 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1340,7 +1340,8 @@ void wacom_setup_device_quirks(struct wacom_features *features)
1340 1340
1341 /* these device have multiple inputs */ 1341 /* these device have multiple inputs */
1342 if (features->type >= WIRELESS || 1342 if (features->type >= WIRELESS ||
1343 (features->type >= INTUOS5S && features->type <= INTUOS5L)) 1343 (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
1344 (features->oVid && features->oPid))
1344 features->quirks |= WACOM_QUIRK_MULTI_INPUT; 1345 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
1345 1346
1346 /* quirk for bamboo touch with 2 low res touches */ 1347 /* quirk for bamboo touch with 2 low res touches */
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 96c185cc301e..3f926ec19ef9 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -109,6 +109,8 @@ struct wacom_features {
109 int distance_fuzz; 109 int distance_fuzz;
110 unsigned quirks; 110 unsigned quirks;
111 unsigned touch_max; 111 unsigned touch_max;
112 int oVid;
113 int oPid;
112}; 114};
113 115
114struct wacom_shared { 116struct wacom_shared {