Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334083
b: refs/heads/master
c: 4e90495
h: refs/heads/master
i:
  334081: 6268e76
  334079: da87173
v: v3
  • Loading branch information
Jason Gerecke authored and Dmitry Torokhov committed Oct 4, 2012
1 parent a7826e9 commit 22b3341
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7774036808011ceecc88cef01dfafcce39ed9fc5
refs/heads/master: 4e90495498cc6f1aa15e7667a695908860938b3e
26 changes: 22 additions & 4 deletions trunk/drivers/input/tablet/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
#define WACOM_INTUOS_RES 100
#define WACOM_INTUOS3_RES 200

/* Scale factor relating reported contact size to logical contact area.
* 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo
*/
#define WACOM_CONTACT_AREA_SCALE 2607

static int wacom_penpartner_irq(struct wacom_wac *wacom)
{
unsigned char *data = wacom->data;
Expand Down Expand Up @@ -1043,11 +1048,19 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
if (touch) {
int x = (data[2] << 4) | (data[4] >> 4);
int y = (data[3] << 4) | (data[4] & 0x0f);
int w = data[6];
int a = data[5];

// "a" is a scaled-down area which we assume is roughly
// circular and which can be described as: a=(pi*r^2)/C.
int x_res = input_abs_get_res(input, ABS_X);
int y_res = input_abs_get_res(input, ABS_Y);
int width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
int height = width * y_res / x_res;

input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
input_report_abs(input, ABS_MT_TOUCH_MAJOR, w);
input_report_abs(input, ABS_MT_TOUCH_MAJOR, width);
input_report_abs(input, ABS_MT_TOUCH_MINOR, height);
}
}

Expand Down Expand Up @@ -1533,7 +1546,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
input_mt_init_slots(input_dev, features->touch_max, 0);

input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
0, 255, 0, 0);
0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
0, features->y_max, 0, 0);

input_set_abs_params(input_dev, ABS_MT_POSITION_X,
0, features->x_max,
Expand Down Expand Up @@ -1641,7 +1656,10 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,

input_set_abs_params(input_dev,
ABS_MT_TOUCH_MAJOR,
0, 255, 0, 0);
0, features->x_max, 0, 0);
input_set_abs_params(input_dev,
ABS_MT_TOUCH_MINOR,
0, features->y_max, 0, 0);
}

input_set_abs_params(input_dev, ABS_MT_POSITION_X,
Expand Down

0 comments on commit 22b3341

Please sign in to comment.