aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorChris Bagwell <chris@cnpbagwell.com>2011-10-10 11:52:13 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-10-10 11:55:34 -0400
commitc18c2cec31881130c591ea60590859002945cd96 (patch)
tree2874b21a6c98cab5d3ac8d3ea8add92620de9187 /drivers/input/tablet
parent3d11ae8190c1b273d655b4d8d82be36754587910 (diff)
Input: wacom - add ABS_DISTANCE to Bamboo Pen reports
Tablet reports a distance of 0 right at highest point possible to be in proximity and distance_max when touching tablet. Inverse the distance since user land has no way of knowing ABS_DISTANCE is not distance from tablet. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/wacom_wac.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index f4206b5236c8..6f94b4593ad6 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -873,7 +873,15 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
873 x = le16_to_cpup((__le16 *)&data[2]); 873 x = le16_to_cpup((__le16 *)&data[2]);
874 y = le16_to_cpup((__le16 *)&data[4]); 874 y = le16_to_cpup((__le16 *)&data[4]);
875 p = le16_to_cpup((__le16 *)&data[6]); 875 p = le16_to_cpup((__le16 *)&data[6]);
876 d = data[8]; 876 /*
877 * Convert distance from out prox to distance from tablet.
878 * distance will be greater than distance_max once
879 * touching and applying pressure; do not report negative
880 * distance.
881 */
882 if (data[8] <= wacom->features.distance_max)
883 d = wacom->features.distance_max - data[8];
884
877 pen = data[1] & 0x01; 885 pen = data[1] & 0x01;
878 btn1 = data[1] & 0x02; 886 btn1 = data[1] & 0x02;
879 btn2 = data[1] & 0x04; 887 btn2 = data[1] & 0x04;
@@ -1222,6 +1230,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1222 __set_bit(BTN_TOOL_PEN, input_dev->keybit); 1230 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
1223 __set_bit(BTN_STYLUS, input_dev->keybit); 1231 __set_bit(BTN_STYLUS, input_dev->keybit);
1224 __set_bit(BTN_STYLUS2, input_dev->keybit); 1232 __set_bit(BTN_STYLUS2, input_dev->keybit);
1233 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
1234 features->distance_max,
1235 0, 0);
1225 } 1236 }
1226 break; 1237 break;
1227 } 1238 }
@@ -1442,37 +1453,37 @@ static const struct wacom_features wacom_features_0x47 =
1442 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1453 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1443static const struct wacom_features wacom_features_0xD0 = 1454static const struct wacom_features wacom_features_0xD0 =
1444 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1455 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1445 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1456 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1446static const struct wacom_features wacom_features_0xD1 = 1457static const struct wacom_features wacom_features_0xD1 =
1447 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1458 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1448 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1459 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1449static const struct wacom_features wacom_features_0xD2 = 1460static const struct wacom_features wacom_features_0xD2 =
1450 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1461 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1451 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1462 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1452static const struct wacom_features wacom_features_0xD3 = 1463static const struct wacom_features wacom_features_0xD3 =
1453 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 1464 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1454 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1465 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1455static const struct wacom_features wacom_features_0xD4 = 1466static const struct wacom_features wacom_features_0xD4 =
1456 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1467 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1457 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1468 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1458static const struct wacom_features wacom_features_0xD5 = 1469static const struct wacom_features wacom_features_0xD5 =
1459 { "Wacom Bamboo Pen 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 1470 { "Wacom Bamboo Pen 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1460 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1471 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1461static const struct wacom_features wacom_features_0xD6 = 1472static const struct wacom_features wacom_features_0xD6 =
1462 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1473 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1463 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1474 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1464static const struct wacom_features wacom_features_0xD7 = 1475static const struct wacom_features wacom_features_0xD7 =
1465 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1476 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1466 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1477 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1467static const struct wacom_features wacom_features_0xD8 = 1478static const struct wacom_features wacom_features_0xD8 =
1468 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 1479 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1469 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1480 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1470static const struct wacom_features wacom_features_0xDA = 1481static const struct wacom_features wacom_features_0xDA =
1471 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 1482 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1472 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1483 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1473static struct wacom_features wacom_features_0xDB = 1484static struct wacom_features wacom_features_0xDB =
1474 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 1485 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1475 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1486 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1476static const struct wacom_features wacom_features_0x6004 = 1487static const struct wacom_features wacom_features_0x6004 =
1477 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 1488 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
1478 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1489 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };