]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
Merge branch 'master' into upstream
authorJiri Kosina <jkosina@suse.cz>
Tue, 2 Feb 2010 22:10:39 +0000 (23:10 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 2 Feb 2010 22:10:39 +0000 (23:10 +0100)
Conflicts:
drivers/hid/hid-ids.h

19 files changed:
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-3m-pct.c [new file with mode: 0644]
drivers/hid/hid-apple.c
drivers/hid/hid-core.c
drivers/hid/hid-debug.c
drivers/hid/hid-ids.h
drivers/hid/hid-input.c
drivers/hid/hid-lg.c
drivers/hid/hid-lg.h
drivers/hid/hid-lg3ff.c [new file with mode: 0644]
drivers/hid/hid-lgff.c
drivers/hid/hid-ortek.c [new file with mode: 0644]
drivers/hid/hid-quanta.c [new file with mode: 0644]
drivers/hid/hid-stantum.c [new file with mode: 0644]
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hid-quirks.c
include/linux/hid.h
include/linux/input.h

index 24d90ea246ce95096dd0d74ba3f50b1dcae4b8fc..139668d6382a0ca779ee49c416dc0afb3c8e9ce3 100644 (file)
@@ -55,6 +55,12 @@ source "drivers/hid/usbhid/Kconfig"
 menu "Special HID drivers"
        depends on HID
 
+config HID_3M_PCT
+       tristate "3M PCT"
+       depends on USB_HID
+       ---help---
+       Support for 3M PCT touch screens.
+
 config HID_A4TECH
        tristate "A4 tech" if EMBEDDED
        depends on USB_HID
@@ -183,6 +189,14 @@ config LOGIRUMBLEPAD2_FF
          Say Y here if you want to enable force feedback support for Logitech
          Rumblepad 2 devices.
 
+config LOGIG940_FF
+       bool "Logitech Flight System G940 force feedback support"
+       depends on HID_LOGITECH
+       select INPUT_FF_MEMLESS
+       help
+         Say Y here if you want to enable force feedback support for Logitech
+         Flight System G940 devices.
+
 config HID_MICROSOFT
        tristate "Microsoft" if EMBEDDED
        depends on USB_HID
@@ -204,6 +218,13 @@ config HID_NTRIG
        ---help---
        Support for N-Trig touch screen.
 
+config HID_ORTEK
+       tristate "Ortek" if EMBEDDED
+       depends on USB_HID
+       default !EMBEDDED
+       ---help---
+       Support for Ortek WKB-2000 wireless keyboard + mouse trackpad.
+
 config HID_PANTHERLORD
        tristate "Pantherlord support" if EMBEDDED
        depends on USB_HID
@@ -227,6 +248,12 @@ config HID_PETALYNX
        ---help---
        Support for Petalynx Maxter remote control.
 
+config HID_QUANTA
+       tristate "Quanta Optical Touch"
+       depends on USB_HID
+       ---help---
+       Support for Quanta Optical Touch dual-touch panels.
+
 config HID_SAMSUNG
        tristate "Samsung" if EMBEDDED
        depends on USB_HID
@@ -241,6 +268,12 @@ config HID_SONY
        ---help---
        Support for Sony PS3 controller.
 
+config HID_STANTUM
+       tristate "Stantum"
+       depends on USB_HID
+       ---help---
+       Support for Stantum multitouch panel.
+
 config HID_SUNPLUS
        tristate "Sunplus" if EMBEDDED
        depends on USB_HID
index 0de2dff5542c9c59255f546fa8b2b512d9312c9e..b62d4b3afdc2a1f863e775f94d0cf9fd6121919b 100644 (file)
@@ -18,7 +18,11 @@ endif
 ifdef CONFIG_LOGIRUMBLEPAD2_FF
        hid-logitech-objs       += hid-lg2ff.o
 endif
+ifdef CONFIG_LOGIG940_FF
+       hid-logitech-objs       += hid-lg3ff.o
+endif
 
+obj-$(CONFIG_HID_3M_PCT)       += hid-3m-pct.o
 obj-$(CONFIG_HID_A4TECH)       += hid-a4tech.o
 obj-$(CONFIG_HID_APPLE)                += hid-apple.o
 obj-$(CONFIG_HID_BELKIN)       += hid-belkin.o
@@ -34,11 +38,14 @@ 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_ORTEK)                += hid-ortek.o
+obj-$(CONFIG_HID_QUANTA)       += hid-quanta.o
 obj-$(CONFIG_HID_PANTHERLORD)  += hid-pl.o
 obj-$(CONFIG_HID_PETALYNX)     += hid-petalynx.o
 obj-$(CONFIG_HID_SAMSUNG)      += hid-samsung.o
 obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
 obj-$(CONFIG_HID_SONY)         += hid-sony.o
+obj-$(CONFIG_HID_STANTUM)      += hid-stantum.o
 obj-$(CONFIG_HID_SUNPLUS)      += hid-sunplus.o
 obj-$(CONFIG_HID_GREENASIA)    += hid-gaff.o
 obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o
diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c
new file mode 100644 (file)
index 0000000..6d11e3d
--- /dev/null
@@ -0,0 +1,291 @@
+/*
+ *  HID driver for 3M PCT multitouch panels
+ *
+ *  Copyright (c) 2009 Stephane Chatty <chatty@enac.fr>
+ *
+ */
+
+/*
+ * 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 <linux/usb.h>
+
+MODULE_VERSION("0.6");
+MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
+MODULE_DESCRIPTION("3M PCT multitouch panels");
+MODULE_LICENSE("GPL");
+
+#include "hid-ids.h"
+
+struct mmm_finger {
+       __s32 x, y;
+       __u8 rank;
+       bool touch, valid;
+};
+
+struct mmm_data {
+       struct mmm_finger f[10];
+       __u8 curid, num;
+       bool touch, valid;
+};
+
+static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       switch (usage->hid & HID_USAGE_PAGE) {
+
+       case HID_UP_BUTTON:
+               return -1;
+
+       case HID_UP_GENDESK:
+               switch (usage->hid) {
+               case HID_GD_X:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_X);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_X,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               case HID_GD_Y:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_Y);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_Y,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               }
+               return 0;
+
+       case HID_UP_DIGITIZER:
+               switch (usage->hid) {
+               /* we do not want to map these: no input-oriented meaning */
+               case 0x14:
+               case 0x23:
+               case HID_DG_INPUTMODE:
+               case HID_DG_DEVICEINDEX:
+               case HID_DG_CONTACTCOUNT:
+               case HID_DG_CONTACTMAX:
+               case HID_DG_INRANGE:
+               case HID_DG_CONFIDENCE:
+                       return -1;
+               case HID_DG_TIPSWITCH:
+                       /* touchscreen emulation */
+                       hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+                       return 1;
+               case HID_DG_CONTACTID:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TRACKING_ID);
+                       return 1;
+               }
+               /* let hid-input decide for the others */
+               return 0;
+
+       case 0xff000000:
+               /* we do not want to map these: no input-oriented meaning */
+               return -1;
+       }
+
+       return 0;
+}
+
+static int mmm_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_ABS)
+               clear_bit(usage->code, *bit);
+
+       return 0;
+}
+
+/*
+ * this function is called when a whole packet has been received and processed,
+ * so that it can decide what to send to the input layer.
+ */
+static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
+{
+       struct mmm_finger *oldest = 0;
+       bool pressed = false, released = false;
+       int i;
+
+       /*
+        * we need to iterate on all fingers to decide if we have a press
+        * or a release event in our touchscreen emulation.
+        */
+       for (i = 0; i < 10; ++i) {
+               struct mmm_finger *f = &md->f[i];
+               if (!f->valid) {
+                       /* this finger is just placeholder data, ignore */
+               } else if (f->touch) {
+                       /* this finger is on the screen */
+                       input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i);
+                       input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
+                       input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
+                       input_mt_sync(input);
+                       /*
+                        * touchscreen emulation: maintain the age rank
+                        * of this finger, decide if we have a press
+                        */
+                       if (f->rank == 0) {
+                               f->rank = ++(md->num);
+                               if (f->rank == 1)
+                                       pressed = true;
+                       }
+                       if (f->rank == 1)
+                               oldest = f;
+               } else {
+                       /* this finger took off the screen */
+                       /* touchscreen emulation: maintain age rank of others */
+                       int j;
+
+                       for (j = 0; j < 10; ++j) {
+                               struct mmm_finger *g = &md->f[j];
+                               if (g->rank > f->rank) {
+                                       g->rank--;
+                                       if (g->rank == 1)
+                                               oldest = g;
+                               }
+                       }
+                       f->rank = 0;
+                       --(md->num);
+                       if (md->num == 0)
+                               released = true;
+               }
+               f->valid = 0;
+       }
+
+       /* touchscreen emulation */
+       if (oldest) {
+               if (pressed)
+                       input_event(input, EV_KEY, BTN_TOUCH, 1);
+               input_event(input, EV_ABS, ABS_X, oldest->x);
+               input_event(input, EV_ABS, ABS_Y, oldest->y);
+       } else if (released) {
+               input_event(input, EV_KEY, BTN_TOUCH, 0);
+       }
+}
+
+/*
+ * this function is called upon all reports
+ * so that we can accumulate contact point information,
+ * and call input_mt_sync after each point.
+ */
+static int mmm_event(struct hid_device *hid, struct hid_field *field,
+                               struct hid_usage *usage, __s32 value)
+{
+       struct mmm_data *md = hid_get_drvdata(hid);
+       /*
+        * strangely, this function can be called before
+        * field->hidinput is initialized!
+        */
+       if (hid->claimed & HID_CLAIMED_INPUT) {
+               struct input_dev *input = field->hidinput->input;
+               switch (usage->hid) {
+               case HID_DG_TIPSWITCH:
+                       md->touch = value;
+                       break;
+               case HID_DG_CONFIDENCE:
+                       md->valid = value;
+                       break;
+               case HID_DG_CONTACTID:
+                       if (md->valid) {
+                               md->curid = value;
+                               md->f[value].touch = md->touch;
+                               md->f[value].valid = 1;
+                       }
+                       break;
+               case HID_GD_X:
+                       if (md->valid)
+                               md->f[md->curid].x = value;
+                       break;
+               case HID_GD_Y:
+                       if (md->valid)
+                               md->f[md->curid].y = value;
+                       break;
+               case HID_DG_CONTACTCOUNT:
+                       mmm_filter_event(md, input);
+                       break;
+               }
+       }
+
+       /* we have handled the hidinput part, now remains hiddev */
+       if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
+
+       return 1;
+}
+
+static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+       int ret;
+       struct mmm_data *md;
+
+       md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
+       if (!md) {
+               dev_err(&hdev->dev, "cannot allocate 3M data\n");
+               return -ENOMEM;
+       }
+       hid_set_drvdata(hdev, md);
+
+       ret = hid_parse(hdev);
+       if (!ret)
+               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+       if (ret)
+               kfree(md);
+       return ret;
+}
+
+static void mmm_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+       hid_set_drvdata(hdev, NULL);
+}
+
+static const struct hid_device_id mmm_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, mmm_devices);
+
+static const struct hid_usage_id mmm_grabbed_usages[] = {
+       { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+};
+
+static struct hid_driver mmm_driver = {
+       .name = "3m-pct",
+       .id_table = mmm_devices,
+       .probe = mmm_probe,
+       .remove = mmm_remove,
+       .input_mapping = mmm_input_mapping,
+       .input_mapped = mmm_input_mapped,
+       .usage_table = mmm_grabbed_usages,
+       .event = mmm_event,
+};
+
+static int __init mmm_init(void)
+{
+       return hid_register_driver(&mmm_driver);
+}
+
+static void __exit mmm_exit(void)
+{
+       hid_unregister_driver(&mmm_driver);
+}
+
+module_init(mmm_init);
+module_exit(mmm_exit);
+MODULE_LICENSE("GPL");
+
index 5b4d66dc1a05600ded73ece82be8fae8d61dc43c..78286b184ace5ebe58850623b5ab670d1c995a64 100644 (file)
@@ -40,6 +40,11 @@ module_param(fnmode, uint, 0644);
 MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, "
                "[1] = fkeyslast, 2 = fkeysfirst)");
 
