Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (30 commits)
Revert "HID: add support for the Wacom Intuos 4 wireless"
HID: fix up Kconfig entry for ACRUX driver
HID: add ACRUX game controller force feedback support
HID: Force input registration for "VEC footpedal"
HID: add HID_QUIRK_HIDINPUT_FORCE
HID: hid-input.c: indentation fixes
HID: hiddev: use usb_find_interface, get rid of BKL
HID: ignore digitizer usage Undefined (0x00)
HID: Add support for Conceptronic CLLRCMCE
HID: hid-ids.h: Whitespace fixup, align using TABs
HID: picolcd: implement refcounting of framebuffer
HID: picolcd: do not reallocate memory on depth change
HID: picolcd: Add minimal palette required by fbcon on 8bpp
HID: magicmouse: Correct parsing of large X and Y motions.
HID: magicmouse: report last touch up
HID: picolcd: fix deferred_io init/cleanup to fb ordering
HID: hid-ids.h: keep vendor ids in alphabetical order
HID: add proper support for Elecom BM084 bluetooth mouse
HID: magicmouse: enable horizontal scrolling
HID: magicmouse: add param for scroll speed
...

+586 -196
-13
Documentation/ABI/testing/sysfs-driver-hid-roccat-kone
··· 33 33 left. E.g. a returned value of 138 means 1.38 34 34 This file is readonly. 35 35 36 - What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/kone_driver_version 37 - Date: March 2010 38 - Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 39 - Description: When read, this file returns the driver version. 40 - The format of the string is "v<major>.<minor>.<patchlevel>". 41 - This attribute is used by the userland tools to find the sysfs- 42 - paths of installed kone-mice and determine the capabilites of 43 - the driver. Versions of this driver for old kernels replace 44 - usbhid instead of generic-usb. The way to scan for this file 45 - has been chosen to provide a consistent way for all supported 46 - kernel versions. 47 - This file is readonly. 48 - 49 36 What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile[1-5] 50 37 Date: March 2010 51 38 Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
+17 -2
drivers/hid/Kconfig
··· 68 68 ---help--- 69 69 Support for A4 tech X5 and WOP-35 / Trust 450L mice. 70 70 71 + config HID_ACRUX_FF 72 + tristate "ACRUX force feedback support" 73 + depends on USB_HID 74 + select INPUT_FF_MEMLESS 75 + ---help--- 76 + Say Y here if you want to enable force feedback support for ACRUX 77 + game controllers. 78 + 71 79 config HID_APPLE 72 80 tristate "Apple" if EMBEDDED 73 81 depends on (USB_HID || BT_HIDP) ··· 155 147 depends on USB_HID 156 148 ---help--- 157 149 Support for the eGalax dual-touch panel. 150 + 151 + config HID_ELECOM 152 + tristate "ELECOM" 153 + depends on BT_HIDP 154 + ---help--- 155 + Support for the ELECOM BM084 (bluetooth mouse). 158 156 159 157 config HID_EZKEY 160 158 tristate "Ezkey" if EMBEDDED ··· 431 417 enable force feedback support for it. 432 418 433 419 config HID_TOPSEED 434 - tristate "TopSeed Cyberlink remote control support" 420 + tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support" 435 421 depends on USB_HID 436 422 ---help--- 437 - Say Y if you have a TopSeed Cyberlink or BTC Emprex remote control. 423 + Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic 424 + CLLRCMCE remote control. 438 425 439 426 config HID_THRUSTMASTER 440 427 tristate "ThrustMaster devices support"
+2
drivers/hid/Makefile
··· 24 24 25 25 obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o 26 26 obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o 27 + obj-$(CONFIG_HID_ACRUX_FF) += hid-axff.o 27 28 obj-$(CONFIG_HID_APPLE) += hid-apple.o 28 29 obj-$(CONFIG_HID_BELKIN) += hid-belkin.o 29 30 obj-$(CONFIG_HID_CANDO) += hid-cando.o ··· 33 32 obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 34 33 obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o 35 34 obj-$(CONFIG_HID_EGALAX) += hid-egalax.o 35 + obj-$(CONFIG_HID_ELECOM) += hid-elecom.o 36 36 obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 37 37 obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 38 38 obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
+172
drivers/hid/hid-axff.c
··· 1 + /* 2 + * Force feedback support for ACRUX game controllers 3 + * 4 + * From what I have gathered, these devices are mass produced in China 5 + * by several vendors. They often share the same design as the original 6 + * Xbox 360 controller. 7 + * 8 + * 1a34:0802 "ACRUX USB GAMEPAD 8116" 9 + * - tested with a EXEQ EQ-PCU-02090 game controller. 10 + * 11 + * Copyright (c) 2010 Sergei Kolzun <x0r@dv-life.ru> 12 + */ 13 + 14 + /* 15 + * This program is free software; you can redistribute it and/or modify 16 + * it under the terms of the GNU General Public License as published by 17 + * the Free Software Foundation; either version 2 of the License, or 18 + * (at your option) any later version. 19 + * 20 + * This program is distributed in the hope that it will be useful, 21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 + * GNU General Public License for more details. 24 + * 25 + * You should have received a copy of the GNU General Public License 26 + * along with this program; if not, write to the Free Software 27 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 + */ 29 + 30 + #include <linux/input.h> 31 + #include <linux/slab.h> 32 + #include <linux/usb.h> 33 + #include <linux/hid.h> 34 + 35 + #include "hid-ids.h" 36 + #include "usbhid/usbhid.h" 37 + 38 + struct axff_device { 39 + struct hid_report *report; 40 + }; 41 + 42 + static int axff_play(struct input_dev *dev, void *data, struct ff_effect *effect) 43 + { 44 + struct hid_device *hid = input_get_drvdata(dev); 45 + struct axff_device *axff = data; 46 + int left, right; 47 + 48 + left = effect->u.rumble.strong_magnitude; 49 + right = effect->u.rumble.weak_magnitude; 50 + 51 + dbg_hid("called with 0x%04x 0x%04x", left, right); 52 + 53 + left = left * 0xff / 0xffff; 54 + right = right * 0xff / 0xffff; 55 + 56 + axff->report->field[0]->value[0] = left; 57 + axff->report->field[1]->value[0] = right; 58 + axff->report->field[2]->value[0] = left; 59 + axff->report->field[3]->value[0] = right; 60 + dbg_hid("running with 0x%02x 0x%02x", left, right); 61 + usbhid_submit_report(hid, axff->report, USB_DIR_OUT); 62 + 63 + return 0; 64 + } 65 + 66 + static int axff_init(struct hid_device *hid) 67 + { 68 + struct axff_device *axff; 69 + struct hid_report *report; 70 + struct hid_input *hidinput = list_first_entry(&hid->inputs, struct hid_input, list); 71 + struct list_head *report_list =&hid->report_enum[HID_OUTPUT_REPORT].report_list; 72 + struct input_dev *dev = hidinput->input; 73 + int error; 74 + 75 + if (list_empty(report_list)) { 76 + dev_err(&hid->dev, "no output reports found\n"); 77 + return -ENODEV; 78 + } 79 + 80 + report = list_first_entry(report_list, struct hid_report, list); 81 + 82 + if (report->maxfield < 4) { 83 + dev_err(&hid->dev, "no fields in the report: %d\n", report->maxfield); 84 + return -ENODEV; 85 + } 86 + 87 + axff = kzalloc(sizeof(struct axff_device), GFP_KERNEL); 88 + if (!axff) 89 + return -ENOMEM; 90 + 91 + set_bit(FF_RUMBLE, dev->ffbit); 92 + 93 + error = input_ff_create_memless(dev, axff, axff_play); 94 + if (error) 95 + goto err_free_mem; 96 + 97 + axff->report = report; 98 + axff->report->field[0]->value[0] = 0x00; 99 + axff->report->field[1]->value[0] = 0x00; 100 + axff->report->field[2]->value[0] = 0x00; 101 + axff->report->field[3]->value[0] = 0x00; 102 + usbhid_submit_report(hid, axff->report, USB_DIR_OUT); 103 + 104 + dev_info(&hid->dev, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n"); 105 + 106 + return 0; 107 + 108 + err_free_mem: 109 + kfree(axff); 110 + return error; 111 + } 112 + 113 + static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id) 114 + { 115 + int error; 116 + 117 + dev_dbg(&hdev->dev, "ACRUX HID hardware probe..."); 118 + 119 + error = hid_parse(hdev); 120 + if (error) { 121 + dev_err(&hdev->dev, "parse failed\n"); 122 + return error; 123 + } 124 + 125 + error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 126 + if (error) { 127 + dev_err(&hdev->dev, "hw start failed\n"); 128 + return error; 129 + } 130 + 131 + error = axff_init(hdev); 132 + if (error) { 133 + /* 134 + * Do not fail device initialization completely as device 135 + * may still be partially operable, just warn. 136 + */ 137 + dev_warn(&hdev->dev, 138 + "Failed to enable force feedback support, error: %d\n", 139 + error); 140 + } 141 + 142 + return 0; 143 + } 144 + 145 + static const struct hid_device_id ax_devices[] = { 146 + { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), }, 147 + { } 148 + }; 149 + MODULE_DEVICE_TABLE(hid, ax_devices); 150 + 151 + static struct hid_driver ax_driver = { 152 + .name = "acrux", 153 + .id_table = ax_devices, 154 + .probe = ax_probe, 155 + }; 156 + 157 + static int __init ax_init(void) 158 + { 159 + return hid_register_driver(&ax_driver); 160 + } 161 + 162 + static void __exit ax_exit(void) 163 + { 164 + hid_unregister_driver(&ax_driver); 165 + } 166 + 167 + module_init(ax_init); 168 + module_exit(ax_exit); 169 + 170 + MODULE_AUTHOR("Sergei Kolzun"); 171 + MODULE_DESCRIPTION("Force feedback support for ACRUX game controllers"); 172 + MODULE_LICENSE("GPL");
+7 -1
drivers/hid/hid-core.c
··· 1157 1157 1158 1158 if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) 1159 1159 connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); 1160 + if (hdev->quirks & HID_QUIRK_HIDINPUT_FORCE) 1161 + connect_mask |= HID_CONNECT_HIDINPUT_FORCE; 1160 1162 if (hdev->bus != BUS_USB) 1161 1163 connect_mask &= ~HID_CONNECT_HIDDEV; 1162 1164 if (hid_hiddev(hdev)) ··· 1241 1239 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, 1242 1240 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1243 1241 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 1242 + #if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE) 1243 + { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, 1244 + #endif 1244 1245 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, 1245 1246 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, 1246 1247 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, ··· 1299 1294 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1300 1295 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, 1301 1296 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 1297 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1302 1298 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1303 1299 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1304 1300 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, ··· 1381 1375 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, 1382 1376 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 1383 1377 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1378 + { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 1384 1379 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1385 1380 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, 1386 1381 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, 1387 - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, 1388 1382 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1389 1383 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 1390 1384 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
+57
drivers/hid/hid-elecom.c
··· 1 + /* 2 + * HID driver for Elecom BM084 (bluetooth mouse). 3 + * Removes a non-existing horizontal wheel from 4 + * the HID descriptor. 5 + * (This module is based on "hid-ortek".) 6 + * 7 + * Copyright (c) 2010 Richard Nauber <Richard.Nauber@gmail.com> 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, or (at your option) 14 + * any later version. 15 + */ 16 + 17 + #include <linux/device.h> 18 + #include <linux/hid.h> 19 + #include <linux/module.h> 20 + 21 + #include "hid-ids.h" 22 + 23 + static void elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, 24 + unsigned int rsize) 25 + { 26 + if (rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { 27 + dev_info(&hdev->dev, "Fixing up Elecom BM084 " 28 + "report descriptor.\n"); 29 + rdesc[47] = 0x00; 30 + } 31 + } 32 + 33 + static const struct hid_device_id elecom_devices[] = { 34 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084)}, 35 + { } 36 + }; 37 + MODULE_DEVICE_TABLE(hid, elecom_devices); 38 + 39 + static struct hid_driver elecom_driver = { 40 + .name = "elecom", 41 + .id_table = elecom_devices, 42 + .report_fixup = elecom_report_fixup 43 + }; 44 + 45 + static int __init elecom_init(void) 46 + { 47 + return hid_register_driver(&elecom_driver); 48 + } 49 + 50 + static void __exit elecom_exit(void) 51 + { 52 + hid_unregister_driver(&elecom_driver); 53 + } 54 + 55 + module_init(elecom_init); 56 + module_exit(elecom_exit); 57 + MODULE_LICENSE("GPL");
+50 -41
drivers/hid/hid-ids.h
··· 34 34 #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 35 35 #define USB_DEVICE_ID_ACECAD_302 0x0008 36 36 37 + #define USB_VENDOR_ID_ACRUX 0x1a34 38 + 37 39 #define USB_VENDOR_ID_ADS_TECH 0x06e1 38 40 #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 39 41 ··· 83 81 #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 84 82 #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 85 83 #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 86 - #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229 87 - #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a 88 - #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b 89 - #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c 90 - #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d 91 - #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e 84 + #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229 85 + #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a 86 + #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b 87 + #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c 88 + #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d 89 + #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e 92 90 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 93 91 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 94 92 #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 ··· 120 118 #define USB_VENDOR_ID_AVERMEDIA 0x07ca 121 119 #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 122 120 123 - #define USB_VENDOR_ID_BELKIN 0x050d 124 - #define USB_DEVICE_ID_FLIP_KVM 0x3201 121 + #define USB_VENDOR_ID_BELKIN 0x050d 122 + #define USB_DEVICE_ID_FLIP_KVM 0x3201 125 123 126 124 #define USB_VENDOR_ID_BERKSHIRE 0x0c98 127 125 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 ··· 130 128 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 131 129 132 130 #define USB_VENDOR_ID_CANDO 0x2087 133 - #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 131 + #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 134 132 #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 135 133 136 134 #define USB_VENDOR_ID_CH 0x068e ··· 177 175 #define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a 178 176 179 177 #define USB_VENDOR_ID_DELORME 0x1163 180 - #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 178 + #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 181 179 #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 182 180 183 181 #define USB_VENDOR_ID_DMI 0x0c0b ··· 189 187 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 190 188 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d 191 189 190 + #define USB_VENDOR_ID_ELECOM 0x056e 191 + #define USB_DEVICE_ID_ELECOM_BM084 0x0061 192 + 192 193 #define USB_VENDOR_ID_ELO 0x04E7 193 194 #define USB_DEVICE_ID_ELO_TS2700 0x0020 194 195 195 196 #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 196 197 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 197 198 198 - #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 199 - #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 200 - 201 199 #define USB_VENDOR_ID_ETT 0x0664 202 200 #define USB_DEVICE_ID_TC5UH 0x0309 203 201 #define USB_DEVICE_ID_TC4UM 0x0306 204 202 205 - #define USB_VENDOR_ID_EZKEY 0x0518 203 + #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 204 + #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 205 + 206 + #define USB_VENDOR_ID_EZKEY 0x0518 206 207 #define USB_DEVICE_ID_BTC_8193 0x0002 207 208 208 209 #define USB_VENDOR_ID_GAMERON 0x0810 ··· 302 297 #define USB_VENDOR_ID_KBGEAR 0x084e 303 298 #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 304 299 300 + #define USB_VENDOR_ID_KENSINGTON 0x047d 301 + #define USB_DEVICE_ID_KS_SLIMBLADE 0x2041 302 + 305 303 #define USB_VENDOR_ID_KWORLD 0x1b80 306 304 #define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700 305 + 306 + #define USB_VENDOR_ID_KYE 0x0458 307 + #define USB_DEVICE_ID_KYE_ERGO_525V 0x0087 308 + #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 307 309 308 310 #define USB_VENDOR_ID_LABTEC 0x1020 309 311 #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 ··· 330 318 #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 331 319 #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 332 320 #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 333 - 334 - #define USB_VENDOR_ID_KENSINGTON 0x047d 335 - #define USB_DEVICE_ID_KS_SLIMBLADE 0x2041 336 321 337 322 #define USB_VENDOR_ID_LOGITECH 0x046d 338 323 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 ··· 386 377 #define USB_VENDOR_ID_MONTEREY 0x0566 387 378 #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 388 379 380 + #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 381 + #define USB_DEVICE_ID_N_S_HARMONY 0xc359 382 + 383 + #define USB_VENDOR_ID_NATSU 0x08b7 384 + #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 385 + 389 386 #define USB_VENDOR_ID_NCR 0x0404 390 387 #define USB_DEVICE_ID_NCR_FIRST 0x0300 391 388 #define USB_DEVICE_ID_NCR_LAST 0x03ff 392 - 393 - #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 394 - #define USB_DEVICE_ID_N_S_HARMONY 0xc359 395 - 396 - #define USB_VENDOR_ID_NATSU 0x08b7 397 - #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 398 389 399 390 #define USB_VENDOR_ID_NEC 0x073e 400 391 #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 ··· 402 393 #define USB_VENDOR_ID_NEXTWINDOW 0x1926 403 394 #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003 404 395 405 - #define USB_VENDOR_ID_NTRIG 0x1b96 396 + #define USB_VENDOR_ID_NTRIG 0x1b96 406 397 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 407 398 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003 408 399 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2 0x0004 ··· 437 428 #define USB_VENDOR_ID_PETALYNX 0x18b1 438 429 #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 439 430 440 - #define USB_VENDOR_ID_PHILIPS 0x0471 431 + #define USB_VENDOR_ID_PHILIPS 0x0471 441 432 #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617 433 + 434 + #define USB_VENDOR_ID_PI_ENGINEERING 0x05f3 435 + #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff 442 436 443 437 #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 444 438 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 ··· 452 440 #define USB_VENDOR_ID_PRODIGE 0x05af 453 441 #define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062 454 442 443 + #define USB_VENDOR_ID_QUANTA 0x0408 444 + #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000 445 + #define USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN 0x3001 446 + 455 447 #define USB_VENDOR_ID_ROCCAT 0x1e7d 456 448 #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced 457 449 458 450 #define USB_VENDOR_ID_SAITEK 0x06a3 459 451 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 460 - 461 - #define USB_VENDOR_ID_QUANTA 0x0408 462 - #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000 463 - #define USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN 0x3001 464 452 465 453 #define USB_VENDOR_ID_SAMSUNG 0x0419 466 454 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 ··· 485 473 486 474 #define USB_VENDOR_ID_THRUSTMASTER 0x044f 487 475 488 - #define USB_VENDOR_ID_TOUCHPACK 0x1bfd 489 - #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 476 + #define USB_VENDOR_ID_TOPSEED 0x0766 477 + #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 478 + 479 + #define USB_VENDOR_ID_TOPSEED2 0x1784 480 + #define USB_DEVICE_ID_TOPSEED2_RF_COMBO 0x0004 490 481 491 482 #define USB_VENDOR_ID_TOPMAX 0x0663 492 483 #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 493 484 494 - #define USB_VENDOR_ID_TOPSEED 0x0766 495 - #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 485 + #define USB_VENDOR_ID_TOUCHPACK 0x1bfd 486 + #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 496 487 497 488 #define USB_VENDOR_ID_TURBOX 0x062a 498 489 #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 499 490 500 - #define USB_VENDOR_ID_TWINHAN 0x6253 501 - #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 491 + #define USB_VENDOR_ID_TWINHAN 0x6253 492 + #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 502 493 503 494 #define USB_VENDOR_ID_UCLOGIC 0x5543 504 495 #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 ··· 516 501 517 502 #define USB_VENDOR_ID_WACOM 0x056a 518 503 #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81 519 - #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0xbd 520 504 521 505 #define USB_VENDOR_ID_WISEGROUP 0x0925 522 506 #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 ··· 536 522 537 523 #define USB_VENDOR_ID_ZYDACRON 0x13EC 538 524 #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 539 - 540 - #define USB_VENDOR_ID_KYE 0x0458 541 - #define USB_DEVICE_ID_KYE_ERGO_525V 0x0087 542 - #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 543 - 544 525 545 526 #endif
+12 -9
drivers/hid/hid-input.c
··· 199 199 case HID_GD_MOUSE: 200 200 case HID_GD_POINTER: code += 0x110; break; 201 201 case HID_GD_JOYSTICK: 202 - if (code <= 0xf) 203 - code += BTN_JOYSTICK; 204 - else 205 - code += BTN_TRIGGER_HAPPY; 206 - break; 202 + if (code <= 0xf) 203 + code += BTN_JOYSTICK; 204 + else 205 + code += BTN_TRIGGER_HAPPY; 206 + break; 207 207 case HID_GD_GAMEPAD: code += 0x130; break; 208 208 default: 209 209 switch (field->physical) { ··· 301 301 302 302 case HID_UP_DIGITIZER: 303 303 switch (usage->hid & 0xff) { 304 + case 0x00: /* Undefined */ 305 + goto ignore; 306 + 304 307 case 0x30: /* TipPressure */ 305 308 if (!test_bit(BTN_TOUCH, input->keybit)) { 306 309 device->quirks |= HID_QUIRK_NOTOUCH; ··· 483 480 484 481 case HID_UP_LOGIVENDOR: 485 482 goto ignore; 486 - 483 + 487 484 case HID_UP_PID: 488 485 switch (usage->hid & HID_USAGE) { 489 486 case 0xa4: map_key_clear(BTN_DEAD); break; ··· 592 589 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; 593 590 if (hat_dir < 0 || hat_dir > 8) hat_dir = 0; 594 591 input_event(input, usage->type, usage->code , hid_hat_to_axis[hat_dir].x); 595 - input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y); 596 - return; 597 - } 592 + input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y); 593 + return; 594 + } 598 595 599 596 if (usage->hid == (HID_UP_DIGITIZER | 0x003c)) { /* Invert */ 600 597 *quirks = value ? (*quirks | HID_QUIRK_INVERT) : (*quirks & ~HID_QUIRK_INVERT);
+73 -23
drivers/hid/hid-magicmouse.c
··· 30 30 module_param(emulate_scroll_wheel, bool, 0644); 31 31 MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel"); 32 32 33 + static unsigned int scroll_speed = 32; 34 + static int param_set_scroll_speed(const char *val, struct kernel_param *kp) { 35 + unsigned long speed; 36 + if (!val || strict_strtoul(val, 0, &speed) || speed > 63) 37 + return -EINVAL; 38 + scroll_speed = speed; 39 + return 0; 40 + } 41 + module_param_call(scroll_speed, param_set_scroll_speed, param_get_uint, &scroll_speed, 0644); 42 + MODULE_PARM_DESC(scroll_speed, "Scroll speed, value from 0 (slow) to 63 (fast)"); 43 + 44 + static bool scroll_acceleration = false; 45 + module_param(scroll_acceleration, bool, 0644); 46 + MODULE_PARM_DESC(scroll_acceleration, "Accelerate sequential scroll events"); 47 + 33 48 static bool report_touches = true; 34 49 module_param(report_touches, bool, 0644); 35 50 MODULE_PARM_DESC(report_touches, "Emit touch records (otherwise, only use them for emulation)"); ··· 64 49 #define TOUCH_STATE_NONE 0x00 65 50 #define TOUCH_STATE_START 0x30 66 51 #define TOUCH_STATE_DRAG 0x40 52 + 53 + #define SCROLL_ACCEL_DEFAULT 7 67 54 68 55 /** 69 56 * struct magicmouse_sc - Tracks Magic Mouse-specific data. ··· 95 78 struct { 96 79 short x; 97 80 short y; 81 + short scroll_x; 98 82 short scroll_y; 99 83 u8 size; 84 + u8 down; 100 85 } touches[16]; 101 86 int tracking_ids[16]; 102 87 }; ··· 160 141 input_report_key(msc->input, BTN_RIGHT, state & 2); 161 142 162 143 if (state != last_state) 163 - msc->scroll_accel = 0; 144 + msc->scroll_accel = SCROLL_ACCEL_DEFAULT; 164 145 } 165 146 166 147 static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) ··· 171 152 int id = (misc >> 6) & 15; 172 153 int x = x_y << 12 >> 20; 173 154 int y = -(x_y >> 20); 155 + int down = (tdata[7] & TOUCH_STATE_MASK) != TOUCH_STATE_NONE; 174 156 175 157 /* Store tracking ID and other fields. */ 176 158 msc->tracking_ids[raw_id] = id; ··· 180 160 msc->touches[id].size = misc & 63; 181 161 182 162 /* If requested, emulate a scroll wheel by detecting small 183 - * vertical touch motions along the middle of the mouse. 163 + * vertical touch motions. 184 164 */ 185 - if (emulate_scroll_wheel && 186 - middle_button_start < x && x < middle_button_stop) { 187 - static const int accel_profile[] = { 188 - 256, 228, 192, 160, 128, 96, 64, 32, 189 - }; 165 + if (emulate_scroll_wheel) { 190 166 unsigned long now = jiffies; 191 - int step = msc->touches[id].scroll_y - y; 192 - 193 - /* Reset acceleration after half a second. */ 194 - if (time_after(now, msc->scroll_jiffies + HZ / 2)) 195 - msc->scroll_accel = 0; 167 + int step_x = msc->touches[id].scroll_x - x; 168 + int step_y = msc->touches[id].scroll_y - y; 196 169 197 170 /* Calculate and apply the scroll motion. */ 198 171 switch (tdata[7] & TOUCH_STATE_MASK) { 199 172 case TOUCH_STATE_START: 173 + msc->touches[id].scroll_x = x; 200 174 msc->touches[id].scroll_y = y; 201 - msc->scroll_accel = min_t(int, msc->scroll_accel + 1, 202 - ARRAY_SIZE(accel_profile) - 1); 175 + 176 + /* Reset acceleration after half a second. */ 177 + if (scroll_acceleration && time_before(now, 178 + msc->scroll_jiffies + HZ / 2)) 179 + msc->scroll_accel = max_t(int, 180 + msc->scroll_accel - 1, 1); 181 + else 182 + msc->scroll_accel = SCROLL_ACCEL_DEFAULT; 183 + 203 184 break; 204 185 case TOUCH_STATE_DRAG: 205 - step = step / accel_profile[msc->scroll_accel]; 206 - if (step != 0) { 207 - msc->touches[id].scroll_y = y; 186 + step_x /= (64 - (int)scroll_speed) * msc->scroll_accel; 187 + if (step_x != 0) { 188 + msc->touches[id].scroll_x -= step_x * 189 + (64 - scroll_speed) * msc->scroll_accel; 208 190 msc->scroll_jiffies = now; 209 - input_report_rel(input, REL_WHEEL, step); 191 + input_report_rel(input, REL_HWHEEL, -step_x); 192 + } 193 + 194 + step_y /= (64 - (int)scroll_speed) * msc->scroll_accel; 195 + if (step_y != 0) { 196 + msc->touches[id].scroll_y -= step_y * 197 + (64 - scroll_speed) * msc->scroll_accel; 198 + msc->scroll_jiffies = now; 199 + input_report_rel(input, REL_WHEEL, step_y); 210 200 } 211 201 break; 212 202 } 213 203 } 214 204 215 205 /* Generate the input events for this touch. */ 216 - if (report_touches) { 206 + if (report_touches && down) { 217 207 int orientation = (misc >> 10) - 32; 208 + 209 + msc->touches[id].down = 1; 218 210 219 211 input_report_abs(input, ABS_MT_TRACKING_ID, id); 220 212 input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]); ··· 247 215 { 248 216 struct magicmouse_sc *msc = hid_get_drvdata(hdev); 249 217 struct input_dev *input = msc->input; 250 - int x, y, ts, ii, clicks; 218 + int x, y, ts, ii, clicks, last_up; 251 219 252 220 switch (data[0]) { 253 221 case 0x10: ··· 267 235 msc->ntouches = (size - 6) / 8; 268 236 for (ii = 0; ii < msc->ntouches; ii++) 269 237 magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); 238 + 239 + if (report_touches) { 240 + last_up = 1; 241 + for (ii = 0; ii < ARRAY_SIZE(msc->touches); ii++) { 242 + if (msc->touches[ii].down) { 243 + last_up = 0; 244 + msc->touches[ii].down = 0; 245 + } 246 + } 247 + if (last_up) { 248 + input_mt_sync(input); 249 + } 250 + } 251 + 270 252 /* When emulating three-button mode, it is important 271 253 * to have the current touch information before 272 254 * generating a click event. 273 255 */ 274 - x = (signed char)data[1]; 275 - y = (signed char)data[2]; 256 + x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22; 257 + y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22; 276 258 clicks = data[3]; 277 259 break; 278 260 case 0x20: /* Theoretically battery status (0-100), but I have ··· 347 301 __set_bit(EV_REL, input->evbit); 348 302 __set_bit(REL_X, input->relbit); 349 303 __set_bit(REL_Y, input->relbit); 350 - if (emulate_scroll_wheel) 304 + if (emulate_scroll_wheel) { 351 305 __set_bit(REL_WHEEL, input->relbit); 306 + __set_bit(REL_HWHEEL, input->relbit); 307 + } 352 308 353 309 if (report_touches) { 354 310 __set_bit(EV_ABS, input->evbit); ··· 392 344 dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n"); 393 345 return -ENOMEM; 394 346 } 347 + 348 + msc->scroll_accel = SCROLL_ACCEL_DEFAULT; 395 349 396 350 msc->quirks = id->driver_data; 397 351 hid_set_drvdata(hdev, msc);
+166 -33
drivers/hid/hid-picolcd.c
··· 127 127 .height = 26, 128 128 .bits_per_pixel = 1, 129 129 .grayscale = 1, 130 + .red = { 131 + .offset = 0, 132 + .length = 1, 133 + .msb_right = 0, 134 + }, 135 + .green = { 136 + .offset = 0, 137 + .length = 1, 138 + .msb_right = 0, 139 + }, 140 + .blue = { 141 + .offset = 0, 142 + .length = 1, 143 + .msb_right = 0, 144 + }, 145 + .transp = { 146 + .offset = 0, 147 + .length = 0, 148 + .msb_right = 0, 149 + }, 130 150 }; 131 151 #endif /* CONFIG_HID_PICOLCD_FB */ 132 152 ··· 208 188 /* Framebuffer stuff */ 209 189 u8 fb_update_rate; 210 190 u8 fb_bpp; 191 + u8 fb_force; 211 192 u8 *fb_vbitmap; /* local copy of what was sent to PicoLCD */ 212 193 u8 *fb_bitmap; /* framebuffer */ 213 194 struct fb_info *fb_info; ··· 367 346 const u8 *bdata = bitmap + tile * 256 + chip * 8 + b * 32; 368 347 for (i = 0; i < 64; i++) { 369 348 tdata[i] <<= 1; 370 - tdata[i] |= (bdata[i/8] >> (7 - i % 8)) & 0x01; 349 + tdata[i] |= (bdata[i/8] >> (i % 8)) & 0x01; 371 350 } 372 351 } 373 352 } else if (bpp == 8) { ··· 420 399 421 400 if (data->fb_bitmap) { 422 401 if (clear) { 423 - memset(data->fb_vbitmap, 0xff, PICOLCDFB_SIZE); 402 + memset(data->fb_vbitmap, 0, PICOLCDFB_SIZE); 424 403 memset(data->fb_bitmap, 0, PICOLCDFB_SIZE*data->fb_bpp); 425 - } else { 426 - /* invert 1 byte in each tile to force resend */ 427 - for (i = 0; i < PICOLCDFB_SIZE; i += 64) 428 - data->fb_vbitmap[i] = ~data->fb_vbitmap[i]; 429 404 } 405 + data->fb_force = 1; 430 406 } 431 407 432 408 /* schedule first output of framebuffer */ ··· 438 420 { 439 421 int chip, tile, n; 440 422 unsigned long flags; 423 + 424 + if (!data) 425 + return; 441 426 442 427 spin_lock_irqsave(&data->lock, flags); 443 428 if (!(data->status & PICOLCD_READY_FB)) { ··· 461 440 for (chip = 0; chip < 4; chip++) 462 441 for (tile = 0; tile < 8; tile++) 463 442 if (picolcd_fb_update_tile(data->fb_vbitmap, 464 - data->fb_bitmap, data->fb_bpp, chip, tile)) { 443 + data->fb_bitmap, data->fb_bpp, chip, tile) || 444 + data->fb_force) { 465 445 n += 2; 446 + if (!data->fb_info->par) 447 + return; /* device lost! */ 466 448 if (n >= HID_OUTPUT_FIFO_SIZE / 2) { 467 449 usbhid_wait_io(data->hdev); 468 450 n = 0; 469 451 } 470 452 picolcd_fb_send_tile(data->hdev, chip, tile); 471 453 } 454 + data->fb_force = false; 472 455 if (n) 473 456 usbhid_wait_io(data->hdev); 474 457 } ··· 536 511 static void picolcd_fb_destroy(struct fb_info *info) 537 512 { 538 513 struct picolcd_data *data = info->par; 514 + u32 *ref_cnt = info->pseudo_palette; 515 + int may_release; 516 + 539 517 info->par = NULL; 540 518 if (data) 541 519 data->fb_info = NULL; 542 520 fb_deferred_io_cleanup(info); 543 - framebuffer_release(info); 521 + 522 + ref_cnt--; 523 + mutex_lock(&info->lock); 524 + (*ref_cnt)--; 525 + may_release = !ref_cnt; 526 + mutex_unlock(&info->lock); 527 + if (may_release) { 528 + framebuffer_release(info); 529 + vfree((u8 *)info->fix.smem_start); 530 + } 544 531 } 545 532 546 533 static int picolcd_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ··· 563 526 /* only allow 1/8 bit depth (8-bit is grayscale) */ 564 527 *var = picolcdfb_var; 565 528 var->activate = activate; 566 - if (bpp >= 8) 529 + if (bpp >= 8) { 567 530 var->bits_per_pixel = 8; 568 - else 531 + var->red.length = 8; 532 + var->green.length = 8; 533 + var->blue.length = 8; 534 + } else { 569 535 var->bits_per_pixel = 1; 536 + var->red.length = 1; 537 + var->green.length = 1; 538 + var->blue.length = 1; 539 + } 570 540 return 0; 571 541 } 572 542 573 543 static int picolcd_set_par(struct fb_info *info) 574 544 { 575 545 struct picolcd_data *data = info->par; 576 - u8 *o_fb, *n_fb; 546 + u8 *tmp_fb, *o_fb; 547 + if (!data) 548 + return -ENODEV; 577 549 if (info->var.bits_per_pixel == data->fb_bpp) 578 550 return 0; 579 551 /* switch between 1/8 bit depths */ 580 552 if (info->var.bits_per_pixel != 1 && info->var.bits_per_pixel != 8) 581 553 return -EINVAL; 582 554 583 - o_fb = data->fb_bitmap; 584 - n_fb = vmalloc(PICOLCDFB_SIZE*info->var.bits_per_pixel); 585 - if (!n_fb) 555 + o_fb = data->fb_bitmap; 556 + tmp_fb = kmalloc(PICOLCDFB_SIZE*info->var.bits_per_pixel, GFP_KERNEL); 557 + if (!tmp_fb) 586 558 return -ENOMEM; 587 559 588 - fb_deferred_io_cleanup(info); 589 560 /* translate FB content to new bits-per-pixel */ 590 561 if (info->var.bits_per_pixel == 1) { 591 562 int i, b; ··· 603 558 p <<= 1; 604 559 p |= o_fb[i*8+b] ? 0x01 : 0x00; 605 560 } 561 + tmp_fb[i] = p; 606 562 } 563 + memcpy(o_fb, tmp_fb, PICOLCDFB_SIZE); 607 564 info->fix.visual = FB_VISUAL_MONO01; 608 565 info->fix.line_length = PICOLCDFB_WIDTH / 8; 609 566 } else { 610 567 int i; 568 + memcpy(tmp_fb, o_fb, PICOLCDFB_SIZE); 611 569 for (i = 0; i < PICOLCDFB_SIZE * 8; i++) 612 - n_fb[i] = o_fb[i/8] & (0x01 << (7 - i % 8)) ? 0xff : 0x00; 613 - info->fix.visual = FB_VISUAL_TRUECOLOR; 570 + o_fb[i] = tmp_fb[i/8] & (0x01 << (7 - i % 8)) ? 0xff : 0x00; 571 + info->fix.visual = FB_VISUAL_DIRECTCOLOR; 614 572 info->fix.line_length = PICOLCDFB_WIDTH; 615 573 } 616 574 617 - data->fb_bitmap = n_fb; 575 + kfree(tmp_fb); 618 576 data->fb_bpp = info->var.bits_per_pixel; 619 - info->screen_base = (char __force __iomem *)n_fb; 620 - info->fix.smem_start = (unsigned long)n_fb; 621 - info->fix.smem_len = PICOLCDFB_SIZE*data->fb_bpp; 622 - fb_deferred_io_init(info); 623 - vfree(o_fb); 577 + return 0; 578 + } 579 + 580 + /* Do refcounting on our FB and cleanup per worker if FB is 581 + * closed after unplug of our device 582 + * (fb_release holds info->lock and still touches info after 583 + * we return so we can't release it immediately. 584 + */ 585 + struct picolcd_fb_cleanup_item { 586 + struct fb_info *info; 587 + struct picolcd_fb_cleanup_item *next; 588 + }; 589 + static struct picolcd_fb_cleanup_item *fb_pending; 590 + DEFINE_SPINLOCK(fb_pending_lock); 591 + 592 + static void picolcd_fb_do_cleanup(struct work_struct *data) 593 + { 594 + struct picolcd_fb_cleanup_item *item; 595 + unsigned long flags; 596 + 597 + do { 598 + spin_lock_irqsave(&fb_pending_lock, flags); 599 + item = fb_pending; 600 + fb_pending = item ? item->next : NULL; 601 + spin_unlock_irqrestore(&fb_pending_lock, flags); 602 + 603 + if (item) { 604 + u8 *fb = (u8 *)item->info->fix.smem_start; 605 + /* make sure we do not race against fb core when 606 + * releasing */ 607 + mutex_lock(&item->info->lock); 608 + mutex_unlock(&item->info->lock); 609 + framebuffer_release(item->info); 610 + vfree(fb); 611 + } 612 + } while (item); 613 + } 614 + 615 + DECLARE_WORK(picolcd_fb_cleanup, picolcd_fb_do_cleanup); 616 + 617 + static int picolcd_fb_open(struct fb_info *info, int u) 618 + { 619 + u32 *ref_cnt = info->pseudo_palette; 620 + ref_cnt--; 621 + 622 + (*ref_cnt)++; 623 + return 0; 624 + } 625 + 626 + static int picolcd_fb_release(struct fb_info *info, int u) 627 + { 628 + u32 *ref_cnt = info->pseudo_palette; 629 + ref_cnt--; 630 + 631 + (*ref_cnt)++; 632 + if (!*ref_cnt) { 633 + unsigned long flags; 634 + struct picolcd_fb_cleanup_item *item = (struct picolcd_fb_cleanup_item *)ref_cnt; 635 + item--; 636 + spin_lock_irqsave(&fb_pending_lock, flags); 637 + item->next = fb_pending; 638 + fb_pending = item; 639 + spin_unlock_irqrestore(&fb_pending_lock, flags); 640 + schedule_work(&picolcd_fb_cleanup); 641 + } 624 642 return 0; 625 643 } 626 644 ··· 691 583 static struct fb_ops picolcdfb_ops = { 692 584 .owner = THIS_MODULE, 693 585 .fb_destroy = picolcd_fb_destroy, 586 + .fb_open = picolcd_fb_open, 587 + .fb_release = picolcd_fb_release, 694 588 .fb_read = fb_sys_read, 695 589 .fb_write = picolcd_fb_write, 696 590 .fb_blank = picolcd_fb_blank, ··· 770 660 { 771 661 struct device *dev = &data->hdev->dev; 772 662 struct fb_info *info = NULL; 773 - int error = -ENOMEM; 663 + int i, error = -ENOMEM; 774 664 u8 *fb_vbitmap = NULL; 775 665 u8 *fb_bitmap = NULL; 666 + u32 *palette; 776 667 777 - fb_bitmap = vmalloc(PICOLCDFB_SIZE*picolcdfb_var.bits_per_pixel); 668 + fb_bitmap = vmalloc(PICOLCDFB_SIZE*8); 778 669 if (fb_bitmap == NULL) { 779 670 dev_err(dev, "can't get a free page for framebuffer\n"); 780 671 goto err_nomem; ··· 789 678 790 679 data->fb_update_rate = PICOLCDFB_UPDATE_RATE_DEFAULT; 791 680 data->fb_defio = picolcd_fb_defio; 792 - info = framebuffer_alloc(0, dev); 681 + /* The extra memory is: 682 + * - struct picolcd_fb_cleanup_item 683 + * - u32 for ref_count 684 + * - 256*u32 for pseudo_palette 685 + */ 686 + info = framebuffer_alloc(257 * sizeof(u32) + sizeof(struct picolcd_fb_cleanup_item), dev); 793 687 if (info == NULL) { 794 688 dev_err(dev, "failed to allocate a framebuffer\n"); 795 689 goto err_nomem; 796 690 } 797 691 692 + palette = info->par + sizeof(struct picolcd_fb_cleanup_item); 693 + *palette = 1; 694 + palette++; 695 + for (i = 0; i < 256; i++) 696 + palette[i] = i > 0 && i < 16 ? 0xff : 0; 697 + info->pseudo_palette = palette; 798 698 info->fbdefio = &data->fb_defio; 799 699 info->screen_base = (char __force __iomem *)fb_bitmap; 800 700 info->fbops = &picolcdfb_ops; 801 701 info->var = picolcdfb_var; 802 702 info->fix = picolcdfb_fix; 803 - info->fix.smem_len = PICOLCDFB_SIZE; 703 + info->fix.smem_len = PICOLCDFB_SIZE*8; 804 704 info->fix.smem_start = (unsigned long)fb_bitmap; 805 705 info->par = data; 806 706 info->flags = FBINFO_FLAG_DEFAULT; ··· 829 707 dev_err(dev, "failed to create sysfs attributes\n"); 830 708 goto err_cleanup; 831 709 } 710 + fb_deferred_io_init(info); 832 711 data->fb_info = info; 833 712 error = register_framebuffer(info); 834 713 if (error) { 835 714 dev_err(dev, "failed to register framebuffer\n"); 836 715 goto err_sysfs; 837 716 } 838 - fb_deferred_io_init(info); 839 717 /* schedule first output of framebuffer */ 718 + data->fb_force = 1; 840 719 schedule_delayed_work(&info->deferred_work, 0); 841 720 return 0; 842 721 843 722 err_sysfs: 723 + fb_deferred_io_cleanup(info); 844 724 device_remove_file(dev, &dev_attr_fb_update_rate); 845 725 err_cleanup: 846 726 data->fb_vbitmap = NULL; ··· 861 737 { 862 738 struct fb_info *info = data->fb_info; 863 739 u8 *fb_vbitmap = data->fb_vbitmap; 864 - u8 *fb_bitmap = data->fb_bitmap; 865 740 866 741 if (!info) 867 742 return; 868 743 744 + info->par = NULL; 745 + device_remove_file(&data->hdev->dev, &dev_attr_fb_update_rate); 746 + unregister_framebuffer(info); 869 747 data->fb_vbitmap = NULL; 870 748 data->fb_bitmap = NULL; 871 749 data->fb_bpp = 0; 872 750 data->fb_info = NULL; 873 - device_remove_file(&data->hdev->dev, &dev_attr_fb_update_rate); 874 - fb_deferred_io_cleanup(info); 875 - unregister_framebuffer(info); 876 - vfree(fb_bitmap); 877 751 kfree(fb_vbitmap); 878 752 } 879 753 ··· 2688 2566 spin_lock_irqsave(&data->lock, flags); 2689 2567 data->status |= PICOLCD_FAILED; 2690 2568 spin_unlock_irqrestore(&data->lock, flags); 2569 + #ifdef CONFIG_HID_PICOLCD_FB 2570 + /* short-circuit FB as early as possible in order to 2571 + * avoid long delays if we host console. 2572 + */ 2573 + if (data->fb_info) 2574 + data->fb_info->par = NULL; 2575 + #endif 2691 2576 2692 2577 picolcd_exit_devfs(data); 2693 2578 device_remove_file(&hdev->dev, &dev_attr_operation_mode); ··· 2752 2623 static void __exit picolcd_exit(void) 2753 2624 { 2754 2625 hid_unregister_driver(&picolcd_driver); 2626 + #ifdef CONFIG_HID_PICOLCD_FB 2627 + flush_scheduled_work(); 2628 + WARN_ON(fb_pending); 2629 + #endif 2755 2630 } 2756 2631 2757 2632 module_init(picolcd_init);
+2 -23
drivers/hid/hid-roccat-kone.c
··· 22 22 * Is it possible to remove and reinstall the urb in raw-event- or any 23 23 * other handler, or to defer this action to be executed somewhere else? 24 24 * 25 - * TODO implement notification mechanism for overlong macro execution 26 - * If user wants to execute an overlong macro only the names of macroset 27 - * and macro are given. Should userland tap hidraw or is there an 28 - * additional streaming mechanism? 29 - * 30 25 * TODO is it possible to overwrite group for sysfs attributes via udev? 31 26 */ 32 27 ··· 272 277 count = sizeof(struct kone_settings) - off; 273 278 274 279 mutex_lock(&kone->kone_lock); 275 - memcpy(buf, &kone->settings + off, count); 280 + memcpy(buf, ((char const *)&kone->settings) + off, count); 276 281 mutex_unlock(&kone->kone_lock); 277 282 278 283 return count; ··· 332 337 count = sizeof(struct kone_profile) - off; 333 338 334 339 mutex_lock(&kone->kone_lock); 335 - memcpy(buf, &kone->profiles[number - 1], sizeof(struct kone_profile)); 340 + memcpy(buf, ((char const *)&kone->profiles[number - 1]) + off, count); 336 341 mutex_unlock(&kone->kone_lock); 337 342 338 343 return count; ··· 618 623 } 619 624 620 625 /* 621 - * This file is used by userland software to find devices that are handled by 622 - * this driver. This provides a consistent way for actual and older kernels 623 - * where this driver replaced usbhid instead of generic-usb. 624 - * Driver capabilities are determined by version number. 625 - */ 626 - static ssize_t kone_sysfs_show_driver_version(struct device *dev, 627 - struct device_attribute *attr, char *buf) 628 - { 629 - return snprintf(buf, PAGE_SIZE, ROCCAT_KONE_DRIVER_VERSION "\n"); 630 - } 631 - 632 - /* 633 626 * Read actual dpi settings. 634 627 * Returns raw value for further processing. Refer to enum kone_polling_rates to 635 628 * get real value. ··· 654 671 kone_sysfs_show_startup_profile, 655 672 kone_sysfs_set_startup_profile); 656 673 657 - static DEVICE_ATTR(kone_driver_version, 0440, 658 - kone_sysfs_show_driver_version, NULL); 659 - 660 674 static struct attribute *kone_attributes[] = { 661 675 &dev_attr_actual_dpi.attr, 662 676 &dev_attr_actual_profile.attr, ··· 661 681 &dev_attr_firmware_version.attr, 662 682 &dev_attr_tcu.attr, 663 683 &dev_attr_startup_profile.attr, 664 - &dev_attr_kone_driver_version.attr, 665 684 NULL 666 685 }; 667 686
-2
drivers/hid/hid-roccat-kone.h
··· 14 14 15 15 #include <linux/types.h> 16 16 17 - #define ROCCAT_KONE_DRIVER_VERSION "v0.3.1" 18 - 19 17 #pragma pack(push) 20 18 #pragma pack(1) 21 19
+6 -3
drivers/hid/hid-roccat.c
··· 168 168 printk(KERN_EMERG "roccat device with minor %d doesn't exist\n", 169 169 minor); 170 170 error = -ENODEV; 171 - goto exit_unlock; 171 + goto exit_err; 172 172 } 173 173 174 174 if (!device->open++) { ··· 178 178 PM_HINT_FULLON); 179 179 if (error < 0) { 180 180 --device->open; 181 - goto exit_unlock; 181 + goto exit_err; 182 182 } 183 183 } 184 184 error = device->hid->ll_driver->open(device->hid); ··· 187 187 device->hid->ll_driver->power(device->hid, 188 188 PM_HINT_NORMAL); 189 189 --device->open; 190 - goto exit_unlock; 190 + goto exit_err; 191 191 } 192 192 } 193 193 ··· 202 202 mutex_unlock(&device->readers_lock); 203 203 mutex_unlock(&devices_lock); 204 204 return error; 205 + exit_err: 206 + kfree(reader); 207 + goto exit_unlock; 205 208 } 206 209 207 210 static int roccat_release(struct inode *inode, struct file *file)
+1 -1
drivers/hid/hid-roccat.h
··· 15 15 #include <linux/hid.h> 16 16 #include <linux/types.h> 17 17 18 - #if defined(CONFIG_HID_ROCCAT) || defined (CONFIG_HID_ROCCAT_MODULE) 18 + #if defined(CONFIG_HID_ROCCAT) || defined(CONFIG_HID_ROCCAT_MODULE) 19 19 int roccat_connect(struct hid_device *hid); 20 20 void roccat_disconnect(int minor); 21 21 int roccat_report_event(int minor, u8 const *data, int len);
+5
drivers/hid/hid-topseed.c
··· 6 6 * 7 7 * Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by 8 8 * Wayne Thomas 2010. 9 + * 10 + * Modified to support Conceptronic CLLRCMCE by 11 + * Kees Bakker 2010. 9 12 */ 10 13 11 14 /* ··· 37 34 case 0x00d: ts_map_key_clear(KEY_MEDIA); break; 38 35 case 0x024: ts_map_key_clear(KEY_MENU); break; 39 36 case 0x025: ts_map_key_clear(KEY_TV); break; 37 + case 0x027: ts_map_key_clear(KEY_MODE); break; 40 38 case 0x031: ts_map_key_clear(KEY_AUDIO); break; 41 39 case 0x032: ts_map_key_clear(KEY_TEXT); break; 42 40 case 0x033: ts_map_key_clear(KEY_CHANNEL); break; ··· 64 60 static const struct hid_device_id ts_devices[] = { 65 61 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 66 62 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 63 + { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 67 64 { } 68 65 }; 69 66 MODULE_DEVICE_TABLE(hid, ts_devices);
+1 -1
drivers/hid/hid-wacom.c
··· 436 436 437 437 static const struct hid_device_id wacom_devices[] = { 438 438 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, 439 - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, 439 + 440 440 { } 441 441 }; 442 442 MODULE_DEVICE_TABLE(hid, wacom_devices);
-2
drivers/hid/hidraw.c
··· 46 46 { 47 47 struct hidraw_list *list = file->private_data; 48 48 int ret = 0, len; 49 - char *report; 50 49 DECLARE_WAITQUEUE(wait, current); 51 50 52 51 mutex_lock(&list->read_mutex); ··· 83 84 if (ret) 84 85 goto out; 85 86 86 - report = list->buffer[list->tail].value; 87 87 len = list->buffer[list->tail].len > count ? 88 88 count : list->buffer[list->tail].len; 89 89
+2
drivers/hid/usbhid/hid-quirks.c
··· 75 75 { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 76 76 { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 77 77 78 + { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, 79 + 78 80 { 0, 0 } 79 81 }; 80 82
+12 -42
drivers/hid/usbhid/hiddev.c
··· 67 67 struct mutex thread_lock; 68 68 }; 69 69 70 - static struct hiddev *hiddev_table[HIDDEV_MINORS]; 70 + static struct usb_driver hiddev_driver; 71 71 72 72 /* 73 73 * Find a report, given the report's type and ID. The ID can be specified ··· 265 265 static int hiddev_open(struct inode *inode, struct file *file) 266 266 { 267 267 struct hiddev_list *list; 268 - int res, i; 268 + struct usb_interface *intf; 269 + struct hiddev *hiddev; 270 + int res; 269 271 270 - /* See comment in hiddev_connect() for BKL explanation */ 271 - lock_kernel(); 272 - i = iminor(inode) - HIDDEV_MINOR_BASE; 273 - 274 - if (i >= HIDDEV_MINORS || i < 0 || !hiddev_table[i]) 272 + intf = usb_find_interface(&hiddev_driver, iminor(inode)); 273 + if (!intf) 275 274 return -ENODEV; 275 + hiddev = usb_get_intfdata(intf); 276 276 277 277 if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL))) 278 278 return -ENOMEM; 279 279 mutex_init(&list->thread_lock); 280 - 281 - list->hiddev = hiddev_table[i]; 282 - 283 - 280 + list->hiddev = hiddev; 284 281 file->private_data = list; 285 282 286 283 /* ··· 286 289 */ 287 290 if (list->hiddev->exist) { 288 291 if (!list->hiddev->open++) { 289 - res = usbhid_open(hiddev_table[i]->hid); 292 + res = usbhid_open(hiddev->hid); 290 293 if (res < 0) { 291 294 res = -EIO; 292 295 goto bail; ··· 298 301 } 299 302 300 303 spin_lock_irq(&list->hiddev->list_lock); 301 - list_add_tail(&list->node, &hiddev_table[i]->list); 304 + list_add_tail(&list->node, &hiddev->list); 302 305 spin_unlock_irq(&list->hiddev->list_lock); 303 306 304 307 if (!list->hiddev->open++) 305 308 if (list->hiddev->exist) { 306 - struct hid_device *hid = hiddev_table[i]->hid; 309 + struct hid_device *hid = hiddev->hid; 307 310 res = usbhid_get_power(hid); 308 311 if (res < 0) { 309 312 res = -EIO; ··· 311 314 } 312 315 usbhid_open(hid); 313 316 } 314 - 315 - unlock_kernel(); 316 317 return 0; 317 318 bail: 318 319 file->private_data = NULL; 319 320 kfree(list); 320 - unlock_kernel(); 321 321 return res; 322 322 } 323 323 ··· 888 894 hid->hiddev = hiddev; 889 895 hiddev->hid = hid; 890 896 hiddev->exist = 1; 891 - 892 - /* 893 - * BKL here is used to avoid race after usb_register_dev(). 894 - * Once the device node has been created, open() could happen on it. 895 - * The code below will then fail, as hiddev_table hasn't been 896 - * updated. 897 - * 898 - * The obvious fix -- introducing mutex to guard hiddev_table[] 899 - * doesn't work, as usb_open() and usb_register_dev() both take 900 - * minor_rwsem, thus we'll have ABBA deadlock. 901 - * 902 - * Before BKL pushdown, usb_open() had been acquiring it in right 903 - * order, so _open() was safe to use it to protect from this race. 904 - * Now the order is different, but AB-BA deadlock still doesn't occur 905 - * as BKL is dropped on schedule() (i.e. while sleeping on 906 - * minor_rwsem). Fugly. 907 - */ 908 - lock_kernel(); 897 + usb_set_intfdata(usbhid->intf, usbhid); 909 898 retval = usb_register_dev(usbhid->intf, &hiddev_class); 910 899 if (retval) { 911 900 err_hid("Not able to get a minor for this device."); 912 901 hid->hiddev = NULL; 913 - unlock_kernel(); 914 902 kfree(hiddev); 915 903 return -1; 916 - } else { 917 - hid->minor = usbhid->intf->minor; 918 - hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; 919 904 } 920 - unlock_kernel(); 921 - 922 905 return 0; 923 906 } 924 907 ··· 913 942 hiddev->exist = 0; 914 943 mutex_unlock(&hiddev->existancelock); 915 944 916 - hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL; 917 945 usb_deregister_dev(usbhid->intf, &hiddev_class); 918 946 919 947 if (hiddev->open) {
+1
include/linux/hid.h
··· 311 311 #define HID_QUIRK_HIDDEV_FORCE 0x00000010 312 312 #define HID_QUIRK_BADPAD 0x00000020 313 313 #define HID_QUIRK_MULTI_INPUT 0x00000040 314 + #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 314 315 #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 315 316 #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 316 317 #define HID_QUIRK_NO_INIT_REPORTS 0x20000000