Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 161232
b: refs/heads/master
c: 837b475
h: refs/heads/master
v: v3
  • Loading branch information
Rafi Rubin authored and Jiri Kosina committed Jul 22, 2009
1 parent b83f523 commit 1bf7a66
Show file tree
Hide file tree
Showing 2 changed files with 30 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: 8b424887b603e953af7238fef96629424dc915cb
refs/heads/master: 837b47533a6476ab3fb96b1f52edd3ce9f3162b8
33 changes: 29 additions & 4 deletions trunk/drivers/hid/hid-ntrig.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
struct ntrig_data {
__s32 x, y, id, w, h;
char reading_a_point, found_contact_id;
char pen_active;
char finger_active;
char inverted;
};

/*
Expand Down Expand Up @@ -63,10 +66,7 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
case HID_UP_DIGITIZER:
switch (usage->hid) {
/* we do not want to map these for now */
case HID_DG_INVERT: /* value is always 0 */
case HID_DG_ERASER: /* value is always 0 */
case HID_DG_CONTACTID: /* value is useless */
case HID_DG_BARRELSWITCH: /* doubtful */
case HID_DG_INPUTMODE:
case HID_DG_DEVICEINDEX:
case HID_DG_CONTACTCOUNT:
Expand Down Expand Up @@ -125,6 +125,18 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,

if (hid->claimed & HID_CLAIMED_INPUT) {
switch (usage->hid) {

case HID_DG_INRANGE:
if (field->application & 0x3)
nd->pen_active = (value != 0);
else
nd->finger_active = (value != 0);
return 0;

case HID_DG_INVERT:
nd->inverted = value;
return 0;

case HID_GD_X:
nd->x = value;
nd->reading_a_point = 1;
Expand All @@ -147,7 +159,11 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
* report received in a finger event. We want
* to emit a normal (X, Y) position
*/
if (! nd->found_contact_id) {
if (!nd->found_contact_id) {
if (nd->pen_active && nd->finger_active) {
input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
}
input_event(input, EV_ABS, ABS_X, nd->x);
input_event(input, EV_ABS, ABS_Y, nd->y);
}
Expand All @@ -159,6 +175,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
* to emit a normal (X, Y) position
*/
if (! nd->found_contact_id) {
if (nd->pen_active && nd->finger_active) {
input_report_key(input,
nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN
, 0);
input_report_key(input,
nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN
, 1);
}
input_event(input, EV_ABS, ABS_X, nd->x);
input_event(input, EV_ABS, ABS_Y, nd->y);
input_event(input, EV_ABS, ABS_PRESSURE, value);
Expand Down Expand Up @@ -233,6 +257,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)

if (ret)
kfree (nd);

return ret;
}

Expand Down

0 comments on commit 1bf7a66

Please sign in to comment.