From e4736fa40fd116937390a0b220b554724317e0cf Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Wed, 29 Sep 2010 18:27:58 +0200 Subject: It seems both devices use HID_DG_INRANGE to signal whether a contact packet should be considered at all. Use this to ignore the null packets in the 480d case. Signed-off-by: Henrik Rydberg --- usr/src/dkms_source_tree/hid-egalax.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/usr/src/dkms_source_tree/hid-egalax.c b/usr/src/dkms_source_tree/hid-egalax.c index 94ff0f7..17b00df 100644 --- a/usr/src/dkms_source_tree/hid-egalax.c +++ b/usr/src/dkms_source_tree/hid-egalax.c @@ -42,7 +42,7 @@ struct egalax_contact { struct egalax_data { struct egalax_contact contact[MAX_SLOTS]; - int valid; + int down, valid; int x, y, z; int slot, prev_slot; int mask; @@ -135,13 +135,13 @@ static int egalax_input_mapped(struct hid_device *hdev, struct hid_input *hi, return -1; } -static void report_frame(struct egalax_data *td, struct input_dev *input) +static void report_contact(struct egalax_data *td, struct input_dev *input) { struct egalax_contact *f = &td->contact[td->slot]; struct egalax_contact *oldest = 0; int i; - if (!td->valid) + if (!td->down) f->id = -1; else if (f->id < 0) f->id = td->trkid++ & MAX_TRKID; @@ -149,7 +149,6 @@ static void report_frame(struct egalax_data *td, struct input_dev *input) f->y = td->y; f->z = td->z; - td->mask = 0; if (td->prev_slot != td->slot) { td->prev_slot = td->slot; if (td->reported) { @@ -203,31 +202,33 @@ static int egalax_event(struct hid_device *hid, struct hid_field *field, //return 1; switch (usage->hid) { - case HID_DG_INRANGE: case HID_DG_CONFIDENCE: case HID_DG_CONTACTCOUNT: break; - case HID_DG_TIPSWITCH: - td->valid = value; + case HID_DG_TIPSWITCH: + td->down = value; td->mask |= 0x01; break; - + case HID_DG_INRANGE: + td->valid = value; + td->mask |= 0x02; + break; case HID_DG_CONTACTID: td->slot = clamp_val(value, 0, MAX_SLOTS - 1); - td->mask |= 0x02; + td->mask |= 0x04; break; case HID_GD_X: td->x = value; - td->mask |= 0x04; + td->mask |= 0x08; break; case HID_GD_Y: td->y = value; - td->mask |= 0x08; + td->mask |= 0x10; break; case HID_DG_TIPPRESSURE: td->z = value; - td->mask |= 0x10; + td->mask |= 0x20; break; default: @@ -235,8 +236,11 @@ static int egalax_event(struct hid_device *hid, struct hid_field *field, return 0; } - if (td->mask == 0x1f) - report_frame(td, input); + if (td->mask == 0x3f) { + td->mask = 0; + if (td->valid) + report_contact(td, input); + } } /* we have handled the hidinput part, now remains hiddev */ -- cgit v1.2.3