Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: wacom: Introduce new 'touch_input' device

Instead of having a single 'input_dev' device that will take either pen
or touch data depending on the type of the device, create seperate devices
devices for each. By splitting things like this, we can support devices
(e.g. the I2C "AES" sensors in some newer tablet PCs) that send both pen
and touch reports from a single endpoint.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Jason Gerecke and committed by
Jiri Kosina
2a6cdbdd 2636a3f2

+139 -101
+70 -46
drivers/hid/wacom_sys.c
··· 253 253 if (features->type == HID_GENERIC) { 254 254 /* Any last-minute generic device setup */ 255 255 if (features->touch_max > 1) { 256 - input_mt_init_slots(wacom_wac->input, wacom_wac->features.touch_max, 256 + input_mt_init_slots(wacom_wac->touch_input, wacom_wac->features.touch_max, 257 257 INPUT_MT_DIRECT); 258 258 } 259 259 } ··· 1130 1130 if (!input_dev) 1131 1131 return NULL; 1132 1132 1133 - input_dev->name = wacom_wac->name; 1133 + input_dev->name = wacom_wac->pen_name; 1134 1134 input_dev->phys = hdev->phys; 1135 1135 input_dev->dev.parent = &hdev->dev; 1136 1136 input_dev->open = wacom_open; ··· 1149 1149 { 1150 1150 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 1151 1151 1152 - if (wacom_wac->input) 1153 - input_free_device(wacom_wac->input); 1152 + if (wacom_wac->pen_input) 1153 + input_free_device(wacom_wac->pen_input); 1154 + if (wacom_wac->touch_input) 1155 + input_free_device(wacom_wac->touch_input); 1154 1156 if (wacom_wac->pad_input) 1155 1157 input_free_device(wacom_wac->pad_input); 1156 - wacom_wac->input = NULL; 1158 + wacom_wac->pen_input = NULL; 1159 + wacom_wac->touch_input = NULL; 1157 1160 wacom_wac->pad_input = NULL; 1158 1161 } 1159 1162 1160 1163 static int wacom_allocate_inputs(struct wacom *wacom) 1161 1164 { 1162 - struct input_dev *input_dev, *pad_input_dev; 1165 + struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev; 1163 1166 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 1164 1167 1165 - input_dev = wacom_allocate_input(wacom); 1168 + pen_input_dev = wacom_allocate_input(wacom); 1169 + touch_input_dev = wacom_allocate_input(wacom); 1166 1170 pad_input_dev = wacom_allocate_input(wacom); 1167 - if (!input_dev || !pad_input_dev) { 1171 + if (!pen_input_dev || !touch_input_dev || !pad_input_dev) { 1168 1172 wacom_free_inputs(wacom); 1169 1173 return -ENOMEM; 1170 1174 } 1171 1175 1172 - wacom_wac->input = input_dev; 1176 + wacom_wac->pen_input = pen_input_dev; 1177 + wacom_wac->touch_input = touch_input_dev; 1178 + wacom_wac->touch_input->name = wacom_wac->touch_name; 1173 1179 wacom_wac->pad_input = pad_input_dev; 1174 1180 wacom_wac->pad_input->name = wacom_wac->pad_name; 1175 1181 ··· 1184 1178 1185 1179 static void wacom_clean_inputs(struct wacom *wacom) 1186 1180 { 1187 - if (wacom->wacom_wac.input) { 1188 - if (wacom->wacom_wac.input_registered) 1189 - input_unregister_device(wacom->wacom_wac.input); 1181 + if (wacom->wacom_wac.pen_input) { 1182 + if (wacom->wacom_wac.pen_registered) 1183 + input_unregister_device(wacom->wacom_wac.pen_input); 1190 1184 else 1191 - input_free_device(wacom->wacom_wac.input); 1185 + input_free_device(wacom->wacom_wac.pen_input); 1186 + } 1187 + if (wacom->wacom_wac.touch_input) { 1188 + if (wacom->wacom_wac.touch_registered) 1189 + input_unregister_device(wacom->wacom_wac.touch_input); 1190 + else 1191 + input_free_device(wacom->wacom_wac.touch_input); 1192 1192 } 1193 1193 if (wacom->wacom_wac.pad_input) { 1194 1194 if (wacom->wacom_wac.pad_registered) ··· 1202 1190 else 1203 1191 input_free_device(wacom->wacom_wac.pad_input); 1204 1192 } 1205 - wacom->wacom_wac.input = NULL; 1193 + wacom->wacom_wac.pen_input = NULL; 1194 + wacom->wacom_wac.touch_input = NULL; 1206 1195 wacom->wacom_wac.pad_input = NULL; 1207 1196 wacom_destroy_leds(wacom); 1208 1197 } 1209 1198 1210 1199 static int wacom_register_inputs(struct wacom *wacom) 1211 1200 { 1212 - struct input_dev *input_dev, *pad_input_dev; 1201 + struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev; 1213 1202 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 1214 - struct wacom_features *features = &wacom_wac->features; 1215 1203 int error = 0; 1216 1204 1217 - input_dev = wacom_wac->input; 1205 + pen_input_dev = wacom_wac->pen_input; 1206 + touch_input_dev = wacom_wac->touch_input; 1218 1207 pad_input_dev = wacom_wac->pad_input; 1219 1208 1220 - if (!input_dev || !pad_input_dev) 1209 + if (!pen_input_dev || !touch_input_dev || !pad_input_dev) 1221 1210 return -EINVAL; 1222 1211 1223 - if (features->device_type & WACOM_DEVICETYPE_PEN) 1224 - error = wacom_setup_pen_input_capabilities(input_dev, wacom_wac); 1225 - if (!error && features->device_type & WACOM_DEVICETYPE_TOUCH) 1226 - error = wacom_setup_touch_input_capabilities(input_dev, wacom_wac); 1227 - if (!error) { 1228 - error = input_register_device(input_dev); 1212 + error = wacom_setup_pen_input_capabilities(pen_input_dev, wacom_wac); 1213 + if (error) { 1214 + /* no pen in use on this interface */ 1215 + input_free_device(pen_input_dev); 1216 + wacom_wac->pen_input = NULL; 1217 + pen_input_dev = NULL; 1218 + } else { 1219 + error = input_register_device(pen_input_dev); 1229 1220 if (error) 1230 - return error; 1231 - wacom_wac->input_registered = true; 1221 + goto fail_register_pen_input; 1222 + wacom_wac->pen_registered = true; 1223 + } 1224 + 1225 + error = wacom_setup_touch_input_capabilities(touch_input_dev, wacom_wac); 1226 + if (error) { 1227 + /* no touch in use on this interface */ 1228 + input_free_device(touch_input_dev); 1229 + wacom_wac->touch_input = NULL; 1230 + touch_input_dev = NULL; 1231 + } else { 1232 + error = input_register_device(touch_input_dev); 1233 + if (error) 1234 + goto fail_register_touch_input; 1235 + wacom_wac->touch_registered = true; 1232 1236 } 1233 1237 1234 1238 error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); ··· 1271 1243 pad_input_dev = NULL; 1272 1244 wacom_wac->pad_registered = false; 1273 1245 fail_register_pad_input: 1274 - input_unregister_device(input_dev); 1275 - wacom_wac->input = NULL; 1276 - wacom_wac->input_registered = false; 1246 + input_unregister_device(touch_input_dev); 1247 + wacom_wac->touch_input = NULL; 1248 + wacom_wac->touch_registered = false; 1249 + fail_register_touch_input: 1250 + input_unregister_device(pen_input_dev); 1251 + wacom_wac->pen_input = NULL; 1252 + wacom_wac->pen_registered = false; 1253 + fail_register_pen_input: 1277 1254 return error; 1278 1255 } 1279 1256 ··· 1339 1306 if (wacom_wac1->features.type != INTUOSHT && 1340 1307 wacom_wac1->features.type != BAMBOO_PT) 1341 1308 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD; 1342 - snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen", 1309 + snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen", 1343 1310 wacom_wac1->features.name); 1344 1311 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad", 1345 1312 wacom_wac1->features.name); ··· 1358 1325 *((struct wacom_features *)id->driver_data); 1359 1326 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; 1360 1327 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; 1361 - snprintf(wacom_wac2->name, WACOM_NAME_MAX, 1328 + snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX, 1362 1329 "%s (WL) Finger",wacom_wac2->features.name); 1363 1330 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX, 1364 1331 "%s (WL) Pad",wacom_wac2->features.name); ··· 1375 1342 1376 1343 if (wacom_wac1->features.type == INTUOSHT && 1377 1344 wacom_wac1->features.touch_max) 1378 - wacom_wac->shared->touch_input = wacom_wac2->input; 1345 + wacom_wac->shared->touch_input = wacom_wac2->touch_input; 1379 1346 } 1380 1347 1381 1348 error = wacom_initialize_battery(wacom); ··· 1490 1457 } 1491 1458 1492 1459 /* Append the device type to the name */ 1460 + snprintf(wacom_wac->pen_name, sizeof(wacom_wac->pen_name), 1461 + "%s Pen", name); 1462 + snprintf(wacom_wac->touch_name, sizeof(wacom_wac->touch_name), 1463 + "%s Finger", name); 1493 1464 snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), 1494 1465 "%s Pad", name); 1495 - 1496 - if (features->device_type & WACOM_DEVICETYPE_PEN) { 1497 - snprintf(wacom_wac->name, sizeof(wacom_wac->name), 1498 - "%s Pen", name); 1499 - } 1500 - else if (features->device_type & WACOM_DEVICETYPE_TOUCH) { 1501 - snprintf(wacom_wac->name, sizeof(wacom_wac->name), 1502 - "%s Finger", name); 1503 - } 1504 - else if (features->device_type & WACOM_DEVICETYPE_PAD) { 1505 - snprintf(wacom_wac->name, sizeof(wacom_wac->name), 1506 - "%s Pad", name); 1507 - } 1508 1466 } 1509 1467 1510 1468 static int wacom_probe(struct hid_device *hdev, ··· 1639 1615 1640 1616 if (wacom_wac->features.type == INTUOSHT && 1641 1617 wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH) { 1642 - wacom_wac->shared->touch_input = wacom_wac->input; 1618 + wacom_wac->shared->touch_input = wacom_wac->touch_input; 1643 1619 } 1644 1620 1645 1621 return 0;
+63 -52
drivers/hid/wacom_wac.c
··· 69 69 static int wacom_penpartner_irq(struct wacom_wac *wacom) 70 70 { 71 71 unsigned char *data = wacom->data; 72 - struct input_dev *input = wacom->input; 72 + struct input_dev *input = wacom->pen_input; 73 73 74 74 switch (data[0]) { 75 75 case 1: ··· 114 114 { 115 115 struct wacom_features *features = &wacom->features; 116 116 unsigned char *data = wacom->data; 117 - struct input_dev *input = wacom->input; 117 + struct input_dev *input = wacom->pen_input; 118 118 int prox, pressure; 119 119 120 120 if (data[0] != WACOM_REPORT_PENABLED) { ··· 186 186 static int wacom_ptu_irq(struct wacom_wac *wacom) 187 187 { 188 188 unsigned char *data = wacom->data; 189 - struct input_dev *input = wacom->input; 189 + struct input_dev *input = wacom->pen_input; 190 190 191 191 if (data[0] != WACOM_REPORT_PENABLED) { 192 192 dev_dbg(input->dev.parent, ··· 215 215 static int wacom_dtu_irq(struct wacom_wac *wacom) 216 216 { 217 217 unsigned char *data = wacom->data; 218 - struct input_dev *input = wacom->input; 218 + struct input_dev *input = wacom->pen_input; 219 219 int prox = data[1] & 0x20; 220 220 221 221 dev_dbg(input->dev.parent, ··· 245 245 static int wacom_dtus_irq(struct wacom_wac *wacom) 246 246 { 247 247 char *data = wacom->data; 248 - struct input_dev *input = wacom->input; 248 + struct input_dev *input = wacom->pen_input; 249 249 unsigned short prox, pressure = 0; 250 250 251 251 if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) { ··· 297 297 { 298 298 struct wacom_features *features = &wacom->features; 299 299 unsigned char *data = wacom->data; 300 - struct input_dev *input = wacom->input; 300 + struct input_dev *input = wacom->pen_input; 301 301 struct input_dev *pad_input = wacom->pad_input; 302 302 int battery_capacity, ps_connected; 303 303 int prox; ··· 464 464 { 465 465 struct wacom_features *features = &wacom->features; 466 466 unsigned char *data = wacom->data; 467 - struct input_dev *input = wacom->input; 467 + struct input_dev *input = wacom->pen_input; 468 468 int idx = 0; 469 469 470 470 /* tool number */ ··· 649 649 { 650 650 struct wacom_features *features = &wacom->features; 651 651 unsigned char *data = wacom->data; 652 - struct input_dev *input = wacom->input; 652 + struct input_dev *input = wacom->pen_input; 653 653 unsigned int t; 654 654 655 655 /* general pen packet */ ··· 681 681 { 682 682 struct wacom_features *features = &wacom->features; 683 683 unsigned char *data = wacom->data; 684 - struct input_dev *input = wacom->input; 684 + struct input_dev *input = wacom->pen_input; 685 685 unsigned int t; 686 686 int idx = 0, result; 687 687 ··· 1025 1025 memcpy(wacom->data, data, 10); 1026 1026 wacom_intuos_irq(wacom); 1027 1027 1028 - input_sync(wacom->input); 1028 + input_sync(wacom->pen_input); 1029 1029 if (wacom->pad_input) 1030 1030 input_sync(wacom->pad_input); 1031 1031 } ··· 1057 1057 ps_connected); 1058 1058 break; 1059 1059 default: 1060 - dev_dbg(wacom->input->dev.parent, 1060 + dev_dbg(wacom->pen_input->dev.parent, 1061 1061 "Unknown report: %d,%d size:%zu\n", 1062 1062 data[0], data[1], len); 1063 1063 return 0; ··· 1067 1067 1068 1068 static int wacom_wac_finger_count_touches(struct wacom_wac *wacom) 1069 1069 { 1070 - struct input_dev *input = wacom->input; 1070 + struct input_dev *input = wacom->touch_input; 1071 1071 unsigned touch_max = wacom->features.touch_max; 1072 1072 int count = 0; 1073 1073 int i; ··· 1088 1088 1089 1089 static int wacom_24hdt_irq(struct wacom_wac *wacom) 1090 1090 { 1091 - struct input_dev *input = wacom->input; 1091 + struct input_dev *input = wacom->touch_input; 1092 1092 unsigned char *data = wacom->data; 1093 1093 int i; 1094 1094 int current_num_contacts = data[61]; ··· 1156 1156 1157 1157 static int wacom_mt_touch(struct wacom_wac *wacom) 1158 1158 { 1159 - struct input_dev *input = wacom->input; 1159 + struct input_dev *input = wacom->touch_input; 1160 1160 unsigned char *data = wacom->data; 1161 1161 int i; 1162 1162 int current_num_contacts = data[2]; ··· 1207 1207 1208 1208 static int wacom_tpc_mt_touch(struct wacom_wac *wacom) 1209 1209 { 1210 - struct input_dev *input = wacom->input; 1210 + struct input_dev *input = wacom->touch_input; 1211 1211 unsigned char *data = wacom->data; 1212 1212 int i; 1213 1213 ··· 1236 1236 static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) 1237 1237 { 1238 1238 unsigned char *data = wacom->data; 1239 - struct input_dev *input = wacom->input; 1239 + struct input_dev *input = wacom->touch_input; 1240 1240 bool prox = !wacom->shared->stylus_in_proximity; 1241 1241 int x = 0, y = 0; 1242 1242 ··· 1272 1272 static int wacom_tpc_pen(struct wacom_wac *wacom) 1273 1273 { 1274 1274 unsigned char *data = wacom->data; 1275 - struct input_dev *input = wacom->input; 1275 + struct input_dev *input = wacom->pen_input; 1276 1276 bool prox = data[1] & 0x20; 1277 1277 1278 1278 if (!wacom->shared->stylus_in_proximity) /* first in prox */ ··· 1301 1301 { 1302 1302 unsigned char *data = wacom->data; 1303 1303 1304 - dev_dbg(wacom->input->dev.parent, 1305 - "%s: received report #%d\n", __func__, data[0]); 1304 + if (wacom->pen_input) 1305 + dev_dbg(wacom->pen_input->dev.parent, 1306 + "%s: received report #%d\n", __func__, data[0]); 1307 + else if (wacom->touch_input) 1308 + dev_dbg(wacom->touch_input->dev.parent, 1309 + "%s: received report #%d\n", __func__, data[0]); 1306 1310 1307 1311 switch (len) { 1308 1312 case WACOM_PKGLEN_TPC1FG: ··· 1338 1334 return 0; 1339 1335 } 1340 1336 1341 - static void wacom_map_usage(struct wacom *wacom, struct hid_usage *usage, 1337 + static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage, 1342 1338 struct hid_field *field, __u8 type, __u16 code, int fuzz) 1343 1339 { 1344 - struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1345 - struct input_dev *input = wacom_wac->input; 1346 1340 int fmin = field->logical_minimum; 1347 1341 int fmax = field->logical_maximum; 1348 1342 ··· 1368 1366 struct hid_field *field, struct hid_usage *usage) 1369 1367 { 1370 1368 struct wacom *wacom = hid_get_drvdata(hdev); 1369 + struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1370 + struct input_dev *input = wacom_wac->pen_input; 1371 1371 1372 1372 switch (usage->hid) { 1373 1373 case HID_GD_X: 1374 - wacom_map_usage(wacom, usage, field, EV_ABS, ABS_X, 4); 1374 + wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); 1375 1375 break; 1376 1376 case HID_GD_Y: 1377 - wacom_map_usage(wacom, usage, field, EV_ABS, ABS_Y, 4); 1377 + wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); 1378 1378 break; 1379 1379 case HID_DG_TIPPRESSURE: 1380 - wacom_map_usage(wacom, usage, field, EV_ABS, ABS_PRESSURE, 0); 1380 + wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0); 1381 1381 break; 1382 1382 case HID_DG_INRANGE: 1383 - wacom_map_usage(wacom, usage, field, EV_KEY, BTN_TOOL_PEN, 0); 1383 + wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0); 1384 1384 break; 1385 1385 case HID_DG_INVERT: 1386 - wacom_map_usage(wacom, usage, field, EV_KEY, 1386 + wacom_map_usage(input, usage, field, EV_KEY, 1387 1387 BTN_TOOL_RUBBER, 0); 1388 1388 break; 1389 1389 case HID_DG_ERASER: 1390 1390 case HID_DG_TIPSWITCH: 1391 - wacom_map_usage(wacom, usage, field, EV_KEY, BTN_TOUCH, 0); 1391 + wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); 1392 1392 break; 1393 1393 case HID_DG_BARRELSWITCH: 1394 - wacom_map_usage(wacom, usage, field, EV_KEY, BTN_STYLUS, 0); 1394 + wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS, 0); 1395 1395 break; 1396 1396 case HID_DG_BARRELSWITCH2: 1397 - wacom_map_usage(wacom, usage, field, EV_KEY, BTN_STYLUS2, 0); 1397 + wacom_map_usage(input, usage, field, EV_KEY, BTN_STYLUS2, 0); 1398 1398 break; 1399 1399 case HID_DG_TOOLSERIALNUMBER: 1400 - wacom_map_usage(wacom, usage, field, EV_MSC, MSC_SERIAL, 0); 1400 + wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); 1401 1401 break; 1402 1402 } 1403 1403 } ··· 1409 1405 { 1410 1406 struct wacom *wacom = hid_get_drvdata(hdev); 1411 1407 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1412 - struct input_dev *input = wacom_wac->input; 1408 + struct input_dev *input = wacom_wac->pen_input; 1413 1409 1414 1410 /* checking which Tool / tip switch to send */ 1415 1411 switch (usage->hid) { ··· 1439 1435 { 1440 1436 struct wacom *wacom = hid_get_drvdata(hdev); 1441 1437 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1442 - struct input_dev *input = wacom_wac->input; 1438 + struct input_dev *input = wacom_wac->pen_input; 1443 1439 bool prox = wacom_wac->hid_data.inrange_state; 1444 1440 1445 1441 if (!wacom_wac->shared->stylus_in_proximity) /* first in prox */ ··· 1468 1464 struct wacom *wacom = hid_get_drvdata(hdev); 1469 1465 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1470 1466 struct wacom_features *features = &wacom_wac->features; 1467 + struct input_dev *input = wacom_wac->touch_input; 1471 1468 unsigned touch_max = wacom_wac->features.touch_max; 1472 1469 1473 1470 switch (usage->hid) { 1474 1471 case HID_GD_X: 1475 1472 features->last_slot_field = usage->hid; 1476 1473 if (touch_max == 1) 1477 - wacom_map_usage(wacom, usage, field, EV_ABS, ABS_X, 4); 1474 + wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4); 1478 1475 else 1479 - wacom_map_usage(wacom, usage, field, EV_ABS, 1476 + wacom_map_usage(input, usage, field, EV_ABS, 1480 1477 ABS_MT_POSITION_X, 4); 1481 1478 break; 1482 1479 case HID_GD_Y: 1483 1480 features->last_slot_field = usage->hid; 1484 1481 if (touch_max == 1) 1485 - wacom_map_usage(wacom, usage, field, EV_ABS, ABS_Y, 4); 1482 + wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); 1486 1483 else 1487 - wacom_map_usage(wacom, usage, field, EV_ABS, 1484 + wacom_map_usage(input, usage, field, EV_ABS, 1488 1485 ABS_MT_POSITION_Y, 4); 1489 1486 break; 1490 1487 case HID_DG_CONTACTID: ··· 1499 1494 break; 1500 1495 case HID_DG_TIPSWITCH: 1501 1496 features->last_slot_field = usage->hid; 1502 - wacom_map_usage(wacom, usage, field, EV_KEY, BTN_TOUCH, 0); 1497 + wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); 1503 1498 break; 1504 1499 } 1505 1500 } ··· 1555 1550 1556 1551 if (usage->usage_index + 1 == field->report_count) { 1557 1552 if (usage->hid == wacom_wac->features.last_slot_field) 1558 - wacom_wac_finger_slot(wacom_wac, wacom_wac->input); 1553 + wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); 1559 1554 } 1560 1555 1561 1556 return 0; ··· 1566 1561 { 1567 1562 struct wacom *wacom = hid_get_drvdata(hdev); 1568 1563 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1569 - struct input_dev *input = wacom_wac->input; 1564 + struct input_dev *input = wacom_wac->touch_input; 1570 1565 unsigned touch_max = wacom_wac->features.touch_max; 1571 1566 1572 1567 if (touch_max > 1) ··· 1583 1578 { 1584 1579 struct wacom *wacom = hid_get_drvdata(hdev); 1585 1580 struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1586 - struct input_dev *input = wacom_wac->input; 1587 1581 1588 1582 /* currently, only direct devices have proper hid report descriptors */ 1589 - __set_bit(INPUT_PROP_DIRECT, input->propbit); 1583 + __set_bit(INPUT_PROP_DIRECT, wacom_wac->pen_input->propbit); 1584 + __set_bit(INPUT_PROP_DIRECT, wacom_wac->touch_input->propbit); 1590 1585 1591 1586 if (WACOM_PEN_FIELD(field)) 1592 1587 return wacom_wac_pen_usage_mapping(hdev, field, usage); ··· 1631 1626 static int wacom_bpt_touch(struct wacom_wac *wacom) 1632 1627 { 1633 1628 struct wacom_features *features = &wacom->features; 1634 - struct input_dev *input = wacom->input; 1629 + struct input_dev *input = wacom->touch_input; 1635 1630 struct input_dev *pad_input = wacom->pad_input; 1636 1631 unsigned char *data = wacom->data; 1637 1632 int i; ··· 1679 1674 static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) 1680 1675 { 1681 1676 struct wacom_features *features = &wacom->features; 1682 - struct input_dev *input = wacom->input; 1677 + struct input_dev *input = wacom->touch_input; 1683 1678 bool touch = data[1] & 0x80; 1684 1679 int slot = input_mt_get_slot_by_key(input, data[0]); 1685 1680 ··· 1737 1732 1738 1733 static int wacom_bpt3_touch(struct wacom_wac *wacom) 1739 1734 { 1740 - struct input_dev *input = wacom->input; 1741 1735 unsigned char *data = wacom->data; 1742 1736 int count = data[1] & 0x07; 1743 1737 int i; ··· 1755 1751 wacom_bpt3_button_msg(wacom, data + offset); 1756 1752 1757 1753 } 1758 - input_mt_sync_frame(input); 1759 - wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); 1754 + 1755 + /* only update the touch if we actually have a touchpad */ 1756 + if (wacom->touch_registered) { 1757 + input_mt_sync_frame(wacom->touch_input); 1758 + wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom); 1759 + } 1760 1760 1761 1761 return 1; 1762 1762 } ··· 1768 1760 static int wacom_bpt_pen(struct wacom_wac *wacom) 1769 1761 { 1770 1762 struct wacom_features *features = &wacom->features; 1771 - struct input_dev *input = wacom->input; 1763 + struct input_dev *input = wacom->pen_input; 1772 1764 unsigned char *data = wacom->data; 1773 1765 int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; 1774 1766 ··· 1877 1869 static int wacom_bamboo_pad_touch_event(struct wacom_wac *wacom, 1878 1870 unsigned char *data) 1879 1871 { 1880 - struct input_dev *input = wacom->input; 1872 + struct input_dev *input = wacom->touch_input; 1881 1873 unsigned char *finger_data, prefix; 1882 1874 unsigned id; 1883 1875 int x, y; ··· 2121 2113 } 2122 2114 2123 2115 if (sync) { 2124 - input_sync(wacom_wac->input); 2116 + if (wacom_wac->pen_input) 2117 + input_sync(wacom_wac->pen_input); 2118 + if (wacom_wac->touch_input) 2119 + input_sync(wacom_wac->touch_input); 2125 2120 if (wacom_wac->pad_input) 2126 2121 input_sync(wacom_wac->pad_input); 2127 2122 } ··· 2132 2121 2133 2122 static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) 2134 2123 { 2135 - struct input_dev *input_dev = wacom_wac->input; 2124 + struct input_dev *input_dev = wacom_wac->pen_input; 2136 2125 2137 2126 input_set_capability(input_dev, EV_MSC, MSC_SERIAL); 2138 2127 ··· 2155 2144 2156 2145 static void wacom_setup_intuos(struct wacom_wac *wacom_wac) 2157 2146 { 2158 - struct input_dev *input_dev = wacom_wac->input; 2147 + struct input_dev *input_dev = wacom_wac->pen_input; 2159 2148 2160 2149 input_set_capability(input_dev, EV_REL, REL_WHEEL); 2161 2150
+6 -3
drivers/hid/wacom_wac.h
··· 196 196 }; 197 197 198 198 struct wacom_wac { 199 - char name[WACOM_NAME_MAX]; 199 + char pen_name[WACOM_NAME_MAX]; 200 + char touch_name[WACOM_NAME_MAX]; 200 201 char pad_name[WACOM_NAME_MAX]; 201 202 char bat_name[WACOM_NAME_MAX]; 202 203 char ac_name[WACOM_NAME_MAX]; ··· 208 207 bool reporting_data; 209 208 struct wacom_features features; 210 209 struct wacom_shared *shared; 211 - struct input_dev *input; 210 + struct input_dev *pen_input; 211 + struct input_dev *touch_input; 212 212 struct input_dev *pad_input; 213 - bool input_registered; 213 + bool pen_registered; 214 + bool touch_registered; 214 215 bool pad_registered; 215 216 int pid; 216 217 int battery_capacity;