diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/Kconfig | 151 | ||||
-rw-r--r-- | drivers/hid/Makefile | 6 | ||||
-rw-r--r-- | drivers/hid/hid-3m-pct.c | 31 | ||||
-rw-r--r-- | drivers/hid/hid-cando.c | 272 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 53 | ||||
-rw-r--r-- | drivers/hid/hid-egalax.c | 281 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 25 | ||||
-rw-r--r-- | drivers/hid/hid-lg.c | 9 | ||||
-rw-r--r-- | drivers/hid/hid-magicmouse.c | 5 | ||||
-rw-r--r-- | drivers/hid/hid-ntrig.c | 526 | ||||
-rw-r--r-- | drivers/hid/hid-picolcd.c | 2631 | ||||
-rw-r--r-- | drivers/hid/hid-prodikeys.c | 910 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-kone.c | 994 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-kone.h | 224 | ||||
-rw-r--r-- | drivers/hid/hid-samsung.c | 95 | ||||
-rw-r--r-- | drivers/hid/hid-topseed.c | 38 | ||||
-rw-r--r-- | drivers/hid/hid-wacom.c | 229 | ||||
-rw-r--r-- | drivers/hid/hid-zydacron.c | 237 | ||||
-rw-r--r-- | drivers/hid/hidraw.c | 50 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 73 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 1 | ||||
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 19 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbkbd.c | 1 |
23 files changed, 6704 insertions, 157 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 71d4c070362..76ba59b9fea 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -86,6 +86,12 @@ config HID_BELKIN ---help--- Support for Belkin Flip KVM and Wireless keyboard. +config HID_CANDO + tristate "Cando dual touch panel" + depends on USB_HID + ---help--- + Support for Cando dual touch panel. + config HID_CHERRY tristate "Cherry" if EMBEDDED depends on USB_HID @@ -100,6 +106,21 @@ config HID_CHICONY ---help--- Support for Chicony Tactical pad. +config HID_PRODIKEYS + tristate "Prodikeys PC-MIDI Keyboard support" + depends on USB_HID && SND + select SND_RAWMIDI + ---help--- + Support for Prodikeys PC-MIDI Keyboard device support. + Say Y here to enable support for this device. + - Prodikeys PC-MIDI keyboard. + The Prodikeys PC-MIDI acts as a USB Audio device, with one MIDI + input and one MIDI output. These MIDI jacks appear as + a sound "card" in the ALSA sound system. + Note: if you say N here, this device will still function as a basic + multimedia keyboard, but will lack support for the musical keyboard + and some additional multimedia keys. + config HID_CYPRESS tristate "Cypress" if EMBEDDED depends on USB_HID @@ -108,9 +129,8 @@ config HID_CYPRESS Support for cypress mouse and barcode readers. config HID_DRAGONRISE - tristate "DragonRise Inc. support" if EMBEDDED + tristate "DragonRise Inc. support" depends on USB_HID - default !EMBEDDED ---help--- Say Y here if you have DragonRise Inc.game controllers. @@ -122,6 +142,12 @@ config DRAGONRISE_FF Say Y here if you want to enable force feedback support for DragonRise Inc. game controllers. +config HID_EGALAX + tristate "eGalax multi-touch panel" + depends on USB_HID + ---help--- + Support for the eGalax dual-touch panel. + config HID_EZKEY tristate "Ezkey" if EMBEDDED depends on USB_HID @@ -137,16 +163,14 @@ config HID_KYE Support for Kye/Genius Ergo Mouse. config HID_GYRATION - tristate "Gyration" if EMBEDDED + tristate "Gyration" depends on USB_HID - default !EMBEDDED ---help--- Support for Gyration remote control. config HID_TWINHAN - tristate "Twinhan" if EMBEDDED + tristate "Twinhan" depends on USB_HID - default !EMBEDDED ---help--- Support for Twinhan IR remote control. @@ -233,16 +257,14 @@ config HID_NTRIG Support for N-Trig touch screen. config HID_ORTEK - tristate "Ortek" if EMBEDDED + tristate "Ortek" depends on USB_HID - default !EMBEDDED ---help--- Support for Ortek WKB-2000 wireless keyboard + mouse trackpad. config HID_PANTHERLORD - tristate "Pantherlord support" if EMBEDDED + tristate "Pantherlord support" depends on USB_HID - default !EMBEDDED ---help--- Say Y here if you have a PantherLord/GreenAsia based game controller or adapter. @@ -256,29 +278,90 @@ config PANTHERLORD_FF or adapter and want to enable force feedback support for it. config HID_PETALYNX - tristate "Petalynx" if EMBEDDED + tristate "Petalynx" depends on USB_HID - default !EMBEDDED ---help--- Support for Petalynx Maxter remote control. +config HID_PICOLCD + tristate "PicoLCD (graphic version)" + depends on USB_HID + ---help--- + This provides support for Minibox PicoLCD devices, currently + only the graphical ones are supported. + + This includes support for the following device features: + - Keypad + - Switching between Firmware and Flash mode + - EEProm / Flash access (via debugfs) + Features selectively enabled: + - Framebuffer for monochrome 256x64 display + - Backlight control + - Contrast control + - General purpose outputs + Features that are not (yet) supported: + - IR + +config HID_PICOLCD_FB + bool "Framebuffer support" if EMBEDDED + default !EMBEDDED + depends on HID_PICOLCD + depends on HID_PICOLCD=FB || FB=y + select FB_DEFERRED_IO + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_SYS_FOPS + ---help--- + Provide access to PicoLCD's 256x64 monochrome display via a + frambuffer device. + +config HID_PICOLCD_BACKLIGHT + bool "Backlight control" if EMBEDDED + default !EMBEDDED + depends on HID_PICOLCD + depends on HID_PICOLCD=BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=y + ---help--- + Provide access to PicoLCD's backlight control via backlight + class. + +config HID_PICOLCD_LCD + bool "Contrast control" if EMBEDDED + default !EMBEDDED + depends on HID_PICOLCD + depends on HID_PICOLCD=LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=y + ---help--- + Provide access to PicoLCD's LCD contrast via lcd class. + +config HID_PICOLCD_LEDS + bool "GPO via leds class" if EMBEDDED + default !EMBEDDED + depends on HID_PICOLCD + depends on HID_PICOLCD=LEDS_CLASS || LEDS_CLASS=y + ---help--- + Provide access to PicoLCD's GPO pins via leds class. + config HID_QUANTA tristate "Quanta Optical Touch" depends on USB_HID ---help--- Support for Quanta Optical Touch dual-touch panels. +config HID_ROCCAT_KONE + tristate "Roccat Kone Mouse support" + depends on USB_HID + ---help--- + Support for Roccat Kone mouse. + config HID_SAMSUNG - tristate "Samsung" if EMBEDDED + tristate "Samsung" depends on USB_HID - default !EMBEDDED ---help--- - Support for Samsung InfraRed remote control. + Support for Samsung InfraRed remote control or keyboards. config HID_SONY - tristate "Sony" if EMBEDDED + tristate "Sony" depends on USB_HID - default !EMBEDDED ---help--- Support for Sony PS3 controller. @@ -289,16 +372,14 @@ config HID_STANTUM Support for Stantum multitouch panel. config HID_SUNPLUS - tristate "Sunplus" if EMBEDDED + tristate "Sunplus" depends on USB_HID - default !EMBEDDED ---help--- Support for Sunplus wireless desktop. config HID_GREENASIA - tristate "GreenAsia (Product ID 0x12) support" if EMBEDDED + tristate "GreenAsia (Product ID 0x12) support" depends on USB_HID - default !EMBEDDED ---help--- Say Y here if you have a GreenAsia (Product ID 0x12) based game controller or adapter. @@ -313,9 +394,8 @@ config GREENASIA_FF and want to enable force feedback support for it. config HID_SMARTJOYPLUS - tristate "SmartJoy PLUS PS2/USB adapter support" if EMBEDDED + tristate "SmartJoy PLUS PS2/USB adapter support" depends on USB_HID - default !EMBEDDED ---help--- Support for SmartJoy PLUS PS2/USB adapter. @@ -328,16 +408,14 @@ config SMARTJOYPLUS_FF enable force feedback support for it. config HID_TOPSEED - tristate "TopSeed Cyberlink remote control support" if EMBEDDED + tristate "TopSeed Cyberlink remote control support" depends on USB_HID - default !EMBEDDED ---help--- - Say Y if you have a TopSeed Cyberlink remote control. + Say Y if you have a TopSeed Cyberlink or BTC Emprex remote control. config HID_THRUSTMASTER - tristate "ThrustMaster devices support" if EMBEDDED + tristate "ThrustMaster devices support" depends on USB_HID - default !EMBEDDED ---help--- Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or a THRUSTMASTER Ferrari GT Rumble Wheel. @@ -357,10 +435,17 @@ config HID_WACOM ---help--- Support for Wacom Graphire Bluetooth tablet. +config HID_WACOM_POWER_SUPPLY + bool "Wacom Bluetooth devices power supply status support" + depends on HID_WACOM + select POWER_SUPPLY + ---help--- + Say Y here if you want to enable power supply status monitoring for + Wacom Bluetooth devices. + config HID_ZEROPLUS - tristate "Zeroplus based game controller support" if EMBEDDED + tristate "Zeroplus based game controller support" depends on USB_HID - default !EMBEDDED ---help--- Say Y here if you have a Zeroplus based game controller. @@ -372,6 +457,12 @@ config ZEROPLUS_FF Say Y here if you have a Zeroplus based game controller and want to have force feedback support for it. +config HID_ZYDACRON + tristate "Zydacron remote control support" + depends on USB_HID + ---help--- + Support for Zydacron remote control. + endmenu endif # HID_SUPPORT diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 0b2618f092c..22e47eaeea3 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -26,10 +26,12 @@ 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 +obj-$(CONFIG_HID_CANDO) += hid-cando.o obj-$(CONFIG_HID_CHERRY) += hid-cherry.o obj-$(CONFIG_HID_CHICONY) += hid-chicony.o obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o +obj-$(CONFIG_HID_EGALAX) += hid-egalax.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o obj-$(CONFIG_HID_GYRATION) += hid-gyration.o obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o @@ -41,9 +43,12 @@ obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o obj-$(CONFIG_HID_MOSART) += hid-mosart.o obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o obj-$(CONFIG_HID_ORTEK) += hid-ortek.o +obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.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_PICOLCD) += hid-picolcd.o +obj-$(CONFIG_HID_ROCCAT_KONE) += hid-roccat-kone.o obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o obj-$(CONFIG_HID_SONY) += hid-sony.o @@ -54,6 +59,7 @@ obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o +obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o obj-$(CONFIG_HID_WACOM) += hid-wacom.o obj-$(CONFIG_USB_HID) += usbhid/ diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c index c31e0be8cce..2a0d56b7a02 100644 --- a/drivers/hid/hid-3m-pct.c +++ b/drivers/hid/hid-3m-pct.c @@ -1,7 +1,7 @@ /* * HID driver for 3M PCT multitouch panels * - * Copyright (c) 2009 Stephane Chatty <chatty@enac.fr> + * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr> * */ @@ -25,7 +25,7 @@ MODULE_LICENSE("GPL"); #include "hid-ids.h" struct mmm_finger { - __s32 x, y; + __s32 x, y, w, h; __u8 rank; bool touch, valid; }; @@ -82,7 +82,18 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi, /* 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: + field->logical_maximum = 59; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TRACKING_ID); return 1; @@ -128,9 +139,15 @@ static void mmm_filter_event(struct mmm_data *md, struct input_dev *input) /* this finger is just placeholder data, ignore */ } else if (f->touch) { /* this finger is on the screen */ + int wide = (f->w > f->h); 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_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); + input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, + wide ? f->w : f->h); + input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, + wide ? f->h : f->w); input_mt_sync(input); /* * touchscreen emulation: maintain the age rank @@ -197,6 +214,14 @@ static int mmm_event(struct hid_device *hid, struct hid_field *field, case HID_DG_CONFIDENCE: md->valid = value; break; + case HID_DG_WIDTH: + if (md->valid) + md->f[md->curid].w = value; + break; + case HID_DG_HEIGHT: + if (md->valid) + md->f[md->curid].h = value; + break; case HID_DG_CONTACTID: if (md->valid) { md->curid = value; @@ -255,6 +280,7 @@ static void mmm_remove(struct hid_device *hdev) static const struct hid_device_id mmm_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, + { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, { } }; MODULE_DEVICE_TABLE(hid, mmm_devices); @@ -287,5 +313,4 @@ static void __exit mmm_exit(void) module_init(mmm_init); module_exit(mmm_exit); -MODULE_LICENSE("GPL"); diff --git a/drivers/hid/hid-cando.c b/drivers/hid/hid-cando.c new file mode 100644 index 00000000000..4267a6fdc27 --- /dev/null +++ b/drivers/hid/hid-cando.c @@ -0,0 +1,272 @@ +/* + * HID driver for Cando dual-touch panels + * + * Copyright (c) 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> +#include <linux/slab.h> + +MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); +MODULE_DESCRIPTION("Cando dual-touch panel"); +MODULE_LICENSE("GPL"); + +#include "hid-ids.h" + +struct cando_data { + __u16 x, y; + __u8 id; + __s8 oldest; /* id of the oldest finger in previous frame */ + bool valid; /* valid finger data, or just placeholder? */ + bool first; /* is this the first finger in this frame? */ + __s8 firstid; /* id of the first finger in the frame */ + __u16 firstx, firsty; /* (x, y) of the first finger in the frame */ +}; + +static int cando_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_TIPSWITCH: + case HID_DG_CONTACTMAX: + 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; + } + + return 0; +} + +static int cando_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 cando_filter_event(struct cando_data *td, struct input_dev *input) +{ + td->first = !td->first; /* touchscreen emulation */ + + if (!td->valid) { + /* + * touchscreen emulation: if this is the second finger and + * the first was valid, the first was the oldest; if the + * first was not valid and there was a valid finger in the + * previous frame, this is a release. + */ + if (td->first) { + td->firstid = -1; + } else if (td->firstid >= 0) { + input_event(input, EV_ABS, ABS_X, td->firstx); + input_event(input, EV_ABS, ABS_Y, td->firsty); + td->oldest = td->firstid; + } else if (td->oldest >= 0) { + input_event(input, EV_KEY, BTN_TOUCH, 0); + td->oldest = -1; + } + + 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); + + /* + * touchscreen emulation: if there was no touching finger previously, + * emit touch event + */ + if (td->oldest < 0) { + input_event(input, EV_KEY, BTN_TOUCH, 1); + td->oldest = td->id; + } + + /* + * touchscreen emulation: if this is the first finger, wait for the + * second; the oldest is then the second if it was the oldest already + * or if there was no first, the first otherwise. + */ + if (td->first) { + td->firstx = td->x; + td->firsty = td->y; + td->firstid = td->id; + } else { + int x, y, oldest; + if (td->id == td->oldest || td->firstid < 0) { + x = td->x; + y = td->y; + oldest = td->id; + } else { + x = td->firstx; + y = td->firsty; + oldest = td->firstid; + } + input_event(input, EV_ABS, ABS_X, x); + input_event(input, EV_ABS, ABS_Y, y); + td->oldest = oldest; + } +} + + +static int cando_event(struct hid_device *hid, struct hid_field *field, + struct hid_usage *usage, __s32 value) +{ + struct cando_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_DG_CONTACTID: + td->id = value; + break; + case HID_GD_X: + td->x = value; + break; + case HID_GD_Y: + td->y = value; + cando_filter_event(td, input); + break; + 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 cando_probe(struct hid_device *hdev, const struct hid_device_id *id) +{ + int ret; + struct cando_data *td; + + td = kmalloc(sizeof(struct cando_data), GFP_KERNEL); + if (!td) { + dev_err(&hdev->dev, "cannot allocate Cando Touch data\n"); + return -ENOMEM; + } + hid_set_drvdata(hdev, td); + td->first = false; + td->oldest = -1; + td->valid = false; + + ret = hid_parse(hdev); + if (!ret) + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + + if (ret) + kfree(td); + + return ret; +} + +static void cando_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 cando_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, + USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, + USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, + { } +}; +MODULE_DEVICE_TABLE(hid, cando_devices); + +static const struct hid_usage_id cando_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 cando_driver = { + .name = "cando-touch", + .id_table = cando_devices, + .probe = cando_probe, + .remove = cando_remove, + .input_mapping = cando_input_mapping, + .input_mapped = cando_input_mapped, + .usage_table = cando_grabbed_usages, + .event = cando_event, +}; + +static int __init cando_init(void) +{ + return hid_register_driver(&cando_driver); +} + +static void __exit cando_exit(void) +{ + hid_unregister_driver(&cando_driver); +} + +module_init(cando_init); +module_exit(cando_exit); + diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 143e788b729..e10e314d38c 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -653,10 +653,9 @@ int hid_parse_report(struct hid_device *device, __u8 *start, if (device->driver->report_fixup) device->driver->report_fixup(device, start, size); - device->rdesc = kmalloc(size, GFP_KERNEL); + device->rdesc = kmemdup(start, size, GFP_KERNEL); if (device->rdesc == NULL) return -ENOMEM; - memcpy(device->rdesc, start, size); device->rsize = size; parser = vmalloc(sizeof(struct hid_parser)); @@ -940,13 +939,8 @@ static void hid_output_field(struct hid_field *field, __u8 *data) unsigned count = field->report_count; unsigned offset = field->report_offset; unsigned size = field->report_size; - unsigned bitsused = offset + count * size; unsigned n; - /* make sure the unused bits in the last byte are zeros */ - if (count > 0 && size > 0 && (bitsused % 8) != 0) - data[(bitsused-1)/8] &= (1 << (bitsused % 8)) - 1; - for (n = 0; n < count; n++) { if (field->logical_minimum < 0) /* signed values */ implement(data, offset + n * size, size, s32ton(field->value[n], size)); @@ -966,6 +960,7 @@ void hid_output_report(struct hid_report *report, __u8 *data) if (report->id > 0) *data++ = report->id; + memset(data, 0, ((report->size - 1) >> 3) + 1); for (n = 0; n < report->maxfield; n++) hid_output_field(report->field[n], data); } @@ -1086,35 +1081,28 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); - if (!buf) { - report = hid_get_report(report_enum, data); + if (!buf) goto nomem; - } - - snprintf(buf, HID_DEBUG_BUFSIZE - 1, - "\nreport (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un"); - hid_debug_event(hid, buf); - - report = hid_get_report(report_enum, data); - if (!report) { - kfree(buf); - return -1; - } /* dump the report */ snprintf(buf, HID_DEBUG_BUFSIZE - 1, - "report %d (size %u) = ", report->id, size); + "\nreport (size %u) (%snumbered) = ", size, report_enum->numbered ? "" : "un"); hid_debug_event(hid, buf); + for (i = 0; i < size; i++) { snprintf(buf, HID_DEBUG_BUFSIZE - 1, " %02x", data[i]); hid_debug_event(hid, buf); } hid_debug_event(hid, "\n"); - kfree(buf); nomem: + report = hid_get_report(report_enum, data); + + if (!report) + return -1; + if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { ret = hdrv->raw_event(hid, report, data, size); if (ret != 0) @@ -1167,6 +1155,8 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) unsigned int i; int len; + if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) + connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); if (hdev->bus != BUS_USB) connect_mask &= ~HID_CONNECT_HIDDEV; if (hid_hiddev(hdev)) @@ -1246,6 +1236,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_3M, USB_DEVICE_ID_3M2256) }, { 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) }, @@ -1290,14 +1281,19 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, + { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, @@ -1331,6 +1327,8 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, @@ -1342,7 +1340,9 @@ static const struct hid_device_id hid_blacklist[] = { { 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_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, { HID_BLUETOOTH_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) }, @@ -1359,8 +1359,10 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, { } @@ -1757,7 +1759,7 @@ int hid_add_device(struct hid_device *hdev) /* we need to kill them here, otherwise they will stay allocated to * wait for coming driver */ - if (hid_ignore(hdev)) + if (!(hdev->quirks & HID_QUIRK_NO_IGNORE) && hid_ignore(hdev)) return -ENODEV; /* XXX hack, any other cleaner solution after the driver core @@ -1765,11 +1767,12 @@ int hid_add_device(struct hid_device *hdev) dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, hdev->vendor, hdev->product, atomic_inc_return(&id)); + hid_debug_register(hdev, dev_name(&hdev->dev)); ret = device_add(&hdev->dev); if (!ret) hdev->status |= HID_STAT_ADDED; - - hid_debug_register(hdev, dev_name(&hdev->dev)); + else + hid_debug_unregister(hdev); return ret; } diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c new file mode 100644 index 00000000000..f44bdc084cb --- /dev/null +++ b/drivers/hid/hid-egalax.c @@ -0,0 +1,281 @@ +/* + * HID driver for eGalax dual-touch panels + * + * Copyright (c) 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> +#include <linux/usb.h> +#include <linux/slab.h> +#include "usbhid/usbhid.h" + +MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); +MODULE_DESCRIPTION("eGalax dual-touch panel"); +MODULE_LICENSE("GPL"); + +#include "hid-ids.h" + +struct egalax_data { + __u16 x, y, z; + __u8 id; + bool first; /* is this the first finger in the frame? */ + bool valid; /* valid finger data, or just placeholder? */ + bool activity; /* at least one active finger previously? */ + __u16 lastx, lasty; /* latest valid (x, y) in the frame */ +}; + +static int egalax_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_TIPSWITCH: + /* touchscreen emulation */ + hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); + return 1; |