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 left. E.g. a returned value of 138 means 1.38 34 This file is readonly. 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 What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile[1-5] 50 Date: March 2010 51 Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
··· 33 left. E.g. a returned value of 138 means 1.38 34 This file is readonly. 35 36 What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile[1-5] 37 Date: March 2010 38 Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
+17 -2
drivers/hid/Kconfig
··· 68 ---help--- 69 Support for A4 tech X5 and WOP-35 / Trust 450L mice. 70 71 config HID_APPLE 72 tristate "Apple" if EMBEDDED 73 depends on (USB_HID || BT_HIDP) ··· 155 depends on USB_HID 156 ---help--- 157 Support for the eGalax dual-touch panel. 158 159 config HID_EZKEY 160 tristate "Ezkey" if EMBEDDED ··· 431 enable force feedback support for it. 432 433 config HID_TOPSEED 434 - tristate "TopSeed Cyberlink remote control support" 435 depends on USB_HID 436 ---help--- 437 - Say Y if you have a TopSeed Cyberlink or BTC Emprex remote control. 438 439 config HID_THRUSTMASTER 440 tristate "ThrustMaster devices support"
··· 68 ---help--- 69 Support for A4 tech X5 and WOP-35 / Trust 450L mice. 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 + 79 config HID_APPLE 80 tristate "Apple" if EMBEDDED 81 depends on (USB_HID || BT_HIDP) ··· 147 depends on USB_HID 148 ---help--- 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). 156 157 config HID_EZKEY 158 tristate "Ezkey" if EMBEDDED ··· 417 enable force feedback support for it. 418 419 config HID_TOPSEED 420 + tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support" 421 depends on USB_HID 422 ---help--- 423 + Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic 424 + CLLRCMCE remote control. 425 426 config HID_THRUSTMASTER 427 tristate "ThrustMaster devices support"
+2
drivers/hid/Makefile
··· 24 25 obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o 26 obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o 27 obj-$(CONFIG_HID_APPLE) += hid-apple.o 28 obj-$(CONFIG_HID_BELKIN) += hid-belkin.o 29 obj-$(CONFIG_HID_CANDO) += hid-cando.o ··· 33 obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 34 obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o 35 obj-$(CONFIG_HID_EGALAX) += hid-egalax.o 36 obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 37 obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 38 obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
··· 24 25 obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o 26 obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o 27 + obj-$(CONFIG_HID_ACRUX_FF) += hid-axff.o 28 obj-$(CONFIG_HID_APPLE) += hid-apple.o 29 obj-$(CONFIG_HID_BELKIN) += hid-belkin.o 30 obj-$(CONFIG_HID_CANDO) += hid-cando.o ··· 32 obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 33 obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o 34 obj-$(CONFIG_HID_EGALAX) += hid-egalax.o 35 + obj-$(CONFIG_HID_ELECOM) += hid-elecom.o 36 obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 37 obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 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 1158 if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) 1159 connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); 1160 if (hdev->bus != BUS_USB) 1161 connect_mask &= ~HID_CONNECT_HIDDEV; 1162 if (hid_hiddev(hdev)) ··· 1241 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, 1242 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1243 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, 1244 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, 1245 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, 1246 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, ··· 1299 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1300 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, 1301 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 1302 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1303 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1304 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, ··· 1381 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, 1382 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 1383 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1384 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1385 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, 1386 { 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 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1389 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 1390 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
··· 1157 1158 if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) 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; 1162 if (hdev->bus != BUS_USB) 1163 connect_mask &= ~HID_CONNECT_HIDDEV; 1164 if (hid_hiddev(hdev)) ··· 1239 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, 1240 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 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 1245 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, 1246 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, 1247 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, ··· 1294 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1295 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, 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) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1299 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1300 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, ··· 1375 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, 1376 { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, 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) }, 1379 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1380 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, 1381 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, 1382 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1383 { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 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 #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 35 #define USB_DEVICE_ID_ACECAD_302 0x0008 36 37 #define USB_VENDOR_ID_ADS_TECH 0x06e1 38 #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 39 ··· 83 #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 84 #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 85 #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 92 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 93 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 94 #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 ··· 120 #define USB_VENDOR_ID_AVERMEDIA 0x07ca 121 #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 122 123 - #define USB_VENDOR_ID_BELKIN 0x050d 124 - #define USB_DEVICE_ID_FLIP_KVM 0x3201 125 126 #define USB_VENDOR_ID_BERKSHIRE 0x0c98 127 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 ··· 130 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 131 132 #define USB_VENDOR_ID_CANDO 0x2087 133 - #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 134 #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 135 136 #define USB_VENDOR_ID_CH 0x068e ··· 177 #define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a 178 179 #define USB_VENDOR_ID_DELORME 0x1163 180 - #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 181 #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 182 183 #define USB_VENDOR_ID_DMI 0x0c0b ··· 189 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 190 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d 191 192 #define USB_VENDOR_ID_ELO 0x04E7 193 #define USB_DEVICE_ID_ELO_TS2700 0x0020 194 195 #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 196 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 197 198 - #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 199 - #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 200 - 201 #define USB_VENDOR_ID_ETT 0x0664 202 #define USB_DEVICE_ID_TC5UH 0x0309 203 #define USB_DEVICE_ID_TC4UM 0x0306 204 205 - #define USB_VENDOR_ID_EZKEY 0x0518 206 #define USB_DEVICE_ID_BTC_8193 0x0002 207 208 #define USB_VENDOR_ID_GAMERON 0x0810 ··· 302 #define USB_VENDOR_ID_KBGEAR 0x084e 303 #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 304 305 #define USB_VENDOR_ID_KWORLD 0x1b80 306 #define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700 307 308 #define USB_VENDOR_ID_LABTEC 0x1020 309 #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 ··· 330 #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 331 #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 332 #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 333 - 334 - #define USB_VENDOR_ID_KENSINGTON 0x047d 335 - #define USB_DEVICE_ID_KS_SLIMBLADE 0x2041 336 337 #define USB_VENDOR_ID_LOGITECH 0x046d 338 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 ··· 386 #define USB_VENDOR_ID_MONTEREY 0x0566 387 #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 388 389 #define USB_VENDOR_ID_NCR 0x0404 390 #define USB_DEVICE_ID_NCR_FIRST 0x0300 391 #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 399 #define USB_VENDOR_ID_NEC 0x073e 400 #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 ··· 402 #define USB_VENDOR_ID_NEXTWINDOW 0x1926 403 #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003 404 405 - #define USB_VENDOR_ID_NTRIG 0x1b96 406 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 407 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003 408 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2 0x0004 ··· 437 #define USB_VENDOR_ID_PETALYNX 0x18b1 438 #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 439 440 - #define USB_VENDOR_ID_PHILIPS 0x0471 441 #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617 442 443 #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 444 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 ··· 452 #define USB_VENDOR_ID_PRODIGE 0x05af 453 #define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062 454 455 #define USB_VENDOR_ID_ROCCAT 0x1e7d 456 #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced 457 458 #define USB_VENDOR_ID_SAITEK 0x06a3 459 #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 465 #define USB_VENDOR_ID_SAMSUNG 0x0419 466 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 ··· 485 486 #define USB_VENDOR_ID_THRUSTMASTER 0x044f 487 488 - #define USB_VENDOR_ID_TOUCHPACK 0x1bfd 489 - #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 490 491 #define USB_VENDOR_ID_TOPMAX 0x0663 492 #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 493 494 - #define USB_VENDOR_ID_TOPSEED 0x0766 495 - #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 496 497 #define USB_VENDOR_ID_TURBOX 0x062a 498 #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 499 500 - #define USB_VENDOR_ID_TWINHAN 0x6253 501 - #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 502 503 #define USB_VENDOR_ID_UCLOGIC 0x5543 504 #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 ··· 516 517 #define USB_VENDOR_ID_WACOM 0x056a 518 #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81 519 - #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0xbd 520 521 #define USB_VENDOR_ID_WISEGROUP 0x0925 522 #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 ··· 536 537 #define USB_VENDOR_ID_ZYDACRON 0x13EC 538 #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 545 #endif
··· 34 #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 35 #define USB_DEVICE_ID_ACECAD_302 0x0008 36 37 + #define USB_VENDOR_ID_ACRUX 0x1a34 38 + 39 #define USB_VENDOR_ID_ADS_TECH 0x06e1 40 #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 41 ··· 81 #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 82 #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 83 #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 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 90 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 91 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 92 #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 ··· 118 #define USB_VENDOR_ID_AVERMEDIA 0x07ca 119 #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 120 121 + #define USB_VENDOR_ID_BELKIN 0x050d 122 + #define USB_DEVICE_ID_FLIP_KVM 0x3201 123 124 #define USB_VENDOR_ID_BERKSHIRE 0x0c98 125 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 ··· 128 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 129 130 #define USB_VENDOR_ID_CANDO 0x2087 131 + #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 132 #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 133 134 #define USB_VENDOR_ID_CH 0x068e ··· 175 #define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a 176 177 #define USB_VENDOR_ID_DELORME 0x1163 178 + #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 179 #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 180 181 #define USB_VENDOR_ID_DMI 0x0c0b ··· 187 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 188 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d 189 190 + #define USB_VENDOR_ID_ELECOM 0x056e 191 + #define USB_DEVICE_ID_ELECOM_BM084 0x0061 192 + 193 #define USB_VENDOR_ID_ELO 0x04E7 194 #define USB_DEVICE_ID_ELO_TS2700 0x0020 195 196 #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 197 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 198 199 #define USB_VENDOR_ID_ETT 0x0664 200 #define USB_DEVICE_ID_TC5UH 0x0309 201 #define USB_DEVICE_ID_TC4UM 0x0306 202 203 + #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 204 + #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 205 + 206 + #define USB_VENDOR_ID_EZKEY 0x0518 207 #define USB_DEVICE_ID_BTC_8193 0x0002 208 209 #define USB_VENDOR_ID_GAMERON 0x0810 ··· 297 #define USB_VENDOR_ID_KBGEAR 0x084e 298 #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 299 300 + #define USB_VENDOR_ID_KENSINGTON 0x047d 301 + #define USB_DEVICE_ID_KS_SLIMBLADE 0x2041 302 + 303 #define USB_VENDOR_ID_KWORLD 0x1b80 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 309 310 #define USB_VENDOR_ID_LABTEC 0x1020 311 #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 ··· 318 #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 319 #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 320 #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 321 322 #define USB_VENDOR_ID_LOGITECH 0x046d 323 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 ··· 377 #define USB_VENDOR_ID_MONTEREY 0x0566 378 #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 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 + 386 #define USB_VENDOR_ID_NCR 0x0404 387 #define USB_DEVICE_ID_NCR_FIRST 0x0300 388 #define USB_DEVICE_ID_NCR_LAST 0x03ff 389 390 #define USB_VENDOR_ID_NEC 0x073e 391 #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 ··· 393 #define USB_VENDOR_ID_NEXTWINDOW 0x1926 394 #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003 395 396 + #define USB_VENDOR_ID_NTRIG 0x1b96 397 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 398 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003 399 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2 0x0004 ··· 428 #define USB_VENDOR_ID_PETALYNX 0x18b1 429 #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 430 431 + #define USB_VENDOR_ID_PHILIPS 0x0471 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 436 437 #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 438 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 ··· 440 #define USB_VENDOR_ID_PRODIGE 0x05af 441 #define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062 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 + 447 #define USB_VENDOR_ID_ROCCAT 0x1e7d 448 #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced 449 450 #define USB_VENDOR_ID_SAITEK 0x06a3 451 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 452 453 #define USB_VENDOR_ID_SAMSUNG 0x0419 454 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 ··· 473 474 #define USB_VENDOR_ID_THRUSTMASTER 0x044f 475 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 481 482 #define USB_VENDOR_ID_TOPMAX 0x0663 483 #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 484 485 + #define USB_VENDOR_ID_TOUCHPACK 0x1bfd 486 + #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 487 488 #define USB_VENDOR_ID_TURBOX 0x062a 489 #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 490 491 + #define USB_VENDOR_ID_TWINHAN 0x6253 492 + #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 493 494 #define USB_VENDOR_ID_UCLOGIC 0x5543 495 #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 ··· 501 502 #define USB_VENDOR_ID_WACOM 0x056a 503 #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81 504 505 #define USB_VENDOR_ID_WISEGROUP 0x0925 506 #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 ··· 522 523 #define USB_VENDOR_ID_ZYDACRON 0x13EC 524 #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 525 526 #endif
+12 -9
drivers/hid/hid-input.c
··· 199 case HID_GD_MOUSE: 200 case HID_GD_POINTER: code += 0x110; break; 201 case HID_GD_JOYSTICK: 202 - if (code <= 0xf) 203 - code += BTN_JOYSTICK; 204 - else 205 - code += BTN_TRIGGER_HAPPY; 206 - break; 207 case HID_GD_GAMEPAD: code += 0x130; break; 208 default: 209 switch (field->physical) { ··· 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; ··· 483 484 case HID_UP_LOGIVENDOR: 485 goto ignore; 486 - 487 case HID_UP_PID: 488 switch (usage->hid & HID_USAGE) { 489 case 0xa4: map_key_clear(BTN_DEAD); break; ··· 592 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; 593 if (hat_dir < 0 || hat_dir > 8) hat_dir = 0; 594 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 - } 598 599 if (usage->hid == (HID_UP_DIGITIZER | 0x003c)) { /* Invert */ 600 *quirks = value ? (*quirks | HID_QUIRK_INVERT) : (*quirks & ~HID_QUIRK_INVERT);
··· 199 case HID_GD_MOUSE: 200 case HID_GD_POINTER: code += 0x110; break; 201 case HID_GD_JOYSTICK: 202 + if (code <= 0xf) 203 + code += BTN_JOYSTICK; 204 + else 205 + code += BTN_TRIGGER_HAPPY; 206 + break; 207 case HID_GD_GAMEPAD: code += 0x130; break; 208 default: 209 switch (field->physical) { ··· 301 302 case HID_UP_DIGITIZER: 303 switch (usage->hid & 0xff) { 304 + case 0x00: /* Undefined */ 305 + goto ignore; 306 + 307 case 0x30: /* TipPressure */ 308 if (!test_bit(BTN_TOUCH, input->keybit)) { 309 device->quirks |= HID_QUIRK_NOTOUCH; ··· 480 481 case HID_UP_LOGIVENDOR: 482 goto ignore; 483 + 484 case HID_UP_PID: 485 switch (usage->hid & HID_USAGE) { 486 case 0xa4: map_key_clear(BTN_DEAD); break; ··· 589 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; 590 if (hat_dir < 0 || hat_dir > 8) hat_dir = 0; 591 input_event(input, usage->type, usage->code , hid_hat_to_axis[hat_dir].x); 592 + input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y); 593 + return; 594 + } 595 596 if (usage->hid == (HID_UP_DIGITIZER | 0x003c)) { /* Invert */ 597 *quirks = value ? (*quirks | HID_QUIRK_INVERT) : (*quirks & ~HID_QUIRK_INVERT);
+73 -23
drivers/hid/hid-magicmouse.c
··· 30 module_param(emulate_scroll_wheel, bool, 0644); 31 MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel"); 32 33 static bool report_touches = true; 34 module_param(report_touches, bool, 0644); 35 MODULE_PARM_DESC(report_touches, "Emit touch records (otherwise, only use them for emulation)"); ··· 64 #define TOUCH_STATE_NONE 0x00 65 #define TOUCH_STATE_START 0x30 66 #define TOUCH_STATE_DRAG 0x40 67 68 /** 69 * struct magicmouse_sc - Tracks Magic Mouse-specific data. ··· 95 struct { 96 short x; 97 short y; 98 short scroll_y; 99 u8 size; 100 } touches[16]; 101 int tracking_ids[16]; 102 }; ··· 160 input_report_key(msc->input, BTN_RIGHT, state & 2); 161 162 if (state != last_state) 163 - msc->scroll_accel = 0; 164 } 165 166 static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) ··· 171 int id = (misc >> 6) & 15; 172 int x = x_y << 12 >> 20; 173 int y = -(x_y >> 20); 174 175 /* Store tracking ID and other fields. */ 176 msc->tracking_ids[raw_id] = id; ··· 180 msc->touches[id].size = misc & 63; 181 182 /* If requested, emulate a scroll wheel by detecting small 183 - * vertical touch motions along the middle of the mouse. 184 */ 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 - }; 190 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; 196 197 /* Calculate and apply the scroll motion. */ 198 switch (tdata[7] & TOUCH_STATE_MASK) { 199 case TOUCH_STATE_START: 200 msc->touches[id].scroll_y = y; 201 - msc->scroll_accel = min_t(int, msc->scroll_accel + 1, 202 - ARRAY_SIZE(accel_profile) - 1); 203 break; 204 case TOUCH_STATE_DRAG: 205 - step = step / accel_profile[msc->scroll_accel]; 206 - if (step != 0) { 207 - msc->touches[id].scroll_y = y; 208 msc->scroll_jiffies = now; 209 - input_report_rel(input, REL_WHEEL, step); 210 } 211 break; 212 } 213 } 214 215 /* Generate the input events for this touch. */ 216 - if (report_touches) { 217 int orientation = (misc >> 10) - 32; 218 219 input_report_abs(input, ABS_MT_TRACKING_ID, id); 220 input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]); ··· 247 { 248 struct magicmouse_sc *msc = hid_get_drvdata(hdev); 249 struct input_dev *input = msc->input; 250 - int x, y, ts, ii, clicks; 251 252 switch (data[0]) { 253 case 0x10: ··· 267 msc->ntouches = (size - 6) / 8; 268 for (ii = 0; ii < msc->ntouches; ii++) 269 magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); 270 /* When emulating three-button mode, it is important 271 * to have the current touch information before 272 * generating a click event. 273 */ 274 - x = (signed char)data[1]; 275 - y = (signed char)data[2]; 276 clicks = data[3]; 277 break; 278 case 0x20: /* Theoretically battery status (0-100), but I have ··· 347 __set_bit(EV_REL, input->evbit); 348 __set_bit(REL_X, input->relbit); 349 __set_bit(REL_Y, input->relbit); 350 - if (emulate_scroll_wheel) 351 __set_bit(REL_WHEEL, input->relbit); 352 353 if (report_touches) { 354 __set_bit(EV_ABS, input->evbit); ··· 392 dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n"); 393 return -ENOMEM; 394 } 395 396 msc->quirks = id->driver_data; 397 hid_set_drvdata(hdev, msc);
··· 30 module_param(emulate_scroll_wheel, bool, 0644); 31 MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel"); 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 + 48 static bool report_touches = true; 49 module_param(report_touches, bool, 0644); 50 MODULE_PARM_DESC(report_touches, "Emit touch records (otherwise, only use them for emulation)"); ··· 49 #define TOUCH_STATE_NONE 0x00 50 #define TOUCH_STATE_START 0x30 51 #define TOUCH_STATE_DRAG 0x40 52 + 53 + #define SCROLL_ACCEL_DEFAULT 7 54 55 /** 56 * struct magicmouse_sc - Tracks Magic Mouse-specific data. ··· 78 struct { 79 short x; 80 short y; 81 + short scroll_x; 82 short scroll_y; 83 u8 size; 84 + u8 down; 85 } touches[16]; 86 int tracking_ids[16]; 87 }; ··· 141 input_report_key(msc->input, BTN_RIGHT, state & 2); 142 143 if (state != last_state) 144 + msc->scroll_accel = SCROLL_ACCEL_DEFAULT; 145 } 146 147 static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) ··· 152 int id = (misc >> 6) & 15; 153 int x = x_y << 12 >> 20; 154 int y = -(x_y >> 20); 155 + int down = (tdata[7] & TOUCH_STATE_MASK) != TOUCH_STATE_NONE; 156 157 /* Store tracking ID and other fields. */ 158 msc->tracking_ids[raw_id] = id; ··· 160 msc->touches[id].size = misc & 63; 161 162 /* If requested, emulate a scroll wheel by detecting small 163 + * vertical touch motions. 164 */ 165 + if (emulate_scroll_wheel) { 166 unsigned long now = jiffies; 167 + int step_x = msc->touches[id].scroll_x - x; 168 + int step_y = msc->touches[id].scroll_y - y; 169 170 /* Calculate and apply the scroll motion. */ 171 switch (tdata[7] & TOUCH_STATE_MASK) { 172 case TOUCH_STATE_START: 173 + msc->touches[id].scroll_x = x; 174 msc->touches[id].scroll_y = y; 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 + 184 break; 185 case TOUCH_STATE_DRAG: 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; 190 msc->scroll_jiffies = now; 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); 200 } 201 break; 202 } 203 } 204 205 /* Generate the input events for this touch. */ 206 + if (report_touches && down) { 207 int orientation = (misc >> 10) - 32; 208 + 209 + msc->touches[id].down = 1; 210 211 input_report_abs(input, ABS_MT_TRACKING_ID, id); 212 input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]); ··· 215 { 216 struct magicmouse_sc *msc = hid_get_drvdata(hdev); 217 struct input_dev *input = msc->input; 218 + int x, y, ts, ii, clicks, last_up; 219 220 switch (data[0]) { 221 case 0x10: ··· 235 msc->ntouches = (size - 6) / 8; 236 for (ii = 0; ii < msc->ntouches; ii++) 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 + 252 /* When emulating three-button mode, it is important 253 * to have the current touch information before 254 * generating a click event. 255 */ 256 + x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22; 257 + y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22; 258 clicks = data[3]; 259 break; 260 case 0x20: /* Theoretically battery status (0-100), but I have ··· 301 __set_bit(EV_REL, input->evbit); 302 __set_bit(REL_X, input->relbit); 303 __set_bit(REL_Y, input->relbit); 304 + if (emulate_scroll_wheel) { 305 __set_bit(REL_WHEEL, input->relbit); 306 + __set_bit(REL_HWHEEL, input->relbit); 307 + } 308 309 if (report_touches) { 310 __set_bit(EV_ABS, input->evbit); ··· 344 dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n"); 345 return -ENOMEM; 346 } 347 + 348 + msc->scroll_accel = SCROLL_ACCEL_DEFAULT; 349 350 msc->quirks = id->driver_data; 351 hid_set_drvdata(hdev, msc);
+166 -33
drivers/hid/hid-picolcd.c
··· 127 .height = 26, 128 .bits_per_pixel = 1, 129 .grayscale = 1, 130 }; 131 #endif /* CONFIG_HID_PICOLCD_FB */ 132 ··· 208 /* Framebuffer stuff */ 209 u8 fb_update_rate; 210 u8 fb_bpp; 211 u8 *fb_vbitmap; /* local copy of what was sent to PicoLCD */ 212 u8 *fb_bitmap; /* framebuffer */ 213 struct fb_info *fb_info; ··· 367 const u8 *bdata = bitmap + tile * 256 + chip * 8 + b * 32; 368 for (i = 0; i < 64; i++) { 369 tdata[i] <<= 1; 370 - tdata[i] |= (bdata[i/8] >> (7 - i % 8)) & 0x01; 371 } 372 } 373 } else if (bpp == 8) { ··· 420 421 if (data->fb_bitmap) { 422 if (clear) { 423 - memset(data->fb_vbitmap, 0xff, PICOLCDFB_SIZE); 424 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 } 430 } 431 432 /* schedule first output of framebuffer */ ··· 438 { 439 int chip, tile, n; 440 unsigned long flags; 441 442 spin_lock_irqsave(&data->lock, flags); 443 if (!(data->status & PICOLCD_READY_FB)) { ··· 461 for (chip = 0; chip < 4; chip++) 462 for (tile = 0; tile < 8; tile++) 463 if (picolcd_fb_update_tile(data->fb_vbitmap, 464 - data->fb_bitmap, data->fb_bpp, chip, tile)) { 465 n += 2; 466 if (n >= HID_OUTPUT_FIFO_SIZE / 2) { 467 usbhid_wait_io(data->hdev); 468 n = 0; 469 } 470 picolcd_fb_send_tile(data->hdev, chip, tile); 471 } 472 if (n) 473 usbhid_wait_io(data->hdev); 474 } ··· 536 static void picolcd_fb_destroy(struct fb_info *info) 537 { 538 struct picolcd_data *data = info->par; 539 info->par = NULL; 540 if (data) 541 data->fb_info = NULL; 542 fb_deferred_io_cleanup(info); 543 - framebuffer_release(info); 544 } 545 546 static int picolcd_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ··· 563 /* only allow 1/8 bit depth (8-bit is grayscale) */ 564 *var = picolcdfb_var; 565 var->activate = activate; 566 - if (bpp >= 8) 567 var->bits_per_pixel = 8; 568 - else 569 var->bits_per_pixel = 1; 570 return 0; 571 } 572 573 static int picolcd_set_par(struct fb_info *info) 574 { 575 struct picolcd_data *data = info->par; 576 - u8 *o_fb, *n_fb; 577 if (info->var.bits_per_pixel == data->fb_bpp) 578 return 0; 579 /* switch between 1/8 bit depths */ 580 if (info->var.bits_per_pixel != 1 && info->var.bits_per_pixel != 8) 581 return -EINVAL; 582 583 - o_fb = data->fb_bitmap; 584 - n_fb = vmalloc(PICOLCDFB_SIZE*info->var.bits_per_pixel); 585 - if (!n_fb) 586 return -ENOMEM; 587 588 - fb_deferred_io_cleanup(info); 589 /* translate FB content to new bits-per-pixel */ 590 if (info->var.bits_per_pixel == 1) { 591 int i, b; ··· 603 p <<= 1; 604 p |= o_fb[i*8+b] ? 0x01 : 0x00; 605 } 606 } 607 info->fix.visual = FB_VISUAL_MONO01; 608 info->fix.line_length = PICOLCDFB_WIDTH / 8; 609 } else { 610 int i; 611 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; 614 info->fix.line_length = PICOLCDFB_WIDTH; 615 } 616 617 - data->fb_bitmap = n_fb; 618 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); 624 return 0; 625 } 626 ··· 691 static struct fb_ops picolcdfb_ops = { 692 .owner = THIS_MODULE, 693 .fb_destroy = picolcd_fb_destroy, 694 .fb_read = fb_sys_read, 695 .fb_write = picolcd_fb_write, 696 .fb_blank = picolcd_fb_blank, ··· 770 { 771 struct device *dev = &data->hdev->dev; 772 struct fb_info *info = NULL; 773 - int error = -ENOMEM; 774 u8 *fb_vbitmap = NULL; 775 u8 *fb_bitmap = NULL; 776 777 - fb_bitmap = vmalloc(PICOLCDFB_SIZE*picolcdfb_var.bits_per_pixel); 778 if (fb_bitmap == NULL) { 779 dev_err(dev, "can't get a free page for framebuffer\n"); 780 goto err_nomem; ··· 789 790 data->fb_update_rate = PICOLCDFB_UPDATE_RATE_DEFAULT; 791 data->fb_defio = picolcd_fb_defio; 792 - info = framebuffer_alloc(0, dev); 793 if (info == NULL) { 794 dev_err(dev, "failed to allocate a framebuffer\n"); 795 goto err_nomem; 796 } 797 798 info->fbdefio = &data->fb_defio; 799 info->screen_base = (char __force __iomem *)fb_bitmap; 800 info->fbops = &picolcdfb_ops; 801 info->var = picolcdfb_var; 802 info->fix = picolcdfb_fix; 803 - info->fix.smem_len = PICOLCDFB_SIZE; 804 info->fix.smem_start = (unsigned long)fb_bitmap; 805 info->par = data; 806 info->flags = FBINFO_FLAG_DEFAULT; ··· 829 dev_err(dev, "failed to create sysfs attributes\n"); 830 goto err_cleanup; 831 } 832 data->fb_info = info; 833 error = register_framebuffer(info); 834 if (error) { 835 dev_err(dev, "failed to register framebuffer\n"); 836 goto err_sysfs; 837 } 838 - fb_deferred_io_init(info); 839 /* schedule first output of framebuffer */ 840 schedule_delayed_work(&info->deferred_work, 0); 841 return 0; 842 843 err_sysfs: 844 device_remove_file(dev, &dev_attr_fb_update_rate); 845 err_cleanup: 846 data->fb_vbitmap = NULL; ··· 861 { 862 struct fb_info *info = data->fb_info; 863 u8 *fb_vbitmap = data->fb_vbitmap; 864 - u8 *fb_bitmap = data->fb_bitmap; 865 866 if (!info) 867 return; 868 869 data->fb_vbitmap = NULL; 870 data->fb_bitmap = NULL; 871 data->fb_bpp = 0; 872 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 kfree(fb_vbitmap); 878 } 879 ··· 2688 spin_lock_irqsave(&data->lock, flags); 2689 data->status |= PICOLCD_FAILED; 2690 spin_unlock_irqrestore(&data->lock, flags); 2691 2692 picolcd_exit_devfs(data); 2693 device_remove_file(&hdev->dev, &dev_attr_operation_mode); ··· 2752 static void __exit picolcd_exit(void) 2753 { 2754 hid_unregister_driver(&picolcd_driver); 2755 } 2756 2757 module_init(picolcd_init);
··· 127 .height = 26, 128 .bits_per_pixel = 1, 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 + }, 150 }; 151 #endif /* CONFIG_HID_PICOLCD_FB */ 152 ··· 188 /* Framebuffer stuff */ 189 u8 fb_update_rate; 190 u8 fb_bpp; 191 + u8 fb_force; 192 u8 *fb_vbitmap; /* local copy of what was sent to PicoLCD */ 193 u8 *fb_bitmap; /* framebuffer */ 194 struct fb_info *fb_info; ··· 346 const u8 *bdata = bitmap + tile * 256 + chip * 8 + b * 32; 347 for (i = 0; i < 64; i++) { 348 tdata[i] <<= 1; 349 + tdata[i] |= (bdata[i/8] >> (i % 8)) & 0x01; 350 } 351 } 352 } else if (bpp == 8) { ··· 399 400 if (data->fb_bitmap) { 401 if (clear) { 402 + memset(data->fb_vbitmap, 0, PICOLCDFB_SIZE); 403 memset(data->fb_bitmap, 0, PICOLCDFB_SIZE*data->fb_bpp); 404 } 405 + data->fb_force = 1; 406 } 407 408 /* schedule first output of framebuffer */ ··· 420 { 421 int chip, tile, n; 422 unsigned long flags; 423 + 424 + if (!data) 425 + return; 426 427 spin_lock_irqsave(&data->lock, flags); 428 if (!(data->status & PICOLCD_READY_FB)) { ··· 440 for (chip = 0; chip < 4; chip++) 441 for (tile = 0; tile < 8; tile++) 442 if (picolcd_fb_update_tile(data->fb_vbitmap, 443 + data->fb_bitmap, data->fb_bpp, chip, tile) || 444 + data->fb_force) { 445 n += 2; 446 + if (!data->fb_info->par) 447 + return; /* device lost! */ 448 if (n >= HID_OUTPUT_FIFO_SIZE / 2) { 449 usbhid_wait_io(data->hdev); 450 n = 0; 451 } 452 picolcd_fb_send_tile(data->hdev, chip, tile); 453 } 454 + data->fb_force = false; 455 if (n) 456 usbhid_wait_io(data->hdev); 457 } ··· 511 static void picolcd_fb_destroy(struct fb_info *info) 512 { 513 struct picolcd_data *data = info->par; 514 + u32 *ref_cnt = info->pseudo_palette; 515 + int may_release; 516 + 517 info->par = NULL; 518 if (data) 519 data->fb_info = NULL; 520 fb_deferred_io_cleanup(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 + } 531 } 532 533 static int picolcd_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ··· 526 /* only allow 1/8 bit depth (8-bit is grayscale) */ 527 *var = picolcdfb_var; 528 var->activate = activate; 529 + if (bpp >= 8) { 530 var->bits_per_pixel = 8; 531 + var->red.length = 8; 532 + var->green.length = 8; 533 + var->blue.length = 8; 534 + } else { 535 var->bits_per_pixel = 1; 536 + var->red.length = 1; 537 + var->green.length = 1; 538 + var->blue.length = 1; 539 + } 540 return 0; 541 } 542 543 static int picolcd_set_par(struct fb_info *info) 544 { 545 struct picolcd_data *data = info->par; 546 + u8 *tmp_fb, *o_fb; 547 + if (!data) 548 + return -ENODEV; 549 if (info->var.bits_per_pixel == data->fb_bpp) 550 return 0; 551 /* switch between 1/8 bit depths */ 552 if (info->var.bits_per_pixel != 1 && info->var.bits_per_pixel != 8) 553 return -EINVAL; 554 555 + o_fb = data->fb_bitmap; 556 + tmp_fb = kmalloc(PICOLCDFB_SIZE*info->var.bits_per_pixel, GFP_KERNEL); 557 + if (!tmp_fb) 558 return -ENOMEM; 559 560 /* translate FB content to new bits-per-pixel */ 561 if (info->var.bits_per_pixel == 1) { 562 int i, b; ··· 558 p <<= 1; 559 p |= o_fb[i*8+b] ? 0x01 : 0x00; 560 } 561 + tmp_fb[i] = p; 562 } 563 + memcpy(o_fb, tmp_fb, PICOLCDFB_SIZE); 564 info->fix.visual = FB_VISUAL_MONO01; 565 info->fix.line_length = PICOLCDFB_WIDTH / 8; 566 } else { 567 int i; 568 + memcpy(tmp_fb, o_fb, PICOLCDFB_SIZE); 569 for (i = 0; i < PICOLCDFB_SIZE * 8; i++) 570 + o_fb[i] = tmp_fb[i/8] & (0x01 << (7 - i % 8)) ? 0xff : 0x00; 571 + info->fix.visual = FB_VISUAL_DIRECTCOLOR; 572 info->fix.line_length = PICOLCDFB_WIDTH; 573 } 574 575 + kfree(tmp_fb); 576 data->fb_bpp = info->var.bits_per_pixel; 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 + } 642 return 0; 643 } 644 ··· 583 static struct fb_ops picolcdfb_ops = { 584 .owner = THIS_MODULE, 585 .fb_destroy = picolcd_fb_destroy, 586 + .fb_open = picolcd_fb_open, 587 + .fb_release = picolcd_fb_release, 588 .fb_read = fb_sys_read, 589 .fb_write = picolcd_fb_write, 590 .fb_blank = picolcd_fb_blank, ··· 660 { 661 struct device *dev = &data->hdev->dev; 662 struct fb_info *info = NULL; 663 + int i, error = -ENOMEM; 664 u8 *fb_vbitmap = NULL; 665 u8 *fb_bitmap = NULL; 666 + u32 *palette; 667 668 + fb_bitmap = vmalloc(PICOLCDFB_SIZE*8); 669 if (fb_bitmap == NULL) { 670 dev_err(dev, "can't get a free page for framebuffer\n"); 671 goto err_nomem; ··· 678 679 data->fb_update_rate = PICOLCDFB_UPDATE_RATE_DEFAULT; 680 data->fb_defio = picolcd_fb_defio; 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); 687 if (info == NULL) { 688 dev_err(dev, "failed to allocate a framebuffer\n"); 689 goto err_nomem; 690 } 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; 698 info->fbdefio = &data->fb_defio; 699 info->screen_base = (char __force __iomem *)fb_bitmap; 700 info->fbops = &picolcdfb_ops; 701 info->var = picolcdfb_var; 702 info->fix = picolcdfb_fix; 703 + info->fix.smem_len = PICOLCDFB_SIZE*8; 704 info->fix.smem_start = (unsigned long)fb_bitmap; 705 info->par = data; 706 info->flags = FBINFO_FLAG_DEFAULT; ··· 707 dev_err(dev, "failed to create sysfs attributes\n"); 708 goto err_cleanup; 709 } 710 + fb_deferred_io_init(info); 711 data->fb_info = info; 712 error = register_framebuffer(info); 713 if (error) { 714 dev_err(dev, "failed to register framebuffer\n"); 715 goto err_sysfs; 716 } 717 /* schedule first output of framebuffer */ 718 + data->fb_force = 1; 719 schedule_delayed_work(&info->deferred_work, 0); 720 return 0; 721 722 err_sysfs: 723 + fb_deferred_io_cleanup(info); 724 device_remove_file(dev, &dev_attr_fb_update_rate); 725 err_cleanup: 726 data->fb_vbitmap = NULL; ··· 737 { 738 struct fb_info *info = data->fb_info; 739 u8 *fb_vbitmap = data->fb_vbitmap; 740 741 if (!info) 742 return; 743 744 + info->par = NULL; 745 + device_remove_file(&data->hdev->dev, &dev_attr_fb_update_rate); 746 + unregister_framebuffer(info); 747 data->fb_vbitmap = NULL; 748 data->fb_bitmap = NULL; 749 data->fb_bpp = 0; 750 data->fb_info = NULL; 751 kfree(fb_vbitmap); 752 } 753 ··· 2566 spin_lock_irqsave(&data->lock, flags); 2567 data->status |= PICOLCD_FAILED; 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 2576 2577 picolcd_exit_devfs(data); 2578 device_remove_file(&hdev->dev, &dev_attr_operation_mode); ··· 2623 static void __exit picolcd_exit(void) 2624 { 2625 hid_unregister_driver(&picolcd_driver); 2626 + #ifdef CONFIG_HID_PICOLCD_FB 2627 + flush_scheduled_work(); 2628 + WARN_ON(fb_pending); 2629 + #endif 2630 } 2631 2632 module_init(picolcd_init);
+2 -23
drivers/hid/hid-roccat-kone.c
··· 22 * Is it possible to remove and reinstall the urb in raw-event- or any 23 * other handler, or to defer this action to be executed somewhere else? 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 * TODO is it possible to overwrite group for sysfs attributes via udev? 31 */ 32 ··· 272 count = sizeof(struct kone_settings) - off; 273 274 mutex_lock(&kone->kone_lock); 275 - memcpy(buf, &kone->settings + off, count); 276 mutex_unlock(&kone->kone_lock); 277 278 return count; ··· 332 count = sizeof(struct kone_profile) - off; 333 334 mutex_lock(&kone->kone_lock); 335 - memcpy(buf, &kone->profiles[number - 1], sizeof(struct kone_profile)); 336 mutex_unlock(&kone->kone_lock); 337 338 return count; ··· 618 } 619 620 /* 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 * Read actual dpi settings. 634 * Returns raw value for further processing. Refer to enum kone_polling_rates to 635 * get real value. ··· 654 kone_sysfs_show_startup_profile, 655 kone_sysfs_set_startup_profile); 656 657 - static DEVICE_ATTR(kone_driver_version, 0440, 658 - kone_sysfs_show_driver_version, NULL); 659 - 660 static struct attribute *kone_attributes[] = { 661 &dev_attr_actual_dpi.attr, 662 &dev_attr_actual_profile.attr, ··· 661 &dev_attr_firmware_version.attr, 662 &dev_attr_tcu.attr, 663 &dev_attr_startup_profile.attr, 664 - &dev_attr_kone_driver_version.attr, 665 NULL 666 }; 667
··· 22 * Is it possible to remove and reinstall the urb in raw-event- or any 23 * other handler, or to defer this action to be executed somewhere else? 24 * 25 * TODO is it possible to overwrite group for sysfs attributes via udev? 26 */ 27 ··· 277 count = sizeof(struct kone_settings) - off; 278 279 mutex_lock(&kone->kone_lock); 280 + memcpy(buf, ((char const *)&kone->settings) + off, count); 281 mutex_unlock(&kone->kone_lock); 282 283 return count; ··· 337 count = sizeof(struct kone_profile) - off; 338 339 mutex_lock(&kone->kone_lock); 340 + memcpy(buf, ((char const *)&kone->profiles[number - 1]) + off, count); 341 mutex_unlock(&kone->kone_lock); 342 343 return count; ··· 623 } 624 625 /* 626 * Read actual dpi settings. 627 * Returns raw value for further processing. Refer to enum kone_polling_rates to 628 * get real value. ··· 671 kone_sysfs_show_startup_profile, 672 kone_sysfs_set_startup_profile); 673 674 static struct attribute *kone_attributes[] = { 675 &dev_attr_actual_dpi.attr, 676 &dev_attr_actual_profile.attr, ··· 681 &dev_attr_firmware_version.attr, 682 &dev_attr_tcu.attr, 683 &dev_attr_startup_profile.attr, 684 NULL 685 }; 686
-2
drivers/hid/hid-roccat-kone.h
··· 14 15 #include <linux/types.h> 16 17 - #define ROCCAT_KONE_DRIVER_VERSION "v0.3.1" 18 - 19 #pragma pack(push) 20 #pragma pack(1) 21
··· 14 15 #include <linux/types.h> 16 17 #pragma pack(push) 18 #pragma pack(1) 19
+6 -3
drivers/hid/hid-roccat.c
··· 168 printk(KERN_EMERG "roccat device with minor %d doesn't exist\n", 169 minor); 170 error = -ENODEV; 171 - goto exit_unlock; 172 } 173 174 if (!device->open++) { ··· 178 PM_HINT_FULLON); 179 if (error < 0) { 180 --device->open; 181 - goto exit_unlock; 182 } 183 } 184 error = device->hid->ll_driver->open(device->hid); ··· 187 device->hid->ll_driver->power(device->hid, 188 PM_HINT_NORMAL); 189 --device->open; 190 - goto exit_unlock; 191 } 192 } 193 ··· 202 mutex_unlock(&device->readers_lock); 203 mutex_unlock(&devices_lock); 204 return error; 205 } 206 207 static int roccat_release(struct inode *inode, struct file *file)
··· 168 printk(KERN_EMERG "roccat device with minor %d doesn't exist\n", 169 minor); 170 error = -ENODEV; 171 + goto exit_err; 172 } 173 174 if (!device->open++) { ··· 178 PM_HINT_FULLON); 179 if (error < 0) { 180 --device->open; 181 + goto exit_err; 182 } 183 } 184 error = device->hid->ll_driver->open(device->hid); ··· 187 device->hid->ll_driver->power(device->hid, 188 PM_HINT_NORMAL); 189 --device->open; 190 + goto exit_err; 191 } 192 } 193 ··· 202 mutex_unlock(&device->readers_lock); 203 mutex_unlock(&devices_lock); 204 return error; 205 + exit_err: 206 + kfree(reader); 207 + goto exit_unlock; 208 } 209 210 static int roccat_release(struct inode *inode, struct file *file)
+1 -1
drivers/hid/hid-roccat.h
··· 15 #include <linux/hid.h> 16 #include <linux/types.h> 17 18 - #if defined(CONFIG_HID_ROCCAT) || defined (CONFIG_HID_ROCCAT_MODULE) 19 int roccat_connect(struct hid_device *hid); 20 void roccat_disconnect(int minor); 21 int roccat_report_event(int minor, u8 const *data, int len);
··· 15 #include <linux/hid.h> 16 #include <linux/types.h> 17 18 + #if defined(CONFIG_HID_ROCCAT) || defined(CONFIG_HID_ROCCAT_MODULE) 19 int roccat_connect(struct hid_device *hid); 20 void roccat_disconnect(int minor); 21 int roccat_report_event(int minor, u8 const *data, int len);
+5
drivers/hid/hid-topseed.c
··· 6 * 7 * Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by 8 * Wayne Thomas 2010. 9 */ 10 11 /* ··· 37 case 0x00d: ts_map_key_clear(KEY_MEDIA); break; 38 case 0x024: ts_map_key_clear(KEY_MENU); break; 39 case 0x025: ts_map_key_clear(KEY_TV); break; 40 case 0x031: ts_map_key_clear(KEY_AUDIO); break; 41 case 0x032: ts_map_key_clear(KEY_TEXT); break; 42 case 0x033: ts_map_key_clear(KEY_CHANNEL); break; ··· 64 static const struct hid_device_id ts_devices[] = { 65 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 66 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 67 { } 68 }; 69 MODULE_DEVICE_TABLE(hid, ts_devices);
··· 6 * 7 * Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by 8 * Wayne Thomas 2010. 9 + * 10 + * Modified to support Conceptronic CLLRCMCE by 11 + * Kees Bakker 2010. 12 */ 13 14 /* ··· 34 case 0x00d: ts_map_key_clear(KEY_MEDIA); break; 35 case 0x024: ts_map_key_clear(KEY_MENU); break; 36 case 0x025: ts_map_key_clear(KEY_TV); break; 37 + case 0x027: ts_map_key_clear(KEY_MODE); break; 38 case 0x031: ts_map_key_clear(KEY_AUDIO); break; 39 case 0x032: ts_map_key_clear(KEY_TEXT); break; 40 case 0x033: ts_map_key_clear(KEY_CHANNEL); break; ··· 60 static const struct hid_device_id ts_devices[] = { 61 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 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) }, 64 { } 65 }; 66 MODULE_DEVICE_TABLE(hid, ts_devices);
+1 -1
drivers/hid/hid-wacom.c
··· 436 437 static const struct hid_device_id wacom_devices[] = { 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) }, 440 { } 441 }; 442 MODULE_DEVICE_TABLE(hid, wacom_devices);
··· 436 437 static const struct hid_device_id wacom_devices[] = { 438 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, 439 + 440 { } 441 }; 442 MODULE_DEVICE_TABLE(hid, wacom_devices);
-2
drivers/hid/hidraw.c
··· 46 { 47 struct hidraw_list *list = file->private_data; 48 int ret = 0, len; 49 - char *report; 50 DECLARE_WAITQUEUE(wait, current); 51 52 mutex_lock(&list->read_mutex); ··· 83 if (ret) 84 goto out; 85 86 - report = list->buffer[list->tail].value; 87 len = list->buffer[list->tail].len > count ? 88 count : list->buffer[list->tail].len; 89
··· 46 { 47 struct hidraw_list *list = file->private_data; 48 int ret = 0, len; 49 DECLARE_WAITQUEUE(wait, current); 50 51 mutex_lock(&list->read_mutex); ··· 84 if (ret) 85 goto out; 86 87 len = list->buffer[list->tail].len > count ? 88 count : list->buffer[list->tail].len; 89
+2
drivers/hid/usbhid/hid-quirks.c
··· 75 { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 76 { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 77 78 { 0, 0 } 79 }; 80
··· 75 { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 76 { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 77 78 + { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, 79 + 80 { 0, 0 } 81 }; 82
+12 -42
drivers/hid/usbhid/hiddev.c
··· 67 struct mutex thread_lock; 68 }; 69 70 - static struct hiddev *hiddev_table[HIDDEV_MINORS]; 71 72 /* 73 * Find a report, given the report's type and ID. The ID can be specified ··· 265 static int hiddev_open(struct inode *inode, struct file *file) 266 { 267 struct hiddev_list *list; 268 - int res, i; 269 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]) 275 return -ENODEV; 276 277 if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL))) 278 return -ENOMEM; 279 mutex_init(&list->thread_lock); 280 - 281 - list->hiddev = hiddev_table[i]; 282 - 283 - 284 file->private_data = list; 285 286 /* ··· 286 */ 287 if (list->hiddev->exist) { 288 if (!list->hiddev->open++) { 289 - res = usbhid_open(hiddev_table[i]->hid); 290 if (res < 0) { 291 res = -EIO; 292 goto bail; ··· 298 } 299 300 spin_lock_irq(&list->hiddev->list_lock); 301 - list_add_tail(&list->node, &hiddev_table[i]->list); 302 spin_unlock_irq(&list->hiddev->list_lock); 303 304 if (!list->hiddev->open++) 305 if (list->hiddev->exist) { 306 - struct hid_device *hid = hiddev_table[i]->hid; 307 res = usbhid_get_power(hid); 308 if (res < 0) { 309 res = -EIO; ··· 311 } 312 usbhid_open(hid); 313 } 314 - 315 - unlock_kernel(); 316 return 0; 317 bail: 318 file->private_data = NULL; 319 kfree(list); 320 - unlock_kernel(); 321 return res; 322 } 323 ··· 888 hid->hiddev = hiddev; 889 hiddev->hid = hid; 890 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(); 909 retval = usb_register_dev(usbhid->intf, &hiddev_class); 910 if (retval) { 911 err_hid("Not able to get a minor for this device."); 912 hid->hiddev = NULL; 913 - unlock_kernel(); 914 kfree(hiddev); 915 return -1; 916 - } else { 917 - hid->minor = usbhid->intf->minor; 918 - hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; 919 } 920 - unlock_kernel(); 921 - 922 return 0; 923 } 924 ··· 913 hiddev->exist = 0; 914 mutex_unlock(&hiddev->existancelock); 915 916 - hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL; 917 usb_deregister_dev(usbhid->intf, &hiddev_class); 918 919 if (hiddev->open) {
··· 67 struct mutex thread_lock; 68 }; 69 70 + static struct usb_driver hiddev_driver; 71 72 /* 73 * Find a report, given the report's type and ID. The ID can be specified ··· 265 static int hiddev_open(struct inode *inode, struct file *file) 266 { 267 struct hiddev_list *list; 268 + struct usb_interface *intf; 269 + struct hiddev *hiddev; 270 + int res; 271 272 + intf = usb_find_interface(&hiddev_driver, iminor(inode)); 273 + if (!intf) 274 return -ENODEV; 275 + hiddev = usb_get_intfdata(intf); 276 277 if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL))) 278 return -ENOMEM; 279 mutex_init(&list->thread_lock); 280 + list->hiddev = hiddev; 281 file->private_data = list; 282 283 /* ··· 289 */ 290 if (list->hiddev->exist) { 291 if (!list->hiddev->open++) { 292 + res = usbhid_open(hiddev->hid); 293 if (res < 0) { 294 res = -EIO; 295 goto bail; ··· 301 } 302 303 spin_lock_irq(&list->hiddev->list_lock); 304 + list_add_tail(&list->node, &hiddev->list); 305 spin_unlock_irq(&list->hiddev->list_lock); 306 307 if (!list->hiddev->open++) 308 if (list->hiddev->exist) { 309 + struct hid_device *hid = hiddev->hid; 310 res = usbhid_get_power(hid); 311 if (res < 0) { 312 res = -EIO; ··· 314 } 315 usbhid_open(hid); 316 } 317 return 0; 318 bail: 319 file->private_data = NULL; 320 kfree(list); 321 return res; 322 } 323 ··· 894 hid->hiddev = hiddev; 895 hiddev->hid = hid; 896 hiddev->exist = 1; 897 + usb_set_intfdata(usbhid->intf, usbhid); 898 retval = usb_register_dev(usbhid->intf, &hiddev_class); 899 if (retval) { 900 err_hid("Not able to get a minor for this device."); 901 hid->hiddev = NULL; 902 kfree(hiddev); 903 return -1; 904 } 905 return 0; 906 } 907 ··· 942 hiddev->exist = 0; 943 mutex_unlock(&hiddev->existancelock); 944 945 usb_deregister_dev(usbhid->intf, &hiddev_class); 946 947 if (hiddev->open) {
+1
include/linux/hid.h
··· 311 #define HID_QUIRK_HIDDEV_FORCE 0x00000010 312 #define HID_QUIRK_BADPAD 0x00000020 313 #define HID_QUIRK_MULTI_INPUT 0x00000040 314 #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 315 #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 316 #define HID_QUIRK_NO_INIT_REPORTS 0x20000000
··· 311 #define HID_QUIRK_HIDDEV_FORCE 0x00000010 312 #define HID_QUIRK_BADPAD 0x00000020 313 #define HID_QUIRK_MULTI_INPUT 0x00000040 314 + #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 315 #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 316 #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 317 #define HID_QUIRK_NO_INIT_REPORTS 0x20000000