+static unsigned int iso_layout = 1;
+module_param(iso_layout, uint, 0644);
+MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. "
+               "(0 = disabled, [1] = enabled)");
+
 struct apple_sc {
        unsigned long quirks;
        unsigned int fn_on;
@@ -199,11 +204,13 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
                }
        }
 
-       if (asc->quirks & APPLE_ISO_KEYBOARD) {
-               trans = apple_find_translation(apple_iso_keyboard, usage->code);
-               if (trans) {
-                       input_event(input, usage->type, trans->to, value);
-                       return 1;
+        if (iso_layout) {
+               if (asc->quirks & APPLE_ISO_KEYBOARD) {
+                       trans = apple_find_translation(apple_iso_keyboard, usage->code);
+                       if (trans) {
+                               input_event(input, usage->type, trans->to, value);
+                               return 1;
+                       }
                }
        }
 
index eabe5f87c6c1a7dfd35f66445edda66f9558669d..2dd9b28e39c46ef89303b72314dbb33e6f1fcb41 100644 (file)
@@ -4,7 +4,7 @@
  *  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) 2006-2010 Jiri Kosina
  */
 
 /*
@@ -387,7 +387,8 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
        __u32 data;
        unsigned n;
 
-       if (item->size == 0) {
+       /* Local delimiter could have value 0, which allows size to be 0 */
+       if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) {
                dbg_hid("item data expected for local item\n");
                return -1;
        }
