summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-10-12 10:20:52 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-10-12 10:20:52 +0200
commit911a68a7c4c9cb5733c9cc9f297ee1ac9f501971 (patch)
tree15986c41aeedac9fcdca3f97a2b9ffabecef8eb3 /usr/src
parentf8698ddf955caa792e344b7b7c4edb0c7a2954d4 (diff)
Add support for the rest of the Pen&Touch family
The pen support was added by Chris Bagwell. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/dkms_source_tree/wacom_sys.c9
-rw-r--r--usr/src/dkms_source_tree/wacom_wac.c104
2 files changed, 102 insertions, 11 deletions
diff --git a/usr/src/dkms_source_tree/wacom_sys.c b/usr/src/dkms_source_tree/wacom_sys.c
index fc6fd53..1e3af29 100644
--- a/usr/src/dkms_source_tree/wacom_sys.c
+++ b/usr/src/dkms_source_tree/wacom_sys.c
@@ -319,8 +319,9 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
319 if (!rep_data) 319 if (!rep_data)
320 return error; 320 return error;
321 321
322 /* ask to report tablet data if it is 2FGT or not a Tablet PC */ 322 /* ask to report tablet data if it is 2FGT Tablet PC or
323 if (features->device_type == BTN_TOOL_TRIPLETAP) { 323 * not a Tablet PC */
324 if (features->type == TABLETPC2FG) {
324 do { 325 do {
325 rep_data[0] = 3; 326 rep_data[0] = 3;
326 rep_data[1] = 4; 327 rep_data[1] = 4;
@@ -332,7 +333,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
332 WAC_HID_FEATURE_REPORT, report_id, 333 WAC_HID_FEATURE_REPORT, report_id,
333 rep_data, 3); 334 rep_data, 3);
334 } while ((error < 0 || rep_data[1] != 4) && limit++ < 5); 335 } while ((error < 0 || rep_data[1] != 4) && limit++ < 5);
335 } else if (features->type != TABLETPC && features->type != TABLETPC2FG) { 336 } else if (features->type != TABLETPC) {
336 do { 337 do {
337 rep_data[0] = 2; 338 rep_data[0] = 2;
338 rep_data[1] = 2; 339 rep_data[1] = 2;
@@ -364,7 +365,7 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
364 features->pressure_fuzz = 0; 365 features->pressure_fuzz = 0;
365 features->distance_fuzz = 0; 366 features->distance_fuzz = 0;
366 367
367 /* only Tablet PCs need to retrieve the info */ 368 /* only Tablet PCs and Bamboo P&T need to retrieve the info */
368 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && 369 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
369 (features->type != BAMBOO_PT)) 370 (features->type != BAMBOO_PT))
370 goto out; 371 goto out;
diff --git a/usr/src/dkms_source_tree/wacom_wac.c b/usr/src/dkms_source_tree/wacom_wac.c
index fd2463c..7fa1d4d 100644
--- a/usr/src/dkms_source_tree/wacom_wac.c
+++ b/usr/src/dkms_source_tree/wacom_wac.c
@@ -243,10 +243,10 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
243 if (features->type == WACOM_G4 || 243 if (features->type == WACOM_G4 ||
244 features->type == WACOM_MO) { 244 features->type == WACOM_MO) {
245 input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); 245 input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f);
246 rw = (signed)(data[7] & 0x04) - (data[7] & 0x03); 246 rw = (data[7] & 0x04) - (data[7] & 0x03);
247 } else { 247 } else {
248 input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); 248 input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f);
249 rw = -(signed)data[6]; 249 rw = -(signed char)data[6];
250 } 250 }
251 input_report_rel(input, REL_WHEEL, rw); 251 input_report_rel(input, REL_WHEEL, rw);
252 } 252 }
@@ -855,7 +855,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
855 return retval; 855 return retval;
856} 856}
857 857
858static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len) 858static int wacom_bpt_touch(struct wacom_wac *wacom)
859{ 859{
860 struct wacom_features *features = &wacom->features; 860 struct wacom_features *features = &wacom->features;
861 struct input_dev *input = wacom->input; 861 struct input_dev *input = wacom->input;
@@ -863,13 +863,16 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
863 int sp = 0, sx = 0, sy = 0, count = 0; 863 int sp = 0, sx = 0, sy = 0, count = 0;
864 int i; 864 int i;
865 865
866 if (len != WACOM_PKGLEN_BBTOUCH)
867 return 0;
868
869 for (i = 0; i < 2; i++) { 866 for (i = 0; i < 2; i++) {
870 int p = data[9 * i + 2]; 867 int p = data[9 * i + 2];
871 input_mt_slot(input, i); 868 input_mt_slot(input, i);
872 if (p) { 869 /*
870 * Touch events need to be disabled while stylus is
871 * in proximity because user's hand is resting on touchpad
872 * and sending unwanted events. User expects tablet buttons
873 * to continue working though.
874 */
875 if (p && !wacom->shared->stylus_in_proximity) {
873 int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff; 876 int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
874 int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff; 877 int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
875 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { 878 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
@@ -907,6 +910,79 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
907 return 0; 910 return 0;
908} 911}
909 912
913static int wacom_bpt_pen(struct wacom_wac *wacom)
914{
915 struct input_dev *input = wacom->input;
916 unsigned char *data = wacom->data;
917 int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
918
919 /*
920 * Similar to Graphire protocol, data[1] & 0x20 is proximity and
921 * data[1] & 0x18 is tool ID. 0x30 is safety check to ignore
922 * 2 unused tool ID's.
923 */
924 prox = (data[1] & 0x30) == 0x30;
925
926 /*
927 * All reports shared between PEN and RUBBER tool must be
928 * forced to a known starting value (zero) when transitioning to
929 * out-of-prox.
930 *
931 * If not reset then, to userspace, it will look like lost events
932 * if new tool comes in-prox with same values as previous tool sent.
933 *
934 * Hardware does report zero in most out-of-prox cases but not all.
935 */
936 if (prox) {
937 if (!wacom->shared->stylus_in_proximity) {
938 if (data[1] & 0x08) {
939 wacom->tool[0] = BTN_TOOL_RUBBER;
940 wacom->id[0] = ERASER_DEVICE_ID;
941 } else {
942 wacom->tool[0] = BTN_TOOL_PEN;
943 wacom->id[0] = STYLUS_DEVICE_ID;
944 }
945 wacom->shared->stylus_in_proximity = true;
946 }
947 x = le16_to_cpup((__le16 *)&data[2]);
948 y = le16_to_cpup((__le16 *)&data[4]);
949 p = le16_to_cpup((__le16 *)&data[6]);
950 d = data[8];
951 pen = data[1] & 0x01;
952 btn1 = data[1] & 0x02;
953 btn2 = data[1] & 0x04;
954 }
955
956 input_report_key(input, BTN_TOUCH, pen);
957 input_report_key(input, BTN_STYLUS, btn1);
958 input_report_key(input, BTN_STYLUS2, btn2);
959
960 input_report_abs(input, ABS_X, x);
961 input_report_abs(input, ABS_Y, y);
962 input_report_abs(input, ABS_PRESSURE, p);
963 input_report_abs(input, ABS_DISTANCE, d);
964
965 if (!prox) {
966 wacom->id[0] = 0;
967 wacom->shared->stylus_in_proximity = false;
968 }
969
970 input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */
971 input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */
972
973 return 1;
974}
975
976static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
977{
978 if (len == WACOM_PKGLEN_BBTOUCH)
979 return wacom_bpt_touch(wacom);
980 else if (len == WACOM_PKGLEN_BBFUN)
981 return wacom_bpt_pen(wacom);
982
983 return 0;
984}
985
910void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) 986void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
911{ 987{
912 bool sync; 988 bool sync;
@@ -1188,6 +1264,11 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1188 features->pressure_fuzz, 0); 1264 features->pressure_fuzz, 0);
1189 input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, 1265 input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0,
1190 MAX_TRACKING_ID, 0, 0); 1266 MAX_TRACKING_ID, 0, 0);
1267 } else if (features->device_type == BTN_TOOL_PEN) {
1268 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1269 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
1270 __set_bit(BTN_STYLUS, input_dev->keybit);
1271 __set_bit(BTN_STYLUS2, input_dev->keybit);
1191 } 1272 }
1192 break; 1273 break;
1193 } 1274 }
@@ -1329,6 +1410,12 @@ static const struct wacom_features wacom_features_0x47 =
1329 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; 1410 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS };
1330static struct wacom_features wacom_features_0xD0 = 1411static struct wacom_features wacom_features_0xD0 =
1331 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1412 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
1413static struct wacom_features wacom_features_0xD1 =
1414 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
1415static struct wacom_features wacom_features_0xD2 =
1416 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
1417static struct wacom_features wacom_features_0xD3 =
1418 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
1332 1419
1333#define USB_DEVICE_WACOM(prod) \ 1420#define USB_DEVICE_WACOM(prod) \
1334 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ 1421 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1394,6 +1481,9 @@ const struct usb_device_id wacom_ids[] = {
1394 { USB_DEVICE_WACOM(0xC7) }, 1481 { USB_DEVICE_WACOM(0xC7) },
1395 { USB_DEVICE_WACOM(0xCE) }, 1482 { USB_DEVICE_WACOM(0xCE) },
1396 { USB_DEVICE_WACOM(0xD0) }, 1483 { USB_DEVICE_WACOM(0xD0) },
1484 { USB_DEVICE_WACOM(0xD1) },
1485 { USB_DEVICE_WACOM(0xD2) },
1486 { USB_DEVICE_WACOM(0xD3) },
1397 { USB_DEVICE_WACOM(0xF0) }, 1487 { USB_DEVICE_WACOM(0xF0) },
1398 { USB_DEVICE_WACOM(0xCC) }, 1488 { USB_DEVICE_WACOM(0xCC) },
1399 { USB_DEVICE_WACOM(0x90) }, 1489 { USB_DEVICE_WACOM(0x90) },