mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] n-trig digitizer quirks
@ 2008-11-14 17:08 Raphael Yoram Rubin
  2008-11-18 14:27 ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Raphael Yoram Rubin @ 2008-11-14 17:08 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel

Added quirks for the N-Trig digitizer.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>

---
diff -uprN linux-2.6.27.6-vanilla/drivers/hid/hid-input-quirks.c linux-2.6.27.6/drivers/hid/hid-input-quirks.c
--- linux-2.6.27.6-vanilla/drivers/hid/hid-input-quirks.c	2008-11-13 12:56:21.000000000 -0500
+++ linux-2.6.27.6/drivers/hid/hid-input-quirks.c	2008-11-14 07:17:54.721758855 -0500
@@ -314,6 +314,17 @@ static int quirk_sunplus_wdesktop(struct
  	return 1;
  }

+static int quirk_ntrig_touch_screen(struct hid_usage *usage, struct input_dev *input,
+			      unsigned long **bit, int *max)
+{
+	if ( (usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER &&
+	    (usage->hid & 0xff) == 0x47) {
+      map_key_clear(BTN_TOOL_DOUBLETAP);
+		return 1;
+	}
+   return 0;
+}
+
  #define VENDOR_ID_BELKIN			0x1020
  #define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD	0x0006

@@ -335,6 +346,9 @@ static int quirk_sunplus_wdesktop(struct
  #define DEVICE_ID_S510_RECEIVER_2		0xc517
  #define DEVICE_ID_MX3000_RECEIVER		0xc513

+#define VENDOR_ID_NTRIG                0x1b96
+#define DEVICE_ID_NTRIG_TOUCH_SCREEN	0x0001
+
  #define VENDOR_ID_MICROSOFT			0x045e
  #define DEVICE_ID_MS4K				0x00db
  #define DEVICE_ID_MS6K				0x00f9
@@ -380,6 +394,7 @@ static const struct hid_input_blacklist
  	{ VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote },

  	{ VENDOR_ID_SUNPLUS, DEVICE_ID_SUNPLUS_WDESKTOP, quirk_sunplus_wdesktop },
+	{ VENDOR_ID_NTRIG, DEVICE_ID_NTRIG_TOUCH_SCREEN, quirk_ntrig_touch_screen },

  	{ 0, 0, NULL }
  };
diff -uprN linux-2.6.27.6-vanilla/drivers/hid/usbhid/hid-quirks.c linux-2.6.27.6/drivers/hid/usbhid/hid-quirks.c
--- linux-2.6.27.6-vanilla/drivers/hid/usbhid/hid-quirks.c	2008-11-13 12:56:21.000000000 -0500
+++ linux-2.6.27.6/drivers/hid/usbhid/hid-quirks.c	2008-11-14 07:17:54.722758633 -0500
@@ -359,6 +359,9 @@
  #define USB_VENDOR_ID_NEC		0x073e
  #define USB_DEVICE_ID_NEC_USB_GAME_PAD	0x0301

+#define USB_VENDOR_ID_NTRIG		0x1b96
+#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN	0x0001
+
  #define USB_VENDOR_ID_ONTRAK		0x0a07
  #define USB_DEVICE_ID_ONTRAK_ADU100	0x0064

@@ -448,6 +451,7 @@ static const struct hid_blacklist {
  	{ USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
  	{ USB_VENDOR_ID_NATSU, USB_DEVICE_ID_NATSU_GAMEPAD, HID_QUIRK_BADPAD },
  	{ USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD },
+	{ USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN, HID_QUIRK_DUPLICATE_USAGES },
  	{ USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD },
  	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-14 17:08 [PATCH] n-trig digitizer quirks Raphael Yoram Rubin
@ 2008-11-18 14:27 ` Jiri Kosina
  2008-11-18 20:44   ` Rafi Rubin
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2008-11-18 14:27 UTC (permalink / raw)
  To: Raphael Yoram Rubin; +Cc: linux-kernel

On Fri, 14 Nov 2008, Raphael Yoram Rubin wrote:

> Added quirks for the N-Trig digitizer.
> Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>

Hi Raphael,

thanks a lot for the patch. The HID code has been refactored for 2.6.28, 
in order to make the support for quirky devices much more clean and 
prevent from turning of the HID code into unmaintainable mess full of 
randomly sprinkled quirks here and there.

Do you think you could rebase your patch on top of current 2.6.28-rc and 
resend it?

Thanks!

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-18 14:27 ` Jiri Kosina
@ 2008-11-18 20:44   ` Rafi Rubin
  2008-11-19 12:58     ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Rafi Rubin @ 2008-11-18 20:44 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added quirks for the N-Trig digitizer.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>

- ---
 drivers/hid/Kconfig     |    7 ++++
 drivers/hid/Makefile    |    1 +
 drivers/hid/hid-core.c  |    1 +
 drivers/hid/hid-ids.h   |    3 ++
 drivers/hid/hid-ntrig.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hid/hid-ntrig.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index b4fd8ca..9e33af9 100644
- --- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -202,6 +202,13 @@ config HID_MONTEREY
 	---help---
 	Support for Monterey Genius KB29E.

+config HID_NTRIG
+	tristate "NTrig" if EMBEDDED
+	depends on USB_HID
+	default y
+	---help---
+	Support for N-Trig touch screen.
+
 config HID_PANTHERLORD
 	tristate "Pantherlord devices support" if EMBEDDED
 	depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index b09e43e..8b2c545 100644
- --- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_HID_GYRATION)	+= hid-gyration.o
 obj-$(CONFIG_HID_LOGITECH)	+= hid-logitech.o
 obj-$(CONFIG_HID_MICROSOFT)	+= hid-microsoft.o
 obj-$(CONFIG_HID_MONTEREY)	+= hid-monterey.o
+obj-$(CONFIG_HID_NTRIG)		+= hid-ntrig.o
 obj-$(CONFIG_HID_PANTHERLORD)	+= hid-pl.o
 obj-$(CONFIG_HID_PETALYNX)	+= hid-petalynx.o
 obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 147ec59..6ee9a64 100644
- --- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1294,6 +1294,7 @@ static const struct hid_device_id hid_blacklist[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index d70075d..c3c2550 100644
- --- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -338,6 +338,9 @@
 #define USB_VENDOR_ID_NEC		0x073e
 #define USB_DEVICE_ID_NEC_USB_GAME_PAD	0x0301

+#define USB_VENDOR_ID_NTRIG                0x1b96
+#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN   0x0001
+
 #define USB_VENDOR_ID_ONTRAK		0x0a07
 #define USB_DEVICE_ID_ONTRAK_ADU100	0x0064

diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
new file mode 100644
index 0000000..01cccc8
- --- /dev/null
+++ b/drivers/hid/hid-ntrig.c
@@ -0,0 +1,84 @@
+/*
+ *  HID driver for some ntrig "special" devices
+ *
+ *  Copyright (c) 1999 Andreas Gal
+ *  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
+ *  Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
+ *  Copyright (c) 2006-2007 Jiri Kosina
+ *  Copyright (c) 2007 Paul Walmsley
+ *  Copyright (c) 2008 Jiri Slaby
+ *  Copyright (c) 2008 Rafi Rubin
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+#include "hid-ids.h"
+
+#define NTRIG_DUPLICATE_USAGES	0x001
+
+#define nt_map_key_clear(c)	hid_map_usage_clear(hi, usage, bit, max, \
+					EV_KEY, (c))
+
+static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+		struct hid_field *field, struct hid_usage *usage,
+		unsigned long **bit, int *max)
+{
+   if ( (usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER &&
+         (usage->hid & 0xff) == 0x47) {
+      nt_map_key_clear(BTN_TOOL_DOUBLETAP);
+      return 1;
+   }
+   return 0;
+}
+
+static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
+		struct hid_field *field, struct hid_usage *usage,
+		unsigned long **bit, int *max)
+{
+	unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
+
+	if (usage->type == EV_KEY || usage->type == EV_REL
+         || usage->type == EV_ABS)
+		clear_bit(usage->code, *bit);
+
+	return 0;
+}
+static const struct hid_device_id ntrig_devices[] = {
+	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN),
+      .driver_data = NTRIG_DUPLICATE_USAGES },
+	{ }
+};
+MODULE_DEVICE_TABLE(hid, ntrig_devices);
+
+static struct hid_driver ntrig_driver = {
+	.name = "ntrig",
+	.id_table = ntrig_devices,
+	.input_mapping = ntrig_input_mapping,
+	.input_mapped = ntrig_input_mapped,
+};
+
+static int ntrig_init(void)
+{
+	return hid_register_driver(&ntrig_driver);
+}
+
+static void ntrig_exit(void)
+{
+	hid_unregister_driver(&ntrig_driver);
+}
+
+module_init(ntrig_init);
+module_exit(ntrig_exit);
+MODULE_LICENSE("GPL");
+
+HID_COMPAT_LOAD_DRIVER(ntrig);
- --
1.5.6.5


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkjKQ8ACgkQwuRiAT9o6084zQCfcbQPIgSz1MStNJngDSr2LFfW
XuUAoKstmmyPod+PIxwxX0OCPzydjAtH
=NCKm
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-18 20:44   ` Rafi Rubin
@ 2008-11-19 12:58     ` Jiri Kosina
  2008-11-19 13:42       ` Rafi Rubin
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2008-11-19 12:58 UTC (permalink / raw)
  To: Rafi Rubin; +Cc: linux-kernel

On Tue, 18 Nov 2008, Rafi Rubin wrote:

> +static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> +		struct hid_field *field, struct hid_usage *usage,
> +		unsigned long **bit, int *max)
> +{
> +   if ( (usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER &&
> +         (usage->hid & 0xff) == 0x47) {
> +      nt_map_key_clear(BTN_TOOL_DOUBLETAP);
> +      return 1;
> +   }
> +   return 0;
> +}

Could you please keep standard linux-kernel indenting style? I.e. 
something like

static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{
	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER &&
			(usage->hid & 0xff) == 0x47) {
		nt_map_key_clear(BTN_TOOL_DOUBLETAP);
		return 1;
	}
	return 0;
}


> +
> +static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
> +		struct hid_field *field, struct hid_usage *usage,
> +		unsigned long **bit, int *max)
> +{
> +	unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);

This could be removed, as it is never used, right?

> +HID_COMPAT_LOAD_DRIVER(ntrig);

Also please don't forget to add HID_COMPAT_CALL_DRIVER() entry into 
hid-dummy.c

Besides that it looks OK, so please resend with the above issues fixed, 
and I'll queue it in my tree.

Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-19 12:58     ` Jiri Kosina
@ 2008-11-19 13:42       ` Rafi Rubin
  2008-11-19 13:52         ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Rafi Rubin @ 2008-11-19 13:42 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Could you please keep standard linux-kernel indenting style? I.e. 
> something like

Sorry, just had different settings in my vimrc for something else.

> 
> 
>> +
>> +static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
>> +		struct hid_field *field, struct hid_usage *usage,
>> +		unsigned long **bit, int *max)
>> +{
>> +	unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
> 
> This could be removed, as it is never used, right?

Yes, it wasn't used at the moment, just something left over from using hid-lg.c as a template.  Since this is the only device known for this driver at this point, is it better to keep it shorter and
not check for the duplicate usage from the driver data or would it be better to add the flexibility now?  Also, if you do prefer using driver data like that, is the probe function necessary to make it
work?

Rafi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkkF9IACgkQwuRiAT9o6088RgCfdvu6ntRJ11vh5Ti2CHG+PJJz
SWcAoLrViuX6HO+wEaJnCS+Yt95nAr0D
=qepn
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-19 13:42       ` Rafi Rubin
@ 2008-11-19 13:52         ` Jiri Kosina
  2008-11-19 14:04           ` Rafi Rubin
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2008-11-19 13:52 UTC (permalink / raw)
  To: Rafi Rubin; +Cc: linux-kernel

On Wed, 19 Nov 2008, Rafi Rubin wrote:

> >> +static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
> >> +		struct hid_field *field, struct hid_usage *usage,
> >> +		unsigned long **bit, int *max)
> >> +{
> >> +	unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
> > This could be removed, as it is never used, right?
> Yes, it wasn't used at the moment, just something left over from using 
> hid-lg.c as a template.  Since this is the only device known for this 
> driver at this point, is it better to keep it shorter and not check for 
> the duplicate usage from the driver data or would it be better to add 
> the flexibility now?  

Please keep the driver as simple as possible. Whenever there are any new 
devices in the future, we could easily extend it so that quirk data in 
driver_data are taken into account.

> Also, if you do prefer using driver data like that, is the probe 
> function necessary to make it work?

Probe function is necesary, you need to parse the report descriptor 
(hid_parse()), activate the hardware (hid_hw_start()), etc.

Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-19 13:52         ` Jiri Kosina
@ 2008-11-19 14:04           ` Rafi Rubin
  2008-11-19 14:07             ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Rafi Rubin @ 2008-11-19 14:04 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>> Also, if you do prefer using driver data like that, is the probe 
>> function necessary to make it work?
> 
> Probe function is necesary, you need to parse the report descriptor 
> (hid_parse()), activate the hardware (hid_hw_start()), etc.

Just to confirm then, its not necessary if I'm not checking the driver data for the quirk?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkkHQEACgkQwuRiAT9o60+WHACg8N419HjyNxVeX/ozhRH7Wdrx
J80AoLXsSnLSAidbNYM6BID5j6OMh4ny
=dk3Z
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-19 14:04           ` Rafi Rubin
@ 2008-11-19 14:07             ` Jiri Kosina
  2008-11-19 14:43               ` Rafi Rubin
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2008-11-19 14:07 UTC (permalink / raw)
  To: Rafi Rubin; +Cc: linux-kernel

On Wed, 19 Nov 2008, Rafi Rubin wrote:

> >> Also, if you do prefer using driver data like that, is the probe 
> >> function necessary to make it work?
> > Probe function is necesary, you need to parse the report descriptor 
> > (hid_parse()), activate the hardware (hid_hw_start()), etc.
> Just to confirm then, its not necessary if I'm not checking the driver 
> data for the quirk?

Correct; if you don't need to do anything special in the _probe function, 
the HID core will do everything necessary (descriptor parsing, 
low-level hardware initialization) for you.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-19 14:07             ` Jiri Kosina
@ 2008-11-19 14:43               ` Rafi Rubin
  2008-11-19 15:02                 ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Rafi Rubin @ 2008-11-19 14:43 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added quirks for the N-Trig digitizer.
Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
- ---
 drivers/hid/Kconfig     |    7 ++++
 drivers/hid/Makefile    |    1 +
 drivers/hid/hid-core.c  |    1 +
 drivers/hid/hid-dummy.c |    4 +-
 drivers/hid/hid-ids.h   |    3 ++
 drivers/hid/hid-ntrig.c |   82 +++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 drivers/hid/hid-ntrig.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index b4fd8ca..9e33af9 100644
- --- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -202,6 +202,13 @@ config HID_MONTEREY
 	---help---
 	Support for Monterey Genius KB29E.

+config HID_NTRIG
+	tristate "NTrig" if EMBEDDED
+	depends on USB_HID
+	default y
+	---help---
+	Support for N-Trig touch screen.
+
 config HID_PANTHERLORD
 	tristate "Pantherlord devices support" if EMBEDDED
 	depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index b09e43e..8b2c545 100644
- --- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_HID_GYRATION)	+= hid-gyration.o
 obj-$(CONFIG_HID_LOGITECH)	+= hid-logitech.o
 obj-$(CONFIG_HID_MICROSOFT)	+= hid-microsoft.o
 obj-$(CONFIG_HID_MONTEREY)	+= hid-monterey.o
+obj-$(CONFIG_HID_NTRIG)		+= hid-ntrig.o
 obj-$(CONFIG_HID_PANTHERLORD)	+= hid-pl.o
 obj-$(CONFIG_HID_PETALYNX)	+= hid-petalynx.o
 obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 147ec59..6ee9a64 100644
- --- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1294,6 +1294,7 @@ static const struct hid_device_id hid_blacklist[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index e148f86..0d44b26 100644
- --- a/drivers/hid/hid-dummy.c
+++ b/drivers/hid/hid-dummy.c
@@ -43,8 +43,8 @@ static int __init hid_dummy_init(void)
 #ifdef CONFIG_HID_MONTEREY_MODULE
 	HID_COMPAT_CALL_DRIVER(monterey);
 #endif
- -#ifdef CONFIG_HID_PANTHERLORD_MODULE
- -	HID_COMPAT_CALL_DRIVER(pantherlord);
+#ifdef CONFIG_HID_NTRIG_MODULE
+	HID_COMPAT_CALL_DRIVER(ntrig);
 #endif
 #ifdef CONFIG_HID_PETALYNX_MODULE
 	HID_COMPAT_CALL_DRIVER(petalynx);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index d70075d..c3c2550 100644
- --- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -338,6 +338,9 @@
 #define USB_VENDOR_ID_NEC		0x073e
 #define USB_DEVICE_ID_NEC_USB_GAME_PAD	0x0301

+#define USB_VENDOR_ID_NTRIG                0x1b96
+#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN   0x0001
+
 #define USB_VENDOR_ID_ONTRAK		0x0a07
 #define USB_DEVICE_ID_ONTRAK_ADU100	0x0064

diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
new file mode 100644
index 0000000..549f5e1
- --- /dev/null
+++ b/drivers/hid/hid-ntrig.c
@@ -0,0 +1,82 @@
+/*
+ *  HID driver for some ntrig "special" devices
+ *
+ *  Copyright (c) 1999 Andreas Gal
+ *  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
+ *  Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
+ *  Copyright (c) 2006-2007 Jiri Kosina
+ *  Copyright (c) 2007 Paul Walmsley
+ *  Copyright (c) 2008 Jiri Slaby
+ *  Copyright (c) 2008 Rafi Rubin
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+#include "hid-ids.h"
+
+#define NTRIG_DUPLICATE_USAGES	0x001
+
+#define nt_map_key_clear(c)	hid_map_usage_clear(hi, usage, bit, max, \
+					EV_KEY, (c))
+
+static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+		struct hid_field *field, struct hid_usage *usage,
+		unsigned long **bit, int *max)
+{
+	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER &&
+			(usage->hid & 0xff) == 0x47) {
+		nt_map_key_clear(BTN_TOOL_DOUBLETAP);
+		return 1;
+	}
+	return 0;
+}
+
+static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
+		struct hid_field *field, struct hid_usage *usage,
+		unsigned long **bit, int *max)
+{
+	if (usage->type == EV_KEY || usage->type == EV_REL
+			|| usage->type == EV_ABS)
+		clear_bit(usage->code, *bit);
+
+	return 0;
+}
+static const struct hid_device_id ntrig_devices[] = {
+	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN),
+		.driver_data = NTRIG_DUPLICATE_USAGES },
+	{ }
+};
+MODULE_DEVICE_TABLE(hid, ntrig_devices);
+
+static struct hid_driver ntrig_driver = {
+	.name = "ntrig",
+	.id_table = ntrig_devices,
+	.input_mapping = ntrig_input_mapping,
+	.input_mapped = ntrig_input_mapped,
+};
+
+static int ntrig_init(void)
+{
+	return hid_register_driver(&ntrig_driver);
+}
+
+static void ntrig_exit(void)
+{
+	hid_unregister_driver(&ntrig_driver);
+}
+
+module_init(ntrig_init);
+module_exit(ntrig_exit);
+MODULE_LICENSE("GPL");
+
+HID_COMPAT_LOAD_DRIVER(ntrig);
- --
1.5.6.5


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkkJhcACgkQwuRiAT9o609q4ACfcbxS0IFnt9uUmUTcxYpugywH
WcAAnRLWr+Om3xqozOcqpAeagrddmck9
=NQkr
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] n-trig digitizer quirks
  2008-11-19 14:43               ` Rafi Rubin
@ 2008-11-19 15:02                 ` Jiri Kosina
  0 siblings, 0 replies; 10+ messages in thread
From: Jiri Kosina @ 2008-11-19 15:02 UTC (permalink / raw)
  To: Rafi Rubin; +Cc: linux-kernel

On Wed, 19 Nov 2008, Rafi Rubin wrote:

> Added quirks for the N-Trig digitizer.
> Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>

Applied, thanks Rafi!

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-11-19 15:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14 17:08 [PATCH] n-trig digitizer quirks Raphael Yoram Rubin
2008-11-18 14:27 ` Jiri Kosina
2008-11-18 20:44   ` Rafi Rubin
2008-11-19 12:58     ` Jiri Kosina
2008-11-19 13:42       ` Rafi Rubin
2008-11-19 13:52         ` Jiri Kosina
2008-11-19 14:04           ` Rafi Rubin
2008-11-19 14:07             ` Jiri Kosina
2008-11-19 14:43               ` Rafi Rubin
2008-11-19 15:02                 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®