diff options
author | Ping Cheng <pinglinux@gmail.com> | 2013-10-16 02:44:00 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-10-22 18:41:15 -0400 |
commit | 57bcfce377d26f84d7b135512a4599f88b85ac52 (patch) | |
tree | 194adf1397df4d62a7cfc537d440df058dc45db8 | |
parent | a4da47527d9f2e19a66527379418a5d13de9fff1 (diff) |
Input: wacom - not all multi-interface devices support touch
Some multi-interface devices support expresskeys on a separate interface,
such as Bamboo; some multi-interface devices do not support touch at all,
such as Pen only Intuos5. Make sure we report the right device names.
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 57 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.h | 4 |
2 files changed, 39 insertions, 22 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 63971b8188b0..8a90da11365f 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -1188,34 +1188,47 @@ static void wacom_wireless_work(struct work_struct *work) | |||
1188 | wacom_wac1->features = | 1188 | wacom_wac1->features = |
1189 | *((struct wacom_features *)id->driver_info); | 1189 | *((struct wacom_features *)id->driver_info); |
1190 | wacom_wac1->features.device_type = BTN_TOOL_PEN; | 1190 | wacom_wac1->features.device_type = BTN_TOOL_PEN; |
1191 | snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen", | ||
1192 | wacom_wac1->features.name); | ||
1191 | error = wacom_register_input(wacom1); | 1193 | error = wacom_register_input(wacom1); |
1192 | if (error) | 1194 | if (error) |
1193 | goto fail1; | 1195 | goto fail; |
1194 | 1196 | ||
1195 | /* Touch interface */ | 1197 | /* Touch interface */ |
1196 | wacom_wac2->features = | 1198 | if (wacom_wac1->features.touch_max) { |
1197 | *((struct wacom_features *)id->driver_info); | 1199 | wacom_wac2->features = |
1198 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; | 1200 | *((struct wacom_features *)id->driver_info); |
1199 | wacom_wac2->features.device_type = BTN_TOOL_FINGER; | 1201 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; |
1200 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; | 1202 | wacom_wac2->features.device_type = BTN_TOOL_FINGER; |
1201 | error = wacom_register_input(wacom2); | 1203 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; |
1202 | if (error) | 1204 | if (wacom_wac2->features.touch_max) |
1203 | goto fail2; | 1205 | snprintf(wacom_wac2->name, WACOM_NAME_MAX, |
1206 | "%s (WL) Finger",wacom_wac2->features.name); | ||
1207 | else | ||
1208 | snprintf(wacom_wac2->name, WACOM_NAME_MAX, | ||
1209 | "%s (WL) Pad",wacom_wac2->features.name); | ||
1210 | error = wacom_register_input(wacom2); | ||
1211 | if (error) | ||
1212 | goto fail; | ||
1213 | } | ||
1204 | 1214 | ||
1205 | error = wacom_initialize_battery(wacom); | 1215 | error = wacom_initialize_battery(wacom); |
1206 | if (error) | 1216 | if (error) |
1207 | goto fail3; | 1217 | goto fail; |
1208 | } | 1218 | } |
1209 | 1219 | ||
1210 | return; | 1220 | return; |
1211 | 1221 | ||
1212 | fail3: | 1222 | fail: |
1213 | input_unregister_device(wacom_wac2->input); | 1223 | if (wacom_wac2->input) { |
1214 | wacom_wac2->input = NULL; | 1224 | input_unregister_device(wacom_wac2->input); |
1215 | fail2: | 1225 | wacom_wac2->input = NULL; |
1216 | input_unregister_device(wacom_wac1->input); | 1226 | } |
1217 | wacom_wac1->input = NULL; | 1227 | |
1218 | fail1: | 1228 | if (wacom_wac1->input) { |
1229 | input_unregister_device(wacom_wac1->input); | ||
1230 | wacom_wac1->input = NULL; | ||
1231 | } | ||
1219 | return; | 1232 | return; |
1220 | } | 1233 | } |
1221 | 1234 | ||
@@ -1332,10 +1345,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1332 | struct usb_device *other_dev; | 1345 | struct usb_device *other_dev; |
1333 | 1346 | ||
1334 | /* Append the device type to the name */ | 1347 | /* Append the device type to the name */ |
1335 | strlcat(wacom_wac->name, | 1348 | if (features->device_type != BTN_TOOL_FINGER) |
1336 | features->device_type == BTN_TOOL_PEN ? | 1349 | strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX); |
1337 | " Pen" : " Finger", | 1350 | else if (features->touch_max) |
1338 | sizeof(wacom_wac->name)); | 1351 | strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX); |
1352 | else | ||
1353 | strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX); | ||
1339 | 1354 | ||
1340 | other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); | 1355 | other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); |
1341 | if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) | 1356 | if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 2a432e688e51..fd23a3790605 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -14,6 +14,8 @@ | |||
14 | /* maximum packet length for USB devices */ | 14 | /* maximum packet length for USB devices */ |
15 | #define WACOM_PKGLEN_MAX 64 | 15 | #define WACOM_PKGLEN_MAX 64 |
16 | 16 | ||
17 | #define WACOM_NAME_MAX 64 | ||
18 | |||
17 | /* packet length for individual models */ | 19 | /* packet length for individual models */ |
18 | #define WACOM_PKGLEN_PENPRTN 7 | 20 | #define WACOM_PKGLEN_PENPRTN 7 |
19 | #define WACOM_PKGLEN_GRAPHIRE 8 | 21 | #define WACOM_PKGLEN_GRAPHIRE 8 |
@@ -130,7 +132,7 @@ struct wacom_shared { | |||
130 | }; | 132 | }; |
131 | 133 | ||
132 | struct wacom_wac { | 134 | struct wacom_wac { |
133 | char name[64]; | 135 | char name[WACOM_NAME_MAX]; |
134 | unsigned char *data; | 136 | unsigned char *data; |
135 | int tool[2]; | 137 | int tool[2]; |
136 | int id[2]; | 138 | int id[2]; |