diff options
author | Ping Cheng <pinglinux@gmail.com> | 2011-02-01 00:06:38 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-02-01 00:32:24 -0500 |
commit | 28a1bc1c0a5a15e72afae1050b227761227b6af2 (patch) | |
tree | d29f3b73e0b887775de3e4bcc69dd744ae8cd3b8 /drivers/input | |
parent | c63fe0a41fd2374be0ebe93c053820a0eed9cefe (diff) |
Input: wacom_w8001 - report resolution to userland
Serial devices send both pen and touch data through the same logical
port. Since we scaled touch to pen maximum, we use pen resolution
for touch as well here.
This is under the assumption that pen and touch share the same physical
surface. In the case when a small physical dimensional difference occurs
between pen and touch, we assume the tolerance for touch point precision
is higher than pen and the difference is within touch point tolerance.
A per-MT tool based resolution mechanism should be introduced if the
above assumption does not hold true for the pen and touch devices any
more.
Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/wacom_w8001.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 5cb8449c909d..c14412ef4648 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
@@ -51,6 +51,10 @@ MODULE_LICENSE("GPL"); | |||
51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ | 51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ |
52 | #define W8001_PKTLEN_TOUCH2FG 13 | 52 | #define W8001_PKTLEN_TOUCH2FG 13 |
53 | 53 | ||
54 | /* resolution in points/mm */ | ||
55 | #define W8001_PEN_RESOLUTION 100 | ||
56 | #define W8001_TOUCH_RESOLUTION 10 | ||
57 | |||
54 | struct w8001_coord { | 58 | struct w8001_coord { |
55 | u8 rdy; | 59 | u8 rdy; |
56 | u8 tsw; | 60 | u8 tsw; |
@@ -198,7 +202,7 @@ static void parse_touchquery(u8 *data, struct w8001_touch_query *query) | |||
198 | query->y = 1024; | 202 | query->y = 1024; |
199 | if (query->panel_res) | 203 | if (query->panel_res) |
200 | query->x = query->y = (1 << query->panel_res); | 204 | query->x = query->y = (1 << query->panel_res); |
201 | query->panel_res = 10; | 205 | query->panel_res = W8001_TOUCH_RESOLUTION; |
202 | } | 206 | } |
203 | } | 207 | } |
204 | 208 | ||
@@ -394,6 +398,8 @@ static int w8001_setup(struct w8001 *w8001) | |||
394 | 398 | ||
395 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); | 399 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); |
396 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); | 400 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); |
401 | input_abs_set_res(dev, ABS_X, W8001_PEN_RESOLUTION); | ||
402 | input_abs_set_res(dev, ABS_Y, W8001_PEN_RESOLUTION); | ||
397 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); | 403 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); |
398 | if (coord.tilt_x && coord.tilt_y) { | 404 | if (coord.tilt_x && coord.tilt_y) { |
399 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); | 405 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); |
@@ -418,14 +424,17 @@ static int w8001_setup(struct w8001 *w8001) | |||
418 | w8001->max_touch_x = touch.x; | 424 | w8001->max_touch_x = touch.x; |
419 | w8001->max_touch_y = touch.y; | 425 | w8001->max_touch_y = touch.y; |
420 | 426 | ||
421 | /* scale to pen maximum */ | ||
422 | if (w8001->max_pen_x && w8001->max_pen_y) { | 427 | if (w8001->max_pen_x && w8001->max_pen_y) { |
428 | /* if pen is supported scale to pen maximum */ | ||
423 | touch.x = w8001->max_pen_x; | 429 | touch.x = w8001->max_pen_x; |
424 | touch.y = w8001->max_pen_y; | 430 | touch.y = w8001->max_pen_y; |
431 | touch.panel_res = W8001_PEN_RESOLUTION; | ||
425 | } | 432 | } |
426 | 433 | ||
427 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); | 434 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); |
428 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); | 435 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); |
436 | input_abs_set_res(dev, ABS_X, touch.panel_res); | ||
437 | input_abs_set_res(dev, ABS_Y, touch.panel_res); | ||
429 | 438 | ||
430 | switch (touch.sensor_id) { | 439 | switch (touch.sensor_id) { |
431 | case 0: | 440 | case 0: |