diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-14 17:55:53 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-14 17:55:53 -0700 |
commit | 5489375d481c8456c8259b48e107d03b05309d1d (patch) | |
tree | 2bb3c9fe3b68e135444d1e5a47fdf3a1b7adf284 /drivers/hid/hid-ntrig.c | |
parent | 355bbd8cb82e60a592f6cd86ce6dbe5677615cf4 (diff) | |
parent | 8123e8f7c89a07cb22279b15bf47cdee0205d4a1 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: completely remove apple mightymouse from blacklist
HID: support larger reports than 64 bytes in hiddev
HID: local function should be static
HID: ignore Philips IEEE802.15.4 RF Dongle
HID: ignore all recent SoundGraph iMON devices
HID: fix memory leak on error patch in debug code
HID: fix overrun in quirks initialization
HID: Drop NULL test on list_entry result
HID: driver for Twinhan USB 6253:0100 remote control
HID: adding __init/__exit macros to module init/exit functions
HID: add rumble support for Thrustmaster Dual Trigger 3-in-1
HID: ntrig tool separation and pen usages
HID: Avoid double spin_lock_init on usbhid->lock
HID: add force feedback support for Logitech WingMan Formula Force GP
HID: Support new variants of Samsung USB IR receiver (0419:0001)
HID: fix memory leak on error path in debug code
HID: fix debugfs build with !CONFIG_DEBUG_FS
HID: use debugfs for events/reports dumping
HID: use debugfs for report dumping descriptor
Diffstat (limited to 'drivers/hid/hid-ntrig.c')
-rw-r--r-- | drivers/hid/hid-ntrig.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 75ed9d2c1a3..49ce69d7bba 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; }; /* @@ -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: @@ -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; @@ -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); } @@ -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); @@ -233,6 +257,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) if (ret) kfree (nd); + return ret; } @@ -265,12 +290,12 @@ static struct hid_driver ntrig_driver = { .event = ntrig_event, }; -static int ntrig_init(void) +static int __init ntrig_init(void) { return hid_register_driver(&ntrig_driver); } -static void ntrig_exit(void) +static void __exit ntrig_exit(void) { hid_unregister_driver(&ntrig_driver); } |