@@ -1248,6 +1249,7 @@ EXPORT_SYMBOL_GPL(hid_disconnect);
 
 /* a list of devices for which there is a specialized driver on HID bus */
 static const struct hid_device_id hid_blacklist[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
        { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
        { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) },
@@ -1324,6 +1326,7 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
@@ -1337,10 +1340,13 @@ static const struct hid_device_id hid_blacklist[] = {
        { 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_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
        { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
        { 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) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
@@ -1661,8 +1667,6 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) },
        { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
index 6abd0369aedba0125f935dc357f292d5e6850017..cd4ece6fdfb967b8fe89227742dd49e13b09df67 100644 (file)
@@ -864,13 +864,13 @@ static const char **names[EV_MAX + 1] = {
        [EV_SND] = sounds,                      [EV_REP] = repeats,
 };
 
-void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f) {
-
+static void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f)
+{
        seq_printf(f, "%s.%s", events[type] ? events[type] : "?",
                names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
 }
 
-void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
+static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
 {
        int i, j, k;
        struct hid_report *report;
index 010368e649ed2fc54ca3832add6e91c1ea791ea2..39ff98a5bd6169152e2fca864f7cc666288e32ac 100644 (file)
@@ -18,6 +18,9 @@
 #ifndef HID_IDS_H_FILE
 #define HID_IDS_H_FILE
 
+#define USB_VENDOR_ID_3M               0x0596
+#define USB_DEVICE_ID_3M1968           0x0500
+
 #define USB_VENDOR_ID_A4TECH           0x09da
 #define USB_DEVICE_ID_A4TECH_WCP32PU   0x0006
 #define USB_DEVICE_ID_A4TECH_X5_005D   0x000a
 #define USB_VENDOR_ID_ESSENTIAL_REALITY        0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
 
+#define USB_VENDOR_ID_ETURBOTOUCH      0x22b9
+#define USB_DEVICE_ID_ETURBOTOUCH      0x0006
+
 #define USB_VENDOR_ID_ETT              0x0664
 #define USB_DEVICE_ID_TC5UH            0x0309
 
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2    0xc219
 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D     0xc283
 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO     0xc286
+#define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940      0xc287
 #define USB_DEVICE_ID_LOGITECH_WHEEL   0xc294
 #define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG     0xc293
 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL      0xc295
 #define USB_VENDOR_ID_ONTRAK           0x0a07
 #define USB_DEVICE_ID_ONTRAK_ADU100    0x0064
 
+#define USB_VENDOR_ID_ORTEK            0x05a4
+#define USB_DEVICE_ID_ORTEK_WKB2000    0x2000
+
 #define USB_VENDOR_ID_PANJIT           0x134c
 
 #define USB_VENDOR_ID_PANTHERLORD      0x0810
 #define USB_VENDOR_ID_POWERCOM         0x0d9f
 #define USB_DEVICE_ID_POWERCOM_UPS     0x0002
 
+#define USB_VENDOR_ID_PRODIGE          0x05af
+#define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062
+
 #define USB_VENDOR_ID_SAITEK           0x06a3
 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
 
+#define USB_VENDOR_ID_QUANTA           0x0408
+#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH     0x3000
+
 #define USB_VENDOR_ID_SAMSUNG          0x0419
 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE        0x0001
 
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST    0x0034
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST     0x0046
 
+#define USB_VENDOR_ID_STANTUM          0x1f87
+#define USB_DEVICE_ID_MTP              0x0002
+
 #define USB_VENDOR_ID_SUN              0x0430
 #define USB_DEVICE_ID_RARITAN_KVM_DONGLE       0xcdab
 
 #define USB_VENDOR_ID_SUNPLUS          0x04fc
 #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8
 
-#define USB_VENDOR_ID_TENX             0x1130
-#define USB_DEVICE_ID_TENX_IBUDDY1     0x0001
-#define USB_DEVICE_ID_TENX_IBUDDY2     0x0002
-
 #define USB_VENDOR_ID_THRUSTMASTER     0x044f
 
 #define USB_VENDOR_ID_TOPMAX           0x0663
index 5862b0f3b55d1de24413744cde877ca33031212a..8430d626511c91a79ef70fc7f5a0684df314a717 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (c) 2000-2001 Vojtech Pavlik
- *  Copyright (c) 2006-2007 Jiri Kosina
+ *  Copyright (c) 2006-2010 Jiri Kosina
  *
  *  HID to Linux Input mapping
  */
@@ -198,7 +198,12 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                switch (field->application) {
                case HID_GD_MOUSE:
                case HID_GD_POINTER:  code += 0x110; break;
-               case HID_GD_JOYSTICK: code += 0x120; break;
+               case HID_GD_JOYSTICK:
+                                     if (code <= 0xf)
+                                             code += BTN_JOYSTICK;
+                                     else
+                                             code += BTN_TRIGGER_HAPPY;
+                                     break;
                case HID_GD_GAMEPAD:  code += 0x130; break;
                default:
                        switch (field->physical) {
index 9fcd3d017ab3ac012906b296e81e9c78ccb070c5..3677c9037a11036da88292adf0693b6ea1531242 100644 (file)
@@ -34,6 +34,7 @@
 #define LG_FF                  0x200
 #define LG_FF2                 0x400
 #define LG_RDESC_REL_ABS       0x800
+#define LG_FF3                 0x1000
 
 /*
  * Certain Logitech keyboards send in report #3 keys which are far
@@ -266,7 +267,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
                goto err_free;
        }
 
-       if (quirks & (LG_FF | LG_FF2))
+       if (quirks & (LG_FF | LG_FF2 | LG_FF3))
                connect_mask &= ~HID_CONNECT_FF;
 
        ret = hid_hw_start(hdev, connect_mask);
@@ -279,6 +280,8 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
                lgff_init(hdev);
        if (quirks & LG_FF2)
                lg2ff_init(hdev);
+       if (quirks & LG_FF3)
+               lg3ff_init(hdev);
 
        return 0;
 err_free:
@@ -331,6 +334,8 @@ static const struct hid_device_id lg_devices[] = {
                .driver_data = LG_FF },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
                .driver_data = LG_FF2 },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940),
+               .driver_data = LG_FF3 },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
                .driver_data = LG_RDESC_REL_ABS },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER),
index bf31592eaf79dc32757296f47191e6e66f1d2477..ce2ac86726245e984829680ba64a77d5bd38a5f2 100644 (file)
@@ -13,4 +13,10 @@ int lg2ff_init(struct hid_device *hdev);
 static inline int lg2ff_init(struct hid_device *hdev) { return -1; }
 #endif
 
+#ifdef CONFIG_LOGIG940_FF
+int lg3ff_init(struct hid_device *hdev);
+#else
+static inline int lg3ff_init(struct hid_device *hdev) { return -1; }
+#endif
+
 #endif
diff --git a/drivers/hid/hid-lg3ff.c b/drivers/hid/hid-lg3ff.c
new file mode 100644 (file)
index 0000000..4002832
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ *  Force feedback support for Logitech Flight System G940
+ *
+ *  Copyright (c) 2009 Gary Stein <LordCnidarian@gmail.com>
+ */
+
+/*
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <linux/input.h>
+#include <linux/usb.h>
+#include <linux/hid.h>
+
+#include "usbhid/usbhid.h"
+#include "hid-lg.h"
+
+/*
+ * G940 Theory of Operation (from experimentation)
+ *
+ * There are 63 fields (only 3 of them currently used)
+ * 0 - seems to be command field
+ * 1 - 30 deal with the x axis
+ * 31 -60 deal with the y axis
+ *
+ * Field 1 is x axis constant force
+ * Field 31 is y axis constant force
+ *
+ * other interesting fields 1,2,3,4 on x axis
+ * (same for 31,32,33,34 on y axis)
+ *
+ * 0 0 127 127 makes the joystick autocenter hard
+ *
+ * 127 0 127 127 makes the joystick loose on the right,
+ * but stops all movemnt left
+ *
+ * -127 0 -127 -127 makes the joystick loose on the left,
+ * but stops all movement right
+ *
+ * 0 0 -127 -127 makes the joystick rattle very hard
+ *
+ * I'm sure these are effects that I don't know enough about them
+ */
+
+struct lg3ff_device {
+       struct hid_report *report;
+};
+
+static int hid_lg3ff_play(struct input_dev *dev, void *data,
+                        struct ff_effect *effect)
+{
+       struct hid_device *hid = input_get_drvdata(dev);
+       struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+       struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
+       int x, y;
+
+/*
+ * Maxusage should always be 63 (maximum fields)
+ * likely a better way to ensure this data is clean
+ */
+       memset(report->field[0]->value, 0, sizeof(__s32)*report->field[0]->maxusage);
+
+       switch (effect->type) {
+       case FF_CONSTANT:
+/*
+ * Already clamped in ff_memless
+ * 0 is center (different then other logitech)
+ */
+               x = effect->u.ramp.start_level;
+               y = effect->u.ramp.end_level;
+
+               /* send command byte */
+               report->field[0]->value[0] = 0x51;
+
+/*
+ * Sign backwards from other Force3d pro
+ * which get recast here in two's complement 8 bits
+ */
+               report->field[0]->value[1] = (unsigned char)(-x);
+               report->field[0]->value[31] = (unsigned char)(-y);
+
+               usbhid_submit_report(hid, report, USB_DIR_OUT);
+               break;
+       }
+       return 0;
+}
+static void hid_lg3ff_set_autocenter(struct input_dev *dev, u16 magnitude)
+{
+       struct hid_device *hid = input_get_drvdata(dev);
+       struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+       struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
+
+/*
+ * Auto Centering probed from device
+ * NOTE: deadman's switch on G940 must be covered
+ * for effects to work
+ */
+       report->field[0]->value[0] = 0x51;
+       report->field[0]->value[1] = 0x00;
+       report->field[0]->value[2] = 0x00;
+       report->field[0]->value[3] = 0x7F;
+       report->field[0]->value[4] = 0x7F;
+       report->field[0]->value[31] = 0x00;
+       report->field[0]->value[32] = 0x00;
+       report->field[0]->value[33] = 0x7F;
+       report->field[0]->value[34] = 0x7F;
+
+       usbhid_submit_report(hid, report, USB_DIR_OUT);
+}
+
+
+static const signed short ff3_joystick_ac[] = {
+       FF_CONSTANT,
+       FF_AUTOCENTER,
+       -1
+};
+
+int lg3ff_init(struct hid_device *hid)
+{
+       struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
+       struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+       struct input_dev *dev = hidinput->input;
+       struct hid_report *report;
+       struct hid_field *field;
+       const signed short *ff_bits = ff3_joystick_ac;
+       int error;
+       int i;
+
+       /* Find the report to use */
+       if (list_empty(report_list)) {
+               err_hid("No output report found");
+               return -1;
+       }
+
+       /* Check that the report looks ok */
+       report = list_entry(report_list->next, struct hid_report, list);
+       if (!report) {
+               err_hid("NULL output report");
+               return -1;
+       }
+
+       field = report->field[0];
+       if (!field) {
+               err_hid("NULL field");
+               return -1;
+       }
+
+       /* Assume single fixed device G940 */
+       for (i = 0; ff_bits[i] >= 0; i++)
+               set_bit(ff_bits[i], dev->ffbit);
+
+       error = input_ff_create_memless(dev, NULL, hid_lg3ff_play);
+       if (error)
+               return error;
+
+       if (test_bit(FF_AUTOCENTER, dev->ffbit))
+               dev->ff->set_autocenter = hid_lg3ff_set_autocenter;
+
+       dev_info(&hid->dev, "Force feedback for Logitech Flight System G940 by "
+                       "Gary Stein <LordCnidarian@gmail.com>\n");
+       return 0;
+}
+
index 987abebe08296a4f37770e2164e623012d4cac95..61142b76a9b19fe90826dfda870d7717d7f36f4b 100644 (file)
@@ -67,6 +67,7 @@ static const struct dev_type devices[] = {
        { 0x046d, 0xc219, ff_rumble },
        { 0x046d, 0xc283, ff_joystick },
        { 0x046d, 0xc286, ff_joystick_ac },
+       { 0x046d, 0xc287, ff_joystick_ac },
        { 0x046d, 0xc293, ff_joystick },
        { 0x046d, 0xc294, ff_wheel },
        { 0x046d, 0xc295, ff_joystick },
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
new file mode 100644 (file)
index 0000000..aa9a960
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ *  HID driver for Ortek WKB-2000 (wireless keyboard + mouse trackpad).
+ *  Fixes LogicalMaximum error in USB report description, see
+ *  http://bugzilla.kernel.org/show_bug.cgi?id=14787
+ *
+ *  Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
+ */
+
+/*
+ * 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"
+
+static void ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+               unsigned int rsize)
+{
+       if (rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
+               dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 "
+                               "report descriptor.\n");
+               rdesc[55] = 0x92;
+       }
+}
+
+static const struct hid_device_id ortek_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, ortek_devices);
+
+static struct hid_driver ortek_driver = {
+       .name = "ortek",
+       .id_table = ortek_devices,
+       .report_fixup = ortek_report_fixup
+};
+
+static int __init ortek_init(void)
+{
+       return hid_register_driver(&ortek_driver);
+}
+
+static void __exit ortek_exit(void)
+{
+       hid_unregister_driver(&ortek_driver);
+}
+
+module_init(ortek_init);
+module_exit(ortek_exit);
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-quanta.c b/drivers/hid/hid-quanta.c
new file mode 100644 (file)
index 0000000..244d61c
--- /dev/null
@@ -0,0 +1,259 @@
+/*
+ *  HID driver for Quanta Optical Touch dual-touch panels
+ *
+ *  Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
+ *
+ */
+
+/*
+ * 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>
+
+MODULE_VERSION("1.00");
+MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
+MODULE_DESCRIPTION("Quanta dual-touch panel");
+MODULE_LICENSE("GPL");
+
+#include "hid-ids.h"
+
+struct quanta_data {
+       __u16 x, y;
+       __u8 id;
+       bool valid;             /* valid finger data, or just placeholder? */
+       bool first;             /* is this the first finger in this frame? */
+       bool activity_now;      /* at least one active finger in this frame? */
+       bool activity;          /* at least one active finger previously? */
+};
+
+static int quanta_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       switch (usage->hid & HID_USAGE_PAGE) {
+
+       case HID_UP_GENDESK:
+               switch (usage->hid) {
+               case HID_GD_X:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_X);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_X,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               case HID_GD_Y:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_Y);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_Y,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               }
+               return 0;
+
+       case HID_UP_DIGITIZER:
+               switch (usage->hid) {
+               case HID_DG_CONFIDENCE:
+               case HID_DG_TIPSWITCH:
+               case HID_DG_INPUTMODE:
+               case HID_DG_DEVICEINDEX:
+               case HID_DG_CONTACTCOUNT:
+               case HID_DG_CONTACTMAX:
+               case HID_DG_TIPPRESSURE:
+               case HID_DG_WIDTH:
+               case HID_DG_HEIGHT:
+                       return -1;
+               case HID_DG_INRANGE:
+                       /* touchscreen emulation */
+                       hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+                       return 1;
+               case HID_DG_CONTACTID:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TRACKING_ID);
+                       return 1;
+               }
+               return 0;
+
+       case 0xff000000:
+               /* ignore vendor-specific features */
+               return -1;
+       }
+
+       return 0;
+}
+
+static int quanta_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_ABS)
+               clear_bit(usage->code, *bit);
+
+       return 0;
+}
+
+/*
+ * this function is called when a whole finger has been parsed,
+ * so that it can decide what to send to the input layer.
+ */
+static void quanta_filter_event(struct quanta_data *td, struct input_dev *input)
+{
+       
+       td->first = !td->first; /* touchscreen emulation */
+
+       if (!td->valid) {
+               /*
+                * touchscreen emulation: if no finger in this frame is valid
+                * and there previously was finger activity, this is a release
+                */ 
+               if (!td->first && !td->activity_now && td->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 0);
+                       td->activity = false;
+               }
+               return;
+       }
+
+       input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id);
+       input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x);
+       input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y);
+
+       input_mt_sync(input);
+       td->valid = false;
+
+       /* touchscreen emulation: if first active finger in this frame... */
+       if (!td->activity_now) {
+               /* if there was no previous activity, emit touch event */
+               if (!td->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 1);
+                       td->activity = true;
+               }
+               td->activity_now = true;
+               /* and in any case this is our preferred finger */
+               input_event(input, EV_ABS, ABS_X, td->x);
+               input_event(input, EV_ABS, ABS_Y, td->y);
+       }
+}
+
+
+static int quanta_event(struct hid_device *hid, struct hid_field *field,
+                               struct hid_usage *usage, __s32 value)
+{
+       struct quanta_data *td = hid_get_drvdata(hid);
+
+       if (hid->claimed & HID_CLAIMED_INPUT) {
+               struct input_dev *input = field->hidinput->input;
+
+               switch (usage->hid) {
+               case HID_DG_INRANGE:
+                       td->valid = !!value;
+                       break;
+               case HID_GD_X:
+                       td->x = value;
+                       break;
+               case HID_GD_Y:
+                       td->y = value;
+                       quanta_filter_event(td, input);
+                       break;
+               case HID_DG_CONTACTID:
+                       td->id = value;
+                       break;
+               case HID_DG_CONTACTCOUNT:
+                       /* touch emulation: this is the last field in a frame */
+                       td->first = false;
+                       td->activity_now = false;
+                       break;
+               case HID_DG_CONFIDENCE:
+               case HID_DG_TIPSWITCH:
+                       /* avoid interference from generic hidinput handling */
+                       break;
+
+               default:
+                       /* fallback to the generic hidinput handling */
+                       return 0;
+               }
+       }
+
+       /* we have handled the hidinput part, now remains hiddev */
+       if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
+
+       return 1;
+}
+
+static int quanta_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+       int ret;
+       struct quanta_data *td;
+
+       td = kmalloc(sizeof(struct quanta_data), GFP_KERNEL);
+       if (!td) {
+               dev_err(&hdev->dev, "cannot allocate Quanta Touch data\n");
+               return -ENOMEM;
+       }
+       td->valid = false;
+       td->activity = false;
+       td->activity_now = false;
+       td->first = false;
+       hid_set_drvdata(hdev, td);
+
+       ret = hid_parse(hdev);
+       if (!ret)
+               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+       if (ret)
+               kfree(td);
+
+       return ret;
+}
+
+static void quanta_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+       hid_set_drvdata(hdev, NULL);
+}
+
+static const struct hid_device_id quanta_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA,
+                       USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, quanta_devices);
+
+static const struct hid_usage_id quanta_grabbed_usages[] = {
+       { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+};
+
+static struct hid_driver quanta_driver = {
+       .name = "quanta-touch",
+       .id_table = quanta_devices,
+       .probe = quanta_probe,
+       .remove = quanta_remove,
+       .input_mapping = quanta_input_mapping,
+       .input_mapped = quanta_input_mapped,
+       .usage_table = quanta_grabbed_usages,
+       .event = quanta_event,
+};
+
+static int __init quanta_init(void)
+{
+       return hid_register_driver(&quanta_driver);
+}
+
+static void __exit quanta_exit(void)
+{
+       hid_unregister_driver(&quanta_driver);
+}
+
+module_init(quanta_init);
+module_exit(quanta_exit);
+
diff --git a/drivers/hid/hid-stantum.c b/drivers/hid/hid-stantum.c
new file mode 100644 (file)
index 0000000..add965d
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ *  HID driver for Stantum multitouch panels
+ *
+ *  Copyright (c) 2009 Stephane Chatty <chatty@enac.fr>
+ *
+ */
+
+/*
+ * 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>
+
+MODULE_VERSION("0.6");
+MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
+MODULE_DESCRIPTION("Stantum HID multitouch panels");
+MODULE_LICENSE("GPL");
+
+#include "hid-ids.h"
+
+struct stantum_data {
+       __s32 x, y, z, w, h;    /* x, y, pressure, width, height */
+       __u16 id;               /* touch id */
+       bool valid;             /* valid finger data, or just placeholder? */
+       bool first;             /* first finger in the HID packet? */
+       bool activity;          /* at least one active finger so far? */
+};
+
+static int stantum_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+               struct hid_field *field, struct hid_usage *usage,
+               unsigned long **bit, int *max)
+{
+       switch (usage->hid & HID_USAGE_PAGE) {
+
+       case HID_UP_GENDESK:
+               switch (usage->hid) {
+               case HID_GD_X:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_X);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_X,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               case HID_GD_Y:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_POSITION_Y);
+                       /* touchscreen emulation */
+                       input_set_abs_params(hi->input, ABS_Y,
+                                               field->logical_minimum,
+                                               field->logical_maximum, 0, 0);
+                       return 1;
+               }
+               return 0;
+
+       case HID_UP_DIGITIZER:
+               switch (usage->hid) {
+               case HID_DG_INRANGE:
+               case HID_DG_CONFIDENCE:
+               case HID_DG_INPUTMODE:
+               case HID_DG_DEVICEINDEX:
+               case HID_DG_CONTACTCOUNT:
+               case HID_DG_CONTACTMAX:
+               case HID_DG_TIPPRESSURE:
+                       return -1;
+
+               case HID_DG_TIPSWITCH:
+                       /* touchscreen emulation */
+                       hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+                       return 1;
+
+               case HID_DG_WIDTH:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TOUCH_MAJOR);
+                       return 1;
+               case HID_DG_HEIGHT:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TOUCH_MINOR);
+                       input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
+                                       1, 1, 0, 0);
+                       return 1;
+               case HID_DG_CONTACTID:
+                       hid_map_usage(hi, usage, bit, max,
+                                       EV_ABS, ABS_MT_TRACKING_ID);
+                       return 1;
+
+               }
+               return 0;
+
+       case 0xff000000:
+               /* no input-oriented meaning */
+               return -1;
+       }
+
+       return 0;
+}
+
+static int stantum_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_ABS)
+               clear_bit(usage->code, *bit);
+
+       return 0;
+}
+
+/*
+ * this function is called when a whole finger has been parsed,
+ * so that it can decide what to send to the input layer.
+ */
+static void stantum_filter_event(struct stantum_data *sd,
+                                       struct input_dev *input)
+{
+       bool wide;
+
+       if (!sd->valid) {
+               /*
+                * touchscreen emulation: if the first finger is not valid and
+                * there previously was finger activity, this is a release
+                */
+               if (sd->first && sd->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 0);
+                       sd->activity = false;
+               }
+               return;
+       }
+
+       input_event(input, EV_ABS, ABS_MT_TRACKING_ID, sd->id);
+       input_event(input, EV_ABS, ABS_MT_POSITION_X, sd->x);
+       input_event(input, EV_ABS, ABS_MT_POSITION_Y, sd->y);
+
+       wide = (sd->w > sd->h);
+       input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
+       input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, wide ? sd->w : sd->h);
+       input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, wide ? sd->h : sd->w);
+
+#if 0
+       /* MT_PRESSURE does not exist yet */
+       input_event(input, EV_ABS, ABS_MT_PRESSURE, sd->z);
+#endif
+
+       input_mt_sync(input);
+       sd->valid = false;
+       sd->first = false;
+
+       /* touchscreen emulation */
+       if (sd->first) {
+               if (!sd->activity) {
+                       input_event(input, EV_KEY, BTN_TOUCH, 1);
+                       sd->activity = true;
+               }
+               input_event(input, EV_ABS, ABS_X, sd->x);
+               input_event(input, EV_ABS, ABS_Y, sd->y);
+       }
+}
+
+
+static int stantum_event(struct hid_device *hid, struct hid_field *field,
+                               struct hid_usage *usage, __s32 value)
+{
+       struct stantum_data *sd = hid_get_drvdata(hid);
+
+       if (hid->claimed & HID_CLAIMED_INPUT) {
+               struct input_dev *input = field->hidinput->input;
+
+               switch (usage->hid) {
+               case HID_DG_INRANGE:
+                       /* this is the last field in a finger */
+                       stantum_filter_event(sd, input);
+                       break;
+               case HID_DG_WIDTH:
+                       sd->w = value;
+                       break;
+               case HID_DG_HEIGHT:
+                       sd->h = value;
+                       break;
+               case HID_GD_X:
+                       sd->x = value;
+                       break;
+               case HID_GD_Y:
+                       sd->y = value;
+                       break;
+               case HID_DG_TIPPRESSURE:
+                       sd->z = value;
+                       break;
+               case HID_DG_CONTACTID:
+                       sd->id = value;
+                       break;
+               case HID_DG_CONFIDENCE:
+                       sd->valid = !!value;
+                       break;
+               case 0xff000002:
+                       /* this comes only before the first finger */
+                       sd->first = true;
+                       break;
+
+               default:
+                       /* ignore the others */
+                       return 1;
+               }
+       }
+
+       /* we have handled the hidinput part, now remains hiddev */
+       if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
+               hid->hiddev_hid_event(hid, field, usage, value);
+
+       return 1;
+}
+
+static int stantum_probe(struct hid_device *hdev,
+                               const struct hid_device_id *id)
+{
+       int ret;
+       struct stantum_data *sd;
+
+       sd = kmalloc(sizeof(struct stantum_data), GFP_KERNEL);
+       if (!sd) {
+               dev_err(&hdev->dev, "cannot allocate Stantum data\n");
+               return -ENOMEM;
+       }
+       sd->valid = false;
+       sd->first = false;
+       sd->activity = false;
+       hid_set_drvdata(hdev, sd);
+
+       ret = hid_parse(hdev);
+       if (!ret)
+               ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
+
+       if (ret)
+               kfree(sd);
+
+       return ret;
+}
+
+static void stantum_remove(struct hid_device *hdev)
+{
+       hid_hw_stop(hdev);
+       kfree(hid_get_drvdata(hdev));
+       hid_set_drvdata(hdev, NULL);
+}
+
+static const struct hid_device_id stantum_devices[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) },
+       { }
+};
+MODULE_DEVICE_TABLE(hid, stantum_devices);
+
+static const struct hid_usage_id stantum_grabbed_usages[] = {
+       { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
+       { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
+};
+
+static struct hid_driver stantum_driver = {
+       .name = "stantum",
+       .id_table = stantum_devices,
+       .probe = stantum_probe,
+       .remove = stantum_remove,
+       .input_mapping = stantum_input_mapping,
+       .input_mapped = stantum_input_mapped,
+       .usage_table = stantum_grabbed_usages,
+       .event = stantum_event,
+};
+
+static int __init stantum_init(void)
+{
+       return hid_register_driver(&stantum_driver);
+}
+
+static void __exit stantum_exit(void)
+{
+       hid_unregister_driver(&stantum_driver);
+}
+
+module_init(stantum_init);
+module_exit(stantum_exit);
+
index e2997a8d5e1b4b726ac9b62f0d60e2647ae37ce4..54060741d45b2ceddca10bb6a64dbd6af0071afb 100644 (file)
@@ -5,7 +5,7 @@
  *  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
  *  Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
  *  Copyright (c) 2007-2008 Oliver Neukum
- *  Copyright (c) 2006-2009 Jiri Kosina
+ *  Copyright (c) 2006-2010 Jiri Kosina
  */
 
 /*
@@ -1342,7 +1342,7 @@ static int hid_reset_resume(struct usb_interface *intf)
 
 #endif /* CONFIG_PM */
 
-static struct usb_device_id hid_usb_ids [] = {
+static const struct usb_device_id hid_usb_ids[] = {
        { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS,
                .bInterfaceClass = USB_INTERFACE_CLASS_HID },
        { }                                             /* Terminating entry */
index 38773dc2821b3360119afad656aab279046bdaba..88a1c693fdcc91b1c7381c6da68a78e7007b6756 100644 (file)
@@ -43,8 +43,10 @@ static const struct hid_blacklist {
 
        { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL },
 
+       { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
        { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },
+       { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET },
 
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },
index 87093652dda8d00ee341132f40eb17d5b46171be..b978c1e2e74df870fd9f455e921fd466998307e1 100644 (file)
@@ -663,7 +663,7 @@ struct hid_ll_driver {
 
 /* Applications from HID Usage Tables 4/8/99 Version 1.1 */
 /* We ignore a few input applications that are not widely used */
-#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
+#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006)))
 
 /* HID core API */
 
index 735ceaf1bc2d5ef1ab80eedff4a070e0a6cc5420..6e04c9e811f394a63cd2480df3947ddbe7c7bbe8 100644 (file)
@@ -597,6 +597,48 @@ struct input_absinfo {
 
 #define KEY_CAMERA_FOCUS       0x210
 
+#define BTN_TRIGGER_HAPPY              0x2c0
+#define BTN_TRIGGER_HAPPY1             0x2c0
+#define BTN_TRIGGER_HAPPY2             0x2c1
+#define BTN_TRIGGER_HAPPY3             0x2c2
+#define BTN_TRIGGER_HAPPY4             0x2c3
+#define BTN_TRIGGER_HAPPY5             0x2c4
+#define BTN_TRIGGER_HAPPY6             0x2c5
+#define BTN_TRIGGER_HAPPY7             0x2c6
+#define BTN_TRIGGER_HAPPY8             0x2c7
+#define BTN_TRIGGER_HAPPY9             0x2c8
+#define BTN_TRIGGER_HAPPY10            0x2c9
+#define BTN_TRIGGER_HAPPY11            0x2ca
+#define BTN_TRIGGER_HAPPY12            0x2cb
+#define BTN_TRIGGER_HAPPY13            0x2cc
+#define BTN_TRIGGER_HAPPY14            0x2cd
+#define BTN_TRIGGER_HAPPY15            0x2ce
+#define BTN_TRIGGER_HAPPY16            0x2cf
+#define BTN_TRIGGER_HAPPY17            0x2d0
+#define BTN_TRIGGER_HAPPY18            0x2d1
+#define BTN_TRIGGER_HAPPY19            0x2d2
+#define BTN_TRIGGER_HAPPY20            0x2d3
+#define BTN_TRIGGER_HAPPY21            0x2d4
+#define BTN_TRIGGER_HAPPY22            0x2d5
+#define BTN_TRIGGER_HAPPY23            0x2d6
+#define BTN_TRIGGER_HAPPY24            0x2d7
+#define BTN_TRIGGER_HAPPY25            0x2d8
+#define BTN_TRIGGER_HAPPY26            0x2d9
+#define BTN_TRIGGER_HAPPY27            0x2da
+#define BTN_TRIGGER_HAPPY28            0x2db
+#define BTN_TRIGGER_HAPPY29            0x2dc
+#define BTN_TRIGGER_HAPPY30            0x2dd
+#define BTN_TRIGGER_HAPPY31            0x2de
+#define BTN_TRIGGER_HAPPY32            0x2df
+#define BTN_TRIGGER_HAPPY33            0x2e0
+#define BTN_TRIGGER_HAPPY34            0x2e1
+#define BTN_TRIGGER_HAPPY35            0x2e2
+#define BTN_TRIGGER_HAPPY36            0x2e3
+#define BTN_TRIGGER_HAPPY37            0x2e4
+#define BTN_TRIGGER_HAPPY38            0x2e5
+#define BTN_TRIGGER_HAPPY39            0x2e6
+#define BTN_TRIGGER_HAPPY40            0x2e7
+
 /* We avoid low common keys in module aliases so they don't get huge. */
 #define KEY_MIN_INTERESTING    KEY_MUTE
 #define KEY_MAX                        0x2ff