wacom_sys.c (7dbd229e10603b3759f366007df2068dc2acfe46) | wacom_sys.c (f81a1295cd9b6d3d3d7d7126e522d80917134b41) |
---|---|
1/* 2 * drivers/input/tablet/wacom_sys.c 3 * 4 * USB Wacom tablet support - system specific code 5 */ 6 7/* 8 * This program is free software; you can redistribute it and/or modify --- 248 unchanged lines hidden (view full) --- 257 report_id, rep_data, length, 1); 258 } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES); 259 260 kfree(rep_data); 261 262 return error < 0 ? error : 0; 263} 264 | 1/* 2 * drivers/input/tablet/wacom_sys.c 3 * 4 * USB Wacom tablet support - system specific code 5 */ 6 7/* 8 * This program is free software; you can redistribute it and/or modify --- 248 unchanged lines hidden (view full) --- 257 report_id, rep_data, length, 1); 258 } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES); 259 260 kfree(rep_data); 261 262 return error < 0 ? error : 0; 263} 264 |
265static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed, 266 struct wacom_features *features) 267{ 268 return 0; 269} 270 |
|
265/* 266 * Switch the tablet into its most-capable mode. Wacom tablets are 267 * typically configured to power-up in a mode which sends mouse-like 268 * reports to the OS. To get absolute position, pressure data, etc. 269 * from the tablet, it is necessary to switch the tablet out of this 270 * mode and into one which sends the full range of tablet data. 271 */ 272static int wacom_query_tablet_data(struct hid_device *hdev, 273 struct wacom_features *features) 274{ | 271/* 272 * Switch the tablet into its most-capable mode. Wacom tablets are 273 * typically configured to power-up in a mode which sends mouse-like 274 * reports to the OS. To get absolute position, pressure data, etc. 275 * from the tablet, it is necessary to switch the tablet out of this 276 * mode and into one which sends the full range of tablet data. 277 */ 278static int wacom_query_tablet_data(struct hid_device *hdev, 279 struct wacom_features *features) 280{ |
281 if (hdev->bus == BUS_BLUETOOTH) 282 return wacom_bt_query_tablet_data(hdev, 1, features); 283 |
|
275 if (features->device_type == BTN_TOOL_FINGER) { 276 if (features->type > TABLETPC) { 277 /* MT Tablet PC touch */ 278 return wacom_set_device_mode(hdev, 3, 4, 4); 279 } 280 else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) { 281 return wacom_set_device_mode(hdev, 18, 3, 2); 282 } --- 602 unchanged lines hidden (view full) --- 885 wacom->battery.dev) { 886 power_supply_unregister(&wacom->battery); 887 wacom->battery.dev = NULL; 888 power_supply_unregister(&wacom->ac); 889 wacom->ac.dev = NULL; 890 } 891} 892 | 284 if (features->device_type == BTN_TOOL_FINGER) { 285 if (features->type > TABLETPC) { 286 /* MT Tablet PC touch */ 287 return wacom_set_device_mode(hdev, 3, 4, 4); 288 } 289 else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) { 290 return wacom_set_device_mode(hdev, 18, 3, 2); 291 } --- 602 unchanged lines hidden (view full) --- 894 wacom->battery.dev) { 895 power_supply_unregister(&wacom->battery); 896 wacom->battery.dev = NULL; 897 power_supply_unregister(&wacom->ac); 898 wacom->ac.dev = NULL; 899 } 900} 901 |
902static ssize_t wacom_show_speed(struct device *dev, 903 struct device_attribute 904 *attr, char *buf) 905{ 906 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 907 struct wacom *wacom = hid_get_drvdata(hdev); 908 909 return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed); 910} 911 912static ssize_t wacom_store_speed(struct device *dev, 913 struct device_attribute *attr, 914 const char *buf, size_t count) 915{ 916 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 917 struct wacom *wacom = hid_get_drvdata(hdev); 918 u8 new_speed; 919 920 if (kstrtou8(buf, 0, &new_speed)) 921 return -EINVAL; 922 923 if (new_speed != 0 && new_speed != 1) 924 return -EINVAL; 925 926 wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features); 927 928 return count; 929} 930 931static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP, 932 wacom_show_speed, wacom_store_speed); 933 |
|
893static struct input_dev *wacom_allocate_input(struct wacom *wacom) 894{ 895 struct input_dev *input_dev; 896 struct hid_device *hdev = wacom->hdev; 897 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 898 899 input_dev = input_allocate_device(); 900 if (!input_dev) --- 304 unchanged lines hidden (view full) --- 1205 (features->pktlen == WACOM_PKGLEN_BBTOUCH3) && 1206 (features->device_type == BTN_TOOL_PEN)) { 1207 features->device_type = BTN_TOOL_FINGER; 1208 1209 features->x_max = 4096; 1210 features->y_max = 4096; 1211 } 1212 | 934static struct input_dev *wacom_allocate_input(struct wacom *wacom) 935{ 936 struct input_dev *input_dev; 937 struct hid_device *hdev = wacom->hdev; 938 struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 939 940 input_dev = input_allocate_device(); 941 if (!input_dev) --- 304 unchanged lines hidden (view full) --- 1246 (features->pktlen == WACOM_PKGLEN_BBTOUCH3) && 1247 (features->device_type == BTN_TOOL_PEN)) { 1248 features->device_type = BTN_TOOL_FINGER; 1249 1250 features->x_max = 4096; 1251 features->y_max = 4096; 1252 } 1253 |
1254 if (hdev->bus == BUS_BLUETOOTH) 1255 features->quirks |= WACOM_QUIRK_BATTERY; 1256 |
|
1213 wacom_setup_device_quirks(features); 1214 1215 /* set unit to "100th of a mm" for devices not reported by HID */ 1216 if (!features->unit) { 1217 features->unit = 0x11; 1218 features->unitExpo = -3; 1219 } 1220 wacom_calculate_res(features); --- 15 unchanged lines hidden (view full) --- 1236 if (error) 1237 goto fail1; 1238 } 1239 1240 error = wacom_initialize_leds(wacom); 1241 if (error) 1242 goto fail2; 1243 | 1257 wacom_setup_device_quirks(features); 1258 1259 /* set unit to "100th of a mm" for devices not reported by HID */ 1260 if (!features->unit) { 1261 features->unit = 0x11; 1262 features->unitExpo = -3; 1263 } 1264 wacom_calculate_res(features); --- 15 unchanged lines hidden (view full) --- 1280 if (error) 1281 goto fail1; 1282 } 1283 1284 error = wacom_initialize_leds(wacom); 1285 if (error) 1286 goto fail2; 1287 |
1288 if (!(features->quirks & WACOM_QUIRK_MONITOR) && 1289 (features->quirks & WACOM_QUIRK_BATTERY)) { 1290 error = wacom_initialize_battery(wacom); 1291 if (error) 1292 goto fail3; 1293 } 1294 |
|
1244 if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { 1245 error = wacom_register_inputs(wacom); 1246 if (error) | 1295 if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { 1296 error = wacom_register_inputs(wacom); 1297 if (error) |
1247 goto fail3; | 1298 goto fail4; |
1248 } 1249 | 1299 } 1300 |
1301 if (hdev->bus == BUS_BLUETOOTH) { 1302 error = device_create_file(&hdev->dev, &dev_attr_speed); 1303 if (error) 1304 hid_warn(hdev, 1305 "can't create sysfs speed attribute err: %d\n", 1306 error); 1307 } 1308 |
|
1250 /* Note that if query fails it is not a hard failure */ 1251 wacom_query_tablet_data(hdev, features); 1252 1253 /* Regular HID work starts now */ 1254 error = hid_hw_start(hdev, HID_CONNECT_HIDRAW); 1255 if (error) { 1256 hid_err(hdev, "hw start failed\n"); | 1309 /* Note that if query fails it is not a hard failure */ 1310 wacom_query_tablet_data(hdev, features); 1311 1312 /* Regular HID work starts now */ 1313 error = hid_hw_start(hdev, HID_CONNECT_HIDRAW); 1314 if (error) { 1315 hid_err(hdev, "hw start failed\n"); |
1257 goto fail4; | 1316 goto fail5; |
1258 } 1259 1260 if (features->quirks & WACOM_QUIRK_MONITOR) 1261 error = hid_hw_open(hdev); 1262 1263 if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) { 1264 if (wacom_wac->features.device_type == BTN_TOOL_FINGER) 1265 wacom_wac->shared->touch_input = wacom_wac->input; 1266 } 1267 1268 return 0; 1269 | 1317 } 1318 1319 if (features->quirks & WACOM_QUIRK_MONITOR) 1320 error = hid_hw_open(hdev); 1321 1322 if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) { 1323 if (wacom_wac->features.device_type == BTN_TOOL_FINGER) 1324 wacom_wac->shared->touch_input = wacom_wac->input; 1325 } 1326 1327 return 0; 1328 |
1270 fail4: wacom_unregister_inputs(wacom); | 1329 fail5: if (hdev->bus == BUS_BLUETOOTH) 1330 device_remove_file(&hdev->dev, &dev_attr_speed); 1331 wacom_unregister_inputs(wacom); 1332 fail4: wacom_destroy_battery(wacom); |
1271 fail3: wacom_destroy_leds(wacom); 1272 fail2: wacom_remove_shared_data(wacom_wac); 1273 fail1: kfree(wacom); 1274 hid_set_drvdata(hdev, NULL); 1275 return error; 1276} 1277 1278static void wacom_remove(struct hid_device *hdev) 1279{ 1280 struct wacom *wacom = hid_get_drvdata(hdev); 1281 1282 hid_hw_stop(hdev); 1283 1284 cancel_work_sync(&wacom->work); 1285 wacom_unregister_inputs(wacom); | 1333 fail3: wacom_destroy_leds(wacom); 1334 fail2: wacom_remove_shared_data(wacom_wac); 1335 fail1: kfree(wacom); 1336 hid_set_drvdata(hdev, NULL); 1337 return error; 1338} 1339 1340static void wacom_remove(struct hid_device *hdev) 1341{ 1342 struct wacom *wacom = hid_get_drvdata(hdev); 1343 1344 hid_hw_stop(hdev); 1345 1346 cancel_work_sync(&wacom->work); 1347 wacom_unregister_inputs(wacom); |
1348 if (hdev->bus == BUS_BLUETOOTH) 1349 device_remove_file(&hdev->dev, &dev_attr_speed); |
|
1286 wacom_destroy_battery(wacom); 1287 wacom_destroy_leds(wacom); 1288 wacom_remove_shared_data(&wacom->wacom_wac); 1289 1290 hid_set_drvdata(hdev, NULL); 1291 kfree(wacom); 1292} 1293 --- 33 unchanged lines hidden --- | 1350 wacom_destroy_battery(wacom); 1351 wacom_destroy_leds(wacom); 1352 wacom_remove_shared_data(&wacom->wacom_wac); 1353 1354 hid_set_drvdata(hdev, NULL); 1355 kfree(wacom); 1356} 1357 --- 33 unchanged lines hidden --- |