From: Rafi Rubin <rafi@seas.upenn.edu>
To: linux-input@vger.kernel.org
Cc: "Stéphane Chatty" <chatty@enac.fr>
Subject: [PATCH] ntrig tool separation
Date: Wed, 17 Jun 2009 01:50:26 -0400 [thread overview]
Message-ID: <4A388422.7020802@seas.upenn.edu> (raw)
When both touch and pen are active send a tool announcement before
sending any status changes so that event users may differentiate
which tool is changing.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
---
drivers/hid/hid-ntrig.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index aeab973..46ece5e 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -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;
};
/*
@@ -127,11 +130,37 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
struct input_dev *input = field->hidinput->input;
struct ntrig_data *nd = hid_get_drvdata(hid);
+ __u16 tool;
+
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;
+ if(nd->pen_active && nd->finger_active)
+ {
+ if(field->application & 0x3)
+ {
+ tool = nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
+ }
+ else
+ tool = BTN_TOOL_DOUBLETAP;
+
+ input_report_key(input, tool, 0);
+ input_report_key(input, tool, 1);
+ }
break;
case HID_GD_Y:
nd->y = value;
--
1.6.3.1
next reply other threads:[~2009-06-17 5:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 5:50 Rafi Rubin [this message]
2009-06-17 13:41 ` [PATCH] ntrig tool separation Stéphane Chatty
2009-06-17 18:37 ` Rafi Rubin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A388422.7020802@seas.upenn.edu \
--to=rafi@seas.upenn.edu \
--cc=chatty@enac.fr \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).