diff options
48 files changed, 5503 insertions, 2949 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index cc8093c15cf5..4d2566a7d168 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
| @@ -287,6 +287,13 @@ Who: Glauber Costa <gcosta@redhat.com> | |||
| 287 | 287 | ||
| 288 | --------------------------- | 288 | --------------------------- |
| 289 | 289 | ||
| 290 | What: remove HID compat support | ||
| 291 | When: 2.6.29 | ||
| 292 | Why: needed only as a temporary solution until distros fix themselves up | ||
| 293 | Who: Jiri Slaby <jirislaby@gmail.com> | ||
| 294 | |||
| 295 | --------------------------- | ||
| 296 | |||
| 290 | What: /sys/o2cb symlink | 297 | What: /sys/o2cb symlink |
| 291 | When: January 2010 | 298 | When: January 2010 |
| 292 | Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb | 299 | Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index cacf89e65af4..da64108de775 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
| @@ -17,6 +17,25 @@ config HID | |||
| 17 | tristate "Generic HID support" | 17 | tristate "Generic HID support" |
| 18 | depends on INPUT | 18 | depends on INPUT |
| 19 | default y | 19 | default y |
| 20 | select HID_A4TECH if !EMBEDDED | ||
| 21 | select HID_APPLE if !EMBEDDED | ||
| 22 | select HID_BELKIN if !EMBEDDED | ||
| 23 | select HID_BRIGHT if !EMBEDDED | ||
| 24 | select HID_CHERRY if !EMBEDDED | ||
| 25 | select HID_CHICONY if !EMBEDDED | ||
| 26 | select HID_CYPRESS if !EMBEDDED | ||
| 27 | select HID_DELL if !EMBEDDED | ||
| 28 | select HID_EZKEY if !EMBEDDED | ||
| 29 | select HID_GYRATION if !EMBEDDED | ||
| 30 | select HID_LOGITECH if !EMBEDDED | ||
| 31 | select HID_MICROSOFT if !EMBEDDED | ||
| 32 | select HID_MONTEREY if !EMBEDDED | ||
| 33 | select HID_PANTHERLORD if !EMBEDDED | ||
| 34 | select HID_PETALYNX if !EMBEDDED | ||
| 35 | select HID_SAMSUNG if !EMBEDDED | ||
| 36 | select HID_SONY if !EMBEDDED | ||
| 37 | select HID_SUNPLUS if !EMBEDDED | ||
| 38 | |||
| 20 | ---help--- | 39 | ---help--- |
| 21 | A human interface device (HID) is a type of computer device that | 40 | A human interface device (HID) is a type of computer device that |
| 22 | interacts directly with and takes input from humans. The term "HID" | 41 | interacts directly with and takes input from humans. The term "HID" |
| @@ -67,4 +86,206 @@ config HIDRAW | |||
| 67 | 86 | ||
| 68 | source "drivers/hid/usbhid/Kconfig" | 87 | source "drivers/hid/usbhid/Kconfig" |
| 69 | 88 | ||
| 89 | menu "Special HID drivers" | ||
| 90 | depends on HID | ||
| 91 | |||
| 92 | config HID_COMPAT | ||
| 93 | bool "Load all HID drivers on hid core load" | ||
| 94 | default y | ||
| 95 | ---help--- | ||
| 96 | Compatible option for older userspace. If you have system without udev | ||
| 97 | support of module loading through aliases and also old | ||
| 98 | module-init-tools which can't handle hid bus, choose Y here. Otherwise | ||
| 99 | say N. If you say N and your userspace is old enough, the only | ||
| 100 | functionality you lose is modules autoloading. | ||
| 101 | |||
| 102 | If unsure, say Y. | ||
| 103 | |||
| 104 | config HID_A4TECH | ||
| 105 | tristate "A4 tech" | ||
| 106 | default m | ||
| 107 | depends on USB_HID | ||
| 108 | ---help--- | ||
| 109 | Support for A4 tech X5 and WOP-35 / Trust 450L mice. | ||
| 110 | |||
| 111 | config HID_APPLE | ||
| 112 | tristate "Apple" | ||
| 113 | default m | ||
| 114 | depends on (USB_HID || BT_HIDP) | ||
| 115 | ---help--- | ||
| 116 | Support for some Apple devices which less or more break | ||
| 117 | HID specification. | ||
| 118 | |||
| 119 | Say Y here if you want support for the special keys (Fn, Numlock) on | ||
| 120 | Apple iBooks, PowerBooks, MacBooks, MacBook Pros and aluminum USB | ||
| 121 | keyboards. | ||
| 122 | |||
| 123 | If unsure, say M. | ||
| 124 | |||
| 125 | config HID_BELKIN | ||
| 126 | tristate "Belkin" | ||
| 127 | default m | ||
| 128 | depends on USB_HID | ||
| 129 | ---help--- | ||
| 130 | Support for Belkin Flip KVM and Wireless keyboard. | ||
| 131 | |||
| 132 | config HID_BRIGHT | ||
| 133 | tristate "Bright" | ||
| 134 | default m | ||
| 135 | depends on USB_HID | ||
| 136 | ---help--- | ||
| 137 | Support for Bright ABNT-2 keyboard. | ||
| 138 | |||
| 139 | config HID_CHERRY | ||
| 140 | tristate "Cherry" | ||
| 141 | default m | ||
| 142 | depends on USB_HID | ||
| 143 | ---help--- | ||
| 144 | Support for Cherry Cymotion. | ||
| 145 | |||
| 146 | config HID_CHICONY | ||
| 147 | tristate "Chicony" | ||
| 148 | default m | ||
| 149 | depends on USB_HID | ||
| 150 | ---help--- | ||
| 151 | Support for Chicony Tactical pad. | ||
| 152 | |||
| 153 | config HID_CYPRESS | ||
| 154 | tristate "Cypress" | ||
| 155 | default m | ||
| 156 | depends on USB_HID | ||
| 157 | ---help--- | ||
| 158 | Support for Cypress mouse and barcodes. | ||
| 159 | |||
| 160 | config HID_DELL | ||
| 161 | tristate "Dell" | ||
| 162 | default m | ||
| 163 | depends on USB_HID | ||
| 164 | ---help--- | ||
| 165 | Support for Dell W7658. | ||
| 166 | |||
| 167 | config HID_EZKEY | ||
| 168 | tristate "Ezkey" | ||
| 169 | default m | ||
| 170 | depends on USB_HID | ||
| 171 | ---help--- | ||
| 172 | Support for Ezkey mouse and barcodes. | ||
| 173 | |||
| 174 | config HID_GYRATION | ||
| 175 | tristate "Gyration" | ||
| 176 | default m | ||
| 177 | depends on USB_HID | ||
| 178 | ---help--- | ||
| 179 | Support for Gyration remote. | ||
| 180 | |||
| 181 | config HID_LOGITECH | ||
| 182 | tristate "Logitech" | ||
| 183 | default m | ||
| 184 | depends on USB_HID | ||
| 185 | ---help--- | ||
| 186 | Support for some Logitech devices which breaks less or more | ||
| 187 | HID specification. | ||
| 188 | |||
| 189 | config LOGITECH_FF | ||
| 190 | bool "Logitech force feedback" | ||
| 191 | depends on HID_LOGITECH | ||
| 192 | select INPUT_FF_MEMLESS | ||
| 193 | help | ||
| 194 | Say Y here if you have one of these devices: | ||
| 195 | - Logitech WingMan Cordless RumblePad | ||
| 196 | - Logitech WingMan Cordless RumblePad 2 | ||
| 197 | - Logitech WingMan Force 3D | ||
| 198 | - Logitech Formula Force EX | ||
| 199 | - Logitech MOMO Force wheel | ||
| 200 | |||
| 201 | and if you want to enable force feedback for them. | ||
| 202 | Note: if you say N here, this device will still be supported, but without | ||
| 203 | force feedback. | ||
| 204 | |||
| 205 | config LOGIRUMBLEPAD2_FF | ||
| 206 | bool "Logitech Rumblepad 2 force feedback" | ||
| 207 | depends on HID_LOGITECH | ||
| 208 | select INPUT_FF_MEMLESS | ||
| 209 | help | ||
| 210 | Say Y here if you want to enable force feedback support for Logitech | ||
| 211 | Rumblepad 2 devices. | ||
| 212 | |||
| 213 | config HID_MICROSOFT | ||
| 214 | tristate "Microsoft" | ||
| 215 | default m | ||
| 216 | depends on USB_HID | ||
| 217 | ---help--- | ||
| 218 | Support for some Microsoft devices which breaks less or more | ||
| 219 | HID specification. | ||
| 220 | |||
| 221 | config HID_MONTEREY | ||
| 222 | tristate "Monterey" | ||
| 223 | default m | ||
| 224 | depends on USB_HID | ||
| 225 | ---help--- | ||
| 226 | Support for Monterey Genius KB29E. | ||
| 227 | |||
| 228 | config HID_PANTHERLORD | ||
| 229 | tristate "Pantherlord devices support" | ||
| 230 | default m | ||
| 231 | depends on USB_HID | ||
| 232 | ---help--- | ||
| 233 | Support for PantherLord/GreenAsia based device support. | ||
| 234 | |||
| 235 | |||
| 236 | config PANTHERLORD_FF | ||
| 237 | bool "Pantherlord force feedback support" | ||
| 238 | depends on HID_PANTHERLORD | ||
| 239 | select INPUT_FF_MEMLESS | ||
| 240 | help | ||
| 241 | Say Y here if you have a PantherLord/GreenAsia based game controller | ||
| 242 | or adapter and want to enable force feedback support for it. | ||
| 243 | |||
| 244 | config HID_PETALYNX | ||
| 245 | tristate "Petalynx" | ||
| 246 | default m | ||
| 247 | depends on USB_HID | ||
| 248 | ---help--- | ||
| 249 | Support for Petalynx Maxter remote. | ||
| 250 | |||
| 251 | config HID_SAMSUNG | ||
| 252 | tristate "Samsung" | ||
| 253 | default m | ||
| 254 | depends on USB_HID | ||
| 255 | ---help--- | ||
| 256 | Support for Samsung IR remote. | ||
| 257 | |||
| 258 | config HID_SONY | ||
| 259 | tristate "Sony" | ||
| 260 | default m | ||
| 261 | depends on USB_HID | ||
| 262 | ---help--- | ||
| 263 | Support for Sony PS3 controller. | ||
| 264 | |||
| 265 | config HID_SUNPLUS | ||
| 266 | tristate "Sunplus" | ||
| 267 | default m | ||
| 268 | depends on USB_HID | ||
| 269 | ---help--- | ||
| 270 | Support for Sunplus WDesktop input device. | ||
| 271 | |||
| 272 | config THRUSTMASTER_FF | ||
| 273 | tristate "ThrustMaster devices support" | ||
| 274 | default m | ||
| 275 | depends on USB_HID | ||
| 276 | select INPUT_FF_MEMLESS | ||
| 277 | help | ||
| 278 | Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or | ||
| 279 | a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel. | ||
| 280 | |||
| 281 | config ZEROPLUS_FF | ||
| 282 | tristate "Zeroplus based game controller support" | ||
| 283 | default m | ||
| 284 | depends on USB_HID | ||
| 285 | select INPUT_FF_MEMLESS | ||
| 286 | help | ||
| 287 | Say Y here if you have a Zeroplus based game controller. | ||
| 288 | |||
| 289 | endmenu | ||
| 290 | |||
| 70 | endif # HID_SUPPORT | 291 | endif # HID_SUPPORT |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 275dc522c738..b09e43e7413e 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
| @@ -1,13 +1,46 @@ | |||
| 1 | # | 1 | # |
| 2 | # Makefile for the HID driver | 2 | # Makefile for the HID driver |
| 3 | # | 3 | # |
| 4 | hid-objs := hid-core.o hid-input.o hid-input-quirks.o | 4 | hid-objs := hid-core.o hid-input.o |
| 5 | 5 | ||
| 6 | obj-$(CONFIG_HID) += hid.o | 6 | obj-$(CONFIG_HID) += hid.o |
| 7 | 7 | ||
| 8 | hid-$(CONFIG_HID_DEBUG) += hid-debug.o | 8 | hid-$(CONFIG_HID_DEBUG) += hid-debug.o |
| 9 | hid-$(CONFIG_HIDRAW) += hidraw.o | 9 | hid-$(CONFIG_HIDRAW) += hidraw.o |
| 10 | 10 | ||
| 11 | ifdef CONFIG_HID_COMPAT | ||
| 12 | obj-m += hid-dummy.o | ||
| 13 | endif | ||
| 14 | |||
| 15 | hid-logitech-objs := hid-lg.o | ||
| 16 | ifdef CONFIG_LOGITECH_FF | ||
| 17 | hid-logitech-objs += hid-lgff.o | ||
| 18 | endif | ||
| 19 | ifdef CONFIG_LOGIRUMBLEPAD2_FF | ||
| 20 | hid-logitech-objs += hid-lg2ff.o | ||
| 21 | endif | ||
| 22 | |||
| 23 | obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o | ||
| 24 | obj-$(CONFIG_HID_APPLE) += hid-apple.o | ||
| 25 | obj-$(CONFIG_HID_BELKIN) += hid-belkin.o | ||
| 26 | obj-$(CONFIG_HID_BRIGHT) += hid-bright.o | ||
| 27 | obj-$(CONFIG_HID_CHERRY) += hid-cherry.o | ||
| 28 | obj-$(CONFIG_HID_CHICONY) += hid-chicony.o | ||
| 29 | obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o | ||
| 30 | obj-$(CONFIG_HID_DELL) += hid-dell.o | ||
| 31 | obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o | ||
| 32 | obj-$(CONFIG_HID_GYRATION) += hid-gyration.o | ||
| 33 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o | ||
| 34 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o | ||
| 35 | obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o | ||
| 36 | obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o | ||
| 37 | obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o | ||
| 38 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o | ||
| 39 | obj-$(CONFIG_HID_SONY) += hid-sony.o | ||
| 40 | obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o | ||
| 41 | obj-$(CONFIG_THRUSTMASTER_FF) += hid-tmff.o | ||
| 42 | obj-$(CONFIG_ZEROPLUS_FF) += hid-zpff.o | ||
| 43 | |||
| 11 | obj-$(CONFIG_USB_HID) += usbhid/ | 44 | obj-$(CONFIG_USB_HID) += usbhid/ |
| 12 | obj-$(CONFIG_USB_MOUSE) += usbhid/ | 45 | obj-$(CONFIG_USB_MOUSE) += usbhid/ |
| 13 | obj-$(CONFIG_USB_KBD) += usbhid/ | 46 | obj-$(CONFIG_USB_KBD) += usbhid/ |
diff --git a/drivers/hid/hid-a4tech.c b/drivers/hid/hid-a4tech.c new file mode 100644 index 000000000000..ebca00e6c103 --- /dev/null +++ b/drivers/hid/hid-a4tech.c | |||
| @@ -0,0 +1,162 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some a4tech "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/input.h> | ||
| 21 | #include <linux/hid.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | #define A4_2WHEEL_MOUSE_HACK_7 0x01 | ||
| 27 | #define A4_2WHEEL_MOUSE_HACK_B8 0x02 | ||
| 28 | |||
| 29 | struct a4tech_sc { | ||
| 30 | unsigned long quirks; | ||
| 31 | unsigned int hw_wheel; | ||
| 32 | __s32 delayed_value; | ||
| 33 | }; | ||
| 34 | |||
| 35 | static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
| 36 | struct hid_field *field, struct hid_usage *usage, | ||
| 37 | unsigned long **bit, int *max) | ||
| 38 | { | ||
| 39 | struct a4tech_sc *a4 = hid_get_drvdata(hdev); | ||
| 40 | |||
| 41 | if (usage->type == EV_REL && usage->code == REL_WHEEL) | ||
| 42 | set_bit(REL_HWHEEL, *bit); | ||
| 43 | |||
| 44 | if ((a4->quirks & A4_2WHEEL_MOUSE_HACK_7) && usage->hid == 0x00090007) | ||
| 45 | return -1; | ||
| 46 | |||
| 47 | return 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | static int a4_event(struct hid_device *hdev, struct hid_field *field, | ||
| 51 | struct hid_usage *usage, __s32 value) | ||
| 52 | { | ||
| 53 | struct a4tech_sc *a4 = hid_get_drvdata(hdev); | ||
| 54 | struct input_dev *input; | ||
| 55 | |||
| 56 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || | ||
| 57 | !usage->type) | ||
| 58 | return 0; | ||
| 59 | |||
| 60 | input = field->hidinput->input; | ||
| 61 | |||
| 62 | if (a4->quirks & A4_2WHEEL_MOUSE_HACK_B8) { | ||
| 63 | if (usage->type == EV_REL && usage->code == REL_WHEEL) { | ||
| 64 | a4->delayed_value = value; | ||
| 65 | return 1; | ||
| 66 | } | ||
| 67 | |||
| 68 | if (usage->hid == 0x000100b8) { | ||
| 69 | input_event(input, EV_REL, value ? REL_HWHEEL : | ||
| 70 | REL_WHEEL, a4->delayed_value); | ||
| 71 | return 1; | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | if ((a4->quirks & A4_2WHEEL_MOUSE_HACK_7) && usage->hid == 0x00090007) { | ||
| 76 | a4->hw_wheel = !!value; | ||
| 77 | return 1; | ||
| 78 | } | ||
| 79 | |||
| 80 | if (usage->code == REL_WHEEL && a4->hw_wheel) { | ||
| 81 | input_event(input, usage->type, REL_HWHEEL, value); | ||
| 82 | return 1; | ||
| 83 | } | ||
| 84 | |||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 89 | { | ||
| 90 | struct a4tech_sc *a4; | ||
| 91 | int ret; | ||
| 92 | |||
| 93 | a4 = kzalloc(sizeof(*a4), GFP_KERNEL); | ||
| 94 | if (a4 == NULL) { | ||
| 95 | dev_err(&hdev->dev, "can't alloc device descriptor\n"); | ||
| 96 | ret = -ENOMEM; | ||
| 97 | goto err_free; | ||
| 98 | } | ||
| 99 | |||
| 100 | a4->quirks = id->driver_data; | ||
| 101 | |||
| 102 | hid_set_drvdata(hdev, a4); | ||
| 103 | |||
| 104 | ret = hid_parse(hdev); | ||
| 105 | if (ret) { | ||
| 106 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 107 | goto err_free; | ||
| 108 | } | ||
| 109 | |||
| 110 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 111 | if (ret) { | ||
| 112 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 113 | goto err_free; | ||
| 114 | } | ||
| 115 | |||
| 116 | return 0; | ||
| 117 | err_free: | ||
| 118 | kfree(a4); | ||
| 119 | return ret; | ||
| 120 | } | ||
| 121 | |||
| 122 | static void a4_remove(struct hid_device *hdev) | ||
| 123 | { | ||
| 124 | struct a4tech_sc *a4 = hid_get_drvdata(hdev); | ||
| 125 | |||
| 126 | hid_hw_stop(hdev); | ||
| 127 | kfree(a4); | ||
| 128 | } | ||
| 129 | |||
| 130 | static const struct hid_device_id a4_devices[] = { | ||
| 131 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU), | ||
| 132 | .driver_data = A4_2WHEEL_MOUSE_HACK_7 }, | ||
| 133 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D), | ||
| 134 | .driver_data = A4_2WHEEL_MOUSE_HACK_B8 }, | ||
| 135 | { } | ||
| 136 | }; | ||
| 137 | MODULE_DEVICE_TABLE(hid, a4_devices); | ||
| 138 | |||
| 139 | static struct hid_driver a4_driver = { | ||
| 140 | .name = "a4tech", | ||
| 141 | .id_table = a4_devices, | ||
| 142 | .input_mapped = a4_input_mapped, | ||
| 143 | .event = a4_event, | ||
| 144 | .probe = a4_probe, | ||
| 145 | .remove = a4_remove, | ||
| 146 | }; | ||
| 147 | |||
| 148 | static int a4_init(void) | ||
| 149 | { | ||
| 150 | return hid_register_driver(&a4_driver); | ||
| 151 | } | ||
| 152 | |||
| 153 | static void a4_exit(void) | ||
| 154 | { | ||
| 155 | hid_unregister_driver(&a4_driver); | ||
| 156 | } | ||
| 157 | |||
| 158 | module_init(a4_init); | ||
| 159 | module_exit(a4_exit); | ||
| 160 | MODULE_LICENSE("GPL"); | ||
| 161 | |||
| 162 | HID_COMPAT_LOAD_DRIVER(a4tech); | ||
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c new file mode 100644 index 000000000000..fd7f896b34f7 --- /dev/null +++ b/drivers/hid/hid-apple.c | |||
| @@ -0,0 +1,484 @@ | |||
| 1 | /* | ||
| 2 | * USB HID quirks support for Linux | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com> | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | #include <linux/usb.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | #define APPLE_RDESC_JIS 0x0001 | ||
| 27 | #define APPLE_IGNORE_MOUSE 0x0002 | ||
| 28 | #define APPLE_HAS_FN 0x0004 | ||
| 29 | #define APPLE_HIDDEV 0x0008 | ||
| 30 | #define APPLE_ISO_KEYBOARD 0x0010 | ||
| 31 | #define APPLE_MIGHTYMOUSE 0x0020 | ||
| 32 | #define APPLE_INVERT_HWHEEL 0x0040 | ||
| 33 | #define APPLE_IGNORE_HIDINPUT 0x0080 | ||
| 34 | #define APPLE_NUMLOCK_EMULATION 0x0100 | ||
| 35 | |||
| 36 | #define APPLE_FLAG_FKEY 0x01 | ||
| 37 | |||
| 38 | static unsigned int fnmode = 1; | ||
| 39 | module_param(fnmode, uint, 0644); | ||
| 40 | MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, " | ||
| 41 | "[1] = fkeyslast, 2 = fkeysfirst)"); | ||
| 42 | |||
| 43 | struct apple_sc { | ||
| 44 | unsigned long quirks; | ||
| 45 | unsigned int fn_on; | ||
| 46 | DECLARE_BITMAP(pressed_fn, KEY_CNT); | ||
| 47 | DECLARE_BITMAP(pressed_numlock, KEY_CNT); | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct apple_key_translation { | ||
| 51 | u16 from; | ||
| 52 | u16 to; | ||
| 53 | u8 flags; | ||
| 54 | }; | ||
| 55 | |||
| 56 | static struct apple_key_translation apple_fn_keys[] = { | ||
| 57 | { KEY_BACKSPACE, KEY_DELETE }, | ||
| 58 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, | ||
| 59 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, | ||
| 60 | { KEY_F3, KEY_FN_F5, APPLE_FLAG_FKEY }, /* Exposé */ | ||
| 61 | { KEY_F4, KEY_FN_F4, APPLE_FLAG_FKEY }, /* Dashboard */ | ||
| 62 | { KEY_F5, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, | ||
| 63 | { KEY_F6, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, | ||
| 64 | { KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, | ||
| 65 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, | ||
| 66 | { KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY }, | ||
| 67 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, | ||
| 68 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, | ||
| 69 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, | ||
| 70 | { KEY_UP, KEY_PAGEUP }, | ||
| 71 | { KEY_DOWN, KEY_PAGEDOWN }, | ||
| 72 | { KEY_LEFT, KEY_HOME }, | ||
| 73 | { KEY_RIGHT, KEY_END }, | ||
| 74 | { } | ||
| 75 | }; | ||
| 76 | |||
| 77 | static struct apple_key_translation powerbook_fn_keys[] = { | ||
| 78 | { KEY_BACKSPACE, KEY_DELETE }, | ||
| 79 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, | ||
| 80 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, | ||
| 81 | { KEY_F3, KEY_MUTE, APPLE_FLAG_FKEY }, | ||
| 82 | { KEY_F4, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, | ||
| 83 | { KEY_F5, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, | ||
| 84 | { KEY_F6, KEY_NUMLOCK, APPLE_FLAG_FKEY }, | ||
| 85 | { KEY_F7, KEY_SWITCHVIDEOMODE, APPLE_FLAG_FKEY }, | ||
| 86 | { KEY_F8, KEY_KBDILLUMTOGGLE, APPLE_FLAG_FKEY }, | ||
| 87 | { KEY_F9, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, | ||
| 88 | { KEY_F10, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, | ||
| 89 | { KEY_UP, KEY_PAGEUP }, | ||
| 90 | { KEY_DOWN, KEY_PAGEDOWN }, | ||
| 91 | { KEY_LEFT, KEY_HOME }, | ||
| 92 | { KEY_RIGHT, KEY_END }, | ||
| 93 | { } | ||
| 94 | }; | ||
| 95 | |||
| 96 | static struct apple_key_translation powerbook_numlock_keys[] = { | ||
| 97 | { KEY_J, KEY_KP1 }, | ||
| 98 | { KEY_K, KEY_KP2 }, | ||
| 99 | { KEY_L, KEY_KP3 }, | ||
| 100 | { KEY_U, KEY_KP4 }, | ||
| 101 | { KEY_I, KEY_KP5 }, | ||
| 102 | { KEY_O, KEY_KP6 }, | ||
| 103 | { KEY_7, KEY_KP7 }, | ||
| 104 | { KEY_8, KEY_KP8 }, | ||
| 105 | { KEY_9, KEY_KP9 }, | ||
| 106 | { KEY_M, KEY_KP0 }, | ||
| 107 | { KEY_DOT, KEY_KPDOT }, | ||
| 108 | { KEY_SLASH, KEY_KPPLUS }, | ||
| 109 | { KEY_SEMICOLON, KEY_KPMINUS }, | ||
| 110 | { KEY_P, KEY_KPASTERISK }, | ||
| 111 | { KEY_MINUS, KEY_KPEQUAL }, | ||
| 112 | { KEY_0, KEY_KPSLASH }, | ||
| 113 | { KEY_F6, KEY_NUMLOCK }, | ||
| 114 | { KEY_KPENTER, KEY_KPENTER }, | ||
| 115 | { KEY_BACKSPACE, KEY_BACKSPACE }, | ||
| 116 | { } | ||
| 117 | }; | ||
| 118 | |||
| 119 | static struct apple_key_translation apple_iso_keyboard[] = { | ||
| 120 | { KEY_GRAVE, KEY_102ND }, | ||
| 121 | { KEY_102ND, KEY_GRAVE }, | ||
| 122 | { } | ||
| 123 | }; | ||
| 124 | |||
| 125 | static struct apple_key_translation *apple_find_translation( | ||
| 126 | struct apple_key_translation *table, u16 from) | ||
| 127 | { | ||
| 128 | struct apple_key_translation *trans; | ||
| 129 | |||
| 130 | /* Look for the translation */ | ||
| 131 | for (trans = table; trans->from; trans++) | ||
| 132 | if (trans->from == from) | ||
| 133 | return trans; | ||
| 134 | |||
| 135 | return NULL; | ||
| 136 | } | ||
| 137 | |||
| 138 | static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | ||
| 139 | struct hid_usage *usage, __s32 value) | ||
| 140 | { | ||
| 141 | struct apple_sc *asc = hid_get_drvdata(hid); | ||
| 142 | struct apple_key_translation *trans; | ||
| 143 | |||
| 144 | if (usage->code == KEY_FN) { | ||
| 145 | asc->fn_on = !!value; | ||
| 146 | input_event(input, usage->type, usage->code, value); | ||
| 147 | return 1; | ||
| 148 | } | ||
| 149 | |||
| 150 | if (fnmode) { | ||
| 151 | int do_translate; | ||
| 152 | |||
| 153 | trans = apple_find_translation((hid->product < 0x220 || | ||
| 154 | hid->product >= 0x300) ? | ||
| 155 | powerbook_fn_keys : apple_fn_keys, | ||
| 156 | usage->code); | ||
| 157 | if (trans) { | ||
| 158 | if (test_bit(usage->code, asc->pressed_fn)) | ||
| 159 | do_translate = 1; | ||
| 160 | else if (trans->flags & APPLE_FLAG_FKEY) | ||
| 161 | do_translate = (fnmode == 2 && asc->fn_on) || | ||
| 162 | (fnmode == 1 && !asc->fn_on); | ||
| 163 | else | ||
| 164 | do_translate = asc->fn_on; | ||
| 165 | |||
| 166 | if (do_translate) { | ||
| 167 | if (value) | ||
| 168 | set_bit(usage->code, asc->pressed_fn); | ||
| 169 | else | ||
| 170 | clear_bit(usage->code, asc->pressed_fn); | ||
| 171 | |||
| 172 | input_event(input, usage->type, trans->to, | ||
| 173 | value); | ||
| 174 | |||
| 175 | return 1; | ||
| 176 | } | ||
| 177 | } | ||
| 178 | |||
| 179 | if (asc->quirks & APPLE_NUMLOCK_EMULATION && | ||
| 180 | (test_bit(usage->code, asc->pressed_numlock) || | ||
| 181 | test_bit(LED_NUML, input->led))) { | ||
| 182 | trans = apple_find_translation(powerbook_numlock_keys, | ||
| 183 | usage->code); | ||
| 184 | |||
| 185 | if (trans) { | ||
| 186 | if (value) | ||
| 187 | set_bit(usage->code, | ||
| 188 | asc->pressed_numlock); | ||
| 189 | else | ||
| 190 | clear_bit(usage->code, | ||
| 191 | asc->pressed_numlock); | ||
| 192 | |||
| 193 | input_event(input, usage->type, trans->to, | ||
| 194 | value); | ||
| 195 | } | ||
| 196 | |||
| 197 | return 1; | ||
| 198 | } | ||
| 199 | } | ||
| 200 | |||
| 201 | if (asc->quirks & APPLE_ISO_KEYBOARD) { | ||
| 202 | trans = apple_find_translation(apple_iso_keyboard, usage->code); | ||
| 203 | if (trans) { | ||
| 204 | input_event(input, usage->type, trans->to, value); | ||
| 205 | return 1; | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 209 | return 0; | ||
| 210 | } | ||
| 211 | |||
| 212 | static int apple_event(struct hid_device *hdev, struct hid_field *field, | ||
| 213 | struct hid_usage *usage, __s32 value) | ||
| 214 | { | ||
| 215 | struct apple_sc *asc = hid_get_drvdata(hdev); | ||
| 216 | |||
| 217 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || | ||
| 218 | !usage->type) | ||
| 219 | return 0; | ||
| 220 | |||
| 221 | if ((asc->quirks & APPLE_INVERT_HWHEEL) && | ||
| 222 | usage->code == REL_HWHEEL) { | ||
| 223 | input_event(field->hidinput->input, usage->type, usage->code, | ||
| 224 | -value); | ||
| 225 | return 1; | ||
| 226 | } | ||
| 227 | |||
| 228 | if ((asc->quirks & APPLE_HAS_FN) && | ||
| 229 | hidinput_apple_event(hdev, field->hidinput->input, | ||
| 230 | usage, value)) | ||
| 231 | return 1; | ||
| 232 | |||
| 233 | |||
| 234 | return 0; | ||
| 235 | } | ||
| 236 | |||
| 237 | /* | ||
| 238 | * MacBook JIS keyboard has wrong logical maximum | ||
| 239 | */ | ||
| 240 | static void apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 241 | unsigned int rsize) | ||
| 242 | { | ||
| 243 | struct apple_sc *asc = hid_get_drvdata(hdev); | ||
| 244 | |||
| 245 | if ((asc->quirks & APPLE_RDESC_JIS) && rsize >= 60 && | ||
| 246 | rdesc[53] == 0x65 && rdesc[59] == 0x65) { | ||
| 247 | dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report " | ||
| 248 | "descriptor\n"); | ||
| 249 | rdesc[53] = rdesc[59] = 0xe7; | ||
| 250 | } | ||
| 251 | } | ||
| 252 | |||
| 253 | static void apple_setup_input(struct input_dev *input) | ||
| 254 | { | ||
| 255 | struct apple_key_translation *trans; | ||
| 256 | |||
| 257 | set_bit(KEY_NUMLOCK, input->keybit); | ||
| 258 | |||
| 259 | /* Enable all needed keys */ | ||
| 260 | for (trans = apple_fn_keys; trans->from; trans++) | ||
| 261 | set_bit(trans->to, input->keybit); | ||
| 262 | |||
| 263 | for (trans = powerbook_fn_keys; trans->from; trans++) | ||
| 264 | set_bit(trans->to, input->keybit); | ||
| 265 | |||
| 266 | for (trans = powerbook_numlock_keys; trans->from; trans++) | ||
| 267 | set_bit(trans->to, input->keybit); | ||
| 268 | |||
| 269 | for (trans = apple_iso_keyboard; trans->from; trans++) | ||
| 270 | set_bit(trans->to, input->keybit); | ||
| 271 | } | ||
| 272 | |||
| 273 | static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 274 | struct hid_field *field, struct hid_usage *usage, | ||
| 275 | unsigned long **bit, int *max) | ||
| 276 | { | ||
| 277 | if (usage->hid == (HID_UP_CUSTOM | 0x0003)) { | ||
| 278 | /* The fn key on Apple USB keyboards */ | ||
| 279 | set_bit(EV_REP, hi->input->evbit); | ||
| 280 | hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN); | ||
| 281 | apple_setup_input(hi->input); | ||
| 282 | return 1; | ||
| 283 | } | ||
| 284 | |||
| 285 | /* we want the hid layer to go through standard path (set and ignore) */ | ||
| 286 | return 0; | ||
| 287 | } | ||
| 288 | |||
| 289 | static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
| 290 | struct hid_field *field, struct hid_usage *usage, | ||
| 291 | unsigned long **bit, int *max) | ||
| 292 | { | ||
| 293 | struct apple_sc *asc = hid_get_drvdata(hdev); | ||
| 294 | |||
| 295 | if (asc->quirks & APPLE_MIGHTYMOUSE) { | ||
| 296 | if (usage->hid == HID_GD_Z) | ||
| 297 | hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); | ||
| 298 | else if (usage->code == BTN_1) | ||
| 299 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_2); | ||
| 300 | else if (usage->code == BTN_2) | ||
| 301 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_1); | ||
| 302 | } | ||
| 303 | |||
| 304 | return 0; | ||
| 305 | } | ||
| 306 | |||
| 307 | static int apple_probe(struct hid_device *hdev, | ||
| 308 | const struct hid_device_id *id) | ||
| 309 | { | ||
| 310 | unsigned long quirks = id->driver_data; | ||
| 311 | struct apple_sc *asc; | ||
| 312 | unsigned int connect_mask = HID_CONNECT_DEFAULT; | ||
| 313 | int ret; | ||
| 314 | |||
| 315 | /* return something else or move to hid layer? device will reside | ||
| 316 | allocated */ | ||
| 317 | if (id->bus == BUS_USB && (quirks & APPLE_IGNORE_MOUSE) && | ||
| 318 | to_usb_interface(hdev->dev.parent)->cur_altsetting-> | ||
| 319 | desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) | ||
| 320 | return -ENODEV; | ||
| 321 | |||
| 322 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); | ||
| 323 | if (asc == NULL) { | ||
| 324 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); | ||
| 325 | return -ENOMEM; | ||
| 326 | } | ||
| 327 | |||
| 328 | asc->quirks = quirks; | ||
| 329 | |||
| 330 | hid_set_drvdata(hdev, asc); | ||
| 331 | |||
| 332 | ret = hid_parse(hdev); | ||
| 333 | if (ret) { | ||
| 334 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 335 | goto err_free; | ||
| 336 | } | ||
| 337 | |||
| 338 | if (quirks & APPLE_HIDDEV) | ||
| 339 | connect_mask |= HID_CONNECT_HIDDEV_FORCE; | ||
| 340 | if (quirks & APPLE_IGNORE_HIDINPUT) | ||
| 341 | connect_mask &= ~HID_CONNECT_HIDINPUT; | ||
| 342 | |||
| 343 | ret = hid_hw_start(hdev, connect_mask); | ||
| 344 | if (ret) { | ||
| 345 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 346 | goto err_free; | ||
| 347 | } | ||
| 348 | |||
| 349 | return 0; | ||
| 350 | err_free: | ||
| 351 | kfree(asc); | ||
| 352 | return ret; | ||
| 353 | } | ||
| 354 | |||
| 355 | static void apple_remove(struct hid_device *hdev) | ||
| 356 | { | ||
| 357 | hid_hw_stop(hdev); | ||
| 358 | kfree(hid_get_drvdata(hdev)); | ||
| 359 | } | ||
| 360 | |||
| 361 | static const struct hid_device_id apple_devices[] = { | ||
| 362 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL), | ||
| 363 | .driver_data = APPLE_HIDDEV | APPLE_IGNORE_HIDINPUT }, | ||
| 364 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4), | ||
| 365 | .driver_data = APPLE_HIDDEV | APPLE_IGNORE_HIDINPUT }, | ||
| 366 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE), | ||
| 367 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, | ||
| 368 | |||
| 369 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), | ||
| 370 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 371 | APPLE_IGNORE_MOUSE }, | ||
| 372 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), | ||
| 373 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 374 | APPLE_IGNORE_MOUSE }, | ||
| 375 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), | ||
| 376 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 377 | APPLE_IGNORE_MOUSE }, | ||
| 378 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), | ||
| 379 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 380 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | ||
| 381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), | ||
| 382 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 383 | APPLE_IGNORE_MOUSE }, | ||
| 384 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), | ||
| 385 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 386 | APPLE_IGNORE_MOUSE }, | ||
| 387 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), | ||
| 388 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 389 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | ||
| 390 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), | ||
| 391 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 392 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | ||
| 393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), | ||
| 394 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 395 | APPLE_IGNORE_MOUSE }, | ||
| 396 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), | ||
| 397 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 398 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | ||
| 399 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), | ||
| 400 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 401 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS}, | ||
| 402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), | ||
| 403 | .driver_data = APPLE_HAS_FN }, | ||
| 404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), | ||
| 405 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | ||
| 406 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), | ||
| 407 | .driver_data = APPLE_HAS_FN }, | ||
| 408 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), | ||
| 409 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 410 | APPLE_IGNORE_MOUSE }, | ||
| 411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), | ||
| 412 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 413 | APPLE_IGNORE_MOUSE }, | ||
| 414 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), | ||
| 415 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 416 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | ||
| 417 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), | ||
| 418 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | ||
| 419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), | ||
| 420 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 421 | APPLE_ISO_KEYBOARD }, | ||
| 422 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), | ||
| 423 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | ||
| 424 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), | ||
| 425 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, | ||
| 426 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), | ||
| 427 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | | ||
| 428 | APPLE_IGNORE_MOUSE }, | ||
| 429 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), | ||
| 430 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | ||
| 431 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), | ||
| 432 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, | ||
| 433 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), | ||
| 434 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | | ||
| 435 | APPLE_IGNORE_MOUSE }, | ||
| 436 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), | ||
| 437 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | ||
| 438 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), | ||
| 439 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 440 | APPLE_IGNORE_MOUSE }, | ||
| 441 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), | ||
| 442 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | ||
| 443 | APPLE_IGNORE_MOUSE }, | ||
| 444 | |||
| 445 | /* Apple wireless Mighty Mouse */ | ||
| 446 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c), | ||
| 447 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, | ||
| 448 | |||
| 449 | { } | ||
| 450 | }; | ||
| 451 | MODULE_DEVICE_TABLE(hid, apple_devices); | ||
| 452 | |||
| 453 | static struct hid_driver apple_driver = { | ||
| 454 | .name = "apple", | ||
| 455 | .id_table = apple_devices, | ||
| 456 | .report_fixup = apple_report_fixup, | ||
| 457 | .probe = apple_probe, | ||
| 458 | .remove = apple_remove, | ||
| 459 | .event = apple_event, | ||
| 460 | .input_mapping = apple_input_mapping, | ||
| 461 | .input_mapped = apple_input_mapped, | ||
| 462 | }; | ||
| 463 | |||
| 464 | static int apple_init(void) | ||
| 465 | { | ||
| 466 | int ret; | ||
| 467 | |||
| 468 | ret = hid_register_driver(&apple_driver); | ||
| 469 | if (ret) | ||
| 470 | printk(KERN_ERR "can't register apple driver\n"); | ||
| 471 | |||
| 472 | return ret; | ||
| 473 | } | ||
| 474 | |||
| 475 | static void apple_exit(void) | ||
| 476 | { | ||
| 477 | hid_unregister_driver(&apple_driver); | ||
| 478 | } | ||
| 479 | |||
| 480 | module_init(apple_init); | ||
| 481 | module_exit(apple_exit); | ||
| 482 | MODULE_LICENSE("GPL"); | ||
| 483 | |||
| 484 | HID_COMPAT_LOAD_DRIVER(apple); | ||
diff --git a/drivers/hid/hid-belkin.c b/drivers/hid/hid-belkin.c new file mode 100644 index 000000000000..12c8a9ba6ed6 --- /dev/null +++ b/drivers/hid/hid-belkin.c | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some belkin "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | |||
| 25 | #define BELKIN_HIDDEV 0x01 | ||
| 26 | #define BELKIN_WKBD 0x02 | ||
| 27 | |||
| 28 | #define belkin_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 29 | EV_KEY, (c)) | ||
| 30 | static int belkin_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 31 | struct hid_field *field, struct hid_usage *usage, | ||
| 32 | unsigned long **bit, int *max) | ||
| 33 | { | ||
| 34 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 35 | |||
| 36 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER || | ||
| 37 | !(quirks & BELKIN_WKBD)) | ||
| 38 | return 0; | ||
| 39 | |||
| 40 | switch (usage->hid & HID_USAGE) { | ||
| 41 | case 0x03a: belkin_map_key_clear(KEY_SOUND); break; | ||
| 42 | case 0x03b: belkin_map_key_clear(KEY_CAMERA); break; | ||
| 43 | case 0x03c: belkin_map_key_clear(KEY_DOCUMENTS); break; | ||
| 44 | default: | ||
| 45 | return 0; | ||
| 46 | } | ||
| 47 | return 1; | ||
| 48 | } | ||
| 49 | |||
| 50 | static int belkin_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 51 | { | ||
| 52 | unsigned long quirks = id->driver_data; | ||
| 53 | int ret; | ||
| 54 | |||
| 55 | hid_set_drvdata(hdev, (void *)quirks); | ||
| 56 | |||
| 57 | ret = hid_parse(hdev); | ||
| 58 | if (ret) { | ||
| 59 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 60 | goto err_free; | ||
| 61 | } | ||
| 62 | |||
| 63 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | | ||
| 64 | ((quirks & BELKIN_HIDDEV) ? HID_CONNECT_HIDDEV_FORCE : 0)); | ||
| 65 | if (ret) { | ||
| 66 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 67 | goto err_free; | ||
| 68 | } | ||
| 69 | |||
| 70 | return 0; | ||
| 71 | err_free: | ||
| 72 | return ret; | ||
| 73 | } | ||
| 74 | |||
| 75 | static const struct hid_device_id belkin_devices[] = { | ||
| 76 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM), | ||
| 77 | .driver_data = BELKIN_HIDDEV }, | ||
| 78 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD), | ||
| 79 | .driver_data = BELKIN_WKBD }, | ||
| 80 | { } | ||
| 81 | }; | ||
| 82 | MODULE_DEVICE_TABLE(hid, belkin_devices); | ||
| 83 | |||
| 84 | static struct hid_driver belkin_driver = { | ||
| 85 | .name = "belkin", | ||
| 86 | .id_table = belkin_devices, | ||
| 87 | .input_mapping = belkin_input_mapping, | ||
| 88 | .probe = belkin_probe, | ||
| 89 | }; | ||
| 90 | |||
| 91 | static int belkin_init(void) | ||
| 92 | { | ||
| 93 | return hid_register_driver(&belkin_driver); | ||
| 94 | } | ||
| 95 | |||
| 96 | static void belkin_exit(void) | ||
| 97 | { | ||
| 98 | hid_unregister_driver(&belkin_driver); | ||
| 99 | } | ||
| 100 | |||
| 101 | module_init(belkin_init); | ||
| 102 | module_exit(belkin_exit); | ||
| 103 | MODULE_LICENSE("GPL"); | ||
| 104 | |||
| 105 | HID_COMPAT_LOAD_DRIVER(belkin); | ||
diff --git a/drivers/hid/hid-bright.c b/drivers/hid/hid-bright.c new file mode 100644 index 000000000000..38517a117dfd --- /dev/null +++ b/drivers/hid/hid-bright.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some bright "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008 Mauro Carvalho Chehab <mchehab@redhat.com> | ||
| 5 | * | ||
| 6 | * Based on hid-dell driver | ||
| 7 | */ | ||
| 8 | |||
| 9 | /* | ||
| 10 | * This program is free software; you can redistribute it and/or modify it | ||
| 11 | * under the terms of the GNU General Public License as published by the Free | ||
| 12 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 13 | * any later version. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/device.h> | ||
| 17 | #include <linux/hid.h> | ||
| 18 | #include <linux/module.h> | ||
| 19 | |||
| 20 | #include "hid-ids.h" | ||
| 21 | |||
| 22 | static int bright_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 23 | { | ||
| 24 | int ret; | ||
| 25 | |||
| 26 | ret = hid_parse(hdev); | ||
| 27 | if (ret) { | ||
| 28 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 29 | goto err_free; | ||
| 30 | } | ||
| 31 | |||
| 32 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 33 | if (ret) { | ||
| 34 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 35 | goto err_free; | ||
| 36 | } | ||
| 37 | |||
| 38 | usbhid_set_leds(hdev); | ||
| 39 | |||
| 40 | return 0; | ||
| 41 | err_free: | ||
| 42 | return ret; | ||
| 43 | } | ||
| 44 | |||
| 45 | static const struct hid_device_id bright_devices[] = { | ||
| 46 | { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) }, | ||
| 47 | { } | ||
| 48 | }; | ||
| 49 | MODULE_DEVICE_TABLE(hid, bright_devices); | ||
| 50 | |||
| 51 | static struct hid_driver bright_driver = { | ||
| 52 | .name = "bright", | ||
| 53 | .id_table = bright_devices, | ||
| 54 | .probe = bright_probe, | ||
| 55 | }; | ||
| 56 | |||
| 57 | static int bright_init(void) | ||
| 58 | { | ||
| 59 | return hid_register_driver(&bright_driver); | ||
| 60 | } | ||
| 61 | |||
| 62 | static void bright_exit(void) | ||
| 63 | { | ||
| 64 | hid_unregister_driver(&bright_driver); | ||
| 65 | } | ||
| 66 | |||
| 67 | module_init(bright_init); | ||
| 68 | module_exit(bright_exit); | ||
| 69 | MODULE_LICENSE("GPL"); | ||
| 70 | |||
| 71 | HID_COMPAT_LOAD_DRIVER(bright); | ||
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c new file mode 100644 index 000000000000..b833b9769aba --- /dev/null +++ b/drivers/hid/hid-cherry.c | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some cherry "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Cherry Cymotion keyboard have an invalid HID report descriptor, | ||
| 27 | * that needs fixing before we can parse it. | ||
| 28 | */ | ||
| 29 | static void ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 30 | unsigned int rsize) | ||
| 31 | { | ||
| 32 | if (rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { | ||
| 33 | dev_info(&hdev->dev, "fixing up Cherry Cymotion report " | ||
| 34 | "descriptor\n"); | ||
| 35 | rdesc[11] = rdesc[16] = 0xff; | ||
| 36 | rdesc[12] = rdesc[17] = 0x03; | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | #define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 41 | EV_KEY, (c)) | ||
| 42 | static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 43 | struct hid_field *field, struct hid_usage *usage, | ||
| 44 | unsigned long **bit, int *max) | ||
| 45 | { | ||
| 46 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 47 | return 0; | ||
| 48 | |||
| 49 | switch (usage->hid & HID_USAGE) { | ||
| 50 | case 0x301: ch_map_key_clear(KEY_PROG1); break; | ||
| 51 | case 0x302: ch_map_key_clear(KEY_PROG2); break; | ||
| 52 | case 0x303: ch_map_key_clear(KEY_PROG3); break; | ||
| 53 | default: | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | |||
| 57 | return 1; | ||
| 58 | } | ||
| 59 | |||
| 60 | static const struct hid_device_id ch_devices[] = { | ||
| 61 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, | ||
| 62 | { } | ||
| 63 | }; | ||
| 64 | MODULE_DEVICE_TABLE(hid, ch_devices); | ||
| 65 | |||
| 66 | static struct hid_driver ch_driver = { | ||
| 67 | .name = "cherry", | ||
| 68 | .id_table = ch_devices, | ||
| 69 | .report_fixup = ch_report_fixup, | ||
| 70 | .input_mapping = ch_input_mapping, | ||
| 71 | }; | ||
| 72 | |||
| 73 | static int ch_init(void) | ||
| 74 | { | ||
| 75 | return hid_register_driver(&ch_driver); | ||
| 76 | } | ||
| 77 | |||
| 78 | static void ch_exit(void) | ||
| 79 | { | ||
| 80 | hid_unregister_driver(&ch_driver); | ||
| 81 | } | ||
| 82 | |||
| 83 | module_init(ch_init); | ||
| 84 | module_exit(ch_exit); | ||
| 85 | MODULE_LICENSE("GPL"); | ||
| 86 | |||
| 87 | HID_COMPAT_LOAD_DRIVER(cherry); | ||
diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c new file mode 100644 index 000000000000..a54d4096e0f7 --- /dev/null +++ b/drivers/hid/hid-chicony.c | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some chicony "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/input.h> | ||
| 21 | #include <linux/hid.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | #define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 27 | EV_KEY, (c)) | ||
| 28 | static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 29 | struct hid_field *field, struct hid_usage *usage, | ||
| 30 | unsigned long **bit, int *max) | ||
| 31 | { | ||
| 32 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) | ||
| 33 | return 0; | ||
| 34 | |||
| 35 | set_bit(EV_REP, hi->input->evbit); | ||
| 36 | switch (usage->hid & HID_USAGE) { | ||
| 37 | case 0xff01: ch_map_key_clear(BTN_1); break; | ||
| 38 | case 0xff02: ch_map_key_clear(BTN_2); break; | ||
| 39 | case 0xff03: ch_map_key_clear(BTN_3); break; | ||
| 40 | case 0xff04: ch_map_key_clear(BTN_4); break; | ||
| 41 | case 0xff05: ch_map_key_clear(BTN_5); break; | ||
| 42 | case 0xff06: ch_map_key_clear(BTN_6); break; | ||
| 43 | case 0xff07: ch_map_key_clear(BTN_7); break; | ||
| 44 | case 0xff08: ch_map_key_clear(BTN_8); break; | ||
| 45 | case 0xff09: ch_map_key_clear(BTN_9); break; | ||
| 46 | case 0xff0a: ch_map_key_clear(BTN_A); break; | ||
| 47 | case 0xff0b: ch_map_key_clear(BTN_B); break; | ||
| 48 | default: | ||
| 49 | return 0; | ||
| 50 | } | ||
| 51 | return 1; | ||
| 52 | } | ||
| 53 | |||
| 54 | static const struct hid_device_id ch_devices[] = { | ||
| 55 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | ||
| 56 | { } | ||
| 57 | }; | ||
| 58 | MODULE_DEVICE_TABLE(hid, ch_devices); | ||
| 59 | |||
| 60 | static struct hid_driver ch_driver = { | ||
| 61 | .name = "chicony", | ||
| 62 | .id_table = ch_devices, | ||
| 63 | .input_mapping = ch_input_mapping, | ||
| 64 | }; | ||
| 65 | |||
| 66 | static int ch_init(void) | ||
| 67 | { | ||
| 68 | return hid_register_driver(&ch_driver); | ||
| 69 | } | ||
| 70 | |||
| 71 | static void ch_exit(void) | ||
| 72 | { | ||
| 73 | hid_unregister_driver(&ch_driver); | ||
| 74 | } | ||
| 75 | |||
| 76 | module_init(ch_init); | ||
| 77 | module_exit(ch_exit); | ||
| 78 | MODULE_LICENSE("GPL"); | ||
| 79 | |||
| 80 | HID_COMPAT_LOAD_DRIVER(chicony); | ||
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 426ac5add585..8a7d9dbb4d07 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -33,6 +33,8 @@ | |||
| 33 | #include <linux/hid-debug.h> | 33 | #include <linux/hid-debug.h> |
| 34 | #include <linux/hidraw.h> | 34 | #include <linux/hidraw.h> |
| 35 | 35 | ||
| 36 | #include "hid-ids.h" | ||
| 37 | |||
| 36 | /* | 38 | /* |
| 37 | * Version Information | 39 | * Version Information |
| 38 | */ | 40 | */ |
| @@ -268,9 +270,9 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign | |||
| 268 | static u32 item_udata(struct hid_item *item) | 270 | static u32 item_udata(struct hid_item *item) |
| 269 | { | 271 | { |
| 270 | switch (item->size) { | 272 | switch (item->size) { |
| 271 | case 1: return item->data.u8; | 273 | case 1: return item->data.u8; |
| 272 | case 2: return item->data.u16; | 274 | case 2: return item->data.u16; |
| 273 | case 4: return item->data.u32; | 275 | case 4: return item->data.u32; |
| 274 | } | 276 | } |
| 275 | return 0; | 277 | return 0; |
| 276 | } | 278 | } |
| @@ -278,9 +280,9 @@ static u32 item_udata(struct hid_item *item) | |||
| 278 | static s32 item_sdata(struct hid_item *item) | 280 | static s32 item_sdata(struct hid_item *item) |
| 279 | { | 281 | { |
| 280 | switch (item->size) { | 282 | switch (item->size) { |
| 281 | case 1: return item->data.s8; | 283 | case 1: return item->data.s8; |
| 282 | case 2: return item->data.s16; | 284 | case 2: return item->data.s16; |
| 283 | case 4: return item->data.s32; | 285 | case 4: return item->data.s32; |
| 284 | } | 286 | } |
| 285 | return 0; | 287 | return 0; |
| 286 | } | 288 | } |
| @@ -292,87 +294,91 @@ static s32 item_sdata(struct hid_item *item) | |||
| 292 | static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) | 294 | static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) |
| 293 | { | 295 | { |
| 294 | switch (item->tag) { | 296 | switch (item->tag) { |
| 297 | case HID_GLOBAL_ITEM_TAG_PUSH: | ||
| 295 | 298 | ||
| 296 | case HID_GLOBAL_ITEM_TAG_PUSH: | 299 | if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { |
| 297 | 300 | dbg_hid("global enviroment stack overflow\n"); | |
| 298 | if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { | 301 | return -1; |
| 299 | dbg_hid("global enviroment stack overflow\n"); | 302 | } |
| 300 | return -1; | ||
| 301 | } | ||
| 302 | 303 | ||
| 303 | memcpy(parser->global_stack + parser->global_stack_ptr++, | 304 | memcpy(parser->global_stack + parser->global_stack_ptr++, |
| 304 | &parser->global, sizeof(struct hid_global)); | 305 | &parser->global, sizeof(struct hid_global)); |
| 305 | return 0; | 306 | return 0; |
| 306 | 307 | ||
| 307 | case HID_GLOBAL_ITEM_TAG_POP: | 308 | case HID_GLOBAL_ITEM_TAG_POP: |
| 308 | 309 | ||
| 309 | if (!parser->global_stack_ptr) { | 310 | if (!parser->global_stack_ptr) { |
| 310 | dbg_hid("global enviroment stack underflow\n"); | 311 | dbg_hid("global enviroment stack underflow\n"); |
| 311 | return -1; | 312 | return -1; |
| 312 | } | 313 | } |
| 313 | |||
| 314 | memcpy(&parser->global, parser->global_stack + --parser->global_stack_ptr, | ||
| 315 | sizeof(struct hid_global)); | ||
| 316 | return 0; | ||
| 317 | 314 | ||
| 318 | case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: | 315 | memcpy(&parser->global, parser->global_stack + |
| 319 | parser->global.usage_page = item_udata(item); | 316 | --parser->global_stack_ptr, sizeof(struct hid_global)); |
| 320 | return 0; | 317 | return 0; |
| 321 | 318 | ||
| 322 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: | 319 | case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: |
| 323 | parser->global.logical_minimum = item_sdata(item); | 320 | parser->global.usage_page = item_udata(item); |
| 324 | return 0; | 321 | return 0; |
| 325 | 322 | ||
| 326 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: | 323 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: |
| 327 | if (parser->global.logical_minimum < 0) | 324 | parser->global.logical_minimum = item_sdata(item); |
| 328 | parser->global.logical_maximum = item_sdata(item); | 325 | return 0; |
| 329 | else | ||
| 330 | parser->global.logical_maximum = item_udata(item); | ||
| 331 | return 0; | ||
| 332 | 326 | ||
| 333 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: | 327 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: |
| 334 | parser->global.physical_minimum = item_sdata(item); | 328 | if (parser->global.logical_minimum < 0) |
| 335 | return 0; | 329 | parser->global.logical_maximum = item_sdata(item); |
| 330 | else | ||
| 331 | parser->global.logical_maximum = item_udata(item); | ||
| 332 | return 0; | ||
| 336 | 333 | ||
| 337 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: | 334 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: |
| 338 | if (parser->global.physical_minimum < 0) | 335 | parser->global.physical_minimum = item_sdata(item); |
| 339 | parser->global.physical_maximum = item_sdata(item); | 336 | return 0; |
| 340 | else | ||
| 341 | parser->global.physical_maximum = item_udata(item); | ||
| 342 | return 0; | ||
| 343 | 337 | ||
| 344 | case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: | 338 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: |
| 345 | parser->global.unit_exponent = item_sdata(item); | 339 | if (parser->global.physical_minimum < 0) |
| 346 | return 0; | 340 | parser->global.physical_maximum = item_sdata(item); |
| 341 | else | ||
| 342 | parser->global.physical_maximum = item_udata(item); | ||
| 343 | return 0; | ||
| 347 | 344 | ||
| 348 | case HID_GLOBAL_ITEM_TAG_UNIT: | 345 | case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: |
| 349 | parser->global.unit = item_udata(item); | 346 | parser->global.unit_exponent = item_sdata(item); |
| 350 | return 0; | 347 | return 0; |
| 351 | 348 | ||
| 352 | case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: | 349 | case HID_GLOBAL_ITEM_TAG_UNIT: |
| 353 | if ((parser->global.report_size = item_udata(item)) > 32) { | 350 | parser->global.unit = item_udata(item); |
| 354 | dbg_hid("invalid report_size %d\n", parser->global.report_size); | 351 | return 0; |
| 355 | return -1; | ||
| 356 | } | ||
| 357 | return 0; | ||
| 358 | 352 | ||
| 359 | case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: | 353 | case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: |
| 360 | if ((parser->global.report_count = item_udata(item)) > HID_MAX_USAGES) { | 354 | parser->global.report_size = item_udata(item); |
| 361 | dbg_hid("invalid report_count %d\n", parser->global.report_count); | 355 | if (parser->global.report_size > 32) { |
| 362 | return -1; | 356 | dbg_hid("invalid report_size %d\n", |
| 363 | } | 357 | parser->global.report_size); |
| 364 | return 0; | 358 | return -1; |
| 359 | } | ||
| 360 | return 0; | ||
| 365 | 361 | ||
| 366 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: | 362 | case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: |
| 367 | if ((parser->global.report_id = item_udata(item)) == 0) { | 363 | parser->global.report_count = item_udata(item); |
| 368 | dbg_hid("report_id 0 is invalid\n"); | 364 | if (parser->global.report_count > HID_MAX_USAGES) { |
| 369 | return -1; | 365 | dbg_hid("invalid report_count %d\n", |
| 370 | } | 366 | parser->global.report_count); |
| 371 | return 0; | 367 | return -1; |
| 368 | } | ||
| 369 | return 0; | ||
| 372 | 370 | ||
| 373 | default: | 371 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: |
| 374 | dbg_hid("unknown global tag 0x%x\n", item->tag); | 372 | parser->global.report_id = item_udata(item); |
| 373 | if (parser->global.report_id == 0) { | ||
| 374 | dbg_hid("report_id 0 is invalid\n"); | ||
| 375 | return -1; | 375 | return -1; |
| 376 | } | ||
| 377 | return 0; | ||
| 378 | |||
| 379 | default: | ||
| 380 | dbg_hid("unknown global tag 0x%x\n", item->tag); | ||
| 381 | return -1; | ||
| 376 | } | 382 | } |
| 377 | } | 383 | } |
| 378 | 384 | ||
| @@ -393,77 +399,76 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
| 393 | data = item_udata(item); | 399 | data = item_udata(item); |
| 394 | 400 | ||
| 395 | switch (item->tag) { | 401 | switch (item->tag) { |
| 396 | 402 | case HID_LOCAL_ITEM_TAG_DELIMITER: | |
| 397 | case HID_LOCAL_ITEM_TAG_DELIMITER: | 403 | |
| 398 | 404 | if (data) { | |
| 399 | if (data) { | 405 | /* |
| 400 | /* | 406 | * We treat items before the first delimiter |
| 401 | * We treat items before the first delimiter | 407 | * as global to all usage sets (branch 0). |
| 402 | * as global to all usage sets (branch 0). | 408 | * In the moment we process only these global |
| 403 | * In the moment we process only these global | 409 | * items and the first delimiter set. |
| 404 | * items and the first delimiter set. | 410 | */ |
| 405 | */ | 411 | if (parser->local.delimiter_depth != 0) { |
| 406 | if (parser->local.delimiter_depth != 0) { | 412 | dbg_hid("nested delimiters\n"); |
| 407 | dbg_hid("nested delimiters\n"); | 413 | return -1; |
| 408 | return -1; | ||
| 409 | } | ||
| 410 | parser->local.delimiter_depth++; | ||
| 411 | parser->local.delimiter_branch++; | ||
| 412 | } else { | ||
| 413 | if (parser->local.delimiter_depth < 1) { | ||
| 414 | dbg_hid("bogus close delimiter\n"); | ||
| 415 | return -1; | ||
| 416 | } | ||
| 417 | parser->local.delimiter_depth--; | ||
| 418 | } | 414 | } |
| 419 | return 1; | 415 | parser->local.delimiter_depth++; |
| 420 | 416 | parser->local.delimiter_branch++; | |
| 421 | case HID_LOCAL_ITEM_TAG_USAGE: | 417 | } else { |
| 422 | 418 | if (parser->local.delimiter_depth < 1) { | |
| 423 | if (parser->local.delimiter_branch > 1) { | 419 | dbg_hid("bogus close delimiter\n"); |
| 424 | dbg_hid("alternative usage ignored\n"); | 420 | return -1; |
| 425 | return 0; | ||
| 426 | } | 421 | } |
| 422 | parser->local.delimiter_depth--; | ||
| 423 | } | ||
| 424 | return 1; | ||
| 427 | 425 | ||
| 428 | if (item->size <= 2) | 426 | case HID_LOCAL_ITEM_TAG_USAGE: |
| 429 | data = (parser->global.usage_page << 16) + data; | ||
| 430 | 427 | ||
| 431 | return hid_add_usage(parser, data); | 428 | if (parser->local.delimiter_branch > 1) { |
| 429 | dbg_hid("alternative usage ignored\n"); | ||
| 430 | return 0; | ||
| 431 | } | ||
| 432 | 432 | ||
| 433 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: | 433 | if (item->size <= 2) |
| 434 | data = (parser->global.usage_page << 16) + data; | ||
| 434 | 435 | ||
| 435 | if (parser->local.delimiter_branch > 1) { | 436 | return hid_add_usage(parser, data); |
| 436 | dbg_hid("alternative usage ignored\n"); | ||
| 437 | return 0; | ||
| 438 | } | ||
| 439 | 437 | ||
| 440 | if (item->size <= 2) | 438 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: |
| 441 | data = (parser->global.usage_page << 16) + data; | ||
| 442 | 439 | ||
| 443 | parser->local.usage_minimum = data; | 440 | if (parser->local.delimiter_branch > 1) { |
| 441 | dbg_hid("alternative usage ignored\n"); | ||
| 444 | return 0; | 442 | return 0; |
| 443 | } | ||
| 445 | 444 | ||
| 446 | case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: | 445 | if (item->size <= 2) |
| 446 | data = (parser->global.usage_page << 16) + data; | ||
| 447 | 447 | ||
| 448 | if (parser->local.delimiter_branch > 1) { | 448 | parser->local.usage_minimum = data; |
| 449 | dbg_hid("alternative usage ignored\n"); | 449 | return 0; |
| 450 | return 0; | ||
| 451 | } | ||
| 452 | 450 | ||
| 453 | if (item->size <= 2) | 451 | case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: |
| 454 | data = (parser->global.usage_page << 16) + data; | ||
| 455 | 452 | ||
| 456 | for (n = parser->local.usage_minimum; n <= data; n++) | 453 | if (parser->local.delimiter_branch > 1) { |
| 457 | if (hid_add_usage(parser, n)) { | 454 | dbg_hid("alternative usage ignored\n"); |
| 458 | dbg_hid("hid_add_usage failed\n"); | ||
| 459 | return -1; | ||
| 460 | } | ||
| 461 | return 0; | 455 | return 0; |
| 456 | } | ||
| 462 | 457 | ||
| 463 | default: | 458 | if (item->size <= 2) |
| 459 | data = (parser->global.usage_page << 16) + data; | ||
| 464 | 460 | ||
| 465 | dbg_hid("unknown local item tag 0x%x\n", item->tag); | 461 | for (n = parser->local.usage_minimum; n <= data; n++) |
| 466 | return 0; | 462 | if (hid_add_usage(parser, n)) { |
| 463 | dbg_hid("hid_add_usage failed\n"); | ||
| 464 | return -1; | ||
| 465 | } | ||
| 466 | return 0; | ||
| 467 | |||
| 468 | default: | ||
| 469 | |||
| 470 | dbg_hid("unknown local item tag 0x%x\n", item->tag); | ||
| 471 | return 0; | ||
| 467 | } | 472 | } |
| 468 | return 0; | 473 | return 0; |
| 469 | } | 474 | } |
| @@ -480,24 +485,24 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) | |||
| 480 | data = item_udata(item); | 485 | data = item_udata(item); |
| 481 | 486 | ||
| 482 | switch (item->tag) { | 487 | switch (item->tag) { |
| 483 | case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: | 488 | case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: |
| 484 | ret = open_collection(parser, data & 0xff); | 489 | ret = open_collection(parser, data & 0xff); |
| 485 | break; | 490 | break; |
| 486 | case HID_MAIN_ITEM_TAG_END_COLLECTION: | 491 | case HID_MAIN_ITEM_TAG_END_COLLECTION: |
| 487 | ret = close_collection(parser); | 492 | ret = close_collection(parser); |
| 488 | break; | 493 | break; |
| 489 | case HID_MAIN_ITEM_TAG_INPUT: | 494 | case HID_MAIN_ITEM_TAG_INPUT: |
| 490 | ret = hid_add_field(parser, HID_INPUT_REPORT, data); | 495 | ret = hid_add_field(parser, HID_INPUT_REPORT, data); |
| 491 | break; | 496 | break; |
| 492 | case HID_MAIN_ITEM_TAG_OUTPUT: | 497 | case HID_MAIN_ITEM_TAG_OUTPUT: |
| 493 | ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); | 498 | ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); |
| 494 | break; | 499 | break; |
| 495 | case HID_MAIN_ITEM_TAG_FEATURE: | 500 | case HID_MAIN_ITEM_TAG_FEATURE: |
| 496 | ret = hid_add_field(parser, HID_FEATURE_REPORT, data); | 501 | ret = hid_add_field(parser, HID_FEATURE_REPORT, data); |
| 497 | break; | 502 | break; |
| 498 | default: | 503 | default: |
| 499 | dbg_hid("unknown main item tag 0x%x\n", item->tag); | 504 | dbg_hid("unknown main item tag 0x%x\n", item->tag); |
| 500 | ret = 0; | 505 | ret = 0; |
| 501 | } | 506 | } |
| 502 | 507 | ||
| 503 | memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ | 508 | memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ |
| @@ -534,9 +539,10 @@ static void hid_free_report(struct hid_report *report) | |||
| 534 | * Free a device structure, all reports, and all fields. | 539 | * Free a device structure, all reports, and all fields. |
| 535 | */ | 540 | */ |
| 536 | 541 | ||
| 537 | void hid_free_device(struct hid_device *device) | 542 | static void hid_device_release(struct device *dev) |
| 538 | { | 543 | { |
| 539 | unsigned i,j; | 544 | struct hid_device *device = container_of(dev, struct hid_device, dev); |
| 545 | unsigned i, j; | ||
| 540 | 546 | ||
| 541 | for (i = 0; i < HID_REPORT_TYPES; i++) { | 547 | for (i = 0; i < HID_REPORT_TYPES; i++) { |
| 542 | struct hid_report_enum *report_enum = device->report_enum + i; | 548 | struct hid_report_enum *report_enum = device->report_enum + i; |
| @@ -552,7 +558,6 @@ void hid_free_device(struct hid_device *device) | |||
| 552 | kfree(device->collection); | 558 | kfree(device->collection); |
| 553 | kfree(device); | 559 | kfree(device); |
| 554 | } | 560 | } |
| 555 | EXPORT_SYMBOL_GPL(hid_free_device); | ||
| 556 | 561 | ||
| 557 | /* | 562 | /* |
| 558 | * Fetch a report description item from the data stream. We support long | 563 | * Fetch a report description item from the data stream. We support long |
| @@ -593,47 +598,52 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) | |||
| 593 | item->size = b & 3; | 598 | item->size = b & 3; |
| 594 | 599 | ||
| 595 | switch (item->size) { | 600 | switch (item->size) { |
| 601 | case 0: | ||
| 602 | return start; | ||
| 596 | 603 | ||
| 597 | case 0: | 604 | case 1: |
| 598 | return start; | 605 | if ((end - start) < 1) |
| 599 | 606 | return NULL; | |
| 600 | case 1: | 607 | item->data.u8 = *start++; |
| 601 | if ((end - start) < 1) | 608 | return start; |
| 602 | return NULL; | ||
| 603 | item->data.u8 = *start++; | ||
| 604 | return start; | ||
| 605 | 609 | ||
| 606 | case 2: | 610 | case 2: |
| 607 | if ((end - start) < 2) | 611 | if ((end - start) < 2) |
| 608 | return NULL; | 612 | return NULL; |
| 609 | item->data.u16 = get_unaligned_le16(start); | 613 | item->data.u16 = get_unaligned_le16(start); |
| 610 | start = (__u8 *)((__le16 *)start + 1); | 614 | start = (__u8 *)((__le16 *)start + 1); |
| 611 | return start; | 615 | return start; |
| 612 | 616 | ||
| 613 | case 3: | 617 | case 3: |
| 614 | item->size++; | 618 | item->size++; |
| 615 | if ((end - start) < 4) | 619 | if ((end - start) < 4) |
| 616 | return NULL; | 620 | return NULL; |
| 617 | item->data.u32 = get_unaligned_le32(start); | 621 | item->data.u32 = get_unaligned_le32(start); |
| 618 | start = (__u8 *)((__le32 *)start + 1); | 622 | start = (__u8 *)((__le32 *)start + 1); |
| 619 | return start; | 623 | return start; |
| 620 | } | 624 | } |
| 621 | 625 | ||
| 622 | return NULL; | 626 | return NULL; |
| 623 | } | 627 | } |
| 624 | 628 | ||
| 625 | /* | 629 | /** |
| 630 | * hid_parse_report - parse device report | ||
| 631 | * | ||
| 632 | * @device: hid device | ||
| 633 | * @start: report start | ||
| 634 | * @size: report size | ||
| 635 | * | ||
| 626 | * Parse a report description into a hid_device structure. Reports are | 636 | * Parse a report description into a hid_device structure. Reports are |
| 627 | * enumerated, fields are attached to these reports. | 637 | * enumerated, fields are attached to these reports. |
| 638 | * 0 returned on success, otherwise nonzero error value. | ||
| 628 | */ | 639 | */ |
| 629 | 640 | int hid_parse_report(struct hid_device *device, __u8 *start, | |
| 630 | struct hid_device *hid_parse_report(__u8 *start, unsigned size) | 641 | unsigned size) |
| 631 | { | 642 | { |
| 632 | struct hid_device *device; | ||
| 633 | struct hid_parser *parser; | 643 | struct hid_parser *parser; |
| 634 | struct hid_item item; | 644 | struct hid_item item; |
| 635 | __u8 *end; | 645 | __u8 *end; |
| 636 | unsigned i; | 646 | int ret; |
| 637 | static int (*dispatch_type[])(struct hid_parser *parser, | 647 | static int (*dispatch_type[])(struct hid_parser *parser, |
| 638 | struct hid_item *item) = { | 648 | struct hid_item *item) = { |
| 639 | hid_parser_main, | 649 | hid_parser_main, |
| @@ -642,76 +652,57 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
| 642 | hid_parser_reserved | 652 | hid_parser_reserved |
| 643 | }; | 653 | }; |
| 644 | 654 | ||
| 645 | if (!(device = kzalloc(sizeof(struct hid_device), GFP_KERNEL))) | 655 | if (device->driver->report_fixup) |
| 646 | return NULL; | 656 | device->driver->report_fixup(device, start, size); |
| 647 | 657 | ||
| 648 | if (!(device->collection = kzalloc(sizeof(struct hid_collection) * | 658 | device->rdesc = kmalloc(size, GFP_KERNEL); |
| 649 | HID_DEFAULT_NUM_COLLECTIONS, GFP_KERNEL))) { | 659 | if (device->rdesc == NULL) |
| 650 | kfree(device); | 660 | return -ENOMEM; |
| 651 | return NULL; | ||
| 652 | } | ||
| 653 | device->collection_size = HID_DEFAULT_NUM_COLLECTIONS; | ||
| 654 | |||
| 655 | for (i = 0; i < HID_REPORT_TYPES; i++) | ||
| 656 | INIT_LIST_HEAD(&device->report_enum[i].report_list); | ||
| 657 | |||
| 658 | if (!(device->rdesc = kmalloc(size, GFP_KERNEL))) { | ||
| 659 | kfree(device->collection); | ||
| 660 | kfree(device); | ||
| 661 | return NULL; | ||
| 662 | } | ||
| 663 | memcpy(device->rdesc, start, size); | 661 | memcpy(device->rdesc, start, size); |
| 664 | device->rsize = size; | 662 | device->rsize = size; |
| 665 | 663 | ||
| 666 | if (!(parser = vmalloc(sizeof(struct hid_parser)))) { | 664 | parser = vmalloc(sizeof(struct hid_parser)); |
| 667 | kfree(device->rdesc); | 665 | if (!parser) { |
| 668 | kfree(device->collection); | 666 | ret = -ENOMEM; |
| 669 | kfree(device); | 667 | goto err; |
| 670 | return NULL; | ||
| 671 | } | 668 | } |
| 669 | |||
| 672 | memset(parser, 0, sizeof(struct hid_parser)); | 670 | memset(parser, 0, sizeof(struct hid_parser)); |
| 673 | parser->device = device; | 671 | parser->device = device; |
| 674 | 672 | ||
| 675 | end = start + size; | 673 | end = start + size; |
| 674 | ret = -EINVAL; | ||
| 676 | while ((start = fetch_item(start, end, &item)) != NULL) { | 675 | while ((start = fetch_item(start, end, &item)) != NULL) { |
| 677 | 676 | ||
| 678 | if (item.format != HID_ITEM_FORMAT_SHORT) { | 677 | if (item.format != HID_ITEM_FORMAT_SHORT) { |
| 679 | dbg_hid("unexpected long global item\n"); | 678 | dbg_hid("unexpected long global item\n"); |
| 680 | hid_free_device(device); | 679 | goto err; |
| 681 | vfree(parser); | ||
| 682 | return NULL; | ||
| 683 | } | 680 | } |
| 684 | 681 | ||
| 685 | if (dispatch_type[item.type](parser, &item)) { | 682 | if (dispatch_type[item.type](parser, &item)) { |
| 686 | dbg_hid("item %u %u %u %u parsing failed\n", | 683 | dbg_hid("item %u %u %u %u parsing failed\n", |
| 687 | item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); | 684 | item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); |
| 688 | hid_free_device(device); | 685 | goto err; |
| 689 | vfree(parser); | ||
| 690 | return NULL; | ||
| 691 | } | 686 | } |
| 692 | 687 | ||
| 693 | if (start == end) { | 688 | if (start == end) { |
| 694 | if (parser->collection_stack_ptr) { | 689 | if (parser->collection_stack_ptr) { |
| 695 | dbg_hid("unbalanced collection at end of report description\n"); | 690 | dbg_hid("unbalanced collection at end of report description\n"); |
| 696 | hid_free_device(device); | 691 | goto err; |
| 697 | vfree(parser); | ||
| 698 | return NULL; | ||
| 699 | } | 692 | } |
| 700 | if (parser->local.delimiter_depth) { | 693 | if (parser->local.delimiter_depth) { |
| 701 | dbg_hid("unbalanced delimiter at end of report description\n"); | 694 | dbg_hid("unbalanced delimiter at end of report description\n"); |
| 702 | hid_free_device(device); | 695 | goto err; |
| 703 | vfree(parser); | ||
| 704 | return NULL; | ||
| 705 | } | 696 | } |
| 706 | vfree(parser); | 697 | vfree(parser); |
| 707 | return device; | 698 | return 0; |
| 708 | } | 699 | } |
| 709 | } | 700 | } |
| 710 | 701 | ||
| 711 | dbg_hid("item fetching failed at offset %d\n", (int)(end - start)); | 702 | dbg_hid("item fetching failed at offset %d\n", (int)(end - start)); |
| 712 | hid_free_device(device); | 703 | err: |
| 713 | vfree(parser); | 704 | vfree(parser); |
| 714 | return NULL; | 705 | return ret; |
| 715 | } | 706 | } |
| 716 | EXPORT_SYMBOL_GPL(hid_parse_report); | 707 | EXPORT_SYMBOL_GPL(hid_parse_report); |
| 717 | 708 | ||
| @@ -724,9 +715,9 @@ EXPORT_SYMBOL_GPL(hid_parse_report); | |||
| 724 | static s32 snto32(__u32 value, unsigned n) | 715 | static s32 snto32(__u32 value, unsigned n) |
| 725 | { | 716 | { |
| 726 | switch (n) { | 717 | switch (n) { |
| 727 | case 8: return ((__s8)value); | 718 | case 8: return ((__s8)value); |
| 728 | case 16: return ((__s16)value); | 719 | case 16: return ((__s16)value); |
| 729 | case 32: return ((__s32)value); | 720 | case 32: return ((__s32)value); |
| 730 | } | 721 | } |
| 731 | return value & (1 << (n - 1)) ? value | (-1 << n) : value; | 722 | return value & (1 << (n - 1)) ? value | (-1 << n) : value; |
| 732 | } | 723 | } |
| @@ -815,9 +806,73 @@ static __inline__ int search(__s32 *array, __s32 value, unsigned n) | |||
| 815 | return -1; | 806 | return -1; |
| 816 | } | 807 | } |
| 817 | 808 | ||
| 818 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, int interrupt) | 809 | /** |
| 810 | * hid_match_report - check if driver's raw_event should be called | ||
| 811 | * | ||
| 812 | * @hid: hid device | ||
| 813 | * @report_type: type to match against | ||
| 814 | * | ||
| 815 | * compare hid->driver->report_table->report_type to report->type | ||
| 816 | */ | ||
| 817 | static int hid_match_report(struct hid_device *hid, struct hid_report *report) | ||
| 818 | { | ||
| 819 | const struct hid_report_id *id = hid->driver->report_table; | ||
| 820 | |||
| 821 | if (!id) /* NULL means all */ | ||
| 822 | return 1; | ||
| 823 | |||
| 824 | for (; id->report_type != HID_TERMINATOR; id++) | ||
| 825 | if (id->report_type == HID_ANY_ID || | ||
| 826 | id->report_type == report->type) | ||
| 827 | return 1; | ||
| 828 | return 0; | ||
| 829 | } | ||
| 830 | |||
| 831 | /** | ||
| 832 | * hid_match_usage - check if driver's event should be called | ||
| 833 | * | ||
| 834 | * @hid: hid device | ||
| 835 | * @usage: usage to match against | ||
| 836 | * | ||
| 837 | * compare hid->driver->usage_table->usage_{type,code} to | ||
| 838 | * usage->usage_{type,code} | ||
| 839 | */ | ||
| 840 | static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) | ||
| 819 | { | 841 | { |
| 842 | const struct hid_usage_id *id = hid->driver->usage_table; | ||
| 843 | |||
| 844 | if (!id) /* NULL means all */ | ||
| 845 | return 1; | ||
| 846 | |||
| 847 | for (; id->usage_type != HID_ANY_ID - 1; id++) | ||
| 848 | if ((id->usage_hid == HID_ANY_ID || | ||
| 849 | id->usage_hid == usage->hid) && | ||
| 850 | (id->usage_type == HID_ANY_ID || | ||
| 851 | id->usage_type == usage->type) && | ||
| 852 | (id->usage_code == HID_ANY_ID || | ||
| 853 | id->usage_code == usage->code)) | ||
| 854 | return 1; | ||
| 855 | return 0; | ||
| 856 | } | ||
| 857 | |||
| 858 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, | ||
| 859 | struct hid_usage *usage, __s32 value, int interrupt) | ||
| 860 | { | ||
| 861 | struct hid_driver *hdrv = hid->driver; | ||
| 862 | int ret; | ||
| 863 | |||
| 820 | hid_dump_input(usage, value); | 864 | hid_dump_input(usage, value); |
| 865 | |||
| 866 | if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { | ||
| 867 | ret = hdrv->event(hid, field, usage, value); | ||
| 868 | if (ret != 0) { | ||
| 869 | if (ret < 0) | ||
| 870 | dbg_hid("%s's event failed with %d\n", | ||
| 871 | hdrv->name, ret); | ||
| 872 | return; | ||
| 873 | } | ||
| 874 | } | ||
| 875 | |||
| 821 | if (hid->claimed & HID_CLAIMED_INPUT) | 876 | if (hid->claimed & HID_CLAIMED_INPUT) |
| 822 | hidinput_hid_event(hid, field, usage, value); | 877 | hidinput_hid_event(hid, field, usage, value); |
| 823 | if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) | 878 | if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) |
| @@ -946,44 +1001,47 @@ int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) | |||
| 946 | } | 1001 | } |
| 947 | EXPORT_SYMBOL_GPL(hid_set_field); | 1002 | EXPORT_SYMBOL_GPL(hid_set_field); |
| 948 | 1003 | ||
| 949 | int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) | 1004 | static struct hid_report *hid_get_report(struct hid_report_enum *report_enum, |
| 1005 | const u8 *data) | ||
| 950 | { | 1006 | { |
| 951 | struct hid_report_enum *report_enum = hid->report_enum + type; | ||
| 952 | struct hid_report *report; | 1007 | struct hid_report *report; |
| 953 | int n, rsize, i; | 1008 | unsigned int n = 0; /* Normally report number is 0 */ |
| 954 | 1009 | ||
| 955 | if (!hid) | 1010 | /* Device uses numbered reports, data[0] is report number */ |
| 956 | return -ENODEV; | 1011 | if (report_enum->numbered) |
| 1012 | n = *data; | ||
| 957 | 1013 | ||
| 958 | if (!size) { | 1014 | report = report_enum->report_id_hash[n]; |
| 959 | dbg_hid("empty report\n"); | 1015 | if (report == NULL) |
| 960 | return -1; | 1016 | dbg_hid("undefined report_id %u received\n", n); |
| 961 | } | ||
| 962 | 1017 | ||
| 963 | dbg_hid("report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un"); | 1018 | return report; |
| 1019 | } | ||
| 964 | 1020 | ||
| 965 | n = 0; /* Normally report number is 0 */ | 1021 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
| 966 | if (report_enum->numbered) { /* Device uses numbered reports, data[0] is report number */ | 1022 | int interrupt) |
| 967 | n = *data++; | 1023 | { |
| 968 | size--; | 1024 | struct hid_report_enum *report_enum = hid->report_enum + type; |
| 969 | } | 1025 | struct hid_report *report; |
| 1026 | unsigned int a; | ||
| 1027 | int rsize, csize = size; | ||
| 1028 | u8 *cdata = data; | ||
| 970 | 1029 | ||
| 971 | /* dump the report */ | 1030 | report = hid_get_report(report_enum, data); |
| 972 | dbg_hid("report %d (size %u) = ", n, size); | 1031 | if (!report) |
| 973 | for (i = 0; i < size; i++) | 1032 | return; |
| 974 | dbg_hid_line(" %02x", data[i]); | ||
| 975 | dbg_hid_line("\n"); | ||
| 976 | 1033 | ||
| 977 | if (!(report = report_enum->report_id_hash[n])) { | 1034 | if (report_enum->numbered) { |
| 978 | dbg_hid("undefined report_id %d received\n", n); | 1035 | cdata++; |
| 979 | return -1; | 1036 | csize--; |
| 980 | } | 1037 | } |
| 981 | 1038 | ||
| 982 | rsize = ((report->size - 1) >> 3) + 1; | 1039 | rsize = ((report->size - 1) >> 3) + 1; |
| 983 | 1040 | ||
| 984 | if (size < rsize) { | 1041 | if (csize < rsize) { |
| 985 | dbg_hid("report %d is too short, (%d < %d)\n", report->id, size, rsize); | 1042 | dbg_hid("report %d is too short, (%d < %d)\n", report->id, |
| 986 | memset(data + size, 0, rsize - size); | 1043 | csize, rsize); |
| 1044 | memset(cdata + csize, 0, rsize - csize); | ||
| 987 | } | 1045 | } |
| 988 | 1046 | ||
| 989 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) | 1047 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) |
| @@ -996,24 +1054,661 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
| 996 | hidraw_report_event(hid, data, size); | 1054 | hidraw_report_event(hid, data, size); |
| 997 | } | 1055 | } |
| 998 | 1056 | ||
| 999 | for (n = 0; n < report->maxfield; n++) | 1057 | for (a = 0; a < report->maxfield; a++) |
| 1000 | hid_input_field(hid, report->field[n], data, interrupt); | 1058 | hid_input_field(hid, report->field[a], cdata, interrupt); |
| 1001 | 1059 | ||
| 1002 | if (hid->claimed & HID_CLAIMED_INPUT) | 1060 | if (hid->claimed & HID_CLAIMED_INPUT) |
| 1003 | hidinput_report_event(hid, report); | 1061 | hidinput_report_event(hid, report); |
| 1062 | } | ||
| 1063 | EXPORT_SYMBOL_GPL(hid_report_raw_event); | ||
| 1064 | |||
| 1065 | /** | ||
| 1066 | * hid_input_report - report data from lower layer (usb, bt...) | ||
| 1067 | * | ||
| 1068 | * @hid: hid device | ||
| 1069 | * @type: HID report type (HID_*_REPORT) | ||
| 1070 | * @data: report contents | ||
| 1071 | * @size: size of data parameter | ||
| 1072 | * @interrupt: called from atomic? | ||
| 1073 | * | ||
| 1074 | * This is data entry for lower layers. | ||
| 1075 | */ | ||
| 1076 | int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) | ||
| 1077 | { | ||
| 1078 | struct hid_report_enum *report_enum = hid->report_enum + type; | ||
| 1079 | struct hid_driver *hdrv = hid->driver; | ||
| 1080 | struct hid_report *report; | ||
| 1081 | unsigned int i; | ||
| 1082 | int ret; | ||
| 1083 | |||
| 1084 | if (!hid || !hid->driver) | ||
| 1085 | return -ENODEV; | ||
| 1086 | |||
| 1087 | if (!size) { | ||
| 1088 | dbg_hid("empty report\n"); | ||
| 1089 | return -1; | ||
| 1090 | } | ||
| 1091 | |||
| 1092 | dbg_hid("report (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un"); | ||
| 1093 | |||
| 1094 | report = hid_get_report(report_enum, data); | ||
| 1095 | if (!report) | ||
| 1096 | return -1; | ||
| 1097 | |||
| 1098 | /* dump the report */ | ||
| 1099 | dbg_hid("report %d (size %u) = ", report->id, size); | ||
| 1100 | for (i = 0; i < size; i++) | ||
| 1101 | dbg_hid_line(" %02x", data[i]); | ||
| 1102 | dbg_hid_line("\n"); | ||
| 1103 | |||
| 1104 | if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { | ||
| 1105 | ret = hdrv->raw_event(hid, report, data, size); | ||
| 1106 | if (ret != 0) | ||
| 1107 | return ret < 0 ? ret : 0; | ||
| 1108 | } | ||
| 1109 | |||
| 1110 | hid_report_raw_event(hid, type, data, size, interrupt); | ||
| 1004 | 1111 | ||
| 1005 | return 0; | 1112 | return 0; |
| 1006 | } | 1113 | } |
| 1007 | EXPORT_SYMBOL_GPL(hid_input_report); | 1114 | EXPORT_SYMBOL_GPL(hid_input_report); |
| 1008 | 1115 | ||
| 1116 | static bool hid_match_one_id(struct hid_device *hdev, | ||
| 1117 | const struct hid_device_id *id) | ||
| 1118 | { | ||
| 1119 | return id->bus == hdev->bus && | ||
| 1120 | (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && | ||
| 1121 | (id->product == HID_ANY_ID || id->product == hdev->product); | ||
| 1122 | } | ||
| 1123 | |||
| 1124 | static const struct hid_device_id *hid_match_id(struct hid_device *hdev, | ||
| 1125 | const struct hid_device_id *id) | ||
| 1126 | { | ||
| 1127 | for (; id->bus; id++) | ||
| 1128 | if (hid_match_one_id(hdev, id)) | ||
| 1129 | return id; | ||
| 1130 | |||
| 1131 | return NULL; | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | static const struct hid_device_id hid_hiddev_list[] = { | ||
| 1135 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, | ||
| 1136 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) }, | ||
| 1137 | { } | ||
| 1138 | }; | ||
| 1139 | |||
| 1140 | static bool hid_hiddev(struct hid_device *hdev) | ||
| 1141 | { | ||
| 1142 | return !!hid_match_id(hdev, hid_hiddev_list); | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | int hid_connect(struct hid_device *hdev, unsigned int connect_mask) | ||
| 1146 | { | ||
| 1147 | static const char *types[] = { "Device", "Pointer", "Mouse", "Device", | ||
| 1148 | "Joystick", "Gamepad", "Keyboard", "Keypad", | ||
| 1149 | "Multi-Axis Controller" | ||
| 1150 | }; | ||
| 1151 | const char *type, *bus; | ||
| 1152 | char buf[64]; | ||
| 1153 | unsigned int i; | ||
| 1154 | int len; | ||
| 1155 | |||
| 1156 | if (hdev->bus != BUS_USB) | ||
| 1157 | connect_mask &= ~HID_CONNECT_HIDDEV; | ||
| 1158 | if (hid_hiddev(hdev)) | ||
| 1159 | connect_mask |= HID_CONNECT_HIDDEV_FORCE; | ||
| 1160 | |||
| 1161 | if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, | ||
| 1162 | connect_mask & HID_CONNECT_HIDINPUT_FORCE)) | ||
| 1163 | hdev->claimed |= HID_CLAIMED_INPUT; | ||
| 1164 | if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && | ||
| 1165 | !hdev->hiddev_connect(hdev, | ||
| 1166 | connect_mask & HID_CONNECT_HIDDEV_FORCE)) | ||
| 1167 | hdev->claimed |= HID_CLAIMED_HIDDEV; | ||
| 1168 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) | ||
| 1169 | hdev->claimed |= HID_CLAIMED_HIDRAW; | ||
| 1170 | |||
| 1171 | if (!hdev->claimed) { | ||
| 1172 | dev_err(&hdev->dev, "claimed by neither input, hiddev nor " | ||
| 1173 | "hidraw\n"); | ||
| 1174 | return -ENODEV; | ||
| 1175 | } | ||
| 1176 | |||
| 1177 | if ((hdev->claimed & HID_CLAIMED_INPUT) && | ||
| 1178 | (connect_mask & HID_CONNECT_FF) && hdev->ff_init) | ||
| 1179 | hdev->ff_init(hdev); | ||
| 1180 | |||
| 1181 | len = 0; | ||
| 1182 | if (hdev->claimed & HID_CLAIMED_INPUT) | ||
| 1183 | len += sprintf(buf + len, "input"); | ||
| 1184 | if (hdev->claimed & HID_CLAIMED_HIDDEV) | ||
| 1185 | len += sprintf(buf + len, "%shiddev%d", len ? "," : "", | ||
| 1186 | hdev->minor); | ||
| 1187 | if (hdev->claimed & HID_CLAIMED_HIDRAW) | ||
| 1188 | len += sprintf(buf + len, "%shidraw%d", len ? "," : "", | ||
| 1189 | ((struct hidraw *)hdev->hidraw)->minor); | ||
| 1190 | |||
| 1191 | type = "Device"; | ||
| 1192 | for (i = 0; i < hdev->maxcollection; i++) { | ||
| 1193 | struct hid_collection *col = &hdev->collection[i]; | ||
| 1194 | if (col->type == HID_COLLECTION_APPLICATION && | ||
| 1195 | (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK && | ||
| 1196 | (col->usage & 0xffff) < ARRAY_SIZE(types)) { | ||
| 1197 | type = types[col->usage & 0xffff]; | ||
| 1198 | break; | ||
| 1199 | } | ||
| 1200 | } | ||
| 1201 | |||
| 1202 | switch (hdev->bus) { | ||
| 1203 | case BUS_USB: | ||
| 1204 | bus = "USB"; | ||
| 1205 | break; | ||
| 1206 | case BUS_BLUETOOTH: | ||
| 1207 | bus = "BLUETOOTH"; | ||
| 1208 | break; | ||
| 1209 | default: | ||
| 1210 | bus = "<UNKNOWN>"; | ||
| 1211 | } | ||
| 1212 | |||
| 1213 | dev_info(&hdev->dev, "%s: %s HID v%x.%02x %s [%s] on %s\n", | ||
| 1214 | buf, bus, hdev->version >> 8, hdev->version & 0xff, | ||
| 1215 | type, hdev->name, hdev->phys); | ||
| 1216 | |||
| 1217 | return 0; | ||
| 1218 | } | ||
| 1219 | EXPORT_SYMBOL_GPL(hid_connect); | ||
| 1220 | |||
| 1221 | static const struct hid_device_id hid_blacklist[] = { | ||
| 1222 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, | ||
| 1223 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, | ||
| 1224 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, | ||
| 1225 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | ||
| 1226 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, | ||
| 1227 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, | ||
| 1228 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, | ||
| 1229 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, | ||
| 1230 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, | ||
| 1231 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, | ||
| 1232 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, | ||
| 1233 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, | ||
| 1234 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, | ||
| 1235 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, | ||
| 1236 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, | ||
| 1237 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, | ||
| 1238 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) }, | ||
| 1239 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) }, | ||
| 1240 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) }, | ||
| 1241 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, | ||
| 1242 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, | ||
| 1243 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, | ||
| 1244 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, | ||
| 1245 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, | ||
| 1246 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, | ||
| 1247 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, | ||
| 1248 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, | ||
| 1249 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, | ||
| 1250 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, | ||
| 1251 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, | ||
| 1252 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, | ||
| 1253 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | ||
| 1254 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | ||
| 1255 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, | ||
| 1256 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, | ||
| 1257 | { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) }, | ||
| 1258 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, | ||
| 1259 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | ||
| 1260 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, | ||
| 1261 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, | ||
| 1262 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, | ||
| 1263 | { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, | ||
| 1264 | { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, | ||
| 1265 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, | ||
| 1266 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, | ||
| 1267 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | ||
| 1268 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, | ||
| 1269 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, | ||
| 1270 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, | ||
| 1271 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, | ||
| 1272 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, | ||
| 1273 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, | ||
| 1274 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, | ||
| 1275 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) }, | ||
| 1276 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, | ||
| 1277 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, | ||
| 1278 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3) }, | ||
| 1279 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150) }, | ||
| 1280 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, | ||
| 1281 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, | ||
| 1282 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, | ||
| 1283 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, | ||
| 1284 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, | ||
| 1285 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, | ||
| 1286 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, | ||
| 1287 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, | ||
| 1288 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, | ||
| 1289 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, | ||
| 1290 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, | ||
| 1291 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, | ||
| 1292 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | ||
| 1293 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, | ||
| 1294 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, | ||
| 1295 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | ||
| 1296 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | ||
| 1297 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
| 1298 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | ||
| 1299 | |||
| 1300 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, | ||
| 1301 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | ||
| 1302 | { } | ||
| 1303 | }; | ||
| 1304 | |||
| 1305 | static int hid_bus_match(struct device *dev, struct device_driver *drv) | ||
| 1306 | { | ||
| 1307 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); | ||
| 1308 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | ||
| 1309 | |||
| 1310 | if (!hid_match_id(hdev, hdrv->id_table)) | ||
| 1311 | return 0; | ||
| 1312 | |||
| 1313 | /* generic wants all non-blacklisted */ | ||
| 1314 | if (!strncmp(hdrv->name, "generic-", 8)) | ||
| 1315 | return !hid_match_id(hdev, hid_blacklist); | ||
| 1316 | |||
| 1317 | return 1; | ||
| 1318 | } | ||
| 1319 | |||
| 1320 | static int hid_device_probe(struct device *dev) | ||
| 1321 | { | ||
| 1322 | struct hid_driver *hdrv = container_of(dev->driver, | ||
| 1323 | struct hid_driver, driver); | ||
| 1324 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | ||
| 1325 | const struct hid_device_id *id; | ||
| 1326 | int ret = 0; | ||
| 1327 | |||
| 1328 | if (!hdev->driver) { | ||
| 1329 | id = hid_match_id(hdev, hdrv->id_table); | ||
| 1330 | if (id == NULL) | ||
| 1331 | return -ENODEV; | ||
| 1332 | |||
| 1333 | hdev->driver = hdrv; | ||
| 1334 | if (hdrv->probe) { | ||
| 1335 | ret = hdrv->probe(hdev, id); | ||
| 1336 | } else { /* default probe */ | ||
| 1337 | ret = hid_parse(hdev); | ||
| 1338 | if (!ret) | ||
| 1339 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 1340 | } | ||
| 1341 | if (ret) | ||
| 1342 | hdev->driver = NULL; | ||
| 1343 | } | ||
| 1344 | return ret; | ||
| 1345 | } | ||
| 1346 | |||
| 1347 | static int hid_device_remove(struct device *dev) | ||
| 1348 | { | ||
| 1349 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | ||
| 1350 | struct hid_driver *hdrv = hdev->driver; | ||
| 1351 | |||
| 1352 | if (hdrv) { | ||
| 1353 | if (hdrv->remove) | ||
| 1354 | hdrv->remove(hdev); | ||
| 1355 | else /* default remove */ | ||
| 1356 | hid_hw_stop(hdev); | ||
| 1357 | hdev->driver = NULL; | ||
| 1358 | } | ||
| 1359 | |||
| 1360 | return 0; | ||
| 1361 | } | ||
| 1362 | |||
| 1363 | static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
| 1364 | { | ||
| 1365 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | ||
| 1366 | |||
| 1367 | if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", | ||
| 1368 | hdev->bus, hdev->vendor, hdev->product)) | ||
| 1369 | return -ENOMEM; | ||
| 1370 | |||
| 1371 | if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) | ||
| 1372 | return -ENOMEM; | ||
| 1373 | |||
| 1374 | if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) | ||
| 1375 | return -ENOMEM; | ||
| 1376 | |||
| 1377 | if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) | ||
| 1378 | return -ENOMEM; | ||
| 1379 | |||
| 1380 | if (add_uevent_var(env, "MODALIAS=hid:b%04Xv%08Xp%08X", | ||
| 1381 | hdev->bus, hdev->vendor, hdev->product)) | ||
| 1382 | return -ENOMEM; | ||
| 1383 | |||
| 1384 | return 0; | ||
| 1385 | } | ||
| 1386 | |||
| 1387 | static struct bus_type hid_bus_type = { | ||
| 1388 | .name = "hid", | ||
| 1389 | .match = hid_bus_match, | ||
| 1390 | .probe = hid_device_probe, | ||
| 1391 | .remove = hid_device_remove, | ||
| 1392 | .uevent = hid_uevent, | ||
| 1393 | }; | ||
| 1394 | |||
| 1395 | static const struct hid_device_id hid_ignore_list[] = { | ||
| 1396 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) }, | ||
| 1397 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) }, | ||
| 1398 | { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) }, | ||
| 1399 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) }, | ||
| 1400 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) }, | ||
| 1401 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) }, | ||
| 1402 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) }, | ||
| 1403 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) }, | ||
| 1404 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) }, | ||
| 1405 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, | ||
| 1406 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, | ||
| 1407 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, | ||
| 1408 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)}, | ||
| 1409 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, | ||
| 1410 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, | ||
| 1411 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, | ||
| 1412 | { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, | ||
| 1413 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, | ||
| 1414 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, | ||
| 1415 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, | ||
| 1416 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, | ||
| 1417 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, | ||
| 1418 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, | ||
| 1419 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, | ||
| 1420 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, | ||
| 1421 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) }, | ||
| 1422 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, | ||
| 1423 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, | ||
| 1424 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, | ||
| 1425 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT) }, | ||
| 1426 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT) }, | ||
| 1427 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT) }, | ||
| 1428 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT) }, | ||
| 1429 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT) }, | ||
| 1430 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL) }, | ||
| 1431 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) }, | ||
| 1432 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) }, | ||
| 1433 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) }, | ||
| 1434 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, | ||
| 1435 | { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) }, | ||
| 1436 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) }, | ||
| 1437 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) }, | ||
| 1438 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) }, | ||
| 1439 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) }, | ||
| 1440 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) }, | ||
| 1441 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) }, | ||
| 1442 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) }, | ||
| 1443 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) }, | ||
| 1444 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) }, | ||
| 1445 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) }, | ||
| 1446 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) }, | ||
| 1447 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) }, | ||
| 1448 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) }, | ||
| 1449 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) }, | ||
| 1450 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) }, | ||
| 1451 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) }, | ||
| 1452 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) }, | ||
| 1453 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) }, | ||
| 1454 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) }, | ||
| 1455 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) }, | ||
| 1456 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) }, | ||
| 1457 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) }, | ||
| 1458 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) }, | ||
| 1459 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) }, | ||
| 1460 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) }, | ||
| 1461 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) }, | ||
| 1462 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) }, | ||
| 1463 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) }, | ||
| 1464 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) }, | ||
| 1465 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) }, | ||
| 1466 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) }, | ||
| 1467 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) }, | ||
| 1468 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) }, | ||
| 1469 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) }, | ||
| 1470 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) }, | ||
| 1471 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) }, | ||
| 1472 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) }, | ||
| 1473 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) }, | ||
| 1474 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) }, | ||
| 1475 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) }, | ||
| 1476 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) }, | ||
| 1477 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) }, | ||
| 1478 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) }, | ||
| 1479 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) }, | ||
| 1480 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) }, | ||
| 1481 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) }, | ||
| 1482 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, | ||
| 1483 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, | ||
| 1484 | { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, | ||
| 1485 | { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, | ||
| 1486 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, | ||
| 1487 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, | ||
| 1488 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, | ||
| 1489 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, | ||
| 1490 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) }, | ||
| 1491 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) }, | ||
| 1492 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) }, | ||
| 1493 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY1) }, | ||
| 1494 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) }, | ||
| 1495 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) }, | ||
| 1496 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) }, | ||
| 1497 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) }, | ||
| 1498 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) }, | ||
| 1499 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) }, | ||
| 1500 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) }, | ||
| 1501 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, | ||
| 1502 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, | ||
| 1503 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, | ||
| 1504 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, | ||
| 1505 | { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, | ||
| 1506 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, | ||
| 1507 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, | ||
| 1508 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) }, | ||
| 1509 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) }, | ||
| 1510 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) }, | ||
| 1511 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) }, | ||
| 1512 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) }, | ||
| 1513 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) }, | ||
| 1514 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) }, | ||
| 1515 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) }, | ||
| 1516 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) }, | ||
| 1517 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, | ||
| 1518 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, | ||
| 1519 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, | ||
| 1520 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, | ||
| 1521 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, | ||
| 1522 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, | ||
| 1523 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, | ||
| 1524 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, | ||
| 1525 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, | ||
| 1526 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, | ||
| 1527 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, | ||
| 1528 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, | ||
| 1529 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, | ||
| 1530 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, | ||
| 1531 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, | ||
| 1532 | { HID_USB_DEVICE(USB_VENDOR_ID_WACOM, HID_ANY_ID) }, | ||
| 1533 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, | ||
| 1534 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, | ||
| 1535 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, | ||
| 1536 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, | ||
| 1537 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, | ||
| 1538 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, | ||
| 1539 | { } | ||
| 1540 | }; | ||
| 1541 | |||
| 1542 | static bool hid_ignore(struct hid_device *hdev) | ||
| 1543 | { | ||
| 1544 | switch (hdev->vendor) { | ||
| 1545 | case USB_VENDOR_ID_CODEMERCS: | ||
| 1546 | /* ignore all Code Mercenaries IOWarrior devices */ | ||
| 1547 | if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && | ||
| 1548 | hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) | ||
| 1549 | return true; | ||
| 1550 | break; | ||
| 1551 | case USB_VENDOR_ID_LOGITECH: | ||
| 1552 | if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && | ||
| 1553 | hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) | ||
| 1554 | return true; | ||
| 1555 | break; | ||
| 1556 | } | ||
| 1557 | |||
| 1558 | return !!hid_match_id(hdev, hid_ignore_list); | ||
| 1559 | } | ||
| 1560 | |||
| 1561 | int hid_add_device(struct hid_device *hdev) | ||
| 1562 | { | ||
| 1563 | static atomic_t id = ATOMIC_INIT(0); | ||
| 1564 | int ret; | ||
| 1565 | |||
| 1566 | if (WARN_ON(hdev->status & HID_STAT_ADDED)) | ||
| 1567 | return -EBUSY; | ||
| 1568 | |||
| 1569 | /* we need to kill them here, otherwise they will stay allocated to | ||
| 1570 | * wait for coming driver */ | ||
| 1571 | if (hid_ignore(hdev)) | ||
| 1572 | return -ENODEV; | ||
| 1573 | |||
| 1574 | /* XXX hack, any other cleaner solution < 20 bus_id bytes? */ | ||
| 1575 | sprintf(hdev->dev.bus_id, "%04X:%04X:%04X.%04X", hdev->bus, | ||
| 1576 | hdev->vendor, hdev->product, atomic_inc_return(&id)); | ||
| 1577 | |||
| 1578 | ret = device_add(&hdev->dev); | ||
| 1579 | if (!ret) | ||
| 1580 | hdev->status |= HID_STAT_ADDED; | ||
| 1581 | |||
| 1582 | return ret; | ||
| 1583 | } | ||
| 1584 | EXPORT_SYMBOL_GPL(hid_add_device); | ||
| 1585 | |||
| 1586 | /** | ||
| 1587 | * hid_allocate_device - allocate new hid device descriptor | ||
| 1588 | * | ||
| 1589 | * Allocate and initialize hid device, so that hid_destroy_device might be | ||
| 1590 | * used to free it. | ||
| 1591 | * | ||
| 1592 | * New hid_device pointer is returned on success, otherwise ERR_PTR encoded | ||
| 1593 | * error value. | ||
| 1594 | */ | ||
| 1595 | struct hid_device *hid_allocate_device(void) | ||
| 1596 | { | ||
| 1597 | struct hid_device *hdev; | ||
| 1598 | unsigned int i; | ||
| 1599 | int ret = -ENOMEM; | ||
| 1600 | |||
| 1601 | hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); | ||
| 1602 | if (hdev == NULL) | ||
| 1603 | return ERR_PTR(ret); | ||
| 1604 | |||
| 1605 | device_initialize(&hdev->dev); | ||
| 1606 | hdev->dev.release = hid_device_release; | ||
| 1607 | hdev->dev.bus = &hid_bus_type; | ||
| 1608 | |||
| 1609 | hdev->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS, | ||
| 1610 | sizeof(struct hid_collection), GFP_KERNEL); | ||
| 1611 | if (hdev->collection == NULL) | ||
| 1612 | goto err; | ||
| 1613 | hdev->collection_size = HID_DEFAULT_NUM_COLLECTIONS; | ||
| 1614 | |||
| 1615 | for (i = 0; i < HID_REPORT_TYPES; i++) | ||
| 1616 | INIT_LIST_HEAD(&hdev->report_enum[i].report_list); | ||
| 1617 | |||
| 1618 | return hdev; | ||
| 1619 | err: | ||
| 1620 | put_device(&hdev->dev); | ||
| 1621 | return ERR_PTR(ret); | ||
| 1622 | } | ||
| 1623 | EXPORT_SYMBOL_GPL(hid_allocate_device); | ||
| 1624 | |||
| 1625 | static void hid_remove_device(struct hid_device *hdev) | ||
| 1626 | { | ||
| 1627 | if (hdev->status & HID_STAT_ADDED) { | ||
| 1628 | device_del(&hdev->dev); | ||
| 1629 | hdev->status &= ~HID_STAT_ADDED; | ||
| 1630 | } | ||
| 1631 | } | ||
| 1632 | |||
| 1633 | /** | ||
| 1634 | * hid_destroy_device - free previously allocated device | ||
| 1635 | * | ||
| 1636 | * @hdev: hid device | ||
| 1637 | * | ||
| 1638 | * If you allocate hid_device through hid_allocate_device, you should ever | ||
| 1639 | * free by this function. | ||
| 1640 | */ | ||
| 1641 | void hid_destroy_device(struct hid_device *hdev) | ||
| 1642 | { | ||
| 1643 | hid_remove_device(hdev); | ||
| 1644 | put_device(&hdev->dev); | ||
| 1645 | } | ||
| 1646 | EXPORT_SYMBOL_GPL(hid_destroy_device); | ||
| 1647 | |||
| 1648 | int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, | ||
| 1649 | const char *mod_name) | ||
| 1650 | { | ||
| 1651 | hdrv->driver.name = hdrv->name; | ||
| 1652 | hdrv->driver.bus = &hid_bus_type; | ||
| 1653 | hdrv->driver.owner = owner; | ||
| 1654 | hdrv->driver.mod_name = mod_name; | ||
| 1655 | |||
| 1656 | return driver_register(&hdrv->driver); | ||
| 1657 | } | ||
| 1658 | EXPORT_SYMBOL_GPL(__hid_register_driver); | ||
| 1659 | |||
| 1660 | void hid_unregister_driver(struct hid_driver *hdrv) | ||
| 1661 | { | ||
| 1662 | driver_unregister(&hdrv->driver); | ||
| 1663 | } | ||
| 1664 | EXPORT_SYMBOL_GPL(hid_unregister_driver); | ||
| 1665 | |||
| 1666 | #ifdef CONFIG_HID_COMPAT | ||
| 1667 | static void hid_compat_load(struct work_struct *ws) | ||
| 1668 | { | ||
| 1669 | request_module("hid-dummy"); | ||
| 1670 | } | ||
| 1671 | static DECLARE_WORK(hid_compat_work, hid_compat_load); | ||
| 1672 | static struct workqueue_struct *hid_compat_wq; | ||
| 1673 | #endif | ||
| 1674 | |||
| 1009 | static int __init hid_init(void) | 1675 | static int __init hid_init(void) |
| 1010 | { | 1676 | { |
| 1011 | return hidraw_init(); | 1677 | int ret; |
| 1678 | |||
| 1679 | ret = bus_register(&hid_bus_type); | ||
| 1680 | if (ret) { | ||
| 1681 | printk(KERN_ERR "HID: can't register hid bus\n"); | ||
| 1682 | goto err; | ||
| 1683 | } | ||
| 1684 | |||
| 1685 | ret = hidraw_init(); | ||
| 1686 | if (ret) | ||
| 1687 | goto err_bus; | ||
| 1688 | |||
| 1689 | #ifdef CONFIG_HID_COMPAT | ||
| 1690 | hid_compat_wq = create_workqueue("hid_compat"); | ||
| 1691 | if (!hid_compat_wq) { | ||
| 1692 | hidraw_exit(); | ||
| 1693 | goto err; | ||
| 1694 | } | ||
| 1695 | queue_work(hid_compat_wq, &hid_compat_work); | ||
| 1696 | #endif | ||
| 1697 | |||
| 1698 | return 0; | ||
| 1699 | err_bus: | ||
| 1700 | bus_unregister(&hid_bus_type); | ||
| 1701 | err: | ||
| 1702 | return ret; | ||
| 1012 | } | 1703 | } |
| 1013 | 1704 | ||
| 1014 | static void __exit hid_exit(void) | 1705 | static void __exit hid_exit(void) |
| 1015 | { | 1706 | { |
| 1707 | #ifdef CONFIG_HID_COMPAT | ||
| 1708 | destroy_workqueue(hid_compat_wq); | ||
| 1709 | #endif | ||
| 1016 | hidraw_exit(); | 1710 | hidraw_exit(); |
| 1711 | bus_unregister(&hid_bus_type); | ||
| 1017 | } | 1712 | } |
| 1018 | 1713 | ||
| 1019 | module_init(hid_init); | 1714 | module_init(hid_init); |
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c new file mode 100644 index 000000000000..5d69d27b935d --- /dev/null +++ b/drivers/hid/hid-cypress.c | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some cypress "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/input.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | #define CP_RDESC_SWAPPED_MIN_MAX 0x01 | ||
| 27 | #define CP_2WHEEL_MOUSE_HACK 0x02 | ||
| 28 | #define CP_2WHEEL_MOUSE_HACK_ON 0x04 | ||
| 29 | |||
| 30 | /* | ||
| 31 | * Some USB barcode readers from cypress have usage min and usage max in | ||
| 32 | * the wrong order | ||
| 33 | */ | ||
| 34 | static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 35 | unsigned int rsize) | ||
| 36 | { | ||
| 37 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 38 | unsigned int i; | ||
| 39 | |||
| 40 | if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) | ||
| 41 | return; | ||
| 42 | |||
| 43 | for (i = 0; i < rsize - 4; i++) | ||
| 44 | if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) { | ||
| 45 | __u8 tmp; | ||
| 46 | |||
| 47 | rdesc[i] = 0x19; | ||
| 48 | rdesc[i + 2] = 0x29; | ||
| 49 | tmp = rdesc[i + 3]; | ||
| 50 | rdesc[i + 3] = rdesc[i + 1]; | ||
| 51 | rdesc[i + 1] = tmp; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
| 56 | struct hid_field *field, struct hid_usage *usage, | ||
| 57 | unsigned long **bit, int *max) | ||
| 58 | { | ||
| 59 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 60 | |||
| 61 | if (!(quirks & CP_2WHEEL_MOUSE_HACK)) | ||
| 62 | return 0; | ||
| 63 | |||
| 64 | if (usage->type == EV_REL && usage->code == REL_WHEEL) | ||
| 65 | set_bit(REL_HWHEEL, *bit); | ||
| 66 | if (usage->hid == 0x00090005) | ||
| 67 | return -1; | ||
| 68 | |||
| 69 | return 0; | ||
| 70 | } | ||
| 71 | |||
| 72 | static int cp_event(struct hid_device *hdev, struct hid_field *field, | ||
| 73 | struct hid_usage *usage, __s32 value) | ||
| 74 | { | ||
| 75 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 76 | |||
| 77 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || | ||
| 78 | !usage->type || !(quirks & CP_2WHEEL_MOUSE_HACK)) | ||
| 79 | return 0; | ||
| 80 | |||
| 81 | if (usage->hid == 0x00090005) { | ||
| 82 | if (value) | ||
| 83 | quirks |= CP_2WHEEL_MOUSE_HACK_ON; | ||
| 84 | else | ||
| 85 | quirks &= ~CP_2WHEEL_MOUSE_HACK_ON; | ||
| 86 | hid_set_drvdata(hdev, (void *)quirks); | ||
| 87 | return 1; | ||
| 88 | } | ||
| 89 | |||
| 90 | if (usage->code == REL_WHEEL && (quirks & CP_2WHEEL_MOUSE_HACK_ON)) { | ||
| 91 | struct input_dev *input = field->hidinput->input; | ||
| 92 | |||
| 93 | input_event(input, usage->type, REL_HWHEEL, value); | ||
| 94 | return 1; | ||
| 95 | } | ||
| 96 | |||
| 97 | return 0; | ||
| 98 | } | ||
| 99 | |||
| 100 | static int cp_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 101 | { | ||
| 102 | unsigned long quirks = id->driver_data; | ||
| 103 | int ret; | ||
| 104 | |||
| 105 | hid_set_drvdata(hdev, (void *)quirks); | ||
| 106 | |||
| 107 | ret = hid_parse(hdev); | ||
| 108 | if (ret) { | ||
| 109 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 110 | goto err_free; | ||
| 111 | } | ||
| 112 | |||
| 113 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 114 | if (ret) { | ||
| 115 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 116 | goto err_free; | ||
| 117 | } | ||
| 118 | |||
| 119 | return 0; | ||
| 120 | err_free: | ||
| 121 | return ret; | ||
| 122 | } | ||
| 123 | |||
| 124 | static const struct hid_device_id cp_devices[] = { | ||
| 125 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1), | ||
| 126 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, | ||
| 127 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2), | ||
| 128 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, | ||
| 129 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), | ||
| 130 | .driver_data = CP_2WHEEL_MOUSE_HACK }, | ||
| 131 | { } | ||
| 132 | }; | ||
| 133 | MODULE_DEVICE_TABLE(hid, cp_devices); | ||
| 134 | |||
| 135 | static struct hid_driver cp_driver = { | ||
| 136 | .name = "cypress", | ||
| 137 | .id_table = cp_devices, | ||
| 138 | .report_fixup = cp_report_fixup, | ||
| 139 | .input_mapped = cp_input_mapped, | ||
| 140 | .event = cp_event, | ||
| 141 | .probe = cp_probe, | ||
| 142 | }; | ||
| 143 | |||
| 144 | static int cp_init(void) | ||
| 145 | { | ||
| 146 | return hid_register_driver(&cp_driver); | ||
| 147 | } | ||
| 148 | |||
| 149 | static void cp_exit(void) | ||
| 150 | { | ||
| 151 | hid_unregister_driver(&cp_driver); | ||
| 152 | } | ||
| 153 | |||
| 154 | module_init(cp_init); | ||
| 155 | module_exit(cp_exit); | ||
| 156 | MODULE_LICENSE("GPL"); | ||
| 157 | |||
| 158 | HID_COMPAT_LOAD_DRIVER(cypress); | ||
diff --git a/drivers/hid/hid-dell.c b/drivers/hid/hid-dell.c new file mode 100644 index 000000000000..1a0d0dfc62fc --- /dev/null +++ b/drivers/hid/hid-dell.c | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some dell "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | |||
| 25 | static int dell_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 26 | { | ||
| 27 | int ret; | ||
| 28 | |||
| 29 | ret = hid_parse(hdev); | ||
| 30 | if (ret) { | ||
| 31 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 32 | goto err_free; | ||
| 33 | } | ||
| 34 | |||
| 35 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 36 | if (ret) { | ||
| 37 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 38 | goto err_free; | ||
| 39 | } | ||
| 40 | |||
| 41 | usbhid_set_leds(hdev); | ||
| 42 | |||
| 43 | return 0; | ||
| 44 | err_free: | ||
| 45 | return ret; | ||
| 46 | } | ||
| 47 | |||
| 48 | static const struct hid_device_id dell_devices[] = { | ||
| 49 | { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, | ||
| 50 | { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, | ||
| 51 | { } | ||
| 52 | }; | ||
| 53 | MODULE_DEVICE_TABLE(hid, dell_devices); | ||
| 54 | |||
| 55 | static struct hid_driver dell_driver = { | ||
| 56 | .name = "dell", | ||
| 57 | .id_table = dell_devices, | ||
| 58 | .probe = dell_probe, | ||
| 59 | }; | ||
| 60 | |||
| 61 | static int dell_init(void) | ||
| 62 | { | ||
| 63 | return hid_register_driver(&dell_driver); | ||
| 64 | } | ||
| 65 | |||
| 66 | static void dell_exit(void) | ||
| 67 | { | ||
| 68 | hid_unregister_driver(&dell_driver); | ||
| 69 | } | ||
| 70 | |||
| 71 | module_init(dell_init); | ||
| 72 | module_exit(dell_exit); | ||
| 73 | MODULE_LICENSE("GPL"); | ||
| 74 | |||
| 75 | HID_COMPAT_LOAD_DRIVER(dell); | ||
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c new file mode 100644 index 000000000000..e148f86fb58e --- /dev/null +++ b/drivers/hid/hid-dummy.c | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | #include <linux/autoconf.h> | ||
| 2 | #include <linux/module.h> | ||
| 3 | #include <linux/hid.h> | ||
| 4 | |||
| 5 | static int __init hid_dummy_init(void) | ||
| 6 | { | ||
| 7 | #ifdef CONFIG_HID_A4TECH_MODULE | ||
| 8 | HID_COMPAT_CALL_DRIVER(a4tech); | ||
| 9 | #endif | ||
| 10 | #ifdef CONFIG_HID_APPLE_MODULE | ||
| 11 | HID_COMPAT_CALL_DRIVER(apple); | ||
| 12 | #endif | ||
| 13 | #ifdef CONFIG_HID_BELKIN_MODULE | ||
| 14 | HID_COMPAT_CALL_DRIVER(belkin); | ||
| 15 | #endif | ||
| 16 | #ifdef CONFIG_HID_BRIGHT_MODULE | ||
| 17 | HID_COMPAT_CALL_DRIVER(bright); | ||
| 18 | #endif | ||
| 19 | #ifdef CONFIG_HID_CHERRY_MODULE | ||
| 20 | HID_COMPAT_CALL_DRIVER(cherry); | ||
| 21 | #endif | ||
| 22 | #ifdef CONFIG_HID_CHICONY_MODULE | ||
| 23 | HID_COMPAT_CALL_DRIVER(chicony); | ||
| 24 | #endif | ||
| 25 | #ifdef CONFIG_HID_CYPRESS_MODULE | ||
| 26 | HID_COMPAT_CALL_DRIVER(cypress); | ||
| 27 | #endif | ||
| 28 | #ifdef CONFIG_HID_DELL_MODULE | ||
| 29 | HID_COMPAT_CALL_DRIVER(dell); | ||
| 30 | #endif | ||
| 31 | #ifdef CONFIG_HID_EZKEY_MODULE | ||
| 32 | HID_COMPAT_CALL_DRIVER(ezkey); | ||
| 33 | #endif | ||
| 34 | #ifdef CONFIG_HID_GYRATION_MODULE | ||
| 35 | HID_COMPAT_CALL_DRIVER(gyration); | ||
| 36 | #endif | ||
| 37 | #ifdef CONFIG_HID_LOGITECH_MODULE | ||
| 38 | HID_COMPAT_CALL_DRIVER(logitech); | ||
| 39 | #endif | ||
| 40 | #ifdef CONFIG_HID_MICROSOFT_MODULE | ||
| 41 | HID_COMPAT_CALL_DRIVER(microsoft); | ||
| 42 | #endif | ||
| 43 | #ifdef CONFIG_HID_MONTEREY_MODULE | ||
| 44 | HID_COMPAT_CALL_DRIVER(monterey); | ||
| 45 | #endif | ||
| 46 | #ifdef CONFIG_HID_PANTHERLORD_MODULE | ||
| 47 | HID_COMPAT_CALL_DRIVER(pantherlord); | ||
| 48 | #endif | ||
| 49 | #ifdef CONFIG_HID_PETALYNX_MODULE | ||
| 50 | HID_COMPAT_CALL_DRIVER(petalynx); | ||
| 51 | #endif | ||
| 52 | #ifdef CONFIG_HID_SAMSUNG_MODULE | ||
| 53 | HID_COMPAT_CALL_DRIVER(samsung); | ||
| 54 | #endif | ||
| 55 | #ifdef CONFIG_HID_SONY_MODULE | ||
| 56 | HID_COMPAT_CALL_DRIVER(sony); | ||
| 57 | #endif | ||
| 58 | #ifdef CONFIG_HID_SUNPLUS_MODULE | ||
| 59 | HID_COMPAT_CALL_DRIVER(sunplus); | ||
| 60 | #endif | ||
| 61 | #ifdef CONFIG_THRUSTMASTER_FF_MODULE | ||
| 62 | HID_COMPAT_CALL_DRIVER(thrustmaster); | ||
| 63 | #endif | ||
| 64 | #ifdef CONFIG_ZEROPLUS_FF_MODULE | ||
| 65 | HID_COMPAT_CALL_DRIVER(zeroplus); | ||
| 66 | #endif | ||
| 67 | |||
| 68 | return -EIO; | ||
| 69 | } | ||
| 70 | module_init(hid_dummy_init); | ||
| 71 | |||
| 72 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hid/hid-ezkey.c b/drivers/hid/hid-ezkey.c new file mode 100644 index 000000000000..deb42f931b7e --- /dev/null +++ b/drivers/hid/hid-ezkey.c | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some ezkey "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/input.h> | ||
| 21 | #include <linux/hid.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | #define ez_map_rel(c) hid_map_usage(hi, usage, bit, max, EV_REL, (c)) | ||
| 27 | #define ez_map_key(c) hid_map_usage(hi, usage, bit, max, EV_KEY, (c)) | ||
| 28 | |||
| 29 | static int ez_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 30 | struct hid_field *field, struct hid_usage *usage, | ||
| 31 | unsigned long **bit, int *max) | ||
| 32 | { | ||
| 33 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 34 | return 0; | ||
| 35 | |||
| 36 | switch (usage->hid & HID_USAGE) { | ||
| 37 | case 0x230: ez_map_key(BTN_MOUSE); break; | ||
| 38 | case 0x231: ez_map_rel(REL_WHEEL); break; | ||
| 39 | /* | ||
| 40 | * this keyboard has a scrollwheel implemented in | ||
| 41 | * totally broken way. We map this usage temporarily | ||
| 42 | * to HWHEEL and handle it in the event quirk handler | ||
| 43 | */ | ||
| 44 | case 0x232: ez_map_rel(REL_HWHEEL); break; | ||
| 45 | default: | ||
| 46 | return 0; | ||
| 47 | } | ||
| 48 | return 1; | ||
| 49 | } | ||
| 50 | |||
| 51 | static int ez_event(struct hid_device *hdev, struct hid_field *field, | ||
| 52 | struct hid_usage *usage, __s32 value) | ||
| 53 | { | ||
| 54 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || | ||
| 55 | !usage->type) | ||
| 56 | return 0; | ||
| 57 | |||
| 58 | /* handle the temporary quirky mapping to HWHEEL */ | ||
| 59 | if (usage->type == EV_REL && usage->code == REL_HWHEEL) { | ||
| 60 | struct input_dev *input = field->hidinput->input; | ||
| 61 | input_event(input, usage->type, REL_WHEEL, -value); | ||
| 62 | return 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | return 0; | ||
| 66 | } | ||
| 67 | |||
| 68 | static const struct hid_device_id ez_devices[] = { | ||
| 69 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, | ||
| 70 | { } | ||
| 71 | }; | ||
| 72 | MODULE_DEVICE_TABLE(hid, ez_devices); | ||
| 73 | |||
| 74 | static struct hid_driver ez_driver = { | ||
| 75 | .name = "ezkey", | ||
| 76 | .id_table = ez_devices, | ||
| 77 | .input_mapping = ez_input_mapping, | ||
| 78 | .event = ez_event, | ||
| 79 | }; | ||
| 80 | |||
| 81 | static int ez_init(void) | ||
| 82 | { | ||
| 83 | return hid_register_driver(&ez_driver); | ||
| 84 | } | ||
| 85 | |||
| 86 | static void ez_exit(void) | ||
| 87 | { | ||
| 88 | hid_unregister_driver(&ez_driver); | ||
| 89 | } | ||
| 90 | |||
| 91 | module_init(ez_init); | ||
| 92 | module_exit(ez_exit); | ||
| 93 | MODULE_LICENSE("GPL"); | ||
| 94 | |||
| 95 | HID_COMPAT_LOAD_DRIVER(ezkey); | ||
diff --git a/drivers/hid/hid-gyration.c b/drivers/hid/hid-gyration.c new file mode 100644 index 000000000000..ac5120f542cc --- /dev/null +++ b/drivers/hid/hid-gyration.c | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some gyration "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/input.h> | ||
| 21 | #include <linux/hid.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | #define gy_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 27 | EV_KEY, (c)) | ||
| 28 | static int gyration_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 29 | struct hid_field *field, struct hid_usage *usage, | ||
| 30 | unsigned long **bit, int *max) | ||
| 31 | { | ||
| 32 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) | ||
| 33 | return 0; | ||
| 34 | |||
| 35 | set_bit(EV_REP, hi->input->evbit); | ||
| 36 | switch (usage->hid & HID_USAGE) { | ||
| 37 | /* Reported on Gyration MCE Remote */ | ||
| 38 | case 0x00d: gy_map_key_clear(KEY_HOME); break; | ||
| 39 | case 0x024: gy_map_key_clear(KEY_DVD); break; | ||
| 40 | case 0x025: gy_map_key_clear(KEY_PVR); break; | ||
| 41 | case 0x046: gy_map_key_clear(KEY_MEDIA); break; | ||
| 42 | case 0x047: gy_map_key_clear(KEY_MP3); break; | ||
| 43 | case 0x049: gy_map_key_clear(KEY_CAMERA); break; | ||
| 44 | case 0x04a: gy_map_key_clear(KEY_VIDEO); break; | ||
| 45 | |||
| 46 | default: | ||
| 47 | return 0; | ||
| 48 | } | ||
| 49 | return 1; | ||
| 50 | } | ||
| 51 | |||
| 52 | static int gyration_event(struct hid_device *hdev, struct hid_field *field, | ||
| 53 | struct hid_usage *usage, __s32 value) | ||
| 54 | { | ||
| 55 | struct input_dev *input = field->hidinput->input; | ||
| 56 | |||
| 57 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK && | ||
| 58 | (usage->hid & 0xff) == 0x82) { | ||
| 59 | input_event(input, usage->type, usage->code, 1); | ||
| 60 | input_sync(input); | ||
| 61 | input_event(input, usage->type, usage->code, 0); | ||
| 62 | input_sync(input); | ||
| 63 | return 1; | ||
| 64 | } | ||
| 65 | |||
| 66 | return 0; | ||
| 67 | } | ||
| 68 | |||
| 69 | static const struct hid_device_id gyration_devices[] = { | ||
| 70 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, | ||
| 71 | { } | ||
| 72 | }; | ||
| 73 | MODULE_DEVICE_TABLE(hid, gyration_devices); | ||
| 74 | |||
| 75 | static struct hid_driver gyration_driver = { | ||
| 76 | .name = "gyration", | ||
| 77 | .id_table = gyration_devices, | ||
| 78 | .input_mapping = gyration_input_mapping, | ||
| 79 | .event = gyration_event, | ||
| 80 | }; | ||
| 81 | |||
| 82 | static int gyration_init(void) | ||
| 83 | { | ||
| 84 | return hid_register_driver(&gyration_driver); | ||
| 85 | } | ||
| 86 | |||
| 87 | static void gyration_exit(void) | ||
| 88 | { | ||
| 89 | hid_unregister_driver(&gyration_driver); | ||
| 90 | } | ||
| 91 | |||
| 92 | module_init(gyration_init); | ||
| 93 | module_exit(gyration_exit); | ||
| 94 | MODULE_LICENSE("GPL"); | ||
| 95 | |||
| 96 | HID_COMPAT_LOAD_DRIVER(gyration); | ||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h new file mode 100644 index 000000000000..aad9ed1b406e --- /dev/null +++ b/drivers/hid/hid-ids.h | |||
| @@ -0,0 +1,404 @@ | |||
| 1 | /* | ||
| 2 | * USB HID quirks support for Linux | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | */ | ||
| 10 | |||
| 11 | /* | ||
| 12 | * This program is free software; you can redistribute it and/or modify it | ||
| 13 | * under the terms of the GNU General Public License as published by the Free | ||
| 14 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 15 | * any later version. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef HID_IDS_H_FILE | ||
| 19 | #define HID_IDS_H_FILE | ||
| 20 | |||
| 21 | #define USB_VENDOR_ID_A4TECH 0x09da | ||
| 22 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 | ||
| 23 | #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a | ||
| 24 | |||
| 25 | #define USB_VENDOR_ID_AASHIMA 0x06d6 | ||
| 26 | #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 | ||
| 27 | #define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026 | ||
| 28 | |||
| 29 | #define USB_VENDOR_ID_ACECAD 0x0460 | ||
| 30 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 | ||
| 31 | #define USB_DEVICE_ID_ACECAD_302 0x0008 | ||
| 32 | |||
| 33 | #define USB_VENDOR_ID_ADS_TECH 0x06e1 | ||
| 34 | #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 | ||
| 35 | |||
| 36 | #define USB_VENDOR_ID_AFATECH 0x15a4 | ||
| 37 | #define USB_DEVICE_ID_AFATECH_AF9016 0x9016 | ||
| 38 | |||
| 39 | #define USB_VENDOR_ID_AIPTEK 0x08ca | ||
| 40 | #define USB_DEVICE_ID_AIPTEK_01 0x0001 | ||
| 41 | #define USB_DEVICE_ID_AIPTEK_10 0x0010 | ||
| 42 | #define USB_DEVICE_ID_AIPTEK_20 0x0020 | ||
| 43 | #define USB_DEVICE_ID_AIPTEK_21 0x0021 | ||
| 44 | #define USB_DEVICE_ID_AIPTEK_22 0x0022 | ||
| 45 | #define USB_DEVICE_ID_AIPTEK_23 0x0023 | ||
| 46 | #define USB_DEVICE_ID_AIPTEK_24 0x0024 | ||
| 47 | |||
| 48 | #define USB_VENDOR_ID_AIRCABLE 0x16CA | ||
| 49 | #define USB_DEVICE_ID_AIRCABLE1 0x1502 | ||
| 50 | |||
| 51 | #define USB_VENDOR_ID_ALCOR 0x058f | ||
| 52 | #define USB_DEVICE_ID_ALCOR_USBRS232 0x9720 | ||
| 53 | |||
| 54 | #define USB_VENDOR_ID_ALPS 0x0433 | ||
| 55 | #define USB_DEVICE_ID_IBM_GAMEPAD 0x1101 | ||
| 56 | |||
| 57 | #define USB_VENDOR_ID_APPLE 0x05ac | ||
| 58 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 | ||
| 59 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e | ||
| 60 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f | ||
| 61 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 | ||
| 62 | #define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215 | ||
| 63 | #define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216 | ||
| 64 | #define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217 | ||
| 65 | #define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218 | ||
| 66 | #define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219 | ||
| 67 | #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a | ||
| 68 | #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b | ||
| 69 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c | ||
| 70 | #define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220 | ||
| 71 | #define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221 | ||
| 72 | #define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222 | ||
| 73 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 | ||
| 74 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 | ||
| 75 | #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 | ||
| 76 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229 | ||
| 77 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a | ||
| 78 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b | ||
| 79 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c | ||
| 80 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d | ||
| 81 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e | ||
| 82 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 | ||
| 83 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 | ||
| 84 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 | ||
| 85 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | ||
| 86 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | ||
| 87 | #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241 | ||
| 88 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 | ||
| 89 | |||
| 90 | #define USB_VENDOR_ID_ASUS 0x0b05 | ||
| 91 | #define USB_DEVICE_ID_ASUS_LCM 0x1726 | ||
| 92 | |||
| 93 | #define USB_VENDOR_ID_ATEN 0x0557 | ||
| 94 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 | ||
| 95 | #define USB_DEVICE_ID_ATEN_CS124U 0x2202 | ||
| 96 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 | ||
| 97 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 | ||
| 98 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 | ||
| 99 | |||
| 100 | #define USB_VENDOR_ID_AVERMEDIA 0x07ca | ||
| 101 | #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 | ||
| 102 | |||
| 103 | #define USB_VENDOR_ID_BELKIN 0x050d | ||
| 104 | #define USB_DEVICE_ID_FLIP_KVM 0x3201 | ||
| 105 | |||
| 106 | #define USB_VENDOR_ID_BRIGHT 0x1241 | ||
| 107 | #define USB_DEVICE_ID_BRIGHT_ABNT2 0x1503 | ||
| 108 | |||
| 109 | #define USB_VENDOR_ID_BERKSHIRE 0x0c98 | ||
| 110 | #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 | ||
| 111 | |||
| 112 | #define USB_VENDOR_ID_CHERRY 0x046a | ||
| 113 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 | ||
| 114 | |||
| 115 | #define USB_VENDOR_ID_CHIC 0x05fe | ||
| 116 | #define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014 | ||
| 117 | |||
| 118 | #define USB_VENDOR_ID_CHICONY 0x04f2 | ||
| 119 | #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 | ||
| 120 | |||
| 121 | #define USB_VENDOR_ID_CIDC 0x1677 | ||
| 122 | |||
| 123 | #define USB_VENDOR_ID_CMEDIA 0x0d8c | ||
| 124 | #define USB_DEVICE_ID_CM109 0x000e | ||
| 125 | |||
| 126 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 | ||
| 127 | #define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500 | ||
| 128 | #define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff | ||
| 129 | |||
| 130 | #define USB_VENDOR_ID_CYGNAL 0x10c4 | ||
| 131 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a | ||
| 132 | |||
| 133 | #define USB_VENDOR_ID_CYPRESS 0x04b4 | ||
| 134 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 | ||
| 135 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 | ||
| 136 | #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417 | ||
| 137 | #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 | ||
| 138 | #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 | ||
| 139 | |||
| 140 | #define USB_VENDOR_ID_DELL 0x413c | ||
| 141 | #define USB_DEVICE_ID_DELL_W7658 0x2005 | ||
| 142 | #define USB_DEVICE_ID_DELL_SK8115 0x2105 | ||
| 143 | |||
| 144 | #define USB_VENDOR_ID_DELORME 0x1163 | ||
| 145 | #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 | ||
| 146 | #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 | ||
| 147 | |||
| 148 | #define USB_VENDOR_ID_DMI 0x0c0b | ||
| 149 | #define USB_DEVICE_ID_DMI_ENC 0x5fab | ||
| 150 | |||
| 151 | #define USB_VENDOR_ID_ELO 0x04E7 | ||
| 152 | #define USB_DEVICE_ID_ELO_TS2700 0x0020 | ||
| 153 | |||
| 154 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f | ||
| 155 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 | ||
| 156 | |||
| 157 | #define USB_VENDOR_ID_EZKEY 0x0518 | ||
| 158 | #define USB_DEVICE_ID_BTC_8193 0x0002 | ||
| 159 | |||
| 160 | #define USB_VENDOR_ID_GAMERON 0x0810 | ||
| 161 | #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 | ||
| 162 | |||
| 163 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc | ||
| 164 | |||
| 165 | #define USB_VENDOR_ID_GLAB 0x06c2 | ||
| 166 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 | ||
| 167 | #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 | ||
| 168 | #define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040 | ||
| 169 | #define USB_DEVICE_ID_0_16_16_IF_KIT 0x0044 | ||
| 170 | #define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045 | ||
| 171 | #define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051 | ||
| 172 | #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 | ||
| 173 | #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 | ||
| 174 | |||
| 175 | #define USB_VENDOR_ID_GOTOP 0x08f2 | ||
| 176 | #define USB_DEVICE_ID_SUPER_Q2 0x007f | ||
| 177 | #define USB_DEVICE_ID_GOGOPEN 0x00ce | ||
| 178 | #define USB_DEVICE_ID_PENPOWER 0x00f4 | ||
| 179 | |||
| 180 | #define USB_VENDOR_ID_GREENASIA 0x0e8f | ||
| 181 | |||
| 182 | #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 | ||
| 183 | #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 | ||
| 184 | |||
| 185 | #define USB_VENDOR_ID_GRIFFIN 0x077d | ||
| 186 | #define USB_DEVICE_ID_POWERMATE 0x0410 | ||
| 187 | #define USB_DEVICE_ID_SOUNDKNOB 0x04AA | ||
| 188 | |||
| 189 | #define USB_VENDOR_ID_GTCO 0x078c | ||
| 190 | #define USB_DEVICE_ID_GTCO_90 0x0090 | ||
| 191 | #define USB_DEVICE_ID_GTCO_100 0x0100 | ||
| 192 | #define USB_DEVICE_ID_GTCO_101 0x0101 | ||
| 193 | #define USB_DEVICE_ID_GTCO_103 0x0103 | ||
| 194 | #define USB_DEVICE_ID_GTCO_104 0x0104 | ||
| 195 | #define USB_DEVICE_ID_GTCO_105 0x0105 | ||
| 196 | #define USB_DEVICE_ID_GTCO_106 0x0106 | ||
| 197 | #define USB_DEVICE_ID_GTCO_107 0x0107 | ||
| 198 | #define USB_DEVICE_ID_GTCO_108 0x0108 | ||
| 199 | #define USB_DEVICE_ID_GTCO_200 0x0200 | ||
| 200 | #define USB_DEVICE_ID_GTCO_201 0x0201 | ||
| 201 | #define USB_DEVICE_ID_GTCO_202 0x0202 | ||
| 202 | #define USB_DEVICE_ID_GTCO_203 0x0203 | ||
| 203 | #define USB_DEVICE_ID_GTCO_204 0x0204 | ||
| 204 | #define USB_DEVICE_ID_GTCO_205 0x0205 | ||
| 205 | #define USB_DEVICE_ID_GTCO_206 0x0206 | ||
| 206 | #define USB_DEVICE_ID_GTCO_207 0x0207 | ||
| 207 | #define USB_DEVICE_ID_GTCO_300 0x0300 | ||
| 208 | #define USB_DEVICE_ID_GTCO_301 0x0301 | ||
| 209 | #define USB_DEVICE_ID_GTCO_302 0x0302 | ||
| 210 | #define USB_DEVICE_ID_GTCO_303 0x0303 | ||
| 211 | #define USB_DEVICE_ID_GTCO_304 0x0304 | ||
| 212 | #define USB_DEVICE_ID_GTCO_305 0x0305 | ||
| 213 | #define USB_DEVICE_ID_GTCO_306 0x0306 | ||
| 214 | #define USB_DEVICE_ID_GTCO_307 0x0307 | ||
| 215 | #define USB_DEVICE_ID_GTCO_308 0x0308 | ||
| 216 | #define USB_DEVICE_ID_GTCO_309 0x0309 | ||
| 217 | #define USB_DEVICE_ID_GTCO_400 0x0400 | ||
| 218 | #define USB_DEVICE_ID_GTCO_401 0x0401 | ||
| 219 | #define USB_DEVICE_ID_GTCO_402 0x0402 | ||
| 220 | #define USB_DEVICE_ID_GTCO_403 0x0403 | ||
| 221 | #define USB_DEVICE_ID_GTCO_404 0x0404 | ||
| 222 | #define USB_DEVICE_ID_GTCO_405 0x0405 | ||
| 223 | #define USB_DEVICE_ID_GTCO_500 0x0500 | ||
| 224 | #define USB_DEVICE_ID_GTCO_501 0x0501 | ||
| 225 | #define USB_DEVICE_ID_GTCO_502 0x0502 | ||
| 226 | #define USB_DEVICE_ID_GTCO_503 0x0503 | ||
| 227 | #define USB_DEVICE_ID_GTCO_504 0x0504 | ||
| 228 | #define USB_DEVICE_ID_GTCO_1000 0x1000 | ||
| 229 | #define USB_DEVICE_ID_GTCO_1001 0x1001 | ||
| 230 | #define USB_DEVICE_ID_GTCO_1002 0x1002 | ||
| 231 | #define USB_DEVICE_ID_GTCO_1003 0x1003 | ||
| 232 | #define USB_DEVICE_ID_GTCO_1004 0x1004 | ||
| 233 | #define USB_DEVICE_ID_GTCO_1005 0x1005 | ||
| 234 | #define USB_DEVICE_ID_GTCO_1006 0x1006 | ||
| 235 | #define USB_DEVICE_ID_GTCO_1007 0x1007 | ||
| 236 | |||
| 237 | #define USB_VENDOR_ID_GYRATION 0x0c16 | ||
| 238 | #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 | ||
| 239 | |||
| 240 | #define USB_VENDOR_ID_HAPP 0x078b | ||
| 241 | #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 | ||
| 242 | #define USB_DEVICE_ID_UGCI_FLYING 0x0020 | ||
| 243 | #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 | ||
| 244 | |||
| 245 | #define USB_VENDOR_ID_IMATION 0x0718 | ||
| 246 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 | ||
| 247 | |||
| 248 | #define USB_VENDOR_ID_KBGEAR 0x084e | ||
| 249 | #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 | ||
| 250 | |||
| 251 | #define USB_VENDOR_ID_LABTEC 0x1020 | ||
| 252 | #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 | ||
| 253 | |||
| 254 | #define USB_VENDOR_ID_LD 0x0f11 | ||
| 255 | #define USB_DEVICE_ID_LD_CASSY 0x1000 | ||
| 256 | #define USB_DEVICE_ID_LD_POCKETCASSY 0x1010 | ||
| 257 | #define USB_DEVICE_ID_LD_MOBILECASSY 0x1020 | ||
| 258 | #define USB_DEVICE_ID_LD_JWM 0x1080 | ||
| 259 | #define USB_DEVICE_ID_LD_DMMP 0x1081 | ||
| 260 | #define USB_DEVICE_ID_LD_UMIP 0x1090 | ||
| 261 | #define USB_DEVICE_ID_LD_XRAY1 0x1100 | ||
| 262 | #define USB_DEVICE_ID_LD_XRAY2 0x1101 | ||
| 263 | #define USB_DEVICE_ID_LD_VIDEOCOM 0x1200 | ||
| 264 | #define USB_DEVICE_ID_LD_COM3LAB 0x2000 | ||
| 265 | #define USB_DEVICE_ID_LD_TELEPORT 0x2010 | ||
| 266 | #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 | ||
| 267 | #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 | ||
| 268 | #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 | ||
| 269 | |||
| 270 | #define USB_VENDOR_ID_LOGITECH 0x046d | ||
| 271 | #define USB_DEVICE_ID_LOGITECH_LX3 0xc044 | ||
| 272 | #define USB_DEVICE_ID_LOGITECH_V150 0xc047 | ||
| 273 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 | ||
| 274 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 | ||
| 275 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f | ||
| 276 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211 | ||
| 277 | #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215 | ||
| 278 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218 | ||
| 279 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 | ||
| 280 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 | ||
| 281 | #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 | ||
| 282 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 | ||
| 283 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 | ||
| 284 | #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a | ||
| 285 | #define USB_DEVICE_ID_LOGITECH_KBD 0xc311 | ||
| 286 | #define USB_DEVICE_ID_S510_RECEIVER 0xc50c | ||
| 287 | #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 | ||
| 288 | #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512 | ||
| 289 | #define USB_DEVICE_ID_MX3000_RECEIVER 0xc513 | ||
| 290 | #define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704 | ||
| 291 | #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 | ||
| 292 | #define USB_DEVICE_ID_DINOVO_MINI 0xc71f | ||
| 293 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03 | ||
| 294 | |||
| 295 | #define USB_VENDOR_ID_MCC 0x09db | ||
| 296 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | ||
| 297 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | ||
| 298 | |||
| 299 | #define USB_VENDOR_ID_MGE 0x0463 | ||
| 300 | #define USB_DEVICE_ID_MGE_UPS 0xffff | ||
| 301 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 | ||
| 302 | |||
| 303 | #define USB_VENDOR_ID_MICROCHIP 0x04d8 | ||
| 304 | #define USB_DEVICE_ID_PICKIT1 0x0032 | ||
| 305 | #define USB_DEVICE_ID_PICKIT2 0x0033 | ||
| 306 | |||
| 307 | #define USB_VENDOR_ID_MICROSOFT 0x045e | ||
| 308 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b | ||
| 309 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d | ||
| 310 | #define USB_DEVICE_ID_MS_NE4K 0x00db | ||
| 311 | #define USB_DEVICE_ID_MS_LK6K 0x00f9 | ||
| 312 | #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 | ||
| 313 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 | ||
| 314 | |||
| 315 | |||
| 316 | #define USB_VENDOR_ID_MONTEREY 0x0566 | ||
| 317 | #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 | ||
| 318 | |||
| 319 | #define USB_VENDOR_ID_NCR 0x0404 | ||
| 320 | #define USB_DEVICE_ID_NCR_FIRST 0x0300 | ||
| 321 | #define USB_DEVICE_ID_NCR_LAST 0x03ff | ||
| 322 | |||
| 323 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 | ||
| 324 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 | ||
| 325 | |||
| 326 | #define USB_VENDOR_ID_NATSU 0x08b7 | ||
| 327 | #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 | ||
| 328 | |||
| 329 | #define USB_VENDOR_ID_NEC 0x073e | ||
| 330 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 | ||
| 331 | |||
| 332 | #define USB_VENDOR_ID_ONTRAK 0x0a07 | ||
| 333 | #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 | ||
| 334 | |||
| 335 | #define USB_VENDOR_ID_PANJIT 0x134c | ||
| 336 | |||
| 337 | #define USB_VENDOR_ID_PANTHERLORD 0x0810 | ||
| 338 | #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001 | ||
| 339 | |||
| 340 | #define USB_VENDOR_ID_PETALYNX 0x18b1 | ||
| 341 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | ||
| 342 | |||
| 343 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 | ||
| 344 | #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 | ||
| 345 | |||
| 346 | #define USB_VENDOR_ID_SAITEK 0x06a3 | ||
| 347 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | ||
| 348 | |||
| 349 | #define USB_VENDOR_ID_SAMSUNG 0x0419 | ||
| 350 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | ||
| 351 | |||
| 352 | #define USB_VENDOR_ID_SONY 0x054c | ||
| 353 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 | ||
| 354 | |||
| 355 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 | ||
| 356 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038 | ||
| 357 | |||
| 358 | #define USB_VENDOR_ID_SUN 0x0430 | ||
| 359 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | ||
| 360 | |||
| 361 | #define USB_VENDOR_ID_SUNPLUS 0x04fc | ||
| 362 | #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 | ||
| 363 | |||
| 364 | #define USB_VENDOR_ID_TENX 0x1130 | ||
| 365 | #define USB_DEVICE_ID_TENX_IBUDDY1 0x0001 | ||
| 366 | #define USB_DEVICE_ID_TENX_IBUDDY2 0x0002 | ||
| 367 | |||
| 368 | #define USB_VENDOR_ID_THRUSTMASTER 0x044f | ||
| 369 | |||
| 370 | #define USB_VENDOR_ID_TOPMAX 0x0663 | ||
| 371 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 | ||
| 372 | |||
| 373 | #define USB_VENDOR_ID_TURBOX 0x062a | ||
| 374 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 | ||
| 375 | |||
| 376 | #define USB_VENDOR_ID_VERNIER 0x08f7 | ||
| 377 | #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 | ||
| 378 | #define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 | ||
| 379 | #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 | ||
| 380 | #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 | ||
| 381 | #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006 | ||
| 382 | |||
| 383 | #define USB_VENDOR_ID_WACOM 0x056a | ||
| 384 | |||
| 385 | #define USB_VENDOR_ID_WISEGROUP 0x0925 | ||
| 386 | #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 | ||
| 387 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 | ||
| 388 | #define USB_DEVICE_ID_8_8_4_IF_KIT 0x8201 | ||
| 389 | #define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800 | ||
| 390 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 | ||
| 391 | |||
| 392 | #define USB_VENDOR_ID_WISEGROUP_LTD 0x6666 | ||
| 393 | #define USB_VENDOR_ID_WISEGROUP_LTD2 0x6677 | ||
| 394 | #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802 | ||
| 395 | |||
| 396 | #define USB_VENDOR_ID_YEALINK 0x6993 | ||
| 397 | #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001 | ||
| 398 | |||
| 399 | #define USB_VENDOR_ID_ZEROPLUS 0x0c12 | ||
| 400 | |||
| 401 | #define USB_VENDOR_ID_KYE 0x0458 | ||
| 402 | #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 | ||
| 403 | |||
| 404 | #endif | ||
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c deleted file mode 100644 index 16feea014494..000000000000 --- a/drivers/hid/hid-input-quirks.c +++ /dev/null | |||
| @@ -1,484 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * HID-input usage mapping quirks | ||
| 3 | * | ||
| 4 | * This is used to handle HID-input mappings for devices violating | ||
| 5 | * HUT 1.12 specification. | ||
| 6 | * | ||
| 7 | * Copyright (c) 2007-2008 Jiri Kosina | ||
| 8 | */ | ||
| 9 | |||
| 10 | /* | ||
| 11 | * This program is free software; you can redistribute it and/or modify it | ||
| 12 | * under the terms of the GNU General Public License as published by the Free | ||
| 13 | * Software Foundation; either version 2 of the License | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/input.h> | ||
| 17 | #include <linux/hid.h> | ||
| 18 | |||
| 19 | #define map_abs(c) do { usage->code = c; usage->type = EV_ABS; *bit = input->absbit; *max = ABS_MAX; } while (0) | ||
| 20 | #define map_rel(c) do { usage->code = c; usage->type = EV_REL; *bit = input->relbit; *max = REL_MAX; } while (0) | ||
| 21 | #define map_key(c) do { usage->code = c; usage->type = EV_KEY; *bit = input->keybit; *max = KEY_MAX; } while (0) | ||
| 22 | #define map_led(c) do { usage->code = c; usage->type = EV_LED; *bit = input->ledbit; *max = LED_MAX; } while (0) | ||
| 23 | |||
| 24 | #define map_abs_clear(c) do { map_abs(c); clear_bit(c, *bit); } while (0) | ||
| 25 | #define map_key_clear(c) do { map_key(c); clear_bit(c, *bit); } while (0) | ||
| 26 | |||
| 27 | static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input, | ||
| 28 | unsigned long **bit, int *max) | ||
| 29 | { | ||
| 30 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 31 | return 0; | ||
| 32 | |||
| 33 | switch (usage->hid & HID_USAGE) { | ||
| 34 | case 0x03a: map_key_clear(KEY_SOUND); break; | ||
| 35 | case 0x03b: map_key_clear(KEY_CAMERA); break; | ||
| 36 | case 0x03c: map_key_clear(KEY_DOCUMENTS); break; | ||
| 37 | default: | ||
| 38 | return 0; | ||
| 39 | } | ||
| 40 | return 1; | ||
| 41 | } | ||
| 42 | |||
| 43 | static int quirk_cherry_cymotion(struct hid_usage *usage, struct input_dev *input, | ||
| 44 | unsigned long **bit, int *max) | ||
| 45 | { | ||
| 46 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 47 | return 0; | ||
| 48 | |||
| 49 | switch (usage->hid & HID_USAGE) { | ||
| 50 | case 0x301: map_key_clear(KEY_PROG1); break; | ||
| 51 | case 0x302: map_key_clear(KEY_PROG2); break; | ||
| 52 | case 0x303: map_key_clear(KEY_PROG3); break; | ||
| 53 | default: | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | return 1; | ||
| 57 | } | ||
| 58 | |||
| 59 | static int quirk_logitech_ultrax_remote(struct hid_usage *usage, struct input_dev *input, | ||
| 60 | unsigned long **bit, int *max) | ||
| 61 | { | ||
| 62 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) | ||
| 63 | return 0; | ||
| 64 | |||
| 65 | set_bit(EV_REP, input->evbit); | ||
| 66 | switch(usage->hid & HID_USAGE) { | ||
| 67 | /* Reported on Logitech Ultra X Media Remote */ | ||
| 68 | case 0x004: map_key_clear(KEY_AGAIN); break; | ||
| 69 | case 0x00d: map_key_clear(KEY_HOME); break; | ||
| 70 | case 0x024: map_key_clear(KEY_SHUFFLE); break; | ||
| 71 | case 0x025: map_key_clear(KEY_TV); break; | ||
| 72 | case 0x026: map_key_clear(KEY_MENU); break; | ||
| 73 | case 0x031: map_key_clear(KEY_AUDIO); break; | ||
| 74 | case 0x032: map_key_clear(KEY_TEXT); break; | ||
| 75 | case 0x033: map_key_clear(KEY_LAST); break; | ||
| 76 | case 0x047: map_key_clear(KEY_MP3); break; | ||
| 77 | case 0x048: map_key_clear(KEY_DVD); break; | ||
| 78 | case 0x049: map_key_clear(KEY_MEDIA); break; | ||
| 79 | case 0x04a: map_key_clear(KEY_VIDEO); break; | ||
| 80 | case 0x04b: map_key_clear(KEY_ANGLE); break; | ||
| 81 | case 0x04c: map_key_clear(KEY_LANGUAGE); break; | ||
| 82 | case 0x04d: map_key_clear(KEY_SUBTITLE); break; | ||
| 83 | case 0x051: map_key_clear(KEY_RED); break; | ||
| 84 | case 0x052: map_key_clear(KEY_CLOSE); break; | ||
| 85 | |||
| 86 | default: | ||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | return 1; | ||
| 90 | } | ||
| 91 | |||
| 92 | static int quirk_gyration_remote(struct hid_usage *usage, struct input_dev *input, | ||
| 93 | unsigned long **bit, int *max) | ||
| 94 | { | ||
| 95 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) | ||
| 96 | return 0; | ||
| 97 | |||
| 98 | set_bit(EV_REP, input->evbit); | ||
| 99 | switch(usage->hid & HID_USAGE) { | ||
| 100 | /* Reported on Gyration MCE Remote */ | ||
| 101 | case 0x00d: map_key_clear(KEY_HOME); break; | ||
| 102 | case 0x024: map_key_clear(KEY_DVD); break; | ||
| 103 | case 0x025: map_key_clear(KEY_PVR); break; | ||
| 104 | case 0x046: map_key_clear(KEY_MEDIA); break; | ||
| 105 | case 0x047: map_key_clear(KEY_MP3); break; | ||
| 106 | case 0x049: map_key_clear(KEY_CAMERA); break; | ||
| 107 | case 0x04a: map_key_clear(KEY_VIDEO); break; | ||
| 108 | |||
| 109 | default: | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | return 1; | ||
| 113 | } | ||
| 114 | |||
| 115 | static int quirk_chicony_tactical_pad(struct hid_usage *usage, struct input_dev *input, | ||
| 116 | unsigned long **bit, int *max) | ||
| 117 | { | ||
| 118 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) | ||
| 119 | return 0; | ||
| 120 | |||
| 121 | set_bit(EV_REP, input->evbit); | ||
| 122 | switch (usage->hid & HID_USAGE) { | ||
| 123 | case 0xff01: map_key_clear(BTN_1); break; | ||
| 124 | case 0xff02: map_key_clear(BTN_2); break; | ||
| 125 | case 0xff03: map_key_clear(BTN_3); break; | ||
| 126 | case 0xff04: map_key_clear(BTN_4); break; | ||
| 127 | case 0xff05: map_key_clear(BTN_5); break; | ||
| 128 | case 0xff06: map_key_clear(BTN_6); break; | ||
| 129 | case 0xff07: map_key_clear(BTN_7); break; | ||
| 130 | case 0xff08: map_key_clear(BTN_8); break; | ||
| 131 | case 0xff09: map_key_clear(BTN_9); break; | ||
| 132 | case 0xff0a: map_key_clear(BTN_A); break; | ||
| 133 | case 0xff0b: map_key_clear(BTN_B); break; | ||
| 134 | default: | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | return 1; | ||
| 138 | } | ||
| 139 | |||
| 140 | static int quirk_microsoft_ergonomy_kb(struct hid_usage *usage, struct input_dev *input, | ||
| 141 | unsigned long **bit, int *max) | ||
| 142 | { | ||
| 143 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) | ||
| 144 | return 0; | ||
| 145 | |||
| 146 | switch(usage->hid & HID_USAGE) { | ||
| 147 | case 0xfd06: map_key_clear(KEY_CHAT); break; | ||
| 148 | case 0xfd07: map_key_clear(KEY_PHONE); break; | ||
| 149 | case 0xff05: | ||
| 150 | set_bit(EV_REP, input->evbit); | ||
| 151 | map_key_clear(KEY_F13); | ||
| 152 | set_bit(KEY_F14, input->keybit); | ||
| 153 | set_bit(KEY_F15, input->keybit); | ||
| 154 | set_bit(KEY_F16, input->keybit); | ||
| 155 | set_bit(KEY_F17, input->keybit); | ||
| 156 | set_bit(KEY_F18, input->keybit); | ||
| 157 | default: | ||
| 158 | return 0; | ||
| 159 | } | ||
| 160 | return 1; | ||
| 161 | } | ||
| 162 | |||
| 163 | static int quirk_microsoft_presenter_8k(struct hid_usage *usage, struct input_dev *input, | ||
| 164 | unsigned long **bit, int *max) | ||
| 165 | { | ||
| 166 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) | ||
| 167 | return 0; | ||
| 168 | |||
| 169 | set_bit(EV_REP, input->evbit); | ||
| 170 | switch(usage->hid & HID_USAGE) { | ||
| 171 | case 0xfd08: map_key_clear(KEY_FORWARD); break; | ||
| 172 | case 0xfd09: map_key_clear(KEY_BACK); break; | ||
| 173 | case 0xfd0b: map_key_clear(KEY_PLAYPAUSE); break; | ||
| 174 | case 0xfd0e: map_key_clear(KEY_CLOSE); break; | ||
| 175 | case 0xfd0f: map_key_clear(KEY_PLAY); break; | ||
| 176 | default: | ||
| 177 | return 0; | ||
| 178 | } | ||
| 179 | return 1; | ||
| 180 | } | ||
| 181 | |||
| 182 | static int quirk_petalynx_remote(struct hid_usage *usage, struct input_dev *input, | ||
| 183 | unsigned long **bit, int *max) | ||
| 184 | { | ||
| 185 | if (((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) && | ||
| 186 | ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)) | ||
| 187 | return 0; | ||
| 188 | |||
| 189 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_LOGIVENDOR) | ||
| 190 | switch(usage->hid & HID_USAGE) { | ||
| 191 | case 0x05a: map_key_clear(KEY_TEXT); break; | ||
| 192 | case 0x05b: map_key_clear(KEY_RED); break; | ||
| 193 | case 0x05c: map_key_clear(KEY_GREEN); break; | ||
| 194 | case 0x05d: map_key_clear(KEY_YELLOW); break; | ||
| 195 | case 0x05e: map_key_clear(KEY_BLUE); break; | ||
| 196 | default: | ||
| 197 | return 0; | ||
| 198 | } | ||
| 199 | |||
| 200 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) | ||
| 201 | switch(usage->hid & HID_USAGE) { | ||
| 202 | case 0x0f6: map_key_clear(KEY_NEXT); break; | ||
| 203 | case 0x0fa: map_key_clear(KEY_BACK); break; | ||
| 204 | default: | ||
| 205 | return 0; | ||
| 206 | } | ||
| 207 | return 1; | ||
| 208 | } | ||
| 209 | |||
| 210 | static int quirk_logitech_wireless(struct hid_usage *usage, struct input_dev *input, | ||
| 211 | unsigned long **bit, int *max) | ||
| 212 | { | ||
| 213 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 214 | return 0; | ||
| 215 | |||
| 216 | switch (usage->hid & HID_USAGE) { | ||
| 217 | case 0x1001: map_key_clear(KEY_MESSENGER); break; | ||
| 218 | case 0x1003: map_key_clear(KEY_SOUND); break; | ||
| 219 | case 0x1004: map_key_clear(KEY_VIDEO); break; | ||
| 220 | case 0x1005: map_key_clear(KEY_AUDIO); break; | ||
| 221 | case 0x100a: map_key_clear(KEY_DOCUMENTS); break; | ||
| 222 | case 0x1011: map_key_clear(KEY_PREVIOUSSONG); break; | ||
| 223 | case 0x1012: map_key_clear(KEY_NEXTSONG); break; | ||
| 224 | case 0x1013: map_key_clear(KEY_CAMERA); break; | ||
| 225 | case 0x1014: map_key_clear(KEY_MESSENGER); break; | ||
| 226 | case 0x1015: map_key_clear(KEY_RECORD); break; | ||
| 227 | case 0x1016: map_key_clear(KEY_PLAYER); break; | ||
| 228 | case 0x1017: map_key_clear(KEY_EJECTCD); break; | ||
| 229 | case 0x1018: map_key_clear(KEY_MEDIA); break; | ||
| 230 | case 0x1019: map_key_clear(KEY_PROG1); break; | ||
| 231 | case 0x101a: map_key_clear(KEY_PROG2); break; | ||
| 232 | case 0x101b: map_key_clear(KEY_PROG3); break; | ||
| 233 | case 0x101f: map_key_clear(KEY_ZOOMIN); break; | ||
| 234 | case 0x1020: map_key_clear(KEY_ZOOMOUT); break; | ||
| 235 | case 0x1021: map_key_clear(KEY_ZOOMRESET); break; | ||
| 236 | case 0x1023: map_key_clear(KEY_CLOSE); break; | ||
| 237 | case 0x1027: map_key_clear(KEY_MENU); break; | ||
| 238 | /* this one is marked as 'Rotate' */ | ||
| 239 | case 0x1028: map_key_clear(KEY_ANGLE); break; | ||
| 240 | case 0x1029: map_key_clear(KEY_SHUFFLE); break; | ||
| 241 | case 0x102a: map_key_clear(KEY_BACK); break; | ||
| 242 | case 0x102b: map_key_clear(KEY_CYCLEWINDOWS); break; | ||
| 243 | case 0x1041: map_key_clear(KEY_BATTERY); break; | ||
| 244 | case 0x1042: map_key_clear(KEY_WORDPROCESSOR); break; | ||
| 245 | case 0x1043: map_key_clear(KEY_SPREADSHEET); break; | ||
| 246 | case 0x1044: map_key_clear(KEY_PRESENTATION); break; | ||
| 247 | case 0x1045: map_key_clear(KEY_UNDO); break; | ||
| 248 | case 0x1046: map_key_clear(KEY_REDO); break; | ||
| 249 | case 0x1047: map_key_clear(KEY_PRINT); break; | ||
| 250 | case 0x1048: map_key_clear(KEY_SAVE); break; | ||
| 251 | case 0x1049: map_key_clear(KEY_PROG1); break; | ||
| 252 | case 0x104a: map_key_clear(KEY_PROG2); break; | ||
| 253 | case 0x104b: map_key_clear(KEY_PROG3); break; | ||
| 254 | case 0x104c: map_key_clear(KEY_PROG4); break; | ||
| 255 | |||
| 256 | default: | ||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | return 1; | ||
| 260 | } | ||
| 261 | |||
| 262 | static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *input, | ||
| 263 | unsigned long **bit, int *max) | ||
| 264 | { | ||
| 265 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 266 | return 0; | ||
| 267 | |||
| 268 | switch (usage->hid & HID_USAGE) { | ||
| 269 | case 0x156: map_key_clear(KEY_WORDPROCESSOR); break; | ||
| 270 | case 0x157: map_key_clear(KEY_SPREADSHEET); break; | ||
| 271 | case 0x158: map_key_clear(KEY_PRESENTATION); break; | ||
| 272 | case 0x15c: map_key_clear(KEY_STOP); break; | ||
| 273 | |||
| 274 | default: | ||
| 275 | return 0; | ||
| 276 | } | ||
| 277 | return 1; | ||
| 278 | } | ||
| 279 | |||
| 280 | static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input, | ||
| 281 | unsigned long **bit, int *max) | ||
| 282 | { | ||
| 283 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 284 | return 0; | ||
| 285 | |||
| 286 | switch (usage->hid & HID_USAGE) { | ||
| 287 | case 0x230: map_key(BTN_MOUSE); break; | ||
| 288 | case 0x231: map_rel(REL_WHEEL); break; | ||
| 289 | /* | ||
| 290 | * this keyboard has a scrollwheel implemented in | ||
| 291 | * totally broken way. We map this usage temporarily | ||
| 292 | * to HWHEEL and handle it in the event quirk handler | ||
| 293 | */ | ||
| 294 | case 0x232: map_rel(REL_HWHEEL); break; | ||
| 295 | |||
| 296 | default: | ||
| 297 | return 0; | ||
| 298 | } | ||
| 299 | return 1; | ||
| 300 | } | ||
| 301 | |||
| 302 | static int quirk_sunplus_wdesktop(struct hid_usage *usage, struct input_dev *input, | ||
| 303 | unsigned long **bit, int *max) | ||
| 304 | { | ||
| 305 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 306 | return 0; | ||
| 307 | |||
| 308 | switch (usage->hid & HID_USAGE) { | ||
| 309 | case 0x2003: map_key_clear(KEY_ZOOMIN); break; | ||
| 310 | case 0x2103: map_key_clear(KEY_ZOOMOUT); break; | ||
| 311 | default: | ||
| 312 | return 0; | ||
| 313 | } | ||
| 314 | return 1; | ||
| 315 | } | ||
| 316 | |||
| 317 | #define VENDOR_ID_BELKIN 0x1020 | ||
| 318 | #define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006 | ||
| 319 | |||
| 320 | #define VENDOR_ID_CHERRY 0x046a | ||
| 321 | #define DEVICE_ID_CHERRY_CYMOTION 0x0023 | ||
| 322 | |||
| 323 | #define VENDOR_ID_CHICONY 0x04f2 | ||
| 324 | #define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 | ||
| 325 | |||
| 326 | #define VENDOR_ID_EZKEY 0x0518 | ||
| 327 | #define DEVICE_ID_BTC_8193 0x0002 | ||
| 328 | |||
| 329 | #define VENDOR_ID_GYRATION 0x0c16 | ||
| 330 | #define DEVICE_ID_GYRATION_REMOTE 0x0002 | ||
| 331 | |||
| 332 | #define VENDOR_ID_LOGITECH 0x046d | ||
| 333 | #define DEVICE_ID_LOGITECH_RECEIVER 0xc101 | ||
| 334 | #define DEVICE_ID_S510_RECEIVER 0xc50c | ||
| 335 | #define DEVICE_ID_S510_RECEIVER_2 0xc517 | ||
| 336 | #define DEVICE_ID_MX3000_RECEIVER 0xc513 | ||
| 337 | |||
| 338 | #define VENDOR_ID_MICROSOFT 0x045e | ||
| 339 | #define DEVICE_ID_MS4K 0x00db | ||
| 340 | #define DEVICE_ID_MS6K 0x00f9 | ||
| 341 | #define DEVICE_IS_MS_PRESENTER_8K_BT 0x0701 | ||
| 342 | #define DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 | ||
| 343 | |||
| 344 | #define VENDOR_ID_MONTEREY 0x0566 | ||
| 345 | #define DEVICE_ID_GENIUS_KB29E 0x3004 | ||
| 346 | |||
| 347 | #define VENDOR_ID_PETALYNX 0x18b1 | ||
| 348 | #define DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | ||
| 349 | |||
| 350 | #define VENDOR_ID_SUNPLUS 0x04fc | ||
| 351 | #define DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 | ||
| 352 | |||
| 353 | static const struct hid_input_blacklist { | ||
| 354 | __u16 idVendor; | ||
| 355 | __u16 idProduct; | ||
| 356 | int (*quirk)(struct hid_usage *, struct input_dev *, unsigned long **, int *); | ||
| 357 | } hid_input_blacklist[] = { | ||
| 358 | { VENDOR_ID_BELKIN, DEVICE_ID_BELKIN_WIRELESS_KEYBOARD, quirk_belkin_wkbd }, | ||
| 359 | |||
| 360 | { VENDOR_ID_CHERRY, DEVICE_ID_CHERRY_CYMOTION, quirk_cherry_cymotion }, | ||
| 361 | |||
| 362 | { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad }, | ||
| 363 | |||
| 364 | { VENDOR_ID_EZKEY, DEVICE_ID_BTC_8193, quirk_btc_8193 }, | ||
| 365 | |||
| 366 | { VENDOR_ID_GYRATION, DEVICE_ID_GYRATION_REMOTE, quirk_gyration_remote }, | ||
| 367 | |||
| 368 | { VENDOR_ID_LOGITECH, DEVICE_ID_LOGITECH_RECEIVER, quirk_logitech_ultrax_remote }, | ||
| 369 | { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER, quirk_logitech_wireless }, | ||
| 370 | { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER_2, quirk_logitech_wireless }, | ||
| 371 | { VENDOR_ID_LOGITECH, DEVICE_ID_MX3000_RECEIVER, quirk_logitech_wireless }, | ||
| 372 | |||
| 373 | { VENDOR_ID_MICROSOFT, DEVICE_ID_MS4K, quirk_microsoft_ergonomy_kb }, | ||
| 374 | { VENDOR_ID_MICROSOFT, DEVICE_ID_MS6K, quirk_microsoft_ergonomy_kb }, | ||
| 375 | { VENDOR_ID_MICROSOFT, DEVICE_IS_MS_PRESENTER_8K_BT, quirk_microsoft_presenter_8k }, | ||
| 376 | { VENDOR_ID_MICROSOFT, DEVICE_ID_MS_PRESENTER_8K_USB, quirk_microsoft_presenter_8k }, | ||
| 377 | |||
| 378 | { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e }, | ||
| 379 | |||
| 380 | { VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote }, | ||
| 381 | |||
| 382 | { VENDOR_ID_SUNPLUS, DEVICE_ID_SUNPLUS_WDESKTOP, quirk_sunplus_wdesktop }, | ||
| 383 | |||
| 384 | { 0, 0, NULL } | ||
| 385 | }; | ||
| 386 | |||
| 387 | int hidinput_mapping_quirks(struct hid_usage *usage, | ||
| 388 | struct input_dev *input, | ||
| 389 | unsigned long **bit, int *max) | ||
| 390 | { | ||
| 391 | struct hid_device *device = input_get_drvdata(input); | ||
| 392 | int i = 0; | ||
| 393 | |||
| 394 | while (hid_input_blacklist[i].quirk) { | ||
| 395 | if (hid_input_blacklist[i].idVendor == device->vendor && | ||
| 396 | hid_input_blacklist[i].idProduct == device->product) | ||
| 397 | return hid_input_blacklist[i].quirk(usage, input, bit, max); | ||
| 398 | i++; | ||
| 399 | } | ||
| 400 | return 0; | ||
| 401 | } | ||
| 402 | |||
| 403 | int hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) | ||
| 404 | { | ||
| 405 | struct input_dev *input; | ||
| 406 | |||
| 407 | input = field->hidinput->input; | ||
| 408 | |||
| 409 | if (((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005)) | ||
| 410 | || ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) { | ||
| 411 | if (value) hid->quirks |= HID_QUIRK_2WHEEL_MOUSE_HACK_ON; | ||
| 412 | else hid->quirks &= ~HID_QUIRK_2WHEEL_MOUSE_HACK_ON; | ||
| 413 | return 1; | ||
| 414 | } | ||
| 415 | |||
| 416 | if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) && | ||
| 417 | (usage->type == EV_REL) && | ||
| 418 | (usage->code == REL_WHEEL)) { | ||
| 419 | hid->delayed_value = value; | ||
| 420 | return 1; | ||
| 421 | } | ||
| 422 | |||
| 423 | if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) && | ||
| 424 | (usage->hid == 0x000100b8)) { | ||
| 425 | input_event(input, EV_REL, value ? REL_HWHEEL : REL_WHEEL, hid->delayed_value); | ||
| 426 | return 1; | ||
| 427 | } | ||
| 428 | |||
| 429 | if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) { | ||
| 430 | input_event(input, usage->type, usage->code, -value); | ||
| 431 | return 1; | ||
| 432 | } | ||
| 433 | |||
| 434 | if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON) && (usage->code == REL_WHEEL)) { | ||
| 435 | input_event(input, usage->type, REL_HWHEEL, value); | ||
| 436 | return 1; | ||
| 437 | } | ||
| 438 | |||
| 439 | if ((hid->quirks & HID_QUIRK_APPLE_HAS_FN) && hidinput_apple_event(hid, input, usage, value)) | ||
| 440 | return 1; | ||
| 441 | |||
| 442 | /* Handling MS keyboards special buttons */ | ||
| 443 | if (hid->quirks & HID_QUIRK_MICROSOFT_KEYS && | ||
| 444 | usage->hid == (HID_UP_MSVENDOR | 0xff05)) { | ||
| 445 | int key = 0; | ||
| 446 | static int last_key = 0; | ||
| 447 | switch (value) { | ||
| 448 | case 0x01: key = KEY_F14; break; | ||
| 449 | case 0x02: key = KEY_F15; break; | ||
| 450 | case 0x04: key = KEY_F16; break; | ||
| 451 | case 0x08: key = KEY_F17; break; | ||
| 452 | case 0x10: key = KEY_F18; break; | ||
| 453 | default: break; | ||
| 454 | } | ||
| 455 | if (key) { | ||
| 456 | input_event(input, usage->type, key, 1); | ||
| 457 | last_key = key; | ||
| 458 | } else { | ||
| 459 | input_event(input, usage->type, last_key, 0); | ||
| 460 | } | ||
| 461 | } | ||
| 462 | |||
| 463 | /* handle the temporary quirky mapping to HWHEEL */ | ||
| 464 | if (hid->quirks & HID_QUIRK_HWHEEL_WHEEL_INVERT && | ||
| 465 | usage->type == EV_REL && usage->code == REL_HWHEEL) { | ||
| 466 | input_event(input, usage->type, REL_WHEEL, -value); | ||
| 467 | return 1; | ||
| 468 | } | ||
| 469 | |||
| 470 | /* Gyration MCE remote "Sleep" key */ | ||
| 471 | if (hid->vendor == VENDOR_ID_GYRATION && | ||
| 472 | hid->product == DEVICE_ID_GYRATION_REMOTE && | ||
| 473 | (usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK && | ||
| 474 | (usage->hid & 0xff) == 0x82) { | ||
| 475 | input_event(input, usage->type, usage->code, 1); | ||
| 476 | input_sync(input); | ||
| 477 | input_event(input, usage->type, usage->code, 0); | ||
| 478 | input_sync(input); | ||
| 479 | return 1; | ||
| 480 | } | ||
| 481 | return 0; | ||
| 482 | } | ||
| 483 | |||
| 484 | |||
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 1b2e8dc3398d..7f183b7147e1 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
| @@ -32,11 +32,6 @@ | |||
| 32 | #include <linux/hid.h> | 32 | #include <linux/hid.h> |
| 33 | #include <linux/hid-debug.h> | 33 | #include <linux/hid-debug.h> |
| 34 | 34 | ||
| 35 | static int hid_apple_fnmode = 1; | ||
| 36 | module_param_named(pb_fnmode, hid_apple_fnmode, int, 0644); | ||
| 37 | MODULE_PARM_DESC(pb_fnmode, | ||
| 38 | "Mode of fn key on Apple keyboards (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)"); | ||
| 39 | |||
| 40 | #define unk KEY_UNKNOWN | 35 | #define unk KEY_UNKNOWN |
| 41 | 36 | ||
| 42 | static const unsigned char hid_keyboard[256] = { | 37 | static const unsigned char hid_keyboard[256] = { |
| @@ -58,227 +53,20 @@ static const unsigned char hid_keyboard[256] = { | |||
| 58 | 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk | 53 | 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk |
| 59 | }; | 54 | }; |
| 60 | 55 | ||
| 61 | /* extended mapping for certain Logitech hardware (Logitech cordless desktop LX500) */ | ||
| 62 | #define LOGITECH_EXPANDED_KEYMAP_SIZE 80 | ||
| 63 | static int logitech_expanded_keymap[LOGITECH_EXPANDED_KEYMAP_SIZE] = { | ||
| 64 | 0,216, 0,213,175,156, 0, 0, 0, 0, | ||
| 65 | 144, 0, 0, 0, 0, 0, 0, 0, 0,212, | ||
| 66 | 174,167,152,161,112, 0, 0, 0,154, 0, | ||
| 67 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 68 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 69 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 70 | 0, 0, 0, 0, 0,183,184,185,186,187, | ||
| 71 | 188,189,190,191,192,193,194, 0, 0, 0 | ||
| 72 | }; | ||
| 73 | |||
| 74 | static const struct { | 56 | static const struct { |
| 75 | __s32 x; | 57 | __s32 x; |
| 76 | __s32 y; | 58 | __s32 y; |
| 77 | } hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; | 59 | } hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; |
| 78 | 60 | ||
| 79 | #define map_abs(c) do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0) | 61 | #define map_abs(c) hid_map_usage(hidinput, usage, &bit, &max, EV_ABS, (c)) |
| 80 | #define map_rel(c) do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0) | 62 | #define map_rel(c) hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c)) |
| 81 | #define map_key(c) do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0) | 63 | #define map_key(c) hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c)) |
| 82 | #define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; max = LED_MAX; } while (0) | 64 | #define map_led(c) hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c)) |
| 83 | |||
| 84 | #define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0) | ||
| 85 | #define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0) | ||
| 86 | |||
| 87 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | ||
| 88 | |||
| 89 | struct hidinput_key_translation { | ||
| 90 | u16 from; | ||
| 91 | u16 to; | ||
| 92 | u8 flags; | ||
| 93 | }; | ||
| 94 | |||
| 95 | #define APPLE_FLAG_FKEY 0x01 | ||
| 96 | |||
| 97 | static struct hidinput_key_translation apple_fn_keys[] = { | ||
| 98 | { KEY_BACKSPACE, KEY_DELETE }, | ||
| 99 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, | ||
| 100 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, | ||
| 101 | { KEY_F3, KEY_FN_F5, APPLE_FLAG_FKEY }, /* Exposé */ | ||
| 102 | { KEY_F4, KEY_FN_F4, APPLE_FLAG_FKEY }, /* Dashboard */ | ||
| 103 | { KEY_F5, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, | ||
| 104 | { KEY_F6, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, | ||
| 105 | { KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, | ||
| 106 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, | ||
| 107 | { KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY }, | ||
| 108 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, | ||
| 109 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, | ||
| 110 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, | ||
| 111 | { KEY_UP, KEY_PAGEUP }, | ||
| 112 | { KEY_DOWN, KEY_PAGEDOWN }, | ||
| 113 | { KEY_LEFT, KEY_HOME }, | ||
| 114 | { KEY_RIGHT, KEY_END }, | ||
| 115 | { } | ||
| 116 | }; | ||
| 117 | |||
| 118 | static struct hidinput_key_translation powerbook_fn_keys[] = { | ||
| 119 | { KEY_BACKSPACE, KEY_DELETE }, | ||
| 120 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, | ||
| 121 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, | ||
| 122 | { KEY_F3, KEY_MUTE, APPLE_FLAG_FKEY }, | ||
| 123 | { KEY_F4, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, | ||
| 124 | { KEY_F5, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, | ||
| 125 | { KEY_F6, KEY_NUMLOCK, APPLE_FLAG_FKEY }, | ||
| 126 | { KEY_F7, KEY_SWITCHVIDEOMODE, APPLE_FLAG_FKEY }, | ||
| 127 | { KEY_F8, KEY_KBDILLUMTOGGLE, APPLE_FLAG_FKEY }, | ||
| 128 | { KEY_F9, KEY_KBDILLUMDOWN, APPLE_FLAG_FKEY }, | ||
| 129 | { KEY_F10, KEY_KBDILLUMUP, APPLE_FLAG_FKEY }, | ||
| 130 | { KEY_UP, KEY_PAGEUP }, | ||
| 131 | { KEY_DOWN, KEY_PAGEDOWN }, | ||
| 132 | { KEY_LEFT, KEY_HOME }, | ||
| 133 | { KEY_RIGHT, KEY_END }, | ||
| 134 | { } | ||
| 135 | }; | ||
| 136 | |||
| 137 | static struct hidinput_key_translation powerbook_numlock_keys[] = { | ||
| 138 | { KEY_J, KEY_KP1 }, | ||
| 139 | { KEY_K, KEY_KP2 }, | ||
| 140 | { KEY_L, KEY_KP3 }, | ||
| 141 | { KEY_U, KEY_KP4 }, | ||
| 142 | { KEY_I, KEY_KP5 }, | ||
| 143 | { KEY_O, KEY_KP6 }, | ||
| 144 | { KEY_7, KEY_KP7 }, | ||
| 145 | { KEY_8, KEY_KP8 }, | ||
| 146 | { KEY_9, KEY_KP9 }, | ||
| 147 | { KEY_M, KEY_KP0 }, | ||
| 148 | { KEY_DOT, KEY_KPDOT }, | ||
| 149 | { KEY_SLASH, KEY_KPPLUS }, | ||
| 150 | { KEY_SEMICOLON, KEY_KPMINUS }, | ||
| 151 | { KEY_P, KEY_KPASTERISK }, | ||
| 152 | { KEY_MINUS, KEY_KPEQUAL }, | ||
| 153 | { KEY_0, KEY_KPSLASH }, | ||
| 154 | { KEY_F6, KEY_NUMLOCK }, | ||
| 155 | { KEY_KPENTER, KEY_KPENTER }, | ||
| 156 | { KEY_BACKSPACE, KEY_BACKSPACE }, | ||
| 157 | { } | ||
| 158 | }; | ||
| 159 | |||
| 160 | static struct hidinput_key_translation apple_iso_keyboard[] = { | ||
| 161 | { KEY_GRAVE, KEY_102ND }, | ||
| 162 | { KEY_102ND, KEY_GRAVE }, | ||
| 163 | { } | ||
| 164 | }; | ||
| 165 | 65 | ||
| 166 | static struct hidinput_key_translation *find_translation(struct hidinput_key_translation *table, u16 from) | 66 | #define map_abs_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ |
| 167 | { | 67 | &max, EV_ABS, (c)) |
| 168 | struct hidinput_key_translation *trans; | 68 | #define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ |
| 169 | 69 | &max, EV_KEY, (c)) | |
| 170 | /* Look for the translation */ | ||
| 171 | for (trans = table; trans->from; trans++) | ||
| 172 | if (trans->from == from) | ||
| 173 | return trans; | ||
| 174 | |||
| 175 | return NULL; | ||
| 176 | } | ||
| 177 | |||
| 178 | int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | ||
| 179 | struct hid_usage *usage, __s32 value) | ||
| 180 | { | ||
| 181 | struct hidinput_key_translation *trans; | ||
| 182 | |||
| 183 | if (usage->code == KEY_FN) { | ||
| 184 | if (value) hid->quirks |= HID_QUIRK_APPLE_FN_ON; | ||
| 185 | else hid->quirks &= ~HID_QUIRK_APPLE_FN_ON; | ||
| 186 | |||
| 187 | input_event(input, usage->type, usage->code, value); | ||
| 188 | |||
| 189 | return 1; | ||
| 190 | } | ||
| 191 | |||
| 192 | if (hid_apple_fnmode) { | ||
| 193 | int do_translate; | ||
| 194 | |||
| 195 | trans = find_translation((hid->product < 0x220 || | ||
| 196 | hid->product >= 0x300) ? | ||
| 197 | powerbook_fn_keys : apple_fn_keys, | ||
| 198 | usage->code); | ||
| 199 | if (trans) { | ||
| 200 | if (test_bit(usage->code, hid->apple_pressed_fn)) | ||
| 201 | do_translate = 1; | ||
| 202 | else if (trans->flags & APPLE_FLAG_FKEY) | ||
| 203 | do_translate = | ||
| 204 | (hid_apple_fnmode == 2 && (hid->quirks & HID_QUIRK_APPLE_FN_ON)) || | ||
| 205 | (hid_apple_fnmode == 1 && !(hid->quirks & HID_QUIRK_APPLE_FN_ON)); | ||
| 206 | else | ||
| 207 | do_translate = (hid->quirks & HID_QUIRK_APPLE_FN_ON); | ||
| 208 | |||
| 209 | if (do_translate) { | ||
| 210 | if (value) | ||
| 211 | set_bit(usage->code, hid->apple_pressed_fn); | ||
| 212 | else | ||
| 213 | clear_bit(usage->code, hid->apple_pressed_fn); | ||
| 214 | |||
| 215 | input_event(input, usage->type, trans->to, value); | ||
| 216 | |||
| 217 | return 1; | ||
| 218 | } | ||
| 219 | } | ||
| 220 | |||
| 221 | if (hid->quirks & HID_QUIRK_APPLE_NUMLOCK_EMULATION && ( | ||
| 222 | test_bit(usage->code, hid->pb_pressed_numlock) || | ||
| 223 | test_bit(LED_NUML, input->led))) { | ||
| 224 | trans = find_translation(powerbook_numlock_keys, usage->code); | ||
| 225 | |||
| 226 | if (trans) { | ||
| 227 | if (value) | ||
| 228 | set_bit(usage->code, hid->pb_pressed_numlock); | ||
| 229 | else | ||
| 230 | clear_bit(usage->code, hid->pb_pressed_numlock); | ||
| 231 | |||
| 232 | input_event(input, usage->type, trans->to, value); | ||
| 233 | } | ||
| 234 | |||
| 235 | return 1; | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | if (hid->quirks & HID_QUIRK_APPLE_ISO_KEYBOARD) { | ||
| 240 | trans = find_translation(apple_iso_keyboard, usage->code); | ||
| 241 | if (trans) { | ||
| 242 | input_event(input, usage->type, trans->to, value); | ||
| 243 | return 1; | ||
| 244 | } | ||
| 245 | } | ||
| 246 | |||
| 247 | return 0; | ||
| 248 | } | ||
| 249 | |||
| 250 | static void hidinput_apple_setup(struct input_dev *input) | ||
| 251 | { | ||
| 252 | struct hidinput_key_translation *trans; | ||
| 253 | |||
| 254 | set_bit(KEY_NUMLOCK, input->keybit); | ||
| 255 | |||
| 256 | /* Enable all needed keys */ | ||
| 257 | for (trans = apple_fn_keys; trans->from; trans++) | ||
| 258 | set_bit(trans->to, input->keybit); | ||
| 259 | |||
| 260 | for (trans = powerbook_fn_keys; trans->from; trans++) | ||
| 261 | set_bit(trans->to, input->keybit); | ||
| 262 | |||
| 263 | for (trans = powerbook_numlock_keys; trans->from; trans++) | ||
| 264 | set_bit(trans->to, input->keybit); | ||
| 265 | |||
| 266 | for (trans = apple_iso_keyboard; trans->from; trans++) | ||
| 267 | set_bit(trans->to, input->keybit); | ||
| 268 | |||
| 269 | } | ||
| 270 | #else | ||
| 271 | inline int hidinput_apple_event(struct hid_device *hid, | ||
| 272 | struct input_dev *input, | ||
| 273 | struct hid_usage *usage, __s32 value) | ||
| 274 | { | ||
| 275 | return 0; | ||
| 276 | } | ||
| 277 | |||
| 278 | static inline void hidinput_apple_setup(struct input_dev *input) | ||
| 279 | { | ||
| 280 | } | ||
| 281 | #endif | ||
| 282 | 70 | ||
| 283 | static inline int match_scancode(int code, int scancode) | 71 | static inline int match_scancode(int code, int scancode) |
| 284 | { | 72 | { |
| @@ -366,7 +154,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 366 | { | 154 | { |
| 367 | struct input_dev *input = hidinput->input; | 155 | struct input_dev *input = hidinput->input; |
| 368 | struct hid_device *device = input_get_drvdata(input); | 156 | struct hid_device *device = input_get_drvdata(input); |
| 369 | int max = 0, code, ret; | 157 | int max = 0, code; |
| 370 | unsigned long *bit = NULL; | 158 | unsigned long *bit = NULL; |
| 371 | 159 | ||
| 372 | field->hidinput = hidinput; | 160 | field->hidinput = hidinput; |
| @@ -385,406 +173,345 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 385 | goto ignore; | 173 | goto ignore; |
| 386 | } | 174 | } |
| 387 | 175 | ||
| 388 | /* handle input mappings for quirky devices */ | 176 | if (device->driver->input_mapping) { |
| 389 | ret = hidinput_mapping_quirks(usage, input, &bit, &max); | 177 | int ret = device->driver->input_mapping(device, hidinput, field, |
| 390 | if (ret) | 178 | usage, &bit, &max); |
| 391 | goto mapped; | 179 | if (ret > 0) |
| 180 | goto mapped; | ||
| 181 | if (ret < 0) | ||
| 182 | goto ignore; | ||
| 183 | } | ||
| 392 | 184 | ||
| 393 | switch (usage->hid & HID_USAGE_PAGE) { | 185 | switch (usage->hid & HID_USAGE_PAGE) { |
| 186 | case HID_UP_UNDEFINED: | ||
| 187 | goto ignore; | ||
| 394 | 188 | ||
| 395 | case HID_UP_UNDEFINED: | 189 | case HID_UP_KEYBOARD: |
| 396 | goto ignore; | 190 | set_bit(EV_REP, input->evbit); |
| 397 | |||
| 398 | case HID_UP_KEYBOARD: | ||
| 399 | 191 | ||
| 400 | set_bit(EV_REP, input->evbit); | 192 | if ((usage->hid & HID_USAGE) < 256) { |
| 193 | if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; | ||
| 194 | map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); | ||
| 195 | } else | ||
| 196 | map_key(KEY_UNKNOWN); | ||
| 401 | 197 | ||
| 402 | if ((usage->hid & HID_USAGE) < 256) { | 198 | break; |
| 403 | if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; | ||
| 404 | map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); | ||
| 405 | } else | ||
| 406 | map_key(KEY_UNKNOWN); | ||
| 407 | 199 | ||
| 408 | break; | 200 | case HID_UP_BUTTON: |
| 201 | code = ((usage->hid - 1) & 0xf); | ||
| 409 | 202 | ||
| 410 | case HID_UP_BUTTON: | 203 | switch (field->application) { |
| 411 | 204 | case HID_GD_MOUSE: | |
| 412 | code = ((usage->hid - 1) & 0xf); | 205 | case HID_GD_POINTER: code += 0x110; break; |
| 413 | 206 | case HID_GD_JOYSTICK: code += 0x120; break; | |
| 414 | switch (field->application) { | 207 | case HID_GD_GAMEPAD: code += 0x130; break; |
| 415 | case HID_GD_MOUSE: | 208 | default: |
| 416 | case HID_GD_POINTER: code += 0x110; break; | 209 | switch (field->physical) { |
| 417 | case HID_GD_JOYSTICK: code += 0x120; break; | 210 | case HID_GD_MOUSE: |
| 418 | case HID_GD_GAMEPAD: code += 0x130; break; | 211 | case HID_GD_POINTER: code += 0x110; break; |
| 419 | default: | 212 | case HID_GD_JOYSTICK: code += 0x120; break; |
| 420 | switch (field->physical) { | 213 | case HID_GD_GAMEPAD: code += 0x130; break; |
| 421 | case HID_GD_MOUSE: | 214 | default: code += 0x100; |
| 422 | case HID_GD_POINTER: code += 0x110; break; | ||
| 423 | case HID_GD_JOYSTICK: code += 0x120; break; | ||
| 424 | case HID_GD_GAMEPAD: code += 0x130; break; | ||
| 425 | default: code += 0x100; | ||
| 426 | } | ||
| 427 | } | ||
| 428 | |||
| 429 | /* Special handling for Logitech Cordless Desktop */ | ||
| 430 | if (field->application != HID_GD_MOUSE) { | ||
| 431 | if (device->quirks & HID_QUIRK_LOGITECH_EXPANDED_KEYMAP) { | ||
| 432 | int hid = usage->hid & HID_USAGE; | ||
| 433 | if (hid < LOGITECH_EXPANDED_KEYMAP_SIZE && logitech_expanded_keymap[hid] != 0) | ||
| 434 | code = logitech_expanded_keymap[hid]; | ||
| 435 | } | ||
| 436 | } else { | ||
| 437 | if (device->quirks & HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL) { | ||
| 438 | int hid = usage->hid & HID_USAGE; | ||
| 439 | if (hid == 7 || hid == 8) | ||
| 440 | goto ignore; | ||
| 441 | } | ||
| 442 | } | 215 | } |
| 216 | } | ||
| 443 | 217 | ||
| 444 | map_key(code); | 218 | map_key(code); |
| 445 | break; | 219 | break; |
| 446 | 220 | ||
| 447 | 221 | case HID_UP_SIMULATION: | |
| 448 | case HID_UP_SIMULATION: | 222 | switch (usage->hid & 0xffff) { |
| 449 | 223 | case 0xba: map_abs(ABS_RUDDER); break; | |
| 450 | switch (usage->hid & 0xffff) { | 224 | case 0xbb: map_abs(ABS_THROTTLE); break; |
| 451 | case 0xba: map_abs(ABS_RUDDER); break; | 225 | case 0xc4: map_abs(ABS_GAS); break; |
| 452 | case 0xbb: map_abs(ABS_THROTTLE); break; | 226 | case 0xc5: map_abs(ABS_BRAKE); break; |
| 453 | case 0xc4: map_abs(ABS_GAS); break; | 227 | case 0xc8: map_abs(ABS_WHEEL); break; |
| 454 | case 0xc5: map_abs(ABS_BRAKE); break; | 228 | default: goto ignore; |
| 455 | case 0xc8: map_abs(ABS_WHEEL); break; | 229 | } |
| 456 | default: goto ignore; | 230 | break; |
| 231 | |||
| 232 | case HID_UP_GENDESK: | ||
| 233 | if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ | ||
| 234 | switch (usage->hid & 0xf) { | ||
| 235 | case 0x1: map_key_clear(KEY_POWER); break; | ||
| 236 | case 0x2: map_key_clear(KEY_SLEEP); break; | ||
| 237 | case 0x3: map_key_clear(KEY_WAKEUP); break; | ||
| 238 | default: goto unknown; | ||
| 457 | } | 239 | } |
| 458 | break; | 240 | break; |
| 241 | } | ||
| 459 | 242 | ||
| 460 | case HID_UP_GENDESK: | 243 | if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ |
| 461 | |||
| 462 | if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ | ||
| 463 | switch (usage->hid & 0xf) { | ||
| 464 | case 0x1: map_key_clear(KEY_POWER); break; | ||
| 465 | case 0x2: map_key_clear(KEY_SLEEP); break; | ||
| 466 | case 0x3: map_key_clear(KEY_WAKEUP); break; | ||
| 467 | default: goto unknown; | ||
| 468 | } | ||
| 469 | break; | ||
| 470 | } | ||
| 471 | |||
| 472 | if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ | ||
| 473 | switch (usage->hid) { | ||
| 474 | case HID_GD_UP: usage->hat_dir = 1; break; | ||
| 475 | case HID_GD_DOWN: usage->hat_dir = 5; break; | ||
| 476 | case HID_GD_RIGHT: usage->hat_dir = 3; break; | ||
| 477 | case HID_GD_LEFT: usage->hat_dir = 7; break; | ||
| 478 | default: goto unknown; | ||
| 479 | } | ||
| 480 | if (field->dpad) { | ||
| 481 | map_abs(field->dpad); | ||
| 482 | goto ignore; | ||
| 483 | } | ||
| 484 | map_abs(ABS_HAT0X); | ||
| 485 | break; | ||
| 486 | } | ||
| 487 | |||
| 488 | switch (usage->hid) { | 244 | switch (usage->hid) { |
| 489 | 245 | case HID_GD_UP: usage->hat_dir = 1; break; | |
| 490 | /* These usage IDs map directly to the usage codes. */ | 246 | case HID_GD_DOWN: usage->hat_dir = 5; break; |
| 491 | case HID_GD_X: case HID_GD_Y: case HID_GD_Z: | 247 | case HID_GD_RIGHT: usage->hat_dir = 3; break; |
| 492 | case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: | 248 | case HID_GD_LEFT: usage->hat_dir = 7; break; |
| 493 | case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: | 249 | default: goto unknown; |
| 494 | if (field->flags & HID_MAIN_ITEM_RELATIVE) | ||
| 495 | map_rel(usage->hid & 0xf); | ||
| 496 | else | ||
| 497 | map_abs(usage->hid & 0xf); | ||
| 498 | break; | ||
| 499 | |||
| 500 | case HID_GD_HATSWITCH: | ||
| 501 | usage->hat_min = field->logical_minimum; | ||
| 502 | usage->hat_max = field->logical_maximum; | ||
| 503 | map_abs(ABS_HAT0X); | ||
| 504 | break; | ||
| 505 | |||
| 506 | case HID_GD_START: map_key_clear(BTN_START); break; | ||
| 507 | case HID_GD_SELECT: map_key_clear(BTN_SELECT); break; | ||
| 508 | |||
| 509 | default: goto unknown; | ||
| 510 | } | 250 | } |
| 511 | 251 | if (field->dpad) { | |
| 512 | break; | 252 | map_abs(field->dpad); |
| 513 | 253 | goto ignore; | |
| 514 | case HID_UP_LED: | ||
| 515 | |||
| 516 | switch (usage->hid & 0xffff) { /* HID-Value: */ | ||
| 517 | case 0x01: map_led (LED_NUML); break; /* "Num Lock" */ | ||
| 518 | case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */ | ||
| 519 | case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */ | ||
| 520 | case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */ | ||
| 521 | case 0x05: map_led (LED_KANA); break; /* "Kana" */ | ||
| 522 | case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */ | ||
| 523 | case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */ | ||
| 524 | case 0x09: map_led (LED_MUTE); break; /* "Mute" */ | ||
| 525 | case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */ | ||
| 526 | case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */ | ||
| 527 | case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */ | ||
| 528 | |||
| 529 | default: goto ignore; | ||
| 530 | } | 254 | } |
| 255 | map_abs(ABS_HAT0X); | ||
| 531 | break; | 256 | break; |
| 257 | } | ||
| 532 | 258 | ||
| 533 | case HID_UP_DIGITIZER: | 259 | switch (usage->hid) { |
| 534 | 260 | /* These usage IDs map directly to the usage codes. */ | |
| 535 | switch (usage->hid & 0xff) { | 261 | case HID_GD_X: case HID_GD_Y: case HID_GD_Z: |
| 536 | 262 | case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: | |
| 537 | case 0x30: /* TipPressure */ | 263 | case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: |
| 538 | if (!test_bit(BTN_TOUCH, input->keybit)) { | 264 | if (field->flags & HID_MAIN_ITEM_RELATIVE) |
| 539 | device->quirks |= HID_QUIRK_NOTOUCH; | 265 | map_rel(usage->hid & 0xf); |
| 540 | set_bit(EV_KEY, input->evbit); | 266 | else |
| 541 | set_bit(BTN_TOUCH, input->keybit); | 267 | map_abs(usage->hid & 0xf); |
| 542 | } | 268 | break; |
| 543 | |||
| 544 | map_abs_clear(ABS_PRESSURE); | ||
| 545 | break; | ||
| 546 | |||
| 547 | case 0x32: /* InRange */ | ||
| 548 | switch (field->physical & 0xff) { | ||
| 549 | case 0x21: map_key(BTN_TOOL_MOUSE); break; | ||
| 550 | case 0x22: map_key(BTN_TOOL_FINGER); break; | ||
| 551 | default: map_key(BTN_TOOL_PEN); break; | ||
| 552 | } | ||
| 553 | break; | ||
| 554 | 269 | ||
| 555 | case 0x3c: /* Invert */ | 270 | case HID_GD_HATSWITCH: |
| 556 | map_key_clear(BTN_TOOL_RUBBER); | 271 | usage->hat_min = field->logical_minimum; |
| 557 | break; | 272 | usage->hat_max = field->logical_maximum; |
| 273 | map_abs(ABS_HAT0X); | ||
| 274 | break; | ||
| 558 | 275 | ||
| 559 | case 0x33: /* Touch */ | 276 | case HID_GD_START: map_key_clear(BTN_START); break; |
| 560 | case 0x42: /* TipSwitch */ | 277 | case HID_GD_SELECT: map_key_clear(BTN_SELECT); break; |
| 561 | case 0x43: /* TipSwitch2 */ | ||
| 562 | device->quirks &= ~HID_QUIRK_NOTOUCH; | ||
| 563 | map_key_clear(BTN_TOUCH); | ||
| 564 | break; | ||
| 565 | 278 | ||
| 566 | case 0x44: /* BarrelSwitch */ | 279 | default: goto unknown; |
| 567 | map_key_clear(BTN_STYLUS); | 280 | } |
| 568 | break; | ||
| 569 | 281 | ||
| 570 | default: goto unknown; | 282 | break; |
| 283 | |||
| 284 | case HID_UP_LED: | ||
| 285 | switch (usage->hid & 0xffff) { /* HID-Value: */ | ||
| 286 | case 0x01: map_led (LED_NUML); break; /* "Num Lock" */ | ||
| 287 | case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */ | ||
| 288 | case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */ | ||
| 289 | case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */ | ||
| 290 | case 0x05: map_led (LED_KANA); break; /* "Kana" */ | ||
| 291 | case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */ | ||
| 292 | case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */ | ||
| 293 | case 0x09: map_led (LED_MUTE); break; /* "Mute" */ | ||
| 294 | case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */ | ||
| 295 | case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */ | ||
| 296 | case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */ | ||
| 297 | |||
| 298 | default: goto ignore; | ||
| 299 | } | ||
| 300 | break; | ||
| 301 | |||
| 302 | case HID_UP_DIGITIZER: | ||
| 303 | switch (usage->hid & 0xff) { | ||
| 304 | case 0x30: /* TipPressure */ | ||
| 305 | if (!test_bit(BTN_TOUCH, input->keybit)) { | ||
| 306 | device->quirks |= HID_QUIRK_NOTOUCH; | ||
| 307 | set_bit(EV_KEY, input->evbit); | ||
| 308 | set_bit(BTN_TOUCH, input->keybit); | ||
| 571 | } | 309 | } |
| 310 | map_abs_clear(ABS_PRESSURE); | ||
| 572 | break; | 311 | break; |
| 573 | 312 | ||
| 574 | case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */ | 313 | case 0x32: /* InRange */ |
| 575 | 314 | switch (field->physical & 0xff) { | |
| 576 | switch (usage->hid & HID_USAGE) { | 315 | case 0x21: map_key(BTN_TOOL_MOUSE); break; |
| 577 | case 0x000: goto ignore; | 316 | case 0x22: map_key(BTN_TOOL_FINGER); break; |
| 578 | case 0x034: map_key_clear(KEY_SLEEP); break; | 317 | default: map_key(BTN_TOOL_PEN); break; |
| 579 | case 0x036: map_key_clear(BTN_MISC); break; | ||
| 580 | |||
| 581 | case 0x040: map_key_clear(KEY_MENU); break; | ||
| 582 | case 0x045: map_key_clear(KEY_RADIO); break; | ||
| 583 | |||
| 584 | case 0x083: map_key_clear(KEY_LAST); break; | ||
| 585 | case 0x088: map_key_clear(KEY_PC); break; | ||
| 586 | case 0x089: map_key_clear(KEY_TV); break; | ||
| 587 | case 0x08a: map_key_clear(KEY_WWW); break; | ||
| 588 | case 0x08b: map_key_clear(KEY_DVD); break; | ||
| 589 | case 0x08c: map_key_clear(KEY_PHONE); break; | ||
| 590 | case 0x08d: map_key_clear(KEY_PROGRAM); break; | ||
| 591 | case 0x08e: map_key_clear(KEY_VIDEOPHONE); break; | ||
| 592 | case 0x08f: map_key_clear(KEY_GAMES); break; | ||
| 593 | case 0x090: map_key_clear(KEY_MEMO); break; | ||
| 594 | case 0x091: map_key_clear(KEY_CD); break; | ||
| 595 | case 0x092: map_key_clear(KEY_VCR); break; | ||
| 596 | case 0x093: map_key_clear(KEY_TUNER); break; | ||
| 597 | case 0x094: map_key_clear(KEY_EXIT); break; | ||
| 598 | case 0x095: map_key_clear(KEY_HELP); break; | ||
| 599 | case 0x096: map_key_clear(KEY_TAPE); break; | ||
| 600 | case 0x097: map_key_clear(KEY_TV2); break; | ||
| 601 | case 0x098: map_key_clear(KEY_SAT); break; | ||
| 602 | case 0x09a: map_key_clear(KEY_PVR); break; | ||
| 603 | |||
| 604 | case 0x09c: map_key_clear(KEY_CHANNELUP); break; | ||
| 605 | case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; | ||
| 606 | case 0x0a0: map_key_clear(KEY_VCR2); break; | ||
| 607 | |||
| 608 | case 0x0b0: map_key_clear(KEY_PLAY); break; | ||
| 609 | case 0x0b1: map_key_clear(KEY_PAUSE); break; | ||
| 610 | case 0x0b2: map_key_clear(KEY_RECORD); break; | ||
| 611 | case 0x0b3: map_key_clear(KEY_FASTFORWARD); break; | ||
| 612 | case 0x0b4: map_key_clear(KEY_REWIND); break; | ||
| 613 | case 0x0b5: map_key_clear(KEY_NEXTSONG); break; | ||
| 614 | case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break; | ||
| 615 | case 0x0b7: map_key_clear(KEY_STOPCD); break; | ||
| 616 | case 0x0b8: map_key_clear(KEY_EJECTCD); break; | ||
| 617 | case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break; | ||
| 618 | |||
| 619 | case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; | ||
| 620 | case 0x0e0: map_abs_clear(ABS_VOLUME); break; | ||
| 621 | case 0x0e2: map_key_clear(KEY_MUTE); break; | ||
| 622 | case 0x0e5: map_key_clear(KEY_BASSBOOST); break; | ||
| 623 | case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; | ||
| 624 | case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; | ||
| 625 | |||
| 626 | case 0x182: map_key_clear(KEY_BOOKMARKS); break; | ||
| 627 | case 0x183: map_key_clear(KEY_CONFIG); break; | ||
| 628 | case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; | ||
| 629 | case 0x185: map_key_clear(KEY_EDITOR); break; | ||
| 630 | case 0x186: map_key_clear(KEY_SPREADSHEET); break; | ||
| 631 | case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break; | ||
| 632 | case 0x188: map_key_clear(KEY_PRESENTATION); break; | ||
| 633 | case 0x189: map_key_clear(KEY_DATABASE); break; | ||
| 634 | case 0x18a: map_key_clear(KEY_MAIL); break; | ||
| 635 | case 0x18b: map_key_clear(KEY_NEWS); break; | ||
| 636 | case 0x18c: map_key_clear(KEY_VOICEMAIL); break; | ||
| 637 | case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break; | ||
| 638 | case 0x18e: map_key_clear(KEY_CALENDAR); break; | ||
| 639 | case 0x191: map_key_clear(KEY_FINANCE); break; | ||
| 640 | case 0x192: map_key_clear(KEY_CALC); break; | ||
| 641 | case 0x194: map_key_clear(KEY_FILE); break; | ||
| 642 | case 0x196: map_key_clear(KEY_WWW); break; | ||
| 643 | case 0x19c: map_key_clear(KEY_LOGOFF); break; | ||
| 644 | case 0x19e: map_key_clear(KEY_COFFEE); break; | ||
| 645 | case 0x1a6: map_key_clear(KEY_HELP); break; | ||
| 646 | case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; | ||
| 647 | case 0x1ab: map_key_clear(KEY_SPELLCHECK); break; | ||
| 648 | case 0x1b6: map_key_clear(KEY_MEDIA); break; | ||
| 649 | case 0x1b7: map_key_clear(KEY_SOUND); break; | ||
| 650 | case 0x1bc: map_key_clear(KEY_MESSENGER); break; | ||
| 651 | case 0x1bd: map_key_clear(KEY_INFO); break; | ||
| 652 | case 0x201: map_key_clear(KEY_NEW); break; | ||
| 653 | case 0x202: map_key_clear(KEY_OPEN); break; | ||
| 654 | case 0x203: map_key_clear(KEY_CLOSE); break; | ||
| 655 | case 0x204: map_key_clear(KEY_EXIT); break; | ||
| 656 | case 0x207: map_key_clear(KEY_SAVE); break; | ||
| 657 | case 0x208: map_key_clear(KEY_PRINT); break; | ||
| 658 | case 0x209: map_key_clear(KEY_PROPS); break; | ||
| 659 | case 0x21a: map_key_clear(KEY_UNDO); break; | ||
| 660 | case 0x21b: map_key_clear(KEY_COPY); break; | ||
| 661 | case 0x21c: map_key_clear(KEY_CUT); break; | ||
| 662 | case 0x21d: map_key_clear(KEY_PASTE); break; | ||
| 663 | case 0x21f: map_key_clear(KEY_FIND); break; | ||
| 664 | case 0x221: map_key_clear(KEY_SEARCH); break; | ||
| 665 | case 0x222: map_key_clear(KEY_GOTO); break; | ||
| 666 | case 0x223: map_key_clear(KEY_HOMEPAGE); break; | ||
| 667 | case 0x224: map_key_clear(KEY_BACK); break; | ||
| 668 | case 0x225: map_key_clear(KEY_FORWARD); break; | ||
| 669 | case 0x226: map_key_clear(KEY_STOP); break; | ||
| 670 | case 0x227: map_key_clear(KEY_REFRESH); break; | ||
| 671 | case 0x22a: map_key_clear(KEY_BOOKMARKS); break; | ||
| 672 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; | ||
| 673 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; | ||
| 674 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; | ||
| 675 | case 0x233: map_key_clear(KEY_SCROLLUP); break; | ||
| 676 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; | ||
| 677 | case 0x238: map_rel(REL_HWHEEL); break; | ||
| 678 | case 0x25f: map_key_clear(KEY_CANCEL); break; | ||
| 679 | case 0x279: map_key_clear(KEY_REDO); break; | ||
| 680 | |||
| 681 | case 0x289: map_key_clear(KEY_REPLY); break; | ||
| 682 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; | ||
| 683 | case 0x28c: map_key_clear(KEY_SEND); break; | ||
| 684 | |||
| 685 | default: goto ignore; | ||
| 686 | } | 318 | } |
| 687 | break; | 319 | break; |
| 688 | 320 | ||
| 689 | case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ | 321 | case 0x3c: /* Invert */ |
| 690 | 322 | map_key_clear(BTN_TOOL_RUBBER); | |
| 691 | set_bit(EV_REP, input->evbit); | ||
| 692 | switch (usage->hid & HID_USAGE) { | ||
| 693 | case 0x021: map_key_clear(KEY_PRINT); break; | ||
| 694 | case 0x070: map_key_clear(KEY_HP); break; | ||
| 695 | case 0x071: map_key_clear(KEY_CAMERA); break; | ||
| 696 | case 0x072: map_key_clear(KEY_SOUND); break; | ||
| 697 | case 0x073: map_key_clear(KEY_QUESTION); break; | ||
| 698 | case 0x080: map_key_clear(KEY_EMAIL); break; | ||
| 699 | case 0x081: map_key_clear(KEY_CHAT); break; | ||
| 700 | case 0x082: map_key_clear(KEY_SEARCH); break; | ||
| 701 | case 0x083: map_key_clear(KEY_CONNECT); break; | ||
| 702 | case 0x084: map_key_clear(KEY_FINANCE); break; | ||
| 703 | case 0x085: map_key_clear(KEY_SPORT); break; | ||
| 704 | case 0x086: map_key_clear(KEY_SHOP); break; | ||
| 705 | default: goto ignore; | ||
| 706 | } | ||
| 707 | break; | 323 | break; |
| 708 | 324 | ||
| 709 | case HID_UP_MSVENDOR: | 325 | case 0x33: /* Touch */ |
| 710 | 326 | case 0x42: /* TipSwitch */ | |
| 711 | goto ignore; | 327 | case 0x43: /* TipSwitch2 */ |
| 712 | 328 | device->quirks &= ~HID_QUIRK_NOTOUCH; | |
| 713 | case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ | 329 | map_key_clear(BTN_TOUCH); |
| 714 | 330 | break; | |
| 715 | set_bit(EV_REP, input->evbit); | ||
| 716 | switch(usage->hid & HID_USAGE) { | ||
| 717 | case 0x003: | ||
| 718 | /* The fn key on Apple USB keyboards */ | ||
| 719 | map_key_clear(KEY_FN); | ||
| 720 | hidinput_apple_setup(input); | ||
| 721 | break; | ||
| 722 | 331 | ||
| 723 | default: goto ignore; | 332 | case 0x44: /* BarrelSwitch */ |
| 724 | } | 333 | map_key_clear(BTN_STYLUS); |
| 725 | break; | 334 | break; |
| 726 | 335 | ||
| 727 | case HID_UP_LOGIVENDOR: | 336 | default: goto unknown; |
| 337 | } | ||
| 338 | break; | ||
| 339 | |||
| 340 | case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */ | ||
| 341 | switch (usage->hid & HID_USAGE) { | ||
| 342 | case 0x000: goto ignore; | ||
| 343 | case 0x034: map_key_clear(KEY_SLEEP); break; | ||
| 344 | case 0x036: map_key_clear(BTN_MISC); break; | ||
| 345 | |||
| 346 | case 0x040: map_key_clear(KEY_MENU); break; | ||
| 347 | case 0x045: map_key_clear(KEY_RADIO); break; | ||
| 348 | |||
| 349 | case 0x083: map_key_clear(KEY_LAST); break; | ||
| 350 | case 0x088: map_key_clear(KEY_PC); break; | ||
| 351 | case 0x089: map_key_clear(KEY_TV); break; | ||
| 352 | case 0x08a: map_key_clear(KEY_WWW); break; | ||
| 353 | case 0x08b: map_key_clear(KEY_DVD); break; | ||
| 354 | case 0x08c: map_key_clear(KEY_PHONE); break; | ||
| 355 | case 0x08d: map_key_clear(KEY_PROGRAM); break; | ||
| 356 | case 0x08e: map_key_clear(KEY_VIDEOPHONE); break; | ||
| 357 | case 0x08f: map_key_clear(KEY_GAMES); break; | ||
| 358 | case 0x090: map_key_clear(KEY_MEMO); break; | ||
| 359 | case 0x091: map_key_clear(KEY_CD); break; | ||
| 360 | case 0x092: map_key_clear(KEY_VCR); break; | ||
| 361 | case 0x093: map_key_clear(KEY_TUNER); break; | ||
| 362 | case 0x094: map_key_clear(KEY_EXIT); break; | ||
| 363 | case 0x095: map_key_clear(KEY_HELP); break; | ||
| 364 | case 0x096: map_key_clear(KEY_TAPE); break; | ||
| 365 | case 0x097: map_key_clear(KEY_TV2); break; | ||
| 366 | case 0x098: map_key_clear(KEY_SAT); break; | ||
| 367 | case 0x09a: map_key_clear(KEY_PVR); break; | ||
| 368 | |||
| 369 | case 0x09c: map_key_clear(KEY_CHANNELUP); break; | ||
| 370 | case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; | ||
| 371 | case 0x0a0: map_key_clear(KEY_VCR2); break; | ||
| 372 | |||
| 373 | case 0x0b0: map_key_clear(KEY_PLAY); break; | ||
| 374 | case 0x0b1: map_key_clear(KEY_PAUSE); break; | ||
| 375 | case 0x0b2: map_key_clear(KEY_RECORD); break; | ||
| 376 | case 0x0b3: map_key_clear(KEY_FASTFORWARD); break; | ||
| 377 | case 0x0b4: map_key_clear(KEY_REWIND); break; | ||
| 378 | case 0x0b5: map_key_clear(KEY_NEXTSONG); break; | ||
| 379 | case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break; | ||
| 380 | case 0x0b7: map_key_clear(KEY_STOPCD); break; | ||
| 381 | case 0x0b8: map_key_clear(KEY_EJECTCD); break; | ||
| 382 | case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break; | ||
| 383 | |||
| 384 | case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; | ||
| 385 | case 0x0e0: map_abs_clear(ABS_VOLUME); break; | ||
| 386 | case 0x0e2: map_key_clear(KEY_MUTE); break; | ||
| 387 | case 0x0e5: map_key_clear(KEY_BASSBOOST); break; | ||
| 388 | case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; | ||
| 389 | case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; | ||
| 390 | |||
| 391 | case 0x182: map_key_clear(KEY_BOOKMARKS); break; | ||
| 392 | case 0x183: map_key_clear(KEY_CONFIG); break; | ||
| 393 | case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; | ||
| 394 | case 0x185: map_key_clear(KEY_EDITOR); break; | ||
| 395 | case 0x186: map_key_clear(KEY_SPREADSHEET); break; | ||
| 396 | case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break; | ||
| 397 | case 0x188: map_key_clear(KEY_PRESENTATION); break; | ||
| 398 | case 0x189: map_key_clear(KEY_DATABASE); break; | ||
| 399 | case 0x18a: map_key_clear(KEY_MAIL); break; | ||
| 400 | case 0x18b: map_key_clear(KEY_NEWS); break; | ||
| 401 | case 0x18c: map_key_clear(KEY_VOICEMAIL); break; | ||
| 402 | case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break; | ||
| 403 | case 0x18e: map_key_clear(KEY_CALENDAR); break; | ||
| 404 | case 0x191: map_key_clear(KEY_FINANCE); break; | ||
| 405 | case 0x192: map_key_clear(KEY_CALC); break; | ||
| 406 | case 0x194: map_key_clear(KEY_FILE); break; | ||
| 407 | case 0x196: map_key_clear(KEY_WWW); break; | ||
| 408 | case 0x19c: map_key_clear(KEY_LOGOFF); break; | ||
| 409 | case 0x19e: map_key_clear(KEY_COFFEE); break; | ||
| 410 | case 0x1a6: map_key_clear(KEY_HELP); break; | ||
| 411 | case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; | ||
| 412 | case 0x1ab: map_key_clear(KEY_SPELLCHECK); break; | ||
| 413 | case 0x1b6: map_key_clear(KEY_MEDIA); break; | ||
| 414 | case 0x1b7: map_key_clear(KEY_SOUND); break; | ||
| 415 | case 0x1bc: map_key_clear(KEY_MESSENGER); break; | ||
| 416 | case 0x1bd: map_key_clear(KEY_INFO); break; | ||
| 417 | case 0x201: map_key_clear(KEY_NEW); break; | ||
| 418 | case 0x202: map_key_clear(KEY_OPEN); break; | ||
| 419 | case 0x203: map_key_clear(KEY_CLOSE); break; | ||
| 420 | case 0x204: map_key_clear(KEY_EXIT); break; | ||
| 421 | case 0x207: map_key_clear(KEY_SAVE); break; | ||
| 422 | case 0x208: map_key_clear(KEY_PRINT); break; | ||
| 423 | case 0x209: map_key_clear(KEY_PROPS); break; | ||
| 424 | case 0x21a: map_key_clear(KEY_UNDO); break; | ||
| 425 | case 0x21b: map_key_clear(KEY_COPY); break; | ||
| 426 | case 0x21c: map_key_clear(KEY_CUT); break; | ||
| 427 | case 0x21d: map_key_clear(KEY_PASTE); break; | ||
| 428 | case 0x21f: map_key_clear(KEY_FIND); break; | ||
| 429 | case 0x221: map_key_clear(KEY_SEARCH); break; | ||
| 430 | case 0x222: map_key_clear(KEY_GOTO); break; | ||
| 431 | case 0x223: map_key_clear(KEY_HOMEPAGE); break; | ||
| 432 | case 0x224: map_key_clear(KEY_BACK); break; | ||
| 433 | case 0x225: map_key_clear(KEY_FORWARD); break; | ||
| 434 | case 0x226: map_key_clear(KEY_STOP); break; | ||
| 435 | case 0x227: map_key_clear(KEY_REFRESH); break; | ||
| 436 | case 0x22a: map_key_clear(KEY_BOOKMARKS); break; | ||
| 437 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; | ||
| 438 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; | ||
| 439 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; | ||
| 440 | case 0x233: map_key_clear(KEY_SCROLLUP); break; | ||
| 441 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; | ||
| 442 | case 0x238: map_rel(REL_HWHEEL); break; | ||
| 443 | case 0x25f: map_key_clear(KEY_CANCEL); break; | ||
| 444 | case 0x279: map_key_clear(KEY_REDO); break; | ||
| 445 | |||
| 446 | case 0x289: map_key_clear(KEY_REPLY); break; | ||
| 447 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; | ||
| 448 | case 0x28c: map_key_clear(KEY_SEND); break; | ||
| 449 | |||
| 450 | default: goto ignore; | ||
| 451 | } | ||
| 452 | break; | ||
| 453 | |||
| 454 | case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ | ||
| 455 | set_bit(EV_REP, input->evbit); | ||
| 456 | switch (usage->hid & HID_USAGE) { | ||
| 457 | case 0x021: map_key_clear(KEY_PRINT); break; | ||
| 458 | case 0x070: map_key_clear(KEY_HP); break; | ||
| 459 | case 0x071: map_key_clear(KEY_CAMERA); break; | ||
| 460 | case 0x072: map_key_clear(KEY_SOUND); break; | ||
| 461 | case 0x073: map_key_clear(KEY_QUESTION); break; | ||
| 462 | case 0x080: map_key_clear(KEY_EMAIL); break; | ||
| 463 | case 0x081: map_key_clear(KEY_CHAT); break; | ||
| 464 | case 0x082: map_key_clear(KEY_SEARCH); break; | ||
| 465 | case 0x083: map_key_clear(KEY_CONNECT); break; | ||
| 466 | case 0x084: map_key_clear(KEY_FINANCE); break; | ||
| 467 | case 0x085: map_key_clear(KEY_SPORT); break; | ||
| 468 | case 0x086: map_key_clear(KEY_SHOP); break; | ||
| 469 | default: goto ignore; | ||
| 470 | } | ||
| 471 | break; | ||
| 728 | 472 | ||
| 729 | goto ignore; | 473 | case HID_UP_MSVENDOR: |
| 730 | 474 | goto ignore; | |
| 731 | case HID_UP_PID: | ||
| 732 | 475 | ||
| 733 | switch(usage->hid & HID_USAGE) { | 476 | case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ |
| 734 | case 0xa4: map_key_clear(BTN_DEAD); break; | 477 | set_bit(EV_REP, input->evbit); |
| 735 | default: goto ignore; | 478 | goto ignore; |
| 736 | } | ||
| 737 | break; | ||
| 738 | 479 | ||
| 739 | default: | 480 | case HID_UP_LOGIVENDOR: |
| 740 | unknown: | 481 | goto ignore; |
| 741 | if (field->report_size == 1) { | 482 | |
| 742 | if (field->report->type == HID_OUTPUT_REPORT) { | 483 | case HID_UP_PID: |
| 743 | map_led(LED_MISC); | 484 | switch (usage->hid & HID_USAGE) { |
| 744 | break; | 485 | case 0xa4: map_key_clear(BTN_DEAD); break; |
| 745 | } | 486 | default: goto ignore; |
| 746 | map_key(BTN_MISC); | 487 | } |
| 747 | break; | 488 | break; |
| 748 | } | 489 | |
| 749 | if (field->flags & HID_MAIN_ITEM_RELATIVE) { | 490 | default: |
| 750 | map_rel(REL_MISC); | 491 | unknown: |
| 492 | if (field->report_size == 1) { | ||
| 493 | if (field->report->type == HID_OUTPUT_REPORT) { | ||
| 494 | map_led(LED_MISC); | ||
| 751 | break; | 495 | break; |
| 752 | } | 496 | } |
| 753 | map_abs(ABS_MISC); | 497 | map_key(BTN_MISC); |
| 498 | break; | ||
| 499 | } | ||
| 500 | if (field->flags & HID_MAIN_ITEM_RELATIVE) { | ||
| 501 | map_rel(REL_MISC); | ||
| 754 | break; | 502 | break; |
| 503 | } | ||
| 504 | map_abs(ABS_MISC); | ||
| 505 | break; | ||
| 755 | } | 506 | } |
| 756 | 507 | ||
| 757 | mapped: | 508 | mapped: |
| 758 | if (device->quirks & HID_QUIRK_MIGHTYMOUSE) { | 509 | if (device->driver->input_mapped && device->driver->input_mapped(device, |
| 759 | if (usage->hid == HID_GD_Z) | 510 | hidinput, field, usage, &bit, &max) < 0) |
| 760 | map_rel(REL_HWHEEL); | ||
| 761 | else if (usage->code == BTN_1) | ||
| 762 | map_key(BTN_2); | ||
| 763 | else if (usage->code == BTN_2) | ||
| 764 | map_key(BTN_1); | ||
| 765 | } | ||
| 766 | |||
| 767 | if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5 | | ||
| 768 | HID_QUIRK_2WHEEL_MOUSE_HACK_B8)) && (usage->type == EV_REL) && | ||
| 769 | (usage->code == REL_WHEEL)) | ||
| 770 | set_bit(REL_HWHEEL, bit); | ||
| 771 | |||
| 772 | if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005)) | ||
| 773 | || ((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) | ||
| 774 | goto ignore; | 511 | goto ignore; |
| 775 | 512 | ||
| 776 | if ((device->quirks & HID_QUIRK_BAD_RELATIVE_KEYS) && | ||
| 777 | usage->type == EV_KEY && (field->flags & HID_MAIN_ITEM_RELATIVE)) | ||
| 778 | field->flags &= ~HID_MAIN_ITEM_RELATIVE; | ||
| 779 | |||
| 780 | set_bit(usage->type, input->evbit); | 513 | set_bit(usage->type, input->evbit); |
| 781 | 514 | ||
| 782 | if (device->quirks & HID_QUIRK_DUPLICATE_USAGES && | ||
| 783 | (usage->type == EV_KEY || | ||
| 784 | usage->type == EV_REL || | ||
| 785 | usage->type == EV_ABS)) | ||
| 786 | clear_bit(usage->code, bit); | ||
| 787 | |||
| 788 | while (usage->code <= max && test_and_set_bit(usage->code, bit)) | 515 | while (usage->code <= max && test_and_set_bit(usage->code, bit)) |
| 789 | usage->code = find_next_zero_bit(bit, max + 1, usage->code); | 516 | usage->code = find_next_zero_bit(bit, max + 1, usage->code); |
| 790 | 517 | ||
| @@ -858,10 +585,6 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct | |||
| 858 | if (!usage->type) | 585 | if (!usage->type) |
| 859 | return; | 586 | return; |
| 860 | 587 | ||
| 861 | /* handle input events for quirky devices */ | ||
| 862 | if (hidinput_event_quirks(hid, field, usage, value)) | ||
| 863 | return; | ||
| 864 | |||
| 865 | if (usage->hat_min < usage->hat_max || usage->hat_dir) { | 588 | if (usage->hat_min < usage->hat_max || usage->hat_dir) { |
| 866 | int hat_dir = usage->hat_dir; | 589 | int hat_dir = usage->hat_dir; |
| 867 | if (!hat_dir) | 590 | if (!hat_dir) |
| @@ -961,14 +684,14 @@ static int hidinput_open(struct input_dev *dev) | |||
| 961 | { | 684 | { |
| 962 | struct hid_device *hid = input_get_drvdata(dev); | 685 | struct hid_device *hid = input_get_drvdata(dev); |
| 963 | 686 | ||
| 964 | return hid->hid_open(hid); | 687 | return hid->ll_driver->open(hid); |
| 965 | } | 688 | } |
| 966 | 689 | ||
| 967 | static void hidinput_close(struct input_dev *dev) | 690 | static void hidinput_close(struct input_dev *dev) |
| 968 | { | 691 | { |
| 969 | struct hid_device *hid = input_get_drvdata(dev); | 692 | struct hid_device *hid = input_get_drvdata(dev); |
| 970 | 693 | ||
| 971 | hid->hid_close(hid); | 694 | hid->ll_driver->close(hid); |
| 972 | } | 695 | } |
| 973 | 696 | ||
| 974 | /* | 697 | /* |
| @@ -977,7 +700,7 @@ static void hidinput_close(struct input_dev *dev) | |||
| 977 | * Read all reports and initialize the absolute field values. | 700 | * Read all reports and initialize the absolute field values. |
| 978 | */ | 701 | */ |
| 979 | 702 | ||
| 980 | int hidinput_connect(struct hid_device *hid) | 703 | int hidinput_connect(struct hid_device *hid, unsigned int force) |
| 981 | { | 704 | { |
| 982 | struct hid_report *report; | 705 | struct hid_report *report; |
| 983 | struct hid_input *hidinput = NULL; | 706 | struct hid_input *hidinput = NULL; |
| @@ -985,19 +708,20 @@ int hidinput_connect(struct hid_device *hid) | |||
| 985 | int i, j, k; | 708 | int i, j, k; |
| 986 | int max_report_type = HID_OUTPUT_REPORT; | 709 | int max_report_type = HID_OUTPUT_REPORT; |
| 987 | 710 | ||
| 988 | if (hid->quirks & HID_QUIRK_IGNORE_HIDINPUT) | ||
| 989 | return -1; | ||
| 990 | |||
| 991 | INIT_LIST_HEAD(&hid->inputs); | 711 | INIT_LIST_HEAD(&hid->inputs); |
| 992 | 712 | ||
| 993 | for (i = 0; i < hid->maxcollection; i++) | 713 | if (!force) { |
| 994 | if (hid->collection[i].type == HID_COLLECTION_APPLICATION || | 714 | for (i = 0; i < hid->maxcollection; i++) { |
| 995 | hid->collection[i].type == HID_COLLECTION_PHYSICAL) | 715 | struct hid_collection *col = &hid->collection[i]; |
| 996 | if (IS_INPUT_APPLICATION(hid->collection[i].usage)) | 716 | if (col->type == HID_COLLECTION_APPLICATION || |
| 997 | break; | 717 | col->type == HID_COLLECTION_PHYSICAL) |
| 718 | if (IS_INPUT_APPLICATION(col->usage)) | ||
| 719 | break; | ||
| 720 | } | ||
| 998 | 721 | ||
| 999 | if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDINPUT) == 0) | 722 | if (i == hid->maxcollection) |
| 1000 | return -1; | 723 | return -1; |
| 724 | } | ||
| 1001 | 725 | ||
| 1002 | if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) | 726 | if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) |
| 1003 | max_report_type = HID_INPUT_REPORT; | 727 | max_report_type = HID_INPUT_REPORT; |
| @@ -1019,7 +743,8 @@ int hidinput_connect(struct hid_device *hid) | |||
| 1019 | } | 743 | } |
| 1020 | 744 | ||
| 1021 | input_set_drvdata(input_dev, hid); | 745 | input_set_drvdata(input_dev, hid); |
| 1022 | input_dev->event = hid->hidinput_input_event; | 746 | input_dev->event = |
| 747 | hid->ll_driver->hidinput_input_event; | ||
| 1023 | input_dev->open = hidinput_open; | 748 | input_dev->open = hidinput_open; |
| 1024 | input_dev->close = hidinput_close; | 749 | input_dev->close = hidinput_close; |
| 1025 | input_dev->setkeycode = hidinput_setkeycode; | 750 | input_dev->setkeycode = hidinput_setkeycode; |
| @@ -1032,7 +757,7 @@ int hidinput_connect(struct hid_device *hid) | |||
| 1032 | input_dev->id.vendor = hid->vendor; | 757 | input_dev->id.vendor = hid->vendor; |
| 1033 | input_dev->id.product = hid->product; | 758 | input_dev->id.product = hid->product; |
| 1034 | input_dev->id.version = hid->version; | 759 | input_dev->id.version = hid->version; |
| 1035 | input_dev->dev.parent = hid->dev; | 760 | input_dev->dev.parent = hid->dev.parent; |
| 1036 | hidinput->input = input_dev; | 761 | hidinput->input = input_dev; |
| 1037 | list_add_tail(&hidinput->list, &hid->inputs); | 762 | list_add_tail(&hidinput->list, &hid->inputs); |
| 1038 | } | 763 | } |
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c new file mode 100644 index 000000000000..406d8c82abf1 --- /dev/null +++ b/drivers/hid/hid-lg.c | |||
| @@ -0,0 +1,342 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some logitech "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | #include "hid-lg.h" | ||
| 25 | |||
| 26 | #define LG_RDESC 0x001 | ||
| 27 | #define LG_BAD_RELATIVE_KEYS 0x002 | ||
| 28 | #define LG_DUPLICATE_USAGES 0x004 | ||
| 29 | #define LG_RESET_LEDS 0x008 | ||
| 30 | #define LG_EXPANDED_KEYMAP 0x010 | ||
| 31 | #define LG_IGNORE_DOUBLED_WHEEL 0x020 | ||
| 32 | #define LG_WIRELESS 0x040 | ||
| 33 | #define LG_INVERT_HWHEEL 0x080 | ||
| 34 | #define LG_NOGET 0x100 | ||
| 35 | #define LG_FF 0x200 | ||
| 36 | #define LG_FF2 0x400 | ||
| 37 | |||
| 38 | /* | ||
| 39 | * Certain Logitech keyboards send in report #3 keys which are far | ||
| 40 | * above the logical maximum described in descriptor. This extends | ||
| 41 | * the original value of 0x28c of logical maximum to 0x104d | ||
| 42 | */ | ||
| 43 | static void lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 44 | unsigned int rsize) | ||
| 45 | { | ||
| 46 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 47 | |||
| 48 | if ((quirks & LG_RDESC) && rsize >= 90 && rdesc[83] == 0x26 && | ||
| 49 | rdesc[84] == 0x8c && rdesc[85] == 0x02) { | ||
| 50 | dev_info(&hdev->dev, "fixing up Logitech keyboard report " | ||
| 51 | "descriptor\n"); | ||
| 52 | rdesc[84] = rdesc[89] = 0x4d; | ||
| 53 | rdesc[85] = rdesc[90] = 0x10; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 58 | EV_KEY, (c)) | ||
| 59 | |||
| 60 | static int lg_ultrax_remote_mapping(struct hid_input *hi, | ||
| 61 | struct hid_usage *usage, unsigned long **bit, int *max) | ||
| 62 | { | ||
| 63 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) | ||
| 64 | return 0; | ||
| 65 | |||
| 66 | set_bit(EV_REP, hi->input->evbit); | ||
| 67 | switch (usage->hid & HID_USAGE) { | ||
| 68 | /* Reported on Logitech Ultra X Media Remote */ | ||
| 69 | case 0x004: lg_map_key_clear(KEY_AGAIN); break; | ||
| 70 | case 0x00d: lg_map_key_clear(KEY_HOME); break; | ||
| 71 | case 0x024: lg_map_key_clear(KEY_SHUFFLE); break; | ||
| 72 | case 0x025: lg_map_key_clear(KEY_TV); break; | ||
| 73 | case 0x026: lg_map_key_clear(KEY_MENU); break; | ||
| 74 | case 0x031: lg_map_key_clear(KEY_AUDIO); break; | ||
| 75 | case 0x032: lg_map_key_clear(KEY_TEXT); break; | ||
| 76 | case 0x033: lg_map_key_clear(KEY_LAST); break; | ||
| 77 | case 0x047: lg_map_key_clear(KEY_MP3); break; | ||
| 78 | case 0x048: lg_map_key_clear(KEY_DVD); break; | ||
| 79 | case 0x049: lg_map_key_clear(KEY_MEDIA); break; | ||
| 80 | case 0x04a: lg_map_key_clear(KEY_VIDEO); break; | ||
| 81 | case 0x04b: lg_map_key_clear(KEY_ANGLE); break; | ||
| 82 | case 0x04c: lg_map_key_clear(KEY_LANGUAGE); break; | ||
| 83 | case 0x04d: lg_map_key_clear(KEY_SUBTITLE); break; | ||
| 84 | case 0x051: lg_map_key_clear(KEY_RED); break; | ||
| 85 | case 0x052: lg_map_key_clear(KEY_CLOSE); break; | ||
| 86 | |||
| 87 | default: | ||
| 88 | return 0; | ||
| 89 | } | ||
| 90 | return 1; | ||
| 91 | } | ||
| 92 | |||
| 93 | static int lg_wireless_mapping(struct hid_input *hi, struct hid_usage *usage, | ||
| 94 | unsigned long **bit, int *max) | ||
| 95 | { | ||
| 96 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 97 | return 0; | ||
| 98 | |||
| 99 | switch (usage->hid & HID_USAGE) { | ||
| 100 | case 0x1001: lg_map_key_clear(KEY_MESSENGER); break; | ||
| 101 | case 0x1003: lg_map_key_clear(KEY_SOUND); break; | ||
| 102 | case 0x1004: lg_map_key_clear(KEY_VIDEO); break; | ||
| 103 | case 0x1005: lg_map_key_clear(KEY_AUDIO); break; | ||
| 104 | case 0x100a: lg_map_key_clear(KEY_DOCUMENTS); break; | ||
| 105 | case 0x1011: lg_map_key_clear(KEY_PREVIOUSSONG); break; | ||
| 106 | case 0x1012: lg_map_key_clear(KEY_NEXTSONG); break; | ||
| 107 | case 0x1013: lg_map_key_clear(KEY_CAMERA); break; | ||
| 108 | case 0x1014: lg_map_key_clear(KEY_MESSENGER); break; | ||
| 109 | case 0x1015: lg_map_key_clear(KEY_RECORD); break; | ||
| 110 | case 0x1016: lg_map_key_clear(KEY_PLAYER); break; | ||
| 111 | case 0x1017: lg_map_key_clear(KEY_EJECTCD); break; | ||
| 112 | case 0x1018: lg_map_key_clear(KEY_MEDIA); break; | ||
| 113 | case 0x1019: lg_map_key_clear(KEY_PROG1); break; | ||
| 114 | case 0x101a: lg_map_key_clear(KEY_PROG2); break; | ||
| 115 | case 0x101b: lg_map_key_clear(KEY_PROG3); break; | ||
| 116 | case 0x101f: lg_map_key_clear(KEY_ZOOMIN); break; | ||
| 117 | case 0x1020: lg_map_key_clear(KEY_ZOOMOUT); break; | ||
| 118 | case 0x1021: lg_map_key_clear(KEY_ZOOMRESET); break; | ||
| 119 | case 0x1023: lg_map_key_clear(KEY_CLOSE); break; | ||
| 120 | case 0x1027: lg_map_key_clear(KEY_MENU); break; | ||
| 121 | /* this one is marked as 'Rotate' */ | ||
| 122 | case 0x1028: lg_map_key_clear(KEY_ANGLE); break; | ||
| 123 | case 0x1029: lg_map_key_clear(KEY_SHUFFLE); break; | ||
| 124 | case 0x102a: lg_map_key_clear(KEY_BACK); break; | ||
| 125 | case 0x102b: lg_map_key_clear(KEY_CYCLEWINDOWS); break; | ||
| 126 | case 0x1041: lg_map_key_clear(KEY_BATTERY); break; | ||
| 127 | case 0x1042: lg_map_key_clear(KEY_WORDPROCESSOR); break; | ||
| 128 | case 0x1043: lg_map_key_clear(KEY_SPREADSHEET); break; | ||
| 129 | case 0x1044: lg_map_key_clear(KEY_PRESENTATION); break; | ||
| 130 | case 0x1045: lg_map_key_clear(KEY_UNDO); break; | ||
| 131 | case 0x1046: lg_map_key_clear(KEY_REDO); break; | ||
| 132 | case 0x1047: lg_map_key_clear(KEY_PRINT); break; | ||
| 133 | case 0x1048: lg_map_key_clear(KEY_SAVE); break; | ||
| 134 | case 0x1049: lg_map_key_clear(KEY_PROG1); break; | ||
| 135 | case 0x104a: lg_map_key_clear(KEY_PROG2); break; | ||
| 136 | case 0x104b: lg_map_key_clear(KEY_PROG3); break; | ||
| 137 | case 0x104c: lg_map_key_clear(KEY_PROG4); break; | ||
| 138 | |||
| 139 | default: | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | return 1; | ||
| 143 | } | ||
| 144 | |||
| 145 | static int lg_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 146 | struct hid_field *field, struct hid_usage *usage, | ||
| 147 | unsigned long **bit, int *max) | ||
| 148 | { | ||
| 149 | /* extended mapping for certain Logitech hardware (Logitech cordless | ||
| 150 | desktop LX500) */ | ||
| 151 | static const u8 e_keymap[] = { | ||
| 152 | 0,216, 0,213,175,156, 0, 0, 0, 0, | ||
| 153 | 144, 0, 0, 0, 0, 0, 0, 0, 0,212, | ||
| 154 | 174,167,152,161,112, 0, 0, 0,154, 0, | ||
| 155 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 156 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 157 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 158 | 0, 0, 0, 0, 0,183,184,185,186,187, | ||
| 159 | 188,189,190,191,192,193,194, 0, 0, 0 | ||
| 160 | }; | ||
| 161 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 162 | unsigned int hid = usage->hid; | ||
| 163 | |||
| 164 | if (hdev->product == USB_DEVICE_ID_LOGITECH_RECEIVER && | ||
| 165 | lg_ultrax_remote_mapping(hi, usage, bit, max)) | ||
| 166 | return 1; | ||
| 167 | |||
| 168 | if ((quirks & LG_WIRELESS) && lg_wireless_mapping(hi, usage, bit, max)) | ||
| 169 | return 1; | ||
| 170 | |||
| 171 | if ((hid & HID_USAGE_PAGE) != HID_UP_BUTTON) | ||
| 172 | return 0; | ||
| 173 | |||
| 174 | hid &= HID_USAGE; | ||
| 175 | |||
| 176 | /* Special handling for Logitech Cordless Desktop */ | ||
| 177 | if (field->application == HID_GD_MOUSE) { | ||
| 178 | if ((quirks & LG_IGNORE_DOUBLED_WHEEL) && | ||
| 179 | (hid == 7 || hid == 8)) | ||
| 180 | return -1; | ||
| 181 | } else { | ||
| 182 | if ((quirks & LG_EXPANDED_KEYMAP) && | ||
| 183 | hid < ARRAY_SIZE(e_keymap) && | ||
| 184 | e_keymap[hid] != 0) { | ||
| 185 | hid_map_usage(hi, usage, bit, max, EV_KEY, | ||
| 186 | e_keymap[hid]); | ||
| 187 | return 1; | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | return 0; | ||
| 192 | } | ||
| 193 | |||
| 194 | static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
| 195 | struct hid_field *field, struct hid_usage *usage, | ||
| 196 | unsigned long **bit, int *max) | ||
| 197 | { | ||
| 198 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 199 | |||
| 200 | if ((quirks & LG_BAD_RELATIVE_KEYS) && usage->type == EV_KEY && | ||
| 201 | (field->flags & HID_MAIN_ITEM_RELATIVE)) | ||
| 202 | field->flags &= ~HID_MAIN_ITEM_RELATIVE; | ||
| 203 | |||
| 204 | if ((quirks & LG_DUPLICATE_USAGES) && (usage->type == EV_KEY || | ||
| 205 | usage->type == EV_REL || usage->type == EV_ABS)) | ||
| 206 | clear_bit(usage->code, *bit); | ||
| 207 | |||
| 208 | return 0; | ||
| 209 | } | ||
| 210 | |||
| 211 | static int lg_event(struct hid_device *hdev, struct hid_field *field, | ||
| 212 | struct hid_usage *usage, __s32 value) | ||
| 213 | { | ||
| 214 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 215 | |||
| 216 | if ((quirks & LG_INVERT_HWHEEL) && usage->code == REL_HWHEEL) { | ||
| 217 | input_event(field->hidinput->input, usage->type, usage->code, | ||
| 218 | -value); | ||
| 219 | return 1; | ||
| 220 | } | ||
| 221 | |||
| 222 | return 0; | ||
| 223 | } | ||
| 224 | |||
| 225 | static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 226 | { | ||
| 227 | unsigned long quirks = id->driver_data; | ||
| 228 | unsigned int connect_mask = HID_CONNECT_DEFAULT; | ||
| 229 | int ret; | ||
| 230 | |||
| 231 | hid_set_drvdata(hdev, (void *)quirks); | ||
| 232 | |||
| 233 | if (quirks & LG_NOGET) | ||
| 234 | hdev->quirks |= HID_QUIRK_NOGET; | ||
| 235 | |||
| 236 | ret = hid_parse(hdev); | ||
| 237 | if (ret) { | ||
| 238 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 239 | goto err_free; | ||
| 240 | } | ||
| 241 | |||
| 242 | if (quirks & (LG_FF | LG_FF2)) | ||
| 243 | connect_mask &= ~HID_CONNECT_FF; | ||
| 244 | |||
| 245 | ret = hid_hw_start(hdev, connect_mask); | ||
| 246 | if (ret) { | ||
| 247 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 248 | goto err_free; | ||
| 249 | } | ||
| 250 | |||
| 251 | if (quirks & LG_RESET_LEDS) | ||
| 252 | usbhid_set_leds(hdev); | ||
| 253 | |||
| 254 | if (quirks & LG_FF) | ||
| 255 | lgff_init(hdev); | ||
| 256 | if (quirks & LG_FF2) | ||
| 257 | lg2ff_init(hdev); | ||
| 258 | |||
| 259 | return 0; | ||
| 260 | err_free: | ||
| 261 | return ret; | ||
| 262 | } | ||
| 263 | |||
| 264 | static const struct hid_device_id lg_devices[] = { | ||
| 265 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER), | ||
| 266 | .driver_data = LG_RDESC | LG_WIRELESS }, | ||
| 267 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER), | ||
| 268 | .driver_data = LG_RDESC | LG_WIRELESS }, | ||
| 269 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2), | ||
| 270 | .driver_data = LG_RDESC | LG_WIRELESS }, | ||
| 271 | |||
| 272 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER), | ||
| 273 | .driver_data = LG_BAD_RELATIVE_KEYS }, | ||
| 274 | |||
| 275 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP), | ||
| 276 | .driver_data = LG_DUPLICATE_USAGES }, | ||
| 277 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE), | ||
| 278 | .driver_data = LG_DUPLICATE_USAGES }, | ||
| 279 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI), | ||
| 280 | .driver_data = LG_DUPLICATE_USAGES }, | ||
| 281 | |||
| 282 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD), | ||
| 283 | .driver_data = LG_RESET_LEDS }, | ||
| 284 | |||
| 285 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD), | ||
| 286 | .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, | ||
| 287 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), | ||
| 288 | .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, | ||
| 289 | |||
| 290 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3), | ||
| 291 | .driver_data = LG_INVERT_HWHEEL }, | ||
| 292 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150), | ||
| 293 | .driver_data = LG_INVERT_HWHEEL }, | ||
| 294 | |||
| 295 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D), | ||
| 296 | .driver_data = LG_NOGET }, | ||
| 297 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), | ||
| 298 | .driver_data = LG_NOGET | LG_FF }, | ||
| 299 | |||
| 300 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD), | ||
| 301 | .driver_data = LG_FF }, | ||
| 302 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2), | ||
| 303 | .driver_data = LG_FF }, | ||
| 304 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D), | ||
| 305 | .driver_data = LG_FF }, | ||
| 306 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO), | ||
| 307 | .driver_data = LG_FF }, | ||
| 308 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL), | ||
| 309 | .driver_data = LG_FF }, | ||
| 310 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2), | ||
| 311 | .driver_data = LG_FF }, | ||
| 312 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), | ||
| 313 | .driver_data = LG_FF2 }, | ||
| 314 | { } | ||
| 315 | }; | ||
| 316 | MODULE_DEVICE_TABLE(hid, lg_devices); | ||
| 317 | |||
| 318 | static struct hid_driver lg_driver = { | ||
| 319 | .name = "logitech", | ||
| 320 | .id_table = lg_devices, | ||
| 321 | .report_fixup = lg_report_fixup, | ||
| 322 | .input_mapping = lg_input_mapping, | ||
| 323 | .input_mapped = lg_input_mapped, | ||
| 324 | .event = lg_event, | ||
| 325 | .probe = lg_probe, | ||
| 326 | }; | ||
| 327 | |||
| 328 | static int lg_init(void) | ||
| 329 | { | ||
| 330 | return hid_register_driver(&lg_driver); | ||
| 331 | } | ||
| 332 | |||
| 333 | static void lg_exit(void) | ||
| 334 | { | ||
| 335 | hid_unregister_driver(&lg_driver); | ||
| 336 | } | ||
| 337 | |||
| 338 | module_init(lg_init); | ||
| 339 | module_exit(lg_exit); | ||
| 340 | MODULE_LICENSE("GPL"); | ||
| 341 | |||
| 342 | HID_COMPAT_LOAD_DRIVER(logitech); | ||
diff --git a/drivers/hid/hid-lg.h b/drivers/hid/hid-lg.h new file mode 100644 index 000000000000..27ae750ca878 --- /dev/null +++ b/drivers/hid/hid-lg.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #ifndef __HID_LG_H | ||
| 2 | #define __HID_LG_H | ||
| 3 | |||
| 4 | #include <linux/autoconf.h> | ||
| 5 | |||
| 6 | #ifdef CONFIG_LOGITECH_FF | ||
| 7 | int lgff_init(struct hid_device *hdev); | ||
| 8 | #else | ||
| 9 | static inline int lgff_init(struct hid_device *hdev) { return -1; } | ||
| 10 | #endif | ||
| 11 | |||
| 12 | #ifdef CONFIG_LOGIRUMBLEPAD2_FF | ||
| 13 | int lg2ff_init(struct hid_device *hdev); | ||
| 14 | #else | ||
| 15 | static inline int lg2ff_init(struct hid_device *hdev) { return -1; } | ||
| 16 | #endif | ||
| 17 | |||
| 18 | #endif | ||
diff --git a/drivers/hid/usbhid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c index d469bd0061c9..4e6dc6e26523 100644 --- a/drivers/hid/usbhid/hid-lg2ff.c +++ b/drivers/hid/hid-lg2ff.c | |||
| @@ -24,7 +24,9 @@ | |||
| 24 | #include <linux/input.h> | 24 | #include <linux/input.h> |
| 25 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
| 26 | #include <linux/hid.h> | 26 | #include <linux/hid.h> |
| 27 | #include "usbhid.h" | 27 | |
| 28 | #include "usbhid/usbhid.h" | ||
| 29 | #include "hid-lg.h" | ||
| 28 | 30 | ||
| 29 | struct lg2ff_device { | 31 | struct lg2ff_device { |
| 30 | struct hid_report *report; | 32 | struct hid_report *report; |
| @@ -57,7 +59,7 @@ static int play_effect(struct input_dev *dev, void *data, | |||
| 57 | return 0; | 59 | return 0; |
| 58 | } | 60 | } |
| 59 | 61 | ||
| 60 | int hid_lg2ff_init(struct hid_device *hid) | 62 | int lg2ff_init(struct hid_device *hid) |
| 61 | { | 63 | { |
| 62 | struct lg2ff_device *lg2ff; | 64 | struct lg2ff_device *lg2ff; |
| 63 | struct hid_report *report; | 65 | struct hid_report *report; |
| @@ -69,18 +71,18 @@ int hid_lg2ff_init(struct hid_device *hid) | |||
| 69 | int error; | 71 | int error; |
| 70 | 72 | ||
| 71 | if (list_empty(report_list)) { | 73 | if (list_empty(report_list)) { |
| 72 | printk(KERN_ERR "hid-lg2ff: no output report found\n"); | 74 | dev_err(&hid->dev, "no output report found\n"); |
| 73 | return -ENODEV; | 75 | return -ENODEV; |
| 74 | } | 76 | } |
| 75 | 77 | ||
| 76 | report = list_entry(report_list->next, struct hid_report, list); | 78 | report = list_entry(report_list->next, struct hid_report, list); |
| 77 | 79 | ||
| 78 | if (report->maxfield < 1) { | 80 | if (report->maxfield < 1) { |
| 79 | printk(KERN_ERR "hid-lg2ff: output report is empty\n"); | 81 | dev_err(&hid->dev, "output report is empty\n"); |
| 80 | return -ENODEV; | 82 | return -ENODEV; |
| 81 | } | 83 | } |
| 82 | if (report->field[0]->report_count < 7) { | 84 | if (report->field[0]->report_count < 7) { |
| 83 | printk(KERN_ERR "hid-lg2ff: not enough values in the field\n"); | 85 | dev_err(&hid->dev, "not enough values in the field\n"); |
| 84 | return -ENODEV; | 86 | return -ENODEV; |
| 85 | } | 87 | } |
| 86 | 88 | ||
| @@ -107,7 +109,7 @@ int hid_lg2ff_init(struct hid_device *hid) | |||
| 107 | 109 | ||
| 108 | usbhid_submit_report(hid, report, USB_DIR_OUT); | 110 | usbhid_submit_report(hid, report, USB_DIR_OUT); |
| 109 | 111 | ||
| 110 | printk(KERN_INFO "Force feedback for Logitech Rumblepad 2 by " | 112 | dev_info(&hid->dev, "Force feedback for Logitech Rumblepad 2 by " |
| 111 | "Anssi Hannula <anssi.hannula@gmail.com>\n"); | 113 | "Anssi Hannula <anssi.hannula@gmail.com>\n"); |
| 112 | 114 | ||
| 113 | return 0; | 115 | return 0; |
diff --git a/drivers/hid/usbhid/hid-lgff.c b/drivers/hid/hid-lgff.c index 4b7ab6a46d93..51aff08e10ce 100644 --- a/drivers/hid/usbhid/hid-lgff.c +++ b/drivers/hid/hid-lgff.c | |||
| @@ -30,7 +30,9 @@ | |||
| 30 | #include <linux/input.h> | 30 | #include <linux/input.h> |
| 31 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
| 32 | #include <linux/hid.h> | 32 | #include <linux/hid.h> |
| 33 | #include "usbhid.h" | 33 | |
| 34 | #include "usbhid/usbhid.h" | ||
| 35 | #include "hid-lg.h" | ||
| 34 | 36 | ||
| 35 | struct dev_type { | 37 | struct dev_type { |
| 36 | u16 idVendor; | 38 | u16 idVendor; |
| @@ -48,6 +50,12 @@ static const signed short ff_joystick[] = { | |||
| 48 | -1 | 50 | -1 |
| 49 | }; | 51 | }; |
| 50 | 52 | ||
| 53 | static const signed short ff_wheel[] = { | ||
| 54 | FF_CONSTANT, | ||
| 55 | FF_AUTOCENTER, | ||
| 56 | -1 | ||
| 57 | }; | ||
| 58 | |||
| 51 | static const struct dev_type devices[] = { | 59 | static const struct dev_type devices[] = { |
| 52 | { 0x046d, 0xc211, ff_rumble }, | 60 | { 0x046d, 0xc211, ff_rumble }, |
| 53 | { 0x046d, 0xc219, ff_rumble }, | 61 | { 0x046d, 0xc219, ff_rumble }, |
| @@ -55,7 +63,7 @@ static const struct dev_type devices[] = { | |||
| 55 | { 0x046d, 0xc286, ff_joystick }, | 63 | { 0x046d, 0xc286, ff_joystick }, |
| 56 | { 0x046d, 0xc294, ff_joystick }, | 64 | { 0x046d, 0xc294, ff_joystick }, |
| 57 | { 0x046d, 0xc295, ff_joystick }, | 65 | { 0x046d, 0xc295, ff_joystick }, |
| 58 | { 0x046d, 0xca03, ff_joystick }, | 66 | { 0x046d, 0xca03, ff_wheel }, |
| 59 | }; | 67 | }; |
| 60 | 68 | ||
| 61 | static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *effect) | 69 | static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *effect) |
| @@ -100,7 +108,24 @@ static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *ef | |||
| 100 | return 0; | 108 | return 0; |
| 101 | } | 109 | } |
| 102 | 110 | ||
| 103 | int hid_lgff_init(struct hid_device* hid) | 111 | static void hid_lgff_set_autocenter(struct input_dev *dev, u16 magnitude) |
| 112 | { | ||
| 113 | struct hid_device *hid = input_get_drvdata(dev); | ||
| 114 | struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; | ||
| 115 | struct hid_report *report = list_entry(report_list->next, struct hid_report, list); | ||
| 116 | __s32 *value = report->field[0]->value; | ||
| 117 | magnitude = (magnitude >> 12) & 0xf; | ||
| 118 | *value++ = 0xfe; | ||
| 119 | *value++ = 0x0d; | ||
| 120 | *value++ = magnitude; /* clockwise strength */ | ||
| 121 | *value++ = magnitude; /* counter-clockwise strength */ | ||
| 122 | *value++ = 0x80; | ||
| 123 | *value++ = 0x00; | ||
| 124 | *value = 0x00; | ||
| 125 | usbhid_submit_report(hid, report, USB_DIR_OUT); | ||
| 126 | } | ||
| 127 | |||
| 128 | int lgff_init(struct hid_device* hid) | ||
| 104 | { | 129 | { |
| 105 | struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); | 130 | struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); |
| 106 | struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; | 131 | struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; |
| @@ -145,6 +170,9 @@ int hid_lgff_init(struct hid_device* hid) | |||
| 145 | if (error) | 170 | if (error) |
| 146 | return error; | 171 | return error; |
| 147 | 172 | ||
| 173 | if ( test_bit(FF_AUTOCENTER, dev->ffbit) ) | ||
| 174 | dev->ff->set_autocenter = hid_lgff_set_autocenter; | ||
| 175 | |||
| 148 | printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n"); | 176 | printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n"); |
| 149 | 177 | ||
| 150 | return 0; | 178 | return 0; |
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c new file mode 100644 index 000000000000..d718b1607d0f --- /dev/null +++ b/drivers/hid/hid-microsoft.c | |||
| @@ -0,0 +1,219 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some microsoft "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/input.h> | ||
| 21 | #include <linux/hid.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | #define MS_HIDINPUT 0x01 | ||
| 27 | #define MS_ERGONOMY 0x02 | ||
| 28 | #define MS_PRESENTER 0x04 | ||
| 29 | #define MS_RDESC 0x08 | ||
| 30 | #define MS_NOGET 0x10 | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Microsoft Wireless Desktop Receiver (Model 1028) has several | ||
| 34 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
| 35 | */ | ||
| 36 | static void ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 37 | unsigned int rsize) | ||
| 38 | { | ||
| 39 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 40 | |||
| 41 | if ((quirks & MS_RDESC) && rsize == 571 && rdesc[284] == 0x19 && | ||
| 42 | rdesc[286] == 0x2a && rdesc[304] == 0x19 && | ||
| 43 | rdesc[306] == 0x29 && rdesc[352] == 0x1a && | ||
| 44 | rdesc[355] == 0x2a && rdesc[557] == 0x19 && | ||
| 45 | rdesc[559] == 0x29) { | ||
| 46 | dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver " | ||
| 47 | "Model 1028 report descriptor\n"); | ||
| 48 | rdesc[284] = rdesc[304] = rdesc[557] = 0x35; | ||
| 49 | rdesc[352] = 0x36; | ||
| 50 | rdesc[286] = rdesc[355] = 0x46; | ||
| 51 | rdesc[306] = rdesc[559] = 0x45; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | #define ms_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 56 | EV_KEY, (c)) | ||
| 57 | static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage, | ||
| 58 | unsigned long **bit, int *max) | ||
| 59 | { | ||
| 60 | struct input_dev *input = hi->input; | ||
| 61 | |||
| 62 | switch (usage->hid & HID_USAGE) { | ||
| 63 | case 0xfd06: ms_map_key_clear(KEY_CHAT); break; | ||
| 64 | case 0xfd07: ms_map_key_clear(KEY_PHONE); break; | ||
| 65 | case 0xff05: | ||
| 66 | set_bit(EV_REP, input->evbit); | ||
| 67 | ms_map_key_clear(KEY_F13); | ||
| 68 | set_bit(KEY_F14, input->keybit); | ||
| 69 | set_bit(KEY_F15, input->keybit); | ||
| 70 | set_bit(KEY_F16, input->keybit); | ||
| 71 | set_bit(KEY_F17, input->keybit); | ||
| 72 | set_bit(KEY_F18, input->keybit); | ||
| 73 | default: | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | return 1; | ||
| 77 | } | ||
| 78 | |||
| 79 | static int ms_presenter_8k_quirk(struct hid_input *hi, struct hid_usage *usage, | ||
| 80 | unsigned long **bit, int *max) | ||
| 81 | { | ||
| 82 | set_bit(EV_REP, hi->input->evbit); | ||
| 83 | switch (usage->hid & HID_USAGE) { | ||
| 84 | case 0xfd08: ms_map_key_clear(KEY_FORWARD); break; | ||
| 85 | case 0xfd09: ms_map_key_clear(KEY_BACK); break; | ||
| 86 | case 0xfd0b: ms_map_key_clear(KEY_PLAYPAUSE); break; | ||
| 87 | case 0xfd0e: ms_map_key_clear(KEY_CLOSE); break; | ||
| 88 | case 0xfd0f: ms_map_key_clear(KEY_PLAY); break; | ||
| 89 | default: | ||
| 90 | return 0; | ||
| 91 | } | ||
| 92 | return 1; | ||
| 93 | } | ||
| 94 | |||
| 95 | static int ms_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 96 | struct hid_field *field, struct hid_usage *usage, | ||
| 97 | unsigned long **bit, int *max) | ||
| 98 | { | ||
| 99 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 100 | |||
| 101 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) | ||
| 102 | return 0; | ||
| 103 | |||
| 104 | if (quirks & MS_ERGONOMY) { | ||
| 105 | int ret = ms_ergonomy_kb_quirk(hi, usage, bit, max); | ||
| 106 | if (ret) | ||
| 107 | return ret; | ||
| 108 | } | ||
| 109 | |||
| 110 | if ((quirks & MS_PRESENTER) && | ||
| 111 | ms_presenter_8k_quirk(hi, usage, bit, max)) | ||
| 112 | return 1; | ||
| 113 | |||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | static int ms_event(struct hid_device *hdev, struct hid_field *field, | ||
| 118 | struct hid_usage *usage, __s32 value) | ||
| 119 | { | ||
| 120 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | ||
| 121 | |||
| 122 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || | ||
| 123 | !usage->type) | ||
| 124 | return 0; | ||
| 125 | |||
| 126 | /* Handling MS keyboards special buttons */ | ||
| 127 | if (quirks & MS_ERGONOMY && usage->hid == (HID_UP_MSVENDOR | 0xff05)) { | ||
| 128 | struct input_dev *input = field->hidinput->input; | ||
| 129 | static unsigned int last_key = 0; | ||
| 130 | unsigned int key = 0; | ||
| 131 | switch (value) { | ||
| 132 | case 0x01: key = KEY_F14; break; | ||
| 133 | case 0x02: key = KEY_F15; break; | ||
| 134 | case 0x04: key = KEY_F16; break; | ||
| 135 | case 0x08: key = KEY_F17; break; | ||
| 136 | case 0x10: key = KEY_F18; break; | ||
| 137 | } | ||
| 138 | if (key) { | ||
| 139 | input_event(input, usage->type, key, 1); | ||
| 140 | last_key = key; | ||
| 141 | } else | ||
| 142 | input_event(input, usage->type, last_key, 0); | ||
| 143 | |||
| 144 | return 1; | ||
| 145 | } | ||
| 146 | |||
| 147 | return 0; | ||
| 148 | } | ||
| 149 | |||
| 150 | static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 151 | { | ||
| 152 | unsigned long quirks = id->driver_data; | ||
| 153 | int ret; | ||
| 154 | |||
| 155 | hid_set_drvdata(hdev, (void *)quirks); | ||
| 156 | |||
| 157 | if (quirks & MS_NOGET) | ||
| 158 | hdev->quirks |= HID_QUIRK_NOGET; | ||
| 159 | |||
| 160 | ret = hid_parse(hdev); | ||
| 161 | if (ret) { | ||
| 162 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 163 | goto err_free; | ||
| 164 | } | ||
| 165 | |||
| 166 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | ((quirks & MS_HIDINPUT) ? | ||
| 167 | HID_CONNECT_HIDINPUT_FORCE : 0)); | ||
| 168 | if (ret) { | ||
| 169 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 170 | goto err_free; | ||
| 171 | } | ||
| 172 | |||
| 173 | return 0; | ||
| 174 | err_free: | ||
| 175 | return ret; | ||
| 176 | } | ||
| 177 | |||
| 178 | static const struct hid_device_id ms_devices[] = { | ||
| 179 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV), | ||
| 180 | .driver_data = MS_HIDINPUT }, | ||
| 181 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K), | ||
| 182 | .driver_data = MS_ERGONOMY }, | ||
| 183 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), | ||
| 184 | .driver_data = MS_ERGONOMY | MS_RDESC }, | ||
| 185 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), | ||
| 186 | .driver_data = MS_PRESENTER }, | ||
| 187 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), | ||
| 188 | .driver_data = MS_NOGET }, | ||
| 189 | |||
| 190 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), | ||
| 191 | .driver_data = MS_PRESENTER }, | ||
| 192 | { } | ||
| 193 | }; | ||
| 194 | MODULE_DEVICE_TABLE(hid, ms_devices); | ||
| 195 | |||
| 196 | static struct hid_driver ms_driver = { | ||
| 197 | .name = "microsoft", | ||
| 198 | .id_table = ms_devices, | ||
| 199 | .report_fixup = ms_report_fixup, | ||
| 200 | .input_mapping = ms_input_mapping, | ||
| 201 | .event = ms_event, | ||
| 202 | .probe = ms_probe, | ||
| 203 | }; | ||
| 204 | |||
| 205 | static int ms_init(void) | ||
| 206 | { | ||
| 207 | return hid_register_driver(&ms_driver); | ||
| 208 | } | ||
| 209 | |||
| 210 | static void ms_exit(void) | ||
| 211 | { | ||
| 212 | hid_unregister_driver(&ms_driver); | ||
| 213 | } | ||
| 214 | |||
| 215 | module_init(ms_init); | ||
| 216 | module_exit(ms_exit); | ||
| 217 | MODULE_LICENSE("GPL"); | ||
| 218 | |||
| 219 | HID_COMPAT_LOAD_DRIVER(microsoft); | ||
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c new file mode 100644 index 000000000000..f3a85a065f18 --- /dev/null +++ b/drivers/hid/hid-monterey.c | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some monterey "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | |||
| 25 | static void mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 26 | unsigned int rsize) | ||
| 27 | { | ||
| 28 | if (rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { | ||
| 29 | dev_info(&hdev->dev, "fixing up button/consumer in HID report " | ||
| 30 | "descriptor\n"); | ||
| 31 | rdesc[30] = 0x0c; | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | #define mr_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 36 | EV_KEY, (c)) | ||
| 37 | static int mr_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 38 | struct hid_field *field, struct hid_usage *usage, | ||
| 39 | unsigned long **bit, int *max) | ||
| 40 | { | ||
| 41 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 42 | return 0; | ||
| 43 | |||
| 44 | switch (usage->hid & HID_USAGE) { | ||
| 45 | case 0x156: mr_map_key_clear(KEY_WORDPROCESSOR); break; | ||
| 46 | case 0x157: mr_map_key_clear(KEY_SPREADSHEET); break; | ||
| 47 | case 0x158: mr_map_key_clear(KEY_PRESENTATION); break; | ||
| 48 | case 0x15c: mr_map_key_clear(KEY_STOP); break; | ||
| 49 | default: | ||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | return 1; | ||
| 53 | } | ||
| 54 | |||
| 55 | static const struct hid_device_id mr_devices[] = { | ||
| 56 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, | ||
| 57 | { } | ||
| 58 | }; | ||
| 59 | MODULE_DEVICE_TABLE(hid, mr_devices); | ||
| 60 | |||
| 61 | static struct hid_driver mr_driver = { | ||
| 62 | .name = "monterey", | ||
| 63 | .id_table = mr_devices, | ||
| 64 | .report_fixup = mr_report_fixup, | ||
| 65 | .input_mapping = mr_input_mapping, | ||
| 66 | }; | ||
| 67 | |||
| 68 | static int mr_init(void) | ||
| 69 | { | ||
| 70 | return hid_register_driver(&mr_driver); | ||
| 71 | } | ||
| 72 | |||
| 73 | static void mr_exit(void) | ||
| 74 | { | ||
| 75 | hid_unregister_driver(&mr_driver); | ||
| 76 | } | ||
| 77 | |||
| 78 | module_init(mr_init); | ||
| 79 | module_exit(mr_exit); | ||
| 80 | MODULE_LICENSE("GPL"); | ||
| 81 | |||
| 82 | HID_COMPAT_LOAD_DRIVER(monterey); | ||
diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c new file mode 100644 index 000000000000..10945fe12d50 --- /dev/null +++ b/drivers/hid/hid-petalynx.c | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some petalynx "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | |||
| 25 | /* Petalynx Maxter Remote has maximum for consumer page set too low */ | ||
| 26 | static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 27 | unsigned int rsize) | ||
| 28 | { | ||
| 29 | if (rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && | ||
| 30 | rdesc[41] == 0x00 && rdesc[59] == 0x26 && | ||
| 31 | rdesc[60] == 0xf9 && rdesc[61] == 0x00) { | ||
| 32 | dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report " | ||
| 33 | "descriptor\n"); | ||
| 34 | rdesc[60] = 0xfa; | ||
| 35 | rdesc[40] = 0xfa; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | #define pl_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 40 | EV_KEY, (c)) | ||
| 41 | static int pl_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 42 | struct hid_field *field, struct hid_usage *usage, | ||
| 43 | unsigned long **bit, int *max) | ||
| 44 | { | ||
| 45 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_LOGIVENDOR) { | ||
| 46 | switch (usage->hid & HID_USAGE) { | ||
| 47 | case 0x05a: pl_map_key_clear(KEY_TEXT); break; | ||
| 48 | case 0x05b: pl_map_key_clear(KEY_RED); break; | ||
| 49 | case 0x05c: pl_map_key_clear(KEY_GREEN); break; | ||
| 50 | case 0x05d: pl_map_key_clear(KEY_YELLOW); break; | ||
| 51 | case 0x05e: pl_map_key_clear(KEY_BLUE); break; | ||
| 52 | default: | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | return 1; | ||
| 56 | } | ||
| 57 | |||
| 58 | if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) { | ||
| 59 | switch (usage->hid & HID_USAGE) { | ||
| 60 | case 0x0f6: pl_map_key_clear(KEY_NEXT); break; | ||
| 61 | case 0x0fa: pl_map_key_clear(KEY_BACK); break; | ||
| 62 | default: | ||
| 63 | return 0; | ||
| 64 | } | ||
| 65 | return 1; | ||
| 66 | } | ||
| 67 | |||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 71 | static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 72 | { | ||
| 73 | int ret; | ||
| 74 | |||
| 75 | hdev->quirks |= HID_QUIRK_NOGET; | ||
| 76 | |||
| 77 | ret = hid_parse(hdev); | ||
| 78 | if (ret) { | ||
| 79 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 80 | goto err_free; | ||
| 81 | } | ||
| 82 | |||
| 83 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 84 | if (ret) { | ||
| 85 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 86 | goto err_free; | ||
| 87 | } | ||
| 88 | |||
| 89 | return 0; | ||
| 90 | err_free: | ||
| 91 | return ret; | ||
| 92 | } | ||
| 93 | |||
| 94 | static const struct hid_device_id pl_devices[] = { | ||
| 95 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | ||
| 96 | { } | ||
| 97 | }; | ||
| 98 | MODULE_DEVICE_TABLE(hid, pl_devices); | ||
| 99 | |||
| 100 | static struct hid_driver pl_driver = { | ||
| 101 | .name = "petalynx", | ||
| 102 | .id_table = pl_devices, | ||
| 103 | .report_fixup = pl_report_fixup, | ||
| 104 | .input_mapping = pl_input_mapping, | ||
| 105 | .probe = pl_probe, | ||
| 106 | }; | ||
| 107 | |||
| 108 | static int pl_init(void) | ||
| 109 | { | ||
| 110 | return hid_register_driver(&pl_driver); | ||
| 111 | } | ||
| 112 | |||
| 113 | static void pl_exit(void) | ||
| 114 | { | ||
| 115 | hid_unregister_driver(&pl_driver); | ||
| 116 | } | ||
| 117 | |||
| 118 | module_init(pl_init); | ||
| 119 | module_exit(pl_exit); | ||
| 120 | MODULE_LICENSE("GPL"); | ||
| 121 | |||
| 122 | HID_COMPAT_LOAD_DRIVER(petalynx); | ||
diff --git a/drivers/hid/usbhid/hid-plff.c b/drivers/hid/hid-pl.c index 9eb83cf9d22b..acd815586182 100644 --- a/drivers/hid/usbhid/hid-plff.c +++ b/drivers/hid/hid-pl.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | * - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT) | 9 | * - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT) |
| 10 | * | 10 | * |
| 11 | * 0e8f:0003 "GreenAsia Inc. USB Joystick " | 11 | * 0e8f:0003 "GreenAsia Inc. USB Joystick " |
| 12 | * - tested with Köng Gaming gamepad | 12 | * - tested with K??ng Gaming gamepad |
| 13 | * | 13 | * |
| 14 | * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com> | 14 | * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com> |
| 15 | */ | 15 | */ |
| @@ -38,7 +38,11 @@ | |||
| 38 | #include <linux/input.h> | 38 | #include <linux/input.h> |
| 39 | #include <linux/usb.h> | 39 | #include <linux/usb.h> |
| 40 | #include <linux/hid.h> | 40 | #include <linux/hid.h> |
| 41 | #include "usbhid.h" | 41 | |
| 42 | #include "hid-ids.h" | ||
| 43 | |||
| 44 | #ifdef CONFIG_PANTHERLORD_FF | ||
| 45 | #include "usbhid/usbhid.h" | ||
| 42 | 46 | ||
| 43 | struct plff_device { | 47 | struct plff_device { |
| 44 | struct hid_report *report; | 48 | struct hid_report *report; |
| @@ -66,7 +70,7 @@ static int hid_plff_play(struct input_dev *dev, void *data, | |||
| 66 | return 0; | 70 | return 0; |
| 67 | } | 71 | } |
| 68 | 72 | ||
| 69 | int hid_plff_init(struct hid_device *hid) | 73 | static int plff_init(struct hid_device *hid) |
| 70 | { | 74 | { |
| 71 | struct plff_device *plff; | 75 | struct plff_device *plff; |
| 72 | struct hid_report *report; | 76 | struct hid_report *report; |
| @@ -86,7 +90,7 @@ int hid_plff_init(struct hid_device *hid) | |||
| 86 | currently unknown. */ | 90 | currently unknown. */ |
| 87 | 91 | ||
| 88 | if (list_empty(report_list)) { | 92 | if (list_empty(report_list)) { |
| 89 | printk(KERN_ERR "hid-plff: no output reports found\n"); | 93 | dev_err(&hid->dev, "no output reports found\n"); |
| 90 | return -ENODEV; | 94 | return -ENODEV; |
| 91 | } | 95 | } |
| 92 | 96 | ||
| @@ -95,18 +99,19 @@ int hid_plff_init(struct hid_device *hid) | |||
| 95 | report_ptr = report_ptr->next; | 99 | report_ptr = report_ptr->next; |
| 96 | 100 | ||
| 97 | if (report_ptr == report_list) { | 101 | if (report_ptr == report_list) { |
| 98 | printk(KERN_ERR "hid-plff: required output report is missing\n"); | 102 | dev_err(&hid->dev, "required output report is " |
| 103 | "missing\n"); | ||
| 99 | return -ENODEV; | 104 | return -ENODEV; |
| 100 | } | 105 | } |
| 101 | 106 | ||
| 102 | report = list_entry(report_ptr, struct hid_report, list); | 107 | report = list_entry(report_ptr, struct hid_report, list); |
| 103 | if (report->maxfield < 1) { | 108 | if (report->maxfield < 1) { |
| 104 | printk(KERN_ERR "hid-plff: no fields in the report\n"); | 109 | dev_err(&hid->dev, "no fields in the report\n"); |
| 105 | return -ENODEV; | 110 | return -ENODEV; |
| 106 | } | 111 | } |
| 107 | 112 | ||
| 108 | if (report->field[0]->report_count < 4) { | 113 | if (report->field[0]->report_count < 4) { |
| 109 | printk(KERN_ERR "hid-plff: not enough values in the field\n"); | 114 | dev_err(&hid->dev, "not enough values in the field\n"); |
| 110 | return -ENODEV; | 115 | return -ENODEV; |
| 111 | } | 116 | } |
| 112 | 117 | ||
| @@ -132,8 +137,70 @@ int hid_plff_init(struct hid_device *hid) | |||
| 132 | usbhid_submit_report(hid, plff->report, USB_DIR_OUT); | 137 | usbhid_submit_report(hid, plff->report, USB_DIR_OUT); |
| 133 | } | 138 | } |
| 134 | 139 | ||
| 135 | printk(KERN_INFO "hid-plff: Force feedback for PantherLord/GreenAsia " | 140 | dev_info(&hid->dev, "Force feedback for PantherLord/GreenAsia " |
| 136 | "devices by Anssi Hannula <anssi.hannula@gmail.com>\n"); | 141 | "devices by Anssi Hannula <anssi.hannula@gmail.com>\n"); |
| 137 | 142 | ||
| 138 | return 0; | 143 | return 0; |
| 139 | } | 144 | } |
| 145 | #else | ||
| 146 | static inline int plff_init(struct hid_device *hid) | ||
| 147 | { | ||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | #endif | ||
| 151 | |||
| 152 | static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 153 | { | ||
| 154 | int ret; | ||
| 155 | |||
| 156 | if (id->driver_data) | ||
| 157 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; | ||
| 158 | |||
| 159 | ret = hid_parse(hdev); | ||
| 160 | if (ret) { | ||
| 161 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 162 | goto err; | ||
| 163 | } | ||
| 164 | |||
| 165 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); | ||
| 166 | if (ret) { | ||
| 167 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 168 | goto err; | ||
| 169 | } | ||
| 170 | |||
| 171 | plff_init(hdev); | ||
| 172 | |||
| 173 | return 0; | ||
| 174 | err: | ||
| 175 | return ret; | ||
| 176 | } | ||
| 177 | |||
| 178 | static const struct hid_device_id pl_devices[] = { | ||
| 179 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR), | ||
| 180 | .driver_data = 1 }, /* Twin USB Joystick */ | ||
| 181 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), }, /* GreenAsia Inc. USB Joystick */ | ||
| 182 | { } | ||
| 183 | }; | ||
| 184 | MODULE_DEVICE_TABLE(hid, pl_devices); | ||
| 185 | |||
| 186 | static struct hid_driver pl_driver = { | ||
| 187 | .name = "pantherlord", | ||
| 188 | .id_table = pl_devices, | ||
| 189 | .probe = pl_probe, | ||
| 190 | }; | ||
| 191 | |||
| 192 | static int pl_init(void) | ||
| 193 | { | ||
| 194 | return hid_register_driver(&pl_driver); | ||
| 195 | } | ||
| 196 | |||
| 197 | static void pl_exit(void) | ||
| 198 | { | ||
| 199 | hid_unregister_driver(&pl_driver); | ||
| 200 | } | ||
| 201 | |||
| 202 | module_init(pl_init); | ||
| 203 | module_exit(pl_exit); | ||
| 204 | MODULE_LICENSE("GPL"); | ||
| 205 | |||
| 206 | HID_COMPAT_LOAD_DRIVER(pantherlord); | ||
diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c new file mode 100644 index 000000000000..15f3c0492450 --- /dev/null +++ b/drivers/hid/hid-samsung.c | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some samsung "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Samsung IrDA remote controller (reports as Cypress USB Mouse). | ||
| 27 | * | ||
| 28 | * Vendor specific report #4 has a size of 48 bit, | ||
| 29 | * and therefore is not accepted when inspecting the descriptors. | ||
| 30 | * As a workaround we reinterpret the report as: | ||
| 31 | * Variable type, count 6, size 8 bit, log. maximum 255 | ||
| 32 | * The burden to reconstruct the data is moved into user space. | ||
| 33 | */ | ||
| 34 | static void samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 35 | unsigned int rsize) | ||
| 36 | { | ||
| 37 | if (rsize >= 182 && rdesc[175] == 0x25 && rdesc[176] == 0x40 && | ||
| 38 | rdesc[177] == 0x75 && rdesc[178] == 0x30 && | ||
| 39 | rdesc[179] == 0x95 && rdesc[180] == 0x01 && | ||
| 40 | rdesc[182] == 0x40) { | ||
| 41 | dev_info(&hdev->dev, "fixing up Samsung IrDA report " | ||
| 42 | "descriptor\n"); | ||
| 43 | rdesc[176] = 0xff; | ||
| 44 | rdesc[178] = 0x08; | ||
| 45 | rdesc[180] = 0x06; | ||
| 46 | rdesc[182] = 0x42; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | static int samsung_probe(struct hid_device *hdev, | ||
| 51 | const struct hid_device_id *id) | ||
| 52 | { | ||
| 53 | int ret; | ||
| 54 | |||
| 55 | ret = hid_parse(hdev); | ||
| 56 | if (ret) { | ||
| 57 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 58 | goto err_free; | ||
| 59 | } | ||
| 60 | |||
| 61 | ret = hid_hw_start(hdev, (HID_CONNECT_DEFAULT & ~HID_CONNECT_HIDINPUT) | | ||
| 62 | HID_CONNECT_HIDDEV_FORCE); | ||
| 63 | if (ret) { | ||
| 64 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 65 | goto err_free; | ||
| 66 | } | ||
| 67 | |||
| 68 | return 0; | ||
| 69 | err_free: | ||
| 70 | return ret; | ||
| 71 | } | ||
| 72 | |||
| 73 | static const struct hid_device_id samsung_devices[] = { | ||
| 74 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | ||
| 75 | { } | ||
| 76 | }; | ||
| 77 | MODULE_DEVICE_TABLE(hid, samsung_devices); | ||
| 78 | |||
| 79 | static struct hid_driver samsung_driver = { | ||
| 80 | .name = "samsung", | ||
| 81 | .id_table = samsung_devices, | ||
| 82 | .report_fixup = samsung_report_fixup, | ||
| 83 | .probe = samsung_probe, | ||
| 84 | }; | ||
| 85 | |||
| 86 | static int samsung_init(void) | ||
| 87 | { | ||
| 88 | return hid_register_driver(&samsung_driver); | ||
| 89 | } | ||
| 90 | |||
| 91 | static void samsung_exit(void) | ||
| 92 | { | ||
| 93 | hid_unregister_driver(&samsung_driver); | ||
| 94 | } | ||
| 95 | |||
| 96 | module_init(samsung_init); | ||
| 97 | module_exit(samsung_exit); | ||
| 98 | MODULE_LICENSE("GPL"); | ||
| 99 | |||
| 100 | HID_COMPAT_LOAD_DRIVER(samsung); | ||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c new file mode 100644 index 000000000000..3af8095a7de1 --- /dev/null +++ b/drivers/hid/hid-sony.c | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some sony "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | #include <linux/usb.h> | ||
| 23 | |||
| 24 | #include "hid-ids.h" | ||
| 25 | |||
| 26 | /* | ||
| 27 | * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller | ||
| 28 | * to "operational". Without this, the ps3 controller will not report any | ||
| 29 | * events. | ||
| 30 | */ | ||
| 31 | static int sony_set_operational(struct hid_device *hdev) | ||
| 32 | { | ||
| 33 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
| 34 | struct usb_device *dev = interface_to_usbdev(intf); | ||
| 35 | __u16 ifnum = intf->cur_altsetting->desc.bInterfaceNumber; | ||
| 36 | int ret; | ||
| 37 | char *buf = kmalloc(18, GFP_KERNEL); | ||
| 38 | |||
| 39 | if (!buf) | ||
| 40 | return -ENOMEM; | ||
| 41 | |||
| 42 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
| 43 | HID_REQ_GET_REPORT, | ||
| 44 | USB_DIR_IN | USB_TYPE_CLASS | | ||
| 45 | USB_RECIP_INTERFACE, | ||
| 46 | (3 << 8) | 0xf2, ifnum, buf, 17, | ||
| 47 | USB_CTRL_GET_TIMEOUT); | ||
| 48 | if (ret < 0) | ||
| 49 | dev_err(&hdev->dev, "can't set operational mode\n"); | ||
| 50 | |||
| 51 | kfree(buf); | ||
| 52 | |||
| 53 | return ret; | ||
| 54 | } | ||
| 55 | |||
| 56 | static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 57 | { | ||
| 58 | int ret; | ||
| 59 | |||
| 60 | ret = hid_parse(hdev); | ||
| 61 | if (ret) { | ||
| 62 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 63 | goto err_free; | ||
| 64 | } | ||
| 65 | |||
| 66 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | | ||
| 67 | HID_CONNECT_HIDDEV_FORCE); | ||
| 68 | if (ret) { | ||
| 69 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 70 | goto err_free; | ||
| 71 | } | ||
| 72 | |||
| 73 | ret = sony_set_operational(hdev); | ||
| 74 | if (ret) | ||
| 75 | goto err_stop; | ||
| 76 | |||
| 77 | return 0; | ||
| 78 | err_stop: | ||
| 79 | hid_hw_stop(hdev); | ||
| 80 | err_free: | ||
| 81 | return ret; | ||
| 82 | } | ||
| 83 | |||
| 84 | static const struct hid_device_id sony_devices[] = { | ||
| 85 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
| 86 | { } | ||
| 87 | }; | ||
| 88 | MODULE_DEVICE_TABLE(hid, sony_devices); | ||
| 89 | |||
| 90 | static struct hid_driver sony_driver = { | ||
| 91 | .name = "sony", | ||
| 92 | .id_table = sony_devices, | ||
| 93 | .probe = sony_probe, | ||
| 94 | }; | ||
| 95 | |||
| 96 | static int sony_init(void) | ||
| 97 | { | ||
| 98 | return hid_register_driver(&sony_driver); | ||
| 99 | } | ||
| 100 | |||
| 101 | static void sony_exit(void) | ||
| 102 | { | ||
| 103 | hid_unregister_driver(&sony_driver); | ||
| 104 | } | ||
| 105 | |||
| 106 | module_init(sony_init); | ||
| 107 | module_exit(sony_exit); | ||
| 108 | MODULE_LICENSE("GPL"); | ||
| 109 | |||
| 110 | HID_COMPAT_LOAD_DRIVER(sony); | ||
diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c new file mode 100644 index 000000000000..5ba68f7dbb78 --- /dev/null +++ b/drivers/hid/hid-sunplus.c | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for some sunplus "special" devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2007 Paul Walmsley | ||
| 9 | * Copyright (c) 2008 Jiri Slaby | ||
| 10 | */ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This program is free software; you can redistribute it and/or modify it | ||
| 14 | * under the terms of the GNU General Public License as published by the Free | ||
| 15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/hid.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | |||
| 23 | #include "hid-ids.h" | ||
| 24 | |||
| 25 | static void sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
| 26 | unsigned int rsize) | ||
| 27 | { | ||
| 28 | if (rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && | ||
| 29 | rdesc[106] == 0x03) { | ||
| 30 | dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop " | ||
| 31 | "report descriptor\n"); | ||
| 32 | rdesc[105] = rdesc[110] = 0x03; | ||
| 33 | rdesc[106] = rdesc[111] = 0x21; | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | #define sp_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ | ||
| 38 | EV_KEY, (c)) | ||
| 39 | static int sp_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
| 40 | struct hid_field *field, struct hid_usage *usage, | ||
| 41 | unsigned long **bit, int *max) | ||
| 42 | { | ||
| 43 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) | ||
| 44 | return 0; | ||
| 45 | |||
| 46 | switch (usage->hid & HID_USAGE) { | ||
| 47 | case 0x2003: sp_map_key_clear(KEY_ZOOMIN); break; | ||
| 48 | case 0x2103: sp_map_key_clear(KEY_ZOOMOUT); break; | ||
| 49 | default: | ||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | return 1; | ||
| 53 | } | ||
| 54 | |||
| 55 | static const struct hid_device_id sp_devices[] = { | ||
| 56 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | ||
| 57 | { } | ||
| 58 | }; | ||
| 59 | MODULE_DEVICE_TABLE(hid, sp_devices); | ||
| 60 | |||
| 61 | static struct hid_driver sp_driver = { | ||
| 62 | .name = "sunplus", | ||
| 63 | .id_table = sp_devices, | ||
| 64 | .report_fixup = sp_report_fixup, | ||
| 65 | .input_mapping = sp_input_mapping, | ||
| 66 | }; | ||
| 67 | |||
| 68 | static int sp_init(void) | ||
| 69 | { | ||
| 70 | return hid_register_driver(&sp_driver); | ||
| 71 | } | ||
| 72 | |||
| 73 | static void sp_exit(void) | ||
| 74 | { | ||
| 75 | hid_unregister_driver(&sp_driver); | ||
| 76 | } | ||
| 77 | |||
| 78 | module_init(sp_init); | ||
| 79 | module_exit(sp_exit); | ||
| 80 | MODULE_LICENSE("GPL"); | ||
| 81 | |||
| 82 | HID_COMPAT_LOAD_DRIVER(sunplus); | ||
diff --git a/drivers/hid/usbhid/hid-tmff.c b/drivers/hid/hid-tmff.c index 144578b1a00c..1b7cba0f7e1f 100644 --- a/drivers/hid/usbhid/hid-tmff.c +++ b/drivers/hid/hid-tmff.c | |||
| @@ -27,23 +27,17 @@ | |||
| 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include <linux/hid.h> | ||
| 30 | #include <linux/input.h> | 31 | #include <linux/input.h> |
| 31 | |||
| 32 | #undef DEBUG | ||
| 33 | #include <linux/usb.h> | 32 | #include <linux/usb.h> |
| 34 | 33 | ||
| 35 | #include <linux/hid.h> | 34 | #include "hid-ids.h" |
| 36 | #include "usbhid.h" | 35 | |
| 36 | #include "usbhid/usbhid.h" | ||
| 37 | 37 | ||
| 38 | /* Usages for thrustmaster devices I know about */ | 38 | /* Usages for thrustmaster devices I know about */ |
| 39 | #define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb) | 39 | #define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb) |
| 40 | 40 | ||
| 41 | struct dev_type { | ||
| 42 | u16 idVendor; | ||
| 43 | u16 idProduct; | ||
| 44 | const signed short *ff; | ||
| 45 | }; | ||
| 46 | |||
| 47 | static const signed short ff_rumble[] = { | 41 | static const signed short ff_rumble[] = { |
| 48 | FF_RUMBLE, | 42 | FF_RUMBLE, |
| 49 | -1 | 43 | -1 |
| @@ -54,21 +48,13 @@ static const signed short ff_joystick[] = { | |||
| 54 | -1 | 48 | -1 |
| 55 | }; | 49 | }; |
| 56 | 50 | ||
| 57 | static const struct dev_type devices[] = { | ||
| 58 | { 0x44f, 0xb300, ff_rumble }, | ||
| 59 | { 0x44f, 0xb304, ff_rumble }, | ||
| 60 | { 0x44f, 0xb651, ff_rumble }, /* FGT Rumble Force Wheel */ | ||
| 61 | { 0x44f, 0xb654, ff_joystick }, /* FGT Force Feedback Wheel */ | ||
| 62 | }; | ||
| 63 | |||
| 64 | struct tmff_device { | 51 | struct tmff_device { |
| 65 | struct hid_report *report; | 52 | struct hid_report *report; |
| 66 | struct hid_field *ff_field; | 53 | struct hid_field *ff_field; |
| 67 | }; | 54 | }; |
| 68 | 55 | ||
| 69 | /* Changes values from 0 to 0xffff into values from minimum to maximum */ | 56 | /* Changes values from 0 to 0xffff into values from minimum to maximum */ |
| 70 | static inline int hid_tmff_scale_u16(unsigned int in, | 57 | static inline int tmff_scale_u16(unsigned int in, int minimum, int maximum) |
| 71 | int minimum, int maximum) | ||
| 72 | { | 58 | { |
| 73 | int ret; | 59 | int ret; |
| 74 | 60 | ||
| @@ -81,8 +67,7 @@ static inline int hid_tmff_scale_u16(unsigned int in, | |||
| 81 | } | 67 | } |
| 82 | 68 | ||
| 83 | /* Changes values from -0x80 to 0x7f into values from minimum to maximum */ | 69 | /* Changes values from -0x80 to 0x7f into values from minimum to maximum */ |
| 84 | static inline int hid_tmff_scale_s8(int in, | 70 | static inline int tmff_scale_s8(int in, int minimum, int maximum) |
| 85 | int minimum, int maximum) | ||
| 86 | { | 71 | { |
| 87 | int ret; | 72 | int ret; |
| 88 | 73 | ||
| @@ -94,7 +79,8 @@ static inline int hid_tmff_scale_s8(int in, | |||
| 94 | return ret; | 79 | return ret; |
| 95 | } | 80 | } |
| 96 | 81 | ||
| 97 | static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *effect) | 82 | static int tmff_play(struct input_dev *dev, void *data, |
| 83 | struct ff_effect *effect) | ||
| 98 | { | 84 | { |
| 99 | struct hid_device *hid = input_get_drvdata(dev); | 85 | struct hid_device *hid = input_get_drvdata(dev); |
| 100 | struct tmff_device *tmff = data; | 86 | struct tmff_device *tmff = data; |
| @@ -104,10 +90,10 @@ static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *ef | |||
| 104 | 90 | ||
| 105 | switch (effect->type) { | 91 | switch (effect->type) { |
| 106 | case FF_CONSTANT: | 92 | case FF_CONSTANT: |
| 107 | x = hid_tmff_scale_s8(effect->u.ramp.start_level, | 93 | x = tmff_scale_s8(effect->u.ramp.start_level, |
| 108 | ff_field->logical_minimum, | 94 | ff_field->logical_minimum, |
| 109 | ff_field->logical_maximum); | 95 | ff_field->logical_maximum); |
| 110 | y = hid_tmff_scale_s8(effect->u.ramp.end_level, | 96 | y = tmff_scale_s8(effect->u.ramp.end_level, |
| 111 | ff_field->logical_minimum, | 97 | ff_field->logical_minimum, |
| 112 | ff_field->logical_maximum); | 98 | ff_field->logical_maximum); |
| 113 | 99 | ||
| @@ -118,10 +104,10 @@ static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *ef | |||
| 118 | break; | 104 | break; |
| 119 | 105 | ||
| 120 | case FF_RUMBLE: | 106 | case FF_RUMBLE: |
| 121 | left = hid_tmff_scale_u16(effect->u.rumble.weak_magnitude, | 107 | left = tmff_scale_u16(effect->u.rumble.weak_magnitude, |
| 122 | ff_field->logical_minimum, | 108 | ff_field->logical_minimum, |
| 123 | ff_field->logical_maximum); | 109 | ff_field->logical_maximum); |
| 124 | right = hid_tmff_scale_u16(effect->u.rumble.strong_magnitude, | 110 | right = tmff_scale_u16(effect->u.rumble.strong_magnitude, |
| 125 | ff_field->logical_minimum, | 111 | ff_field->logical_minimum, |
| 126 | ff_field->logical_maximum); | 112 | ff_field->logical_maximum); |
| 127 | 113 | ||
| @@ -134,14 +120,14 @@ static int hid_tmff_play(struct input_dev *dev, void *data, struct ff_effect *ef | |||
| 134 | return 0; | 120 | return 0; |
| 135 | } | 121 | } |
| 136 | 122 | ||
| 137 | int hid_tmff_init(struct hid_device *hid) | 123 | static int tmff_init(struct hid_device *hid, const signed short *ff_bits) |
| 138 | { | 124 | { |
| 139 | struct tmff_device *tmff; | 125 | struct tmff_device *tmff; |
| 140 | struct hid_report *report; | 126 | struct hid_report *report; |
| 141 | struct list_head *report_list; | 127 | struct list_head *report_list; |
| 142 | struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); | 128 | struct hid_input *hidinput = list_entry(hid->inputs.next, |
| 129 | struct hid_input, list); | ||
| 143 | struct input_dev *input_dev = hidinput->input; | 130 | struct input_dev *input_dev = hidinput->input; |
| 144 | const signed short *ff_bits = ff_joystick; | ||
| 145 | int error; | 131 | int error; |
| 146 | int i; | 132 | int i; |
| 147 | 133 | ||
| @@ -163,63 +149,121 @@ int hid_tmff_init(struct hid_device *hid) | |||
| 163 | switch (field->usage[0].hid) { | 149 | switch (field->usage[0].hid) { |
| 164 | case THRUSTMASTER_USAGE_FF: | 150 | case THRUSTMASTER_USAGE_FF: |
| 165 | if (field->report_count < 2) { | 151 | if (field->report_count < 2) { |
| 166 | warn("ignoring FF field with report_count < 2"); | 152 | dev_warn(&hid->dev, "ignoring FF field " |
| 153 | "with report_count < 2\n"); | ||
| 167 | continue; | 154 | continue; |
| 168 | } | 155 | } |
| 169 | 156 | ||
| 170 | if (field->logical_maximum == field->logical_minimum) { | 157 | if (field->logical_maximum == |
| 171 | warn("ignoring FF field with logical_maximum == logical_minimum"); | 158 | field->logical_minimum) { |
| 159 | dev_warn(&hid->dev, "ignoring FF field " | ||
| 160 | "with logical_maximum " | ||
| 161 | "== logical_minimum\n"); | ||
| 172 | continue; | 162 | continue; |
| 173 | } | 163 | } |
| 174 | 164 | ||
| 175 | if (tmff->report && tmff->report != report) { | 165 | if (tmff->report && tmff->report != report) { |
| 176 | warn("ignoring FF field in other report"); | 166 | dev_warn(&hid->dev, "ignoring FF field " |
| 167 | "in other report\n"); | ||
| 177 | continue; | 168 | continue; |
| 178 | } | 169 | } |
| 179 | 170 | ||
| 180 | if (tmff->ff_field && tmff->ff_field != field) { | 171 | if (tmff->ff_field && tmff->ff_field != field) { |
| 181 | warn("ignoring duplicate FF field"); | 172 | dev_warn(&hid->dev, "ignoring " |
| 173 | "duplicate FF field\n"); | ||
| 182 | continue; | 174 | continue; |
| 183 | } | 175 | } |
| 184 | 176 | ||
| 185 | tmff->report = report; | 177 | tmff->report = report; |
| 186 | tmff->ff_field = field; | 178 | tmff->ff_field = field; |
| 187 | 179 | ||
| 188 | for (i = 0; i < ARRAY_SIZE(devices); i++) { | ||
| 189 | if (input_dev->id.vendor == devices[i].idVendor && | ||
| 190 | input_dev->id.product == devices[i].idProduct) { | ||
| 191 | ff_bits = devices[i].ff; | ||
| 192 | break; | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | for (i = 0; ff_bits[i] >= 0; i++) | 180 | for (i = 0; ff_bits[i] >= 0; i++) |
| 197 | set_bit(ff_bits[i], input_dev->ffbit); | 181 | set_bit(ff_bits[i], input_dev->ffbit); |
| 198 | 182 | ||
| 199 | break; | 183 | break; |
| 200 | 184 | ||
| 201 | default: | 185 | default: |
| 202 | warn("ignoring unknown output usage %08x", field->usage[0].hid); | 186 | dev_warn(&hid->dev, "ignoring unknown output " |
| 187 | "usage %08x\n", | ||
| 188 | field->usage[0].hid); | ||
| 203 | continue; | 189 | continue; |
| 204 | } | 190 | } |
| 205 | } | 191 | } |
| 206 | } | 192 | } |
| 207 | 193 | ||
| 208 | if (!tmff->report) { | 194 | if (!tmff->report) { |
| 209 | err("cant find FF field in output reports\n"); | 195 | dev_err(&hid->dev, "can't find FF field in output reports\n"); |
| 210 | error = -ENODEV; | 196 | error = -ENODEV; |
| 211 | goto fail; | 197 | goto fail; |
| 212 | } | 198 | } |
| 213 | 199 | ||
| 214 | error = input_ff_create_memless(input_dev, tmff, hid_tmff_play); | 200 | error = input_ff_create_memless(input_dev, tmff, tmff_play); |
| 215 | if (error) | 201 | if (error) |
| 216 | goto fail; | 202 | goto fail; |
| 217 | 203 | ||
| 218 | info("Force feedback for ThrustMaster devices by Zinx Verituse <zinx@epicsol.org>"); | 204 | dev_info(&hid->dev, "force feedback for ThrustMaster devices by Zinx " |
| 205 | "Verituse <zinx@epicsol.org>"); | ||
| 219 | return 0; | 206 | return 0; |
| 220 | 207 | ||
| 221 | fail: | 208 | fail: |
| 222 | kfree(tmff); | 209 | kfree(tmff); |
| 223 | return error; | 210 | return error; |
| 224 | } | 211 | } |
| 225 | 212 | ||
| 213 | static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 214 | { | ||
| 215 | int ret; | ||
| 216 | |||
| 217 | ret = hid_parse(hdev); | ||
| 218 | if (ret) { | ||
| 219 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 220 | goto err; | ||
| 221 | } | ||
| 222 | |||
| 223 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); | ||
| 224 | if (ret) { | ||
| 225 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 226 | goto err; | ||
| 227 | } | ||
| 228 | |||
| 229 | tmff_init(hdev, (void *)id->driver_data); | ||
| 230 | |||
| 231 | return 0; | ||
| 232 | err: | ||
| 233 | return ret; | ||
| 234 | } | ||
| 235 | |||
| 236 | static const struct hid_device_id tm_devices[] = { | ||
| 237 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300), | ||
| 238 | .driver_data = (unsigned long)ff_rumble }, | ||
| 239 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304), | ||
| 240 | .driver_data = (unsigned long)ff_rumble }, | ||
| 241 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651), /* FGT Rumble Force Wheel */ | ||
| 242 | .driver_data = (unsigned long)ff_rumble }, | ||
| 243 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654), /* FGT Force Feedback Wheel */ | ||
| 244 | .driver_data = (unsigned long)ff_joystick }, | ||
| 245 | { } | ||
| 246 | }; | ||
| 247 | MODULE_DEVICE_TABLE(hid, tm_devices); | ||
| 248 | |||
| 249 | static struct hid_driver tm_driver = { | ||
| 250 | .name = "thrustmaster", | ||
| 251 | .id_table = tm_devices, | ||
| 252 | .probe = tm_probe, | ||
| 253 | }; | ||
| 254 | |||
| 255 | static int tm_init(void) | ||
| 256 | { | ||
| 257 | return hid_register_driver(&tm_driver); | ||
| 258 | } | ||
| 259 | |||
| 260 | static void tm_exit(void) | ||
| 261 | { | ||
| 262 | hid_unregister_driver(&tm_driver); | ||
| 263 | } | ||
| 264 | |||
| 265 | module_init(tm_init); | ||
| 266 | module_exit(tm_exit); | ||
| 267 | MODULE_LICENSE("GPL"); | ||
| 268 | |||
| 269 | HID_COMPAT_LOAD_DRIVER(thrustmaster); | ||
diff --git a/drivers/hid/usbhid/hid-zpff.c b/drivers/hid/hid-zpff.c index 5a688274f6a3..ea82f3718b21 100644 --- a/drivers/hid/usbhid/hid-zpff.c +++ b/drivers/hid/hid-zpff.c | |||
| @@ -21,16 +21,19 @@ | |||
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | #include <linux/hid.h> | ||
| 24 | #include <linux/input.h> | 25 | #include <linux/input.h> |
| 25 | #include <linux/usb.h> | 26 | #include <linux/usb.h> |
| 26 | #include <linux/hid.h> | 27 | |
| 27 | #include "usbhid.h" | 28 | #include "hid-ids.h" |
| 29 | |||
| 30 | #include "usbhid/usbhid.h" | ||
| 28 | 31 | ||
| 29 | struct zpff_device { | 32 | struct zpff_device { |
| 30 | struct hid_report *report; | 33 | struct hid_report *report; |
| 31 | }; | 34 | }; |
| 32 | 35 | ||
| 33 | static int hid_zpff_play(struct input_dev *dev, void *data, | 36 | static int zpff_play(struct input_dev *dev, void *data, |
| 34 | struct ff_effect *effect) | 37 | struct ff_effect *effect) |
| 35 | { | 38 | { |
| 36 | struct hid_device *hid = input_get_drvdata(dev); | 39 | struct hid_device *hid = input_get_drvdata(dev); |
| @@ -58,7 +61,7 @@ static int hid_zpff_play(struct input_dev *dev, void *data, | |||
| 58 | return 0; | 61 | return 0; |
| 59 | } | 62 | } |
| 60 | 63 | ||
| 61 | int hid_zpff_init(struct hid_device *hid) | 64 | static int zpff_init(struct hid_device *hid) |
| 62 | { | 65 | { |
| 63 | struct zpff_device *zpff; | 66 | struct zpff_device *zpff; |
| 64 | struct hid_report *report; | 67 | struct hid_report *report; |
| @@ -70,14 +73,14 @@ int hid_zpff_init(struct hid_device *hid) | |||
| 70 | int error; | 73 | int error; |
| 71 | 74 | ||
| 72 | if (list_empty(report_list)) { | 75 | if (list_empty(report_list)) { |
| 73 | printk(KERN_ERR "hid-zpff: no output report found\n"); | 76 | dev_err(&hid->dev, "no output report found\n"); |
| 74 | return -ENODEV; | 77 | return -ENODEV; |
| 75 | } | 78 | } |
| 76 | 79 | ||
| 77 | report = list_entry(report_list->next, struct hid_report, list); | 80 | report = list_entry(report_list->next, struct hid_report, list); |
| 78 | 81 | ||
| 79 | if (report->maxfield < 4) { | 82 | if (report->maxfield < 4) { |
| 80 | printk(KERN_ERR "hid-zpff: not enough fields in report\n"); | 83 | dev_err(&hid->dev, "not enough fields in report\n"); |
| 81 | return -ENODEV; | 84 | return -ENODEV; |
| 82 | } | 85 | } |
| 83 | 86 | ||
| @@ -87,7 +90,7 @@ int hid_zpff_init(struct hid_device *hid) | |||
| 87 | 90 | ||
| 88 | set_bit(FF_RUMBLE, dev->ffbit); | 91 | set_bit(FF_RUMBLE, dev->ffbit); |
| 89 | 92 | ||
| 90 | error = input_ff_create_memless(dev, zpff, hid_zpff_play); | 93 | error = input_ff_create_memless(dev, zpff, zpff_play); |
| 91 | if (error) { | 94 | if (error) { |
| 92 | kfree(zpff); | 95 | kfree(zpff); |
| 93 | return error; | 96 | return error; |
| @@ -100,8 +103,60 @@ int hid_zpff_init(struct hid_device *hid) | |||
| 100 | zpff->report->field[3]->value[0] = 0x00; | 103 | zpff->report->field[3]->value[0] = 0x00; |
| 101 | usbhid_submit_report(hid, zpff->report, USB_DIR_OUT); | 104 | usbhid_submit_report(hid, zpff->report, USB_DIR_OUT); |
| 102 | 105 | ||
| 103 | printk(KERN_INFO "Force feedback for Zeroplus based devices by " | 106 | dev_info(&hid->dev, "force feedback for Zeroplus based devices by " |
| 104 | "Anssi Hannula <anssi.hannula@gmail.com>\n"); | 107 | "Anssi Hannula <anssi.hannula@gmail.com>\n"); |
| 105 | 108 | ||
| 106 | return 0; | 109 | return 0; |
| 107 | } | 110 | } |
| 111 | |||
| 112 | static int zp_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 113 | { | ||
| 114 | int ret; | ||
| 115 | |||
| 116 | ret = hid_parse(hdev); | ||
| 117 | if (ret) { | ||
| 118 | dev_err(&hdev->dev, "parse failed\n"); | ||
| 119 | goto err; | ||
| 120 | } | ||
| 121 | |||
| 122 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); | ||
| 123 | if (ret) { | ||
| 124 | dev_err(&hdev->dev, "hw start failed\n"); | ||
| 125 | goto err; | ||
| 126 | } | ||
| 127 | |||
| 128 | zpff_init(hdev); | ||
| 129 | |||
| 130 | return 0; | ||
| 131 | err: | ||
| 132 | return ret; | ||
| 133 | } | ||
| 134 | |||
| 135 | static const struct hid_device_id zp_devices[] = { | ||
| 136 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, | ||
| 137 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, | ||
| 138 | { } | ||
| 139 | }; | ||
| 140 | MODULE_DEVICE_TABLE(hid, zp_devices); | ||
| 141 | |||
| 142 | static struct hid_driver zp_driver = { | ||
| 143 | .name = "zeroplus", | ||
| 144 | .id_table = zp_devices, | ||
| 145 | .probe = zp_probe, | ||
| 146 | }; | ||
| 147 | |||
| 148 | static int zp_init(void) | ||
| 149 | { | ||
| 150 | return hid_register_driver(&zp_driver); | ||
| 151 | } | ||
| 152 | |||
| 153 | static void zp_exit(void) | ||
| 154 | { | ||
| 155 | hid_unregister_driver(&zp_driver); | ||
| 156 | } | ||
| 157 | |||
| 158 | module_init(zp_init); | ||
| 159 | module_exit(zp_exit); | ||
| 160 | MODULE_LICENSE("GPL"); | ||
| 161 | |||
| 162 | HID_COMPAT_LOAD_DRIVER(zeroplus); | ||
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index c40f0403edaf..497e0d1dd3c3 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
| @@ -113,7 +113,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t | |||
| 113 | if (!dev->hid_output_raw_report) | 113 | if (!dev->hid_output_raw_report) |
| 114 | return -ENODEV; | 114 | return -ENODEV; |
| 115 | 115 | ||
| 116 | if (count > HID_MIN_BUFFER_SIZE) { | 116 | if (count > HID_MAX_BUFFER_SIZE) { |
| 117 | printk(KERN_WARNING "hidraw: pid %d passed too large report\n", | 117 | printk(KERN_WARNING "hidraw: pid %d passed too large report\n", |
| 118 | task_pid_nr(current)); | 118 | task_pid_nr(current)); |
| 119 | return -EINVAL; | 119 | return -EINVAL; |
| @@ -181,7 +181,7 @@ static int hidraw_open(struct inode *inode, struct file *file) | |||
| 181 | 181 | ||
| 182 | dev = hidraw_table[minor]; | 182 | dev = hidraw_table[minor]; |
| 183 | if (!dev->open++) | 183 | if (!dev->open++) |
| 184 | dev->hid->hid_open(dev->hid); | 184 | dev->hid->ll_driver->open(dev->hid); |
| 185 | 185 | ||
| 186 | out_unlock: | 186 | out_unlock: |
| 187 | spin_unlock(&minors_lock); | 187 | spin_unlock(&minors_lock); |
| @@ -207,7 +207,7 @@ static int hidraw_release(struct inode * inode, struct file * file) | |||
| 207 | dev = hidraw_table[minor]; | 207 | dev = hidraw_table[minor]; |
| 208 | if (!dev->open--) { | 208 | if (!dev->open--) { |
| 209 | if (list->hidraw->exist) | 209 | if (list->hidraw->exist) |
| 210 | dev->hid->hid_close(dev->hid); | 210 | dev->hid->ll_driver->close(dev->hid); |
| 211 | else | 211 | else |
| 212 | kfree(list->hidraw); | 212 | kfree(list->hidraw); |
| 213 | } | 213 | } |
| @@ -367,7 +367,7 @@ void hidraw_disconnect(struct hid_device *hid) | |||
| 367 | device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); | 367 | device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); |
| 368 | 368 | ||
| 369 | if (hidraw->open) { | 369 | if (hidraw->open) { |
| 370 | hid->hid_close(hid); | 370 | hid->ll_driver->close(hid); |
| 371 | wake_up_interruptible(&hidraw->wait); | 371 | wake_up_interruptible(&hidraw->wait); |
| 372 | } else { | 372 | } else { |
| 373 | kfree(hidraw); | 373 | kfree(hidraw); |
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig index 18f09104765c..5d9aa95fc3ef 100644 --- a/drivers/hid/usbhid/Kconfig +++ b/drivers/hid/usbhid/Kconfig | |||
| @@ -24,88 +24,13 @@ config USB_HID | |||
| 24 | comment "Input core support is needed for USB HID input layer or HIDBP support" | 24 | comment "Input core support is needed for USB HID input layer or HIDBP support" |
| 25 | depends on USB_HID && INPUT=n | 25 | depends on USB_HID && INPUT=n |
| 26 | 26 | ||
| 27 | config USB_HIDINPUT_POWERBOOK | ||
| 28 | bool "Enable support for Apple laptop/aluminum USB special keys" | ||
| 29 | default n | ||
| 30 | depends on USB_HID | ||
| 31 | help | ||
| 32 | Say Y here if you want support for the special keys (Fn, Numlock) on | ||
| 33 | Apple iBooks, PowerBooks, MacBooks, MacBook Pros and aluminum USB | ||
| 34 | keyboards. | ||
| 35 | |||
| 36 | If unsure, say N. | ||
| 37 | |||
| 38 | config HID_FF | ||
| 39 | bool "Force feedback support (EXPERIMENTAL)" | ||
| 40 | depends on USB_HID && EXPERIMENTAL | ||
| 41 | help | ||
| 42 | Say Y here is you want force feedback support for a few HID devices. | ||
| 43 | See below for a list of supported devices. | ||
| 44 | |||
| 45 | See <file:Documentation/input/ff.txt> for a description of the force | ||
| 46 | feedback API. | ||
| 47 | |||
| 48 | If unsure, say N. | ||
| 49 | |||
| 50 | config HID_PID | 27 | config HID_PID |
| 51 | bool "PID device support" | 28 | bool "PID device support" |
| 52 | depends on HID_FF | ||
| 53 | help | 29 | help |
| 54 | Say Y here if you have a PID-compliant device and wish to enable force | 30 | Say Y here if you have a PID-compliant device and wish to enable force |
| 55 | feedback for it. Microsoft Sidewinder Force Feedback 2 is one of such | 31 | feedback for it. Microsoft Sidewinder Force Feedback 2 is one of such |
| 56 | devices. | 32 | devices. |
| 57 | 33 | ||
| 58 | config LOGITECH_FF | ||
| 59 | bool "Logitech devices support" | ||
| 60 | depends on HID_FF | ||
| 61 | select INPUT_FF_MEMLESS if USB_HID | ||
| 62 | help | ||
| 63 | Say Y here if you have one of these devices: | ||
| 64 | - Logitech WingMan Cordless RumblePad | ||
| 65 | - Logitech WingMan Cordless RumblePad 2 | ||
| 66 | - Logitech WingMan Force 3D | ||
| 67 | - Logitech Formula Force EX | ||
| 68 | - Logitech MOMO Force wheel | ||
| 69 | |||
| 70 | and if you want to enable force feedback for them. | ||
| 71 | Note: if you say N here, this device will still be supported, but without | ||
| 72 | force feedback. | ||
| 73 | |||
| 74 | config LOGIRUMBLEPAD2_FF | ||
| 75 | bool "Logitech Rumblepad 2 support" | ||
| 76 | depends on HID_FF | ||
| 77 | select INPUT_FF_MEMLESS if USB_HID | ||
| 78 | help | ||
| 79 | Say Y here if you want to enable force feedback support for Logitech | ||
| 80 | Rumblepad 2 devices. | ||
| 81 | |||
| 82 | config PANTHERLORD_FF | ||
| 83 | bool "PantherLord/GreenAsia based device support" | ||
| 84 | depends on HID_FF | ||
| 85 | select INPUT_FF_MEMLESS if USB_HID | ||
| 86 | help | ||
| 87 | Say Y here if you have a PantherLord/GreenAsia based game controller | ||
| 88 | or adapter and want to enable force feedback support for it. | ||
| 89 | |||
| 90 | config THRUSTMASTER_FF | ||
| 91 | bool "ThrustMaster devices support" | ||
| 92 | depends on HID_FF | ||
| 93 | select INPUT_FF_MEMLESS if USB_HID | ||
| 94 | help | ||
| 95 | Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or | ||
| 96 | a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel, | ||
| 97 | and want to enable force feedback support for it. | ||
| 98 | Note: if you say N here, this device will still be supported, but without | ||
| 99 | force feedback. | ||
| 100 | |||
| 101 | config ZEROPLUS_FF | ||
| 102 | bool "Zeroplus based game controller support" | ||
| 103 | depends on HID_FF | ||
| 104 | select INPUT_FF_MEMLESS if USB_HID | ||
| 105 | help | ||
| 106 | Say Y here if you have a Zeroplus based game controller and want to | ||
| 107 | enable force feedback for it. | ||
| 108 | |||
| 109 | config USB_HIDDEV | 34 | config USB_HIDDEV |
| 110 | bool "/dev/hiddev raw HID device support" | 35 | bool "/dev/hiddev raw HID device support" |
| 111 | depends on USB_HID | 36 | depends on USB_HID |
diff --git a/drivers/hid/usbhid/Makefile b/drivers/hid/usbhid/Makefile index 00a7b7090192..1329ecb37a1c 100644 --- a/drivers/hid/usbhid/Makefile +++ b/drivers/hid/usbhid/Makefile | |||
| @@ -13,24 +13,6 @@ endif | |||
| 13 | ifeq ($(CONFIG_HID_PID),y) | 13 | ifeq ($(CONFIG_HID_PID),y) |
| 14 | usbhid-objs += hid-pidff.o | 14 | usbhid-objs += hid-pidff.o |
| 15 | endif | 15 | endif |
| 16 | ifeq ($(CONFIG_LOGITECH_FF),y) | ||
| 17 | usbhid-objs += hid-lgff.o | ||
| 18 | endif | ||
| 19 | ifeq ($(CONFIG_LOGIRUMBLEPAD2_FF),y) | ||
| 20 | usbhid-objs += hid-lg2ff.o | ||
| 21 | endif | ||
| 22 | ifeq ($(CONFIG_PANTHERLORD_FF),y) | ||
| 23 | usbhid-objs += hid-plff.o | ||
| 24 | endif | ||
| 25 | ifeq ($(CONFIG_THRUSTMASTER_FF),y) | ||
| 26 | usbhid-objs += hid-tmff.o | ||
| 27 | endif | ||
| 28 | ifeq ($(CONFIG_ZEROPLUS_FF),y) | ||
| 29 | usbhid-objs += hid-zpff.o | ||
| 30 | endif | ||
| 31 | ifeq ($(CONFIG_HID_FF),y) | ||
| 32 | usbhid-objs += hid-ff.o | ||
| 33 | endif | ||
| 34 | 16 | ||
| 35 | obj-$(CONFIG_USB_HID) += usbhid.o | 17 | obj-$(CONFIG_USB_HID) += usbhid.o |
| 36 | obj-$(CONFIG_USB_KBD) += usbkbd.o | 18 | obj-$(CONFIG_USB_KBD) += usbkbd.o |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 27fe4d8912cb..1d3b8a394d46 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
| @@ -44,8 +44,6 @@ | |||
| 44 | #define DRIVER_DESC "USB HID core driver" | 44 | #define DRIVER_DESC "USB HID core driver" |
| 45 | #define DRIVER_LICENSE "GPL" | 45 | #define DRIVER_LICENSE "GPL" |
| 46 | 46 | ||
| 47 | static char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick", | ||
| 48 | "Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"}; | ||
| 49 | /* | 47 | /* |
| 50 | * Module parameters. | 48 | * Module parameters. |
| 51 | */ | 49 | */ |
| @@ -61,12 +59,6 @@ MODULE_PARM_DESC(quirks, "Add/modify USB HID quirks by specifying " | |||
| 61 | " quirks=vendorID:productID:quirks" | 59 | " quirks=vendorID:productID:quirks" |
| 62 | " where vendorID, productID, and quirks are all in" | 60 | " where vendorID, productID, and quirks are all in" |
| 63 | " 0x-prefixed hex"); | 61 | " 0x-prefixed hex"); |
| 64 | static char *rdesc_quirks_param[MAX_USBHID_BOOT_QUIRKS] = { [ 0 ... (MAX_USBHID_BOOT_QUIRKS - 1) ] = NULL }; | ||
| 65 | module_param_array_named(rdesc_quirks, rdesc_quirks_param, charp, NULL, 0444); | ||
| 66 | MODULE_PARM_DESC(rdesc_quirks, "Add/modify report descriptor quirks by specifying " | ||
| 67 | " rdesc_quirks=vendorID:productID:rdesc_quirks" | ||
| 68 | " where vendorID, productID, and rdesc_quirks are all in" | ||
| 69 | " 0x-prefixed hex"); | ||
| 70 | /* | 62 | /* |
| 71 | * Input submission and I/O error handler. | 63 | * Input submission and I/O error handler. |
| 72 | */ | 64 | */ |
| @@ -197,31 +189,32 @@ static void hid_irq_in(struct urb *urb) | |||
| 197 | int status; | 189 | int status; |
| 198 | 190 | ||
| 199 | switch (urb->status) { | 191 | switch (urb->status) { |
| 200 | case 0: /* success */ | 192 | case 0: /* success */ |
| 201 | usbhid->retry_delay = 0; | 193 | usbhid->retry_delay = 0; |
| 202 | hid_input_report(urb->context, HID_INPUT_REPORT, | 194 | hid_input_report(urb->context, HID_INPUT_REPORT, |
| 203 | urb->transfer_buffer, | 195 | urb->transfer_buffer, |
| 204 | urb->actual_length, 1); | 196 | urb->actual_length, 1); |
| 205 | break; | 197 | break; |
| 206 | case -EPIPE: /* stall */ | 198 | case -EPIPE: /* stall */ |
| 207 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); | 199 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); |
| 208 | set_bit(HID_CLEAR_HALT, &usbhid->iofl); | 200 | set_bit(HID_CLEAR_HALT, &usbhid->iofl); |
| 209 | schedule_work(&usbhid->reset_work); | 201 | schedule_work(&usbhid->reset_work); |
| 210 | return; | 202 | return; |
| 211 | case -ECONNRESET: /* unlink */ | 203 | case -ECONNRESET: /* unlink */ |
| 212 | case -ENOENT: | 204 | case -ENOENT: |
| 213 | case -ESHUTDOWN: /* unplug */ | 205 | case -ESHUTDOWN: /* unplug */ |
| 214 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); | 206 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); |
| 215 | return; | 207 | return; |
| 216 | case -EILSEQ: /* protocol error or unplug */ | 208 | case -EILSEQ: /* protocol error or unplug */ |
| 217 | case -EPROTO: /* protocol error or unplug */ | 209 | case -EPROTO: /* protocol error or unplug */ |
| 218 | case -ETIME: /* protocol error or unplug */ | 210 | case -ETIME: /* protocol error or unplug */ |
| 219 | case -ETIMEDOUT: /* Should never happen, but... */ | 211 | case -ETIMEDOUT: /* Should never happen, but... */ |
| 220 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); | 212 | clear_bit(HID_IN_RUNNING, &usbhid->iofl); |
| 221 | hid_io_error(hid); | 213 | hid_io_error(hid); |
| 222 | return; | 214 | return; |
| 223 | default: /* error */ | 215 | default: /* error */ |
| 224 | warn("input irq status %d received", urb->status); | 216 | dev_warn(&urb->dev->dev, "input irq status %d " |
| 217 | "received\n", urb->status); | ||
| 225 | } | 218 | } |
| 226 | 219 | ||
| 227 | status = usb_submit_urb(urb, GFP_ATOMIC); | 220 | status = usb_submit_urb(urb, GFP_ATOMIC); |
| @@ -240,13 +233,16 @@ static void hid_irq_in(struct urb *urb) | |||
| 240 | static int hid_submit_out(struct hid_device *hid) | 233 | static int hid_submit_out(struct hid_device *hid) |
| 241 | { | 234 | { |
| 242 | struct hid_report *report; | 235 | struct hid_report *report; |
| 236 | char *raw_report; | ||
| 243 | struct usbhid_device *usbhid = hid->driver_data; | 237 | struct usbhid_device *usbhid = hid->driver_data; |
| 244 | 238 | ||
| 245 | report = usbhid->out[usbhid->outtail]; | 239 | report = usbhid->out[usbhid->outtail].report; |
| 240 | raw_report = usbhid->out[usbhid->outtail].raw_report; | ||
| 246 | 241 | ||
| 247 | hid_output_report(report, usbhid->outbuf); | ||
| 248 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 242 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
| 249 | usbhid->urbout->dev = hid_to_usb_dev(hid); | 243 | usbhid->urbout->dev = hid_to_usb_dev(hid); |
| 244 | memcpy(usbhid->outbuf, raw_report, usbhid->urbout->transfer_buffer_length); | ||
| 245 | kfree(raw_report); | ||
| 250 | 246 | ||
| 251 | dbg_hid("submitting out urb\n"); | 247 | dbg_hid("submitting out urb\n"); |
| 252 | 248 | ||
| @@ -262,17 +258,20 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
| 262 | { | 258 | { |
| 263 | struct hid_report *report; | 259 | struct hid_report *report; |
| 264 | unsigned char dir; | 260 | unsigned char dir; |
| 261 | char *raw_report; | ||
| 265 | int len; | 262 | int len; |
| 266 | struct usbhid_device *usbhid = hid->driver_data; | 263 | struct usbhid_device *usbhid = hid->driver_data; |
| 267 | 264 | ||
| 268 | report = usbhid->ctrl[usbhid->ctrltail].report; | 265 | report = usbhid->ctrl[usbhid->ctrltail].report; |
| 266 | raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report; | ||
| 269 | dir = usbhid->ctrl[usbhid->ctrltail].dir; | 267 | dir = usbhid->ctrl[usbhid->ctrltail].dir; |
| 270 | 268 | ||
| 271 | len = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 269 | len = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
| 272 | if (dir == USB_DIR_OUT) { | 270 | if (dir == USB_DIR_OUT) { |
| 273 | hid_output_report(report, usbhid->ctrlbuf); | ||
| 274 | usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0); | 271 | usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0); |
| 275 | usbhid->urbctrl->transfer_buffer_length = len; | 272 | usbhid->urbctrl->transfer_buffer_length = len; |
| 273 | memcpy(usbhid->ctrlbuf, raw_report, len); | ||
| 274 | kfree(raw_report); | ||
| 276 | } else { | 275 | } else { |
| 277 | int maxpacket, padlen; | 276 | int maxpacket, padlen; |
| 278 | 277 | ||
| @@ -319,17 +318,18 @@ static void hid_irq_out(struct urb *urb) | |||
| 319 | int unplug = 0; | 318 | int unplug = 0; |
| 320 | 319 | ||
| 321 | switch (urb->status) { | 320 | switch (urb->status) { |
| 322 | case 0: /* success */ | 321 | case 0: /* success */ |
| 323 | break; | 322 | break; |
| 324 | case -ESHUTDOWN: /* unplug */ | 323 | case -ESHUTDOWN: /* unplug */ |
| 325 | unplug = 1; | 324 | unplug = 1; |
| 326 | case -EILSEQ: /* protocol error or unplug */ | 325 | case -EILSEQ: /* protocol error or unplug */ |
| 327 | case -EPROTO: /* protocol error or unplug */ | 326 | case -EPROTO: /* protocol error or unplug */ |
| 328 | case -ECONNRESET: /* unlink */ | 327 | case -ECONNRESET: /* unlink */ |
| 329 | case -ENOENT: | 328 | case -ENOENT: |
| 330 | break; | 329 | break; |
| 331 | default: /* error */ | 330 | default: /* error */ |
| 332 | warn("output irq status %d received", urb->status); | 331 | dev_warn(&urb->dev->dev, "output irq status %d " |
| 332 | "received\n", urb->status); | ||
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | spin_lock_irqsave(&usbhid->outlock, flags); | 335 | spin_lock_irqsave(&usbhid->outlock, flags); |
| @@ -367,21 +367,23 @@ static void hid_ctrl(struct urb *urb) | |||
| 367 | spin_lock_irqsave(&usbhid->ctrllock, flags); | 367 | spin_lock_irqsave(&usbhid->ctrllock, flags); |
| 368 | 368 | ||
| 369 | switch (urb->status) { | 369 | switch (urb->status) { |
| 370 | case 0: /* success */ | 370 | case 0: /* success */ |
| 371 | if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN) | 371 | if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN) |
| 372 | hid_input_report(urb->context, usbhid->ctrl[usbhid->ctrltail].report->type, | 372 | hid_input_report(urb->context, |
| 373 | urb->transfer_buffer, urb->actual_length, 0); | 373 | usbhid->ctrl[usbhid->ctrltail].report->type, |
| 374 | break; | 374 | urb->transfer_buffer, urb->actual_length, 0); |
| 375 | case -ESHUTDOWN: /* unplug */ | 375 | break; |
| 376 | unplug = 1; | 376 | case -ESHUTDOWN: /* unplug */ |
| 377 | case -EILSEQ: /* protocol error or unplug */ | 377 | unplug = 1; |
| 378 | case -EPROTO: /* protocol error or unplug */ | 378 | case -EILSEQ: /* protocol error or unplug */ |
| 379 | case -ECONNRESET: /* unlink */ | 379 | case -EPROTO: /* protocol error or unplug */ |
| 380 | case -ENOENT: | 380 | case -ECONNRESET: /* unlink */ |
| 381 | case -EPIPE: /* report not available */ | 381 | case -ENOENT: |
| 382 | break; | 382 | case -EPIPE: /* report not available */ |
| 383 | default: /* error */ | 383 | break; |
| 384 | warn("ctrl urb status %d received", urb->status); | 384 | default: /* error */ |
| 385 | dev_warn(&urb->dev->dev, "ctrl urb status %d " | ||
| 386 | "received\n", urb->status); | ||
| 385 | } | 387 | } |
| 386 | 388 | ||
| 387 | if (unplug) | 389 | if (unplug) |
| @@ -408,6 +410,7 @@ void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, uns | |||
| 408 | int head; | 410 | int head; |
| 409 | unsigned long flags; | 411 | unsigned long flags; |
| 410 | struct usbhid_device *usbhid = hid->driver_data; | 412 | struct usbhid_device *usbhid = hid->driver_data; |
| 413 | int len = ((report->size - 1) >> 3) + 1 + (report->id > 0); | ||
| 411 | 414 | ||
| 412 | if ((hid->quirks & HID_QUIRK_NOGET) && dir == USB_DIR_IN) | 415 | if ((hid->quirks & HID_QUIRK_NOGET) && dir == USB_DIR_IN) |
| 413 | return; | 416 | return; |
| @@ -418,11 +421,18 @@ void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, uns | |||
| 418 | 421 | ||
| 419 | if ((head = (usbhid->outhead + 1) & (HID_OUTPUT_FIFO_SIZE - 1)) == usbhid->outtail) { | 422 | if ((head = (usbhid->outhead + 1) & (HID_OUTPUT_FIFO_SIZE - 1)) == usbhid->outtail) { |
| 420 | spin_unlock_irqrestore(&usbhid->outlock, flags); | 423 | spin_unlock_irqrestore(&usbhid->outlock, flags); |
| 421 | warn("output queue full"); | 424 | dev_warn(&hid->dev, "output queue full\n"); |
| 422 | return; | 425 | return; |
| 423 | } | 426 | } |
| 424 | 427 | ||
| 425 | usbhid->out[usbhid->outhead] = report; | 428 | usbhid->out[usbhid->outhead].raw_report = kmalloc(len, GFP_ATOMIC); |
| 429 | if (!usbhid->out[usbhid->outhead].raw_report) { | ||
| 430 | spin_unlock_irqrestore(&usbhid->outlock, flags); | ||
| 431 | warn("output queueing failed"); | ||
| 432 | return; | ||
| 433 | } | ||
| 434 | hid_output_report(report, usbhid->out[usbhid->outhead].raw_report); | ||
| 435 | usbhid->out[usbhid->outhead].report = report; | ||
| 426 | usbhid->outhead = head; | 436 | usbhid->outhead = head; |
| 427 | 437 | ||
| 428 | if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) | 438 | if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) |
| @@ -437,10 +447,19 @@ void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, uns | |||
| 437 | 447 | ||
| 438 | if ((head = (usbhid->ctrlhead + 1) & (HID_CONTROL_FIFO_SIZE - 1)) == usbhid->ctrltail) { | 448 | if ((head = (usbhid->ctrlhead + 1) & (HID_CONTROL_FIFO_SIZE - 1)) == usbhid->ctrltail) { |
| 439 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); | 449 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); |
| 440 | warn("control queue full"); | 450 | dev_warn(&hid->dev, "control queue full\n"); |
| 441 | return; | 451 | return; |
| 442 | } | 452 | } |
| 443 | 453 | ||
| 454 | if (dir == USB_DIR_OUT) { | ||
| 455 | usbhid->ctrl[usbhid->ctrlhead].raw_report = kmalloc(len, GFP_ATOMIC); | ||
| 456 | if (!usbhid->ctrl[usbhid->ctrlhead].raw_report) { | ||
| 457 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); | ||
| 458 | warn("control queueing failed"); | ||
| 459 | return; | ||
| 460 | } | ||
| 461 | hid_output_report(report, usbhid->ctrl[usbhid->ctrlhead].raw_report); | ||
| 462 | } | ||
| 444 | usbhid->ctrl[usbhid->ctrlhead].report = report; | 463 | usbhid->ctrl[usbhid->ctrlhead].report = report; |
| 445 | usbhid->ctrl[usbhid->ctrlhead].dir = dir; | 464 | usbhid->ctrl[usbhid->ctrlhead].dir = dir; |
| 446 | usbhid->ctrlhead = head; | 465 | usbhid->ctrlhead = head; |
| @@ -451,6 +470,7 @@ void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, uns | |||
| 451 | 470 | ||
| 452 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); | 471 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); |
| 453 | } | 472 | } |
| 473 | EXPORT_SYMBOL_GPL(usbhid_submit_report); | ||
| 454 | 474 | ||
| 455 | static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 475 | static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
| 456 | { | 476 | { |
| @@ -465,7 +485,7 @@ static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, un | |||
| 465 | return -1; | 485 | return -1; |
| 466 | 486 | ||
| 467 | if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) { | 487 | if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) { |
| 468 | warn("event field not found"); | 488 | dev_warn(&dev->dev, "event field not found\n"); |
| 469 | return -1; | 489 | return -1; |
| 470 | } | 490 | } |
| 471 | 491 | ||
| @@ -568,7 +588,7 @@ void usbhid_init_reports(struct hid_device *hid) | |||
| 568 | } | 588 | } |
| 569 | 589 | ||
| 570 | if (err) | 590 | if (err) |
| 571 | warn("timeout initializing reports"); | 591 | dev_warn(&hid->dev, "timeout initializing reports\n"); |
| 572 | } | 592 | } |
| 573 | 593 | ||
| 574 | /* | 594 | /* |
| @@ -598,7 +618,7 @@ static int hid_find_field_early(struct hid_device *hid, unsigned int page, | |||
| 598 | return -1; | 618 | return -1; |
| 599 | } | 619 | } |
| 600 | 620 | ||
| 601 | static void usbhid_set_leds(struct hid_device *hid) | 621 | void usbhid_set_leds(struct hid_device *hid) |
| 602 | { | 622 | { |
| 603 | struct hid_field *field; | 623 | struct hid_field *field; |
| 604 | int offset; | 624 | int offset; |
| @@ -608,6 +628,7 @@ static void usbhid_set_leds(struct hid_device *hid) | |||
| 608 | usbhid_submit_report(hid, field->report, USB_DIR_OUT); | 628 | usbhid_submit_report(hid, field->report, USB_DIR_OUT); |
| 609 | } | 629 | } |
| 610 | } | 630 | } |
| 631 | EXPORT_SYMBOL_GPL(usbhid_set_leds); | ||
| 611 | 632 | ||
| 612 | /* | 633 | /* |
| 613 | * Traverse the supplied list of reports and find the longest | 634 | * Traverse the supplied list of reports and find the longest |
| @@ -675,43 +696,16 @@ static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) | |||
| 675 | usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma); | 696 | usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma); |
| 676 | } | 697 | } |
| 677 | 698 | ||
| 678 | /* | 699 | static int usbhid_parse(struct hid_device *hid) |
| 679 | * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller | ||
| 680 | * to "operational". Without this, the ps3 controller will not report any | ||
| 681 | * events. | ||
| 682 | */ | ||
| 683 | static void hid_fixup_sony_ps3_controller(struct usb_device *dev, int ifnum) | ||
| 684 | { | ||
| 685 | int result; | ||
| 686 | char *buf = kmalloc(18, GFP_KERNEL); | ||
| 687 | |||
| 688 | if (!buf) | ||
| 689 | return; | ||
| 690 | |||
| 691 | result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
| 692 | HID_REQ_GET_REPORT, | ||
| 693 | USB_DIR_IN | USB_TYPE_CLASS | | ||
| 694 | USB_RECIP_INTERFACE, | ||
| 695 | (3 << 8) | 0xf2, ifnum, buf, 17, | ||
| 696 | USB_CTRL_GET_TIMEOUT); | ||
| 697 | |||
| 698 | if (result < 0) | ||
| 699 | err_hid("%s failed: %d\n", __func__, result); | ||
| 700 | |||
| 701 | kfree(buf); | ||
| 702 | } | ||
| 703 | |||
| 704 | static struct hid_device *usb_hid_configure(struct usb_interface *intf) | ||
| 705 | { | 700 | { |
| 701 | struct usb_interface *intf = to_usb_interface(hid->dev.parent); | ||
| 706 | struct usb_host_interface *interface = intf->cur_altsetting; | 702 | struct usb_host_interface *interface = intf->cur_altsetting; |
| 707 | struct usb_device *dev = interface_to_usbdev (intf); | 703 | struct usb_device *dev = interface_to_usbdev (intf); |
| 708 | struct hid_descriptor *hdesc; | 704 | struct hid_descriptor *hdesc; |
| 709 | struct hid_device *hid; | ||
| 710 | u32 quirks = 0; | 705 | u32 quirks = 0; |
| 711 | unsigned int insize = 0, rsize = 0; | 706 | unsigned int rsize = 0; |
| 712 | char *rdesc; | 707 | char *rdesc; |
| 713 | int n, len; | 708 | int ret, n; |
| 714 | struct usbhid_device *usbhid; | ||
| 715 | 709 | ||
| 716 | quirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor), | 710 | quirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor), |
| 717 | le16_to_cpu(dev->descriptor.idProduct)); | 711 | le16_to_cpu(dev->descriptor.idProduct)); |
| @@ -724,63 +718,75 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
| 724 | quirks |= HID_QUIRK_NOGET; | 718 | quirks |= HID_QUIRK_NOGET; |
| 725 | } | 719 | } |
| 726 | 720 | ||
| 727 | if (quirks & HID_QUIRK_IGNORE) | ||
| 728 | return NULL; | ||
| 729 | |||
| 730 | if ((quirks & HID_QUIRK_IGNORE_MOUSE) && | ||
| 731 | (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)) | ||
| 732 | return NULL; | ||
| 733 | |||
| 734 | |||
| 735 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && | 721 | if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && |
| 736 | (!interface->desc.bNumEndpoints || | 722 | (!interface->desc.bNumEndpoints || |
| 737 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { | 723 | usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) { |
| 738 | dbg_hid("class descriptor not present\n"); | 724 | dbg_hid("class descriptor not present\n"); |
| 739 | return NULL; | 725 | return -ENODEV; |
| 740 | } | 726 | } |
| 741 | 727 | ||
| 728 | hid->version = le16_to_cpu(hdesc->bcdHID); | ||
| 729 | hid->country = hdesc->bCountryCode; | ||
| 730 | |||
| 742 | for (n = 0; n < hdesc->bNumDescriptors; n++) | 731 | for (n = 0; n < hdesc->bNumDescriptors; n++) |
| 743 | if (hdesc->desc[n].bDescriptorType == HID_DT_REPORT) | 732 | if (hdesc->desc[n].bDescriptorType == HID_DT_REPORT) |
| 744 | rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength); | 733 | rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength); |
| 745 | 734 | ||
| 746 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { | 735 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { |
| 747 | dbg_hid("weird size of report descriptor (%u)\n", rsize); | 736 | dbg_hid("weird size of report descriptor (%u)\n", rsize); |
| 748 | return NULL; | 737 | return -EINVAL; |
| 749 | } | 738 | } |
| 750 | 739 | ||
| 751 | if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) { | 740 | if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) { |
| 752 | dbg_hid("couldn't allocate rdesc memory\n"); | 741 | dbg_hid("couldn't allocate rdesc memory\n"); |
| 753 | return NULL; | 742 | return -ENOMEM; |
| 754 | } | 743 | } |
| 755 | 744 | ||
| 756 | hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); | 745 | hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); |
| 757 | 746 | ||
| 758 | if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) { | 747 | ret = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, |
| 748 | HID_DT_REPORT, rdesc, rsize); | ||
| 749 | if (ret < 0) { | ||
| 759 | dbg_hid("reading report descriptor failed\n"); | 750 | dbg_hid("reading report descriptor failed\n"); |
| 760 | kfree(rdesc); | 751 | kfree(rdesc); |
| 761 | return NULL; | 752 | goto err; |
| 762 | } | 753 | } |
| 763 | 754 | ||
| 764 | usbhid_fixup_report_descriptor(le16_to_cpu(dev->descriptor.idVendor), | ||
| 765 | le16_to_cpu(dev->descriptor.idProduct), rdesc, | ||
| 766 | rsize, rdesc_quirks_param); | ||
| 767 | |||
| 768 | dbg_hid("report descriptor (size %u, read %d) = ", rsize, n); | 755 | dbg_hid("report descriptor (size %u, read %d) = ", rsize, n); |
| 769 | for (n = 0; n < rsize; n++) | 756 | for (n = 0; n < rsize; n++) |
| 770 | dbg_hid_line(" %02x", (unsigned char) rdesc[n]); | 757 | dbg_hid_line(" %02x", (unsigned char) rdesc[n]); |
| 771 | dbg_hid_line("\n"); | 758 | dbg_hid_line("\n"); |
| 772 | 759 | ||
| 773 | if (!(hid = hid_parse_report(rdesc, n))) { | 760 | ret = hid_parse_report(hid, rdesc, rsize); |
| 761 | kfree(rdesc); | ||
| 762 | if (ret) { | ||
| 774 | dbg_hid("parsing report descriptor failed\n"); | 763 | dbg_hid("parsing report descriptor failed\n"); |
| 775 | kfree(rdesc); | 764 | goto err; |
| 776 | return NULL; | ||
| 777 | } | 765 | } |
| 778 | 766 | ||
| 779 | kfree(rdesc); | ||
| 780 | hid->quirks = quirks; | 767 | hid->quirks = quirks; |
| 781 | 768 | ||
| 782 | if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL))) | 769 | return 0; |
| 783 | goto fail_no_usbhid; | 770 | err: |
| 771 | return ret; | ||
| 772 | } | ||
| 773 | |||
| 774 | static int usbhid_start(struct hid_device *hid) | ||
| 775 | { | ||
| 776 | struct usb_interface *intf = to_usb_interface(hid->dev.parent); | ||
| 777 | struct usb_host_interface *interface = intf->cur_altsetting; | ||
| 778 | struct usb_device *dev = interface_to_usbdev(intf); | ||
| 779 | struct usbhid_device *usbhid; | ||
| 780 | unsigned int n, insize = 0; | ||
| 781 | int ret; | ||
| 782 | |||
| 783 | WARN_ON(hid->driver_data); | ||
| 784 | |||
| 785 | usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL); | ||
| 786 | if (usbhid == NULL) { | ||
| 787 | ret = -ENOMEM; | ||
| 788 | goto err; | ||
| 789 | } | ||
| 784 | 790 | ||
| 785 | hid->driver_data = usbhid; | 791 | hid->driver_data = usbhid; |
| 786 | usbhid->hid = hid; | 792 | usbhid->hid = hid; |
| @@ -799,28 +805,11 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
| 799 | insize = HID_MAX_BUFFER_SIZE; | 805 | insize = HID_MAX_BUFFER_SIZE; |
| 800 | 806 | ||
| 801 | if (hid_alloc_buffers(dev, hid)) { | 807 | if (hid_alloc_buffers(dev, hid)) { |
| 802 | hid_free_buffers(dev, hid); | 808 | ret = -ENOMEM; |
| 803 | goto fail; | 809 | goto fail; |
| 804 | } | 810 | } |
| 805 | 811 | ||
| 806 | hid->name[0] = 0; | ||
| 807 | |||
| 808 | if (dev->manufacturer) | ||
| 809 | strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); | ||
| 810 | |||
| 811 | if (dev->product) { | ||
| 812 | if (dev->manufacturer) | ||
| 813 | strlcat(hid->name, " ", sizeof(hid->name)); | ||
| 814 | strlcat(hid->name, dev->product, sizeof(hid->name)); | ||
| 815 | } | ||
| 816 | |||
| 817 | if (!strlen(hid->name)) | ||
| 818 | snprintf(hid->name, sizeof(hid->name), "HID %04x:%04x", | ||
| 819 | le16_to_cpu(dev->descriptor.idVendor), | ||
| 820 | le16_to_cpu(dev->descriptor.idProduct)); | ||
| 821 | |||
| 822 | for (n = 0; n < interface->desc.bNumEndpoints; n++) { | 812 | for (n = 0; n < interface->desc.bNumEndpoints; n++) { |
| 823 | |||
| 824 | struct usb_endpoint_descriptor *endpoint; | 813 | struct usb_endpoint_descriptor *endpoint; |
| 825 | int pipe; | 814 | int pipe; |
| 826 | int interval; | 815 | int interval; |
| @@ -832,7 +821,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
| 832 | interval = endpoint->bInterval; | 821 | interval = endpoint->bInterval; |
| 833 | 822 | ||
| 834 | /* Some vendors give fullspeed interval on highspeed devides */ | 823 | /* Some vendors give fullspeed interval on highspeed devides */ |
| 835 | if (quirks & HID_QUIRK_FULLSPEED_INTERVAL && | 824 | if (hid->quirks & HID_QUIRK_FULLSPEED_INTERVAL && |
| 836 | dev->speed == USB_SPEED_HIGH) { | 825 | dev->speed == USB_SPEED_HIGH) { |
| 837 | interval = fls(endpoint->bInterval*8); | 826 | interval = fls(endpoint->bInterval*8); |
| 838 | printk(KERN_INFO "%s: Fixing fullspeed to highspeed interval: %d -> %d\n", | 827 | printk(KERN_INFO "%s: Fixing fullspeed to highspeed interval: %d -> %d\n", |
| @@ -843,6 +832,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
| 843 | if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) | 832 | if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) |
| 844 | interval = hid_mousepoll_interval; | 833 | interval = hid_mousepoll_interval; |
| 845 | 834 | ||
| 835 | ret = -ENOMEM; | ||
| 846 | if (usb_endpoint_dir_in(endpoint)) { | 836 | if (usb_endpoint_dir_in(endpoint)) { |
| 847 | if (usbhid->urbin) | 837 | if (usbhid->urbin) |
| 848 | continue; | 838 | continue; |
| @@ -868,6 +858,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
| 868 | 858 | ||
| 869 | if (!usbhid->urbin) { | 859 | if (!usbhid->urbin) { |
| 870 | err_hid("couldn't find an input interrupt endpoint"); | 860 | err_hid("couldn't find an input interrupt endpoint"); |
| 861 | ret = -ENODEV; | ||
| 871 | goto fail; | 862 | goto fail; |
| 872 | } | 863 | } |
| 873 | 864 | ||
| @@ -879,44 +870,25 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
| 879 | spin_lock_init(&usbhid->outlock); | 870 | spin_lock_init(&usbhid->outlock); |
| 880 | spin_lock_init(&usbhid->ctrllock); | 871 | spin_lock_init(&usbhid->ctrllock); |
| 881 | 872 | ||
| 882 | hid->version = le16_to_cpu(hdesc->bcdHID); | ||
| 883 | hid->country = hdesc->bCountryCode; | ||
| 884 | hid->dev = &intf->dev; | ||
| 885 | usbhid->intf = intf; | 873 | usbhid->intf = intf; |
| 886 | usbhid->ifnum = interface->desc.bInterfaceNumber; | 874 | usbhid->ifnum = interface->desc.bInterfaceNumber; |
| 887 | 875 | ||
| 888 | hid->bus = BUS_USB; | ||
| 889 | hid->vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 890 | hid->product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 891 | |||
| 892 | usb_make_path(dev, hid->phys, sizeof(hid->phys)); | ||
| 893 | strlcat(hid->phys, "/input", sizeof(hid->phys)); | ||
| 894 | len = strlen(hid->phys); | ||
| 895 | if (len < sizeof(hid->phys) - 1) | ||
| 896 | snprintf(hid->phys + len, sizeof(hid->phys) - len, | ||
| 897 | "%d", intf->altsetting[0].desc.bInterfaceNumber); | ||
| 898 | |||
| 899 | if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) | ||
| 900 | hid->uniq[0] = 0; | ||
| 901 | |||
| 902 | usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL); | 876 | usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL); |
| 903 | if (!usbhid->urbctrl) | 877 | if (!usbhid->urbctrl) { |
| 878 | ret = -ENOMEM; | ||
| 904 | goto fail; | 879 | goto fail; |
| 880 | } | ||
| 905 | 881 | ||
| 906 | usb_fill_control_urb(usbhid->urbctrl, dev, 0, (void *) usbhid->cr, | 882 | usb_fill_control_urb(usbhid->urbctrl, dev, 0, (void *) usbhid->cr, |
| 907 | usbhid->ctrlbuf, 1, hid_ctrl, hid); | 883 | usbhid->ctrlbuf, 1, hid_ctrl, hid); |
| 908 | usbhid->urbctrl->setup_dma = usbhid->cr_dma; | 884 | usbhid->urbctrl->setup_dma = usbhid->cr_dma; |
| 909 | usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma; | 885 | usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma; |
| 910 | usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); | 886 | usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); |
| 911 | hid->hidinput_input_event = usb_hidinput_input_event; | 887 | |
| 912 | hid->hid_open = usbhid_open; | 888 | usbhid_init_reports(hid); |
| 913 | hid->hid_close = usbhid_close; | 889 | hid_dump_device(hid); |
| 914 | #ifdef CONFIG_USB_HIDDEV | 890 | |
| 915 | hid->hiddev_hid_event = hiddev_hid_event; | 891 | return 0; |
| 916 | hid->hiddev_report_event = hiddev_report_event; | ||
| 917 | #endif | ||
| 918 | hid->hid_output_raw_report = usbhid_output_raw_report; | ||
| 919 | return hid; | ||
| 920 | 892 | ||
| 921 | fail: | 893 | fail: |
| 922 | usb_free_urb(usbhid->urbin); | 894 | usb_free_urb(usbhid->urbin); |
| @@ -924,24 +896,18 @@ fail: | |||
| 924 | usb_free_urb(usbhid->urbctrl); | 896 | usb_free_urb(usbhid->urbctrl); |
| 925 | hid_free_buffers(dev, hid); | 897 | hid_free_buffers(dev, hid); |
| 926 | kfree(usbhid); | 898 | kfree(usbhid); |
| 927 | fail_no_usbhid: | 899 | err: |
| 928 | hid_free_device(hid); | 900 | return ret; |
| 929 | |||
| 930 | return NULL; | ||
| 931 | } | 901 | } |
| 932 | 902 | ||
| 933 | static void hid_disconnect(struct usb_interface *intf) | 903 | static void usbhid_stop(struct hid_device *hid) |
| 934 | { | 904 | { |
| 935 | struct hid_device *hid = usb_get_intfdata (intf); | 905 | struct usbhid_device *usbhid = hid->driver_data; |
| 936 | struct usbhid_device *usbhid; | ||
| 937 | 906 | ||
| 938 | if (!hid) | 907 | if (WARN_ON(!usbhid)) |
| 939 | return; | 908 | return; |
| 940 | 909 | ||
| 941 | usbhid = hid->driver_data; | ||
| 942 | |||
| 943 | spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ | 910 | spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ |
| 944 | usb_set_intfdata(intf, NULL); | ||
| 945 | set_bit(HID_DISCONNECTED, &usbhid->iofl); | 911 | set_bit(HID_DISCONNECTED, &usbhid->iofl); |
| 946 | spin_unlock_irq(&usbhid->inlock); | 912 | spin_unlock_irq(&usbhid->inlock); |
| 947 | usb_kill_urb(usbhid->urbin); | 913 | usb_kill_urb(usbhid->urbin); |
| @@ -958,86 +924,100 @@ static void hid_disconnect(struct usb_interface *intf) | |||
| 958 | if (hid->claimed & HID_CLAIMED_HIDRAW) | 924 | if (hid->claimed & HID_CLAIMED_HIDRAW) |
| 959 | hidraw_disconnect(hid); | 925 | hidraw_disconnect(hid); |
| 960 | 926 | ||
| 927 | hid->claimed = 0; | ||
| 928 | |||
| 961 | usb_free_urb(usbhid->urbin); | 929 | usb_free_urb(usbhid->urbin); |
| 962 | usb_free_urb(usbhid->urbctrl); | 930 | usb_free_urb(usbhid->urbctrl); |
| 963 | usb_free_urb(usbhid->urbout); | 931 | usb_free_urb(usbhid->urbout); |
| 964 | 932 | ||
| 965 | hid_free_buffers(hid_to_usb_dev(hid), hid); | 933 | hid_free_buffers(hid_to_usb_dev(hid), hid); |
| 966 | kfree(usbhid); | 934 | kfree(usbhid); |
| 967 | hid_free_device(hid); | 935 | hid->driver_data = NULL; |
| 968 | } | 936 | } |
| 969 | 937 | ||
| 938 | static struct hid_ll_driver usb_hid_driver = { | ||
| 939 | .parse = usbhid_parse, | ||
| 940 | .start = usbhid_start, | ||
| 941 | .stop = usbhid_stop, | ||
| 942 | .open = usbhid_open, | ||
| 943 | .close = usbhid_close, | ||
| 944 | .hidinput_input_event = usb_hidinput_input_event, | ||
| 945 | }; | ||
| 946 | |||
| 970 | static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | 947 | static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) |
| 971 | { | 948 | { |
| 949 | struct usb_device *dev = interface_to_usbdev(intf); | ||
| 972 | struct hid_device *hid; | 950 | struct hid_device *hid; |
| 973 | char path[64]; | 951 | size_t len; |
| 974 | int i; | 952 | int ret; |
| 975 | char *c; | ||
| 976 | 953 | ||
| 977 | dbg_hid("HID probe called for ifnum %d\n", | 954 | dbg_hid("HID probe called for ifnum %d\n", |
| 978 | intf->altsetting->desc.bInterfaceNumber); | 955 | intf->altsetting->desc.bInterfaceNumber); |
| 979 | 956 | ||
| 980 | if (!(hid = usb_hid_configure(intf))) | 957 | hid = hid_allocate_device(); |
| 981 | return -ENODEV; | 958 | if (IS_ERR(hid)) |
| 982 | 959 | return PTR_ERR(hid); | |
| 983 | usbhid_init_reports(hid); | ||
| 984 | hid_dump_device(hid); | ||
| 985 | if (hid->quirks & HID_QUIRK_RESET_LEDS) | ||
| 986 | usbhid_set_leds(hid); | ||
| 987 | |||
| 988 | if (!hidinput_connect(hid)) | ||
| 989 | hid->claimed |= HID_CLAIMED_INPUT; | ||
| 990 | if (!hiddev_connect(hid)) | ||
| 991 | hid->claimed |= HID_CLAIMED_HIDDEV; | ||
| 992 | if (!hidraw_connect(hid)) | ||
| 993 | hid->claimed |= HID_CLAIMED_HIDRAW; | ||
| 994 | 960 | ||
| 995 | usb_set_intfdata(intf, hid); | 961 | usb_set_intfdata(intf, hid); |
| 962 | hid->ll_driver = &usb_hid_driver; | ||
| 963 | hid->hid_output_raw_report = usbhid_output_raw_report; | ||
| 964 | hid->ff_init = hid_pidff_init; | ||
| 965 | #ifdef CONFIG_USB_HIDDEV | ||
| 966 | hid->hiddev_connect = hiddev_connect; | ||
| 967 | hid->hiddev_hid_event = hiddev_hid_event; | ||
| 968 | hid->hiddev_report_event = hiddev_report_event; | ||
| 969 | #endif | ||
| 970 | hid->dev.parent = &intf->dev; | ||
| 971 | hid->bus = BUS_USB; | ||
| 972 | hid->vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 973 | hid->product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 974 | hid->name[0] = 0; | ||
| 996 | 975 | ||
| 997 | if (!hid->claimed) { | 976 | if (dev->manufacturer) |
| 998 | printk ("HID device claimed by neither input, hiddev nor hidraw\n"); | 977 | strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); |
| 999 | hid_disconnect(intf); | 978 | |
| 1000 | return -ENODEV; | 979 | if (dev->product) { |
| 980 | if (dev->manufacturer) | ||
| 981 | strlcat(hid->name, " ", sizeof(hid->name)); | ||
| 982 | strlcat(hid->name, dev->product, sizeof(hid->name)); | ||
| 1001 | } | 983 | } |
| 1002 | 984 | ||
| 1003 | if ((hid->claimed & HID_CLAIMED_INPUT)) | 985 | if (!strlen(hid->name)) |
| 1004 | hid_ff_init(hid); | 986 | snprintf(hid->name, sizeof(hid->name), "HID %04x:%04x", |
| 987 | le16_to_cpu(dev->descriptor.idVendor), | ||
| 988 | le16_to_cpu(dev->descriptor.idProduct)); | ||
| 1005 | 989 | ||
| 1006 | if (hid->quirks & HID_QUIRK_SONY_PS3_CONTROLLER) | 990 | usb_make_path(dev, hid->phys, sizeof(hid->phys)); |
| 1007 | hid_fixup_sony_ps3_controller(interface_to_usbdev(intf), | 991 | strlcat(hid->phys, "/input", sizeof(hid->phys)); |
| 1008 | intf->cur_altsetting->desc.bInterfaceNumber); | 992 | len = strlen(hid->phys); |
| 993 | if (len < sizeof(hid->phys) - 1) | ||
| 994 | snprintf(hid->phys + len, sizeof(hid->phys) - len, | ||
| 995 | "%d", intf->altsetting[0].desc.bInterfaceNumber); | ||
| 1009 | 996 | ||
| 1010 | printk(KERN_INFO); | 997 | if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) |
| 998 | hid->uniq[0] = 0; | ||
| 1011 | 999 | ||
| 1012 | if (hid->claimed & HID_CLAIMED_INPUT) | 1000 | ret = hid_add_device(hid); |
| 1013 | printk("input"); | 1001 | if (ret) { |
| 1014 | if ((hid->claimed & HID_CLAIMED_INPUT) && ((hid->claimed & HID_CLAIMED_HIDDEV) || | 1002 | if (ret != -ENODEV) |
| 1015 | hid->claimed & HID_CLAIMED_HIDRAW)) | 1003 | dev_err(&intf->dev, "can't add hid device: %d\n", ret); |
| 1016 | printk(","); | 1004 | goto err; |
| 1017 | if (hid->claimed & HID_CLAIMED_HIDDEV) | ||
| 1018 | printk("hiddev%d", hid->minor); | ||
| 1019 | if ((hid->claimed & HID_CLAIMED_INPUT) && (hid->claimed & HID_CLAIMED_HIDDEV) && | ||
| 1020 | (hid->claimed & HID_CLAIMED_HIDRAW)) | ||
| 1021 | printk(","); | ||
| 1022 | if (hid->claimed & HID_CLAIMED_HIDRAW) | ||
| 1023 | printk("hidraw%d", ((struct hidraw*)hid->hidraw)->minor); | ||
| 1024 | |||
| 1025 | c = "Device"; | ||
| 1026 | for (i = 0; i < hid->maxcollection; i++) { | ||
| 1027 | if (hid->collection[i].type == HID_COLLECTION_APPLICATION && | ||
| 1028 | (hid->collection[i].usage & HID_USAGE_PAGE) == HID_UP_GENDESK && | ||
| 1029 | (hid->collection[i].usage & 0xffff) < ARRAY_SIZE(hid_types)) { | ||
| 1030 | c = hid_types[hid->collection[i].usage & 0xffff]; | ||
| 1031 | break; | ||
| 1032 | } | ||
| 1033 | } | 1005 | } |
| 1034 | 1006 | ||
| 1035 | usb_make_path(interface_to_usbdev(intf), path, 63); | 1007 | return 0; |
| 1008 | err: | ||
| 1009 | hid_destroy_device(hid); | ||
| 1010 | return ret; | ||
| 1011 | } | ||
| 1036 | 1012 | ||
| 1037 | printk(": USB HID v%x.%02x %s [%s] on %s\n", | 1013 | static void hid_disconnect(struct usb_interface *intf) |
| 1038 | hid->version >> 8, hid->version & 0xff, c, hid->name, path); | 1014 | { |
| 1015 | struct hid_device *hid = usb_get_intfdata(intf); | ||
| 1039 | 1016 | ||
| 1040 | return 0; | 1017 | if (WARN_ON(!hid)) |
| 1018 | return; | ||
| 1019 | |||
| 1020 | hid_destroy_device(hid); | ||
| 1041 | } | 1021 | } |
| 1042 | 1022 | ||
| 1043 | static int hid_suspend(struct usb_interface *intf, pm_message_t message) | 1023 | static int hid_suspend(struct usb_interface *intf, pm_message_t message) |
| @@ -1107,9 +1087,22 @@ static struct usb_driver hid_driver = { | |||
| 1107 | .supports_autosuspend = 1, | 1087 | .supports_autosuspend = 1, |
| 1108 | }; | 1088 | }; |
| 1109 | 1089 | ||
| 1090 | static const struct hid_device_id hid_usb_table[] = { | ||
| 1091 | { HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) }, | ||
| 1092 | { } | ||
| 1093 | }; | ||
| 1094 | |||
| 1095 | static struct hid_driver hid_usb_driver = { | ||
| 1096 | .name = "generic-usb", | ||
| 1097 | .id_table = hid_usb_table, | ||
| 1098 | }; | ||
| 1099 | |||
| 1110 | static int __init hid_init(void) | 1100 | static int __init hid_init(void) |
| 1111 | { | 1101 | { |
| 1112 | int retval; | 1102 | int retval; |
| 1103 | retval = hid_register_driver(&hid_usb_driver); | ||
| 1104 | if (retval) | ||
| 1105 | goto hid_register_fail; | ||
| 1113 | retval = usbhid_quirks_init(quirks_param); | 1106 | retval = usbhid_quirks_init(quirks_param); |
| 1114 | if (retval) | 1107 | if (retval) |
| 1115 | goto usbhid_quirks_init_fail; | 1108 | goto usbhid_quirks_init_fail; |
| @@ -1119,7 +1112,8 @@ static int __init hid_init(void) | |||
| 1119 | retval = usb_register(&hid_driver); | 1112 | retval = usb_register(&hid_driver); |
| 1120 | if (retval) | 1113 | if (retval) |
| 1121 | goto usb_register_fail; | 1114 | goto usb_register_fail; |
| 1122 | info(DRIVER_VERSION ":" DRIVER_DESC); | 1115 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
| 1116 | DRIVER_DESC "\n"); | ||
| 1123 | 1117 | ||
| 1124 | return 0; | 1118 | return 0; |
| 1125 | usb_register_fail: | 1119 | usb_register_fail: |
| @@ -1127,6 +1121,8 @@ usb_register_fail: | |||
| 1127 | hiddev_init_fail: | 1121 | hiddev_init_fail: |
| 1128 | usbhid_quirks_exit(); | 1122 | usbhid_quirks_exit(); |
| 1129 | usbhid_quirks_init_fail: | 1123 | usbhid_quirks_init_fail: |
| 1124 | hid_unregister_driver(&hid_usb_driver); | ||
| 1125 | hid_register_fail: | ||
| 1130 | return retval; | 1126 | return retval; |
| 1131 | } | 1127 | } |
| 1132 | 1128 | ||
| @@ -1135,6 +1131,7 @@ static void __exit hid_exit(void) | |||
| 1135 | usb_deregister(&hid_driver); | 1131 | usb_deregister(&hid_driver); |
| 1136 | hiddev_exit(); | 1132 | hiddev_exit(); |
| 1137 | usbhid_quirks_exit(); | 1133 | usbhid_quirks_exit(); |
| 1134 | hid_unregister_driver(&hid_usb_driver); | ||
| 1138 | } | 1135 | } |
| 1139 | 1136 | ||
| 1140 | module_init(hid_init); | 1137 | module_init(hid_init); |
diff --git a/drivers/hid/usbhid/hid-ff.c b/drivers/hid/usbhid/hid-ff.c deleted file mode 100644 index 1d0dac52f166..000000000000 --- a/drivers/hid/usbhid/hid-ff.c +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Force feedback support for hid devices. | ||
| 3 | * Not all hid devices use the same protocol. For example, some use PID, | ||
| 4 | * other use their own proprietary procotol. | ||
| 5 | * | ||
| 6 | * Copyright (c) 2002-2004 Johann Deneux | ||
| 7 | */ | ||
| 8 | |||
| 9 | /* | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | * | ||
| 24 | * Should you need to contact me, the author, you can do so by | ||
| 25 | * e-mail - mail your message to <johann.deneux@it.uu.se> | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include <linux/input.h> | ||
| 29 | |||
| 30 | #undef DEBUG | ||
| 31 | #include <linux/usb.h> | ||
| 32 | |||
| 33 | #include <linux/hid.h> | ||
| 34 | #include "usbhid.h" | ||
| 35 | |||
| 36 | /* | ||
| 37 | * This table contains pointers to initializers. To add support for new | ||
| 38 | * devices, you need to add the USB vendor and product ids here. | ||
| 39 | */ | ||
| 40 | struct hid_ff_initializer { | ||
| 41 | u16 idVendor; | ||
| 42 | u16 idProduct; | ||
| 43 | int (*init)(struct hid_device*); | ||
| 44 | }; | ||
| 45 | |||
| 46 | /* | ||
| 47 | * We try pidff when no other driver is found because PID is the | ||
| 48 | * standards compliant way of implementing force feedback in HID. | ||
| 49 | * pidff_init() will quickly abort if the device doesn't appear to | ||
| 50 | * be a PID device | ||
| 51 | */ | ||
| 52 | static struct hid_ff_initializer inits[] = { | ||
| 53 | #ifdef CONFIG_LOGITECH_FF | ||
| 54 | { 0x46d, 0xc211, hid_lgff_init }, /* Logitech Cordless rumble pad */ | ||
| 55 | { 0x46d, 0xc219, hid_lgff_init }, /* Logitech Cordless rumble pad 2 */ | ||
| 56 | { 0x46d, 0xc283, hid_lgff_init }, /* Logitech Wingman Force 3d */ | ||
| 57 | { 0x46d, 0xc286, hid_lgff_init }, /* Logitech Force 3D Pro Joystick */ | ||
| 58 | { 0x46d, 0xc294, hid_lgff_init }, /* Logitech Formula Force EX */ | ||
| 59 | { 0x46d, 0xc295, hid_lgff_init }, /* Logitech MOMO force wheel */ | ||
| 60 | { 0x46d, 0xca03, hid_lgff_init }, /* Logitech MOMO force wheel */ | ||
| 61 | #endif | ||
| 62 | #ifdef CONFIG_LOGIRUMBLEPAD2_FF | ||
| 63 | { 0x46d, 0xc218, hid_lg2ff_init }, /* Logitech Rumblepad 2 */ | ||
| 64 | #endif | ||
| 65 | #ifdef CONFIG_PANTHERLORD_FF | ||
| 66 | { 0x810, 0x0001, hid_plff_init }, /* "Twin USB Joystick" */ | ||
| 67 | { 0xe8f, 0x0003, hid_plff_init }, /* "GreenAsia Inc. USB Joystick " */ | ||
| 68 | #endif | ||
| 69 | #ifdef CONFIG_THRUSTMASTER_FF | ||
| 70 | { 0x44f, 0xb300, hid_tmff_init }, | ||
| 71 | { 0x44f, 0xb304, hid_tmff_init }, | ||
| 72 | { 0x44f, 0xb651, hid_tmff_init }, /* FGT Rumble Force Wheel */ | ||
| 73 | { 0x44f, 0xb654, hid_tmff_init }, /* FGT Force Feedback Wheel */ | ||
| 74 | #endif | ||
| 75 | #ifdef CONFIG_ZEROPLUS_FF | ||
| 76 | { 0xc12, 0x0005, hid_zpff_init }, | ||
| 77 | { 0xc12, 0x0030, hid_zpff_init }, | ||
| 78 | #endif | ||
| 79 | { 0, 0, hid_pidff_init} /* Matches anything */ | ||
| 80 | }; | ||
| 81 | |||
| 82 | int hid_ff_init(struct hid_device* hid) | ||
| 83 | { | ||
| 84 | struct hid_ff_initializer *init; | ||
| 85 | int vendor = le16_to_cpu(hid_to_usb_dev(hid)->descriptor.idVendor); | ||
| 86 | int product = le16_to_cpu(hid_to_usb_dev(hid)->descriptor.idProduct); | ||
| 87 | |||
| 88 | for (init = inits; init->idVendor; init++) | ||
| 89 | if (init->idVendor == vendor && init->idProduct == product) | ||
| 90 | break; | ||
| 91 | |||
| 92 | return init->init(hid); | ||
| 93 | } | ||
| 94 | EXPORT_SYMBOL_GPL(hid_ff_init); | ||
| 95 | |||
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index 011326178c06..484e3eec2f88 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c | |||
| @@ -397,7 +397,6 @@ static void pidff_set_condition_report(struct pidff_device *pidff, | |||
| 397 | effect->u.condition[i].left_saturation); | 397 | effect->u.condition[i].left_saturation); |
| 398 | pidff_set(&pidff->set_condition[PID_DEAD_BAND], | 398 | pidff_set(&pidff->set_condition[PID_DEAD_BAND], |
| 399 | effect->u.condition[i].deadband); | 399 | effect->u.condition[i].deadband); |
| 400 | usbhid_wait_io(pidff->hid); | ||
| 401 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONDITION], | 400 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONDITION], |
| 402 | USB_DIR_OUT); | 401 | USB_DIR_OUT); |
| 403 | } | 402 | } |
| @@ -512,7 +511,6 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n) | |||
| 512 | pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; | 511 | pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; |
| 513 | } | 512 | } |
| 514 | 513 | ||
| 515 | usbhid_wait_io(pidff->hid); | ||
| 516 | usbhid_submit_report(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], | 514 | usbhid_submit_report(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], |
| 517 | USB_DIR_OUT); | 515 | USB_DIR_OUT); |
| 518 | } | 516 | } |
| @@ -548,6 +546,9 @@ static int pidff_erase_effect(struct input_dev *dev, int effect_id) | |||
| 548 | int pid_id = pidff->pid_id[effect_id]; | 546 | int pid_id = pidff->pid_id[effect_id]; |
| 549 | 547 | ||
| 550 | debug("starting to erase %d/%d", effect_id, pidff->pid_id[effect_id]); | 548 | debug("starting to erase %d/%d", effect_id, pidff->pid_id[effect_id]); |
| 549 | /* Wait for the queue to clear. We do not want a full fifo to | ||
| 550 | prevent the effect removal. */ | ||
| 551 | usbhid_wait_io(pidff->hid); | ||
| 551 | pidff_playback_pid(pidff, pid_id, 0); | 552 | pidff_playback_pid(pidff, pid_id, 0); |
| 552 | pidff_erase_pid(pidff, pid_id); | 553 | pidff_erase_pid(pidff, pid_id); |
| 553 | 554 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index b15f88249639..47ebe045f9b5 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -17,412 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/hid.h> | 18 | #include <linux/hid.h> |
| 19 | 19 | ||
| 20 | #define USB_VENDOR_ID_A4TECH 0x09da | 20 | #include "../hid-ids.h" |
| 21 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 | ||
| 22 | #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a | ||
| 23 | |||
| 24 | #define USB_VENDOR_ID_AASHIMA 0x06d6 | ||
| 25 | #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 | ||
| 26 | #define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026 | ||
| 27 | |||
| 28 | #define USB_VENDOR_ID_ACECAD 0x0460 | ||
| 29 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 | ||
| 30 | #define USB_DEVICE_ID_ACECAD_302 0x0008 | ||
| 31 | |||
| 32 | #define USB_VENDOR_ID_ADS_TECH 0x06e1 | ||
| 33 | #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 | ||
| 34 | |||
| 35 | #define USB_VENDOR_ID_AFATECH 0x15a4 | ||
| 36 | #define USB_DEVICE_ID_AFATECH_AF9016 0x9016 | ||
| 37 | |||
| 38 | #define USB_VENDOR_ID_AIPTEK 0x08ca | ||
| 39 | #define USB_DEVICE_ID_AIPTEK_01 0x0001 | ||
| 40 | #define USB_DEVICE_ID_AIPTEK_10 0x0010 | ||
| 41 | #define USB_DEVICE_ID_AIPTEK_20 0x0020 | ||
| 42 | #define USB_DEVICE_ID_AIPTEK_21 0x0021 | ||
| 43 | #define USB_DEVICE_ID_AIPTEK_22 0x0022 | ||
| 44 | #define USB_DEVICE_ID_AIPTEK_23 0x0023 | ||
| 45 | #define USB_DEVICE_ID_AIPTEK_24 0x0024 | ||
| 46 | |||
| 47 | #define USB_VENDOR_ID_AIRCABLE 0x16CA | ||
| 48 | #define USB_DEVICE_ID_AIRCABLE1 0x1502 | ||
| 49 | |||
| 50 | #define USB_VENDOR_ID_ALCOR 0x058f | ||
| 51 | #define USB_DEVICE_ID_ALCOR_USBRS232 0x9720 | ||
| 52 | |||
| 53 | #define USB_VENDOR_ID_ALPS 0x0433 | ||
| 54 | #define USB_DEVICE_ID_IBM_GAMEPAD 0x1101 | ||
| 55 | |||
| 56 | #define USB_VENDOR_ID_APPLE 0x05ac | ||
| 57 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 | ||
| 58 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e | ||
| 59 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f | ||
| 60 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 | ||
| 61 | #define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215 | ||
| 62 | #define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216 | ||
| 63 | #define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217 | ||
| 64 | #define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218 | ||
| 65 | #define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219 | ||
| 66 | #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a | ||
| 67 | #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b | ||
| 68 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c | ||
| 69 | #define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220 | ||
| 70 | #define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221 | ||
| 71 | #define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222 | ||
| 72 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 | ||
| 73 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 | ||
| 74 | #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 | ||
| 75 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229 | ||
| 76 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a | ||
| 77 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b | ||
| 78 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c | ||
| 79 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d | ||
| 80 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e | ||
| 81 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 | ||
| 82 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 | ||
| 83 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 | ||
| 84 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | ||
| 85 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | ||
| 86 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 | ||
| 87 | |||
| 88 | #define USB_VENDOR_ID_ASUS 0x0b05 | ||
| 89 | #define USB_DEVICE_ID_ASUS_LCM 0x1726 | ||
| 90 | |||
| 91 | #define USB_VENDOR_ID_ATEN 0x0557 | ||
| 92 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 | ||
| 93 | #define USB_DEVICE_ID_ATEN_CS124U 0x2202 | ||
| 94 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 | ||
| 95 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 | ||
| 96 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 | ||
| 97 | |||
| 98 | #define USB_VENDOR_ID_BELKIN 0x050d | ||
| 99 | #define USB_DEVICE_ID_FLIP_KVM 0x3201 | ||
| 100 | |||
| 101 | #define USB_VENDOR_ID_BERKSHIRE 0x0c98 | ||
| 102 | #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 | ||
| 103 | |||
| 104 | #define USB_VENDOR_ID_CHERRY 0x046a | ||
| 105 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 | ||
| 106 | |||
| 107 | #define USB_VENDOR_ID_CHIC 0x05fe | ||
| 108 | #define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014 | ||
| 109 | |||
| 110 | #define USB_VENDOR_ID_CIDC 0x1677 | ||
| 111 | |||
| 112 | #define USB_VENDOR_ID_CMEDIA 0x0d8c | ||
| 113 | #define USB_DEVICE_ID_CM109 0x000e | ||
| 114 | |||
| 115 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 | ||
| 116 | #define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500 | ||
| 117 | #define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff | ||
| 118 | |||
| 119 | #define USB_VENDOR_ID_CYGNAL 0x10c4 | ||
| 120 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a | ||
| 121 | |||
| 122 | #define USB_VENDOR_ID_CYPRESS 0x04b4 | ||
| 123 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 | ||
| 124 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 | ||
| 125 | #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417 | ||
| 126 | #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 | ||
| 127 | #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 | ||
| 128 | |||
| 129 | #define USB_VENDOR_ID_DELL 0x413c | ||
| 130 | #define USB_DEVICE_ID_DELL_W7658 0x2005 | ||
| 131 | |||
| 132 | #define USB_VENDOR_ID_DELORME 0x1163 | ||
| 133 | #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 | ||
| 134 | #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 | ||
| 135 | |||
| 136 | #define USB_VENDOR_ID_DMI 0x0c0b | ||
| 137 | #define USB_DEVICE_ID_DMI_ENC 0x5fab | ||
| 138 | |||
| 139 | #define USB_VENDOR_ID_ELO 0x04E7 | ||
| 140 | #define USB_DEVICE_ID_ELO_TS2700 0x0020 | ||
| 141 | |||
| 142 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f | ||
| 143 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 | ||
| 144 | |||
| 145 | #define USB_VENDOR_ID_EZKEY 0x0518 | ||
| 146 | #define USB_DEVICE_ID_BTC_8193 0x0002 | ||
| 147 | |||
| 148 | #define USB_VENDOR_ID_GAMERON 0x0810 | ||
| 149 | #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 | ||
| 150 | |||
| 151 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc | ||
| 152 | |||
| 153 | #define USB_VENDOR_ID_GLAB 0x06c2 | ||
| 154 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 | ||
| 155 | #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 | ||
| 156 | #define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040 | ||
| 157 | #define USB_DEVICE_ID_0_16_16_IF_KIT 0x0044 | ||
| 158 | #define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045 | ||
| 159 | #define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051 | ||
| 160 | #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 | ||
| 161 | #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 | ||
| 162 | |||
| 163 | #define USB_VENDOR_ID_GOTOP 0x08f2 | ||
| 164 | #define USB_DEVICE_ID_SUPER_Q2 0x007f | ||
| 165 | #define USB_DEVICE_ID_GOGOPEN 0x00ce | ||
| 166 | #define USB_DEVICE_ID_PENPOWER 0x00f4 | ||
| 167 | |||
| 168 | #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 | ||
| 169 | #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 | ||
| 170 | |||
| 171 | #define USB_VENDOR_ID_GRIFFIN 0x077d | ||
| 172 | #define USB_DEVICE_ID_POWERMATE 0x0410 | ||
| 173 | #define USB_DEVICE_ID_SOUNDKNOB 0x04AA | ||
| 174 | |||
| 175 | #define USB_VENDOR_ID_GTCO 0x078c | ||
| 176 | #define USB_DEVICE_ID_GTCO_90 0x0090 | ||
| 177 | #define USB_DEVICE_ID_GTCO_100 0x0100 | ||
| 178 | #define USB_DEVICE_ID_GTCO_101 0x0101 | ||
| 179 | #define USB_DEVICE_ID_GTCO_103 0x0103 | ||
| 180 | #define USB_DEVICE_ID_GTCO_104 0x0104 | ||
| 181 | #define USB_DEVICE_ID_GTCO_105 0x0105 | ||
| 182 | #define USB_DEVICE_ID_GTCO_106 0x0106 | ||
| 183 | #define USB_DEVICE_ID_GTCO_107 0x0107 | ||
| 184 | #define USB_DEVICE_ID_GTCO_108 0x0108 | ||
| 185 | #define USB_DEVICE_ID_GTCO_200 0x0200 | ||
| 186 | #define USB_DEVICE_ID_GTCO_201 0x0201 | ||
| 187 | #define USB_DEVICE_ID_GTCO_202 0x0202 | ||
| 188 | #define USB_DEVICE_ID_GTCO_203 0x0203 | ||
| 189 | #define USB_DEVICE_ID_GTCO_204 0x0204 | ||
| 190 | #define USB_DEVICE_ID_GTCO_205 0x0205 | ||
| 191 | #define USB_DEVICE_ID_GTCO_206 0x0206 | ||
| 192 | #define USB_DEVICE_ID_GTCO_207 0x0207 | ||
| 193 | #define USB_DEVICE_ID_GTCO_300 0x0300 | ||
| 194 | #define USB_DEVICE_ID_GTCO_301 0x0301 | ||
| 195 | #define USB_DEVICE_ID_GTCO_302 0x0302 | ||
| 196 | #define USB_DEVICE_ID_GTCO_303 0x0303 | ||
| 197 | #define USB_DEVICE_ID_GTCO_304 0x0304 | ||
| 198 | #define USB_DEVICE_ID_GTCO_305 0x0305 | ||
| 199 | #define USB_DEVICE_ID_GTCO_306 0x0306 | ||
| 200 | #define USB_DEVICE_ID_GTCO_307 0x0307 | ||
| 201 | #define USB_DEVICE_ID_GTCO_308 0x0308 | ||
| 202 | #define USB_DEVICE_ID_GTCO_309 0x0309 | ||
| 203 | #define USB_DEVICE_ID_GTCO_400 0x0400 | ||
| 204 | #define USB_DEVICE_ID_GTCO_401 0x0401 | ||
| 205 | #define USB_DEVICE_ID_GTCO_402 0x0402 | ||
| 206 | #define USB_DEVICE_ID_GTCO_403 0x0403 | ||
| 207 | #define USB_DEVICE_ID_GTCO_404 0x0404 | ||
| 208 | #define USB_DEVICE_ID_GTCO_405 0x0405 | ||
| 209 | #define USB_DEVICE_ID_GTCO_500 0x0500 | ||
| 210 | #define USB_DEVICE_ID_GTCO_501 0x0501 | ||
| 211 | #define USB_DEVICE_ID_GTCO_502 0x0502 | ||
| 212 | #define USB_DEVICE_ID_GTCO_503 0x0503 | ||
| 213 | #define USB_DEVICE_ID_GTCO_504 0x0504 | ||
| 214 | #define USB_DEVICE_ID_GTCO_1000 0x1000 | ||
| 215 | #define USB_DEVICE_ID_GTCO_1001 0x1001 | ||
| 216 | #define USB_DEVICE_ID_GTCO_1002 0x1002 | ||
| 217 | #define USB_DEVICE_ID_GTCO_1003 0x1003 | ||
| 218 | #define USB_DEVICE_ID_GTCO_1004 0x1004 | ||
| 219 | #define USB_DEVICE_ID_GTCO_1005 0x1005 | ||
| 220 | #define USB_DEVICE_ID_GTCO_1006 0x1006 | ||
| 221 | #define USB_DEVICE_ID_GTCO_1007 0x1007 | ||
| 222 | #define USB_VENDOR_ID_HAPP 0x078b | ||
| 223 | #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 | ||
| 224 | #define USB_DEVICE_ID_UGCI_FLYING 0x0020 | ||
| 225 | #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 | ||
| 226 | |||
| 227 | #define USB_VENDOR_ID_IMATION 0x0718 | ||
| 228 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 | ||
| 229 | |||
| 230 | #define USB_VENDOR_ID_KBGEAR 0x084e | ||
| 231 | #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 | ||
| 232 | |||
| 233 | #define USB_VENDOR_ID_LD 0x0f11 | ||
| 234 | #define USB_DEVICE_ID_LD_CASSY 0x1000 | ||
| 235 | #define USB_DEVICE_ID_LD_POCKETCASSY 0x1010 | ||
| 236 | #define USB_DEVICE_ID_LD_MOBILECASSY 0x1020 | ||
| 237 | #define USB_DEVICE_ID_LD_JWM 0x1080 | ||
| 238 | #define USB_DEVICE_ID_LD_DMMP 0x1081 | ||
| 239 | #define USB_DEVICE_ID_LD_UMIP 0x1090 | ||
| 240 | #define USB_DEVICE_ID_LD_XRAY1 0x1100 | ||
| 241 | #define USB_DEVICE_ID_LD_XRAY2 0x1101 | ||
| 242 | #define USB_DEVICE_ID_LD_VIDEOCOM 0x1200 | ||
| 243 | #define USB_DEVICE_ID_LD_COM3LAB 0x2000 | ||
| 244 | #define USB_DEVICE_ID_LD_TELEPORT 0x2010 | ||
| 245 | #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 | ||
| 246 | #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 | ||
| 247 | #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 | ||
| 248 | |||
| 249 | #define USB_VENDOR_ID_LOGITECH 0x046d | ||
| 250 | #define USB_DEVICE_ID_LOGITECH_LX3 0xc044 | ||
| 251 | #define USB_DEVICE_ID_LOGITECH_V150 0xc047 | ||
| 252 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 | ||
| 253 | #define USB_DEVICE_ID_LOGITECH_HARMONY 0xc110 | ||
| 254 | #define USB_DEVICE_ID_LOGITECH_HARMONY_2 0xc111 | ||
| 255 | #define USB_DEVICE_ID_LOGITECH_HARMONY_3 0xc112 | ||
| 256 | #define USB_DEVICE_ID_LOGITECH_HARMONY_4 0xc113 | ||
| 257 | #define USB_DEVICE_ID_LOGITECH_HARMONY_5 0xc114 | ||
| 258 | #define USB_DEVICE_ID_LOGITECH_HARMONY_6 0xc115 | ||
| 259 | #define USB_DEVICE_ID_LOGITECH_HARMONY_7 0xc116 | ||
| 260 | #define USB_DEVICE_ID_LOGITECH_HARMONY_8 0xc117 | ||
| 261 | #define USB_DEVICE_ID_LOGITECH_HARMONY_9 0xc118 | ||
| 262 | #define USB_DEVICE_ID_LOGITECH_HARMONY_10 0xc119 | ||
| 263 | #define USB_DEVICE_ID_LOGITECH_HARMONY_11 0xc11a | ||
| 264 | #define USB_DEVICE_ID_LOGITECH_HARMONY_12 0xc11b | ||
| 265 | #define USB_DEVICE_ID_LOGITECH_HARMONY_13 0xc11c | ||
| 266 | #define USB_DEVICE_ID_LOGITECH_HARMONY_14 0xc11d | ||
| 267 | #define USB_DEVICE_ID_LOGITECH_HARMONY_15 0xc11e | ||
| 268 | #define USB_DEVICE_ID_LOGITECH_HARMONY_16 0xc11f | ||
| 269 | #define USB_DEVICE_ID_LOGITECH_HARMONY_17 0xc120 | ||
| 270 | #define USB_DEVICE_ID_LOGITECH_HARMONY_18 0xc121 | ||
| 271 | #define USB_DEVICE_ID_LOGITECH_HARMONY_19 0xc122 | ||
| 272 | #define USB_DEVICE_ID_LOGITECH_HARMONY_20 0xc123 | ||
| 273 | #define USB_DEVICE_ID_LOGITECH_HARMONY_21 0xc124 | ||
| 274 | #define USB_DEVICE_ID_LOGITECH_HARMONY_22 0xc125 | ||
| 275 | #define USB_DEVICE_ID_LOGITECH_HARMONY_23 0xc126 | ||
| 276 | #define USB_DEVICE_ID_LOGITECH_HARMONY_24 0xc127 | ||
| 277 | #define USB_DEVICE_ID_LOGITECH_HARMONY_25 0xc128 | ||
| 278 | #define USB_DEVICE_ID_LOGITECH_HARMONY_26 0xc129 | ||
| 279 | #define USB_DEVICE_ID_LOGITECH_HARMONY_27 0xc12a | ||
| 280 | #define USB_DEVICE_ID_LOGITECH_HARMONY_28 0xc12b | ||
| 281 | #define USB_DEVICE_ID_LOGITECH_HARMONY_29 0xc12c | ||
| 282 | #define USB_DEVICE_ID_LOGITECH_HARMONY_30 0xc12d | ||
| 283 | #define USB_DEVICE_ID_LOGITECH_HARMONY_31 0xc12e | ||
| 284 | #define USB_DEVICE_ID_LOGITECH_HARMONY_32 0xc12f | ||
| 285 | #define USB_DEVICE_ID_LOGITECH_HARMONY_33 0xc130 | ||
| 286 | #define USB_DEVICE_ID_LOGITECH_HARMONY_34 0xc131 | ||
| 287 | #define USB_DEVICE_ID_LOGITECH_HARMONY_35 0xc132 | ||
| 288 | #define USB_DEVICE_ID_LOGITECH_HARMONY_36 0xc133 | ||
| 289 | #define USB_DEVICE_ID_LOGITECH_HARMONY_37 0xc134 | ||
| 290 | #define USB_DEVICE_ID_LOGITECH_HARMONY_38 0xc135 | ||
| 291 | #define USB_DEVICE_ID_LOGITECH_HARMONY_39 0xc136 | ||
| 292 | #define USB_DEVICE_ID_LOGITECH_HARMONY_40 0xc137 | ||
| 293 | #define USB_DEVICE_ID_LOGITECH_HARMONY_41 0xc138 | ||
| 294 | #define USB_DEVICE_ID_LOGITECH_HARMONY_42 0xc139 | ||
| 295 | #define USB_DEVICE_ID_LOGITECH_HARMONY_43 0xc13a | ||
| 296 | #define USB_DEVICE_ID_LOGITECH_HARMONY_44 0xc13b | ||
| 297 | #define USB_DEVICE_ID_LOGITECH_HARMONY_45 0xc13c | ||
| 298 | #define USB_DEVICE_ID_LOGITECH_HARMONY_46 0xc13d | ||
| 299 | #define USB_DEVICE_ID_LOGITECH_HARMONY_47 0xc13e | ||
| 300 | #define USB_DEVICE_ID_LOGITECH_HARMONY_48 0xc13f | ||
| 301 | #define USB_DEVICE_ID_LOGITECH_HARMONY_49 0xc140 | ||
| 302 | #define USB_DEVICE_ID_LOGITECH_HARMONY_50 0xc141 | ||
| 303 | #define USB_DEVICE_ID_LOGITECH_HARMONY_51 0xc142 | ||
| 304 | #define USB_DEVICE_ID_LOGITECH_HARMONY_52 0xc143 | ||
| 305 | #define USB_DEVICE_ID_LOGITECH_HARMONY_53 0xc144 | ||
| 306 | #define USB_DEVICE_ID_LOGITECH_HARMONY_54 0xc145 | ||
| 307 | #define USB_DEVICE_ID_LOGITECH_HARMONY_55 0xc146 | ||
| 308 | #define USB_DEVICE_ID_LOGITECH_HARMONY_56 0xc147 | ||
| 309 | #define USB_DEVICE_ID_LOGITECH_HARMONY_57 0xc148 | ||
| 310 | #define USB_DEVICE_ID_LOGITECH_HARMONY_58 0xc149 | ||
| 311 | #define USB_DEVICE_ID_LOGITECH_HARMONY_59 0xc14a | ||
| 312 | #define USB_DEVICE_ID_LOGITECH_HARMONY_60 0xc14b | ||
| 313 | #define USB_DEVICE_ID_LOGITECH_HARMONY_61 0xc14c | ||
| 314 | #define USB_DEVICE_ID_LOGITECH_HARMONY_62 0xc14d | ||
| 315 | #define USB_DEVICE_ID_LOGITECH_HARMONY_63 0xc14e | ||
| 316 | #define USB_DEVICE_ID_LOGITECH_HARMONY_64 0xc14f | ||
| 317 | #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215 | ||
| 318 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 | ||
| 319 | #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a | ||
| 320 | #define USB_DEVICE_ID_LOGITECH_KBD 0xc311 | ||
| 321 | #define USB_DEVICE_ID_S510_RECEIVER 0xc50c | ||
| 322 | #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 | ||
| 323 | #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512 | ||
| 324 | #define USB_DEVICE_ID_MX3000_RECEIVER 0xc513 | ||
| 325 | #define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704 | ||
| 326 | #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 | ||
| 327 | #define USB_DEVICE_ID_DINOVO_MINI 0xc71f | ||
| 328 | |||
| 329 | #define USB_VENDOR_ID_MCC 0x09db | ||
| 330 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | ||
| 331 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | ||
| 332 | |||
| 333 | #define USB_VENDOR_ID_MGE 0x0463 | ||
| 334 | #define USB_DEVICE_ID_MGE_UPS 0xffff | ||
| 335 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 | ||
| 336 | |||
| 337 | #define USB_VENDOR_ID_MICROCHIP 0x04d8 | ||
| 338 | #define USB_DEVICE_ID_PICKIT1 0x0032 | ||
| 339 | #define USB_DEVICE_ID_PICKIT2 0x0033 | ||
| 340 | |||
| 341 | #define USB_VENDOR_ID_MICROSOFT 0x045e | ||
| 342 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b | ||
| 343 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d | ||
| 344 | #define USB_DEVICE_ID_DESKTOP_RECV_1028 0x00f9 | ||
| 345 | #define USB_DEVICE_ID_MS_NE4K 0x00db | ||
| 346 | #define USB_DEVICE_ID_MS_LK6K 0x00f9 | ||
| 347 | |||
| 348 | #define USB_VENDOR_ID_MONTEREY 0x0566 | ||
| 349 | #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 | ||
| 350 | |||
| 351 | #define USB_VENDOR_ID_NCR 0x0404 | ||
| 352 | #define USB_DEVICE_ID_NCR_FIRST 0x0300 | ||
| 353 | #define USB_DEVICE_ID_NCR_LAST 0x03ff | ||
| 354 | |||
| 355 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 | ||
| 356 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 | ||
| 357 | |||
| 358 | #define USB_VENDOR_ID_NATSU 0x08b7 | ||
| 359 | #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 | ||
| 360 | |||
| 361 | #define USB_VENDOR_ID_NEC 0x073e | ||
| 362 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 | ||
| 363 | |||
| 364 | #define USB_VENDOR_ID_ONTRAK 0x0a07 | ||
| 365 | #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 | ||
| 366 | |||
| 367 | #define USB_VENDOR_ID_PANJIT 0x134c | ||
| 368 | |||
| 369 | #define USB_VENDOR_ID_PANTHERLORD 0x0810 | ||
| 370 | #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001 | ||
| 371 | |||
| 372 | #define USB_VENDOR_ID_PETALYNX 0x18b1 | ||
| 373 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | ||
| 374 | |||
| 375 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 | ||
| 376 | #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 | ||
| 377 | |||
| 378 | #define USB_VENDOR_ID_SAITEK 0x06a3 | ||
| 379 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | ||
| 380 | |||
| 381 | #define USB_VENDOR_ID_SAMSUNG 0x0419 | ||
| 382 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | ||
| 383 | |||
| 384 | #define USB_VENDOR_ID_SONY 0x054c | ||
| 385 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 | ||
| 386 | |||
| 387 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 | ||
| 388 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038 | ||
| 389 | |||
| 390 | #define USB_VENDOR_ID_SUN 0x0430 | ||
| 391 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | ||
| 392 | |||
| 393 | #define USB_VENDOR_ID_SUNPLUS 0x04fc | ||
| 394 | #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 | ||
| 395 | |||
| 396 | #define USB_VENDOR_ID_TOPMAX 0x0663 | ||
| 397 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 | ||
| 398 | |||
| 399 | #define USB_VENDOR_ID_TURBOX 0x062a | ||
| 400 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 | ||
| 401 | |||
| 402 | #define USB_VENDOR_ID_VERNIER 0x08f7 | ||
| 403 | #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 | ||
| 404 | #define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 | ||
| 405 | #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 | ||
| 406 | #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 | ||
| 407 | #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006 | ||
| 408 | |||
| 409 | #define USB_VENDOR_ID_WACOM 0x056a | ||
| 410 | |||
| 411 | #define USB_VENDOR_ID_WISEGROUP 0x0925 | ||
| 412 | #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 | ||
| 413 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 | ||
| 414 | #define USB_DEVICE_ID_8_8_4_IF_KIT 0x8201 | ||
| 415 | #define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800 | ||
| 416 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 | ||
| 417 | |||
| 418 | #define USB_VENDOR_ID_WISEGROUP_LTD 0x6677 | ||
| 419 | #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802 | ||
| 420 | |||
| 421 | #define USB_VENDOR_ID_YEALINK 0x6993 | ||
| 422 | #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001 | ||
| 423 | |||
| 424 | #define USB_VENDOR_ID_KYE 0x0458 | ||
| 425 | #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 | ||
| 426 | 21 | ||
| 427 | /* | 22 | /* |
| 428 | * Alphabetically sorted blacklist by quirk type. | 23 | * Alphabetically sorted blacklist by quirk type. |
| @@ -433,18 +28,10 @@ static const struct hid_blacklist { | |||
| 433 | __u16 idProduct; | 28 | __u16 idProduct; |
| 434 | __u32 quirks; | 29 | __u32 quirks; |
| 435 | } hid_blacklist[] = { | 30 | } hid_blacklist[] = { |
| 436 | |||
| 437 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, | ||
| 438 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D, HID_QUIRK_2WHEEL_MOUSE_HACK_B8 }, | ||
| 439 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, | ||
| 440 | |||
| 441 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS }, | ||
| 442 | |||
| 443 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, | 31 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, |
| 444 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, | 32 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, |
| 445 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, | 33 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, |
| 446 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, | 34 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, |
| 447 | { USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR, HID_QUIRK_MULTI_INPUT }, | ||
| 448 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 35 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
| 449 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 36 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
| 450 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 37 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
| @@ -453,169 +40,11 @@ static const struct hid_blacklist { | |||
| 453 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, | 40 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, |
| 454 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, | 41 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, |
| 455 | 42 | ||
| 456 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP, HID_QUIRK_DUPLICATE_USAGES }, | ||
| 457 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE, HID_QUIRK_DUPLICATE_USAGES }, | ||
| 458 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI, HID_QUIRK_DUPLICATE_USAGES }, | ||
| 459 | |||
| 460 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, | 43 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, |
| 461 | 44 | ||
| 462 | { USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM, HID_QUIRK_HIDDEV }, | ||
| 463 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT }, | ||
| 464 | { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT }, | ||
| 465 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV, HID_QUIRK_HIDINPUT }, | ||
| 466 | |||
| 467 | { USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193, HID_QUIRK_HWHEEL_WHEEL_INVERT }, | ||
| 468 | |||
| 469 | { USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X, HID_QUIRK_IGNORE }, | ||
| 470 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01, HID_QUIRK_IGNORE }, | ||
| 471 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10, HID_QUIRK_IGNORE }, | ||
| 472 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20, HID_QUIRK_IGNORE }, | ||
| 473 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21, HID_QUIRK_IGNORE }, | ||
| 474 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE }, | ||
| 475 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE }, | ||
| 476 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, | ||
| 477 | { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE }, | ||
| 478 | { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE }, | ||
| 479 | { USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM, HID_QUIRK_IGNORE}, | ||
| 480 | { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, | ||
| 481 | { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE }, | ||
| 482 | { USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X, HID_QUIRK_IGNORE }, | ||
| 483 | { USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109, HID_QUIRK_IGNORE }, | ||
| 484 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE }, | ||
| 485 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE, HID_QUIRK_IGNORE }, | ||
| 486 | { USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE, HID_QUIRK_IGNORE }, | ||
| 487 | { USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20, HID_QUIRK_IGNORE }, | ||
| 488 | { USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE }, | ||
| 489 | { USB_VENDOR_ID_GENERAL_TOUCH, 0x0001, HID_QUIRK_IGNORE }, | ||
| 490 | { USB_VENDOR_ID_GENERAL_TOUCH, 0x0002, HID_QUIRK_IGNORE }, | ||
| 491 | { USB_VENDOR_ID_GENERAL_TOUCH, 0x0003, HID_QUIRK_IGNORE }, | ||
| 492 | { USB_VENDOR_ID_GENERAL_TOUCH, 0x0004, HID_QUIRK_IGNORE }, | ||
| 493 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30, HID_QUIRK_IGNORE }, | ||
| 494 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30, HID_QUIRK_IGNORE }, | ||
| 495 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT, HID_QUIRK_IGNORE }, | ||
| 496 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT, HID_QUIRK_IGNORE }, | ||
| 497 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT, HID_QUIRK_IGNORE }, | ||
| 498 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT, HID_QUIRK_IGNORE }, | ||
| 499 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, | ||
| 500 | { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL, HID_QUIRK_IGNORE }, | ||
| 501 | { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2, HID_QUIRK_IGNORE }, | ||
| 502 | { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN, HID_QUIRK_IGNORE }, | ||
| 503 | { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER, HID_QUIRK_IGNORE }, | ||
| 504 | { USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY, HID_QUIRK_IGNORE }, | ||
| 505 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, | ||
| 506 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, | ||
| 507 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE }, | ||
| 508 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100, HID_QUIRK_IGNORE }, | ||
| 509 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101, HID_QUIRK_IGNORE }, | ||
| 510 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103, HID_QUIRK_IGNORE }, | ||
| 511 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104, HID_QUIRK_IGNORE }, | ||
| 512 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105, HID_QUIRK_IGNORE }, | ||
| 513 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106, HID_QUIRK_IGNORE }, | ||
| 514 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107, HID_QUIRK_IGNORE }, | ||
| 515 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108, HID_QUIRK_IGNORE }, | ||
| 516 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200, HID_QUIRK_IGNORE }, | ||
| 517 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201, HID_QUIRK_IGNORE }, | ||
| 518 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202, HID_QUIRK_IGNORE }, | ||
| 519 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203, HID_QUIRK_IGNORE }, | ||
| 520 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204, HID_QUIRK_IGNORE }, | ||
| 521 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205, HID_QUIRK_IGNORE }, | ||
| 522 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206, HID_QUIRK_IGNORE }, | ||
| 523 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207, HID_QUIRK_IGNORE }, | ||
| 524 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300, HID_QUIRK_IGNORE }, | ||
| 525 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301, HID_QUIRK_IGNORE }, | ||
| 526 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302, HID_QUIRK_IGNORE }, | ||
| 527 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303, HID_QUIRK_IGNORE }, | ||
| 528 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304, HID_QUIRK_IGNORE }, | ||
| 529 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305, HID_QUIRK_IGNORE }, | ||
| 530 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306, HID_QUIRK_IGNORE }, | ||
| 531 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307, HID_QUIRK_IGNORE }, | ||
| 532 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308, HID_QUIRK_IGNORE }, | ||
| 533 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309, HID_QUIRK_IGNORE }, | ||
| 534 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400, HID_QUIRK_IGNORE }, | ||
| 535 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401, HID_QUIRK_IGNORE }, | ||
| 536 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402, HID_QUIRK_IGNORE }, | ||
| 537 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403, HID_QUIRK_IGNORE }, | ||
| 538 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404, HID_QUIRK_IGNORE }, | ||
| 539 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405, HID_QUIRK_IGNORE }, | ||
| 540 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500, HID_QUIRK_IGNORE }, | ||
| 541 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501, HID_QUIRK_IGNORE }, | ||
| 542 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502, HID_QUIRK_IGNORE }, | ||
| 543 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503, HID_QUIRK_IGNORE }, | ||
| 544 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504, HID_QUIRK_IGNORE }, | ||
| 545 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000, HID_QUIRK_IGNORE }, | ||
| 546 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001, HID_QUIRK_IGNORE }, | ||
| 547 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002, HID_QUIRK_IGNORE }, | ||
| 548 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003, HID_QUIRK_IGNORE }, | ||
| 549 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE }, | ||
| 550 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE }, | ||
| 551 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE }, | ||
| 552 | { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007, HID_QUIRK_IGNORE }, | ||
| 553 | { USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA, HID_QUIRK_IGNORE }, | ||
| 554 | { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, | ||
| 555 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE }, | ||
| 556 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY, HID_QUIRK_IGNORE }, | ||
| 557 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY, HID_QUIRK_IGNORE }, | ||
| 558 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM, HID_QUIRK_IGNORE }, | ||
| 559 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP, HID_QUIRK_IGNORE }, | ||
| 560 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP, HID_QUIRK_IGNORE }, | ||
| 561 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY1, HID_QUIRK_IGNORE }, | ||
| 562 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2, HID_QUIRK_IGNORE }, | ||
| 563 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM, HID_QUIRK_IGNORE }, | ||
| 564 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB, HID_QUIRK_IGNORE }, | ||
| 565 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT, HID_QUIRK_IGNORE }, | ||
| 566 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER, HID_QUIRK_IGNORE }, | ||
| 567 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL, HID_QUIRK_IGNORE }, | ||
| 568 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST, HID_QUIRK_IGNORE }, | ||
| 569 | { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE }, | ||
| 570 | { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE }, | ||
| 571 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE }, | ||
| 572 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_IGNORE }, | ||
| 573 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100, HID_QUIRK_IGNORE }, | ||
| 574 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20, HID_QUIRK_IGNORE }, | ||
| 575 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30, HID_QUIRK_IGNORE }, | ||
| 576 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100, HID_QUIRK_IGNORE }, | ||
| 577 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108, HID_QUIRK_IGNORE }, | ||
| 578 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118, HID_QUIRK_IGNORE }, | ||
| 579 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200, HID_QUIRK_IGNORE }, | ||
| 580 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300, HID_QUIRK_IGNORE }, | ||
| 581 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400, HID_QUIRK_IGNORE }, | ||
| 582 | { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500, HID_QUIRK_IGNORE }, | ||
| 583 | { USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE }, | ||
| 584 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, | ||
| 585 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, | ||
| 586 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, | ||
| 587 | { USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD, HID_QUIRK_IGNORE }, | ||
| 588 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, | ||
| 589 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, | ||
| 590 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, | ||
| 591 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE }, | ||
| 592 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC, HID_QUIRK_IGNORE }, | ||
| 593 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | ||
| 594 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | ||
| 595 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT, HID_QUIRK_IGNORE }, | ||
| 596 | { USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K, HID_QUIRK_IGNORE }, | ||
| 597 | |||
| 598 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, | ||
| 599 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, | ||
| 600 | |||
| 601 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1, HID_QUIRK_IGNORE }, | ||
| 602 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2, HID_QUIRK_IGNORE }, | ||
| 603 | |||
| 604 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | ||
| 605 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | ||
| 606 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3, HID_QUIRK_INVERT_HWHEEL }, | ||
| 607 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150, HID_QUIRK_INVERT_HWHEEL }, | ||
| 608 | |||
| 609 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K, HID_QUIRK_MICROSOFT_KEYS }, | ||
| 610 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K, HID_QUIRK_MICROSOFT_KEYS }, | ||
| 611 | |||
| 612 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, | ||
| 613 | |||
| 614 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 45 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
| 615 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, | 46 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, |
| 616 | 47 | ||
| 617 | { USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER, HID_QUIRK_SONY_PS3_CONTROLLER | HID_QUIRK_HIDDEV }, | ||
| 618 | |||
| 619 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, | 48 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, |
| 620 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, | 49 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, |
| 621 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, | 50 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, |
| @@ -623,144 +52,13 @@ static const struct hid_blacklist { | |||
| 623 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 52 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
| 624 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 53 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
| 625 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 54 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
| 626 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D, HID_QUIRK_NOGET }, | ||
| 627 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL, HID_QUIRK_NOGET }, | ||
| 628 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0, HID_QUIRK_NOGET }, | ||
| 629 | { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_NOGET }, | ||
| 630 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | 55 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
| 631 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | 56 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, |
| 632 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 57 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
| 633 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 58 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
| 634 | 59 | ||
| 635 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 60 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
| 636 | 61 | { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | |
| 637 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 638 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 639 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 640 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | ||
| 641 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 642 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 643 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | ||
| 644 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 645 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 646 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | ||
| 647 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 648 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, | ||
| 649 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | ||
| 650 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, | ||
| 651 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 652 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 653 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 654 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, | ||
| 655 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | ||
| 656 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, | ||
| 657 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 658 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD | HID_QUIRK_IGNORE_MOUSE}, | ||
| 659 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE}, | ||
| 660 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE}, | ||
| 661 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD | HID_QUIRK_IGNORE_MOUSE }, | ||
| 662 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 663 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 664 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | ||
| 665 | |||
| 666 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, | ||
| 667 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, | ||
| 668 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY, HID_QUIRK_IGNORE }, | ||
| 669 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_2, HID_QUIRK_IGNORE }, | ||
| 670 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_3, HID_QUIRK_IGNORE }, | ||
| 671 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_4, HID_QUIRK_IGNORE }, | ||
| 672 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_5, HID_QUIRK_IGNORE }, | ||
| 673 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_6, HID_QUIRK_IGNORE }, | ||
| 674 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_7, HID_QUIRK_IGNORE }, | ||
| 675 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_8, HID_QUIRK_IGNORE }, | ||
| 676 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_9, HID_QUIRK_IGNORE }, | ||
| 677 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_10, HID_QUIRK_IGNORE }, | ||
| 678 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_11, HID_QUIRK_IGNORE }, | ||
| 679 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_12, HID_QUIRK_IGNORE }, | ||
| 680 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_13, HID_QUIRK_IGNORE }, | ||
| 681 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_14, HID_QUIRK_IGNORE }, | ||
| 682 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_15, HID_QUIRK_IGNORE }, | ||
| 683 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_16, HID_QUIRK_IGNORE }, | ||
| 684 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_17, HID_QUIRK_IGNORE }, | ||
| 685 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_18, HID_QUIRK_IGNORE }, | ||
| 686 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_19, HID_QUIRK_IGNORE }, | ||
| 687 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_20, HID_QUIRK_IGNORE }, | ||
| 688 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_21, HID_QUIRK_IGNORE }, | ||
| 689 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_22, HID_QUIRK_IGNORE }, | ||
| 690 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_23, HID_QUIRK_IGNORE }, | ||
| 691 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_24, HID_QUIRK_IGNORE }, | ||
| 692 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_25, HID_QUIRK_IGNORE }, | ||
| 693 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_26, HID_QUIRK_IGNORE }, | ||
| 694 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_27, HID_QUIRK_IGNORE }, | ||
| 695 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_28, HID_QUIRK_IGNORE }, | ||
| 696 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_29, HID_QUIRK_IGNORE }, | ||
| 697 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_30, HID_QUIRK_IGNORE }, | ||
| 698 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_31, HID_QUIRK_IGNORE }, | ||
| 699 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_32, HID_QUIRK_IGNORE }, | ||
| 700 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_33, HID_QUIRK_IGNORE }, | ||
| 701 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_34, HID_QUIRK_IGNORE }, | ||
| 702 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_35, HID_QUIRK_IGNORE }, | ||
| 703 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_36, HID_QUIRK_IGNORE }, | ||
| 704 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_37, HID_QUIRK_IGNORE }, | ||
| 705 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_38, HID_QUIRK_IGNORE }, | ||
| 706 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_39, HID_QUIRK_IGNORE }, | ||
| 707 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_40, HID_QUIRK_IGNORE }, | ||
| 708 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_41, HID_QUIRK_IGNORE }, | ||
| 709 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_42, HID_QUIRK_IGNORE }, | ||
| 710 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_43, HID_QUIRK_IGNORE }, | ||
| 711 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_44, HID_QUIRK_IGNORE }, | ||
| 712 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_45, HID_QUIRK_IGNORE }, | ||
| 713 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_46, HID_QUIRK_IGNORE }, | ||
| 714 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_47, HID_QUIRK_IGNORE }, | ||
| 715 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_48, HID_QUIRK_IGNORE }, | ||
| 716 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_49, HID_QUIRK_IGNORE }, | ||
| 717 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_50, HID_QUIRK_IGNORE }, | ||
| 718 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_51, HID_QUIRK_IGNORE }, | ||
| 719 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_52, HID_QUIRK_IGNORE }, | ||
| 720 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_53, HID_QUIRK_IGNORE }, | ||
| 721 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_54, HID_QUIRK_IGNORE }, | ||
| 722 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_55, HID_QUIRK_IGNORE }, | ||
| 723 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_56, HID_QUIRK_IGNORE }, | ||
| 724 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_57, HID_QUIRK_IGNORE }, | ||
| 725 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_58, HID_QUIRK_IGNORE }, | ||
| 726 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_59, HID_QUIRK_IGNORE }, | ||
| 727 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_60, HID_QUIRK_IGNORE }, | ||
| 728 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_61, HID_QUIRK_IGNORE }, | ||
| 729 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_62, HID_QUIRK_IGNORE }, | ||
| 730 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_63, HID_QUIRK_IGNORE }, | ||
| 731 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_64, HID_QUIRK_IGNORE }, | ||
| 732 | { USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY, HID_QUIRK_IGNORE }, | ||
| 733 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560, HID_QUIRK_IGNORE }, | ||
| 734 | |||
| 735 | { 0, 0 } | ||
| 736 | }; | ||
| 737 | |||
| 738 | /* Quirks for devices which require report descriptor fixup go here */ | ||
| 739 | static const struct hid_rdesc_blacklist { | ||
| 740 | __u16 idVendor; | ||
| 741 | __u16 idProduct; | ||
| 742 | __u32 quirks; | ||
| 743 | } hid_rdesc_blacklist[] = { | ||
| 744 | |||
| 745 | { USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION, HID_QUIRK_RDESC_CYMOTION }, | ||
| 746 | |||
| 747 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER, HID_QUIRK_RDESC_LOGITECH }, | ||
| 748 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER, HID_QUIRK_RDESC_LOGITECH }, | ||
| 749 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2, HID_QUIRK_RDESC_LOGITECH }, | ||
| 750 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_DESKTOP_RECV_1028, HID_QUIRK_RDESC_MICROSOFT_RECV_1028 }, | ||
| 751 | |||
| 752 | { USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E, HID_QUIRK_RDESC_BUTTON_CONSUMER }, | ||
| 753 | |||
| 754 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_RDESC_MACBOOK_JIS }, | ||
| 755 | |||
| 756 | { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_RDESC_PETALYNX }, | ||
| 757 | |||
| 758 | { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_RDESC_SAMSUNG_REMOTE }, | ||
| 759 | |||
| 760 | { USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP, HID_QUIRK_RDESC_SUNPLUS_WDESKTOP }, | ||
| 761 | |||
| 762 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, | ||
| 763 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, HID_QUIRK_RDESC_SWAPPED_MIN_MAX }, | ||
| 764 | 62 | ||
| 765 | { 0, 0 } | 63 | { 0, 0 } |
| 766 | }; | 64 | }; |
| @@ -974,16 +272,6 @@ u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct) | |||
| 974 | u32 quirks = 0; | 272 | u32 quirks = 0; |
| 975 | const struct hid_blacklist *bl_entry = NULL; | 273 | const struct hid_blacklist *bl_entry = NULL; |
| 976 | 274 | ||
| 977 | /* Ignore all Wacom devices */ | ||
| 978 | if (idVendor == USB_VENDOR_ID_WACOM) | ||
| 979 | return HID_QUIRK_IGNORE; | ||
| 980 | |||
| 981 | /* ignore all Code Mercenaries IOWarrior devices */ | ||
| 982 | if (idVendor == USB_VENDOR_ID_CODEMERCS) | ||
| 983 | if (idProduct >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && | ||
| 984 | idProduct <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) | ||
| 985 | return HID_QUIRK_IGNORE; | ||
| 986 | |||
| 987 | /* NCR devices must not be queried for reports */ | 275 | /* NCR devices must not be queried for reports */ |
| 988 | if (idVendor == USB_VENDOR_ID_NCR && | 276 | if (idVendor == USB_VENDOR_ID_NCR && |
| 989 | idProduct >= USB_DEVICE_ID_NCR_FIRST && | 277 | idProduct >= USB_DEVICE_ID_NCR_FIRST && |
| @@ -1002,221 +290,3 @@ u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct) | |||
| 1002 | } | 290 | } |
| 1003 | 291 | ||
| 1004 | EXPORT_SYMBOL_GPL(usbhid_lookup_quirk); | 292 | EXPORT_SYMBOL_GPL(usbhid_lookup_quirk); |
| 1005 | |||
| 1006 | /* | ||
| 1007 | * Cherry Cymotion keyboard have an invalid HID report descriptor, | ||
| 1008 | * that needs fixing before we can parse it. | ||
| 1009 | */ | ||
| 1010 | static void usbhid_fixup_cymotion_descriptor(char *rdesc, int rsize) | ||
| 1011 | { | ||
| 1012 | if (rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { | ||
| 1013 | printk(KERN_INFO "Fixing up Cherry Cymotion report descriptor\n"); | ||
| 1014 | rdesc[11] = rdesc[16] = 0xff; | ||
| 1015 | rdesc[12] = rdesc[17] = 0x03; | ||
| 1016 | } | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | |||
| 1020 | /* | ||
| 1021 | * Certain Logitech keyboards send in report #3 keys which are far | ||
| 1022 | * above the logical maximum described in descriptor. This extends | ||
| 1023 | * the original value of 0x28c of logical maximum to 0x104d | ||
| 1024 | */ | ||
| 1025 | static void usbhid_fixup_logitech_descriptor(unsigned char *rdesc, int rsize) | ||
| 1026 | { | ||
| 1027 | if (rsize >= 90 && rdesc[83] == 0x26 | ||
| 1028 | && rdesc[84] == 0x8c | ||
| 1029 | && rdesc[85] == 0x02) { | ||
| 1030 | printk(KERN_INFO "Fixing up Logitech keyboard report descriptor\n"); | ||
| 1031 | rdesc[84] = rdesc[89] = 0x4d; | ||
| 1032 | rdesc[85] = rdesc[90] = 0x10; | ||
| 1033 | } | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | static void usbhid_fixup_sunplus_wdesktop(unsigned char *rdesc, int rsize) | ||
| 1037 | { | ||
| 1038 | if (rsize >= 107 && rdesc[104] == 0x26 | ||
| 1039 | && rdesc[105] == 0x80 | ||
| 1040 | && rdesc[106] == 0x03) { | ||
| 1041 | printk(KERN_INFO "Fixing up Sunplus Wireless Desktop report descriptor\n"); | ||
| 1042 | rdesc[105] = rdesc[110] = 0x03; | ||
| 1043 | rdesc[106] = rdesc[111] = 0x21; | ||
| 1044 | } | ||
| 1045 | } | ||
| 1046 | |||
| 1047 | /* | ||
| 1048 | * Samsung IrDA remote controller (reports as Cypress USB Mouse). | ||
| 1049 | * | ||
| 1050 | * Vendor specific report #4 has a size of 48 bit, | ||
| 1051 | * and therefore is not accepted when inspecting the descriptors. | ||
| 1052 | * As a workaround we reinterpret the report as: | ||
| 1053 | * Variable type, count 6, size 8 bit, log. maximum 255 | ||
| 1054 | * The burden to reconstruct the data is moved into user space. | ||
| 1055 | */ | ||
| 1056 | static void usbhid_fixup_samsung_irda_descriptor(unsigned char *rdesc, | ||
| 1057 | int rsize) | ||
| 1058 | { | ||
| 1059 | if (rsize >= 182 && rdesc[175] == 0x25 | ||
| 1060 | && rdesc[176] == 0x40 | ||
| 1061 | && rdesc[177] == 0x75 | ||
| 1062 | && rdesc[178] == 0x30 | ||
| 1063 | && rdesc[179] == 0x95 | ||
| 1064 | && rdesc[180] == 0x01 | ||
| 1065 | && rdesc[182] == 0x40) { | ||
| 1066 | printk(KERN_INFO "Fixing up Samsung IrDA report descriptor\n"); | ||
| 1067 | rdesc[176] = 0xff; | ||
| 1068 | rdesc[178] = 0x08; | ||
| 1069 | rdesc[180] = 0x06; | ||
| 1070 | rdesc[182] = 0x42; | ||
| 1071 | } | ||
| 1072 | } | ||
| 1073 | |||
| 1074 | /* Petalynx Maxter Remote has maximum for consumer page set too low */ | ||
| 1075 | static void usbhid_fixup_petalynx_descriptor(unsigned char *rdesc, int rsize) | ||
| 1076 | { | ||
| 1077 | if (rsize >= 60 && rdesc[39] == 0x2a | ||
| 1078 | && rdesc[40] == 0xf5 | ||
| 1079 | && rdesc[41] == 0x00 | ||
| 1080 | && rdesc[59] == 0x26 | ||
| 1081 | && rdesc[60] == 0xf9 | ||
| 1082 | && rdesc[61] == 0x00) { | ||
| 1083 | printk(KERN_INFO "Fixing up Petalynx Maxter Remote report descriptor\n"); | ||
| 1084 | rdesc[60] = 0xfa; | ||
| 1085 | rdesc[40] = 0xfa; | ||
| 1086 | } | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | /* | ||
| 1090 | * Some USB barcode readers from cypress have usage min and usage max in | ||
| 1091 | * the wrong order | ||
| 1092 | */ | ||
| 1093 | static void usbhid_fixup_cypress_descriptor(unsigned char *rdesc, int rsize) | ||
| 1094 | { | ||
| 1095 | short fixed = 0; | ||
| 1096 | int i; | ||
| 1097 | |||
| 1098 | for (i = 0; i < rsize - 4; i++) { | ||
| 1099 | if (rdesc[i] == 0x29 && rdesc [i+2] == 0x19) { | ||
| 1100 | unsigned char tmp; | ||
| 1101 | |||
| 1102 | rdesc[i] = 0x19; rdesc[i+2] = 0x29; | ||
| 1103 | tmp = rdesc[i+3]; | ||
| 1104 | rdesc[i+3] = rdesc[i+1]; | ||
| 1105 | rdesc[i+1] = tmp; | ||
| 1106 | } | ||
| 1107 | } | ||
| 1108 | |||
| 1109 | if (fixed) | ||
| 1110 | printk(KERN_INFO "Fixing up Cypress report descriptor\n"); | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | /* | ||
| 1114 | * MacBook JIS keyboard has wrong logical maximum | ||
| 1115 | */ | ||
| 1116 | static void usbhid_fixup_macbook_descriptor(unsigned char *rdesc, int rsize) | ||
| 1117 | { | ||
| 1118 | if (rsize >= 60 && rdesc[53] == 0x65 | ||
| 1119 | && rdesc[59] == 0x65) { | ||
| 1120 | printk(KERN_INFO "Fixing up MacBook JIS keyboard report descriptor\n"); | ||
| 1121 | rdesc[53] = rdesc[59] = 0xe7; | ||
| 1122 | } | ||
| 1123 | } | ||
| 1124 | |||
| 1125 | static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rsize) | ||
| 1126 | { | ||
| 1127 | if (rsize >= 30 && rdesc[29] == 0x05 | ||
| 1128 | && rdesc[30] == 0x09) { | ||
| 1129 | printk(KERN_INFO "Fixing up button/consumer in HID report descriptor\n"); | ||
| 1130 | rdesc[30] = 0x0c; | ||
| 1131 | } | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | /* | ||
| 1135 | * Microsoft Wireless Desktop Receiver (Model 1028) has several | ||
| 1136 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
| 1137 | */ | ||
| 1138 | static void usbhid_fixup_microsoft_descriptor(unsigned char *rdesc, int rsize) | ||
| 1139 | { | ||
| 1140 | if (rsize == 571 && rdesc[284] == 0x19 | ||
| 1141 | && rdesc[286] == 0x2a | ||
| 1142 | && rdesc[304] == 0x19 | ||
| 1143 | && rdesc[306] == 0x29 | ||
| 1144 | && rdesc[352] == 0x1a | ||
| 1145 | && rdesc[355] == 0x2a | ||
| 1146 | && rdesc[557] == 0x19 | ||
| 1147 | && rdesc[559] == 0x29) { | ||
| 1148 | printk(KERN_INFO "Fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); | ||
| 1149 | rdesc[284] = rdesc[304] = rdesc[557] = 0x35; | ||
| 1150 | rdesc[352] = 0x36; | ||
| 1151 | rdesc[286] = rdesc[355] = 0x46; | ||
| 1152 | rdesc[306] = rdesc[559] = 0x45; | ||
| 1153 | } | ||
| 1154 | } | ||
| 1155 | |||
| 1156 | static void __usbhid_fixup_report_descriptor(__u32 quirks, char *rdesc, unsigned rsize) | ||
| 1157 | { | ||
| 1158 | if ((quirks & HID_QUIRK_RDESC_CYMOTION)) | ||
| 1159 | usbhid_fixup_cymotion_descriptor(rdesc, rsize); | ||
| 1160 | |||
| 1161 | if (quirks & HID_QUIRK_RDESC_LOGITECH) | ||
| 1162 | usbhid_fixup_logitech_descriptor(rdesc, rsize); | ||
| 1163 | |||
| 1164 | if (quirks & HID_QUIRK_RDESC_SWAPPED_MIN_MAX) | ||
| 1165 | usbhid_fixup_cypress_descriptor(rdesc, rsize); | ||
| 1166 | |||
| 1167 | if (quirks & HID_QUIRK_RDESC_PETALYNX) | ||
| 1168 | usbhid_fixup_petalynx_descriptor(rdesc, rsize); | ||
| 1169 | |||
| 1170 | if (quirks & HID_QUIRK_RDESC_MACBOOK_JIS) | ||
| 1171 | usbhid_fixup_macbook_descriptor(rdesc, rsize); | ||
| 1172 | |||
| 1173 | if (quirks & HID_QUIRK_RDESC_BUTTON_CONSUMER) | ||
| 1174 | usbhid_fixup_button_consumer_descriptor(rdesc, rsize); | ||
| 1175 | |||
| 1176 | if (quirks & HID_QUIRK_RDESC_SAMSUNG_REMOTE) | ||
| 1177 | usbhid_fixup_samsung_irda_descriptor(rdesc, rsize); | ||
| 1178 | |||
| 1179 | if (quirks & HID_QUIRK_RDESC_MICROSOFT_RECV_1028) | ||
| 1180 | usbhid_fixup_microsoft_descriptor(rdesc, rsize); | ||
| 1181 | |||
| 1182 | if (quirks & HID_QUIRK_RDESC_SUNPLUS_WDESKTOP) | ||
| 1183 | usbhid_fixup_sunplus_wdesktop(rdesc, rsize); | ||
| 1184 | } | ||
| 1185 | |||
| 1186 | /** | ||
| 1187 | * usbhid_fixup_report_descriptor: check if report descriptor needs fixup | ||
| 1188 | * | ||
| 1189 | * Description: | ||
| 1190 | * Walks the hid_rdesc_blacklist[] array and checks whether the device | ||
| 1191 | * is known to have broken report descriptor that needs to be fixed up | ||
| 1192 | * prior to entering the HID parser | ||
| 1193 | * | ||
| 1194 | * Returns: nothing | ||
| 1195 | */ | ||
| 1196 | void usbhid_fixup_report_descriptor(const u16 idVendor, const u16 idProduct, | ||
| 1197 | char *rdesc, unsigned rsize, char **quirks_param) | ||
| 1198 | { | ||
| 1199 | int n, m; | ||
| 1200 | u16 paramVendor, paramProduct; | ||
| 1201 | u32 quirks; | ||
| 1202 | |||
| 1203 | /* static rdesc quirk entries */ | ||
| 1204 | for (n = 0; hid_rdesc_blacklist[n].idVendor; n++) | ||
| 1205 | if (hid_rdesc_blacklist[n].idVendor == idVendor && | ||
| 1206 | hid_rdesc_blacklist[n].idProduct == idProduct) | ||
| 1207 | __usbhid_fixup_report_descriptor(hid_rdesc_blacklist[n].quirks, | ||
| 1208 | rdesc, rsize); | ||
| 1209 | |||
| 1210 | /* runtime rdesc quirk entries handling */ | ||
| 1211 | for (n = 0; quirks_param[n] && n < MAX_USBHID_BOOT_QUIRKS; n++) { | ||
| 1212 | m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", | ||
| 1213 | ¶mVendor, ¶mProduct, &quirks); | ||
| 1214 | |||
| 1215 | if (m != 3) | ||
| 1216 | printk(KERN_WARNING | ||
| 1217 | "Could not parse HID quirk module param %s\n", | ||
| 1218 | quirks_param[n]); | ||
| 1219 | else if (paramVendor == idVendor && paramProduct == idProduct) | ||
| 1220 | __usbhid_fixup_report_descriptor(quirks, rdesc, rsize); | ||
| 1221 | } | ||
| 1222 | } | ||
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 842e9edb888e..babd65dd46ad 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
| @@ -790,21 +790,23 @@ static struct usb_class_driver hiddev_class = { | |||
| 790 | /* | 790 | /* |
| 791 | * This is where hid.c calls us to connect a hid device to the hiddev driver | 791 | * This is where hid.c calls us to connect a hid device to the hiddev driver |
| 792 | */ | 792 | */ |
| 793 | int hiddev_connect(struct hid_device *hid) | 793 | int hiddev_connect(struct hid_device *hid, unsigned int force) |
| 794 | { | 794 | { |
| 795 | struct hiddev *hiddev; | 795 | struct hiddev *hiddev; |
| 796 | struct usbhid_device *usbhid = hid->driver_data; | 796 | struct usbhid_device *usbhid = hid->driver_data; |
| 797 | int i; | ||
| 798 | int retval; | 797 | int retval; |
| 799 | 798 | ||
| 800 | for (i = 0; i < hid->maxcollection; i++) | 799 | if (!force) { |
| 801 | if (hid->collection[i].type == | 800 | unsigned int i; |
| 802 | HID_COLLECTION_APPLICATION && | 801 | for (i = 0; i < hid->maxcollection; i++) |
| 803 | !IS_INPUT_APPLICATION(hid->collection[i].usage)) | 802 | if (hid->collection[i].type == |
| 804 | break; | 803 | HID_COLLECTION_APPLICATION && |
| 804 | !IS_INPUT_APPLICATION(hid->collection[i].usage)) | ||
| 805 | break; | ||
| 805 | 806 | ||
| 806 | if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0) | 807 | if (i == hid->maxcollection) |
| 807 | return -1; | 808 | return -1; |
| 809 | } | ||
| 808 | 810 | ||
| 809 | if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) | 811 | if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) |
| 810 | return -1; | 812 | return -1; |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index 62d2d7c925bd..abedb13c623e 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
| @@ -67,7 +67,7 @@ struct usbhid_device { | |||
| 67 | spinlock_t ctrllock; /* Control fifo spinlock */ | 67 | spinlock_t ctrllock; /* Control fifo spinlock */ |
| 68 | 68 | ||
| 69 | struct urb *urbout; /* Output URB */ | 69 | struct urb *urbout; /* Output URB */ |
| 70 | struct hid_report *out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */ | 70 | struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */ |
| 71 | unsigned char outhead, outtail; /* Output pipe fifo head & tail */ | 71 | unsigned char outhead, outtail; /* Output pipe fifo head & tail */ |
| 72 | char *outbuf; /* Output buffer */ | 72 | char *outbuf; /* Output buffer */ |
| 73 | dma_addr_t outbuf_dma; /* Output buffer dma */ | 73 | dma_addr_t outbuf_dma; /* Output buffer dma */ |
| @@ -82,7 +82,7 @@ struct usbhid_device { | |||
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | #define hid_to_usb_dev(hid_dev) \ | 84 | #define hid_to_usb_dev(hid_dev) \ |
| 85 | container_of(hid_dev->dev->parent, struct usb_device, dev) | 85 | container_of(hid_dev->dev.parent->parent, struct usb_device, dev) |
| 86 | 86 | ||
| 87 | #endif | 87 | #endif |
| 88 | 88 | ||
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 0caaafe01843..b342926dd7fc 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c | |||
| @@ -105,14 +105,16 @@ static void usb_kbd_irq(struct urb *urb) | |||
| 105 | if (usb_kbd_keycode[kbd->old[i]]) | 105 | if (usb_kbd_keycode[kbd->old[i]]) |
| 106 | input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0); | 106 | input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0); |
| 107 | else | 107 | else |
| 108 | info("Unknown key (scancode %#x) released.", kbd->old[i]); | 108 | dev_info(&urb->dev->dev, |
| 109 | "Unknown key (scancode %#x) released.\n", kbd->old[i]); | ||
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) { | 112 | if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) { |
| 112 | if (usb_kbd_keycode[kbd->new[i]]) | 113 | if (usb_kbd_keycode[kbd->new[i]]) |
| 113 | input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1); | 114 | input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1); |
| 114 | else | 115 | else |
| 115 | info("Unknown key (scancode %#x) pressed.", kbd->new[i]); | 116 | dev_info(&urb->dev->dev, |
| 117 | "Unknown key (scancode %#x) released.\n", kbd->new[i]); | ||
| 116 | } | 118 | } |
| 117 | } | 119 | } |
| 118 | 120 | ||
| @@ -159,7 +161,8 @@ static void usb_kbd_led(struct urb *urb) | |||
| 159 | struct usb_kbd *kbd = urb->context; | 161 | struct usb_kbd *kbd = urb->context; |
| 160 | 162 | ||
| 161 | if (urb->status) | 163 | if (urb->status) |
| 162 | warn("led urb status %d received", urb->status); | 164 | dev_warn(&urb->dev->dev, "led urb status %d received\n", |
| 165 | urb->status); | ||
| 163 | 166 | ||
| 164 | if (*(kbd->leds) == kbd->newleds) | 167 | if (*(kbd->leds) == kbd->newleds) |
| 165 | return; | 168 | return; |
| @@ -352,7 +355,8 @@ static int __init usb_kbd_init(void) | |||
| 352 | { | 355 | { |
| 353 | int result = usb_register(&usb_kbd_driver); | 356 | int result = usb_register(&usb_kbd_driver); |
| 354 | if (result == 0) | 357 | if (result == 0) |
| 355 | info(DRIVER_VERSION ":" DRIVER_DESC); | 358 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
| 359 | DRIVER_DESC "\n"); | ||
| 356 | return result; | 360 | return result; |
| 357 | } | 361 | } |
| 358 | 362 | ||
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index 35689ef172cc..72ab4b268096 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c | |||
| @@ -31,6 +31,11 @@ | |||
| 31 | #include <linux/usb/input.h> | 31 | #include <linux/usb/input.h> |
| 32 | #include <linux/hid.h> | 32 | #include <linux/hid.h> |
| 33 | 33 | ||
| 34 | /* for apple IDs */ | ||
| 35 | #ifdef CONFIG_USB_HID_MODULE | ||
| 36 | #include "../hid-ids.h" | ||
| 37 | #endif | ||
| 38 | |||
| 34 | /* | 39 | /* |
| 35 | * Version Information | 40 | * Version Information |
| 36 | */ | 41 | */ |
| @@ -240,7 +245,8 @@ static int __init usb_mouse_init(void) | |||
| 240 | { | 245 | { |
| 241 | int retval = usb_register(&usb_mouse_driver); | 246 | int retval = usb_register(&usb_mouse_driver); |
| 242 | if (retval == 0) | 247 | if (retval == 0) |
| 243 | info(DRIVER_VERSION ":" DRIVER_DESC); | 248 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
| 249 | DRIVER_DESC "\n"); | ||
| 244 | return retval; | 250 | return retval; |
| 245 | } | 251 | } |
| 246 | 252 | ||
diff --git a/include/linux/hid.h b/include/linux/hid.h index ac4e678a04ed..f13bca2dd53b 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -67,6 +67,7 @@ | |||
| 67 | #include <linux/types.h> | 67 | #include <linux/types.h> |
| 68 | #include <linux/slab.h> | 68 | #include <linux/slab.h> |
| 69 | #include <linux/list.h> | 69 | #include <linux/list.h> |
| 70 | #include <linux/mod_devicetable.h> /* hid_device_id */ | ||
| 70 | #include <linux/timer.h> | 71 | #include <linux/timer.h> |
| 71 | #include <linux/workqueue.h> | 72 | #include <linux/workqueue.h> |
| 72 | #include <linux/input.h> | 73 | #include <linux/input.h> |
| @@ -246,6 +247,19 @@ struct hid_item { | |||
| 246 | #define HID_FEATURE_REPORT 2 | 247 | #define HID_FEATURE_REPORT 2 |
| 247 | 248 | ||
| 248 | /* | 249 | /* |
| 250 | * HID connect requests | ||
| 251 | */ | ||
| 252 | |||
| 253 | #define HID_CONNECT_HIDINPUT 0x01 | ||
| 254 | #define HID_CONNECT_HIDINPUT_FORCE 0x02 | ||
| 255 | #define HID_CONNECT_HIDRAW 0x04 | ||
| 256 | #define HID_CONNECT_HIDDEV 0x08 | ||
| 257 | #define HID_CONNECT_HIDDEV_FORCE 0x10 | ||
| 258 | #define HID_CONNECT_FF 0x20 | ||
| 259 | #define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \ | ||
| 260 | HID_CONNECT_HIDDEV|HID_CONNECT_FF) | ||
| 261 | |||
| 262 | /* | ||
| 249 | * HID device quirks. | 263 | * HID device quirks. |
| 250 | */ | 264 | */ |
| 251 | 265 | ||
| @@ -256,48 +270,11 @@ struct hid_item { | |||
| 256 | 270 | ||
| 257 | #define HID_QUIRK_INVERT 0x00000001 | 271 | #define HID_QUIRK_INVERT 0x00000001 |
| 258 | #define HID_QUIRK_NOTOUCH 0x00000002 | 272 | #define HID_QUIRK_NOTOUCH 0x00000002 |
| 259 | #define HID_QUIRK_IGNORE 0x00000004 | ||
| 260 | #define HID_QUIRK_NOGET 0x00000008 | 273 | #define HID_QUIRK_NOGET 0x00000008 |
| 261 | #define HID_QUIRK_HIDDEV 0x00000010 | ||
| 262 | #define HID_QUIRK_BADPAD 0x00000020 | 274 | #define HID_QUIRK_BADPAD 0x00000020 |
| 263 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 275 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
| 264 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x00000080 | ||
| 265 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100 | ||
| 266 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200 | ||
| 267 | #define HID_QUIRK_MIGHTYMOUSE 0x00000400 | ||
| 268 | #define HID_QUIRK_APPLE_HAS_FN 0x00000800 | ||
| 269 | #define HID_QUIRK_APPLE_FN_ON 0x00001000 | ||
| 270 | #define HID_QUIRK_INVERT_HWHEEL 0x00002000 | ||
| 271 | #define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000 | ||
| 272 | #define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000 | ||
| 273 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 276 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
| 274 | #define HID_QUIRK_IGNORE_MOUSE 0x00020000 | ||
| 275 | #define HID_QUIRK_SONY_PS3_CONTROLLER 0x00040000 | ||
| 276 | #define HID_QUIRK_DUPLICATE_USAGES 0x00080000 | ||
| 277 | #define HID_QUIRK_RESET_LEDS 0x00100000 | ||
| 278 | #define HID_QUIRK_HIDINPUT 0x00200000 | ||
| 279 | #define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 | ||
| 280 | #define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 | ||
| 281 | #define HID_QUIRK_IGNORE_HIDINPUT 0x01000000 | ||
| 282 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000 | ||
| 283 | #define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000 | ||
| 284 | #define HID_QUIRK_MICROSOFT_KEYS 0x08000000 | ||
| 285 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 277 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
| 286 | #define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000 | ||
| 287 | |||
| 288 | /* | ||
| 289 | * Separate quirks for runtime report descriptor fixup | ||
| 290 | */ | ||
| 291 | |||
| 292 | #define HID_QUIRK_RDESC_CYMOTION 0x00000001 | ||
| 293 | #define HID_QUIRK_RDESC_LOGITECH 0x00000002 | ||
| 294 | #define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 | ||
| 295 | #define HID_QUIRK_RDESC_PETALYNX 0x00000008 | ||
| 296 | #define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 | ||
| 297 | #define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 | ||
| 298 | #define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 | ||
| 299 | #define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080 | ||
| 300 | #define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100 | ||
| 301 | 278 | ||
| 302 | /* | 279 | /* |
| 303 | * This is the global environment of the parser. This information is | 280 | * This is the global environment of the parser. This information is |
| @@ -411,12 +388,21 @@ struct hid_report_enum { | |||
| 411 | struct hid_control_fifo { | 388 | struct hid_control_fifo { |
| 412 | unsigned char dir; | 389 | unsigned char dir; |
| 413 | struct hid_report *report; | 390 | struct hid_report *report; |
| 391 | char *raw_report; | ||
| 392 | }; | ||
| 393 | |||
| 394 | struct hid_output_fifo { | ||
| 395 | struct hid_report *report; | ||
| 396 | char *raw_report; | ||
| 414 | }; | 397 | }; |
| 415 | 398 | ||
| 416 | #define HID_CLAIMED_INPUT 1 | 399 | #define HID_CLAIMED_INPUT 1 |
| 417 | #define HID_CLAIMED_HIDDEV 2 | 400 | #define HID_CLAIMED_HIDDEV 2 |
| 418 | #define HID_CLAIMED_HIDRAW 4 | 401 | #define HID_CLAIMED_HIDRAW 4 |
| 419 | 402 | ||
| 403 | #define HID_STAT_ADDED 1 | ||
| 404 | #define HID_STAT_PARSED 2 | ||
| 405 | |||
| 420 | #define HID_CTRL_RUNNING 1 | 406 | #define HID_CTRL_RUNNING 1 |
| 421 | #define HID_OUT_RUNNING 2 | 407 | #define HID_OUT_RUNNING 2 |
| 422 | #define HID_IN_RUNNING 3 | 408 | #define HID_IN_RUNNING 3 |
| @@ -431,22 +417,28 @@ struct hid_input { | |||
| 431 | struct input_dev *input; | 417 | struct input_dev *input; |
| 432 | }; | 418 | }; |
| 433 | 419 | ||
| 420 | struct hid_driver; | ||
| 421 | struct hid_ll_driver; | ||
| 422 | |||
| 434 | struct hid_device { /* device report descriptor */ | 423 | struct hid_device { /* device report descriptor */ |
| 435 | __u8 *rdesc; | 424 | __u8 *rdesc; |
| 436 | unsigned rsize; | 425 | unsigned rsize; |
| 437 | struct hid_collection *collection; /* List of HID collections */ | 426 | struct hid_collection *collection; /* List of HID collections */ |
| 438 | unsigned collection_size; /* Number of allocated hid_collections */ | 427 | unsigned collection_size; /* Number of allocated hid_collections */ |
| 439 | unsigned maxcollection; /* Number of parsed collections */ | 428 | unsigned maxcollection; /* Number of parsed collections */ |
| 440 | unsigned maxapplication; /* Number of applications */ | 429 | unsigned maxapplication; /* Number of applications */ |
| 441 | unsigned short bus; /* BUS ID */ | 430 | __u16 bus; /* BUS ID */ |
| 442 | unsigned short vendor; /* Vendor ID */ | 431 | __u32 vendor; /* Vendor ID */ |
| 443 | unsigned short product; /* Product ID */ | 432 | __u32 product; /* Product ID */ |
| 444 | unsigned version; /* HID version */ | 433 | __u32 version; /* HID version */ |
| 445 | unsigned country; /* HID country */ | 434 | unsigned country; /* HID country */ |
| 446 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; | 435 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; |
| 447 | 436 | ||
| 448 | struct device *dev; /* device */ | 437 | struct device dev; /* device */ |
| 438 | struct hid_driver *driver; | ||
| 439 | struct hid_ll_driver *ll_driver; | ||
| 449 | 440 | ||
| 441 | unsigned int status; /* see STAT flags above */ | ||
| 450 | unsigned claimed; /* Claimed by hidinput, hiddev? */ | 442 | unsigned claimed; /* Claimed by hidinput, hiddev? */ |
| 451 | unsigned quirks; /* Various quirks the device can pull on us */ | 443 | unsigned quirks; /* Various quirks the device can pull on us */ |
| 452 | 444 | ||
| @@ -462,26 +454,29 @@ struct hid_device { /* device report descriptor */ | |||
| 462 | 454 | ||
| 463 | void *driver_data; | 455 | void *driver_data; |
| 464 | 456 | ||
| 465 | __s32 delayed_value; /* For A4 Tech mice hwheel quirk */ | 457 | /* temporary hid_ff handling (until moved to the drivers) */ |
| 466 | 458 | int (*ff_init)(struct hid_device *); | |
| 467 | /* device-specific function pointers */ | ||
| 468 | int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); | ||
| 469 | int (*hid_open) (struct hid_device *); | ||
| 470 | void (*hid_close) (struct hid_device *); | ||
| 471 | 459 | ||
| 472 | /* hiddev event handler */ | 460 | /* hiddev event handler */ |
| 461 | int (*hiddev_connect)(struct hid_device *, unsigned int); | ||
| 473 | void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, | 462 | void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, |
| 474 | struct hid_usage *, __s32); | 463 | struct hid_usage *, __s32); |
| 475 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 464 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
| 476 | 465 | ||
| 477 | /* handler for raw output data, used by hidraw */ | 466 | /* handler for raw output data, used by hidraw */ |
| 478 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); | 467 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); |
| 479 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | ||
| 480 | unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)]; | ||
| 481 | unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)]; | ||
| 482 | #endif | ||
| 483 | }; | 468 | }; |
| 484 | 469 | ||
| 470 | static inline void *hid_get_drvdata(struct hid_device *hdev) | ||
| 471 | { | ||
| 472 | return dev_get_drvdata(&hdev->dev); | ||
| 473 | } | ||
| 474 | |||
| 475 | static inline void hid_set_drvdata(struct hid_device *hdev, void *data) | ||
| 476 | { | ||
| 477 | dev_set_drvdata(&hdev->dev, data); | ||
| 478 | } | ||
| 479 | |||
| 485 | #define HID_GLOBAL_STACK_SIZE 4 | 480 | #define HID_GLOBAL_STACK_SIZE 4 |
| 486 | #define HID_COLLECTION_STACK_SIZE 4 | 481 | #define HID_COLLECTION_STACK_SIZE 4 |
| 487 | 482 | ||
| @@ -510,6 +505,107 @@ struct hid_descriptor { | |||
| 510 | struct hid_class_descriptor desc[1]; | 505 | struct hid_class_descriptor desc[1]; |
| 511 | } __attribute__ ((packed)); | 506 | } __attribute__ ((packed)); |
| 512 | 507 | ||
| 508 | #define HID_DEVICE(b, ven, prod) \ | ||
| 509 | .bus = (b), \ | ||
| 510 | .vendor = (ven), .product = (prod) | ||
| 511 | |||
| 512 | #define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod) | ||
| 513 | #define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod) | ||
| 514 | |||
| 515 | #define HID_REPORT_ID(rep) \ | ||
| 516 | .report_type = (rep) | ||
| 517 | #define HID_USAGE_ID(uhid, utype, ucode) \ | ||
| 518 | .usage_hid = (uhid), .usage_type = (utype), .usage_code = (ucode) | ||
| 519 | /* we don't want to catch types and codes equal to 0 */ | ||
| 520 | #define HID_TERMINATOR (HID_ANY_ID - 1) | ||
| 521 | |||
| 522 | struct hid_report_id { | ||
| 523 | __u32 report_type; | ||
| 524 | }; | ||
| 525 | struct hid_usage_id { | ||
| 526 | __u32 usage_hid; | ||
| 527 | __u32 usage_type; | ||
| 528 | __u32 usage_code; | ||
| 529 | }; | ||
| 530 | |||
| 531 | /** | ||
| 532 | * struct hid_driver | ||
| 533 | * @name: driver name (e.g. "Footech_bar-wheel") | ||
| 534 | * @id_table: which devices is this driver for (must be non-NULL for probe | ||
| 535 | * to be called) | ||
| 536 | * @probe: new device inserted | ||
| 537 | * @remove: device removed (NULL if not a hot-plug capable driver) | ||
| 538 | * @report_table: on which reports to call raw_event (NULL means all) | ||
| 539 | * @raw_event: if report in report_table, this hook is called (NULL means nop) | ||
| 540 | * @usage_table: on which events to call event (NULL means all) | ||
| 541 | * @event: if usage in usage_table, this hook is called (NULL means nop) | ||
| 542 | * @report_fixup: called before report descriptor parsing (NULL means nop) | ||
| 543 | * @input_mapping: invoked on input registering before mapping an usage | ||
| 544 | * @input_mapped: invoked on input registering after mapping an usage | ||
| 545 | * | ||
| 546 | * raw_event and event should return 0 on no action performed, 1 when no | ||
| 547 | * further processing should be done and negative on error | ||
| 548 | * | ||
| 549 | * input_mapping shall return a negative value to completely ignore this usage | ||
| 550 | * (e.g. doubled or invalid usage), zero to continue with parsing of this | ||
| 551 | * usage by generic code (no special handling needed) or positive to skip | ||
| 552 | * generic parsing (needed special handling which was done in the hook already) | ||
| 553 | * input_mapped shall return negative to inform the layer that this usage | ||
| 554 | * should not be considered for further processing or zero to notify that | ||
| 555 | * no processing was performed and should be done in a generic manner | ||
| 556 | * Both these functions may be NULL which means the same behavior as returning | ||
| 557 | * zero from them. | ||
| 558 | */ | ||
| 559 | struct hid_driver { | ||
| 560 | char *name; | ||
| 561 | const struct hid_device_id *id_table; | ||
| 562 | |||
| 563 | int (*probe)(struct hid_device *dev, const struct hid_device_id *id); | ||
| 564 | void (*remove)(struct hid_device *dev); | ||
| 565 | |||
| 566 | const struct hid_report_id *report_table; | ||
| 567 | int (*raw_event)(struct hid_device *hdev, struct hid_report *report, | ||
| 568 | u8 *data, int size); | ||
| 569 | const struct hid_usage_id *usage_table; | ||
| 570 | int (*event)(struct hid_device *hdev, struct hid_field *field, | ||
| 571 | struct hid_usage *usage, __s32 value); | ||
| 572 | |||
| 573 | void (*report_fixup)(struct hid_device *hdev, __u8 *buf, | ||
| 574 | unsigned int size); | ||
| 575 | |||
| 576 | int (*input_mapping)(struct hid_device *hdev, | ||
| 577 | struct hid_input *hidinput, struct hid_field *field, | ||
| 578 | struct hid_usage *usage, unsigned long **bit, int *max); | ||
| 579 | int (*input_mapped)(struct hid_device *hdev, | ||
| 580 | struct hid_input *hidinput, struct hid_field *field, | ||
| 581 | struct hid_usage *usage, unsigned long **bit, int *max); | ||
| 582 | /* private: */ | ||
| 583 | struct device_driver driver; | ||
| 584 | }; | ||
| 585 | |||
| 586 | /** | ||
| 587 | * hid_ll_driver - low level driver callbacks | ||
| 588 | * @start: called on probe to start the device | ||
| 589 | * @stop: called on remove | ||
| 590 | * @open: called by input layer on open | ||
| 591 | * @close: called by input layer on close | ||
| 592 | * @hidinput_input_event: event input event (e.g. ff or leds) | ||
| 593 | * @parse: this method is called only once to parse the device data, | ||
| 594 | * shouldn't allocate anything to not leak memory | ||
| 595 | */ | ||
| 596 | struct hid_ll_driver { | ||
| 597 | int (*start)(struct hid_device *hdev); | ||
| 598 | void (*stop)(struct hid_device *hdev); | ||
| 599 | |||
| 600 | int (*open)(struct hid_device *hdev); | ||
| 601 | void (*close)(struct hid_device *hdev); | ||
| 602 | |||
| 603 | int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, | ||
| 604 | unsigned int code, int value); | ||
| 605 | |||
| 606 | int (*parse)(struct hid_device *hdev); | ||
| 607 | }; | ||
| 608 | |||
| 513 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ | 609 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
| 514 | /* We ignore a few input applications that are not widely used */ | 610 | /* We ignore a few input applications that are not widely used */ |
| 515 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) | 611 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) |
| @@ -520,43 +616,157 @@ struct hid_descriptor { | |||
| 520 | extern int hid_debug; | 616 | extern int hid_debug; |
| 521 | #endif | 617 | #endif |
| 522 | 618 | ||
| 619 | extern int hid_add_device(struct hid_device *); | ||
| 620 | extern void hid_destroy_device(struct hid_device *); | ||
| 621 | |||
| 622 | extern int __must_check __hid_register_driver(struct hid_driver *, | ||
| 623 | struct module *, const char *mod_name); | ||
| 624 | static inline int __must_check hid_register_driver(struct hid_driver *driver) | ||
| 625 | { | ||
| 626 | return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | ||
| 627 | } | ||
| 628 | extern void hid_unregister_driver(struct hid_driver *); | ||
| 629 | |||
| 523 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | 630 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); |
| 524 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); | 631 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); |
| 525 | extern int hidinput_connect(struct hid_device *); | 632 | extern int hidinput_connect(struct hid_device *hid, unsigned int force); |
| 526 | extern void hidinput_disconnect(struct hid_device *); | 633 | extern void hidinput_disconnect(struct hid_device *); |
| 527 | 634 | ||
| 528 | int hid_set_field(struct hid_field *, unsigned, __s32); | 635 | int hid_set_field(struct hid_field *, unsigned, __s32); |
| 529 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); | 636 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); |
| 530 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); | 637 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); |
| 531 | int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *); | ||
| 532 | int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | ||
| 533 | int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32); | ||
| 534 | void hid_output_report(struct hid_report *report, __u8 *data); | 638 | void hid_output_report(struct hid_report *report, __u8 *data); |
| 535 | void hid_free_device(struct hid_device *device); | 639 | struct hid_device *hid_allocate_device(void); |
| 536 | struct hid_device *hid_parse_report(__u8 *start, unsigned size); | 640 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
| 641 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | ||
| 642 | |||
| 643 | /** | ||
| 644 | * hid_map_usage - map usage input bits | ||
| 645 | * | ||
| 646 | * @hidinput: hidinput which we are interested in | ||
| 647 | * @usage: usage to fill in | ||
| 648 | * @bit: pointer to input->{}bit (out parameter) | ||
| 649 | * @max: maximal valid usage->code to consider later (out parameter) | ||
| 650 | * @type: input event type (EV_KEY, EV_REL, ...) | ||
| 651 | * @c: code which corresponds to this usage and type | ||
| 652 | */ | ||
| 653 | static inline void hid_map_usage(struct hid_input *hidinput, | ||
| 654 | struct hid_usage *usage, unsigned long **bit, int *max, | ||
| 655 | __u8 type, __u16 c) | ||
| 656 | { | ||
| 657 | struct input_dev *input = hidinput->input; | ||
| 658 | |||
| 659 | usage->type = type; | ||
| 660 | usage->code = c; | ||
| 661 | |||
| 662 | switch (type) { | ||
| 663 | case EV_ABS: | ||
| 664 | *bit = input->absbit; | ||
| 665 | *max = ABS_MAX; | ||
| 666 | break; | ||
| 667 | case EV_REL: | ||
| 668 | *bit = input->relbit; | ||
| 669 | *max = REL_MAX; | ||
| 670 | break; | ||
| 671 | case EV_KEY: | ||
| 672 | *bit = input->keybit; | ||
| 673 | *max = KEY_MAX; | ||
| 674 | break; | ||
| 675 | case EV_LED: | ||
| 676 | *bit = input->ledbit; | ||
| 677 | *max = LED_MAX; | ||
| 678 | break; | ||
| 679 | } | ||
| 680 | } | ||
| 681 | |||
| 682 | /** | ||
| 683 | * hid_map_usage_clear - map usage input bits and clear the input bit | ||
| 684 | * | ||
| 685 | * The same as hid_map_usage, except the @c bit is also cleared in supported | ||
| 686 | * bits (@bit). | ||
| 687 | */ | ||
| 688 | static inline void hid_map_usage_clear(struct hid_input *hidinput, | ||
| 689 | struct hid_usage *usage, unsigned long **bit, int *max, | ||
| 690 | __u8 type, __u16 c) | ||
| 691 | { | ||
| 692 | hid_map_usage(hidinput, usage, bit, max, type, c); | ||
| 693 | clear_bit(c, *bit); | ||
| 694 | } | ||
| 695 | |||
| 696 | /** | ||
| 697 | * hid_parse - parse HW reports | ||
| 698 | * | ||
| 699 | * @hdev: hid device | ||
| 700 | * | ||
| 701 | * Call this from probe after you set up the device (if needed). Your | ||
| 702 | * report_fixup will be called (if non-NULL) after reading raw report from | ||
| 703 | * device before passing it to hid layer for real parsing. | ||
| 704 | */ | ||
| 705 | static inline int __must_check hid_parse(struct hid_device *hdev) | ||
| 706 | { | ||
| 707 | int ret; | ||
| 708 | |||
| 709 | if (hdev->status & HID_STAT_PARSED) | ||
| 710 | return 0; | ||
| 711 | |||
| 712 | ret = hdev->ll_driver->parse(hdev); | ||
| 713 | if (!ret) | ||
| 714 | hdev->status |= HID_STAT_PARSED; | ||
| 715 | |||
| 716 | return ret; | ||
| 717 | } | ||
| 718 | |||
| 719 | /** | ||
| 720 | * hid_hw_start - start underlaying HW | ||
| 721 | * | ||
| 722 | * @hdev: hid device | ||
| 723 | * @connect_mask: which outputs to connect, see HID_CONNECT_* | ||
| 724 | * | ||
| 725 | * Call this in probe function *after* hid_parse. This will setup HW buffers | ||
| 726 | * and start the device (if not deffered to device open). hid_hw_stop must be | ||
| 727 | * called if this was successfull. | ||
| 728 | */ | ||
| 729 | static inline int __must_check hid_hw_start(struct hid_device *hdev, | ||
| 730 | unsigned int connect_mask) | ||
| 731 | { | ||
| 732 | int ret = hdev->ll_driver->start(hdev); | ||
| 733 | if (ret || !connect_mask) | ||
| 734 | return ret; | ||
| 735 | ret = hid_connect(hdev, connect_mask); | ||
| 736 | if (ret) | ||
| 737 | hdev->ll_driver->stop(hdev); | ||
| 738 | return ret; | ||
| 739 | } | ||
| 740 | |||
| 741 | /** | ||
| 742 | * hid_hw_stop - stop underlaying HW | ||
| 743 | * | ||
| 744 | * @hdev: hid device | ||
| 745 | * | ||
| 746 | * This is usually called from remove function or from probe when something | ||
| 747 | * failed and hid_hw_start was called already. | ||
| 748 | */ | ||
| 749 | static inline void hid_hw_stop(struct hid_device *hdev) | ||
| 750 | { | ||
| 751 | hdev->ll_driver->stop(hdev); | ||
| 752 | } | ||
| 753 | |||
| 754 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | ||
| 755 | int interrupt); | ||
| 756 | |||
| 757 | extern int hid_generic_init(void); | ||
| 758 | extern void hid_generic_exit(void); | ||
| 537 | 759 | ||
| 538 | /* HID quirks API */ | 760 | /* HID quirks API */ |
| 539 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); | 761 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); |
| 540 | int usbhid_quirks_init(char **quirks_param); | 762 | int usbhid_quirks_init(char **quirks_param); |
| 541 | void usbhid_quirks_exit(void); | 763 | void usbhid_quirks_exit(void); |
| 542 | void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); | 764 | void usbhid_set_leds(struct hid_device *hid); |
| 543 | |||
| 544 | #ifdef CONFIG_HID_FF | ||
| 545 | int hid_ff_init(struct hid_device *hid); | ||
| 546 | 765 | ||
| 547 | int hid_lgff_init(struct hid_device *hid); | ||
| 548 | int hid_lg2ff_init(struct hid_device *hid); | ||
| 549 | int hid_plff_init(struct hid_device *hid); | ||
| 550 | int hid_tmff_init(struct hid_device *hid); | ||
| 551 | int hid_zpff_init(struct hid_device *hid); | ||
| 552 | #ifdef CONFIG_HID_PID | 766 | #ifdef CONFIG_HID_PID |
| 553 | int hid_pidff_init(struct hid_device *hid); | 767 | int hid_pidff_init(struct hid_device *hid); |
| 554 | #else | 768 | #else |
| 555 | static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } | 769 | #define hid_pidff_init NULL |
| 556 | #endif | ||
| 557 | |||
| 558 | #else | ||
| 559 | static inline int hid_ff_init(struct hid_device *hid) { return -1; } | ||
| 560 | #endif | 770 | #endif |
| 561 | 771 | ||
| 562 | #ifdef CONFIG_HID_DEBUG | 772 | #ifdef CONFIG_HID_DEBUG |
| @@ -572,10 +782,23 @@ dbg_hid(const char *fmt, ...) | |||
| 572 | return 0; | 782 | return 0; |
| 573 | } | 783 | } |
| 574 | #define dbg_hid_line dbg_hid | 784 | #define dbg_hid_line dbg_hid |
| 575 | #endif | 785 | #endif /* HID_DEBUG */ |
| 576 | 786 | ||
| 577 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ | 787 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ |
| 578 | __FILE__ , ## arg) | 788 | __FILE__ , ## arg) |
| 579 | #endif | 789 | #endif /* HID_FF */ |
| 790 | |||
| 791 | #ifdef CONFIG_HID_COMPAT | ||
| 792 | #define HID_COMPAT_LOAD_DRIVER(name) \ | ||
| 793 | void hid_compat_##name(void) { } \ | ||
| 794 | EXPORT_SYMBOL(hid_compat_##name) | ||
| 795 | #else | ||
| 796 | #define HID_COMPAT_LOAD_DRIVER(name) | ||
| 797 | #endif /* HID_COMPAT */ | ||
| 798 | #define HID_COMPAT_CALL_DRIVER(name) do { \ | ||
| 799 | extern void hid_compat_##name(void); \ | ||
| 800 | hid_compat_##name(); \ | ||
| 801 | } while (0) | ||
| 802 | |||
| 580 | #endif | 803 | #endif |
| 581 | 804 | ||
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h index a416b904ba90..c760ae0eb6a1 100644 --- a/include/linux/hiddev.h +++ b/include/linux/hiddev.h | |||
| @@ -182,26 +182,28 @@ struct hiddev_usage_ref_multi { | |||
| 182 | /* To traverse the input report descriptor info for a HID device, perform the | 182 | /* To traverse the input report descriptor info for a HID device, perform the |
| 183 | * following: | 183 | * following: |
| 184 | * | 184 | * |
| 185 | * rinfo.report_type = HID_REPORT_TYPE_INPUT; | 185 | * rinfo.report_type = HID_REPORT_TYPE_INPUT; |
| 186 | * rinfo.report_id = HID_REPORT_ID_FIRST; | 186 | * rinfo.report_id = HID_REPORT_ID_FIRST; |
| 187 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | 187 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); |
| 188 | * | 188 | * |
| 189 | * while (ret >= 0) { | 189 | * while (ret >= 0) { |
| 190 | * for (i = 0; i < rinfo.num_fields; i++) { | 190 | * for (i = 0; i < rinfo.num_fields; i++) { |
| 191 | * finfo.report_type = rinfo.report_type; | 191 | * finfo.report_type = rinfo.report_type; |
| 192 | * finfo.report_id = rinfo.report_id; | 192 | * finfo.report_id = rinfo.report_id; |
| 193 | * finfo.field_index = i; | 193 | * finfo.field_index = i; |
| 194 | * ioctl(fd, HIDIOCGFIELDINFO, &finfo); | 194 | * ioctl(fd, HIDIOCGFIELDINFO, &finfo); |
| 195 | * for (j = 0; j < finfo.maxusage; j++) { | 195 | * for (j = 0; j < finfo.maxusage; j++) { |
| 196 | * uref.field_index = i; | 196 | * uref.report_type = rinfo.report_type; |
| 197 | * uref.usage_index = j; | 197 | * uref.report_id = rinfo.report_id; |
| 198 | * ioctl(fd, HIDIOCGUCODE, &uref); | 198 | * uref.field_index = i; |
| 199 | * ioctl(fd, HIDIOCGUSAGE, &uref); | 199 | * uref.usage_index = j; |
| 200 | * } | 200 | * ioctl(fd, HIDIOCGUCODE, &uref); |
| 201 | * } | 201 | * ioctl(fd, HIDIOCGUSAGE, &uref); |
| 202 | * rinfo.report_id |= HID_REPORT_ID_NEXT; | 202 | * } |
| 203 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | 203 | * } |
| 204 | * } | 204 | * rinfo.report_id |= HID_REPORT_ID_NEXT; |
| 205 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | ||
| 206 | * } | ||
| 205 | */ | 207 | */ |
| 206 | 208 | ||
| 207 | 209 | ||
| @@ -217,7 +219,7 @@ struct hid_field; | |||
| 217 | struct hid_report; | 219 | struct hid_report; |
| 218 | 220 | ||
| 219 | #ifdef CONFIG_USB_HIDDEV | 221 | #ifdef CONFIG_USB_HIDDEV |
| 220 | int hiddev_connect(struct hid_device *); | 222 | int hiddev_connect(struct hid_device *hid, unsigned int force); |
| 221 | void hiddev_disconnect(struct hid_device *); | 223 | void hiddev_disconnect(struct hid_device *); |
| 222 | void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | 224 | void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, |
| 223 | struct hid_usage *usage, __s32 value); | 225 | struct hid_usage *usage, __s32 value); |
| @@ -225,7 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report); | |||
| 225 | int __init hiddev_init(void); | 227 | int __init hiddev_init(void); |
| 226 | void hiddev_exit(void); | 228 | void hiddev_exit(void); |
| 227 | #else | 229 | #else |
| 228 | static inline int hiddev_connect(struct hid_device *hid) { return -1; } | 230 | static inline int hiddev_connect(struct hid_device *hid, |
| 231 | unsigned int force) | ||
| 232 | { return -1; } | ||
| 229 | static inline void hiddev_disconnect(struct hid_device *hid) { } | 233 | static inline void hiddev_disconnect(struct hid_device *hid) { } |
| 230 | static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | 234 | static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, |
| 231 | struct hid_usage *usage, __s32 value) { } | 235 | struct hid_usage *usage, __s32 value) { } |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 3481a7d5bc0a..d6a3f47e95cb 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
| @@ -131,6 +131,16 @@ struct usb_device_id { | |||
| 131 | #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 | 131 | #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 |
| 132 | #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 | 132 | #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 |
| 133 | 133 | ||
| 134 | #define HID_ANY_ID (~0) | ||
| 135 | |||
| 136 | struct hid_device_id { | ||
| 137 | __u16 bus; | ||
| 138 | __u32 vendor; | ||
| 139 | __u32 product; | ||
| 140 | kernel_ulong_t driver_data | ||
| 141 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 142 | }; | ||
| 143 | |||
| 134 | /* s390 CCW devices */ | 144 | /* s390 CCW devices */ |
| 135 | struct ccw_device_id { | 145 | struct ccw_device_id { |
| 136 | __u16 match_flags; /* which fields to match against */ | 146 | __u16 match_flags; /* which fields to match against */ |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 96434d774c84..acdeab3d9807 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
| @@ -578,7 +578,7 @@ static int hidp_session(void *arg) | |||
| 578 | if (session->hid) { | 578 | if (session->hid) { |
| 579 | if (session->hid->claimed & HID_CLAIMED_INPUT) | 579 | if (session->hid->claimed & HID_CLAIMED_INPUT) |
| 580 | hidinput_disconnect(session->hid); | 580 | hidinput_disconnect(session->hid); |
| 581 | hid_free_device(session->hid); | 581 | hid_destroy_device(session->hid); |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | /* Wakeup user-space polling for socket errors */ | 584 | /* Wakeup user-space polling for socket errors */ |
| @@ -623,9 +623,15 @@ static struct device *hidp_get_device(struct hidp_session *session) | |||
| 623 | static int hidp_setup_input(struct hidp_session *session, | 623 | static int hidp_setup_input(struct hidp_session *session, |
| 624 | struct hidp_connadd_req *req) | 624 | struct hidp_connadd_req *req) |
| 625 | { | 625 | { |
| 626 | struct input_dev *input = session->input; | 626 | struct input_dev *input; |
| 627 | int i; | 627 | int i; |
| 628 | 628 | ||
| 629 | input = input_allocate_device(); | ||
| 630 | if (!input) | ||
| 631 | return -ENOMEM; | ||
| 632 | |||
| 633 | session->input = input; | ||
| 634 | |||
| 629 | input_set_drvdata(input, session); | 635 | input_set_drvdata(input, session); |
| 630 | 636 | ||
| 631 | input->name = "Bluetooth HID Boot Protocol Device"; | 637 | input->name = "Bluetooth HID Boot Protocol Device"; |
| @@ -677,67 +683,114 @@ static void hidp_close(struct hid_device *hid) | |||
| 677 | { | 683 | { |
| 678 | } | 684 | } |
| 679 | 685 | ||
| 680 | static const struct { | 686 | static int hidp_parse(struct hid_device *hid) |
| 681 | __u16 idVendor; | 687 | { |
| 682 | __u16 idProduct; | 688 | struct hidp_session *session = hid->driver_data; |
| 683 | unsigned quirks; | 689 | struct hidp_connadd_req *req = session->req; |
| 684 | } hidp_blacklist[] = { | 690 | unsigned char *buf; |
| 685 | /* Apple wireless Mighty Mouse */ | 691 | int ret; |
| 686 | { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, | ||
| 687 | 692 | ||
| 688 | { } /* Terminating entry */ | 693 | buf = kmalloc(req->rd_size, GFP_KERNEL); |
| 689 | }; | 694 | if (!buf) |
| 695 | return -ENOMEM; | ||
| 696 | |||
| 697 | if (copy_from_user(buf, req->rd_data, req->rd_size)) { | ||
| 698 | kfree(buf); | ||
| 699 | return -EFAULT; | ||
| 700 | } | ||
| 701 | |||
| 702 | ret = hid_parse_report(session->hid, buf, req->rd_size); | ||
| 703 | |||
| 704 | kfree(buf); | ||
| 705 | |||
| 706 | if (ret) | ||
| 707 | return ret; | ||
| 708 | |||
| 709 | session->req = NULL; | ||
| 710 | |||
| 711 | return 0; | ||
| 712 | } | ||
| 713 | |||
| 714 | static int hidp_start(struct hid_device *hid) | ||
| 715 | { | ||
| 716 | struct hidp_session *session = hid->driver_data; | ||
| 717 | struct hid_report *report; | ||
| 690 | 718 | ||
| 691 | static void hidp_setup_quirks(struct hid_device *hid) | 719 | list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT]. |
| 720 | report_list, list) | ||
| 721 | hidp_send_report(session, report); | ||
| 722 | |||
| 723 | list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT]. | ||
| 724 | report_list, list) | ||
| 725 | hidp_send_report(session, report); | ||
| 726 | |||
| 727 | return 0; | ||
| 728 | } | ||
| 729 | |||
| 730 | static void hidp_stop(struct hid_device *hid) | ||
| 692 | { | 731 | { |
| 693 | unsigned int n; | 732 | struct hidp_session *session = hid->driver_data; |
| 733 | |||
| 734 | skb_queue_purge(&session->ctrl_transmit); | ||
| 735 | skb_queue_purge(&session->intr_transmit); | ||
| 694 | 736 | ||
| 695 | for (n = 0; hidp_blacklist[n].idVendor; n++) | 737 | if (hid->claimed & HID_CLAIMED_INPUT) |
| 696 | if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) && | 738 | hidinput_disconnect(hid); |
| 697 | hidp_blacklist[n].idProduct == le16_to_cpu(hid->product)) | 739 | hid->claimed = 0; |
| 698 | hid->quirks = hidp_blacklist[n].quirks; | ||
| 699 | } | 740 | } |
| 700 | 741 | ||
| 701 | static void hidp_setup_hid(struct hidp_session *session, | 742 | static struct hid_ll_driver hidp_hid_driver = { |
| 743 | .parse = hidp_parse, | ||
| 744 | .start = hidp_start, | ||
| 745 | .stop = hidp_stop, | ||
| 746 | .open = hidp_open, | ||
| 747 | .close = hidp_close, | ||
| 748 | .hidinput_input_event = hidp_hidinput_event, | ||
| 749 | }; | ||
| 750 | |||
| 751 | static int hidp_setup_hid(struct hidp_session *session, | ||
| 702 | struct hidp_connadd_req *req) | 752 | struct hidp_connadd_req *req) |
| 703 | { | 753 | { |
| 704 | struct hid_device *hid = session->hid; | 754 | struct hid_device *hid; |
| 705 | struct hid_report *report; | ||
| 706 | bdaddr_t src, dst; | 755 | bdaddr_t src, dst; |
| 756 | int ret; | ||
| 707 | 757 | ||
| 708 | baswap(&src, &bt_sk(session->ctrl_sock->sk)->src); | 758 | hid = hid_allocate_device(); |
| 709 | baswap(&dst, &bt_sk(session->ctrl_sock->sk)->dst); | 759 | if (IS_ERR(hid)) { |
| 760 | ret = PTR_ERR(session->hid); | ||
| 761 | goto err; | ||
| 762 | } | ||
| 710 | 763 | ||
| 764 | session->hid = hid; | ||
| 765 | session->req = req; | ||
| 711 | hid->driver_data = session; | 766 | hid->driver_data = session; |
| 712 | 767 | ||
| 713 | hid->country = req->country; | 768 | baswap(&src, &bt_sk(session->ctrl_sock->sk)->src); |
| 769 | baswap(&dst, &bt_sk(session->ctrl_sock->sk)->dst); | ||
| 714 | 770 | ||
| 715 | hid->bus = BUS_BLUETOOTH; | 771 | hid->bus = BUS_BLUETOOTH; |
| 716 | hid->vendor = req->vendor; | 772 | hid->vendor = req->vendor; |
| 717 | hid->product = req->product; | 773 | hid->product = req->product; |
| 718 | hid->version = req->version; | 774 | hid->version = req->version; |
| 775 | hid->country = req->country; | ||
| 719 | 776 | ||
| 720 | strncpy(hid->name, req->name, 128); | 777 | strncpy(hid->name, req->name, 128); |
| 721 | strncpy(hid->phys, batostr(&src), 64); | 778 | strncpy(hid->phys, batostr(&src), 64); |
| 722 | strncpy(hid->uniq, batostr(&dst), 64); | 779 | strncpy(hid->uniq, batostr(&dst), 64); |
| 723 | 780 | ||
| 724 | hid->dev = hidp_get_device(session); | 781 | hid->dev.parent = hidp_get_device(session); |
| 725 | 782 | hid->ll_driver = &hidp_hid_driver; | |
| 726 | hid->hid_open = hidp_open; | ||
| 727 | hid->hid_close = hidp_close; | ||
| 728 | |||
| 729 | hid->hidinput_input_event = hidp_hidinput_event; | ||
| 730 | 783 | ||
| 731 | hidp_setup_quirks(hid); | 784 | ret = hid_add_device(hid); |
| 785 | if (ret) | ||
| 786 | goto err_hid; | ||
| 732 | 787 | ||
| 733 | list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) | 788 | return 0; |
| 734 | hidp_send_report(session, report); | 789 | err_hid: |
| 735 | 790 | hid_destroy_device(hid); | |
| 736 | list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list) | 791 | session->hid = NULL; |
| 737 | hidp_send_report(session, report); | 792 | err: |
| 738 | 793 | return ret; | |
| 739 | if (hidinput_connect(hid) == 0) | ||
| 740 | hid->claimed |= HID_CLAIMED_INPUT; | ||
| 741 | } | 794 | } |
| 742 | 795 | ||
| 743 | int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) | 796 | int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) |
| @@ -757,38 +810,6 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, | |||
| 757 | 810 | ||
| 758 | BT_DBG("rd_data %p rd_size %d", req->rd_data, req->rd_size); | 811 | BT_DBG("rd_data %p rd_size %d", req->rd_data, req->rd_size); |
| 759 | 812 | ||
| 760 | if (req->rd_size > 0) { | ||
| 761 | unsigned char *buf = kmalloc(req->rd_size, GFP_KERNEL); | ||
| 762 | |||
| 763 | if (!buf) { | ||
| 764 | kfree(session); | ||
| 765 | return -ENOMEM; | ||
| 766 | } | ||
| 767 | |||
| 768 | if (copy_from_user(buf, req->rd_data, req->rd_size)) { | ||
| 769 | kfree(buf); | ||
| 770 | kfree(session); | ||
| 771 | return -EFAULT; | ||
| 772 | } | ||
| 773 | |||
| 774 | session->hid = hid_parse_report(buf, req->rd_size); | ||
| 775 | |||
| 776 | kfree(buf); | ||
| 777 | |||
| 778 | if (!session->hid) { | ||
| 779 | kfree(session); | ||
| 780 | return -EINVAL; | ||
| 781 | } | ||
| 782 | } | ||
| 783 | |||
| 784 | if (!session->hid) { | ||
| 785 | session->input = input_allocate_device(); | ||
| 786 | if (!session->input) { | ||
| 787 | kfree(session); | ||
| 788 | return -ENOMEM; | ||
| 789 | } | ||
| 790 | } | ||
| 791 | |||
| 792 | down_write(&hidp_session_sem); | 813 | down_write(&hidp_session_sem); |
| 793 | 814 | ||
| 794 | s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst); | 815 | s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst); |
| @@ -816,15 +837,18 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, | |||
| 816 | session->flags = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID); | 837 | session->flags = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID); |
| 817 | session->idle_to = req->idle_to; | 838 | session->idle_to = req->idle_to; |
| 818 | 839 | ||
| 819 | if (session->input) { | 840 | if (req->rd_size > 0) { |
| 841 | err = hidp_setup_hid(session, req); | ||
| 842 | if (err && err != -ENODEV) | ||
| 843 | goto err_skb; | ||
| 844 | } | ||
| 845 | |||
| 846 | if (!session->hid) { | ||
| 820 | err = hidp_setup_input(session, req); | 847 | err = hidp_setup_input(session, req); |
| 821 | if (err < 0) | 848 | if (err < 0) |
| 822 | goto failed; | 849 | goto err_skb; |
| 823 | } | 850 | } |
| 824 | 851 | ||
| 825 | if (session->hid) | ||
| 826 | hidp_setup_hid(session, req); | ||
| 827 | |||
| 828 | __hidp_link_session(session); | 852 | __hidp_link_session(session); |
| 829 | 853 | ||
| 830 | hidp_set_timer(session); | 854 | hidp_set_timer(session); |
| @@ -850,17 +874,16 @@ unlink: | |||
| 850 | 874 | ||
| 851 | __hidp_unlink_session(session); | 875 | __hidp_unlink_session(session); |
| 852 | 876 | ||
| 853 | if (session->input) { | 877 | if (session->input) |
| 854 | input_unregister_device(session->input); | 878 | input_unregister_device(session->input); |
| 855 | session->input = NULL; /* don't try to free it here */ | 879 | if (session->hid) |
| 856 | } | 880 | hid_destroy_device(session->hid); |
| 857 | 881 | err_skb: | |
| 882 | skb_queue_purge(&session->ctrl_transmit); | ||
| 883 | skb_queue_purge(&session->intr_transmit); | ||
| 858 | failed: | 884 | failed: |
| 859 | up_write(&hidp_session_sem); | 885 | up_write(&hidp_session_sem); |
| 860 | 886 | ||
| 861 | if (session->hid) | ||
| 862 | hid_free_device(session->hid); | ||
| 863 | |||
| 864 | input_free_device(session->input); | 887 | input_free_device(session->input); |
| 865 | kfree(session); | 888 | kfree(session); |
| 866 | return err; | 889 | return err; |
| @@ -950,18 +973,43 @@ int hidp_get_conninfo(struct hidp_conninfo *ci) | |||
| 950 | return err; | 973 | return err; |
| 951 | } | 974 | } |
| 952 | 975 | ||
| 976 | static const struct hid_device_id hidp_table[] = { | ||
| 977 | { HID_BLUETOOTH_DEVICE(HID_ANY_ID, HID_ANY_ID) }, | ||
| 978 | { } | ||
| 979 | }; | ||
| 980 | |||
| 981 | static struct hid_driver hidp_driver = { | ||
| 982 | .name = "generic-bluetooth", | ||
| 983 | .id_table = hidp_table, | ||
| 984 | }; | ||
| 985 | |||
| 953 | static int __init hidp_init(void) | 986 | static int __init hidp_init(void) |
| 954 | { | 987 | { |
| 988 | int ret; | ||
| 989 | |||
| 955 | l2cap_load(); | 990 | l2cap_load(); |
| 956 | 991 | ||
| 957 | BT_INFO("HIDP (Human Interface Emulation) ver %s", VERSION); | 992 | BT_INFO("HIDP (Human Interface Emulation) ver %s", VERSION); |
| 958 | 993 | ||
| 959 | return hidp_init_sockets(); | 994 | ret = hid_register_driver(&hidp_driver); |
| 995 | if (ret) | ||
| 996 | goto err; | ||
| 997 | |||
| 998 | ret = hidp_init_sockets(); | ||
| 999 | if (ret) | ||
| 1000 | goto err_drv; | ||
| 1001 | |||
| 1002 | return 0; | ||
| 1003 | err_drv: | ||
| 1004 | hid_unregister_driver(&hidp_driver); | ||
| 1005 | err: | ||
| 1006 | return ret; | ||
| 960 | } | 1007 | } |
| 961 | 1008 | ||
| 962 | static void __exit hidp_exit(void) | 1009 | static void __exit hidp_exit(void) |
| 963 | { | 1010 | { |
| 964 | hidp_cleanup_sockets(); | 1011 | hidp_cleanup_sockets(); |
| 1012 | hid_unregister_driver(&hidp_driver); | ||
| 965 | } | 1013 | } |
| 966 | 1014 | ||
| 967 | module_init(hidp_init); | 1015 | module_init(hidp_init); |
diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h index 343fb0566b3e..e503c89057ad 100644 --- a/net/bluetooth/hidp/hidp.h +++ b/net/bluetooth/hidp/hidp.h | |||
| @@ -151,6 +151,8 @@ struct hidp_session { | |||
| 151 | 151 | ||
| 152 | struct sk_buff_head ctrl_transmit; | 152 | struct sk_buff_head ctrl_transmit; |
| 153 | struct sk_buff_head intr_transmit; | 153 | struct sk_buff_head intr_transmit; |
| 154 | |||
| 155 | struct hidp_connadd_req *req; | ||
| 154 | }; | 156 | }; |
| 155 | 157 | ||
| 156 | static inline void hidp_schedule(struct hidp_session *session) | 158 | static inline void hidp_schedule(struct hidp_session *session) |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 473f94e56ead..d4dc222a74f3 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -206,6 +206,20 @@ static void do_usb_table(void *symval, unsigned long size, | |||
| 206 | do_usb_entry_multi(symval + i, mod); | 206 | do_usb_entry_multi(symval + i, mod); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | /* Looks like: hid:bNvNpN */ | ||
| 210 | static int do_hid_entry(const char *filename, | ||
| 211 | struct hid_device_id *id, char *alias) | ||
| 212 | { | ||
| 213 | id->vendor = TO_NATIVE(id->vendor); | ||
| 214 | id->product = TO_NATIVE(id->product); | ||
| 215 | |||
| 216 | sprintf(alias, "hid:b%04X", id->bus); | ||
| 217 | ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor); | ||
| 218 | ADD(alias, "p", id->product != HID_ANY_ID, id->product); | ||
| 219 | |||
| 220 | return 1; | ||
| 221 | } | ||
| 222 | |||
| 209 | /* Looks like: ieee1394:venNmoNspNverN */ | 223 | /* Looks like: ieee1394:venNmoNspNverN */ |
| 210 | static int do_ieee1394_entry(const char *filename, | 224 | static int do_ieee1394_entry(const char *filename, |
| 211 | struct ieee1394_device_id *id, char *alias) | 225 | struct ieee1394_device_id *id, char *alias) |
| @@ -745,6 +759,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 745 | else if (sym_is(symname, "__mod_usb_device_table")) | 759 | else if (sym_is(symname, "__mod_usb_device_table")) |
| 746 | /* special case to handle bcdDevice ranges */ | 760 | /* special case to handle bcdDevice ranges */ |
| 747 | do_usb_table(symval, sym->st_size, mod); | 761 | do_usb_table(symval, sym->st_size, mod); |
| 762 | else if (sym_is(symname, "__mod_hid_device_table")) | ||
| 763 | do_table(symval, sym->st_size, | ||
| 764 | sizeof(struct hid_device_id), "hid", | ||
| 765 | do_hid_entry, mod); | ||
| 748 | else if (sym_is(symname, "__mod_ieee1394_device_table")) | 766 | else if (sym_is(symname, "__mod_ieee1394_device_table")) |
| 749 | do_table(symval, sym->st_size, | 767 | do_table(symval, sym->st_size, |
| 750 | sizeof(struct ieee1394_device_id), "ieee1394", | 768 | sizeof(struct ieee1394_device_id), "ieee1394", |
