Commit 28023d2a8e9121b1b06c3b46e523c3c7a3e8b530
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina: - bounds checking fixes in logitech and roccat drivers, from Peter Wu and Dan Carpenter - double-kfree fix in i2c-hid driver on bus shutdown, from Mika Westerberg - a couple of various small driver fixes - a few device id additions * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: roccat: potential out of bounds in pyra_sysfs_write_settings() HID: Add a new id 0x501a for Genius MousePen i608X HID: logitech-hidpp: prefix the name with "Logitech" HID: logitech-hidpp: avoid unintended fall-through HID: Allow HID_BATTERY_STRENGTH to be enabled HID: i2c-hid: Do not free buffers in i2c_hid_stop() HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard HID: logitech-hidpp: check WTP report length HID: logitech-dj: check report length
Showing 10 changed files Inline Diff
drivers/hid/Kconfig
1 | # | 1 | # |
2 | # HID driver configuration | 2 | # HID driver configuration |
3 | # | 3 | # |
4 | menu "HID support" | 4 | menu "HID support" |
5 | depends on INPUT | 5 | depends on INPUT |
6 | 6 | ||
7 | config HID | 7 | config HID |
8 | tristate "HID bus support" | 8 | tristate "HID bus support" |
9 | depends on INPUT | 9 | depends on INPUT |
10 | default y | 10 | default y |
11 | ---help--- | 11 | ---help--- |
12 | A human interface device (HID) is a type of computer device that | 12 | A human interface device (HID) is a type of computer device that |
13 | interacts directly with and takes input from humans. The term "HID" | 13 | interacts directly with and takes input from humans. The term "HID" |
14 | most commonly used to refer to the USB-HID specification, but other | 14 | most commonly used to refer to the USB-HID specification, but other |
15 | devices (such as, but not strictly limited to, Bluetooth) are | 15 | devices (such as, but not strictly limited to, Bluetooth) are |
16 | designed using HID specification (this involves certain keyboards, | 16 | designed using HID specification (this involves certain keyboards, |
17 | mice, tablets, etc). This option adds the HID bus to the kernel, | 17 | mice, tablets, etc). This option adds the HID bus to the kernel, |
18 | together with generic HID layer code. The HID devices are added and | 18 | together with generic HID layer code. The HID devices are added and |
19 | removed from the HID bus by the transport-layer drivers, such as | 19 | removed from the HID bus by the transport-layer drivers, such as |
20 | usbhid (USB_HID) and hidp (BT_HIDP). | 20 | usbhid (USB_HID) and hidp (BT_HIDP). |
21 | 21 | ||
22 | For docs and specs, see http://www.usb.org/developers/hidpage/ | 22 | For docs and specs, see http://www.usb.org/developers/hidpage/ |
23 | 23 | ||
24 | If unsure, say Y. | 24 | If unsure, say Y. |
25 | 25 | ||
26 | if HID | 26 | if HID |
27 | 27 | ||
28 | config HID_BATTERY_STRENGTH | 28 | config HID_BATTERY_STRENGTH |
29 | bool "Battery level reporting for HID devices" | 29 | bool "Battery level reporting for HID devices" |
30 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY | 30 | depends on HID |
31 | select POWER_SUPPLY | ||
31 | default n | 32 | default n |
32 | ---help--- | 33 | ---help--- |
33 | This option adds support of reporting battery strength (for HID devices | 34 | This option adds support of reporting battery strength (for HID devices |
34 | that support this feature) through power_supply class so that userspace | 35 | that support this feature) through power_supply class so that userspace |
35 | tools, such as upower, can display it. | 36 | tools, such as upower, can display it. |
36 | 37 | ||
37 | config HIDRAW | 38 | config HIDRAW |
38 | bool "/dev/hidraw raw HID device support" | 39 | bool "/dev/hidraw raw HID device support" |
39 | depends on HID | 40 | depends on HID |
40 | ---help--- | 41 | ---help--- |
41 | Say Y here if you want to support HID devices (from the USB | 42 | Say Y here if you want to support HID devices (from the USB |
42 | specification standpoint) that aren't strictly user interface | 43 | specification standpoint) that aren't strictly user interface |
43 | devices, like monitor controls and Uninterruptable Power Supplies. | 44 | devices, like monitor controls and Uninterruptable Power Supplies. |
44 | 45 | ||
45 | This module supports these devices separately using a separate | 46 | This module supports these devices separately using a separate |
46 | event interface on /dev/hidraw. | 47 | event interface on /dev/hidraw. |
47 | 48 | ||
48 | There is also a /dev/hiddev configuration option in the USB HID | 49 | There is also a /dev/hiddev configuration option in the USB HID |
49 | configuration menu. In comparison to hiddev, this device does not process | 50 | configuration menu. In comparison to hiddev, this device does not process |
50 | the hid events at all (no parsing, no lookups). This lets applications | 51 | the hid events at all (no parsing, no lookups). This lets applications |
51 | to work on raw hid events when they want to, and avoid using transport-specific | 52 | to work on raw hid events when they want to, and avoid using transport-specific |
52 | userspace libhid/libusb libraries. | 53 | userspace libhid/libusb libraries. |
53 | 54 | ||
54 | If unsure, say Y. | 55 | If unsure, say Y. |
55 | 56 | ||
56 | config UHID | 57 | config UHID |
57 | tristate "User-space I/O driver support for HID subsystem" | 58 | tristate "User-space I/O driver support for HID subsystem" |
58 | depends on HID | 59 | depends on HID |
59 | default n | 60 | default n |
60 | ---help--- | 61 | ---help--- |
61 | Say Y here if you want to provide HID I/O Drivers from user-space. | 62 | Say Y here if you want to provide HID I/O Drivers from user-space. |
62 | This allows to write I/O drivers in user-space and feed the data from | 63 | This allows to write I/O drivers in user-space and feed the data from |
63 | the device into the kernel. The kernel parses the HID reports, loads the | 64 | the device into the kernel. The kernel parses the HID reports, loads the |
64 | corresponding HID Device Driver or provides input devices on top of your | 65 | corresponding HID Device Driver or provides input devices on top of your |
65 | user-space device. | 66 | user-space device. |
66 | 67 | ||
67 | This driver cannot be used to parse HID-reports in user-space and write | 68 | This driver cannot be used to parse HID-reports in user-space and write |
68 | special HID-drivers. You should use hidraw for that. | 69 | special HID-drivers. You should use hidraw for that. |
69 | Instead, this driver allows to write the transport-layer driver in | 70 | Instead, this driver allows to write the transport-layer driver in |
70 | user-space like USB-HID and Bluetooth-HID do in kernel-space. | 71 | user-space like USB-HID and Bluetooth-HID do in kernel-space. |
71 | 72 | ||
72 | If unsure, say N. | 73 | If unsure, say N. |
73 | 74 | ||
74 | To compile this driver as a module, choose M here: the | 75 | To compile this driver as a module, choose M here: the |
75 | module will be called uhid. | 76 | module will be called uhid. |
76 | 77 | ||
77 | config HID_GENERIC | 78 | config HID_GENERIC |
78 | tristate "Generic HID driver" | 79 | tristate "Generic HID driver" |
79 | depends on HID | 80 | depends on HID |
80 | default HID | 81 | default HID |
81 | ---help--- | 82 | ---help--- |
82 | Support for generic devices on the HID bus. This includes most | 83 | Support for generic devices on the HID bus. This includes most |
83 | keyboards and mice, joysticks, tablets and digitizers. | 84 | keyboards and mice, joysticks, tablets and digitizers. |
84 | 85 | ||
85 | To compile this driver as a module, choose M here: the module | 86 | To compile this driver as a module, choose M here: the module |
86 | will be called hid-generic. | 87 | will be called hid-generic. |
87 | 88 | ||
88 | If unsure, say Y. | 89 | If unsure, say Y. |
89 | 90 | ||
90 | menu "Special HID drivers" | 91 | menu "Special HID drivers" |
91 | depends on HID | 92 | depends on HID |
92 | 93 | ||
93 | config HID_A4TECH | 94 | config HID_A4TECH |
94 | tristate "A4 tech mice" if EXPERT | 95 | tristate "A4 tech mice" if EXPERT |
95 | depends on HID | 96 | depends on HID |
96 | default !EXPERT | 97 | default !EXPERT |
97 | ---help--- | 98 | ---help--- |
98 | Support for A4 tech X5 and WOP-35 / Trust 450L mice. | 99 | Support for A4 tech X5 and WOP-35 / Trust 450L mice. |
99 | 100 | ||
100 | config HID_ACRUX | 101 | config HID_ACRUX |
101 | tristate "ACRUX game controller support" | 102 | tristate "ACRUX game controller support" |
102 | depends on HID | 103 | depends on HID |
103 | ---help--- | 104 | ---help--- |
104 | Say Y here if you want to enable support for ACRUX game controllers. | 105 | Say Y here if you want to enable support for ACRUX game controllers. |
105 | 106 | ||
106 | config HID_ACRUX_FF | 107 | config HID_ACRUX_FF |
107 | bool "ACRUX force feedback support" | 108 | bool "ACRUX force feedback support" |
108 | depends on HID_ACRUX | 109 | depends on HID_ACRUX |
109 | select INPUT_FF_MEMLESS | 110 | select INPUT_FF_MEMLESS |
110 | ---help--- | 111 | ---help--- |
111 | Say Y here if you want to enable force feedback support for ACRUX | 112 | Say Y here if you want to enable force feedback support for ACRUX |
112 | game controllers. | 113 | game controllers. |
113 | 114 | ||
114 | config HID_APPLE | 115 | config HID_APPLE |
115 | tristate "Apple {i,Power,Mac}Books" if EXPERT | 116 | tristate "Apple {i,Power,Mac}Books" if EXPERT |
116 | depends on HID | 117 | depends on HID |
117 | default !EXPERT | 118 | default !EXPERT |
118 | ---help--- | 119 | ---help--- |
119 | Support for some Apple devices which less or more break | 120 | Support for some Apple devices which less or more break |
120 | HID specification. | 121 | HID specification. |
121 | 122 | ||
122 | Say Y here if you want support for keyboards of Apple iBooks, PowerBooks, | 123 | Say Y here if you want support for keyboards of Apple iBooks, PowerBooks, |
123 | MacBooks, MacBook Pros and Apple Aluminum. | 124 | MacBooks, MacBook Pros and Apple Aluminum. |
124 | 125 | ||
125 | config HID_APPLEIR | 126 | config HID_APPLEIR |
126 | tristate "Apple infrared receiver" | 127 | tristate "Apple infrared receiver" |
127 | depends on (USB_HID) | 128 | depends on (USB_HID) |
128 | ---help--- | 129 | ---help--- |
129 | Support for Apple infrared remote control. All the Apple computers from | 130 | Support for Apple infrared remote control. All the Apple computers from |
130 | 2005 onwards include such a port, except the unibody Macbook (2009), | 131 | 2005 onwards include such a port, except the unibody Macbook (2009), |
131 | and Mac Pros. This receiver is also used in the Apple TV set-top box | 132 | and Mac Pros. This receiver is also used in the Apple TV set-top box |
132 | prior to the 2010 model. | 133 | prior to the 2010 model. |
133 | 134 | ||
134 | Say Y here if you want support for Apple infrared remote control. | 135 | Say Y here if you want support for Apple infrared remote control. |
135 | 136 | ||
136 | config HID_AUREAL | 137 | config HID_AUREAL |
137 | tristate "Aureal" | 138 | tristate "Aureal" |
138 | depends on HID | 139 | depends on HID |
139 | ---help--- | 140 | ---help--- |
140 | Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes. | 141 | Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes. |
141 | 142 | ||
142 | config HID_BELKIN | 143 | config HID_BELKIN |
143 | tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT | 144 | tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT |
144 | depends on HID | 145 | depends on HID |
145 | default !EXPERT | 146 | default !EXPERT |
146 | ---help--- | 147 | ---help--- |
147 | Support for Belkin Flip KVM and Wireless keyboard. | 148 | Support for Belkin Flip KVM and Wireless keyboard. |
148 | 149 | ||
149 | config HID_CHERRY | 150 | config HID_CHERRY |
150 | tristate "Cherry Cymotion keyboard" if EXPERT | 151 | tristate "Cherry Cymotion keyboard" if EXPERT |
151 | depends on HID | 152 | depends on HID |
152 | default !EXPERT | 153 | default !EXPERT |
153 | ---help--- | 154 | ---help--- |
154 | Support for Cherry Cymotion keyboard. | 155 | Support for Cherry Cymotion keyboard. |
155 | 156 | ||
156 | config HID_CHICONY | 157 | config HID_CHICONY |
157 | tristate "Chicony Tactical pad" if EXPERT | 158 | tristate "Chicony Tactical pad" if EXPERT |
158 | depends on HID | 159 | depends on HID |
159 | default !EXPERT | 160 | default !EXPERT |
160 | ---help--- | 161 | ---help--- |
161 | Support for Chicony Tactical pad. | 162 | Support for Chicony Tactical pad. |
162 | 163 | ||
163 | config HID_PRODIKEYS | 164 | config HID_PRODIKEYS |
164 | tristate "Prodikeys PC-MIDI Keyboard support" | 165 | tristate "Prodikeys PC-MIDI Keyboard support" |
165 | depends on HID && SND | 166 | depends on HID && SND |
166 | select SND_RAWMIDI | 167 | select SND_RAWMIDI |
167 | ---help--- | 168 | ---help--- |
168 | Support for Prodikeys PC-MIDI Keyboard device support. | 169 | Support for Prodikeys PC-MIDI Keyboard device support. |
169 | Say Y here to enable support for this device. | 170 | Say Y here to enable support for this device. |
170 | - Prodikeys PC-MIDI keyboard. | 171 | - Prodikeys PC-MIDI keyboard. |
171 | The Prodikeys PC-MIDI acts as a USB Audio device, with one MIDI | 172 | The Prodikeys PC-MIDI acts as a USB Audio device, with one MIDI |
172 | input and one MIDI output. These MIDI jacks appear as | 173 | input and one MIDI output. These MIDI jacks appear as |
173 | a sound "card" in the ALSA sound system. | 174 | a sound "card" in the ALSA sound system. |
174 | Note: if you say N here, this device will still function as a basic | 175 | Note: if you say N here, this device will still function as a basic |
175 | multimedia keyboard, but will lack support for the musical keyboard | 176 | multimedia keyboard, but will lack support for the musical keyboard |
176 | and some additional multimedia keys. | 177 | and some additional multimedia keys. |
177 | 178 | ||
178 | config HID_CP2112 | 179 | config HID_CP2112 |
179 | tristate "Silicon Labs CP2112 HID USB-to-SMBus Bridge support" | 180 | tristate "Silicon Labs CP2112 HID USB-to-SMBus Bridge support" |
180 | depends on USB_HID && I2C && GPIOLIB | 181 | depends on USB_HID && I2C && GPIOLIB |
181 | ---help--- | 182 | ---help--- |
182 | Support for Silicon Labs CP2112 HID USB to SMBus Master Bridge. | 183 | Support for Silicon Labs CP2112 HID USB to SMBus Master Bridge. |
183 | This is a HID device driver which registers as an i2c adapter | 184 | This is a HID device driver which registers as an i2c adapter |
184 | and gpiochip to expose these functions of the CP2112. The | 185 | and gpiochip to expose these functions of the CP2112. The |
185 | customizable USB descriptor fields are exposed as sysfs attributes. | 186 | customizable USB descriptor fields are exposed as sysfs attributes. |
186 | 187 | ||
187 | config HID_CYPRESS | 188 | config HID_CYPRESS |
188 | tristate "Cypress mouse and barcode readers" if EXPERT | 189 | tristate "Cypress mouse and barcode readers" if EXPERT |
189 | depends on HID | 190 | depends on HID |
190 | default !EXPERT | 191 | default !EXPERT |
191 | ---help--- | 192 | ---help--- |
192 | Support for cypress mouse and barcode readers. | 193 | Support for cypress mouse and barcode readers. |
193 | 194 | ||
194 | config HID_DRAGONRISE | 195 | config HID_DRAGONRISE |
195 | tristate "DragonRise Inc. game controller" | 196 | tristate "DragonRise Inc. game controller" |
196 | depends on HID | 197 | depends on HID |
197 | ---help--- | 198 | ---help--- |
198 | Say Y here if you have DragonRise Inc. game controllers. | 199 | Say Y here if you have DragonRise Inc. game controllers. |
199 | These might be branded as: | 200 | These might be branded as: |
200 | - Tesun USB-703 | 201 | - Tesun USB-703 |
201 | - Media-tech MT1504 "Rogue" | 202 | - Media-tech MT1504 "Rogue" |
202 | - DVTech JS19 "Gear" | 203 | - DVTech JS19 "Gear" |
203 | - Defender Game Master | 204 | - Defender Game Master |
204 | 205 | ||
205 | config DRAGONRISE_FF | 206 | config DRAGONRISE_FF |
206 | bool "DragonRise Inc. force feedback" | 207 | bool "DragonRise Inc. force feedback" |
207 | depends on HID_DRAGONRISE | 208 | depends on HID_DRAGONRISE |
208 | select INPUT_FF_MEMLESS | 209 | select INPUT_FF_MEMLESS |
209 | ---help--- | 210 | ---help--- |
210 | Say Y here if you want to enable force feedback support for DragonRise Inc. | 211 | Say Y here if you want to enable force feedback support for DragonRise Inc. |
211 | game controllers. | 212 | game controllers. |
212 | 213 | ||
213 | config HID_EMS_FF | 214 | config HID_EMS_FF |
214 | tristate "EMS Production Inc. force feedback support" | 215 | tristate "EMS Production Inc. force feedback support" |
215 | depends on HID | 216 | depends on HID |
216 | select INPUT_FF_MEMLESS | 217 | select INPUT_FF_MEMLESS |
217 | ---help--- | 218 | ---help--- |
218 | Say Y here if you want to enable force feedback support for devices by | 219 | Say Y here if you want to enable force feedback support for devices by |
219 | EMS Production Ltd. | 220 | EMS Production Ltd. |
220 | Currently the following devices are known to be supported: | 221 | Currently the following devices are known to be supported: |
221 | - Trio Linker Plus II | 222 | - Trio Linker Plus II |
222 | 223 | ||
223 | config HID_ELECOM | 224 | config HID_ELECOM |
224 | tristate "ELECOM BM084 bluetooth mouse" | 225 | tristate "ELECOM BM084 bluetooth mouse" |
225 | depends on HID | 226 | depends on HID |
226 | ---help--- | 227 | ---help--- |
227 | Support for the ELECOM BM084 (bluetooth mouse). | 228 | Support for the ELECOM BM084 (bluetooth mouse). |
228 | 229 | ||
229 | config HID_ELO | 230 | config HID_ELO |
230 | tristate "ELO USB 4000/4500 touchscreen" | 231 | tristate "ELO USB 4000/4500 touchscreen" |
231 | depends on USB_HID | 232 | depends on USB_HID |
232 | ---help--- | 233 | ---help--- |
233 | Support for the ELO USB 4000/4500 touchscreens. Note that this is for | 234 | Support for the ELO USB 4000/4500 touchscreens. Note that this is for |
234 | different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. | 235 | different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. |
235 | 236 | ||
236 | config HID_EZKEY | 237 | config HID_EZKEY |
237 | tristate "Ezkey BTC 8193 keyboard" if EXPERT | 238 | tristate "Ezkey BTC 8193 keyboard" if EXPERT |
238 | depends on HID | 239 | depends on HID |
239 | default !EXPERT | 240 | default !EXPERT |
240 | ---help--- | 241 | ---help--- |
241 | Support for Ezkey BTC 8193 keyboard. | 242 | Support for Ezkey BTC 8193 keyboard. |
242 | 243 | ||
243 | config HID_HOLTEK | 244 | config HID_HOLTEK |
244 | tristate "Holtek HID devices" | 245 | tristate "Holtek HID devices" |
245 | depends on USB_HID | 246 | depends on USB_HID |
246 | ---help--- | 247 | ---help--- |
247 | Support for Holtek based devices: | 248 | Support for Holtek based devices: |
248 | - Holtek On Line Grip based game controller | 249 | - Holtek On Line Grip based game controller |
249 | - Trust GXT 18 Gaming Keyboard | 250 | - Trust GXT 18 Gaming Keyboard |
250 | - Sharkoon Drakonia / Perixx MX-2000 gaming mice | 251 | - Sharkoon Drakonia / Perixx MX-2000 gaming mice |
251 | - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 / | 252 | - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 / |
252 | Zalman ZM-GM1 | 253 | Zalman ZM-GM1 |
253 | - SHARKOON DarkGlider Gaming mouse | 254 | - SHARKOON DarkGlider Gaming mouse |
254 | - LEETGION Hellion Gaming Mouse | 255 | - LEETGION Hellion Gaming Mouse |
255 | 256 | ||
256 | config HOLTEK_FF | 257 | config HOLTEK_FF |
257 | bool "Holtek On Line Grip force feedback support" | 258 | bool "Holtek On Line Grip force feedback support" |
258 | depends on HID_HOLTEK | 259 | depends on HID_HOLTEK |
259 | select INPUT_FF_MEMLESS | 260 | select INPUT_FF_MEMLESS |
260 | ---help--- | 261 | ---help--- |
261 | Say Y here if you have a Holtek On Line Grip based game controller | 262 | Say Y here if you have a Holtek On Line Grip based game controller |
262 | and want to have force feedback support for it. | 263 | and want to have force feedback support for it. |
263 | 264 | ||
264 | config HID_GT683R | 265 | config HID_GT683R |
265 | tristate "MSI GT68xR LED support" | 266 | tristate "MSI GT68xR LED support" |
266 | depends on LEDS_CLASS && USB_HID | 267 | depends on LEDS_CLASS && USB_HID |
267 | ---help--- | 268 | ---help--- |
268 | Say Y here if you want to enable support for the three MSI GT68xR LEDs | 269 | Say Y here if you want to enable support for the three MSI GT68xR LEDs |
269 | 270 | ||
270 | This driver support following modes: | 271 | This driver support following modes: |
271 | - Normal: LEDs are fully on when enabled | 272 | - Normal: LEDs are fully on when enabled |
272 | - Audio: LEDs brightness depends on sound level | 273 | - Audio: LEDs brightness depends on sound level |
273 | - Breathing: LEDs brightness varies at human breathing rate | 274 | - Breathing: LEDs brightness varies at human breathing rate |
274 | 275 | ||
275 | Currently the following devices are know to be supported: | 276 | Currently the following devices are know to be supported: |
276 | - MSI GT683R | 277 | - MSI GT683R |
277 | 278 | ||
278 | config HID_HUION | 279 | config HID_HUION |
279 | tristate "Huion tablets" | 280 | tristate "Huion tablets" |
280 | depends on USB_HID | 281 | depends on USB_HID |
281 | ---help--- | 282 | ---help--- |
282 | Support for Huion 580 tablet. | 283 | Support for Huion 580 tablet. |
283 | 284 | ||
284 | config HID_KEYTOUCH | 285 | config HID_KEYTOUCH |
285 | tristate "Keytouch HID devices" | 286 | tristate "Keytouch HID devices" |
286 | depends on HID | 287 | depends on HID |
287 | ---help--- | 288 | ---help--- |
288 | Support for Keytouch HID devices not fully compliant with | 289 | Support for Keytouch HID devices not fully compliant with |
289 | the specification. Currently supported: | 290 | the specification. Currently supported: |
290 | - Keytouch IEC 60945 | 291 | - Keytouch IEC 60945 |
291 | 292 | ||
292 | config HID_KYE | 293 | config HID_KYE |
293 | tristate "KYE/Genius devices" | 294 | tristate "KYE/Genius devices" |
294 | depends on HID | 295 | depends on HID |
295 | ---help--- | 296 | ---help--- |
296 | Support for KYE/Genius devices not fully compliant with HID standard: | 297 | Support for KYE/Genius devices not fully compliant with HID standard: |
297 | - Ergo Mouse | 298 | - Ergo Mouse |
298 | - EasyPen i405X tablet | 299 | - EasyPen i405X tablet |
299 | - MousePen i608X tablet | 300 | - MousePen i608X tablet |
300 | - EasyPen M610X tablet | 301 | - EasyPen M610X tablet |
301 | 302 | ||
302 | config HID_UCLOGIC | 303 | config HID_UCLOGIC |
303 | tristate "UC-Logic" | 304 | tristate "UC-Logic" |
304 | depends on HID | 305 | depends on HID |
305 | ---help--- | 306 | ---help--- |
306 | Support for UC-Logic tablets. | 307 | Support for UC-Logic tablets. |
307 | 308 | ||
308 | config HID_WALTOP | 309 | config HID_WALTOP |
309 | tristate "Waltop" | 310 | tristate "Waltop" |
310 | depends on HID | 311 | depends on HID |
311 | ---help--- | 312 | ---help--- |
312 | Support for Waltop tablets. | 313 | Support for Waltop tablets. |
313 | 314 | ||
314 | config HID_GYRATION | 315 | config HID_GYRATION |
315 | tristate "Gyration remote control" | 316 | tristate "Gyration remote control" |
316 | depends on HID | 317 | depends on HID |
317 | ---help--- | 318 | ---help--- |
318 | Support for Gyration remote control. | 319 | Support for Gyration remote control. |
319 | 320 | ||
320 | config HID_ICADE | 321 | config HID_ICADE |
321 | tristate "ION iCade arcade controller" | 322 | tristate "ION iCade arcade controller" |
322 | depends on HID | 323 | depends on HID |
323 | ---help--- | 324 | ---help--- |
324 | Support for the ION iCade arcade controller to work as a joystick. | 325 | Support for the ION iCade arcade controller to work as a joystick. |
325 | 326 | ||
326 | To compile this driver as a module, choose M here: the | 327 | To compile this driver as a module, choose M here: the |
327 | module will be called hid-icade. | 328 | module will be called hid-icade. |
328 | 329 | ||
329 | config HID_TWINHAN | 330 | config HID_TWINHAN |
330 | tristate "Twinhan IR remote control" | 331 | tristate "Twinhan IR remote control" |
331 | depends on HID | 332 | depends on HID |
332 | ---help--- | 333 | ---help--- |
333 | Support for Twinhan IR remote control. | 334 | Support for Twinhan IR remote control. |
334 | 335 | ||
335 | config HID_KENSINGTON | 336 | config HID_KENSINGTON |
336 | tristate "Kensington Slimblade Trackball" if EXPERT | 337 | tristate "Kensington Slimblade Trackball" if EXPERT |
337 | depends on HID | 338 | depends on HID |
338 | default !EXPERT | 339 | default !EXPERT |
339 | ---help--- | 340 | ---help--- |
340 | Support for Kensington Slimblade Trackball. | 341 | Support for Kensington Slimblade Trackball. |
341 | 342 | ||
342 | config HID_LCPOWER | 343 | config HID_LCPOWER |
343 | tristate "LC-Power" | 344 | tristate "LC-Power" |
344 | depends on HID | 345 | depends on HID |
345 | ---help--- | 346 | ---help--- |
346 | Support for LC-Power RC1000MCE RF remote control. | 347 | Support for LC-Power RC1000MCE RF remote control. |
347 | 348 | ||
348 | config HID_LENOVO | 349 | config HID_LENOVO |
349 | tristate "Lenovo / Thinkpad devices" | 350 | tristate "Lenovo / Thinkpad devices" |
350 | depends on HID | 351 | depends on HID |
351 | select NEW_LEDS | 352 | select NEW_LEDS |
352 | select LEDS_CLASS | 353 | select LEDS_CLASS |
353 | ---help--- | 354 | ---help--- |
354 | Support for Lenovo devices that are not fully compliant with HID standard. | 355 | Support for Lenovo devices that are not fully compliant with HID standard. |
355 | 356 | ||
356 | Say Y if you want support for the non-compliant features of the Lenovo | 357 | Say Y if you want support for the non-compliant features of the Lenovo |
357 | Thinkpad standalone keyboards, e.g: | 358 | Thinkpad standalone keyboards, e.g: |
358 | - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint | 359 | - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint |
359 | configuration) | 360 | configuration) |
360 | - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) | 361 | - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) |
361 | - ThinkPad Compact USB Keyboard with TrackPoint (supports Fn keys) | 362 | - ThinkPad Compact USB Keyboard with TrackPoint (supports Fn keys) |
362 | 363 | ||
363 | config HID_LOGITECH | 364 | config HID_LOGITECH |
364 | tristate "Logitech devices" if EXPERT | 365 | tristate "Logitech devices" if EXPERT |
365 | depends on HID | 366 | depends on HID |
366 | default !EXPERT | 367 | default !EXPERT |
367 | ---help--- | 368 | ---help--- |
368 | Support for Logitech devices that are not fully compliant with HID standard. | 369 | Support for Logitech devices that are not fully compliant with HID standard. |
369 | 370 | ||
370 | config HID_LOGITECH_DJ | 371 | config HID_LOGITECH_DJ |
371 | tristate "Logitech Unifying receivers full support" | 372 | tristate "Logitech Unifying receivers full support" |
372 | depends on HIDRAW | 373 | depends on HIDRAW |
373 | depends on HID_LOGITECH | 374 | depends on HID_LOGITECH |
374 | select HID_LOGITECH_HIDPP | 375 | select HID_LOGITECH_HIDPP |
375 | ---help--- | 376 | ---help--- |
376 | Say Y if you want support for Logitech Unifying receivers and devices. | 377 | Say Y if you want support for Logitech Unifying receivers and devices. |
377 | Unifying receivers are capable of pairing up to 6 Logitech compliant | 378 | Unifying receivers are capable of pairing up to 6 Logitech compliant |
378 | devices to the same receiver. Without this driver it will be handled by | 379 | devices to the same receiver. Without this driver it will be handled by |
379 | generic USB_HID driver and all incoming events will be multiplexed | 380 | generic USB_HID driver and all incoming events will be multiplexed |
380 | into a single mouse and a single keyboard device. | 381 | into a single mouse and a single keyboard device. |
381 | 382 | ||
382 | config HID_LOGITECH_HIDPP | 383 | config HID_LOGITECH_HIDPP |
383 | tristate "Logitech HID++ devices support" | 384 | tristate "Logitech HID++ devices support" |
384 | depends on HID_LOGITECH | 385 | depends on HID_LOGITECH |
385 | ---help--- | 386 | ---help--- |
386 | Support for Logitech devices relyingon the HID++ Logitech specification | 387 | Support for Logitech devices relyingon the HID++ Logitech specification |
387 | 388 | ||
388 | Say Y if you want support for Logitech devices relying on the HID++ | 389 | Say Y if you want support for Logitech devices relying on the HID++ |
389 | specification. Such devices are the various Logitech Touchpads (T650, | 390 | specification. Such devices are the various Logitech Touchpads (T650, |
390 | T651, TK820), some mice (Zone Touch mouse), or even keyboards (Solar | 391 | T651, TK820), some mice (Zone Touch mouse), or even keyboards (Solar |
391 | Keayboard). | 392 | Keayboard). |
392 | 393 | ||
393 | config LOGITECH_FF | 394 | config LOGITECH_FF |
394 | bool "Logitech force feedback support" | 395 | bool "Logitech force feedback support" |
395 | depends on HID_LOGITECH | 396 | depends on HID_LOGITECH |
396 | select INPUT_FF_MEMLESS | 397 | select INPUT_FF_MEMLESS |
397 | help | 398 | help |
398 | Say Y here if you have one of these devices: | 399 | Say Y here if you have one of these devices: |
399 | - Logitech WingMan Cordless RumblePad | 400 | - Logitech WingMan Cordless RumblePad |
400 | - Logitech WingMan Cordless RumblePad 2 | 401 | - Logitech WingMan Cordless RumblePad 2 |
401 | - Logitech WingMan Force 3D | 402 | - Logitech WingMan Force 3D |
402 | - Logitech Formula Force EX | 403 | - Logitech Formula Force EX |
403 | - Logitech WingMan Formula Force GP | 404 | - Logitech WingMan Formula Force GP |
404 | 405 | ||
405 | and if you want to enable force feedback for them. | 406 | and if you want to enable force feedback for them. |
406 | Note: if you say N here, this device will still be supported, but without | 407 | Note: if you say N here, this device will still be supported, but without |
407 | force feedback. | 408 | force feedback. |
408 | 409 | ||
409 | config LOGIRUMBLEPAD2_FF | 410 | config LOGIRUMBLEPAD2_FF |
410 | bool "Logitech force feedback support (variant 2)" | 411 | bool "Logitech force feedback support (variant 2)" |
411 | depends on HID_LOGITECH | 412 | depends on HID_LOGITECH |
412 | select INPUT_FF_MEMLESS | 413 | select INPUT_FF_MEMLESS |
413 | help | 414 | help |
414 | Say Y here if you want to enable force feedback support for: | 415 | Say Y here if you want to enable force feedback support for: |
415 | - Logitech RumblePad | 416 | - Logitech RumblePad |
416 | - Logitech Rumblepad 2 | 417 | - Logitech Rumblepad 2 |
417 | - Logitech Formula Vibration Feedback Wheel | 418 | - Logitech Formula Vibration Feedback Wheel |
418 | 419 | ||
419 | config LOGIG940_FF | 420 | config LOGIG940_FF |
420 | bool "Logitech Flight System G940 force feedback support" | 421 | bool "Logitech Flight System G940 force feedback support" |
421 | depends on HID_LOGITECH | 422 | depends on HID_LOGITECH |
422 | select INPUT_FF_MEMLESS | 423 | select INPUT_FF_MEMLESS |
423 | help | 424 | help |
424 | Say Y here if you want to enable force feedback support for Logitech | 425 | Say Y here if you want to enable force feedback support for Logitech |
425 | Flight System G940 devices. | 426 | Flight System G940 devices. |
426 | 427 | ||
427 | config LOGIWHEELS_FF | 428 | config LOGIWHEELS_FF |
428 | bool "Logitech wheels configuration and force feedback support" | 429 | bool "Logitech wheels configuration and force feedback support" |
429 | depends on HID_LOGITECH | 430 | depends on HID_LOGITECH |
430 | select INPUT_FF_MEMLESS | 431 | select INPUT_FF_MEMLESS |
431 | default LOGITECH_FF | 432 | default LOGITECH_FF |
432 | help | 433 | help |
433 | Say Y here if you want to enable force feedback and range setting | 434 | Say Y here if you want to enable force feedback and range setting |
434 | support for following Logitech wheels: | 435 | support for following Logitech wheels: |
435 | - Logitech Driving Force | 436 | - Logitech Driving Force |
436 | - Logitech Driving Force Pro | 437 | - Logitech Driving Force Pro |
437 | - Logitech Driving Force GT | 438 | - Logitech Driving Force GT |
438 | - Logitech G25 | 439 | - Logitech G25 |
439 | - Logitech G27 | 440 | - Logitech G27 |
440 | - Logitech MOMO/MOMO 2 | 441 | - Logitech MOMO/MOMO 2 |
441 | - Logitech Formula Force EX | 442 | - Logitech Formula Force EX |
442 | 443 | ||
443 | config HID_MAGICMOUSE | 444 | config HID_MAGICMOUSE |
444 | tristate "Apple Magic Mouse/Trackpad multi-touch support" | 445 | tristate "Apple Magic Mouse/Trackpad multi-touch support" |
445 | depends on HID | 446 | depends on HID |
446 | ---help--- | 447 | ---help--- |
447 | Support for the Apple Magic Mouse/Trackpad multi-touch. | 448 | Support for the Apple Magic Mouse/Trackpad multi-touch. |
448 | 449 | ||
449 | Say Y here if you want support for the multi-touch features of the | 450 | Say Y here if you want support for the multi-touch features of the |
450 | Apple Wireless "Magic" Mouse and the Apple Wireless "Magic" Trackpad. | 451 | Apple Wireless "Magic" Mouse and the Apple Wireless "Magic" Trackpad. |
451 | 452 | ||
452 | config HID_MICROSOFT | 453 | config HID_MICROSOFT |
453 | tristate "Microsoft non-fully HID-compliant devices" if EXPERT | 454 | tristate "Microsoft non-fully HID-compliant devices" if EXPERT |
454 | depends on HID | 455 | depends on HID |
455 | default !EXPERT | 456 | default !EXPERT |
456 | ---help--- | 457 | ---help--- |
457 | Support for Microsoft devices that are not fully compliant with HID standard. | 458 | Support for Microsoft devices that are not fully compliant with HID standard. |
458 | 459 | ||
459 | config HID_MONTEREY | 460 | config HID_MONTEREY |
460 | tristate "Monterey Genius KB29E keyboard" if EXPERT | 461 | tristate "Monterey Genius KB29E keyboard" if EXPERT |
461 | depends on HID | 462 | depends on HID |
462 | default !EXPERT | 463 | default !EXPERT |
463 | ---help--- | 464 | ---help--- |
464 | Support for Monterey Genius KB29E. | 465 | Support for Monterey Genius KB29E. |
465 | 466 | ||
466 | config HID_MULTITOUCH | 467 | config HID_MULTITOUCH |
467 | tristate "HID Multitouch panels" | 468 | tristate "HID Multitouch panels" |
468 | depends on HID | 469 | depends on HID |
469 | ---help--- | 470 | ---help--- |
470 | Generic support for HID multitouch panels. | 471 | Generic support for HID multitouch panels. |
471 | 472 | ||
472 | Say Y here if you have one of the following devices: | 473 | Say Y here if you have one of the following devices: |
473 | - 3M PCT touch screens | 474 | - 3M PCT touch screens |
474 | - ActionStar dual touch panels | 475 | - ActionStar dual touch panels |
475 | - Atmel panels | 476 | - Atmel panels |
476 | - Cando dual touch panels | 477 | - Cando dual touch panels |
477 | - Chunghwa panels | 478 | - Chunghwa panels |
478 | - CVTouch panels | 479 | - CVTouch panels |
479 | - Cypress TrueTouch panels | 480 | - Cypress TrueTouch panels |
480 | - Elan Microelectronics touch panels | 481 | - Elan Microelectronics touch panels |
481 | - Elo TouchSystems IntelliTouch Plus panels | 482 | - Elo TouchSystems IntelliTouch Plus panels |
482 | - GeneralTouch 'Sensing Win7-TwoFinger' panels | 483 | - GeneralTouch 'Sensing Win7-TwoFinger' panels |
483 | - GoodTouch panels | 484 | - GoodTouch panels |
484 | - Hanvon dual touch panels | 485 | - Hanvon dual touch panels |
485 | - Ilitek dual touch panels | 486 | - Ilitek dual touch panels |
486 | - IrTouch Infrared USB panels | 487 | - IrTouch Infrared USB panels |
487 | - LG Display panels (Dell ST2220Tc) | 488 | - LG Display panels (Dell ST2220Tc) |
488 | - Lumio CrystalTouch panels | 489 | - Lumio CrystalTouch panels |
489 | - MosArt dual-touch panels | 490 | - MosArt dual-touch panels |
490 | - Panasonic multitouch panels | 491 | - Panasonic multitouch panels |
491 | - PenMount dual touch panels | 492 | - PenMount dual touch panels |
492 | - Perixx Peripad 701 touchpad | 493 | - Perixx Peripad 701 touchpad |
493 | - PixArt optical touch screen | 494 | - PixArt optical touch screen |
494 | - Pixcir dual touch panels | 495 | - Pixcir dual touch panels |
495 | - Quanta panels | 496 | - Quanta panels |
496 | - eGalax dual-touch panels, including the Joojoo and Wetab tablets | 497 | - eGalax dual-touch panels, including the Joojoo and Wetab tablets |
497 | - SiS multitouch panels | 498 | - SiS multitouch panels |
498 | - Stantum multitouch panels | 499 | - Stantum multitouch panels |
499 | - Touch International Panels | 500 | - Touch International Panels |
500 | - Unitec Panels | 501 | - Unitec Panels |
501 | - Wistron optical touch panels | 502 | - Wistron optical touch panels |
502 | - XAT optical touch panels | 503 | - XAT optical touch panels |
503 | - Xiroku optical touch panels | 504 | - Xiroku optical touch panels |
504 | - Zytronic touch panels | 505 | - Zytronic touch panels |
505 | 506 | ||
506 | If unsure, say N. | 507 | If unsure, say N. |
507 | 508 | ||
508 | To compile this driver as a module, choose M here: the | 509 | To compile this driver as a module, choose M here: the |
509 | module will be called hid-multitouch. | 510 | module will be called hid-multitouch. |
510 | 511 | ||
511 | config HID_NTRIG | 512 | config HID_NTRIG |
512 | tristate "N-Trig touch screen" | 513 | tristate "N-Trig touch screen" |
513 | depends on USB_HID | 514 | depends on USB_HID |
514 | ---help--- | 515 | ---help--- |
515 | Support for N-Trig touch screen. | 516 | Support for N-Trig touch screen. |
516 | 517 | ||
517 | config HID_ORTEK | 518 | config HID_ORTEK |
518 | tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad" | 519 | tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad" |
519 | depends on HID | 520 | depends on HID |
520 | ---help--- | 521 | ---help--- |
521 | There are certain devices which have LogicalMaximum wrong in the keyboard | 522 | There are certain devices which have LogicalMaximum wrong in the keyboard |
522 | usage page of their report descriptor. The most prevailing ones so far | 523 | usage page of their report descriptor. The most prevailing ones so far |
523 | are manufactured by Ortek, thus the name of the driver. Currently | 524 | are manufactured by Ortek, thus the name of the driver. Currently |
524 | supported devices by this driver are | 525 | supported devices by this driver are |
525 | 526 | ||
526 | - Ortek PKB-1700 | 527 | - Ortek PKB-1700 |
527 | - Ortek WKB-2000 | 528 | - Ortek WKB-2000 |
528 | - Skycable wireless presenter | 529 | - Skycable wireless presenter |
529 | 530 | ||
530 | config HID_PANTHERLORD | 531 | config HID_PANTHERLORD |
531 | tristate "Pantherlord/GreenAsia game controller" | 532 | tristate "Pantherlord/GreenAsia game controller" |
532 | depends on HID | 533 | depends on HID |
533 | ---help--- | 534 | ---help--- |
534 | Say Y here if you have a PantherLord/GreenAsia based game controller | 535 | Say Y here if you have a PantherLord/GreenAsia based game controller |
535 | or adapter. | 536 | or adapter. |
536 | 537 | ||
537 | config PANTHERLORD_FF | 538 | config PANTHERLORD_FF |
538 | bool "Pantherlord force feedback support" | 539 | bool "Pantherlord force feedback support" |
539 | depends on HID_PANTHERLORD | 540 | depends on HID_PANTHERLORD |
540 | select INPUT_FF_MEMLESS | 541 | select INPUT_FF_MEMLESS |
541 | ---help--- | 542 | ---help--- |
542 | Say Y here if you have a PantherLord/GreenAsia based game controller | 543 | Say Y here if you have a PantherLord/GreenAsia based game controller |
543 | or adapter and want to enable force feedback support for it. | 544 | or adapter and want to enable force feedback support for it. |
544 | 545 | ||
545 | config HID_PENMOUNT | 546 | config HID_PENMOUNT |
546 | tristate "Penmount touch device" | 547 | tristate "Penmount touch device" |
547 | depends on USB_HID | 548 | depends on USB_HID |
548 | ---help--- | 549 | ---help--- |
549 | This selects a driver for the PenMount 6000 touch controller. | 550 | This selects a driver for the PenMount 6000 touch controller. |
550 | 551 | ||
551 | The driver works around a problem in the report descript allowing | 552 | The driver works around a problem in the report descript allowing |
552 | the userspace to touch events instead of mouse events. | 553 | the userspace to touch events instead of mouse events. |
553 | 554 | ||
554 | Say Y here if you have a Penmount based touch controller. | 555 | Say Y here if you have a Penmount based touch controller. |
555 | 556 | ||
556 | config HID_PETALYNX | 557 | config HID_PETALYNX |
557 | tristate "Petalynx Maxter remote control" | 558 | tristate "Petalynx Maxter remote control" |
558 | depends on HID | 559 | depends on HID |
559 | ---help--- | 560 | ---help--- |
560 | Support for Petalynx Maxter remote control. | 561 | Support for Petalynx Maxter remote control. |
561 | 562 | ||
562 | config HID_PICOLCD | 563 | config HID_PICOLCD |
563 | tristate "PicoLCD (graphic version)" | 564 | tristate "PicoLCD (graphic version)" |
564 | depends on HID | 565 | depends on HID |
565 | ---help--- | 566 | ---help--- |
566 | This provides support for Minibox PicoLCD devices, currently | 567 | This provides support for Minibox PicoLCD devices, currently |
567 | only the graphical ones are supported. | 568 | only the graphical ones are supported. |
568 | 569 | ||
569 | This includes support for the following device features: | 570 | This includes support for the following device features: |
570 | - Keypad | 571 | - Keypad |
571 | - Switching between Firmware and Flash mode | 572 | - Switching between Firmware and Flash mode |
572 | - EEProm / Flash access (via debugfs) | 573 | - EEProm / Flash access (via debugfs) |
573 | Features selectively enabled: | 574 | Features selectively enabled: |
574 | - Framebuffer for monochrome 256x64 display | 575 | - Framebuffer for monochrome 256x64 display |
575 | - Backlight control | 576 | - Backlight control |
576 | - Contrast control | 577 | - Contrast control |
577 | - General purpose outputs | 578 | - General purpose outputs |
578 | Features that are not (yet) supported: | 579 | Features that are not (yet) supported: |
579 | - IR | 580 | - IR |
580 | 581 | ||
581 | config HID_PICOLCD_FB | 582 | config HID_PICOLCD_FB |
582 | bool "Framebuffer support" if EXPERT | 583 | bool "Framebuffer support" if EXPERT |
583 | default !EXPERT | 584 | default !EXPERT |
584 | depends on HID_PICOLCD | 585 | depends on HID_PICOLCD |
585 | depends on HID_PICOLCD=FB || FB=y | 586 | depends on HID_PICOLCD=FB || FB=y |
586 | select FB_DEFERRED_IO | 587 | select FB_DEFERRED_IO |
587 | select FB_SYS_FILLRECT | 588 | select FB_SYS_FILLRECT |
588 | select FB_SYS_COPYAREA | 589 | select FB_SYS_COPYAREA |
589 | select FB_SYS_IMAGEBLIT | 590 | select FB_SYS_IMAGEBLIT |
590 | select FB_SYS_FOPS | 591 | select FB_SYS_FOPS |
591 | ---help--- | 592 | ---help--- |
592 | Provide access to PicoLCD's 256x64 monochrome display via a | 593 | Provide access to PicoLCD's 256x64 monochrome display via a |
593 | framebuffer device. | 594 | framebuffer device. |
594 | 595 | ||
595 | config HID_PICOLCD_BACKLIGHT | 596 | config HID_PICOLCD_BACKLIGHT |
596 | bool "Backlight control" if EXPERT | 597 | bool "Backlight control" if EXPERT |
597 | default !EXPERT | 598 | default !EXPERT |
598 | depends on HID_PICOLCD | 599 | depends on HID_PICOLCD |
599 | depends on HID_PICOLCD=BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=y | 600 | depends on HID_PICOLCD=BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=y |
600 | ---help--- | 601 | ---help--- |
601 | Provide access to PicoLCD's backlight control via backlight | 602 | Provide access to PicoLCD's backlight control via backlight |
602 | class. | 603 | class. |
603 | 604 | ||
604 | config HID_PICOLCD_LCD | 605 | config HID_PICOLCD_LCD |
605 | bool "Contrast control" if EXPERT | 606 | bool "Contrast control" if EXPERT |
606 | default !EXPERT | 607 | default !EXPERT |
607 | depends on HID_PICOLCD | 608 | depends on HID_PICOLCD |
608 | depends on HID_PICOLCD=LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=y | 609 | depends on HID_PICOLCD=LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=y |
609 | ---help--- | 610 | ---help--- |
610 | Provide access to PicoLCD's LCD contrast via lcd class. | 611 | Provide access to PicoLCD's LCD contrast via lcd class. |
611 | 612 | ||
612 | config HID_PICOLCD_LEDS | 613 | config HID_PICOLCD_LEDS |
613 | bool "GPO via leds class" if EXPERT | 614 | bool "GPO via leds class" if EXPERT |
614 | default !EXPERT | 615 | default !EXPERT |
615 | depends on HID_PICOLCD | 616 | depends on HID_PICOLCD |
616 | depends on HID_PICOLCD=LEDS_CLASS || LEDS_CLASS=y | 617 | depends on HID_PICOLCD=LEDS_CLASS || LEDS_CLASS=y |
617 | ---help--- | 618 | ---help--- |
618 | Provide access to PicoLCD's GPO pins via leds class. | 619 | Provide access to PicoLCD's GPO pins via leds class. |
619 | 620 | ||
620 | config HID_PICOLCD_CIR | 621 | config HID_PICOLCD_CIR |
621 | bool "CIR via RC class" if EXPERT | 622 | bool "CIR via RC class" if EXPERT |
622 | default !EXPERT | 623 | default !EXPERT |
623 | depends on HID_PICOLCD | 624 | depends on HID_PICOLCD |
624 | depends on HID_PICOLCD=RC_CORE || RC_CORE=y | 625 | depends on HID_PICOLCD=RC_CORE || RC_CORE=y |
625 | ---help--- | 626 | ---help--- |
626 | Provide access to PicoLCD's CIR interface via remote control (LIRC). | 627 | Provide access to PicoLCD's CIR interface via remote control (LIRC). |
627 | 628 | ||
628 | config HID_PLANTRONICS | 629 | config HID_PLANTRONICS |
629 | tristate "Plantronics USB HID Driver" | 630 | tristate "Plantronics USB HID Driver" |
630 | default !EXPERT | 631 | default !EXPERT |
631 | depends on HID | 632 | depends on HID |
632 | ---help--- | 633 | ---help--- |
633 | Provides HID support for Plantronics telephony devices. | 634 | Provides HID support for Plantronics telephony devices. |
634 | 635 | ||
635 | config HID_PRIMAX | 636 | config HID_PRIMAX |
636 | tristate "Primax non-fully HID-compliant devices" | 637 | tristate "Primax non-fully HID-compliant devices" |
637 | depends on HID | 638 | depends on HID |
638 | ---help--- | 639 | ---help--- |
639 | Support for Primax devices that are not fully compliant with the | 640 | Support for Primax devices that are not fully compliant with the |
640 | HID standard. | 641 | HID standard. |
641 | 642 | ||
642 | config HID_ROCCAT | 643 | config HID_ROCCAT |
643 | tristate "Roccat device support" | 644 | tristate "Roccat device support" |
644 | depends on USB_HID | 645 | depends on USB_HID |
645 | ---help--- | 646 | ---help--- |
646 | Support for Roccat devices. | 647 | Support for Roccat devices. |
647 | Say Y here if you have a Roccat mouse or keyboard and want | 648 | Say Y here if you have a Roccat mouse or keyboard and want |
648 | support for its special functionalities. | 649 | support for its special functionalities. |
649 | 650 | ||
650 | config HID_SAITEK | 651 | config HID_SAITEK |
651 | tristate "Saitek (Mad Catz) non-fully HID-compliant devices" | 652 | tristate "Saitek (Mad Catz) non-fully HID-compliant devices" |
652 | depends on HID | 653 | depends on HID |
653 | ---help--- | 654 | ---help--- |
654 | Support for Saitek devices that are not fully compliant with the | 655 | Support for Saitek devices that are not fully compliant with the |
655 | HID standard. | 656 | HID standard. |
656 | 657 | ||
657 | Supported devices: | 658 | Supported devices: |
658 | - PS1000 Dual Analog Pad | 659 | - PS1000 Dual Analog Pad |
659 | - R.A.T.9 Gaming Mouse | 660 | - R.A.T.9 Gaming Mouse |
660 | - R.A.T.7 Gaming Mouse | 661 | - R.A.T.7 Gaming Mouse |
661 | - M.M.O.7 Gaming Mouse | 662 | - M.M.O.7 Gaming Mouse |
662 | 663 | ||
663 | config HID_SAMSUNG | 664 | config HID_SAMSUNG |
664 | tristate "Samsung InfraRed remote control or keyboards" | 665 | tristate "Samsung InfraRed remote control or keyboards" |
665 | depends on HID | 666 | depends on HID |
666 | ---help--- | 667 | ---help--- |
667 | Support for Samsung InfraRed remote control or keyboards. | 668 | Support for Samsung InfraRed remote control or keyboards. |
668 | 669 | ||
669 | config HID_SONY | 670 | config HID_SONY |
670 | tristate "Sony PS2/3/4 accessories" | 671 | tristate "Sony PS2/3/4 accessories" |
671 | depends on USB_HID | 672 | depends on USB_HID |
672 | depends on NEW_LEDS | 673 | depends on NEW_LEDS |
673 | depends on LEDS_CLASS | 674 | depends on LEDS_CLASS |
674 | select POWER_SUPPLY | 675 | select POWER_SUPPLY |
675 | ---help--- | 676 | ---help--- |
676 | Support for | 677 | Support for |
677 | 678 | ||
678 | * Sony PS3 6-axis controllers | 679 | * Sony PS3 6-axis controllers |
679 | * Sony PS4 DualShock 4 controllers | 680 | * Sony PS4 DualShock 4 controllers |
680 | * Buzz controllers | 681 | * Buzz controllers |
681 | * Sony PS3 Blue-ray Disk Remote Control (Bluetooth) | 682 | * Sony PS3 Blue-ray Disk Remote Control (Bluetooth) |
682 | * Logitech Harmony adapter for Sony Playstation 3 (Bluetooth) | 683 | * Logitech Harmony adapter for Sony Playstation 3 (Bluetooth) |
683 | 684 | ||
684 | config SONY_FF | 685 | config SONY_FF |
685 | bool "Sony PS2/3/4 accessories force feedback support" | 686 | bool "Sony PS2/3/4 accessories force feedback support" |
686 | depends on HID_SONY | 687 | depends on HID_SONY |
687 | select INPUT_FF_MEMLESS | 688 | select INPUT_FF_MEMLESS |
688 | ---help--- | 689 | ---help--- |
689 | Say Y here if you have a Sony PS2/3/4 accessory and want to enable | 690 | Say Y here if you have a Sony PS2/3/4 accessory and want to enable |
690 | force feedback support for it. | 691 | force feedback support for it. |
691 | 692 | ||
692 | config HID_SPEEDLINK | 693 | config HID_SPEEDLINK |
693 | tristate "Speedlink VAD Cezanne mouse support" | 694 | tristate "Speedlink VAD Cezanne mouse support" |
694 | depends on HID | 695 | depends on HID |
695 | ---help--- | 696 | ---help--- |
696 | Support for Speedlink Vicious and Divine Cezanne mouse. | 697 | Support for Speedlink Vicious and Divine Cezanne mouse. |
697 | 698 | ||
698 | config HID_STEELSERIES | 699 | config HID_STEELSERIES |
699 | tristate "Steelseries SRW-S1 steering wheel support" | 700 | tristate "Steelseries SRW-S1 steering wheel support" |
700 | depends on HID | 701 | depends on HID |
701 | ---help--- | 702 | ---help--- |
702 | Support for Steelseries SRW-S1 steering wheel | 703 | Support for Steelseries SRW-S1 steering wheel |
703 | 704 | ||
704 | config HID_SUNPLUS | 705 | config HID_SUNPLUS |
705 | tristate "Sunplus wireless desktop" | 706 | tristate "Sunplus wireless desktop" |
706 | depends on HID | 707 | depends on HID |
707 | ---help--- | 708 | ---help--- |
708 | Support for Sunplus wireless desktop. | 709 | Support for Sunplus wireless desktop. |
709 | 710 | ||
710 | config HID_RMI | 711 | config HID_RMI |
711 | tristate "Synaptics RMI4 device support" | 712 | tristate "Synaptics RMI4 device support" |
712 | depends on HID | 713 | depends on HID |
713 | ---help--- | 714 | ---help--- |
714 | Support for Synaptics RMI4 touchpads. | 715 | Support for Synaptics RMI4 touchpads. |
715 | Say Y here if you have a Synaptics RMI4 touchpads over i2c-hid or usbhid | 716 | Say Y here if you have a Synaptics RMI4 touchpads over i2c-hid or usbhid |
716 | and want support for its special functionalities. | 717 | and want support for its special functionalities. |
717 | 718 | ||
718 | config HID_GREENASIA | 719 | config HID_GREENASIA |
719 | tristate "GreenAsia (Product ID 0x12) game controller support" | 720 | tristate "GreenAsia (Product ID 0x12) game controller support" |
720 | depends on HID | 721 | depends on HID |
721 | ---help--- | 722 | ---help--- |
722 | Say Y here if you have a GreenAsia (Product ID 0x12) based game | 723 | Say Y here if you have a GreenAsia (Product ID 0x12) based game |
723 | controller or adapter. | 724 | controller or adapter. |
724 | 725 | ||
725 | config GREENASIA_FF | 726 | config GREENASIA_FF |
726 | bool "GreenAsia (Product ID 0x12) force feedback support" | 727 | bool "GreenAsia (Product ID 0x12) force feedback support" |
727 | depends on HID_GREENASIA | 728 | depends on HID_GREENASIA |
728 | select INPUT_FF_MEMLESS | 729 | select INPUT_FF_MEMLESS |
729 | ---help--- | 730 | ---help--- |
730 | Say Y here if you have a GreenAsia (Product ID 0x12) based game controller | 731 | Say Y here if you have a GreenAsia (Product ID 0x12) based game controller |
731 | (like MANTA Warrior MM816 and SpeedLink Strike2 SL-6635) or adapter | 732 | (like MANTA Warrior MM816 and SpeedLink Strike2 SL-6635) or adapter |
732 | and want to enable force feedback support for it. | 733 | and want to enable force feedback support for it. |
733 | 734 | ||
734 | config HID_HYPERV_MOUSE | 735 | config HID_HYPERV_MOUSE |
735 | tristate "Microsoft Hyper-V mouse driver" | 736 | tristate "Microsoft Hyper-V mouse driver" |
736 | depends on HYPERV | 737 | depends on HYPERV |
737 | ---help--- | 738 | ---help--- |
738 | Select this option to enable the Hyper-V mouse driver. | 739 | Select this option to enable the Hyper-V mouse driver. |
739 | 740 | ||
740 | config HID_SMARTJOYPLUS | 741 | config HID_SMARTJOYPLUS |
741 | tristate "SmartJoy PLUS PS2/USB adapter support" | 742 | tristate "SmartJoy PLUS PS2/USB adapter support" |
742 | depends on HID | 743 | depends on HID |
743 | ---help--- | 744 | ---help--- |
744 | Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box, | 745 | Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box, |
745 | Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro. | 746 | Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro. |
746 | 747 | ||
747 | Note that DDR (Dance Dance Revolution) mode is not supported, nor | 748 | Note that DDR (Dance Dance Revolution) mode is not supported, nor |
748 | is pressure sensitive buttons on the pro models. | 749 | is pressure sensitive buttons on the pro models. |
749 | 750 | ||
750 | config SMARTJOYPLUS_FF | 751 | config SMARTJOYPLUS_FF |
751 | bool "SmartJoy PLUS PS2/USB adapter force feedback support" | 752 | bool "SmartJoy PLUS PS2/USB adapter force feedback support" |
752 | depends on HID_SMARTJOYPLUS | 753 | depends on HID_SMARTJOYPLUS |
753 | select INPUT_FF_MEMLESS | 754 | select INPUT_FF_MEMLESS |
754 | ---help--- | 755 | ---help--- |
755 | Say Y here if you have a SmartJoy PLUS PS2/USB adapter and want to | 756 | Say Y here if you have a SmartJoy PLUS PS2/USB adapter and want to |
756 | enable force feedback support for it. | 757 | enable force feedback support for it. |
757 | 758 | ||
758 | config HID_TIVO | 759 | config HID_TIVO |
759 | tristate "TiVo Slide Bluetooth remote control support" | 760 | tristate "TiVo Slide Bluetooth remote control support" |
760 | depends on HID | 761 | depends on HID |
761 | ---help--- | 762 | ---help--- |
762 | Say Y if you have a TiVo Slide Bluetooth remote control. | 763 | Say Y if you have a TiVo Slide Bluetooth remote control. |
763 | 764 | ||
764 | config HID_TOPSEED | 765 | config HID_TOPSEED |
765 | tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support" | 766 | tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support" |
766 | depends on HID | 767 | depends on HID |
767 | ---help--- | 768 | ---help--- |
768 | Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic | 769 | Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic |
769 | CLLRCMCE remote control. | 770 | CLLRCMCE remote control. |
770 | 771 | ||
771 | config HID_THINGM | 772 | config HID_THINGM |
772 | tristate "ThingM blink(1) USB RGB LED" | 773 | tristate "ThingM blink(1) USB RGB LED" |
773 | depends on HID | 774 | depends on HID |
774 | depends on LEDS_CLASS | 775 | depends on LEDS_CLASS |
775 | ---help--- | 776 | ---help--- |
776 | Support for the ThingM blink(1) USB RGB LED. This driver registers a | 777 | Support for the ThingM blink(1) USB RGB LED. This driver registers a |
777 | Linux LED class instance, plus additional sysfs attributes to control | 778 | Linux LED class instance, plus additional sysfs attributes to control |
778 | RGB colors, fade time and playing. The device is exposed through hidraw | 779 | RGB colors, fade time and playing. The device is exposed through hidraw |
779 | to access other functions. | 780 | to access other functions. |
780 | 781 | ||
781 | config HID_THRUSTMASTER | 782 | config HID_THRUSTMASTER |
782 | tristate "ThrustMaster devices support" | 783 | tristate "ThrustMaster devices support" |
783 | depends on HID | 784 | depends on HID |
784 | ---help--- | 785 | ---help--- |
785 | Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or | 786 | Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or |
786 | a THRUSTMASTER Ferrari GT Rumble Wheel. | 787 | a THRUSTMASTER Ferrari GT Rumble Wheel. |
787 | 788 | ||
788 | config THRUSTMASTER_FF | 789 | config THRUSTMASTER_FF |
789 | bool "ThrustMaster devices force feedback support" | 790 | bool "ThrustMaster devices force feedback support" |
790 | depends on HID_THRUSTMASTER | 791 | depends on HID_THRUSTMASTER |
791 | select INPUT_FF_MEMLESS | 792 | select INPUT_FF_MEMLESS |
792 | ---help--- | 793 | ---help--- |
793 | Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or 3, | 794 | Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or 3, |
794 | a THRUSTMASTER Dual Trigger 3-in-1 or a THRUSTMASTER Ferrari GT | 795 | a THRUSTMASTER Dual Trigger 3-in-1 or a THRUSTMASTER Ferrari GT |
795 | Rumble Force or Force Feedback Wheel. | 796 | Rumble Force or Force Feedback Wheel. |
796 | 797 | ||
797 | config HID_WACOM | 798 | config HID_WACOM |
798 | tristate "Wacom Intuos/Graphire tablet support (USB)" | 799 | tristate "Wacom Intuos/Graphire tablet support (USB)" |
799 | depends on HID | 800 | depends on HID |
800 | select POWER_SUPPLY | 801 | select POWER_SUPPLY |
801 | select NEW_LEDS | 802 | select NEW_LEDS |
802 | select LEDS_CLASS | 803 | select LEDS_CLASS |
803 | help | 804 | help |
804 | Say Y here if you want to use the USB or BT version of the Wacom Intuos | 805 | Say Y here if you want to use the USB or BT version of the Wacom Intuos |
805 | or Graphire tablet. | 806 | or Graphire tablet. |
806 | 807 | ||
807 | To compile this driver as a module, choose M here: the | 808 | To compile this driver as a module, choose M here: the |
808 | module will be called wacom. | 809 | module will be called wacom. |
809 | 810 | ||
810 | config HID_WIIMOTE | 811 | config HID_WIIMOTE |
811 | tristate "Nintendo Wii / Wii U peripherals" | 812 | tristate "Nintendo Wii / Wii U peripherals" |
812 | depends on HID | 813 | depends on HID |
813 | depends on LEDS_CLASS | 814 | depends on LEDS_CLASS |
814 | select POWER_SUPPLY | 815 | select POWER_SUPPLY |
815 | select INPUT_FF_MEMLESS | 816 | select INPUT_FF_MEMLESS |
816 | ---help--- | 817 | ---help--- |
817 | Support for Nintendo Wii and Wii U Bluetooth peripherals. Supported | 818 | Support for Nintendo Wii and Wii U Bluetooth peripherals. Supported |
818 | devices are the Wii Remote and its extension devices, but also devices | 819 | devices are the Wii Remote and its extension devices, but also devices |
819 | based on the Wii Remote like the Wii U Pro Controller or the | 820 | based on the Wii Remote like the Wii U Pro Controller or the |
820 | Wii Balance Board. | 821 | Wii Balance Board. |
821 | 822 | ||
822 | Support for all official Nintendo extensions is available, however, 3rd | 823 | Support for all official Nintendo extensions is available, however, 3rd |
823 | party extensions might not be supported. Please report these devices to: | 824 | party extensions might not be supported. Please report these devices to: |
824 | http://github.com/dvdhrm/xwiimote/issues | 825 | http://github.com/dvdhrm/xwiimote/issues |
825 | 826 | ||
826 | Other Nintendo Wii U peripherals that are IEEE 802.11 based (including | 827 | Other Nintendo Wii U peripherals that are IEEE 802.11 based (including |
827 | the Wii U Gamepad) might be supported in the future. But currently | 828 | the Wii U Gamepad) might be supported in the future. But currently |
828 | support is limited to Bluetooth based devices. | 829 | support is limited to Bluetooth based devices. |
829 | 830 | ||
830 | If unsure, say N. | 831 | If unsure, say N. |
831 | 832 | ||
832 | To compile this driver as a module, choose M here: the | 833 | To compile this driver as a module, choose M here: the |
833 | module will be called hid-wiimote. | 834 | module will be called hid-wiimote. |
834 | 835 | ||
835 | config HID_XINMO | 836 | config HID_XINMO |
836 | tristate "Xin-Mo non-fully compliant devices" | 837 | tristate "Xin-Mo non-fully compliant devices" |
837 | depends on HID | 838 | depends on HID |
838 | ---help--- | 839 | ---help--- |
839 | Support for Xin-Mo devices that are not fully compliant with the HID | 840 | Support for Xin-Mo devices that are not fully compliant with the HID |
840 | standard. Currently only supports the Xin-Mo Dual Arcade. Say Y here | 841 | standard. Currently only supports the Xin-Mo Dual Arcade. Say Y here |
841 | if you have a Xin-Mo Dual Arcade controller. | 842 | if you have a Xin-Mo Dual Arcade controller. |
842 | 843 | ||
843 | config HID_ZEROPLUS | 844 | config HID_ZEROPLUS |
844 | tristate "Zeroplus based game controller support" | 845 | tristate "Zeroplus based game controller support" |
845 | depends on HID | 846 | depends on HID |
846 | ---help--- | 847 | ---help--- |
847 | Say Y here if you have a Zeroplus based game controller. | 848 | Say Y here if you have a Zeroplus based game controller. |
848 | 849 | ||
849 | config ZEROPLUS_FF | 850 | config ZEROPLUS_FF |
850 | bool "Zeroplus based game controller force feedback support" | 851 | bool "Zeroplus based game controller force feedback support" |
851 | depends on HID_ZEROPLUS | 852 | depends on HID_ZEROPLUS |
852 | select INPUT_FF_MEMLESS | 853 | select INPUT_FF_MEMLESS |
853 | ---help--- | 854 | ---help--- |
854 | Say Y here if you have a Zeroplus based game controller and want | 855 | Say Y here if you have a Zeroplus based game controller and want |
855 | to have force feedback support for it. | 856 | to have force feedback support for it. |
856 | 857 | ||
857 | config HID_ZYDACRON | 858 | config HID_ZYDACRON |
858 | tristate "Zydacron remote control support" | 859 | tristate "Zydacron remote control support" |
859 | depends on HID | 860 | depends on HID |
860 | ---help--- | 861 | ---help--- |
861 | Support for Zydacron remote control. | 862 | Support for Zydacron remote control. |
862 | 863 | ||
863 | config HID_SENSOR_HUB | 864 | config HID_SENSOR_HUB |
864 | tristate "HID Sensors framework support" | 865 | tristate "HID Sensors framework support" |
865 | depends on HID && HAS_IOMEM | 866 | depends on HID && HAS_IOMEM |
866 | select MFD_CORE | 867 | select MFD_CORE |
867 | default n | 868 | default n |
868 | ---help--- | 869 | ---help--- |
869 | Support for HID Sensor framework. This creates a MFD instance | 870 | Support for HID Sensor framework. This creates a MFD instance |
870 | for a sensor hub and identifies all the sensors connected to it. | 871 | for a sensor hub and identifies all the sensors connected to it. |
871 | Each sensor is registered as a MFD cell, so that sensor specific | 872 | Each sensor is registered as a MFD cell, so that sensor specific |
872 | processing can be done in a separate driver. Each sensor | 873 | processing can be done in a separate driver. Each sensor |
873 | drivers can use the service provided by this driver to register | 874 | drivers can use the service provided by this driver to register |
874 | for events and handle data streams. Each sensor driver can format | 875 | for events and handle data streams. Each sensor driver can format |
875 | data and present to user mode using input or IIO interface. | 876 | data and present to user mode using input or IIO interface. |
876 | 877 | ||
877 | endmenu | 878 | endmenu |
878 | 879 | ||
879 | endif # HID | 880 | endif # HID |
880 | 881 | ||
881 | source "drivers/hid/usbhid/Kconfig" | 882 | source "drivers/hid/usbhid/Kconfig" |
882 | 883 | ||
883 | source "drivers/hid/i2c-hid/Kconfig" | 884 | source "drivers/hid/i2c-hid/Kconfig" |
884 | 885 | ||
885 | endmenu | 886 | endmenu |
886 | 887 |
drivers/hid/hid-core.c
1 | /* | 1 | /* |
2 | * HID support for Linux | 2 | * HID support for Linux |
3 | * | 3 | * |
4 | * Copyright (c) 1999 Andreas Gal | 4 | * Copyright (c) 1999 Andreas Gal |
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
7 | * Copyright (c) 2006-2012 Jiri Kosina | 7 | * Copyright (c) 2006-2012 Jiri Kosina |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * This program is free software; you can redistribute it and/or modify it | 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 | 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) | 13 | * Software Foundation; either version 2 of the License, or (at your option) |
14 | * any later version. | 14 | * any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
18 | 18 | ||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
27 | #include <asm/byteorder.h> | 27 | #include <asm/byteorder.h> |
28 | #include <linux/input.h> | 28 | #include <linux/input.h> |
29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
30 | #include <linux/vmalloc.h> | 30 | #include <linux/vmalloc.h> |
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <linux/semaphore.h> | 32 | #include <linux/semaphore.h> |
33 | 33 | ||
34 | #include <linux/hid.h> | 34 | #include <linux/hid.h> |
35 | #include <linux/hiddev.h> | 35 | #include <linux/hiddev.h> |
36 | #include <linux/hid-debug.h> | 36 | #include <linux/hid-debug.h> |
37 | #include <linux/hidraw.h> | 37 | #include <linux/hidraw.h> |
38 | 38 | ||
39 | #include "hid-ids.h" | 39 | #include "hid-ids.h" |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Version Information | 42 | * Version Information |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #define DRIVER_DESC "HID core driver" | 45 | #define DRIVER_DESC "HID core driver" |
46 | #define DRIVER_LICENSE "GPL" | 46 | #define DRIVER_LICENSE "GPL" |
47 | 47 | ||
48 | int hid_debug = 0; | 48 | int hid_debug = 0; |
49 | module_param_named(debug, hid_debug, int, 0600); | 49 | module_param_named(debug, hid_debug, int, 0600); |
50 | MODULE_PARM_DESC(debug, "toggle HID debugging messages"); | 50 | MODULE_PARM_DESC(debug, "toggle HID debugging messages"); |
51 | EXPORT_SYMBOL_GPL(hid_debug); | 51 | EXPORT_SYMBOL_GPL(hid_debug); |
52 | 52 | ||
53 | static int hid_ignore_special_drivers = 0; | 53 | static int hid_ignore_special_drivers = 0; |
54 | module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600); | 54 | module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600); |
55 | MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver"); | 55 | MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver"); |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * Register a new report for a device. | 58 | * Register a new report for a device. |
59 | */ | 59 | */ |
60 | 60 | ||
61 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) | 61 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) |
62 | { | 62 | { |
63 | struct hid_report_enum *report_enum = device->report_enum + type; | 63 | struct hid_report_enum *report_enum = device->report_enum + type; |
64 | struct hid_report *report; | 64 | struct hid_report *report; |
65 | 65 | ||
66 | if (id >= HID_MAX_IDS) | 66 | if (id >= HID_MAX_IDS) |
67 | return NULL; | 67 | return NULL; |
68 | if (report_enum->report_id_hash[id]) | 68 | if (report_enum->report_id_hash[id]) |
69 | return report_enum->report_id_hash[id]; | 69 | return report_enum->report_id_hash[id]; |
70 | 70 | ||
71 | report = kzalloc(sizeof(struct hid_report), GFP_KERNEL); | 71 | report = kzalloc(sizeof(struct hid_report), GFP_KERNEL); |
72 | if (!report) | 72 | if (!report) |
73 | return NULL; | 73 | return NULL; |
74 | 74 | ||
75 | if (id != 0) | 75 | if (id != 0) |
76 | report_enum->numbered = 1; | 76 | report_enum->numbered = 1; |
77 | 77 | ||
78 | report->id = id; | 78 | report->id = id; |
79 | report->type = type; | 79 | report->type = type; |
80 | report->size = 0; | 80 | report->size = 0; |
81 | report->device = device; | 81 | report->device = device; |
82 | report_enum->report_id_hash[id] = report; | 82 | report_enum->report_id_hash[id] = report; |
83 | 83 | ||
84 | list_add_tail(&report->list, &report_enum->report_list); | 84 | list_add_tail(&report->list, &report_enum->report_list); |
85 | 85 | ||
86 | return report; | 86 | return report; |
87 | } | 87 | } |
88 | EXPORT_SYMBOL_GPL(hid_register_report); | 88 | EXPORT_SYMBOL_GPL(hid_register_report); |
89 | 89 | ||
90 | /* | 90 | /* |
91 | * Register a new field for this report. | 91 | * Register a new field for this report. |
92 | */ | 92 | */ |
93 | 93 | ||
94 | static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) | 94 | static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) |
95 | { | 95 | { |
96 | struct hid_field *field; | 96 | struct hid_field *field; |
97 | 97 | ||
98 | if (report->maxfield == HID_MAX_FIELDS) { | 98 | if (report->maxfield == HID_MAX_FIELDS) { |
99 | hid_err(report->device, "too many fields in report\n"); | 99 | hid_err(report->device, "too many fields in report\n"); |
100 | return NULL; | 100 | return NULL; |
101 | } | 101 | } |
102 | 102 | ||
103 | field = kzalloc((sizeof(struct hid_field) + | 103 | field = kzalloc((sizeof(struct hid_field) + |
104 | usages * sizeof(struct hid_usage) + | 104 | usages * sizeof(struct hid_usage) + |
105 | values * sizeof(unsigned)), GFP_KERNEL); | 105 | values * sizeof(unsigned)), GFP_KERNEL); |
106 | if (!field) | 106 | if (!field) |
107 | return NULL; | 107 | return NULL; |
108 | 108 | ||
109 | field->index = report->maxfield++; | 109 | field->index = report->maxfield++; |
110 | report->field[field->index] = field; | 110 | report->field[field->index] = field; |
111 | field->usage = (struct hid_usage *)(field + 1); | 111 | field->usage = (struct hid_usage *)(field + 1); |
112 | field->value = (s32 *)(field->usage + usages); | 112 | field->value = (s32 *)(field->usage + usages); |
113 | field->report = report; | 113 | field->report = report; |
114 | 114 | ||
115 | return field; | 115 | return field; |
116 | } | 116 | } |
117 | 117 | ||
118 | /* | 118 | /* |
119 | * Open a collection. The type/usage is pushed on the stack. | 119 | * Open a collection. The type/usage is pushed on the stack. |
120 | */ | 120 | */ |
121 | 121 | ||
122 | static int open_collection(struct hid_parser *parser, unsigned type) | 122 | static int open_collection(struct hid_parser *parser, unsigned type) |
123 | { | 123 | { |
124 | struct hid_collection *collection; | 124 | struct hid_collection *collection; |
125 | unsigned usage; | 125 | unsigned usage; |
126 | 126 | ||
127 | usage = parser->local.usage[0]; | 127 | usage = parser->local.usage[0]; |
128 | 128 | ||
129 | if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { | 129 | if (parser->collection_stack_ptr == HID_COLLECTION_STACK_SIZE) { |
130 | hid_err(parser->device, "collection stack overflow\n"); | 130 | hid_err(parser->device, "collection stack overflow\n"); |
131 | return -EINVAL; | 131 | return -EINVAL; |
132 | } | 132 | } |
133 | 133 | ||
134 | if (parser->device->maxcollection == parser->device->collection_size) { | 134 | if (parser->device->maxcollection == parser->device->collection_size) { |
135 | collection = kmalloc(sizeof(struct hid_collection) * | 135 | collection = kmalloc(sizeof(struct hid_collection) * |
136 | parser->device->collection_size * 2, GFP_KERNEL); | 136 | parser->device->collection_size * 2, GFP_KERNEL); |
137 | if (collection == NULL) { | 137 | if (collection == NULL) { |
138 | hid_err(parser->device, "failed to reallocate collection array\n"); | 138 | hid_err(parser->device, "failed to reallocate collection array\n"); |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
140 | } | 140 | } |
141 | memcpy(collection, parser->device->collection, | 141 | memcpy(collection, parser->device->collection, |
142 | sizeof(struct hid_collection) * | 142 | sizeof(struct hid_collection) * |
143 | parser->device->collection_size); | 143 | parser->device->collection_size); |
144 | memset(collection + parser->device->collection_size, 0, | 144 | memset(collection + parser->device->collection_size, 0, |
145 | sizeof(struct hid_collection) * | 145 | sizeof(struct hid_collection) * |
146 | parser->device->collection_size); | 146 | parser->device->collection_size); |
147 | kfree(parser->device->collection); | 147 | kfree(parser->device->collection); |
148 | parser->device->collection = collection; | 148 | parser->device->collection = collection; |
149 | parser->device->collection_size *= 2; | 149 | parser->device->collection_size *= 2; |
150 | } | 150 | } |
151 | 151 | ||
152 | parser->collection_stack[parser->collection_stack_ptr++] = | 152 | parser->collection_stack[parser->collection_stack_ptr++] = |
153 | parser->device->maxcollection; | 153 | parser->device->maxcollection; |
154 | 154 | ||
155 | collection = parser->device->collection + | 155 | collection = parser->device->collection + |
156 | parser->device->maxcollection++; | 156 | parser->device->maxcollection++; |
157 | collection->type = type; | 157 | collection->type = type; |
158 | collection->usage = usage; | 158 | collection->usage = usage; |
159 | collection->level = parser->collection_stack_ptr - 1; | 159 | collection->level = parser->collection_stack_ptr - 1; |
160 | 160 | ||
161 | if (type == HID_COLLECTION_APPLICATION) | 161 | if (type == HID_COLLECTION_APPLICATION) |
162 | parser->device->maxapplication++; | 162 | parser->device->maxapplication++; |
163 | 163 | ||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | /* | 167 | /* |
168 | * Close a collection. | 168 | * Close a collection. |
169 | */ | 169 | */ |
170 | 170 | ||
171 | static int close_collection(struct hid_parser *parser) | 171 | static int close_collection(struct hid_parser *parser) |
172 | { | 172 | { |
173 | if (!parser->collection_stack_ptr) { | 173 | if (!parser->collection_stack_ptr) { |
174 | hid_err(parser->device, "collection stack underflow\n"); | 174 | hid_err(parser->device, "collection stack underflow\n"); |
175 | return -EINVAL; | 175 | return -EINVAL; |
176 | } | 176 | } |
177 | parser->collection_stack_ptr--; | 177 | parser->collection_stack_ptr--; |
178 | return 0; | 178 | return 0; |
179 | } | 179 | } |
180 | 180 | ||
181 | /* | 181 | /* |
182 | * Climb up the stack, search for the specified collection type | 182 | * Climb up the stack, search for the specified collection type |
183 | * and return the usage. | 183 | * and return the usage. |
184 | */ | 184 | */ |
185 | 185 | ||
186 | static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) | 186 | static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) |
187 | { | 187 | { |
188 | struct hid_collection *collection = parser->device->collection; | 188 | struct hid_collection *collection = parser->device->collection; |
189 | int n; | 189 | int n; |
190 | 190 | ||
191 | for (n = parser->collection_stack_ptr - 1; n >= 0; n--) { | 191 | for (n = parser->collection_stack_ptr - 1; n >= 0; n--) { |
192 | unsigned index = parser->collection_stack[n]; | 192 | unsigned index = parser->collection_stack[n]; |
193 | if (collection[index].type == type) | 193 | if (collection[index].type == type) |
194 | return collection[index].usage; | 194 | return collection[index].usage; |
195 | } | 195 | } |
196 | return 0; /* we know nothing about this usage type */ | 196 | return 0; /* we know nothing about this usage type */ |
197 | } | 197 | } |
198 | 198 | ||
199 | /* | 199 | /* |
200 | * Add a usage to the temporary parser table. | 200 | * Add a usage to the temporary parser table. |
201 | */ | 201 | */ |
202 | 202 | ||
203 | static int hid_add_usage(struct hid_parser *parser, unsigned usage) | 203 | static int hid_add_usage(struct hid_parser *parser, unsigned usage) |
204 | { | 204 | { |
205 | if (parser->local.usage_index >= HID_MAX_USAGES) { | 205 | if (parser->local.usage_index >= HID_MAX_USAGES) { |
206 | hid_err(parser->device, "usage index exceeded\n"); | 206 | hid_err(parser->device, "usage index exceeded\n"); |
207 | return -1; | 207 | return -1; |
208 | } | 208 | } |
209 | parser->local.usage[parser->local.usage_index] = usage; | 209 | parser->local.usage[parser->local.usage_index] = usage; |
210 | parser->local.collection_index[parser->local.usage_index] = | 210 | parser->local.collection_index[parser->local.usage_index] = |
211 | parser->collection_stack_ptr ? | 211 | parser->collection_stack_ptr ? |
212 | parser->collection_stack[parser->collection_stack_ptr - 1] : 0; | 212 | parser->collection_stack[parser->collection_stack_ptr - 1] : 0; |
213 | parser->local.usage_index++; | 213 | parser->local.usage_index++; |
214 | return 0; | 214 | return 0; |
215 | } | 215 | } |
216 | 216 | ||
217 | /* | 217 | /* |
218 | * Register a new field for this report. | 218 | * Register a new field for this report. |
219 | */ | 219 | */ |
220 | 220 | ||
221 | static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags) | 221 | static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags) |
222 | { | 222 | { |
223 | struct hid_report *report; | 223 | struct hid_report *report; |
224 | struct hid_field *field; | 224 | struct hid_field *field; |
225 | unsigned usages; | 225 | unsigned usages; |
226 | unsigned offset; | 226 | unsigned offset; |
227 | unsigned i; | 227 | unsigned i; |
228 | 228 | ||
229 | report = hid_register_report(parser->device, report_type, parser->global.report_id); | 229 | report = hid_register_report(parser->device, report_type, parser->global.report_id); |
230 | if (!report) { | 230 | if (!report) { |
231 | hid_err(parser->device, "hid_register_report failed\n"); | 231 | hid_err(parser->device, "hid_register_report failed\n"); |
232 | return -1; | 232 | return -1; |
233 | } | 233 | } |
234 | 234 | ||
235 | /* Handle both signed and unsigned cases properly */ | 235 | /* Handle both signed and unsigned cases properly */ |
236 | if ((parser->global.logical_minimum < 0 && | 236 | if ((parser->global.logical_minimum < 0 && |
237 | parser->global.logical_maximum < | 237 | parser->global.logical_maximum < |
238 | parser->global.logical_minimum) || | 238 | parser->global.logical_minimum) || |
239 | (parser->global.logical_minimum >= 0 && | 239 | (parser->global.logical_minimum >= 0 && |
240 | (__u32)parser->global.logical_maximum < | 240 | (__u32)parser->global.logical_maximum < |
241 | (__u32)parser->global.logical_minimum)) { | 241 | (__u32)parser->global.logical_minimum)) { |
242 | dbg_hid("logical range invalid 0x%x 0x%x\n", | 242 | dbg_hid("logical range invalid 0x%x 0x%x\n", |
243 | parser->global.logical_minimum, | 243 | parser->global.logical_minimum, |
244 | parser->global.logical_maximum); | 244 | parser->global.logical_maximum); |
245 | return -1; | 245 | return -1; |
246 | } | 246 | } |
247 | 247 | ||
248 | offset = report->size; | 248 | offset = report->size; |
249 | report->size += parser->global.report_size * parser->global.report_count; | 249 | report->size += parser->global.report_size * parser->global.report_count; |
250 | 250 | ||
251 | if (!parser->local.usage_index) /* Ignore padding fields */ | 251 | if (!parser->local.usage_index) /* Ignore padding fields */ |
252 | return 0; | 252 | return 0; |
253 | 253 | ||
254 | usages = max_t(unsigned, parser->local.usage_index, | 254 | usages = max_t(unsigned, parser->local.usage_index, |
255 | parser->global.report_count); | 255 | parser->global.report_count); |
256 | 256 | ||
257 | field = hid_register_field(report, usages, parser->global.report_count); | 257 | field = hid_register_field(report, usages, parser->global.report_count); |
258 | if (!field) | 258 | if (!field) |
259 | return 0; | 259 | return 0; |
260 | 260 | ||
261 | field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); | 261 | field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); |
262 | field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL); | 262 | field->logical = hid_lookup_collection(parser, HID_COLLECTION_LOGICAL); |
263 | field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION); | 263 | field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION); |
264 | 264 | ||
265 | for (i = 0; i < usages; i++) { | 265 | for (i = 0; i < usages; i++) { |
266 | unsigned j = i; | 266 | unsigned j = i; |
267 | /* Duplicate the last usage we parsed if we have excess values */ | 267 | /* Duplicate the last usage we parsed if we have excess values */ |
268 | if (i >= parser->local.usage_index) | 268 | if (i >= parser->local.usage_index) |
269 | j = parser->local.usage_index - 1; | 269 | j = parser->local.usage_index - 1; |
270 | field->usage[i].hid = parser->local.usage[j]; | 270 | field->usage[i].hid = parser->local.usage[j]; |
271 | field->usage[i].collection_index = | 271 | field->usage[i].collection_index = |
272 | parser->local.collection_index[j]; | 272 | parser->local.collection_index[j]; |
273 | field->usage[i].usage_index = i; | 273 | field->usage[i].usage_index = i; |
274 | } | 274 | } |
275 | 275 | ||
276 | field->maxusage = usages; | 276 | field->maxusage = usages; |
277 | field->flags = flags; | 277 | field->flags = flags; |
278 | field->report_offset = offset; | 278 | field->report_offset = offset; |
279 | field->report_type = report_type; | 279 | field->report_type = report_type; |
280 | field->report_size = parser->global.report_size; | 280 | field->report_size = parser->global.report_size; |
281 | field->report_count = parser->global.report_count; | 281 | field->report_count = parser->global.report_count; |
282 | field->logical_minimum = parser->global.logical_minimum; | 282 | field->logical_minimum = parser->global.logical_minimum; |
283 | field->logical_maximum = parser->global.logical_maximum; | 283 | field->logical_maximum = parser->global.logical_maximum; |
284 | field->physical_minimum = parser->global.physical_minimum; | 284 | field->physical_minimum = parser->global.physical_minimum; |
285 | field->physical_maximum = parser->global.physical_maximum; | 285 | field->physical_maximum = parser->global.physical_maximum; |
286 | field->unit_exponent = parser->global.unit_exponent; | 286 | field->unit_exponent = parser->global.unit_exponent; |
287 | field->unit = parser->global.unit; | 287 | field->unit = parser->global.unit; |
288 | 288 | ||
289 | return 0; | 289 | return 0; |
290 | } | 290 | } |
291 | 291 | ||
292 | /* | 292 | /* |
293 | * Read data value from item. | 293 | * Read data value from item. |
294 | */ | 294 | */ |
295 | 295 | ||
296 | static u32 item_udata(struct hid_item *item) | 296 | static u32 item_udata(struct hid_item *item) |
297 | { | 297 | { |
298 | switch (item->size) { | 298 | switch (item->size) { |
299 | case 1: return item->data.u8; | 299 | case 1: return item->data.u8; |
300 | case 2: return item->data.u16; | 300 | case 2: return item->data.u16; |
301 | case 4: return item->data.u32; | 301 | case 4: return item->data.u32; |
302 | } | 302 | } |
303 | return 0; | 303 | return 0; |
304 | } | 304 | } |
305 | 305 | ||
306 | static s32 item_sdata(struct hid_item *item) | 306 | static s32 item_sdata(struct hid_item *item) |
307 | { | 307 | { |
308 | switch (item->size) { | 308 | switch (item->size) { |
309 | case 1: return item->data.s8; | 309 | case 1: return item->data.s8; |
310 | case 2: return item->data.s16; | 310 | case 2: return item->data.s16; |
311 | case 4: return item->data.s32; | 311 | case 4: return item->data.s32; |
312 | } | 312 | } |
313 | return 0; | 313 | return 0; |
314 | } | 314 | } |
315 | 315 | ||
316 | /* | 316 | /* |
317 | * Process a global item. | 317 | * Process a global item. |
318 | */ | 318 | */ |
319 | 319 | ||
320 | static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) | 320 | static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) |
321 | { | 321 | { |
322 | __s32 raw_value; | 322 | __s32 raw_value; |
323 | switch (item->tag) { | 323 | switch (item->tag) { |
324 | case HID_GLOBAL_ITEM_TAG_PUSH: | 324 | case HID_GLOBAL_ITEM_TAG_PUSH: |
325 | 325 | ||
326 | if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { | 326 | if (parser->global_stack_ptr == HID_GLOBAL_STACK_SIZE) { |
327 | hid_err(parser->device, "global environment stack overflow\n"); | 327 | hid_err(parser->device, "global environment stack overflow\n"); |
328 | return -1; | 328 | return -1; |
329 | } | 329 | } |
330 | 330 | ||
331 | memcpy(parser->global_stack + parser->global_stack_ptr++, | 331 | memcpy(parser->global_stack + parser->global_stack_ptr++, |
332 | &parser->global, sizeof(struct hid_global)); | 332 | &parser->global, sizeof(struct hid_global)); |
333 | return 0; | 333 | return 0; |
334 | 334 | ||
335 | case HID_GLOBAL_ITEM_TAG_POP: | 335 | case HID_GLOBAL_ITEM_TAG_POP: |
336 | 336 | ||
337 | if (!parser->global_stack_ptr) { | 337 | if (!parser->global_stack_ptr) { |
338 | hid_err(parser->device, "global environment stack underflow\n"); | 338 | hid_err(parser->device, "global environment stack underflow\n"); |
339 | return -1; | 339 | return -1; |
340 | } | 340 | } |
341 | 341 | ||
342 | memcpy(&parser->global, parser->global_stack + | 342 | memcpy(&parser->global, parser->global_stack + |
343 | --parser->global_stack_ptr, sizeof(struct hid_global)); | 343 | --parser->global_stack_ptr, sizeof(struct hid_global)); |
344 | return 0; | 344 | return 0; |
345 | 345 | ||
346 | case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: | 346 | case HID_GLOBAL_ITEM_TAG_USAGE_PAGE: |
347 | parser->global.usage_page = item_udata(item); | 347 | parser->global.usage_page = item_udata(item); |
348 | return 0; | 348 | return 0; |
349 | 349 | ||
350 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: | 350 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM: |
351 | parser->global.logical_minimum = item_sdata(item); | 351 | parser->global.logical_minimum = item_sdata(item); |
352 | return 0; | 352 | return 0; |
353 | 353 | ||
354 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: | 354 | case HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM: |
355 | if (parser->global.logical_minimum < 0) | 355 | if (parser->global.logical_minimum < 0) |
356 | parser->global.logical_maximum = item_sdata(item); | 356 | parser->global.logical_maximum = item_sdata(item); |
357 | else | 357 | else |
358 | parser->global.logical_maximum = item_udata(item); | 358 | parser->global.logical_maximum = item_udata(item); |
359 | return 0; | 359 | return 0; |
360 | 360 | ||
361 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: | 361 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM: |
362 | parser->global.physical_minimum = item_sdata(item); | 362 | parser->global.physical_minimum = item_sdata(item); |
363 | return 0; | 363 | return 0; |
364 | 364 | ||
365 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: | 365 | case HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM: |
366 | if (parser->global.physical_minimum < 0) | 366 | if (parser->global.physical_minimum < 0) |
367 | parser->global.physical_maximum = item_sdata(item); | 367 | parser->global.physical_maximum = item_sdata(item); |
368 | else | 368 | else |
369 | parser->global.physical_maximum = item_udata(item); | 369 | parser->global.physical_maximum = item_udata(item); |
370 | return 0; | 370 | return 0; |
371 | 371 | ||
372 | case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: | 372 | case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT: |
373 | /* Many devices provide unit exponent as a two's complement | 373 | /* Many devices provide unit exponent as a two's complement |
374 | * nibble due to the common misunderstanding of HID | 374 | * nibble due to the common misunderstanding of HID |
375 | * specification 1.11, 6.2.2.7 Global Items. Attempt to handle | 375 | * specification 1.11, 6.2.2.7 Global Items. Attempt to handle |
376 | * both this and the standard encoding. */ | 376 | * both this and the standard encoding. */ |
377 | raw_value = item_sdata(item); | 377 | raw_value = item_sdata(item); |
378 | if (!(raw_value & 0xfffffff0)) | 378 | if (!(raw_value & 0xfffffff0)) |
379 | parser->global.unit_exponent = hid_snto32(raw_value, 4); | 379 | parser->global.unit_exponent = hid_snto32(raw_value, 4); |
380 | else | 380 | else |
381 | parser->global.unit_exponent = raw_value; | 381 | parser->global.unit_exponent = raw_value; |
382 | return 0; | 382 | return 0; |
383 | 383 | ||
384 | case HID_GLOBAL_ITEM_TAG_UNIT: | 384 | case HID_GLOBAL_ITEM_TAG_UNIT: |
385 | parser->global.unit = item_udata(item); | 385 | parser->global.unit = item_udata(item); |
386 | return 0; | 386 | return 0; |
387 | 387 | ||
388 | case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: | 388 | case HID_GLOBAL_ITEM_TAG_REPORT_SIZE: |
389 | parser->global.report_size = item_udata(item); | 389 | parser->global.report_size = item_udata(item); |
390 | if (parser->global.report_size > 128) { | 390 | if (parser->global.report_size > 128) { |
391 | hid_err(parser->device, "invalid report_size %d\n", | 391 | hid_err(parser->device, "invalid report_size %d\n", |
392 | parser->global.report_size); | 392 | parser->global.report_size); |
393 | return -1; | 393 | return -1; |
394 | } | 394 | } |
395 | return 0; | 395 | return 0; |
396 | 396 | ||
397 | case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: | 397 | case HID_GLOBAL_ITEM_TAG_REPORT_COUNT: |
398 | parser->global.report_count = item_udata(item); | 398 | parser->global.report_count = item_udata(item); |
399 | if (parser->global.report_count > HID_MAX_USAGES) { | 399 | if (parser->global.report_count > HID_MAX_USAGES) { |
400 | hid_err(parser->device, "invalid report_count %d\n", | 400 | hid_err(parser->device, "invalid report_count %d\n", |
401 | parser->global.report_count); | 401 | parser->global.report_count); |
402 | return -1; | 402 | return -1; |
403 | } | 403 | } |
404 | return 0; | 404 | return 0; |
405 | 405 | ||
406 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: | 406 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: |
407 | parser->global.report_id = item_udata(item); | 407 | parser->global.report_id = item_udata(item); |
408 | if (parser->global.report_id == 0 || | 408 | if (parser->global.report_id == 0 || |
409 | parser->global.report_id >= HID_MAX_IDS) { | 409 | parser->global.report_id >= HID_MAX_IDS) { |
410 | hid_err(parser->device, "report_id %u is invalid\n", | 410 | hid_err(parser->device, "report_id %u is invalid\n", |
411 | parser->global.report_id); | 411 | parser->global.report_id); |
412 | return -1; | 412 | return -1; |
413 | } | 413 | } |
414 | return 0; | 414 | return 0; |
415 | 415 | ||
416 | default: | 416 | default: |
417 | hid_err(parser->device, "unknown global tag 0x%x\n", item->tag); | 417 | hid_err(parser->device, "unknown global tag 0x%x\n", item->tag); |
418 | return -1; | 418 | return -1; |
419 | } | 419 | } |
420 | } | 420 | } |
421 | 421 | ||
422 | /* | 422 | /* |
423 | * Process a local item. | 423 | * Process a local item. |
424 | */ | 424 | */ |
425 | 425 | ||
426 | static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | 426 | static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
427 | { | 427 | { |
428 | __u32 data; | 428 | __u32 data; |
429 | unsigned n; | 429 | unsigned n; |
430 | 430 | ||
431 | data = item_udata(item); | 431 | data = item_udata(item); |
432 | 432 | ||
433 | switch (item->tag) { | 433 | switch (item->tag) { |
434 | case HID_LOCAL_ITEM_TAG_DELIMITER: | 434 | case HID_LOCAL_ITEM_TAG_DELIMITER: |
435 | 435 | ||
436 | if (data) { | 436 | if (data) { |
437 | /* | 437 | /* |
438 | * We treat items before the first delimiter | 438 | * We treat items before the first delimiter |
439 | * as global to all usage sets (branch 0). | 439 | * as global to all usage sets (branch 0). |
440 | * In the moment we process only these global | 440 | * In the moment we process only these global |
441 | * items and the first delimiter set. | 441 | * items and the first delimiter set. |
442 | */ | 442 | */ |
443 | if (parser->local.delimiter_depth != 0) { | 443 | if (parser->local.delimiter_depth != 0) { |
444 | hid_err(parser->device, "nested delimiters\n"); | 444 | hid_err(parser->device, "nested delimiters\n"); |
445 | return -1; | 445 | return -1; |
446 | } | 446 | } |
447 | parser->local.delimiter_depth++; | 447 | parser->local.delimiter_depth++; |
448 | parser->local.delimiter_branch++; | 448 | parser->local.delimiter_branch++; |
449 | } else { | 449 | } else { |
450 | if (parser->local.delimiter_depth < 1) { | 450 | if (parser->local.delimiter_depth < 1) { |
451 | hid_err(parser->device, "bogus close delimiter\n"); | 451 | hid_err(parser->device, "bogus close delimiter\n"); |
452 | return -1; | 452 | return -1; |
453 | } | 453 | } |
454 | parser->local.delimiter_depth--; | 454 | parser->local.delimiter_depth--; |
455 | } | 455 | } |
456 | return 0; | 456 | return 0; |
457 | 457 | ||
458 | case HID_LOCAL_ITEM_TAG_USAGE: | 458 | case HID_LOCAL_ITEM_TAG_USAGE: |
459 | 459 | ||
460 | if (parser->local.delimiter_branch > 1) { | 460 | if (parser->local.delimiter_branch > 1) { |
461 | dbg_hid("alternative usage ignored\n"); | 461 | dbg_hid("alternative usage ignored\n"); |
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | 464 | ||
465 | if (item->size <= 2) | 465 | if (item->size <= 2) |
466 | data = (parser->global.usage_page << 16) + data; | 466 | data = (parser->global.usage_page << 16) + data; |
467 | 467 | ||
468 | return hid_add_usage(parser, data); | 468 | return hid_add_usage(parser, data); |
469 | 469 | ||
470 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: | 470 | case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: |
471 | 471 | ||
472 | if (parser->local.delimiter_branch > 1) { | 472 | if (parser->local.delimiter_branch > 1) { |
473 | dbg_hid("alternative usage ignored\n"); | 473 | dbg_hid("alternative usage ignored\n"); |
474 | return 0; | 474 | return 0; |
475 | } | 475 | } |
476 | 476 | ||
477 | if (item->size <= 2) | 477 | if (item->size <= 2) |
478 | data = (parser->global.usage_page << 16) + data; | 478 | data = (parser->global.usage_page << 16) + data; |
479 | 479 | ||
480 | parser->local.usage_minimum = data; | 480 | parser->local.usage_minimum = data; |
481 | return 0; | 481 | return 0; |
482 | 482 | ||
483 | case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: | 483 | case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: |
484 | 484 | ||
485 | if (parser->local.delimiter_branch > 1) { | 485 | if (parser->local.delimiter_branch > 1) { |
486 | dbg_hid("alternative usage ignored\n"); | 486 | dbg_hid("alternative usage ignored\n"); |
487 | return 0; | 487 | return 0; |
488 | } | 488 | } |
489 | 489 | ||
490 | if (item->size <= 2) | 490 | if (item->size <= 2) |
491 | data = (parser->global.usage_page << 16) + data; | 491 | data = (parser->global.usage_page << 16) + data; |
492 | 492 | ||
493 | for (n = parser->local.usage_minimum; n <= data; n++) | 493 | for (n = parser->local.usage_minimum; n <= data; n++) |
494 | if (hid_add_usage(parser, n)) { | 494 | if (hid_add_usage(parser, n)) { |
495 | dbg_hid("hid_add_usage failed\n"); | 495 | dbg_hid("hid_add_usage failed\n"); |
496 | return -1; | 496 | return -1; |
497 | } | 497 | } |
498 | return 0; | 498 | return 0; |
499 | 499 | ||
500 | default: | 500 | default: |
501 | 501 | ||
502 | dbg_hid("unknown local item tag 0x%x\n", item->tag); | 502 | dbg_hid("unknown local item tag 0x%x\n", item->tag); |
503 | return 0; | 503 | return 0; |
504 | } | 504 | } |
505 | return 0; | 505 | return 0; |
506 | } | 506 | } |
507 | 507 | ||
508 | /* | 508 | /* |
509 | * Process a main item. | 509 | * Process a main item. |
510 | */ | 510 | */ |
511 | 511 | ||
512 | static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) | 512 | static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) |
513 | { | 513 | { |
514 | __u32 data; | 514 | __u32 data; |
515 | int ret; | 515 | int ret; |
516 | 516 | ||
517 | data = item_udata(item); | 517 | data = item_udata(item); |
518 | 518 | ||
519 | switch (item->tag) { | 519 | switch (item->tag) { |
520 | case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: | 520 | case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: |
521 | ret = open_collection(parser, data & 0xff); | 521 | ret = open_collection(parser, data & 0xff); |
522 | break; | 522 | break; |
523 | case HID_MAIN_ITEM_TAG_END_COLLECTION: | 523 | case HID_MAIN_ITEM_TAG_END_COLLECTION: |
524 | ret = close_collection(parser); | 524 | ret = close_collection(parser); |
525 | break; | 525 | break; |
526 | case HID_MAIN_ITEM_TAG_INPUT: | 526 | case HID_MAIN_ITEM_TAG_INPUT: |
527 | ret = hid_add_field(parser, HID_INPUT_REPORT, data); | 527 | ret = hid_add_field(parser, HID_INPUT_REPORT, data); |
528 | break; | 528 | break; |
529 | case HID_MAIN_ITEM_TAG_OUTPUT: | 529 | case HID_MAIN_ITEM_TAG_OUTPUT: |
530 | ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); | 530 | ret = hid_add_field(parser, HID_OUTPUT_REPORT, data); |
531 | break; | 531 | break; |
532 | case HID_MAIN_ITEM_TAG_FEATURE: | 532 | case HID_MAIN_ITEM_TAG_FEATURE: |
533 | ret = hid_add_field(parser, HID_FEATURE_REPORT, data); | 533 | ret = hid_add_field(parser, HID_FEATURE_REPORT, data); |
534 | break; | 534 | break; |
535 | default: | 535 | default: |
536 | hid_err(parser->device, "unknown main item tag 0x%x\n", item->tag); | 536 | hid_err(parser->device, "unknown main item tag 0x%x\n", item->tag); |
537 | ret = 0; | 537 | ret = 0; |
538 | } | 538 | } |
539 | 539 | ||
540 | memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ | 540 | memset(&parser->local, 0, sizeof(parser->local)); /* Reset the local parser environment */ |
541 | 541 | ||
542 | return ret; | 542 | return ret; |
543 | } | 543 | } |
544 | 544 | ||
545 | /* | 545 | /* |
546 | * Process a reserved item. | 546 | * Process a reserved item. |
547 | */ | 547 | */ |
548 | 548 | ||
549 | static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) | 549 | static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) |
550 | { | 550 | { |
551 | dbg_hid("reserved item type, tag 0x%x\n", item->tag); | 551 | dbg_hid("reserved item type, tag 0x%x\n", item->tag); |
552 | return 0; | 552 | return 0; |
553 | } | 553 | } |
554 | 554 | ||
555 | /* | 555 | /* |
556 | * Free a report and all registered fields. The field->usage and | 556 | * Free a report and all registered fields. The field->usage and |
557 | * field->value table's are allocated behind the field, so we need | 557 | * field->value table's are allocated behind the field, so we need |
558 | * only to free(field) itself. | 558 | * only to free(field) itself. |
559 | */ | 559 | */ |
560 | 560 | ||
561 | static void hid_free_report(struct hid_report *report) | 561 | static void hid_free_report(struct hid_report *report) |
562 | { | 562 | { |
563 | unsigned n; | 563 | unsigned n; |
564 | 564 | ||
565 | for (n = 0; n < report->maxfield; n++) | 565 | for (n = 0; n < report->maxfield; n++) |
566 | kfree(report->field[n]); | 566 | kfree(report->field[n]); |
567 | kfree(report); | 567 | kfree(report); |
568 | } | 568 | } |
569 | 569 | ||
570 | /* | 570 | /* |
571 | * Close report. This function returns the device | 571 | * Close report. This function returns the device |
572 | * state to the point prior to hid_open_report(). | 572 | * state to the point prior to hid_open_report(). |
573 | */ | 573 | */ |
574 | static void hid_close_report(struct hid_device *device) | 574 | static void hid_close_report(struct hid_device *device) |
575 | { | 575 | { |
576 | unsigned i, j; | 576 | unsigned i, j; |
577 | 577 | ||
578 | for (i = 0; i < HID_REPORT_TYPES; i++) { | 578 | for (i = 0; i < HID_REPORT_TYPES; i++) { |
579 | struct hid_report_enum *report_enum = device->report_enum + i; | 579 | struct hid_report_enum *report_enum = device->report_enum + i; |
580 | 580 | ||
581 | for (j = 0; j < HID_MAX_IDS; j++) { | 581 | for (j = 0; j < HID_MAX_IDS; j++) { |
582 | struct hid_report *report = report_enum->report_id_hash[j]; | 582 | struct hid_report *report = report_enum->report_id_hash[j]; |
583 | if (report) | 583 | if (report) |
584 | hid_free_report(report); | 584 | hid_free_report(report); |
585 | } | 585 | } |
586 | memset(report_enum, 0, sizeof(*report_enum)); | 586 | memset(report_enum, 0, sizeof(*report_enum)); |
587 | INIT_LIST_HEAD(&report_enum->report_list); | 587 | INIT_LIST_HEAD(&report_enum->report_list); |
588 | } | 588 | } |
589 | 589 | ||
590 | kfree(device->rdesc); | 590 | kfree(device->rdesc); |
591 | device->rdesc = NULL; | 591 | device->rdesc = NULL; |
592 | device->rsize = 0; | 592 | device->rsize = 0; |
593 | 593 | ||
594 | kfree(device->collection); | 594 | kfree(device->collection); |
595 | device->collection = NULL; | 595 | device->collection = NULL; |
596 | device->collection_size = 0; | 596 | device->collection_size = 0; |
597 | device->maxcollection = 0; | 597 | device->maxcollection = 0; |
598 | device->maxapplication = 0; | 598 | device->maxapplication = 0; |
599 | 599 | ||
600 | device->status &= ~HID_STAT_PARSED; | 600 | device->status &= ~HID_STAT_PARSED; |
601 | } | 601 | } |
602 | 602 | ||
603 | /* | 603 | /* |
604 | * Free a device structure, all reports, and all fields. | 604 | * Free a device structure, all reports, and all fields. |
605 | */ | 605 | */ |
606 | 606 | ||
607 | static void hid_device_release(struct device *dev) | 607 | static void hid_device_release(struct device *dev) |
608 | { | 608 | { |
609 | struct hid_device *hid = container_of(dev, struct hid_device, dev); | 609 | struct hid_device *hid = container_of(dev, struct hid_device, dev); |
610 | 610 | ||
611 | hid_close_report(hid); | 611 | hid_close_report(hid); |
612 | kfree(hid->dev_rdesc); | 612 | kfree(hid->dev_rdesc); |
613 | kfree(hid); | 613 | kfree(hid); |
614 | } | 614 | } |
615 | 615 | ||
616 | /* | 616 | /* |
617 | * Fetch a report description item from the data stream. We support long | 617 | * Fetch a report description item from the data stream. We support long |
618 | * items, though they are not used yet. | 618 | * items, though they are not used yet. |
619 | */ | 619 | */ |
620 | 620 | ||
621 | static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) | 621 | static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) |
622 | { | 622 | { |
623 | u8 b; | 623 | u8 b; |
624 | 624 | ||
625 | if ((end - start) <= 0) | 625 | if ((end - start) <= 0) |
626 | return NULL; | 626 | return NULL; |
627 | 627 | ||
628 | b = *start++; | 628 | b = *start++; |
629 | 629 | ||
630 | item->type = (b >> 2) & 3; | 630 | item->type = (b >> 2) & 3; |
631 | item->tag = (b >> 4) & 15; | 631 | item->tag = (b >> 4) & 15; |
632 | 632 | ||
633 | if (item->tag == HID_ITEM_TAG_LONG) { | 633 | if (item->tag == HID_ITEM_TAG_LONG) { |
634 | 634 | ||
635 | item->format = HID_ITEM_FORMAT_LONG; | 635 | item->format = HID_ITEM_FORMAT_LONG; |
636 | 636 | ||
637 | if ((end - start) < 2) | 637 | if ((end - start) < 2) |
638 | return NULL; | 638 | return NULL; |
639 | 639 | ||
640 | item->size = *start++; | 640 | item->size = *start++; |
641 | item->tag = *start++; | 641 | item->tag = *start++; |
642 | 642 | ||
643 | if ((end - start) < item->size) | 643 | if ((end - start) < item->size) |
644 | return NULL; | 644 | return NULL; |
645 | 645 | ||
646 | item->data.longdata = start; | 646 | item->data.longdata = start; |
647 | start += item->size; | 647 | start += item->size; |
648 | return start; | 648 | return start; |
649 | } | 649 | } |
650 | 650 | ||
651 | item->format = HID_ITEM_FORMAT_SHORT; | 651 | item->format = HID_ITEM_FORMAT_SHORT; |
652 | item->size = b & 3; | 652 | item->size = b & 3; |
653 | 653 | ||
654 | switch (item->size) { | 654 | switch (item->size) { |
655 | case 0: | 655 | case 0: |
656 | return start; | 656 | return start; |
657 | 657 | ||
658 | case 1: | 658 | case 1: |
659 | if ((end - start) < 1) | 659 | if ((end - start) < 1) |
660 | return NULL; | 660 | return NULL; |
661 | item->data.u8 = *start++; | 661 | item->data.u8 = *start++; |
662 | return start; | 662 | return start; |
663 | 663 | ||
664 | case 2: | 664 | case 2: |
665 | if ((end - start) < 2) | 665 | if ((end - start) < 2) |
666 | return NULL; | 666 | return NULL; |
667 | item->data.u16 = get_unaligned_le16(start); | 667 | item->data.u16 = get_unaligned_le16(start); |
668 | start = (__u8 *)((__le16 *)start + 1); | 668 | start = (__u8 *)((__le16 *)start + 1); |
669 | return start; | 669 | return start; |
670 | 670 | ||
671 | case 3: | 671 | case 3: |
672 | item->size++; | 672 | item->size++; |
673 | if ((end - start) < 4) | 673 | if ((end - start) < 4) |
674 | return NULL; | 674 | return NULL; |
675 | item->data.u32 = get_unaligned_le32(start); | 675 | item->data.u32 = get_unaligned_le32(start); |
676 | start = (__u8 *)((__le32 *)start + 1); | 676 | start = (__u8 *)((__le32 *)start + 1); |
677 | return start; | 677 | return start; |
678 | } | 678 | } |
679 | 679 | ||
680 | return NULL; | 680 | return NULL; |
681 | } | 681 | } |
682 | 682 | ||
683 | static void hid_scan_input_usage(struct hid_parser *parser, u32 usage) | 683 | static void hid_scan_input_usage(struct hid_parser *parser, u32 usage) |
684 | { | 684 | { |
685 | struct hid_device *hid = parser->device; | 685 | struct hid_device *hid = parser->device; |
686 | 686 | ||
687 | if (usage == HID_DG_CONTACTID) | 687 | if (usage == HID_DG_CONTACTID) |
688 | hid->group = HID_GROUP_MULTITOUCH; | 688 | hid->group = HID_GROUP_MULTITOUCH; |
689 | } | 689 | } |
690 | 690 | ||
691 | static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage) | 691 | static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage) |
692 | { | 692 | { |
693 | if (usage == 0xff0000c5 && parser->global.report_count == 256 && | 693 | if (usage == 0xff0000c5 && parser->global.report_count == 256 && |
694 | parser->global.report_size == 8) | 694 | parser->global.report_size == 8) |
695 | parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; | 695 | parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; |
696 | } | 696 | } |
697 | 697 | ||
698 | static void hid_scan_collection(struct hid_parser *parser, unsigned type) | 698 | static void hid_scan_collection(struct hid_parser *parser, unsigned type) |
699 | { | 699 | { |
700 | struct hid_device *hid = parser->device; | 700 | struct hid_device *hid = parser->device; |
701 | 701 | ||
702 | if (((parser->global.usage_page << 16) == HID_UP_SENSOR) && | 702 | if (((parser->global.usage_page << 16) == HID_UP_SENSOR) && |
703 | type == HID_COLLECTION_PHYSICAL) | 703 | type == HID_COLLECTION_PHYSICAL) |
704 | hid->group = HID_GROUP_SENSOR_HUB; | 704 | hid->group = HID_GROUP_SENSOR_HUB; |
705 | 705 | ||
706 | if (hid->vendor == USB_VENDOR_ID_MICROSOFT && | 706 | if (hid->vendor == USB_VENDOR_ID_MICROSOFT && |
707 | hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 && | 707 | hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 && |
708 | hid->group == HID_GROUP_MULTITOUCH) | 708 | hid->group == HID_GROUP_MULTITOUCH) |
709 | hid->group = HID_GROUP_GENERIC; | 709 | hid->group = HID_GROUP_GENERIC; |
710 | } | 710 | } |
711 | 711 | ||
712 | static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) | 712 | static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) |
713 | { | 713 | { |
714 | __u32 data; | 714 | __u32 data; |
715 | int i; | 715 | int i; |
716 | 716 | ||
717 | data = item_udata(item); | 717 | data = item_udata(item); |
718 | 718 | ||
719 | switch (item->tag) { | 719 | switch (item->tag) { |
720 | case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: | 720 | case HID_MAIN_ITEM_TAG_BEGIN_COLLECTION: |
721 | hid_scan_collection(parser, data & 0xff); | 721 | hid_scan_collection(parser, data & 0xff); |
722 | break; | 722 | break; |
723 | case HID_MAIN_ITEM_TAG_END_COLLECTION: | 723 | case HID_MAIN_ITEM_TAG_END_COLLECTION: |
724 | break; | 724 | break; |
725 | case HID_MAIN_ITEM_TAG_INPUT: | 725 | case HID_MAIN_ITEM_TAG_INPUT: |
726 | /* ignore constant inputs, they will be ignored by hid-input */ | 726 | /* ignore constant inputs, they will be ignored by hid-input */ |
727 | if (data & HID_MAIN_ITEM_CONSTANT) | 727 | if (data & HID_MAIN_ITEM_CONSTANT) |
728 | break; | 728 | break; |
729 | for (i = 0; i < parser->local.usage_index; i++) | 729 | for (i = 0; i < parser->local.usage_index; i++) |
730 | hid_scan_input_usage(parser, parser->local.usage[i]); | 730 | hid_scan_input_usage(parser, parser->local.usage[i]); |
731 | break; | 731 | break; |
732 | case HID_MAIN_ITEM_TAG_OUTPUT: | 732 | case HID_MAIN_ITEM_TAG_OUTPUT: |
733 | break; | 733 | break; |
734 | case HID_MAIN_ITEM_TAG_FEATURE: | 734 | case HID_MAIN_ITEM_TAG_FEATURE: |
735 | for (i = 0; i < parser->local.usage_index; i++) | 735 | for (i = 0; i < parser->local.usage_index; i++) |
736 | hid_scan_feature_usage(parser, parser->local.usage[i]); | 736 | hid_scan_feature_usage(parser, parser->local.usage[i]); |
737 | break; | 737 | break; |
738 | } | 738 | } |
739 | 739 | ||
740 | /* Reset the local parser environment */ | 740 | /* Reset the local parser environment */ |
741 | memset(&parser->local, 0, sizeof(parser->local)); | 741 | memset(&parser->local, 0, sizeof(parser->local)); |
742 | 742 | ||
743 | return 0; | 743 | return 0; |
744 | } | 744 | } |
745 | 745 | ||
746 | /* | 746 | /* |
747 | * Scan a report descriptor before the device is added to the bus. | 747 | * Scan a report descriptor before the device is added to the bus. |
748 | * Sets device groups and other properties that determine what driver | 748 | * Sets device groups and other properties that determine what driver |
749 | * to load. | 749 | * to load. |
750 | */ | 750 | */ |
751 | static int hid_scan_report(struct hid_device *hid) | 751 | static int hid_scan_report(struct hid_device *hid) |
752 | { | 752 | { |
753 | struct hid_parser *parser; | 753 | struct hid_parser *parser; |
754 | struct hid_item item; | 754 | struct hid_item item; |
755 | __u8 *start = hid->dev_rdesc; | 755 | __u8 *start = hid->dev_rdesc; |
756 | __u8 *end = start + hid->dev_rsize; | 756 | __u8 *end = start + hid->dev_rsize; |
757 | static int (*dispatch_type[])(struct hid_parser *parser, | 757 | static int (*dispatch_type[])(struct hid_parser *parser, |
758 | struct hid_item *item) = { | 758 | struct hid_item *item) = { |
759 | hid_scan_main, | 759 | hid_scan_main, |
760 | hid_parser_global, | 760 | hid_parser_global, |
761 | hid_parser_local, | 761 | hid_parser_local, |
762 | hid_parser_reserved | 762 | hid_parser_reserved |
763 | }; | 763 | }; |
764 | 764 | ||
765 | parser = vzalloc(sizeof(struct hid_parser)); | 765 | parser = vzalloc(sizeof(struct hid_parser)); |
766 | if (!parser) | 766 | if (!parser) |
767 | return -ENOMEM; | 767 | return -ENOMEM; |
768 | 768 | ||
769 | parser->device = hid; | 769 | parser->device = hid; |
770 | hid->group = HID_GROUP_GENERIC; | 770 | hid->group = HID_GROUP_GENERIC; |
771 | 771 | ||
772 | /* | 772 | /* |
773 | * The parsing is simpler than the one in hid_open_report() as we should | 773 | * The parsing is simpler than the one in hid_open_report() as we should |
774 | * be robust against hid errors. Those errors will be raised by | 774 | * be robust against hid errors. Those errors will be raised by |
775 | * hid_open_report() anyway. | 775 | * hid_open_report() anyway. |
776 | */ | 776 | */ |
777 | while ((start = fetch_item(start, end, &item)) != NULL) | 777 | while ((start = fetch_item(start, end, &item)) != NULL) |
778 | dispatch_type[item.type](parser, &item); | 778 | dispatch_type[item.type](parser, &item); |
779 | 779 | ||
780 | /* | 780 | /* |
781 | * Handle special flags set during scanning. | 781 | * Handle special flags set during scanning. |
782 | */ | 782 | */ |
783 | if ((parser->scan_flags & HID_SCAN_FLAG_MT_WIN_8) && | 783 | if ((parser->scan_flags & HID_SCAN_FLAG_MT_WIN_8) && |
784 | (hid->group == HID_GROUP_MULTITOUCH)) | 784 | (hid->group == HID_GROUP_MULTITOUCH)) |
785 | hid->group = HID_GROUP_MULTITOUCH_WIN_8; | 785 | hid->group = HID_GROUP_MULTITOUCH_WIN_8; |
786 | 786 | ||
787 | /* | 787 | /* |
788 | * Vendor specific handlings | 788 | * Vendor specific handlings |
789 | */ | 789 | */ |
790 | switch (hid->vendor) { | 790 | switch (hid->vendor) { |
791 | case USB_VENDOR_ID_WACOM: | 791 | case USB_VENDOR_ID_WACOM: |
792 | hid->group = HID_GROUP_WACOM; | 792 | hid->group = HID_GROUP_WACOM; |
793 | break; | 793 | break; |
794 | case USB_VENDOR_ID_SYNAPTICS: | 794 | case USB_VENDOR_ID_SYNAPTICS: |
795 | if ((hid->group == HID_GROUP_GENERIC) && | 795 | if ((hid->group == HID_GROUP_GENERIC) && |
796 | (hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE)) | 796 | (hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE)) |
797 | /* hid-rmi should only bind to the mouse interface of | 797 | /* hid-rmi should only bind to the mouse interface of |
798 | * composite USB devices */ | 798 | * composite USB devices */ |
799 | hid->group = HID_GROUP_RMI; | 799 | hid->group = HID_GROUP_RMI; |
800 | break; | 800 | break; |
801 | } | 801 | } |
802 | 802 | ||
803 | vfree(parser); | 803 | vfree(parser); |
804 | return 0; | 804 | return 0; |
805 | } | 805 | } |
806 | 806 | ||
807 | /** | 807 | /** |
808 | * hid_parse_report - parse device report | 808 | * hid_parse_report - parse device report |
809 | * | 809 | * |
810 | * @device: hid device | 810 | * @device: hid device |
811 | * @start: report start | 811 | * @start: report start |
812 | * @size: report size | 812 | * @size: report size |
813 | * | 813 | * |
814 | * Allocate the device report as read by the bus driver. This function should | 814 | * Allocate the device report as read by the bus driver. This function should |
815 | * only be called from parse() in ll drivers. | 815 | * only be called from parse() in ll drivers. |
816 | */ | 816 | */ |
817 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size) | 817 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size) |
818 | { | 818 | { |
819 | hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL); | 819 | hid->dev_rdesc = kmemdup(start, size, GFP_KERNEL); |
820 | if (!hid->dev_rdesc) | 820 | if (!hid->dev_rdesc) |
821 | return -ENOMEM; | 821 | return -ENOMEM; |
822 | hid->dev_rsize = size; | 822 | hid->dev_rsize = size; |
823 | return 0; | 823 | return 0; |
824 | } | 824 | } |
825 | EXPORT_SYMBOL_GPL(hid_parse_report); | 825 | EXPORT_SYMBOL_GPL(hid_parse_report); |
826 | 826 | ||
827 | static const char * const hid_report_names[] = { | 827 | static const char * const hid_report_names[] = { |
828 | "HID_INPUT_REPORT", | 828 | "HID_INPUT_REPORT", |
829 | "HID_OUTPUT_REPORT", | 829 | "HID_OUTPUT_REPORT", |
830 | "HID_FEATURE_REPORT", | 830 | "HID_FEATURE_REPORT", |
831 | }; | 831 | }; |
832 | /** | 832 | /** |
833 | * hid_validate_values - validate existing device report's value indexes | 833 | * hid_validate_values - validate existing device report's value indexes |
834 | * | 834 | * |
835 | * @device: hid device | 835 | * @device: hid device |
836 | * @type: which report type to examine | 836 | * @type: which report type to examine |
837 | * @id: which report ID to examine (0 for first) | 837 | * @id: which report ID to examine (0 for first) |
838 | * @field_index: which report field to examine | 838 | * @field_index: which report field to examine |
839 | * @report_counts: expected number of values | 839 | * @report_counts: expected number of values |
840 | * | 840 | * |
841 | * Validate the number of values in a given field of a given report, after | 841 | * Validate the number of values in a given field of a given report, after |
842 | * parsing. | 842 | * parsing. |
843 | */ | 843 | */ |
844 | struct hid_report *hid_validate_values(struct hid_device *hid, | 844 | struct hid_report *hid_validate_values(struct hid_device *hid, |
845 | unsigned int type, unsigned int id, | 845 | unsigned int type, unsigned int id, |
846 | unsigned int field_index, | 846 | unsigned int field_index, |
847 | unsigned int report_counts) | 847 | unsigned int report_counts) |
848 | { | 848 | { |
849 | struct hid_report *report; | 849 | struct hid_report *report; |
850 | 850 | ||
851 | if (type > HID_FEATURE_REPORT) { | 851 | if (type > HID_FEATURE_REPORT) { |
852 | hid_err(hid, "invalid HID report type %u\n", type); | 852 | hid_err(hid, "invalid HID report type %u\n", type); |
853 | return NULL; | 853 | return NULL; |
854 | } | 854 | } |
855 | 855 | ||
856 | if (id >= HID_MAX_IDS) { | 856 | if (id >= HID_MAX_IDS) { |
857 | hid_err(hid, "invalid HID report id %u\n", id); | 857 | hid_err(hid, "invalid HID report id %u\n", id); |
858 | return NULL; | 858 | return NULL; |
859 | } | 859 | } |
860 | 860 | ||
861 | /* | 861 | /* |
862 | * Explicitly not using hid_get_report() here since it depends on | 862 | * Explicitly not using hid_get_report() here since it depends on |
863 | * ->numbered being checked, which may not always be the case when | 863 | * ->numbered being checked, which may not always be the case when |
864 | * drivers go to access report values. | 864 | * drivers go to access report values. |
865 | */ | 865 | */ |
866 | if (id == 0) { | 866 | if (id == 0) { |
867 | /* | 867 | /* |
868 | * Validating on id 0 means we should examine the first | 868 | * Validating on id 0 means we should examine the first |
869 | * report in the list. | 869 | * report in the list. |
870 | */ | 870 | */ |
871 | report = list_entry( | 871 | report = list_entry( |
872 | hid->report_enum[type].report_list.next, | 872 | hid->report_enum[type].report_list.next, |
873 | struct hid_report, list); | 873 | struct hid_report, list); |
874 | } else { | 874 | } else { |
875 | report = hid->report_enum[type].report_id_hash[id]; | 875 | report = hid->report_enum[type].report_id_hash[id]; |
876 | } | 876 | } |
877 | if (!report) { | 877 | if (!report) { |
878 | hid_err(hid, "missing %s %u\n", hid_report_names[type], id); | 878 | hid_err(hid, "missing %s %u\n", hid_report_names[type], id); |
879 | return NULL; | 879 | return NULL; |
880 | } | 880 | } |
881 | if (report->maxfield <= field_index) { | 881 | if (report->maxfield <= field_index) { |
882 | hid_err(hid, "not enough fields in %s %u\n", | 882 | hid_err(hid, "not enough fields in %s %u\n", |
883 | hid_report_names[type], id); | 883 | hid_report_names[type], id); |
884 | return NULL; | 884 | return NULL; |
885 | } | 885 | } |
886 | if (report->field[field_index]->report_count < report_counts) { | 886 | if (report->field[field_index]->report_count < report_counts) { |
887 | hid_err(hid, "not enough values in %s %u field %u\n", | 887 | hid_err(hid, "not enough values in %s %u field %u\n", |
888 | hid_report_names[type], id, field_index); | 888 | hid_report_names[type], id, field_index); |
889 | return NULL; | 889 | return NULL; |
890 | } | 890 | } |
891 | return report; | 891 | return report; |
892 | } | 892 | } |
893 | EXPORT_SYMBOL_GPL(hid_validate_values); | 893 | EXPORT_SYMBOL_GPL(hid_validate_values); |
894 | 894 | ||
895 | /** | 895 | /** |
896 | * hid_open_report - open a driver-specific device report | 896 | * hid_open_report - open a driver-specific device report |
897 | * | 897 | * |
898 | * @device: hid device | 898 | * @device: hid device |
899 | * | 899 | * |
900 | * Parse a report description into a hid_device structure. Reports are | 900 | * Parse a report description into a hid_device structure. Reports are |
901 | * enumerated, fields are attached to these reports. | 901 | * enumerated, fields are attached to these reports. |
902 | * 0 returned on success, otherwise nonzero error value. | 902 | * 0 returned on success, otherwise nonzero error value. |
903 | * | 903 | * |
904 | * This function (or the equivalent hid_parse() macro) should only be | 904 | * This function (or the equivalent hid_parse() macro) should only be |
905 | * called from probe() in drivers, before starting the device. | 905 | * called from probe() in drivers, before starting the device. |
906 | */ | 906 | */ |
907 | int hid_open_report(struct hid_device *device) | 907 | int hid_open_report(struct hid_device *device) |
908 | { | 908 | { |
909 | struct hid_parser *parser; | 909 | struct hid_parser *parser; |
910 | struct hid_item item; | 910 | struct hid_item item; |
911 | unsigned int size; | 911 | unsigned int size; |
912 | __u8 *start; | 912 | __u8 *start; |
913 | __u8 *buf; | 913 | __u8 *buf; |
914 | __u8 *end; | 914 | __u8 *end; |
915 | int ret; | 915 | int ret; |
916 | static int (*dispatch_type[])(struct hid_parser *parser, | 916 | static int (*dispatch_type[])(struct hid_parser *parser, |
917 | struct hid_item *item) = { | 917 | struct hid_item *item) = { |
918 | hid_parser_main, | 918 | hid_parser_main, |
919 | hid_parser_global, | 919 | hid_parser_global, |
920 | hid_parser_local, | 920 | hid_parser_local, |
921 | hid_parser_reserved | 921 | hid_parser_reserved |
922 | }; | 922 | }; |
923 | 923 | ||
924 | if (WARN_ON(device->status & HID_STAT_PARSED)) | 924 | if (WARN_ON(device->status & HID_STAT_PARSED)) |
925 | return -EBUSY; | 925 | return -EBUSY; |
926 | 926 | ||
927 | start = device->dev_rdesc; | 927 | start = device->dev_rdesc; |
928 | if (WARN_ON(!start)) | 928 | if (WARN_ON(!start)) |
929 | return -ENODEV; | 929 | return -ENODEV; |
930 | size = device->dev_rsize; | 930 | size = device->dev_rsize; |
931 | 931 | ||
932 | buf = kmemdup(start, size, GFP_KERNEL); | 932 | buf = kmemdup(start, size, GFP_KERNEL); |
933 | if (buf == NULL) | 933 | if (buf == NULL) |
934 | return -ENOMEM; | 934 | return -ENOMEM; |
935 | 935 | ||
936 | if (device->driver->report_fixup) | 936 | if (device->driver->report_fixup) |
937 | start = device->driver->report_fixup(device, buf, &size); | 937 | start = device->driver->report_fixup(device, buf, &size); |
938 | else | 938 | else |
939 | start = buf; | 939 | start = buf; |
940 | 940 | ||
941 | start = kmemdup(start, size, GFP_KERNEL); | 941 | start = kmemdup(start, size, GFP_KERNEL); |
942 | kfree(buf); | 942 | kfree(buf); |
943 | if (start == NULL) | 943 | if (start == NULL) |
944 | return -ENOMEM; | 944 | return -ENOMEM; |
945 | 945 | ||
946 | device->rdesc = start; | 946 | device->rdesc = start; |
947 | device->rsize = size; | 947 | device->rsize = size; |
948 | 948 | ||
949 | parser = vzalloc(sizeof(struct hid_parser)); | 949 | parser = vzalloc(sizeof(struct hid_parser)); |
950 | if (!parser) { | 950 | if (!parser) { |
951 | ret = -ENOMEM; | 951 | ret = -ENOMEM; |
952 | goto err; | 952 | goto err; |
953 | } | 953 | } |
954 | 954 | ||
955 | parser->device = device; | 955 | parser->device = device; |
956 | 956 | ||
957 | end = start + size; | 957 | end = start + size; |
958 | 958 | ||
959 | device->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS, | 959 | device->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS, |
960 | sizeof(struct hid_collection), GFP_KERNEL); | 960 | sizeof(struct hid_collection), GFP_KERNEL); |
961 | if (!device->collection) { | 961 | if (!device->collection) { |
962 | ret = -ENOMEM; | 962 | ret = -ENOMEM; |
963 | goto err; | 963 | goto err; |
964 | } | 964 | } |
965 | device->collection_size = HID_DEFAULT_NUM_COLLECTIONS; | 965 | device->collection_size = HID_DEFAULT_NUM_COLLECTIONS; |
966 | 966 | ||
967 | ret = -EINVAL; | 967 | ret = -EINVAL; |
968 | while ((start = fetch_item(start, end, &item)) != NULL) { | 968 | while ((start = fetch_item(start, end, &item)) != NULL) { |
969 | 969 | ||
970 | if (item.format != HID_ITEM_FORMAT_SHORT) { | 970 | if (item.format != HID_ITEM_FORMAT_SHORT) { |
971 | hid_err(device, "unexpected long global item\n"); | 971 | hid_err(device, "unexpected long global item\n"); |
972 | goto err; | 972 | goto err; |
973 | } | 973 | } |
974 | 974 | ||
975 | if (dispatch_type[item.type](parser, &item)) { | 975 | if (dispatch_type[item.type](parser, &item)) { |
976 | hid_err(device, "item %u %u %u %u parsing failed\n", | 976 | hid_err(device, "item %u %u %u %u parsing failed\n", |
977 | item.format, (unsigned)item.size, | 977 | item.format, (unsigned)item.size, |
978 | (unsigned)item.type, (unsigned)item.tag); | 978 | (unsigned)item.type, (unsigned)item.tag); |
979 | goto err; | 979 | goto err; |
980 | } | 980 | } |
981 | 981 | ||
982 | if (start == end) { | 982 | if (start == end) { |
983 | if (parser->collection_stack_ptr) { | 983 | if (parser->collection_stack_ptr) { |
984 | hid_err(device, "unbalanced collection at end of report description\n"); | 984 | hid_err(device, "unbalanced collection at end of report description\n"); |
985 | goto err; | 985 | goto err; |
986 | } | 986 | } |
987 | if (parser->local.delimiter_depth) { | 987 | if (parser->local.delimiter_depth) { |
988 | hid_err(device, "unbalanced delimiter at end of report description\n"); | 988 | hid_err(device, "unbalanced delimiter at end of report description\n"); |
989 | goto err; | 989 | goto err; |
990 | } | 990 | } |
991 | vfree(parser); | 991 | vfree(parser); |
992 | device->status |= HID_STAT_PARSED; | 992 | device->status |= HID_STAT_PARSED; |
993 | return 0; | 993 | return 0; |
994 | } | 994 | } |
995 | } | 995 | } |
996 | 996 | ||
997 | hid_err(device, "item fetching failed at offset %d\n", (int)(end - start)); | 997 | hid_err(device, "item fetching failed at offset %d\n", (int)(end - start)); |
998 | err: | 998 | err: |
999 | vfree(parser); | 999 | vfree(parser); |
1000 | hid_close_report(device); | 1000 | hid_close_report(device); |
1001 | return ret; | 1001 | return ret; |
1002 | } | 1002 | } |
1003 | EXPORT_SYMBOL_GPL(hid_open_report); | 1003 | EXPORT_SYMBOL_GPL(hid_open_report); |
1004 | 1004 | ||
1005 | /* | 1005 | /* |
1006 | * Convert a signed n-bit integer to signed 32-bit integer. Common | 1006 | * Convert a signed n-bit integer to signed 32-bit integer. Common |
1007 | * cases are done through the compiler, the screwed things has to be | 1007 | * cases are done through the compiler, the screwed things has to be |
1008 | * done by hand. | 1008 | * done by hand. |
1009 | */ | 1009 | */ |
1010 | 1010 | ||
1011 | static s32 snto32(__u32 value, unsigned n) | 1011 | static s32 snto32(__u32 value, unsigned n) |
1012 | { | 1012 | { |
1013 | switch (n) { | 1013 | switch (n) { |
1014 | case 8: return ((__s8)value); | 1014 | case 8: return ((__s8)value); |
1015 | case 16: return ((__s16)value); | 1015 | case 16: return ((__s16)value); |
1016 | case 32: return ((__s32)value); | 1016 | case 32: return ((__s32)value); |
1017 | } | 1017 | } |
1018 | return value & (1 << (n - 1)) ? value | (-1 << n) : value; | 1018 | return value & (1 << (n - 1)) ? value | (-1 << n) : value; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | s32 hid_snto32(__u32 value, unsigned n) | 1021 | s32 hid_snto32(__u32 value, unsigned n) |
1022 | { | 1022 | { |
1023 | return snto32(value, n); | 1023 | return snto32(value, n); |
1024 | } | 1024 | } |
1025 | EXPORT_SYMBOL_GPL(hid_snto32); | 1025 | EXPORT_SYMBOL_GPL(hid_snto32); |
1026 | 1026 | ||
1027 | /* | 1027 | /* |
1028 | * Convert a signed 32-bit integer to a signed n-bit integer. | 1028 | * Convert a signed 32-bit integer to a signed n-bit integer. |
1029 | */ | 1029 | */ |
1030 | 1030 | ||
1031 | static u32 s32ton(__s32 value, unsigned n) | 1031 | static u32 s32ton(__s32 value, unsigned n) |
1032 | { | 1032 | { |
1033 | s32 a = value >> (n - 1); | 1033 | s32 a = value >> (n - 1); |
1034 | if (a && a != -1) | 1034 | if (a && a != -1) |
1035 | return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; | 1035 | return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; |
1036 | return value & ((1 << n) - 1); | 1036 | return value & ((1 << n) - 1); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | /* | 1039 | /* |
1040 | * Extract/implement a data field from/to a little endian report (bit array). | 1040 | * Extract/implement a data field from/to a little endian report (bit array). |
1041 | * | 1041 | * |
1042 | * Code sort-of follows HID spec: | 1042 | * Code sort-of follows HID spec: |
1043 | * http://www.usb.org/developers/devclass_docs/HID1_11.pdf | 1043 | * http://www.usb.org/developers/devclass_docs/HID1_11.pdf |
1044 | * | 1044 | * |
1045 | * While the USB HID spec allows unlimited length bit fields in "report | 1045 | * While the USB HID spec allows unlimited length bit fields in "report |
1046 | * descriptors", most devices never use more than 16 bits. | 1046 | * descriptors", most devices never use more than 16 bits. |
1047 | * One model of UPS is claimed to report "LINEV" as a 32-bit field. | 1047 | * One model of UPS is claimed to report "LINEV" as a 32-bit field. |
1048 | * Search linux-kernel and linux-usb-devel archives for "hid-core extract". | 1048 | * Search linux-kernel and linux-usb-devel archives for "hid-core extract". |
1049 | */ | 1049 | */ |
1050 | 1050 | ||
1051 | static __u32 extract(const struct hid_device *hid, __u8 *report, | 1051 | static __u32 extract(const struct hid_device *hid, __u8 *report, |
1052 | unsigned offset, unsigned n) | 1052 | unsigned offset, unsigned n) |
1053 | { | 1053 | { |
1054 | u64 x; | 1054 | u64 x; |
1055 | 1055 | ||
1056 | if (n > 32) | 1056 | if (n > 32) |
1057 | hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n", | 1057 | hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n", |
1058 | n, current->comm); | 1058 | n, current->comm); |
1059 | 1059 | ||
1060 | report += offset >> 3; /* adjust byte index */ | 1060 | report += offset >> 3; /* adjust byte index */ |
1061 | offset &= 7; /* now only need bit offset into one byte */ | 1061 | offset &= 7; /* now only need bit offset into one byte */ |
1062 | x = get_unaligned_le64(report); | 1062 | x = get_unaligned_le64(report); |
1063 | x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ | 1063 | x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ |
1064 | return (u32) x; | 1064 | return (u32) x; |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | /* | 1067 | /* |
1068 | * "implement" : set bits in a little endian bit stream. | 1068 | * "implement" : set bits in a little endian bit stream. |
1069 | * Same concepts as "extract" (see comments above). | 1069 | * Same concepts as "extract" (see comments above). |
1070 | * The data mangled in the bit stream remains in little endian | 1070 | * The data mangled in the bit stream remains in little endian |
1071 | * order the whole time. It make more sense to talk about | 1071 | * order the whole time. It make more sense to talk about |
1072 | * endianness of register values by considering a register | 1072 | * endianness of register values by considering a register |
1073 | * a "cached" copy of the little endiad bit stream. | 1073 | * a "cached" copy of the little endiad bit stream. |
1074 | */ | 1074 | */ |
1075 | static void implement(const struct hid_device *hid, __u8 *report, | 1075 | static void implement(const struct hid_device *hid, __u8 *report, |
1076 | unsigned offset, unsigned n, __u32 value) | 1076 | unsigned offset, unsigned n, __u32 value) |
1077 | { | 1077 | { |
1078 | u64 x; | 1078 | u64 x; |
1079 | u64 m = (1ULL << n) - 1; | 1079 | u64 m = (1ULL << n) - 1; |
1080 | 1080 | ||
1081 | if (n > 32) | 1081 | if (n > 32) |
1082 | hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", | 1082 | hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n", |
1083 | __func__, n, current->comm); | 1083 | __func__, n, current->comm); |
1084 | 1084 | ||
1085 | if (value > m) | 1085 | if (value > m) |
1086 | hid_warn(hid, "%s() called with too large value %d! (%s)\n", | 1086 | hid_warn(hid, "%s() called with too large value %d! (%s)\n", |
1087 | __func__, value, current->comm); | 1087 | __func__, value, current->comm); |
1088 | WARN_ON(value > m); | 1088 | WARN_ON(value > m); |
1089 | value &= m; | 1089 | value &= m; |
1090 | 1090 | ||
1091 | report += offset >> 3; | 1091 | report += offset >> 3; |
1092 | offset &= 7; | 1092 | offset &= 7; |
1093 | 1093 | ||
1094 | x = get_unaligned_le64(report); | 1094 | x = get_unaligned_le64(report); |
1095 | x &= ~(m << offset); | 1095 | x &= ~(m << offset); |
1096 | x |= ((u64)value) << offset; | 1096 | x |= ((u64)value) << offset; |
1097 | put_unaligned_le64(x, report); | 1097 | put_unaligned_le64(x, report); |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | /* | 1100 | /* |
1101 | * Search an array for a value. | 1101 | * Search an array for a value. |
1102 | */ | 1102 | */ |
1103 | 1103 | ||
1104 | static int search(__s32 *array, __s32 value, unsigned n) | 1104 | static int search(__s32 *array, __s32 value, unsigned n) |
1105 | { | 1105 | { |
1106 | while (n--) { | 1106 | while (n--) { |
1107 | if (*array++ == value) | 1107 | if (*array++ == value) |
1108 | return 0; | 1108 | return 0; |
1109 | } | 1109 | } |
1110 | return -1; | 1110 | return -1; |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | /** | 1113 | /** |
1114 | * hid_match_report - check if driver's raw_event should be called | 1114 | * hid_match_report - check if driver's raw_event should be called |
1115 | * | 1115 | * |
1116 | * @hid: hid device | 1116 | * @hid: hid device |
1117 | * @report_type: type to match against | 1117 | * @report_type: type to match against |
1118 | * | 1118 | * |
1119 | * compare hid->driver->report_table->report_type to report->type | 1119 | * compare hid->driver->report_table->report_type to report->type |
1120 | */ | 1120 | */ |
1121 | static int hid_match_report(struct hid_device *hid, struct hid_report *report) | 1121 | static int hid_match_report(struct hid_device *hid, struct hid_report *report) |
1122 | { | 1122 | { |
1123 | const struct hid_report_id *id = hid->driver->report_table; | 1123 | const struct hid_report_id *id = hid->driver->report_table; |
1124 | 1124 | ||
1125 | if (!id) /* NULL means all */ | 1125 | if (!id) /* NULL means all */ |
1126 | return 1; | 1126 | return 1; |
1127 | 1127 | ||
1128 | for (; id->report_type != HID_TERMINATOR; id++) | 1128 | for (; id->report_type != HID_TERMINATOR; id++) |
1129 | if (id->report_type == HID_ANY_ID || | 1129 | if (id->report_type == HID_ANY_ID || |
1130 | id->report_type == report->type) | 1130 | id->report_type == report->type) |
1131 | return 1; | 1131 | return 1; |
1132 | return 0; | 1132 | return 0; |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | /** | 1135 | /** |
1136 | * hid_match_usage - check if driver's event should be called | 1136 | * hid_match_usage - check if driver's event should be called |
1137 | * | 1137 | * |
1138 | * @hid: hid device | 1138 | * @hid: hid device |
1139 | * @usage: usage to match against | 1139 | * @usage: usage to match against |
1140 | * | 1140 | * |
1141 | * compare hid->driver->usage_table->usage_{type,code} to | 1141 | * compare hid->driver->usage_table->usage_{type,code} to |
1142 | * usage->usage_{type,code} | 1142 | * usage->usage_{type,code} |
1143 | */ | 1143 | */ |
1144 | static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) | 1144 | static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage) |
1145 | { | 1145 | { |
1146 | const struct hid_usage_id *id = hid->driver->usage_table; | 1146 | const struct hid_usage_id *id = hid->driver->usage_table; |
1147 | 1147 | ||
1148 | if (!id) /* NULL means all */ | 1148 | if (!id) /* NULL means all */ |
1149 | return 1; | 1149 | return 1; |
1150 | 1150 | ||
1151 | for (; id->usage_type != HID_ANY_ID - 1; id++) | 1151 | for (; id->usage_type != HID_ANY_ID - 1; id++) |
1152 | if ((id->usage_hid == HID_ANY_ID || | 1152 | if ((id->usage_hid == HID_ANY_ID || |
1153 | id->usage_hid == usage->hid) && | 1153 | id->usage_hid == usage->hid) && |
1154 | (id->usage_type == HID_ANY_ID || | 1154 | (id->usage_type == HID_ANY_ID || |
1155 | id->usage_type == usage->type) && | 1155 | id->usage_type == usage->type) && |
1156 | (id->usage_code == HID_ANY_ID || | 1156 | (id->usage_code == HID_ANY_ID || |
1157 | id->usage_code == usage->code)) | 1157 | id->usage_code == usage->code)) |
1158 | return 1; | 1158 | return 1; |
1159 | return 0; | 1159 | return 0; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, | 1162 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, |
1163 | struct hid_usage *usage, __s32 value, int interrupt) | 1163 | struct hid_usage *usage, __s32 value, int interrupt) |
1164 | { | 1164 | { |
1165 | struct hid_driver *hdrv = hid->driver; | 1165 | struct hid_driver *hdrv = hid->driver; |
1166 | int ret; | 1166 | int ret; |
1167 | 1167 | ||
1168 | if (!list_empty(&hid->debug_list)) | 1168 | if (!list_empty(&hid->debug_list)) |
1169 | hid_dump_input(hid, usage, value); | 1169 | hid_dump_input(hid, usage, value); |
1170 | 1170 | ||
1171 | if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { | 1171 | if (hdrv && hdrv->event && hid_match_usage(hid, usage)) { |
1172 | ret = hdrv->event(hid, field, usage, value); | 1172 | ret = hdrv->event(hid, field, usage, value); |
1173 | if (ret != 0) { | 1173 | if (ret != 0) { |
1174 | if (ret < 0) | 1174 | if (ret < 0) |
1175 | hid_err(hid, "%s's event failed with %d\n", | 1175 | hid_err(hid, "%s's event failed with %d\n", |
1176 | hdrv->name, ret); | 1176 | hdrv->name, ret); |
1177 | return; | 1177 | return; |
1178 | } | 1178 | } |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | if (hid->claimed & HID_CLAIMED_INPUT) | 1181 | if (hid->claimed & HID_CLAIMED_INPUT) |
1182 | hidinput_hid_event(hid, field, usage, value); | 1182 | hidinput_hid_event(hid, field, usage, value); |
1183 | if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) | 1183 | if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt && hid->hiddev_hid_event) |
1184 | hid->hiddev_hid_event(hid, field, usage, value); | 1184 | hid->hiddev_hid_event(hid, field, usage, value); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | /* | 1187 | /* |
1188 | * Analyse a received field, and fetch the data from it. The field | 1188 | * Analyse a received field, and fetch the data from it. The field |
1189 | * content is stored for next report processing (we do differential | 1189 | * content is stored for next report processing (we do differential |
1190 | * reporting to the layer). | 1190 | * reporting to the layer). |
1191 | */ | 1191 | */ |
1192 | 1192 | ||
1193 | static void hid_input_field(struct hid_device *hid, struct hid_field *field, | 1193 | static void hid_input_field(struct hid_device *hid, struct hid_field *field, |
1194 | __u8 *data, int interrupt) | 1194 | __u8 *data, int interrupt) |
1195 | { | 1195 | { |
1196 | unsigned n; | 1196 | unsigned n; |
1197 | unsigned count = field->report_count; | 1197 | unsigned count = field->report_count; |
1198 | unsigned offset = field->report_offset; | 1198 | unsigned offset = field->report_offset; |
1199 | unsigned size = field->report_size; | 1199 | unsigned size = field->report_size; |
1200 | __s32 min = field->logical_minimum; | 1200 | __s32 min = field->logical_minimum; |
1201 | __s32 max = field->logical_maximum; | 1201 | __s32 max = field->logical_maximum; |
1202 | __s32 *value; | 1202 | __s32 *value; |
1203 | 1203 | ||
1204 | value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC); | 1204 | value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC); |
1205 | if (!value) | 1205 | if (!value) |
1206 | return; | 1206 | return; |
1207 | 1207 | ||
1208 | for (n = 0; n < count; n++) { | 1208 | for (n = 0; n < count; n++) { |
1209 | 1209 | ||
1210 | value[n] = min < 0 ? | 1210 | value[n] = min < 0 ? |
1211 | snto32(extract(hid, data, offset + n * size, size), | 1211 | snto32(extract(hid, data, offset + n * size, size), |
1212 | size) : | 1212 | size) : |
1213 | extract(hid, data, offset + n * size, size); | 1213 | extract(hid, data, offset + n * size, size); |
1214 | 1214 | ||
1215 | /* Ignore report if ErrorRollOver */ | 1215 | /* Ignore report if ErrorRollOver */ |
1216 | if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && | 1216 | if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && |
1217 | value[n] >= min && value[n] <= max && | 1217 | value[n] >= min && value[n] <= max && |
1218 | field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) | 1218 | field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) |
1219 | goto exit; | 1219 | goto exit; |
1220 | } | 1220 | } |
1221 | 1221 | ||
1222 | for (n = 0; n < count; n++) { | 1222 | for (n = 0; n < count; n++) { |
1223 | 1223 | ||
1224 | if (HID_MAIN_ITEM_VARIABLE & field->flags) { | 1224 | if (HID_MAIN_ITEM_VARIABLE & field->flags) { |
1225 | hid_process_event(hid, field, &field->usage[n], value[n], interrupt); | 1225 | hid_process_event(hid, field, &field->usage[n], value[n], interrupt); |
1226 | continue; | 1226 | continue; |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | if (field->value[n] >= min && field->value[n] <= max | 1229 | if (field->value[n] >= min && field->value[n] <= max |
1230 | && field->usage[field->value[n] - min].hid | 1230 | && field->usage[field->value[n] - min].hid |
1231 | && search(value, field->value[n], count)) | 1231 | && search(value, field->value[n], count)) |
1232 | hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); | 1232 | hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); |
1233 | 1233 | ||
1234 | if (value[n] >= min && value[n] <= max | 1234 | if (value[n] >= min && value[n] <= max |
1235 | && field->usage[value[n] - min].hid | 1235 | && field->usage[value[n] - min].hid |
1236 | && search(field->value, value[n], count)) | 1236 | && search(field->value, value[n], count)) |
1237 | hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); | 1237 | hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | memcpy(field->value, value, count * sizeof(__s32)); | 1240 | memcpy(field->value, value, count * sizeof(__s32)); |
1241 | exit: | 1241 | exit: |
1242 | kfree(value); | 1242 | kfree(value); |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | /* | 1245 | /* |
1246 | * Output the field into the report. | 1246 | * Output the field into the report. |
1247 | */ | 1247 | */ |
1248 | 1248 | ||
1249 | static void hid_output_field(const struct hid_device *hid, | 1249 | static void hid_output_field(const struct hid_device *hid, |
1250 | struct hid_field *field, __u8 *data) | 1250 | struct hid_field *field, __u8 *data) |
1251 | { | 1251 | { |
1252 | unsigned count = field->report_count; | 1252 | unsigned count = field->report_count; |
1253 | unsigned offset = field->report_offset; | 1253 | unsigned offset = field->report_offset; |
1254 | unsigned size = field->report_size; | 1254 | unsigned size = field->report_size; |
1255 | unsigned n; | 1255 | unsigned n; |
1256 | 1256 | ||
1257 | for (n = 0; n < count; n++) { | 1257 | for (n = 0; n < count; n++) { |
1258 | if (field->logical_minimum < 0) /* signed values */ | 1258 | if (field->logical_minimum < 0) /* signed values */ |
1259 | implement(hid, data, offset + n * size, size, | 1259 | implement(hid, data, offset + n * size, size, |
1260 | s32ton(field->value[n], size)); | 1260 | s32ton(field->value[n], size)); |
1261 | else /* unsigned values */ | 1261 | else /* unsigned values */ |
1262 | implement(hid, data, offset + n * size, size, | 1262 | implement(hid, data, offset + n * size, size, |
1263 | field->value[n]); | 1263 | field->value[n]); |
1264 | } | 1264 | } |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | /* | 1267 | /* |
1268 | * Create a report. 'data' has to be allocated using | 1268 | * Create a report. 'data' has to be allocated using |
1269 | * hid_alloc_report_buf() so that it has proper size. | 1269 | * hid_alloc_report_buf() so that it has proper size. |
1270 | */ | 1270 | */ |
1271 | 1271 | ||
1272 | void hid_output_report(struct hid_report *report, __u8 *data) | 1272 | void hid_output_report(struct hid_report *report, __u8 *data) |
1273 | { | 1273 | { |
1274 | unsigned n; | 1274 | unsigned n; |
1275 | 1275 | ||
1276 | if (report->id > 0) | 1276 | if (report->id > 0) |
1277 | *data++ = report->id; | 1277 | *data++ = report->id; |
1278 | 1278 | ||
1279 | memset(data, 0, ((report->size - 1) >> 3) + 1); | 1279 | memset(data, 0, ((report->size - 1) >> 3) + 1); |
1280 | for (n = 0; n < report->maxfield; n++) | 1280 | for (n = 0; n < report->maxfield; n++) |
1281 | hid_output_field(report->device, report->field[n], data); | 1281 | hid_output_field(report->device, report->field[n], data); |
1282 | } | 1282 | } |
1283 | EXPORT_SYMBOL_GPL(hid_output_report); | 1283 | EXPORT_SYMBOL_GPL(hid_output_report); |
1284 | 1284 | ||
1285 | /* | 1285 | /* |
1286 | * Allocator for buffer that is going to be passed to hid_output_report() | 1286 | * Allocator for buffer that is going to be passed to hid_output_report() |
1287 | */ | 1287 | */ |
1288 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags) | 1288 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags) |
1289 | { | 1289 | { |
1290 | /* | 1290 | /* |
1291 | * 7 extra bytes are necessary to achieve proper functionality | 1291 | * 7 extra bytes are necessary to achieve proper functionality |
1292 | * of implement() working on 8 byte chunks | 1292 | * of implement() working on 8 byte chunks |
1293 | */ | 1293 | */ |
1294 | 1294 | ||
1295 | int len = hid_report_len(report) + 7; | 1295 | int len = hid_report_len(report) + 7; |
1296 | 1296 | ||
1297 | return kmalloc(len, flags); | 1297 | return kmalloc(len, flags); |
1298 | } | 1298 | } |
1299 | EXPORT_SYMBOL_GPL(hid_alloc_report_buf); | 1299 | EXPORT_SYMBOL_GPL(hid_alloc_report_buf); |
1300 | 1300 | ||
1301 | /* | 1301 | /* |
1302 | * Set a field value. The report this field belongs to has to be | 1302 | * Set a field value. The report this field belongs to has to be |
1303 | * created and transferred to the device, to set this value in the | 1303 | * created and transferred to the device, to set this value in the |
1304 | * device. | 1304 | * device. |
1305 | */ | 1305 | */ |
1306 | 1306 | ||
1307 | int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) | 1307 | int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) |
1308 | { | 1308 | { |
1309 | unsigned size; | 1309 | unsigned size; |
1310 | 1310 | ||
1311 | if (!field) | 1311 | if (!field) |
1312 | return -1; | 1312 | return -1; |
1313 | 1313 | ||
1314 | size = field->report_size; | 1314 | size = field->report_size; |
1315 | 1315 | ||
1316 | hid_dump_input(field->report->device, field->usage + offset, value); | 1316 | hid_dump_input(field->report->device, field->usage + offset, value); |
1317 | 1317 | ||
1318 | if (offset >= field->report_count) { | 1318 | if (offset >= field->report_count) { |
1319 | hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n", | 1319 | hid_err(field->report->device, "offset (%d) exceeds report_count (%d)\n", |
1320 | offset, field->report_count); | 1320 | offset, field->report_count); |
1321 | return -1; | 1321 | return -1; |
1322 | } | 1322 | } |
1323 | if (field->logical_minimum < 0) { | 1323 | if (field->logical_minimum < 0) { |
1324 | if (value != snto32(s32ton(value, size), size)) { | 1324 | if (value != snto32(s32ton(value, size), size)) { |
1325 | hid_err(field->report->device, "value %d is out of range\n", value); | 1325 | hid_err(field->report->device, "value %d is out of range\n", value); |
1326 | return -1; | 1326 | return -1; |
1327 | } | 1327 | } |
1328 | } | 1328 | } |
1329 | field->value[offset] = value; | 1329 | field->value[offset] = value; |
1330 | return 0; | 1330 | return 0; |
1331 | } | 1331 | } |
1332 | EXPORT_SYMBOL_GPL(hid_set_field); | 1332 | EXPORT_SYMBOL_GPL(hid_set_field); |
1333 | 1333 | ||
1334 | static struct hid_report *hid_get_report(struct hid_report_enum *report_enum, | 1334 | static struct hid_report *hid_get_report(struct hid_report_enum *report_enum, |
1335 | const u8 *data) | 1335 | const u8 *data) |
1336 | { | 1336 | { |
1337 | struct hid_report *report; | 1337 | struct hid_report *report; |
1338 | unsigned int n = 0; /* Normally report number is 0 */ | 1338 | unsigned int n = 0; /* Normally report number is 0 */ |
1339 | 1339 | ||
1340 | /* Device uses numbered reports, data[0] is report number */ | 1340 | /* Device uses numbered reports, data[0] is report number */ |
1341 | if (report_enum->numbered) | 1341 | if (report_enum->numbered) |
1342 | n = *data; | 1342 | n = *data; |
1343 | 1343 | ||
1344 | report = report_enum->report_id_hash[n]; | 1344 | report = report_enum->report_id_hash[n]; |
1345 | if (report == NULL) | 1345 | if (report == NULL) |
1346 | dbg_hid("undefined report_id %u received\n", n); | 1346 | dbg_hid("undefined report_id %u received\n", n); |
1347 | 1347 | ||
1348 | return report; | 1348 | return report; |
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | /* | 1351 | /* |
1352 | * Implement a generic .request() callback, using .raw_request() | 1352 | * Implement a generic .request() callback, using .raw_request() |
1353 | * DO NOT USE in hid drivers directly, but through hid_hw_request instead. | 1353 | * DO NOT USE in hid drivers directly, but through hid_hw_request instead. |
1354 | */ | 1354 | */ |
1355 | void __hid_request(struct hid_device *hid, struct hid_report *report, | 1355 | void __hid_request(struct hid_device *hid, struct hid_report *report, |
1356 | int reqtype) | 1356 | int reqtype) |
1357 | { | 1357 | { |
1358 | char *buf; | 1358 | char *buf; |
1359 | int ret; | 1359 | int ret; |
1360 | int len; | 1360 | int len; |
1361 | 1361 | ||
1362 | buf = hid_alloc_report_buf(report, GFP_KERNEL); | 1362 | buf = hid_alloc_report_buf(report, GFP_KERNEL); |
1363 | if (!buf) | 1363 | if (!buf) |
1364 | return; | 1364 | return; |
1365 | 1365 | ||
1366 | len = hid_report_len(report); | 1366 | len = hid_report_len(report); |
1367 | 1367 | ||
1368 | if (reqtype == HID_REQ_SET_REPORT) | 1368 | if (reqtype == HID_REQ_SET_REPORT) |
1369 | hid_output_report(report, buf); | 1369 | hid_output_report(report, buf); |
1370 | 1370 | ||
1371 | ret = hid->ll_driver->raw_request(hid, report->id, buf, len, | 1371 | ret = hid->ll_driver->raw_request(hid, report->id, buf, len, |
1372 | report->type, reqtype); | 1372 | report->type, reqtype); |
1373 | if (ret < 0) { | 1373 | if (ret < 0) { |
1374 | dbg_hid("unable to complete request: %d\n", ret); | 1374 | dbg_hid("unable to complete request: %d\n", ret); |
1375 | goto out; | 1375 | goto out; |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | if (reqtype == HID_REQ_GET_REPORT) | 1378 | if (reqtype == HID_REQ_GET_REPORT) |
1379 | hid_input_report(hid, report->type, buf, ret, 0); | 1379 | hid_input_report(hid, report->type, buf, ret, 0); |
1380 | 1380 | ||
1381 | out: | 1381 | out: |
1382 | kfree(buf); | 1382 | kfree(buf); |
1383 | } | 1383 | } |
1384 | EXPORT_SYMBOL_GPL(__hid_request); | 1384 | EXPORT_SYMBOL_GPL(__hid_request); |
1385 | 1385 | ||
1386 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | 1386 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
1387 | int interrupt) | 1387 | int interrupt) |
1388 | { | 1388 | { |
1389 | struct hid_report_enum *report_enum = hid->report_enum + type; | 1389 | struct hid_report_enum *report_enum = hid->report_enum + type; |
1390 | struct hid_report *report; | 1390 | struct hid_report *report; |
1391 | struct hid_driver *hdrv; | 1391 | struct hid_driver *hdrv; |
1392 | unsigned int a; | 1392 | unsigned int a; |
1393 | int rsize, csize = size; | 1393 | int rsize, csize = size; |
1394 | u8 *cdata = data; | 1394 | u8 *cdata = data; |
1395 | int ret = 0; | 1395 | int ret = 0; |
1396 | 1396 | ||
1397 | report = hid_get_report(report_enum, data); | 1397 | report = hid_get_report(report_enum, data); |
1398 | if (!report) | 1398 | if (!report) |
1399 | goto out; | 1399 | goto out; |
1400 | 1400 | ||
1401 | if (report_enum->numbered) { | 1401 | if (report_enum->numbered) { |
1402 | cdata++; | 1402 | cdata++; |
1403 | csize--; | 1403 | csize--; |
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | rsize = ((report->size - 1) >> 3) + 1; | 1406 | rsize = ((report->size - 1) >> 3) + 1; |
1407 | 1407 | ||
1408 | if (rsize > HID_MAX_BUFFER_SIZE) | 1408 | if (rsize > HID_MAX_BUFFER_SIZE) |
1409 | rsize = HID_MAX_BUFFER_SIZE; | 1409 | rsize = HID_MAX_BUFFER_SIZE; |
1410 | 1410 | ||
1411 | if (csize < rsize) { | 1411 | if (csize < rsize) { |
1412 | dbg_hid("report %d is too short, (%d < %d)\n", report->id, | 1412 | dbg_hid("report %d is too short, (%d < %d)\n", report->id, |
1413 | csize, rsize); | 1413 | csize, rsize); |
1414 | memset(cdata + csize, 0, rsize - csize); | 1414 | memset(cdata + csize, 0, rsize - csize); |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) | 1417 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) |
1418 | hid->hiddev_report_event(hid, report); | 1418 | hid->hiddev_report_event(hid, report); |
1419 | if (hid->claimed & HID_CLAIMED_HIDRAW) { | 1419 | if (hid->claimed & HID_CLAIMED_HIDRAW) { |
1420 | ret = hidraw_report_event(hid, data, size); | 1420 | ret = hidraw_report_event(hid, data, size); |
1421 | if (ret) | 1421 | if (ret) |
1422 | goto out; | 1422 | goto out; |
1423 | } | 1423 | } |
1424 | 1424 | ||
1425 | if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { | 1425 | if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) { |
1426 | for (a = 0; a < report->maxfield; a++) | 1426 | for (a = 0; a < report->maxfield; a++) |
1427 | hid_input_field(hid, report->field[a], cdata, interrupt); | 1427 | hid_input_field(hid, report->field[a], cdata, interrupt); |
1428 | hdrv = hid->driver; | 1428 | hdrv = hid->driver; |
1429 | if (hdrv && hdrv->report) | 1429 | if (hdrv && hdrv->report) |
1430 | hdrv->report(hid, report); | 1430 | hdrv->report(hid, report); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | if (hid->claimed & HID_CLAIMED_INPUT) | 1433 | if (hid->claimed & HID_CLAIMED_INPUT) |
1434 | hidinput_report_event(hid, report); | 1434 | hidinput_report_event(hid, report); |
1435 | out: | 1435 | out: |
1436 | return ret; | 1436 | return ret; |
1437 | } | 1437 | } |
1438 | EXPORT_SYMBOL_GPL(hid_report_raw_event); | 1438 | EXPORT_SYMBOL_GPL(hid_report_raw_event); |
1439 | 1439 | ||
1440 | /** | 1440 | /** |
1441 | * hid_input_report - report data from lower layer (usb, bt...) | 1441 | * hid_input_report - report data from lower layer (usb, bt...) |
1442 | * | 1442 | * |
1443 | * @hid: hid device | 1443 | * @hid: hid device |
1444 | * @type: HID report type (HID_*_REPORT) | 1444 | * @type: HID report type (HID_*_REPORT) |
1445 | * @data: report contents | 1445 | * @data: report contents |
1446 | * @size: size of data parameter | 1446 | * @size: size of data parameter |
1447 | * @interrupt: distinguish between interrupt and control transfers | 1447 | * @interrupt: distinguish between interrupt and control transfers |
1448 | * | 1448 | * |
1449 | * This is data entry for lower layers. | 1449 | * This is data entry for lower layers. |
1450 | */ | 1450 | */ |
1451 | int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) | 1451 | int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt) |
1452 | { | 1452 | { |
1453 | struct hid_report_enum *report_enum; | 1453 | struct hid_report_enum *report_enum; |
1454 | struct hid_driver *hdrv; | 1454 | struct hid_driver *hdrv; |
1455 | struct hid_report *report; | 1455 | struct hid_report *report; |
1456 | int ret = 0; | 1456 | int ret = 0; |
1457 | 1457 | ||
1458 | if (!hid) | 1458 | if (!hid) |
1459 | return -ENODEV; | 1459 | return -ENODEV; |
1460 | 1460 | ||
1461 | if (down_trylock(&hid->driver_input_lock)) | 1461 | if (down_trylock(&hid->driver_input_lock)) |
1462 | return -EBUSY; | 1462 | return -EBUSY; |
1463 | 1463 | ||
1464 | if (!hid->driver) { | 1464 | if (!hid->driver) { |
1465 | ret = -ENODEV; | 1465 | ret = -ENODEV; |
1466 | goto unlock; | 1466 | goto unlock; |
1467 | } | 1467 | } |
1468 | report_enum = hid->report_enum + type; | 1468 | report_enum = hid->report_enum + type; |
1469 | hdrv = hid->driver; | 1469 | hdrv = hid->driver; |
1470 | 1470 | ||
1471 | if (!size) { | 1471 | if (!size) { |
1472 | dbg_hid("empty report\n"); | 1472 | dbg_hid("empty report\n"); |
1473 | ret = -1; | 1473 | ret = -1; |
1474 | goto unlock; | 1474 | goto unlock; |
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | /* Avoid unnecessary overhead if debugfs is disabled */ | 1477 | /* Avoid unnecessary overhead if debugfs is disabled */ |
1478 | if (!list_empty(&hid->debug_list)) | 1478 | if (!list_empty(&hid->debug_list)) |
1479 | hid_dump_report(hid, type, data, size); | 1479 | hid_dump_report(hid, type, data, size); |
1480 | 1480 | ||
1481 | report = hid_get_report(report_enum, data); | 1481 | report = hid_get_report(report_enum, data); |
1482 | 1482 | ||
1483 | if (!report) { | 1483 | if (!report) { |
1484 | ret = -1; | 1484 | ret = -1; |
1485 | goto unlock; | 1485 | goto unlock; |
1486 | } | 1486 | } |
1487 | 1487 | ||
1488 | if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { | 1488 | if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { |
1489 | ret = hdrv->raw_event(hid, report, data, size); | 1489 | ret = hdrv->raw_event(hid, report, data, size); |
1490 | if (ret < 0) | 1490 | if (ret < 0) |
1491 | goto unlock; | 1491 | goto unlock; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | ret = hid_report_raw_event(hid, type, data, size, interrupt); | 1494 | ret = hid_report_raw_event(hid, type, data, size, interrupt); |
1495 | 1495 | ||
1496 | unlock: | 1496 | unlock: |
1497 | up(&hid->driver_input_lock); | 1497 | up(&hid->driver_input_lock); |
1498 | return ret; | 1498 | return ret; |
1499 | } | 1499 | } |
1500 | EXPORT_SYMBOL_GPL(hid_input_report); | 1500 | EXPORT_SYMBOL_GPL(hid_input_report); |
1501 | 1501 | ||
1502 | static bool hid_match_one_id(struct hid_device *hdev, | 1502 | static bool hid_match_one_id(struct hid_device *hdev, |
1503 | const struct hid_device_id *id) | 1503 | const struct hid_device_id *id) |
1504 | { | 1504 | { |
1505 | return (id->bus == HID_BUS_ANY || id->bus == hdev->bus) && | 1505 | return (id->bus == HID_BUS_ANY || id->bus == hdev->bus) && |
1506 | (id->group == HID_GROUP_ANY || id->group == hdev->group) && | 1506 | (id->group == HID_GROUP_ANY || id->group == hdev->group) && |
1507 | (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && | 1507 | (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && |
1508 | (id->product == HID_ANY_ID || id->product == hdev->product); | 1508 | (id->product == HID_ANY_ID || id->product == hdev->product); |
1509 | } | 1509 | } |
1510 | 1510 | ||
1511 | const struct hid_device_id *hid_match_id(struct hid_device *hdev, | 1511 | const struct hid_device_id *hid_match_id(struct hid_device *hdev, |
1512 | const struct hid_device_id *id) | 1512 | const struct hid_device_id *id) |
1513 | { | 1513 | { |
1514 | for (; id->bus; id++) | 1514 | for (; id->bus; id++) |
1515 | if (hid_match_one_id(hdev, id)) | 1515 | if (hid_match_one_id(hdev, id)) |
1516 | return id; | 1516 | return id; |
1517 | 1517 | ||
1518 | return NULL; | 1518 | return NULL; |
1519 | } | 1519 | } |
1520 | 1520 | ||
1521 | static const struct hid_device_id hid_hiddev_list[] = { | 1521 | static const struct hid_device_id hid_hiddev_list[] = { |
1522 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, | 1522 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS) }, |
1523 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) }, | 1523 | { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1) }, |
1524 | { } | 1524 | { } |
1525 | }; | 1525 | }; |
1526 | 1526 | ||
1527 | static bool hid_hiddev(struct hid_device *hdev) | 1527 | static bool hid_hiddev(struct hid_device *hdev) |
1528 | { | 1528 | { |
1529 | return !!hid_match_id(hdev, hid_hiddev_list); | 1529 | return !!hid_match_id(hdev, hid_hiddev_list); |
1530 | } | 1530 | } |
1531 | 1531 | ||
1532 | 1532 | ||
1533 | static ssize_t | 1533 | static ssize_t |
1534 | read_report_descriptor(struct file *filp, struct kobject *kobj, | 1534 | read_report_descriptor(struct file *filp, struct kobject *kobj, |
1535 | struct bin_attribute *attr, | 1535 | struct bin_attribute *attr, |
1536 | char *buf, loff_t off, size_t count) | 1536 | char *buf, loff_t off, size_t count) |
1537 | { | 1537 | { |
1538 | struct device *dev = container_of(kobj, struct device, kobj); | 1538 | struct device *dev = container_of(kobj, struct device, kobj); |
1539 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 1539 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
1540 | 1540 | ||
1541 | if (off >= hdev->rsize) | 1541 | if (off >= hdev->rsize) |
1542 | return 0; | 1542 | return 0; |
1543 | 1543 | ||
1544 | if (off + count > hdev->rsize) | 1544 | if (off + count > hdev->rsize) |
1545 | count = hdev->rsize - off; | 1545 | count = hdev->rsize - off; |
1546 | 1546 | ||
1547 | memcpy(buf, hdev->rdesc + off, count); | 1547 | memcpy(buf, hdev->rdesc + off, count); |
1548 | 1548 | ||
1549 | return count; | 1549 | return count; |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | static struct bin_attribute dev_bin_attr_report_desc = { | 1552 | static struct bin_attribute dev_bin_attr_report_desc = { |
1553 | .attr = { .name = "report_descriptor", .mode = 0444 }, | 1553 | .attr = { .name = "report_descriptor", .mode = 0444 }, |
1554 | .read = read_report_descriptor, | 1554 | .read = read_report_descriptor, |
1555 | .size = HID_MAX_DESCRIPTOR_SIZE, | 1555 | .size = HID_MAX_DESCRIPTOR_SIZE, |
1556 | }; | 1556 | }; |
1557 | 1557 | ||
1558 | int hid_connect(struct hid_device *hdev, unsigned int connect_mask) | 1558 | int hid_connect(struct hid_device *hdev, unsigned int connect_mask) |
1559 | { | 1559 | { |
1560 | static const char *types[] = { "Device", "Pointer", "Mouse", "Device", | 1560 | static const char *types[] = { "Device", "Pointer", "Mouse", "Device", |
1561 | "Joystick", "Gamepad", "Keyboard", "Keypad", | 1561 | "Joystick", "Gamepad", "Keyboard", "Keypad", |
1562 | "Multi-Axis Controller" | 1562 | "Multi-Axis Controller" |
1563 | }; | 1563 | }; |
1564 | const char *type, *bus; | 1564 | const char *type, *bus; |
1565 | char buf[64]; | 1565 | char buf[64]; |
1566 | unsigned int i; | 1566 | unsigned int i; |
1567 | int len; | 1567 | int len; |
1568 | int ret; | 1568 | int ret; |
1569 | 1569 | ||
1570 | if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) | 1570 | if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) |
1571 | connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); | 1571 | connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); |
1572 | if (hdev->quirks & HID_QUIRK_HIDINPUT_FORCE) | 1572 | if (hdev->quirks & HID_QUIRK_HIDINPUT_FORCE) |
1573 | connect_mask |= HID_CONNECT_HIDINPUT_FORCE; | 1573 | connect_mask |= HID_CONNECT_HIDINPUT_FORCE; |
1574 | if (hdev->bus != BUS_USB) | 1574 | if (hdev->bus != BUS_USB) |
1575 | connect_mask &= ~HID_CONNECT_HIDDEV; | 1575 | connect_mask &= ~HID_CONNECT_HIDDEV; |
1576 | if (hid_hiddev(hdev)) | 1576 | if (hid_hiddev(hdev)) |
1577 | connect_mask |= HID_CONNECT_HIDDEV_FORCE; | 1577 | connect_mask |= HID_CONNECT_HIDDEV_FORCE; |
1578 | 1578 | ||
1579 | if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, | 1579 | if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, |
1580 | connect_mask & HID_CONNECT_HIDINPUT_FORCE)) | 1580 | connect_mask & HID_CONNECT_HIDINPUT_FORCE)) |
1581 | hdev->claimed |= HID_CLAIMED_INPUT; | 1581 | hdev->claimed |= HID_CLAIMED_INPUT; |
1582 | 1582 | ||
1583 | if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && | 1583 | if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && |
1584 | !hdev->hiddev_connect(hdev, | 1584 | !hdev->hiddev_connect(hdev, |
1585 | connect_mask & HID_CONNECT_HIDDEV_FORCE)) | 1585 | connect_mask & HID_CONNECT_HIDDEV_FORCE)) |
1586 | hdev->claimed |= HID_CLAIMED_HIDDEV; | 1586 | hdev->claimed |= HID_CLAIMED_HIDDEV; |
1587 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) | 1587 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) |
1588 | hdev->claimed |= HID_CLAIMED_HIDRAW; | 1588 | hdev->claimed |= HID_CLAIMED_HIDRAW; |
1589 | 1589 | ||
1590 | if (connect_mask & HID_CONNECT_DRIVER) | 1590 | if (connect_mask & HID_CONNECT_DRIVER) |
1591 | hdev->claimed |= HID_CLAIMED_DRIVER; | 1591 | hdev->claimed |= HID_CLAIMED_DRIVER; |
1592 | 1592 | ||
1593 | /* Drivers with the ->raw_event callback set are not required to connect | 1593 | /* Drivers with the ->raw_event callback set are not required to connect |
1594 | * to any other listener. */ | 1594 | * to any other listener. */ |
1595 | if (!hdev->claimed && !hdev->driver->raw_event) { | 1595 | if (!hdev->claimed && !hdev->driver->raw_event) { |
1596 | hid_err(hdev, "device has no listeners, quitting\n"); | 1596 | hid_err(hdev, "device has no listeners, quitting\n"); |
1597 | return -ENODEV; | 1597 | return -ENODEV; |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | if ((hdev->claimed & HID_CLAIMED_INPUT) && | 1600 | if ((hdev->claimed & HID_CLAIMED_INPUT) && |
1601 | (connect_mask & HID_CONNECT_FF) && hdev->ff_init) | 1601 | (connect_mask & HID_CONNECT_FF) && hdev->ff_init) |
1602 | hdev->ff_init(hdev); | 1602 | hdev->ff_init(hdev); |
1603 | 1603 | ||
1604 | len = 0; | 1604 | len = 0; |
1605 | if (hdev->claimed & HID_CLAIMED_INPUT) | 1605 | if (hdev->claimed & HID_CLAIMED_INPUT) |
1606 | len += sprintf(buf + len, "input"); | 1606 | len += sprintf(buf + len, "input"); |
1607 | if (hdev->claimed & HID_CLAIMED_HIDDEV) | 1607 | if (hdev->claimed & HID_CLAIMED_HIDDEV) |
1608 | len += sprintf(buf + len, "%shiddev%d", len ? "," : "", | 1608 | len += sprintf(buf + len, "%shiddev%d", len ? "," : "", |
1609 | hdev->minor); | 1609 | hdev->minor); |
1610 | if (hdev->claimed & HID_CLAIMED_HIDRAW) | 1610 | if (hdev->claimed & HID_CLAIMED_HIDRAW) |
1611 | len += sprintf(buf + len, "%shidraw%d", len ? "," : "", | 1611 | len += sprintf(buf + len, "%shidraw%d", len ? "," : "", |
1612 | ((struct hidraw *)hdev->hidraw)->minor); | 1612 | ((struct hidraw *)hdev->hidraw)->minor); |
1613 | 1613 | ||
1614 | type = "Device"; | 1614 | type = "Device"; |
1615 | for (i = 0; i < hdev->maxcollection; i++) { | 1615 | for (i = 0; i < hdev->maxcollection; i++) { |
1616 | struct hid_collection *col = &hdev->collection[i]; | 1616 | struct hid_collection *col = &hdev->collection[i]; |
1617 | if (col->type == HID_COLLECTION_APPLICATION && | 1617 | if (col->type == HID_COLLECTION_APPLICATION && |
1618 | (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK && | 1618 | (col->usage & HID_USAGE_PAGE) == HID_UP_GENDESK && |
1619 | (col->usage & 0xffff) < ARRAY_SIZE(types)) { | 1619 | (col->usage & 0xffff) < ARRAY_SIZE(types)) { |
1620 | type = types[col->usage & 0xffff]; | 1620 | type = types[col->usage & 0xffff]; |
1621 | break; | 1621 | break; |
1622 | } | 1622 | } |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | switch (hdev->bus) { | 1625 | switch (hdev->bus) { |
1626 | case BUS_USB: | 1626 | case BUS_USB: |
1627 | bus = "USB"; | 1627 | bus = "USB"; |
1628 | break; | 1628 | break; |
1629 | case BUS_BLUETOOTH: | 1629 | case BUS_BLUETOOTH: |
1630 | bus = "BLUETOOTH"; | 1630 | bus = "BLUETOOTH"; |
1631 | break; | 1631 | break; |
1632 | default: | 1632 | default: |
1633 | bus = "<UNKNOWN>"; | 1633 | bus = "<UNKNOWN>"; |
1634 | } | 1634 | } |
1635 | 1635 | ||
1636 | ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc); | 1636 | ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc); |
1637 | if (ret) | 1637 | if (ret) |
1638 | hid_warn(hdev, | 1638 | hid_warn(hdev, |
1639 | "can't create sysfs report descriptor attribute err: %d\n", ret); | 1639 | "can't create sysfs report descriptor attribute err: %d\n", ret); |
1640 | 1640 | ||
1641 | hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n", | 1641 | hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n", |
1642 | buf, bus, hdev->version >> 8, hdev->version & 0xff, | 1642 | buf, bus, hdev->version >> 8, hdev->version & 0xff, |
1643 | type, hdev->name, hdev->phys); | 1643 | type, hdev->name, hdev->phys); |
1644 | 1644 | ||
1645 | return 0; | 1645 | return 0; |
1646 | } | 1646 | } |
1647 | EXPORT_SYMBOL_GPL(hid_connect); | 1647 | EXPORT_SYMBOL_GPL(hid_connect); |
1648 | 1648 | ||
1649 | void hid_disconnect(struct hid_device *hdev) | 1649 | void hid_disconnect(struct hid_device *hdev) |
1650 | { | 1650 | { |
1651 | device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc); | 1651 | device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc); |
1652 | if (hdev->claimed & HID_CLAIMED_INPUT) | 1652 | if (hdev->claimed & HID_CLAIMED_INPUT) |
1653 | hidinput_disconnect(hdev); | 1653 | hidinput_disconnect(hdev); |
1654 | if (hdev->claimed & HID_CLAIMED_HIDDEV) | 1654 | if (hdev->claimed & HID_CLAIMED_HIDDEV) |
1655 | hdev->hiddev_disconnect(hdev); | 1655 | hdev->hiddev_disconnect(hdev); |
1656 | if (hdev->claimed & HID_CLAIMED_HIDRAW) | 1656 | if (hdev->claimed & HID_CLAIMED_HIDRAW) |
1657 | hidraw_disconnect(hdev); | 1657 | hidraw_disconnect(hdev); |
1658 | hdev->claimed = 0; | 1658 | hdev->claimed = 0; |
1659 | } | 1659 | } |
1660 | EXPORT_SYMBOL_GPL(hid_disconnect); | 1660 | EXPORT_SYMBOL_GPL(hid_disconnect); |
1661 | 1661 | ||
1662 | /* | 1662 | /* |
1663 | * A list of devices for which there is a specialized driver on HID bus. | 1663 | * A list of devices for which there is a specialized driver on HID bus. |
1664 | * | 1664 | * |
1665 | * Please note that for multitouch devices (driven by hid-multitouch driver), | 1665 | * Please note that for multitouch devices (driven by hid-multitouch driver), |
1666 | * there is a proper autodetection and autoloading in place (based on presence | 1666 | * there is a proper autodetection and autoloading in place (based on presence |
1667 | * of HID_DG_CONTACTID), so those devices don't need to be added to this list, | 1667 | * of HID_DG_CONTACTID), so those devices don't need to be added to this list, |
1668 | * as we are doing the right thing in hid_scan_usage(). | 1668 | * as we are doing the right thing in hid_scan_usage(). |
1669 | * | 1669 | * |
1670 | * Autodetection for (USB) HID sensor hubs exists too. If a collection of type | 1670 | * Autodetection for (USB) HID sensor hubs exists too. If a collection of type |
1671 | * physical is found inside a usage page of type sensor, hid-sensor-hub will be | 1671 | * physical is found inside a usage page of type sensor, hid-sensor-hub will be |
1672 | * used as a driver. See hid_scan_report(). | 1672 | * used as a driver. See hid_scan_report(). |
1673 | */ | 1673 | */ |
1674 | static const struct hid_device_id hid_have_special_driver[] = { | 1674 | static const struct hid_device_id hid_have_special_driver[] = { |
1675 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, | 1675 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, |
1676 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, | 1676 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
1677 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, | 1677 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, |
1678 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, | 1678 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, |
1679 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) }, | 1679 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) }, |
1680 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, | 1680 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
1681 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | 1681 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, |
1682 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, | 1682 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, |
1683 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, | 1683 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
1684 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, | 1684 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
1685 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, | 1685 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
1686 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, | 1686 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, |
1687 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, | 1687 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, |
1688 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, | 1688 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, |
1689 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, | 1689 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, |
1690 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, | 1690 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, |
1691 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, | 1691 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, |
1692 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, | 1692 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, |
1693 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, | 1693 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, |
1694 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI) }, | 1694 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI) }, |
1695 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO) }, | 1695 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO) }, |
1696 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS) }, | 1696 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS) }, |
1697 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) }, | 1697 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI) }, |
1698 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) }, | 1698 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO) }, |
1699 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) }, | 1699 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS) }, |
1700 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, | 1700 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, |
1701 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, | 1701 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, |
1702 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, | 1702 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, |
1703 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, | 1703 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, |
1704 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, | 1704 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, |
1705 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, | 1705 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, |
1706 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | 1706 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, |
1707 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, | 1707 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, |
1708 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, | 1708 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, |
1709 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, | 1709 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, |
1710 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, | 1710 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, |
1711 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, | 1711 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, |
1712 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, | 1712 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, |
1713 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, | 1713 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, |
1714 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, | 1714 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, |
1715 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, | 1715 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, |
1716 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, | 1716 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, |
1717 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, | 1717 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, |
1718 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, | 1718 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, |
1719 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, | 1719 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, |
1720 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, | 1720 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, |
1721 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, | 1721 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, |
1722 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, | 1722 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, |
1723 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, | 1723 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, |
1724 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, | 1724 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, |
1725 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, | 1725 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, |
1726 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, | 1726 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, |
1727 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, | 1727 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, |
1728 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, | 1728 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, |
1729 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, | 1729 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, |
1730 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, | 1730 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, |
1731 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, | 1731 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, |
1732 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, | 1732 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) }, |
1733 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, | 1733 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) }, |
1734 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) }, | 1734 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) }, |
1735 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, | 1735 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, |
1736 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, | 1736 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, |
1737 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, | 1737 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, |
1738 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, | 1738 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
1739 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, | 1739 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
1740 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, | 1740 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
1741 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 1741 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
1742 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 1742 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
1743 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 1743 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
1744 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | 1744 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, |
1745 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | 1745 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, |
1746 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | 1746 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, |
1747 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, | 1747 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, |
1748 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, | 1748 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, |
1749 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, | 1749 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, |
1750 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | 1750 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
1751 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | 1751 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
1752 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1752 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
1753 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) }, | 1753 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) }, |
1754 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, | 1754 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, |
1755 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, | 1755 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, |
1756 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 1756 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
1757 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 1757 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
1758 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, | 1758 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, |
1759 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, | 1759 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, |
1760 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, | 1760 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, |
1761 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | 1761 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, |
1762 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, | 1762 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, |
1763 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, | 1763 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
1764 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | 1764 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
1765 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | 1765 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, |
1766 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, | 1766 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
1767 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, | 1767 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, |
1768 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | 1768 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
1769 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, | 1769 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, |
1770 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, | 1770 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
1771 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, | 1771 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, |
1772 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, | 1772 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, |
1773 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) }, | 1773 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) }, |
1774 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, | 1774 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, |
1775 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, | 1775 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, |
1776 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, | 1776 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, |
1777 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, | 1777 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, |
1778 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) }, | 1778 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) }, |
1779 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) }, | 1779 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) }, |
1780 | { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, | 1780 | { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, |
1781 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, | 1781 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, |
1782 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, | 1782 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, |
1783 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, | 1783 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, |
1784 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, | 1784 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, |
1785 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, | 1785 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, |
1786 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, | 1786 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, |
1787 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, | 1787 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, |
1788 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, | 1788 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, |
1789 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, | 1789 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, |
1790 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, | 1790 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, |
1791 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, | 1791 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, |
1792 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, | 1792 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, |
1793 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A070) }, | 1793 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A070) }, |
1794 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) }, | 1794 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) }, |
1795 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, | 1795 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, |
1796 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) }, | 1796 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) }, |
1797 | { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, | 1797 | { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, |
1798 | { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, | 1798 | { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, |
1799 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, | 1799 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, |
1800 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, | 1800 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
1801 | { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, | 1801 | { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, |
1802 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, | 1802 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, |
1803 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, | 1803 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, |
1804 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, | 1804 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, |
1805 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, | 1805 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, |
1806 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, | 1806 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, |
1807 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, | 1807 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, |
1808 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, | ||
1808 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | 1809 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
1809 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | 1810 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, |
1810 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, | 1811 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, |
1811 | #if IS_ENABLED(CONFIG_HID_LENOVO) | 1812 | #if IS_ENABLED(CONFIG_HID_LENOVO) |
1812 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, | 1813 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, |
1813 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, | 1814 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, |
1814 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, | 1815 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, |
1815 | #endif | 1816 | #endif |
1816 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, | 1817 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, |
1817 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, | 1818 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, |
1818 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, | 1819 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, |
1819 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, | 1820 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, |
1820 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, | 1821 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, |
1821 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, | 1822 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, |
1822 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, | 1823 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, |
1823 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, | 1824 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, |
1824 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, | 1825 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, |
1825 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, | 1826 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, |
1826 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, | 1827 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, |
1827 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, | 1828 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, |
1828 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, | 1829 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, |
1829 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) }, | 1830 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) }, |
1830 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, | 1831 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, |
1831 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, | 1832 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, |
1832 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, | 1833 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, |
1833 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, | 1834 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, |
1834 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, | 1835 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, |
1835 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, | 1836 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, |
1836 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, | 1837 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, |
1837 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, | 1838 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, |
1838 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL) }, | 1839 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL) }, |
1839 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, | 1840 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, |
1840 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, | 1841 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, |
1841 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, | 1842 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, |
1842 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, | 1843 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, |
1843 | #if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) | 1844 | #if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) |
1844 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, | 1845 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, |
1845 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, | 1846 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, |
1846 | #endif | 1847 | #endif |
1847 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, | 1848 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, |
1848 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, | 1849 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, |
1849 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, | 1850 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, |
1850 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, | 1851 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, |
1851 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, | 1852 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, |
1852 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, | 1853 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, |
1853 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, | 1854 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, |
1854 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, | 1855 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, |
1855 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, | 1856 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, |
1856 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, | 1857 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, |
1857 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, | 1858 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, |
1858 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | 1859 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, |
1859 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, | 1860 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, |
1860 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, | 1861 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, |
1861 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, | 1862 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, |
1862 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) }, | 1863 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) }, |
1863 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, | 1864 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, |
1864 | { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, | 1865 | { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, |
1865 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, | 1866 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, |
1866 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, | 1867 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, |
1867 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) }, | 1868 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) }, |
1868 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3) }, | 1869 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3) }, |
1869 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4) }, | 1870 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4) }, |
1870 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5) }, | 1871 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5) }, |
1871 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6) }, | 1872 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6) }, |
1872 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7) }, | 1873 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7) }, |
1873 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8) }, | 1874 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8) }, |
1874 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9) }, | 1875 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9) }, |
1875 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10) }, | 1876 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10) }, |
1876 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11) }, | 1877 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11) }, |
1877 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12) }, | 1878 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12) }, |
1878 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13) }, | 1879 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13) }, |
1879 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14) }, | 1880 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14) }, |
1880 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15) }, | 1881 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15) }, |
1881 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) }, | 1882 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) }, |
1882 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) }, | 1883 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) }, |
1883 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, | 1884 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, |
1884 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, | 1885 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, |
1885 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, | 1886 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, |
1886 | { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, | 1887 | { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, |
1887 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | 1888 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, |
1888 | { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, | 1889 | { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, |
1889 | { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, | 1890 | { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, |
1890 | #if IS_ENABLED(CONFIG_HID_ROCCAT) | 1891 | #if IS_ENABLED(CONFIG_HID_ROCCAT) |
1891 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, | 1892 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, |
1892 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, | 1893 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, |
1893 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKUFX) }, | 1894 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKUFX) }, |
1894 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, | 1895 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, |
1895 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, | 1896 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, |
1896 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, | 1897 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, |
1897 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE_OPTICAL) }, | 1898 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE_OPTICAL) }, |
1898 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEXTD) }, | 1899 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEXTD) }, |
1899 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, | 1900 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, |
1900 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, | 1901 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, |
1901 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, | 1902 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, |
1902 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, | 1903 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, |
1903 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK) }, | 1904 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK) }, |
1904 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK_GLOW) }, | 1905 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK_GLOW) }, |
1905 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK_PRO) }, | 1906 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_RYOS_MK_PRO) }, |
1906 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_SAVU) }, | 1907 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_SAVU) }, |
1907 | #endif | 1908 | #endif |
1908 | #if IS_ENABLED(CONFIG_HID_SAITEK) | 1909 | #if IS_ENABLED(CONFIG_HID_SAITEK) |
1909 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, | 1910 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, |
1910 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, | 1911 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, |
1911 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, | 1912 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, |
1912 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, | 1913 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, |
1913 | #endif | 1914 | #endif |
1914 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | 1915 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
1915 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, | 1916 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, |
1916 | { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, | 1917 | { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, |
1917 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) }, | 1918 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) }, |
1918 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, | 1919 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, |
1919 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, | 1920 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, |
1920 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) }, | 1921 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) }, |
1921 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 1922 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1922 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, | 1923 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, |
1923 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 1924 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1924 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) }, | 1925 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) }, |
1925 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) }, | 1926 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) }, |
1926 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, | 1927 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
1927 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) }, | 1928 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) }, |
1928 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, | 1929 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, |
1929 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | 1930 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
1930 | { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, | 1931 | { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, |
1931 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, | 1932 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, |
1932 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, | 1933 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, |
1933 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) }, | 1934 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) }, |
1934 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324) }, | 1935 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324) }, |
1935 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, | 1936 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, |
1936 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, | 1937 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, |
1937 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, | 1938 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, |
1938 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, | 1939 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, |
1939 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, | 1940 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
1940 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, | 1941 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
1941 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, | 1942 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
1942 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, | 1943 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
1943 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, | 1944 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, |
1944 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, | 1945 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, |
1945 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, | 1946 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, |
1946 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, | 1947 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, |
1947 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, | 1948 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, |
1948 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, | 1949 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, |
1949 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) }, | 1950 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) }, |
1950 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) }, | 1951 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) }, |
1951 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, | 1952 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, |
1952 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, | 1953 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, |
1953 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, | 1954 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, |
1954 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | 1955 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, |
1955 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, | 1956 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, |
1956 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, | 1957 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, |
1957 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, | 1958 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, |
1958 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, | 1959 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, |
1959 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, | 1960 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, |
1960 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) }, | 1961 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) }, |
1961 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, | 1962 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, |
1962 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, | 1963 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, |
1963 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) }, | 1964 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) }, |
1964 | { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, | 1965 | { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, |
1965 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) }, | 1966 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) }, |
1966 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, | 1967 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, |
1967 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, | 1968 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, |
1968 | { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, | 1969 | { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, |
1969 | 1970 | ||
1970 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | 1971 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, |
1971 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, | 1972 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, |
1972 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, | 1973 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, |
1973 | { } | 1974 | { } |
1974 | }; | 1975 | }; |
1975 | 1976 | ||
1976 | struct hid_dynid { | 1977 | struct hid_dynid { |
1977 | struct list_head list; | 1978 | struct list_head list; |
1978 | struct hid_device_id id; | 1979 | struct hid_device_id id; |
1979 | }; | 1980 | }; |
1980 | 1981 | ||
1981 | /** | 1982 | /** |
1982 | * store_new_id - add a new HID device ID to this driver and re-probe devices | 1983 | * store_new_id - add a new HID device ID to this driver and re-probe devices |
1983 | * @driver: target device driver | 1984 | * @driver: target device driver |
1984 | * @buf: buffer for scanning device ID data | 1985 | * @buf: buffer for scanning device ID data |
1985 | * @count: input size | 1986 | * @count: input size |
1986 | * | 1987 | * |
1987 | * Adds a new dynamic hid device ID to this driver, | 1988 | * Adds a new dynamic hid device ID to this driver, |
1988 | * and causes the driver to probe for all devices again. | 1989 | * and causes the driver to probe for all devices again. |
1989 | */ | 1990 | */ |
1990 | static ssize_t store_new_id(struct device_driver *drv, const char *buf, | 1991 | static ssize_t store_new_id(struct device_driver *drv, const char *buf, |
1991 | size_t count) | 1992 | size_t count) |
1992 | { | 1993 | { |
1993 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); | 1994 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); |
1994 | struct hid_dynid *dynid; | 1995 | struct hid_dynid *dynid; |
1995 | __u32 bus, vendor, product; | 1996 | __u32 bus, vendor, product; |
1996 | unsigned long driver_data = 0; | 1997 | unsigned long driver_data = 0; |
1997 | int ret; | 1998 | int ret; |
1998 | 1999 | ||
1999 | ret = sscanf(buf, "%x %x %x %lx", | 2000 | ret = sscanf(buf, "%x %x %x %lx", |
2000 | &bus, &vendor, &product, &driver_data); | 2001 | &bus, &vendor, &product, &driver_data); |
2001 | if (ret < 3) | 2002 | if (ret < 3) |
2002 | return -EINVAL; | 2003 | return -EINVAL; |
2003 | 2004 | ||
2004 | dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); | 2005 | dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); |
2005 | if (!dynid) | 2006 | if (!dynid) |
2006 | return -ENOMEM; | 2007 | return -ENOMEM; |
2007 | 2008 | ||
2008 | dynid->id.bus = bus; | 2009 | dynid->id.bus = bus; |
2009 | dynid->id.group = HID_GROUP_ANY; | 2010 | dynid->id.group = HID_GROUP_ANY; |
2010 | dynid->id.vendor = vendor; | 2011 | dynid->id.vendor = vendor; |
2011 | dynid->id.product = product; | 2012 | dynid->id.product = product; |
2012 | dynid->id.driver_data = driver_data; | 2013 | dynid->id.driver_data = driver_data; |
2013 | 2014 | ||
2014 | spin_lock(&hdrv->dyn_lock); | 2015 | spin_lock(&hdrv->dyn_lock); |
2015 | list_add_tail(&dynid->list, &hdrv->dyn_list); | 2016 | list_add_tail(&dynid->list, &hdrv->dyn_list); |
2016 | spin_unlock(&hdrv->dyn_lock); | 2017 | spin_unlock(&hdrv->dyn_lock); |
2017 | 2018 | ||
2018 | ret = driver_attach(&hdrv->driver); | 2019 | ret = driver_attach(&hdrv->driver); |
2019 | 2020 | ||
2020 | return ret ? : count; | 2021 | return ret ? : count; |
2021 | } | 2022 | } |
2022 | static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); | 2023 | static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); |
2023 | 2024 | ||
2024 | static void hid_free_dynids(struct hid_driver *hdrv) | 2025 | static void hid_free_dynids(struct hid_driver *hdrv) |
2025 | { | 2026 | { |
2026 | struct hid_dynid *dynid, *n; | 2027 | struct hid_dynid *dynid, *n; |
2027 | 2028 | ||
2028 | spin_lock(&hdrv->dyn_lock); | 2029 | spin_lock(&hdrv->dyn_lock); |
2029 | list_for_each_entry_safe(dynid, n, &hdrv->dyn_list, list) { | 2030 | list_for_each_entry_safe(dynid, n, &hdrv->dyn_list, list) { |
2030 | list_del(&dynid->list); | 2031 | list_del(&dynid->list); |
2031 | kfree(dynid); | 2032 | kfree(dynid); |
2032 | } | 2033 | } |
2033 | spin_unlock(&hdrv->dyn_lock); | 2034 | spin_unlock(&hdrv->dyn_lock); |
2034 | } | 2035 | } |
2035 | 2036 | ||
2036 | static const struct hid_device_id *hid_match_device(struct hid_device *hdev, | 2037 | static const struct hid_device_id *hid_match_device(struct hid_device *hdev, |
2037 | struct hid_driver *hdrv) | 2038 | struct hid_driver *hdrv) |
2038 | { | 2039 | { |
2039 | struct hid_dynid *dynid; | 2040 | struct hid_dynid *dynid; |
2040 | 2041 | ||
2041 | spin_lock(&hdrv->dyn_lock); | 2042 | spin_lock(&hdrv->dyn_lock); |
2042 | list_for_each_entry(dynid, &hdrv->dyn_list, list) { | 2043 | list_for_each_entry(dynid, &hdrv->dyn_list, list) { |
2043 | if (hid_match_one_id(hdev, &dynid->id)) { | 2044 | if (hid_match_one_id(hdev, &dynid->id)) { |
2044 | spin_unlock(&hdrv->dyn_lock); | 2045 | spin_unlock(&hdrv->dyn_lock); |
2045 | return &dynid->id; | 2046 | return &dynid->id; |
2046 | } | 2047 | } |
2047 | } | 2048 | } |
2048 | spin_unlock(&hdrv->dyn_lock); | 2049 | spin_unlock(&hdrv->dyn_lock); |
2049 | 2050 | ||
2050 | return hid_match_id(hdev, hdrv->id_table); | 2051 | return hid_match_id(hdev, hdrv->id_table); |
2051 | } | 2052 | } |
2052 | 2053 | ||
2053 | static int hid_bus_match(struct device *dev, struct device_driver *drv) | 2054 | static int hid_bus_match(struct device *dev, struct device_driver *drv) |
2054 | { | 2055 | { |
2055 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); | 2056 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); |
2056 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 2057 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
2057 | 2058 | ||
2058 | return hid_match_device(hdev, hdrv) != NULL; | 2059 | return hid_match_device(hdev, hdrv) != NULL; |
2059 | } | 2060 | } |
2060 | 2061 | ||
2061 | static int hid_device_probe(struct device *dev) | 2062 | static int hid_device_probe(struct device *dev) |
2062 | { | 2063 | { |
2063 | struct hid_driver *hdrv = container_of(dev->driver, | 2064 | struct hid_driver *hdrv = container_of(dev->driver, |
2064 | struct hid_driver, driver); | 2065 | struct hid_driver, driver); |
2065 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 2066 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
2066 | const struct hid_device_id *id; | 2067 | const struct hid_device_id *id; |
2067 | int ret = 0; | 2068 | int ret = 0; |
2068 | 2069 | ||
2069 | if (down_interruptible(&hdev->driver_lock)) | 2070 | if (down_interruptible(&hdev->driver_lock)) |
2070 | return -EINTR; | 2071 | return -EINTR; |
2071 | if (down_interruptible(&hdev->driver_input_lock)) { | 2072 | if (down_interruptible(&hdev->driver_input_lock)) { |
2072 | ret = -EINTR; | 2073 | ret = -EINTR; |
2073 | goto unlock_driver_lock; | 2074 | goto unlock_driver_lock; |
2074 | } | 2075 | } |
2075 | hdev->io_started = false; | 2076 | hdev->io_started = false; |
2076 | 2077 | ||
2077 | if (!hdev->driver) { | 2078 | if (!hdev->driver) { |
2078 | id = hid_match_device(hdev, hdrv); | 2079 | id = hid_match_device(hdev, hdrv); |
2079 | if (id == NULL) { | 2080 | if (id == NULL) { |
2080 | ret = -ENODEV; | 2081 | ret = -ENODEV; |
2081 | goto unlock; | 2082 | goto unlock; |
2082 | } | 2083 | } |
2083 | 2084 | ||
2084 | hdev->driver = hdrv; | 2085 | hdev->driver = hdrv; |
2085 | if (hdrv->probe) { | 2086 | if (hdrv->probe) { |
2086 | ret = hdrv->probe(hdev, id); | 2087 | ret = hdrv->probe(hdev, id); |
2087 | } else { /* default probe */ | 2088 | } else { /* default probe */ |
2088 | ret = hid_open_report(hdev); | 2089 | ret = hid_open_report(hdev); |
2089 | if (!ret) | 2090 | if (!ret) |
2090 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 2091 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
2091 | } | 2092 | } |
2092 | if (ret) { | 2093 | if (ret) { |
2093 | hid_close_report(hdev); | 2094 | hid_close_report(hdev); |
2094 | hdev->driver = NULL; | 2095 | hdev->driver = NULL; |
2095 | } | 2096 | } |
2096 | } | 2097 | } |
2097 | unlock: | 2098 | unlock: |
2098 | if (!hdev->io_started) | 2099 | if (!hdev->io_started) |
2099 | up(&hdev->driver_input_lock); | 2100 | up(&hdev->driver_input_lock); |
2100 | unlock_driver_lock: | 2101 | unlock_driver_lock: |
2101 | up(&hdev->driver_lock); | 2102 | up(&hdev->driver_lock); |
2102 | return ret; | 2103 | return ret; |
2103 | } | 2104 | } |
2104 | 2105 | ||
2105 | static int hid_device_remove(struct device *dev) | 2106 | static int hid_device_remove(struct device *dev) |
2106 | { | 2107 | { |
2107 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 2108 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
2108 | struct hid_driver *hdrv; | 2109 | struct hid_driver *hdrv; |
2109 | int ret = 0; | 2110 | int ret = 0; |
2110 | 2111 | ||
2111 | if (down_interruptible(&hdev->driver_lock)) | 2112 | if (down_interruptible(&hdev->driver_lock)) |
2112 | return -EINTR; | 2113 | return -EINTR; |
2113 | if (down_interruptible(&hdev->driver_input_lock)) { | 2114 | if (down_interruptible(&hdev->driver_input_lock)) { |
2114 | ret = -EINTR; | 2115 | ret = -EINTR; |
2115 | goto unlock_driver_lock; | 2116 | goto unlock_driver_lock; |
2116 | } | 2117 | } |
2117 | hdev->io_started = false; | 2118 | hdev->io_started = false; |
2118 | 2119 | ||
2119 | hdrv = hdev->driver; | 2120 | hdrv = hdev->driver; |
2120 | if (hdrv) { | 2121 | if (hdrv) { |
2121 | if (hdrv->remove) | 2122 | if (hdrv->remove) |
2122 | hdrv->remove(hdev); | 2123 | hdrv->remove(hdev); |
2123 | else /* default remove */ | 2124 | else /* default remove */ |
2124 | hid_hw_stop(hdev); | 2125 | hid_hw_stop(hdev); |
2125 | hid_close_report(hdev); | 2126 | hid_close_report(hdev); |
2126 | hdev->driver = NULL; | 2127 | hdev->driver = NULL; |
2127 | } | 2128 | } |
2128 | 2129 | ||
2129 | if (!hdev->io_started) | 2130 | if (!hdev->io_started) |
2130 | up(&hdev->driver_input_lock); | 2131 | up(&hdev->driver_input_lock); |
2131 | unlock_driver_lock: | 2132 | unlock_driver_lock: |
2132 | up(&hdev->driver_lock); | 2133 | up(&hdev->driver_lock); |
2133 | return ret; | 2134 | return ret; |
2134 | } | 2135 | } |
2135 | 2136 | ||
2136 | static ssize_t modalias_show(struct device *dev, struct device_attribute *a, | 2137 | static ssize_t modalias_show(struct device *dev, struct device_attribute *a, |
2137 | char *buf) | 2138 | char *buf) |
2138 | { | 2139 | { |
2139 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 2140 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
2140 | int len; | 2141 | int len; |
2141 | 2142 | ||
2142 | len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n", | 2143 | len = snprintf(buf, PAGE_SIZE, "hid:b%04Xg%04Xv%08Xp%08X\n", |
2143 | hdev->bus, hdev->group, hdev->vendor, hdev->product); | 2144 | hdev->bus, hdev->group, hdev->vendor, hdev->product); |
2144 | 2145 | ||
2145 | return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; | 2146 | return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; |
2146 | } | 2147 | } |
2147 | static DEVICE_ATTR_RO(modalias); | 2148 | static DEVICE_ATTR_RO(modalias); |
2148 | 2149 | ||
2149 | static struct attribute *hid_dev_attrs[] = { | 2150 | static struct attribute *hid_dev_attrs[] = { |
2150 | &dev_attr_modalias.attr, | 2151 | &dev_attr_modalias.attr, |
2151 | NULL, | 2152 | NULL, |
2152 | }; | 2153 | }; |
2153 | ATTRIBUTE_GROUPS(hid_dev); | 2154 | ATTRIBUTE_GROUPS(hid_dev); |
2154 | 2155 | ||
2155 | static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) | 2156 | static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) |
2156 | { | 2157 | { |
2157 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 2158 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
2158 | 2159 | ||
2159 | if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", | 2160 | if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", |
2160 | hdev->bus, hdev->vendor, hdev->product)) | 2161 | hdev->bus, hdev->vendor, hdev->product)) |
2161 | return -ENOMEM; | 2162 | return -ENOMEM; |
2162 | 2163 | ||
2163 | if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) | 2164 | if (add_uevent_var(env, "HID_NAME=%s", hdev->name)) |
2164 | return -ENOMEM; | 2165 | return -ENOMEM; |
2165 | 2166 | ||
2166 | if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) | 2167 | if (add_uevent_var(env, "HID_PHYS=%s", hdev->phys)) |
2167 | return -ENOMEM; | 2168 | return -ENOMEM; |
2168 | 2169 | ||
2169 | if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) | 2170 | if (add_uevent_var(env, "HID_UNIQ=%s", hdev->uniq)) |
2170 | return -ENOMEM; | 2171 | return -ENOMEM; |
2171 | 2172 | ||
2172 | if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X", | 2173 | if (add_uevent_var(env, "MODALIAS=hid:b%04Xg%04Xv%08Xp%08X", |
2173 | hdev->bus, hdev->group, hdev->vendor, hdev->product)) | 2174 | hdev->bus, hdev->group, hdev->vendor, hdev->product)) |
2174 | return -ENOMEM; | 2175 | return -ENOMEM; |
2175 | 2176 | ||
2176 | return 0; | 2177 | return 0; |
2177 | } | 2178 | } |
2178 | 2179 | ||
2179 | static struct bus_type hid_bus_type = { | 2180 | static struct bus_type hid_bus_type = { |
2180 | .name = "hid", | 2181 | .name = "hid", |
2181 | .dev_groups = hid_dev_groups, | 2182 | .dev_groups = hid_dev_groups, |
2182 | .match = hid_bus_match, | 2183 | .match = hid_bus_match, |
2183 | .probe = hid_device_probe, | 2184 | .probe = hid_device_probe, |
2184 | .remove = hid_device_remove, | 2185 | .remove = hid_device_remove, |
2185 | .uevent = hid_uevent, | 2186 | .uevent = hid_uevent, |
2186 | }; | 2187 | }; |
2187 | 2188 | ||
2188 | /* a list of devices that shouldn't be handled by HID core at all */ | 2189 | /* a list of devices that shouldn't be handled by HID core at all */ |
2189 | static const struct hid_device_id hid_ignore_list[] = { | 2190 | static const struct hid_device_id hid_ignore_list[] = { |
2190 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) }, | 2191 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) }, |
2191 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) }, | 2192 | { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) }, |
2192 | { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) }, | 2193 | { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) }, |
2193 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) }, | 2194 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) }, |
2194 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) }, | 2195 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) }, |
2195 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) }, | 2196 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) }, |
2196 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) }, | 2197 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) }, |
2197 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) }, | 2198 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) }, |
2198 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) }, | 2199 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) }, |
2199 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, | 2200 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, |
2200 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, | 2201 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, |
2201 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, | 2202 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, |
2202 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, | 2203 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, |
2203 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, | 2204 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, |
2204 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, | 2205 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, |
2205 | { HID_USB_DEVICE(USB_VENDOR_ID_AXENTIA, USB_DEVICE_ID_AXENTIA_FM_RADIO) }, | 2206 | { HID_USB_DEVICE(USB_VENDOR_ID_AXENTIA, USB_DEVICE_ID_AXENTIA_FM_RADIO) }, |
2206 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, | 2207 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, |
2207 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, | 2208 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, |
2208 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, | 2209 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, |
2209 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI4713) }, | 2210 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI4713) }, |
2210 | { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, | 2211 | { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, |
2211 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, | 2212 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, |
2212 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, | 2213 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, |
2213 | { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, | 2214 | { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, |
2214 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, | 2215 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, |
2215 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, | 2216 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, |
2216 | { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x0004) }, | 2217 | { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x0004) }, |
2217 | { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x000a) }, | 2218 | { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, 0x000a) }, |
2218 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, | 2219 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, |
2219 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, | 2220 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, |
2220 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, | 2221 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, |
2221 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, | 2222 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, |
2222 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, | 2223 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, |
2223 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, | 2224 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, |
2224 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, | 2225 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, |
2225 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, | 2226 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, |
2226 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT) }, | 2227 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_0_4_IF_KIT) }, |
2227 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT) }, | 2228 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_16_16_IF_KIT) }, |
2228 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT) }, | 2229 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_8_8_8_IF_KIT) }, |
2229 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT) }, | 2230 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT) }, |
2230 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT) }, | 2231 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT) }, |
2231 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL) }, | 2232 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL) }, |
2232 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) }, | 2233 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2) }, |
2233 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) }, | 2234 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN) }, |
2234 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) }, | 2235 | { HID_USB_DEVICE(USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER) }, |
2235 | { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) }, | 2236 | { HID_USB_DEVICE(USB_VENDOR_ID_GRETAGMACBETH, USB_DEVICE_ID_GRETAGMACBETH_HUEY) }, |
2236 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) }, | 2237 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE) }, |
2237 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) }, | 2238 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB) }, |
2238 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_RADIOSHARK) }, | 2239 | { HID_USB_DEVICE(USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_RADIOSHARK) }, |
2239 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) }, | 2240 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90) }, |
2240 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) }, | 2241 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_100) }, |
2241 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) }, | 2242 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_101) }, |
2242 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) }, | 2243 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_103) }, |
2243 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) }, | 2244 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_104) }, |
2244 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) }, | 2245 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_105) }, |
2245 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) }, | 2246 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_106) }, |
2246 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) }, | 2247 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_107) }, |
2247 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) }, | 2248 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_108) }, |
2248 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) }, | 2249 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_200) }, |
2249 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) }, | 2250 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_201) }, |
2250 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) }, | 2251 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_202) }, |
2251 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) }, | 2252 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_203) }, |
2252 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) }, | 2253 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_204) }, |
2253 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) }, | 2254 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_205) }, |
2254 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) }, | 2255 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_206) }, |
2255 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) }, | 2256 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_207) }, |
2256 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) }, | 2257 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_300) }, |
2257 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) }, | 2258 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_301) }, |
2258 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) }, | 2259 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_302) }, |
2259 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) }, | 2260 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_303) }, |
2260 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) }, | 2261 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_304) }, |
2261 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) }, | 2262 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_305) }, |
2262 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) }, | 2263 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_306) }, |
2263 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) }, | 2264 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_307) }, |
2264 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) }, | 2265 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_308) }, |
2265 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) }, | 2266 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_309) }, |
2266 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) }, | 2267 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_400) }, |
2267 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) }, | 2268 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_401) }, |
2268 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) }, | 2269 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_402) }, |
2269 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) }, | 2270 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_403) }, |
2270 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) }, | 2271 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_404) }, |
2271 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) }, | 2272 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_405) }, |
2272 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) }, | 2273 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_500) }, |
2273 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) }, | 2274 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_501) }, |
2274 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) }, | 2275 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502) }, |
2275 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) }, | 2276 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503) }, |
2276 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) }, | 2277 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504) }, |
2277 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) }, | 2278 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000) }, |
2278 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) }, | 2279 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001) }, |
2279 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) }, | 2280 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002) }, |
2280 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) }, | 2281 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1003) }, |
2281 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) }, | 2282 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004) }, |
2282 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) }, | 2283 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005) }, |
2283 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, | 2284 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, |
2284 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, | 2285 | { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, |
2285 | { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, | 2286 | { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, |
2286 | { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_410) }, | 2287 | { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_410) }, |
2287 | { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_510) }, | 2288 | { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_SPEAK_510) }, |
2288 | { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_GN9350E) }, | 2289 | { HID_USB_DEVICE(USB_VENDOR_ID_JABRA, USB_DEVICE_ID_JABRA_GN9350E) }, |
2289 | { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, | 2290 | { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, |
2290 | { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, | 2291 | { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, |
2291 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, | 2292 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, |
2292 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_KYE, 0x0058) }, | 2293 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_KYE, 0x0058) }, |
2293 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, | 2294 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, |
2294 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY2) }, | 2295 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY2) }, |
2295 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, | 2296 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, |
2296 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY2) }, | 2297 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY2) }, |
2297 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, | 2298 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, |
2298 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY2) }, | 2299 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY2) }, |
2299 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYVOLTAGE) }, | 2300 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYVOLTAGE) }, |
2300 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYCURRENT) }, | 2301 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYCURRENT) }, |
2301 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) }, | 2302 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) }, |
2302 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) }, | 2303 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) }, |
2303 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) }, | 2304 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) }, |
2304 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) }, | 2305 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) }, |
2305 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) }, | 2306 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) }, |
2306 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) }, | 2307 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) }, |
2307 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIC) }, | 2308 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIC) }, |
2308 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIB) }, | 2309 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIB) }, |
2309 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY) }, | 2310 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY) }, |
2310 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) }, | 2311 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_XRAY2) }, |
2311 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) }, | 2312 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_VIDEOCOM) }, |
2312 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOTOR) }, | 2313 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOTOR) }, |
2313 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) }, | 2314 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_COM3LAB) }, |
2314 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) }, | 2315 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_TELEPORT) }, |
2315 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) }, | 2316 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_NETWORKANALYSER) }, |
2316 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) }, | 2317 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERCONTROL) }, |
2317 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) }, | 2318 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST) }, |
2318 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER) }, | 2319 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER) }, |
2319 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER2) }, | 2320 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOSTANALYSER2) }, |
2320 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_ABSESP) }, | 2321 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_ABSESP) }, |
2321 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_AUTODATABUS) }, | 2322 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_AUTODATABUS) }, |
2322 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, | 2323 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, |
2323 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, | 2324 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
2324 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, | 2325 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
2325 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, | 2326 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, |
2326 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, | 2327 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
2327 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, | 2328 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
2328 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, | 2329 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
2329 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, | 2330 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) }, |
2330 | { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, | 2331 | { HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) }, |
2331 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, | 2332 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) }, |
2332 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, | 2333 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) }, |
2333 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) }, | 2334 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30) }, |
2334 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) }, | 2335 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100) }, |
2335 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) }, | 2336 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 108) }, |
2336 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) }, | 2337 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 118) }, |
2337 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) }, | 2338 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200) }, |
2338 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) }, | 2339 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 300) }, |
2339 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) }, | 2340 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 400) }, |
2340 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) }, | 2341 | { HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 500) }, |
2341 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) }, | 2342 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0001) }, |
2342 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, | 2343 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, |
2343 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, | 2344 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, |
2344 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, | 2345 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, |
2345 | { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, | 2346 | { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, |
2346 | { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, | 2347 | { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, |
2347 | #if defined(CONFIG_MOUSE_SYNAPTICS_USB) || defined(CONFIG_MOUSE_SYNAPTICS_USB_MODULE) | 2348 | #if defined(CONFIG_MOUSE_SYNAPTICS_USB) || defined(CONFIG_MOUSE_SYNAPTICS_USB_MODULE) |
2348 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP) }, | 2349 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP) }, |
2349 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_INT_TP) }, | 2350 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_INT_TP) }, |
2350 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_CPAD) }, | 2351 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_CPAD) }, |
2351 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_STICK) }, | 2352 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_STICK) }, |
2352 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WP) }, | 2353 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WP) }, |
2353 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_COMP_TP) }, | 2354 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_COMP_TP) }, |
2354 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WTP) }, | 2355 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_WTP) }, |
2355 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) }, | 2356 | { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) }, |
2356 | #endif | 2357 | #endif |
2357 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, | 2358 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, |
2358 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, | 2359 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, |
2359 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, | 2360 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, |
2360 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, | 2361 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, |
2361 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, | 2362 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, |
2362 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, | 2363 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, |
2363 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, | 2364 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, |
2364 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, | 2365 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, |
2365 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, | 2366 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, |
2366 | { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) }, | 2367 | { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) }, |
2367 | { } | 2368 | { } |
2368 | }; | 2369 | }; |
2369 | 2370 | ||
2370 | /** | 2371 | /** |
2371 | * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer | 2372 | * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer |
2372 | * | 2373 | * |
2373 | * There are composite devices for which we want to ignore only a certain | 2374 | * There are composite devices for which we want to ignore only a certain |
2374 | * interface. This is a list of devices for which only the mouse interface will | 2375 | * interface. This is a list of devices for which only the mouse interface will |
2375 | * be ignored. This allows a dedicated driver to take care of the interface. | 2376 | * be ignored. This allows a dedicated driver to take care of the interface. |
2376 | */ | 2377 | */ |
2377 | static const struct hid_device_id hid_mouse_ignore_list[] = { | 2378 | static const struct hid_device_id hid_mouse_ignore_list[] = { |
2378 | /* appletouch driver */ | 2379 | /* appletouch driver */ |
2379 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, | 2380 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
2380 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, | 2381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
2381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, | 2382 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
2382 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, | 2383 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, |
2383 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, | 2384 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, |
2384 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, | 2385 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, |
2385 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, | 2386 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, |
2386 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, | 2387 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, |
2387 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, | 2388 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, |
2388 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, | 2389 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, |
2389 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, | 2390 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, |
2390 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, | 2391 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, |
2391 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, | 2392 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, |
2392 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, | 2393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, |
2393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, | 2394 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, |
2394 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, | 2395 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, |
2395 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, | 2396 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, |
2396 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, | 2397 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, |
2397 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, | 2398 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, |
2398 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, | 2399 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, |
2399 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, | 2400 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, |
2400 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, | 2401 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, |
2401 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, | 2402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, |
2402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, | 2403 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) }, |
2403 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, | 2404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) }, |
2404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, | 2405 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) }, |
2405 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, | 2406 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) }, |
2406 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, | 2407 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) }, |
2407 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, | 2408 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) }, |
2408 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, | 2409 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) }, |
2409 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, | 2410 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) }, |
2410 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, | 2411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) }, |
2411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, | 2412 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) }, |
2412 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, | 2413 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) }, |
2413 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, | 2414 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) }, |
2414 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, | 2415 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) }, |
2415 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, | 2416 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) }, |
2416 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, | 2417 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) }, |
2417 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, | 2418 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
2418 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, | 2419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
2419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, | 2420 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
2420 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 2421 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
2421 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 2422 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
2422 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 2423 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
2423 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | 2424 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, |
2424 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | 2425 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, |
2425 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | 2426 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, |
2426 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, | 2427 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, |
2427 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, | 2428 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, |
2428 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, | 2429 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, |
2429 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 2430 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
2430 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 2431 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
2431 | { } | 2432 | { } |
2432 | }; | 2433 | }; |
2433 | 2434 | ||
2434 | bool hid_ignore(struct hid_device *hdev) | 2435 | bool hid_ignore(struct hid_device *hdev) |
2435 | { | 2436 | { |
2436 | if (hdev->quirks & HID_QUIRK_NO_IGNORE) | 2437 | if (hdev->quirks & HID_QUIRK_NO_IGNORE) |
2437 | return false; | 2438 | return false; |
2438 | if (hdev->quirks & HID_QUIRK_IGNORE) | 2439 | if (hdev->quirks & HID_QUIRK_IGNORE) |
2439 | return true; | 2440 | return true; |
2440 | 2441 | ||
2441 | switch (hdev->vendor) { | 2442 | switch (hdev->vendor) { |
2442 | case USB_VENDOR_ID_CODEMERCS: | 2443 | case USB_VENDOR_ID_CODEMERCS: |
2443 | /* ignore all Code Mercenaries IOWarrior devices */ | 2444 | /* ignore all Code Mercenaries IOWarrior devices */ |
2444 | if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && | 2445 | if (hdev->product >= USB_DEVICE_ID_CODEMERCS_IOW_FIRST && |
2445 | hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) | 2446 | hdev->product <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) |
2446 | return true; | 2447 | return true; |
2447 | break; | 2448 | break; |
2448 | case USB_VENDOR_ID_LOGITECH: | 2449 | case USB_VENDOR_ID_LOGITECH: |
2449 | if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && | 2450 | if (hdev->product >= USB_DEVICE_ID_LOGITECH_HARMONY_FIRST && |
2450 | hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) | 2451 | hdev->product <= USB_DEVICE_ID_LOGITECH_HARMONY_LAST) |
2451 | return true; | 2452 | return true; |
2452 | /* | 2453 | /* |
2453 | * The Keene FM transmitter USB device has the same USB ID as | 2454 | * The Keene FM transmitter USB device has the same USB ID as |
2454 | * the Logitech AudioHub Speaker, but it should ignore the hid. | 2455 | * the Logitech AudioHub Speaker, but it should ignore the hid. |
2455 | * Check if the name is that of the Keene device. | 2456 | * Check if the name is that of the Keene device. |
2456 | * For reference: the name of the AudioHub is | 2457 | * For reference: the name of the AudioHub is |
2457 | * "HOLTEK AudioHub Speaker". | 2458 | * "HOLTEK AudioHub Speaker". |
2458 | */ | 2459 | */ |
2459 | if (hdev->product == USB_DEVICE_ID_LOGITECH_AUDIOHUB && | 2460 | if (hdev->product == USB_DEVICE_ID_LOGITECH_AUDIOHUB && |
2460 | !strcmp(hdev->name, "HOLTEK B-LINK USB Audio ")) | 2461 | !strcmp(hdev->name, "HOLTEK B-LINK USB Audio ")) |
2461 | return true; | 2462 | return true; |
2462 | break; | 2463 | break; |
2463 | case USB_VENDOR_ID_SOUNDGRAPH: | 2464 | case USB_VENDOR_ID_SOUNDGRAPH: |
2464 | if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST && | 2465 | if (hdev->product >= USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST && |
2465 | hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST) | 2466 | hdev->product <= USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST) |
2466 | return true; | 2467 | return true; |
2467 | break; | 2468 | break; |
2468 | case USB_VENDOR_ID_HANWANG: | 2469 | case USB_VENDOR_ID_HANWANG: |
2469 | if (hdev->product >= USB_DEVICE_ID_HANWANG_TABLET_FIRST && | 2470 | if (hdev->product >= USB_DEVICE_ID_HANWANG_TABLET_FIRST && |
2470 | hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST) | 2471 | hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST) |
2471 | return true; | 2472 | return true; |
2472 | break; | 2473 | break; |
2473 | case USB_VENDOR_ID_JESS: | 2474 | case USB_VENDOR_ID_JESS: |
2474 | if (hdev->product == USB_DEVICE_ID_JESS_YUREX && | 2475 | if (hdev->product == USB_DEVICE_ID_JESS_YUREX && |
2475 | hdev->type == HID_TYPE_USBNONE) | 2476 | hdev->type == HID_TYPE_USBNONE) |
2476 | return true; | 2477 | return true; |
2477 | break; | 2478 | break; |
2478 | case USB_VENDOR_ID_VELLEMAN: | 2479 | case USB_VENDOR_ID_VELLEMAN: |
2479 | /* These are not HID devices. They are handled by comedi. */ | 2480 | /* These are not HID devices. They are handled by comedi. */ |
2480 | if ((hdev->product >= USB_DEVICE_ID_VELLEMAN_K8055_FIRST && | 2481 | if ((hdev->product >= USB_DEVICE_ID_VELLEMAN_K8055_FIRST && |
2481 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8055_LAST) || | 2482 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8055_LAST) || |
2482 | (hdev->product >= USB_DEVICE_ID_VELLEMAN_K8061_FIRST && | 2483 | (hdev->product >= USB_DEVICE_ID_VELLEMAN_K8061_FIRST && |
2483 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) | 2484 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) |
2484 | return true; | 2485 | return true; |
2485 | break; | 2486 | break; |
2486 | case USB_VENDOR_ID_ATMEL_V_USB: | 2487 | case USB_VENDOR_ID_ATMEL_V_USB: |
2487 | /* Masterkit MA901 usb radio based on Atmel tiny85 chip and | 2488 | /* Masterkit MA901 usb radio based on Atmel tiny85 chip and |
2488 | * it has the same USB ID as many Atmel V-USB devices. This | 2489 | * it has the same USB ID as many Atmel V-USB devices. This |
2489 | * usb radio is handled by radio-ma901.c driver so we want | 2490 | * usb radio is handled by radio-ma901.c driver so we want |
2490 | * ignore the hid. Check the name, bus, product and ignore | 2491 | * ignore the hid. Check the name, bus, product and ignore |
2491 | * if we have MA901 usb radio. | 2492 | * if we have MA901 usb radio. |
2492 | */ | 2493 | */ |
2493 | if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB && | 2494 | if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB && |
2494 | hdev->bus == BUS_USB && | 2495 | hdev->bus == BUS_USB && |
2495 | strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0) | 2496 | strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0) |
2496 | return true; | 2497 | return true; |
2497 | break; | 2498 | break; |
2498 | } | 2499 | } |
2499 | 2500 | ||
2500 | if (hdev->type == HID_TYPE_USBMOUSE && | 2501 | if (hdev->type == HID_TYPE_USBMOUSE && |
2501 | hid_match_id(hdev, hid_mouse_ignore_list)) | 2502 | hid_match_id(hdev, hid_mouse_ignore_list)) |
2502 | return true; | 2503 | return true; |
2503 | 2504 | ||
2504 | return !!hid_match_id(hdev, hid_ignore_list); | 2505 | return !!hid_match_id(hdev, hid_ignore_list); |
2505 | } | 2506 | } |
2506 | EXPORT_SYMBOL_GPL(hid_ignore); | 2507 | EXPORT_SYMBOL_GPL(hid_ignore); |
2507 | 2508 | ||
2508 | int hid_add_device(struct hid_device *hdev) | 2509 | int hid_add_device(struct hid_device *hdev) |
2509 | { | 2510 | { |
2510 | static atomic_t id = ATOMIC_INIT(0); | 2511 | static atomic_t id = ATOMIC_INIT(0); |
2511 | int ret; | 2512 | int ret; |
2512 | 2513 | ||
2513 | if (WARN_ON(hdev->status & HID_STAT_ADDED)) | 2514 | if (WARN_ON(hdev->status & HID_STAT_ADDED)) |
2514 | return -EBUSY; | 2515 | return -EBUSY; |
2515 | 2516 | ||
2516 | /* we need to kill them here, otherwise they will stay allocated to | 2517 | /* we need to kill them here, otherwise they will stay allocated to |
2517 | * wait for coming driver */ | 2518 | * wait for coming driver */ |
2518 | if (hid_ignore(hdev)) | 2519 | if (hid_ignore(hdev)) |
2519 | return -ENODEV; | 2520 | return -ENODEV; |
2520 | 2521 | ||
2521 | /* | 2522 | /* |
2522 | * Check for the mandatory transport channel. | 2523 | * Check for the mandatory transport channel. |
2523 | */ | 2524 | */ |
2524 | if (!hdev->ll_driver->raw_request) { | 2525 | if (!hdev->ll_driver->raw_request) { |
2525 | hid_err(hdev, "transport driver missing .raw_request()\n"); | 2526 | hid_err(hdev, "transport driver missing .raw_request()\n"); |
2526 | return -EINVAL; | 2527 | return -EINVAL; |
2527 | } | 2528 | } |
2528 | 2529 | ||
2529 | /* | 2530 | /* |
2530 | * Read the device report descriptor once and use as template | 2531 | * Read the device report descriptor once and use as template |
2531 | * for the driver-specific modifications. | 2532 | * for the driver-specific modifications. |
2532 | */ | 2533 | */ |
2533 | ret = hdev->ll_driver->parse(hdev); | 2534 | ret = hdev->ll_driver->parse(hdev); |
2534 | if (ret) | 2535 | if (ret) |
2535 | return ret; | 2536 | return ret; |
2536 | if (!hdev->dev_rdesc) | 2537 | if (!hdev->dev_rdesc) |
2537 | return -ENODEV; | 2538 | return -ENODEV; |
2538 | 2539 | ||
2539 | /* | 2540 | /* |
2540 | * Scan generic devices for group information | 2541 | * Scan generic devices for group information |
2541 | */ | 2542 | */ |
2542 | if (hid_ignore_special_drivers || | 2543 | if (hid_ignore_special_drivers || |
2543 | (!hdev->group && | 2544 | (!hdev->group && |
2544 | !hid_match_id(hdev, hid_have_special_driver))) { | 2545 | !hid_match_id(hdev, hid_have_special_driver))) { |
2545 | ret = hid_scan_report(hdev); | 2546 | ret = hid_scan_report(hdev); |
2546 | if (ret) | 2547 | if (ret) |
2547 | hid_warn(hdev, "bad device descriptor (%d)\n", ret); | 2548 | hid_warn(hdev, "bad device descriptor (%d)\n", ret); |
2548 | } | 2549 | } |
2549 | 2550 | ||
2550 | /* XXX hack, any other cleaner solution after the driver core | 2551 | /* XXX hack, any other cleaner solution after the driver core |
2551 | * is converted to allow more than 20 bytes as the device name? */ | 2552 | * is converted to allow more than 20 bytes as the device name? */ |
2552 | dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, | 2553 | dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus, |
2553 | hdev->vendor, hdev->product, atomic_inc_return(&id)); | 2554 | hdev->vendor, hdev->product, atomic_inc_return(&id)); |
2554 | 2555 | ||
2555 | hid_debug_register(hdev, dev_name(&hdev->dev)); | 2556 | hid_debug_register(hdev, dev_name(&hdev->dev)); |
2556 | ret = device_add(&hdev->dev); | 2557 | ret = device_add(&hdev->dev); |
2557 | if (!ret) | 2558 | if (!ret) |
2558 | hdev->status |= HID_STAT_ADDED; | 2559 | hdev->status |= HID_STAT_ADDED; |
2559 | else | 2560 | else |
2560 | hid_debug_unregister(hdev); | 2561 | hid_debug_unregister(hdev); |
2561 | 2562 | ||
2562 | return ret; | 2563 | return ret; |
2563 | } | 2564 | } |
2564 | EXPORT_SYMBOL_GPL(hid_add_device); | 2565 | EXPORT_SYMBOL_GPL(hid_add_device); |
2565 | 2566 | ||
2566 | /** | 2567 | /** |
2567 | * hid_allocate_device - allocate new hid device descriptor | 2568 | * hid_allocate_device - allocate new hid device descriptor |
2568 | * | 2569 | * |
2569 | * Allocate and initialize hid device, so that hid_destroy_device might be | 2570 | * Allocate and initialize hid device, so that hid_destroy_device might be |
2570 | * used to free it. | 2571 | * used to free it. |
2571 | * | 2572 | * |
2572 | * New hid_device pointer is returned on success, otherwise ERR_PTR encoded | 2573 | * New hid_device pointer is returned on success, otherwise ERR_PTR encoded |
2573 | * error value. | 2574 | * error value. |
2574 | */ | 2575 | */ |
2575 | struct hid_device *hid_allocate_device(void) | 2576 | struct hid_device *hid_allocate_device(void) |
2576 | { | 2577 | { |
2577 | struct hid_device *hdev; | 2578 | struct hid_device *hdev; |
2578 | int ret = -ENOMEM; | 2579 | int ret = -ENOMEM; |
2579 | 2580 | ||
2580 | hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); | 2581 | hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); |
2581 | if (hdev == NULL) | 2582 | if (hdev == NULL) |
2582 | return ERR_PTR(ret); | 2583 | return ERR_PTR(ret); |
2583 | 2584 | ||
2584 | device_initialize(&hdev->dev); | 2585 | device_initialize(&hdev->dev); |
2585 | hdev->dev.release = hid_device_release; | 2586 | hdev->dev.release = hid_device_release; |
2586 | hdev->dev.bus = &hid_bus_type; | 2587 | hdev->dev.bus = &hid_bus_type; |
2587 | 2588 | ||
2588 | hid_close_report(hdev); | 2589 | hid_close_report(hdev); |
2589 | 2590 | ||
2590 | init_waitqueue_head(&hdev->debug_wait); | 2591 | init_waitqueue_head(&hdev->debug_wait); |
2591 | INIT_LIST_HEAD(&hdev->debug_list); | 2592 | INIT_LIST_HEAD(&hdev->debug_list); |
2592 | spin_lock_init(&hdev->debug_list_lock); | 2593 | spin_lock_init(&hdev->debug_list_lock); |
2593 | sema_init(&hdev->driver_lock, 1); | 2594 | sema_init(&hdev->driver_lock, 1); |
2594 | sema_init(&hdev->driver_input_lock, 1); | 2595 | sema_init(&hdev->driver_input_lock, 1); |
2595 | 2596 | ||
2596 | return hdev; | 2597 | return hdev; |
2597 | } | 2598 | } |
2598 | EXPORT_SYMBOL_GPL(hid_allocate_device); | 2599 | EXPORT_SYMBOL_GPL(hid_allocate_device); |
2599 | 2600 | ||
2600 | static void hid_remove_device(struct hid_device *hdev) | 2601 | static void hid_remove_device(struct hid_device *hdev) |
2601 | { | 2602 | { |
2602 | if (hdev->status & HID_STAT_ADDED) { | 2603 | if (hdev->status & HID_STAT_ADDED) { |
2603 | device_del(&hdev->dev); | 2604 | device_del(&hdev->dev); |
2604 | hid_debug_unregister(hdev); | 2605 | hid_debug_unregister(hdev); |
2605 | hdev->status &= ~HID_STAT_ADDED; | 2606 | hdev->status &= ~HID_STAT_ADDED; |
2606 | } | 2607 | } |
2607 | kfree(hdev->dev_rdesc); | 2608 | kfree(hdev->dev_rdesc); |
2608 | hdev->dev_rdesc = NULL; | 2609 | hdev->dev_rdesc = NULL; |
2609 | hdev->dev_rsize = 0; | 2610 | hdev->dev_rsize = 0; |
2610 | } | 2611 | } |
2611 | 2612 | ||
2612 | /** | 2613 | /** |
2613 | * hid_destroy_device - free previously allocated device | 2614 | * hid_destroy_device - free previously allocated device |
2614 | * | 2615 | * |
2615 | * @hdev: hid device | 2616 | * @hdev: hid device |
2616 | * | 2617 | * |
2617 | * If you allocate hid_device through hid_allocate_device, you should ever | 2618 | * If you allocate hid_device through hid_allocate_device, you should ever |
2618 | * free by this function. | 2619 | * free by this function. |
2619 | */ | 2620 | */ |
2620 | void hid_destroy_device(struct hid_device *hdev) | 2621 | void hid_destroy_device(struct hid_device *hdev) |
2621 | { | 2622 | { |
2622 | hid_remove_device(hdev); | 2623 | hid_remove_device(hdev); |
2623 | put_device(&hdev->dev); | 2624 | put_device(&hdev->dev); |
2624 | } | 2625 | } |
2625 | EXPORT_SYMBOL_GPL(hid_destroy_device); | 2626 | EXPORT_SYMBOL_GPL(hid_destroy_device); |
2626 | 2627 | ||
2627 | int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, | 2628 | int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, |
2628 | const char *mod_name) | 2629 | const char *mod_name) |
2629 | { | 2630 | { |
2630 | int ret; | 2631 | int ret; |
2631 | 2632 | ||
2632 | hdrv->driver.name = hdrv->name; | 2633 | hdrv->driver.name = hdrv->name; |
2633 | hdrv->driver.bus = &hid_bus_type; | 2634 | hdrv->driver.bus = &hid_bus_type; |
2634 | hdrv->driver.owner = owner; | 2635 | hdrv->driver.owner = owner; |
2635 | hdrv->driver.mod_name = mod_name; | 2636 | hdrv->driver.mod_name = mod_name; |
2636 | 2637 | ||
2637 | INIT_LIST_HEAD(&hdrv->dyn_list); | 2638 | INIT_LIST_HEAD(&hdrv->dyn_list); |
2638 | spin_lock_init(&hdrv->dyn_lock); | 2639 | spin_lock_init(&hdrv->dyn_lock); |
2639 | 2640 | ||
2640 | ret = driver_register(&hdrv->driver); | 2641 | ret = driver_register(&hdrv->driver); |
2641 | if (ret) | 2642 | if (ret) |
2642 | return ret; | 2643 | return ret; |
2643 | 2644 | ||
2644 | ret = driver_create_file(&hdrv->driver, &driver_attr_new_id); | 2645 | ret = driver_create_file(&hdrv->driver, &driver_attr_new_id); |
2645 | if (ret) | 2646 | if (ret) |
2646 | driver_unregister(&hdrv->driver); | 2647 | driver_unregister(&hdrv->driver); |
2647 | 2648 | ||
2648 | return ret; | 2649 | return ret; |
2649 | } | 2650 | } |
2650 | EXPORT_SYMBOL_GPL(__hid_register_driver); | 2651 | EXPORT_SYMBOL_GPL(__hid_register_driver); |
2651 | 2652 | ||
2652 | void hid_unregister_driver(struct hid_driver *hdrv) | 2653 | void hid_unregister_driver(struct hid_driver *hdrv) |
2653 | { | 2654 | { |
2654 | driver_remove_file(&hdrv->driver, &driver_attr_new_id); | 2655 | driver_remove_file(&hdrv->driver, &driver_attr_new_id); |
2655 | driver_unregister(&hdrv->driver); | 2656 | driver_unregister(&hdrv->driver); |
2656 | hid_free_dynids(hdrv); | 2657 | hid_free_dynids(hdrv); |
2657 | } | 2658 | } |
2658 | EXPORT_SYMBOL_GPL(hid_unregister_driver); | 2659 | EXPORT_SYMBOL_GPL(hid_unregister_driver); |
2659 | 2660 | ||
2660 | int hid_check_keys_pressed(struct hid_device *hid) | 2661 | int hid_check_keys_pressed(struct hid_device *hid) |
2661 | { | 2662 | { |
2662 | struct hid_input *hidinput; | 2663 | struct hid_input *hidinput; |
2663 | int i; | 2664 | int i; |
2664 | 2665 | ||
2665 | if (!(hid->claimed & HID_CLAIMED_INPUT)) | 2666 | if (!(hid->claimed & HID_CLAIMED_INPUT)) |
2666 | return 0; | 2667 | return 0; |
2667 | 2668 | ||
2668 | list_for_each_entry(hidinput, &hid->inputs, list) { | 2669 | list_for_each_entry(hidinput, &hid->inputs, list) { |
2669 | for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) | 2670 | for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) |
2670 | if (hidinput->input->key[i]) | 2671 | if (hidinput->input->key[i]) |
2671 | return 1; | 2672 | return 1; |
2672 | } | 2673 | } |
2673 | 2674 | ||
2674 | return 0; | 2675 | return 0; |
2675 | } | 2676 | } |
2676 | 2677 | ||
2677 | EXPORT_SYMBOL_GPL(hid_check_keys_pressed); | 2678 | EXPORT_SYMBOL_GPL(hid_check_keys_pressed); |
2678 | 2679 | ||
2679 | static int __init hid_init(void) | 2680 | static int __init hid_init(void) |
2680 | { | 2681 | { |
2681 | int ret; | 2682 | int ret; |
2682 | 2683 | ||
2683 | if (hid_debug) | 2684 | if (hid_debug) |
2684 | pr_warn("hid_debug is now used solely for parser and driver debugging.\n" | 2685 | pr_warn("hid_debug is now used solely for parser and driver debugging.\n" |
2685 | "debugfs is now used for inspecting the device (report descriptor, reports)\n"); | 2686 | "debugfs is now used for inspecting the device (report descriptor, reports)\n"); |
2686 | 2687 | ||
2687 | ret = bus_register(&hid_bus_type); | 2688 | ret = bus_register(&hid_bus_type); |
2688 | if (ret) { | 2689 | if (ret) { |
2689 | pr_err("can't register hid bus\n"); | 2690 | pr_err("can't register hid bus\n"); |
2690 | goto err; | 2691 | goto err; |
2691 | } | 2692 | } |
2692 | 2693 | ||
2693 | ret = hidraw_init(); | 2694 | ret = hidraw_init(); |
2694 | if (ret) | 2695 | if (ret) |
2695 | goto err_bus; | 2696 | goto err_bus; |
2696 | 2697 | ||
2697 | hid_debug_init(); | 2698 | hid_debug_init(); |
2698 | 2699 | ||
2699 | return 0; | 2700 | return 0; |
2700 | err_bus: | 2701 | err_bus: |
2701 | bus_unregister(&hid_bus_type); | 2702 | bus_unregister(&hid_bus_type); |
2702 | err: | 2703 | err: |
2703 | return ret; | 2704 | return ret; |
2704 | } | 2705 | } |
2705 | 2706 | ||
2706 | static void __exit hid_exit(void) | 2707 | static void __exit hid_exit(void) |
2707 | { | 2708 | { |
2708 | hid_debug_exit(); | 2709 | hid_debug_exit(); |
2709 | hidraw_exit(); | 2710 | hidraw_exit(); |
2710 | bus_unregister(&hid_bus_type); | 2711 | bus_unregister(&hid_bus_type); |
2711 | } | 2712 | } |
2712 | 2713 | ||
2713 | module_init(hid_init); | 2714 | module_init(hid_init); |
2714 | module_exit(hid_exit); | 2715 | module_exit(hid_exit); |
2715 | 2716 | ||
2716 | MODULE_AUTHOR("Andreas Gal"); | 2717 | MODULE_AUTHOR("Andreas Gal"); |
2717 | MODULE_AUTHOR("Vojtech Pavlik"); | 2718 | MODULE_AUTHOR("Vojtech Pavlik"); |
2718 | MODULE_AUTHOR("Jiri Kosina"); | 2719 | MODULE_AUTHOR("Jiri Kosina"); |
2719 | MODULE_LICENSE(DRIVER_LICENSE); | 2720 | MODULE_LICENSE(DRIVER_LICENSE); |
2720 | 2721 | ||
2721 | 2722 |
drivers/hid/hid-ids.h
1 | /* | 1 | /* |
2 | * USB HID quirks support for Linux | 2 | * USB HID quirks support for Linux |
3 | * | 3 | * |
4 | * Copyright (c) 1999 Andreas Gal | 4 | * Copyright (c) 1999 Andreas Gal |
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
7 | * Copyright (c) 2006-2007 Jiri Kosina | 7 | * Copyright (c) 2006-2007 Jiri Kosina |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * This program is free software; you can redistribute it and/or modify it | 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 | 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) | 13 | * Software Foundation; either version 2 of the License, or (at your option) |
14 | * any later version. | 14 | * any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef HID_IDS_H_FILE | 17 | #ifndef HID_IDS_H_FILE |
18 | #define HID_IDS_H_FILE | 18 | #define HID_IDS_H_FILE |
19 | 19 | ||
20 | #define USB_VENDOR_ID_3M 0x0596 | 20 | #define USB_VENDOR_ID_3M 0x0596 |
21 | #define USB_DEVICE_ID_3M1968 0x0500 | 21 | #define USB_DEVICE_ID_3M1968 0x0500 |
22 | #define USB_DEVICE_ID_3M2256 0x0502 | 22 | #define USB_DEVICE_ID_3M2256 0x0502 |
23 | #define USB_DEVICE_ID_3M3266 0x0506 | 23 | #define USB_DEVICE_ID_3M3266 0x0506 |
24 | 24 | ||
25 | #define USB_VENDOR_ID_A4TECH 0x09da | 25 | #define USB_VENDOR_ID_A4TECH 0x09da |
26 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 | 26 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 |
27 | #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a | 27 | #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a |
28 | #define USB_DEVICE_ID_A4TECH_RP_649 0x001a | 28 | #define USB_DEVICE_ID_A4TECH_RP_649 0x001a |
29 | 29 | ||
30 | #define USB_VENDOR_ID_AASHIMA 0x06d6 | 30 | #define USB_VENDOR_ID_AASHIMA 0x06d6 |
31 | #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 | 31 | #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 |
32 | #define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026 | 32 | #define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026 |
33 | 33 | ||
34 | #define USB_VENDOR_ID_ACECAD 0x0460 | 34 | #define USB_VENDOR_ID_ACECAD 0x0460 |
35 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 | 35 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 |
36 | #define USB_DEVICE_ID_ACECAD_302 0x0008 | 36 | #define USB_DEVICE_ID_ACECAD_302 0x0008 |
37 | 37 | ||
38 | #define USB_VENDOR_ID_ACRUX 0x1a34 | 38 | #define USB_VENDOR_ID_ACRUX 0x1a34 |
39 | 39 | ||
40 | #define USB_VENDOR_ID_ACTIONSTAR 0x2101 | 40 | #define USB_VENDOR_ID_ACTIONSTAR 0x2101 |
41 | #define USB_DEVICE_ID_ACTIONSTAR_1011 0x1011 | 41 | #define USB_DEVICE_ID_ACTIONSTAR_1011 0x1011 |
42 | 42 | ||
43 | #define USB_VENDOR_ID_ADS_TECH 0x06e1 | 43 | #define USB_VENDOR_ID_ADS_TECH 0x06e1 |
44 | #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 | 44 | #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155 |
45 | 45 | ||
46 | #define USB_VENDOR_ID_AFATECH 0x15a4 | 46 | #define USB_VENDOR_ID_AFATECH 0x15a4 |
47 | #define USB_DEVICE_ID_AFATECH_AF9016 0x9016 | 47 | #define USB_DEVICE_ID_AFATECH_AF9016 0x9016 |
48 | 48 | ||
49 | #define USB_VENDOR_ID_AIPTEK 0x08ca | 49 | #define USB_VENDOR_ID_AIPTEK 0x08ca |
50 | #define USB_DEVICE_ID_AIPTEK_01 0x0001 | 50 | #define USB_DEVICE_ID_AIPTEK_01 0x0001 |
51 | #define USB_DEVICE_ID_AIPTEK_10 0x0010 | 51 | #define USB_DEVICE_ID_AIPTEK_10 0x0010 |
52 | #define USB_DEVICE_ID_AIPTEK_20 0x0020 | 52 | #define USB_DEVICE_ID_AIPTEK_20 0x0020 |
53 | #define USB_DEVICE_ID_AIPTEK_21 0x0021 | 53 | #define USB_DEVICE_ID_AIPTEK_21 0x0021 |
54 | #define USB_DEVICE_ID_AIPTEK_22 0x0022 | 54 | #define USB_DEVICE_ID_AIPTEK_22 0x0022 |
55 | #define USB_DEVICE_ID_AIPTEK_23 0x0023 | 55 | #define USB_DEVICE_ID_AIPTEK_23 0x0023 |
56 | #define USB_DEVICE_ID_AIPTEK_24 0x0024 | 56 | #define USB_DEVICE_ID_AIPTEK_24 0x0024 |
57 | 57 | ||
58 | #define USB_VENDOR_ID_AIRCABLE 0x16CA | 58 | #define USB_VENDOR_ID_AIRCABLE 0x16CA |
59 | #define USB_DEVICE_ID_AIRCABLE1 0x1502 | 59 | #define USB_DEVICE_ID_AIRCABLE1 0x1502 |
60 | 60 | ||
61 | #define USB_VENDOR_ID_AIREN 0x1a2c | 61 | #define USB_VENDOR_ID_AIREN 0x1a2c |
62 | #define USB_DEVICE_ID_AIREN_SLIMPLUS 0x0002 | 62 | #define USB_DEVICE_ID_AIREN_SLIMPLUS 0x0002 |
63 | 63 | ||
64 | #define USB_VENDOR_ID_ALCOR 0x058f | 64 | #define USB_VENDOR_ID_ALCOR 0x058f |
65 | #define USB_DEVICE_ID_ALCOR_USBRS232 0x9720 | 65 | #define USB_DEVICE_ID_ALCOR_USBRS232 0x9720 |
66 | 66 | ||
67 | #define USB_VENDOR_ID_ALPS 0x0433 | 67 | #define USB_VENDOR_ID_ALPS 0x0433 |
68 | #define USB_DEVICE_ID_IBM_GAMEPAD 0x1101 | 68 | #define USB_DEVICE_ID_IBM_GAMEPAD 0x1101 |
69 | 69 | ||
70 | #define USB_VENDOR_ID_ANTON 0x1130 | 70 | #define USB_VENDOR_ID_ANTON 0x1130 |
71 | #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101 | 71 | #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101 |
72 | 72 | ||
73 | #define USB_VENDOR_ID_APPLE 0x05ac | 73 | #define USB_VENDOR_ID_APPLE 0x05ac |
74 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 | 74 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 |
75 | #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d | 75 | #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d |
76 | #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e | 76 | #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e |
77 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e | 77 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e |
78 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f | 78 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f |
79 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 | 79 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 |
80 | #define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215 | 80 | #define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215 |
81 | #define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216 | 81 | #define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216 |
82 | #define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217 | 82 | #define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217 |
83 | #define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218 | 83 | #define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218 |
84 | #define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219 | 84 | #define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219 |
85 | #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a | 85 | #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a |
86 | #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b | 86 | #define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b |
87 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c | 87 | #define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c |
88 | #define USB_DEVICE_ID_APPLE_ALU_MINI_ANSI 0x021d | 88 | #define USB_DEVICE_ID_APPLE_ALU_MINI_ANSI 0x021d |
89 | #define USB_DEVICE_ID_APPLE_ALU_MINI_ISO 0x021e | 89 | #define USB_DEVICE_ID_APPLE_ALU_MINI_ISO 0x021e |
90 | #define USB_DEVICE_ID_APPLE_ALU_MINI_JIS 0x021f | 90 | #define USB_DEVICE_ID_APPLE_ALU_MINI_JIS 0x021f |
91 | #define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220 | 91 | #define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220 |
92 | #define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221 | 92 | #define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221 |
93 | #define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222 | 93 | #define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222 |
94 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 | 94 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 |
95 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 | 95 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 |
96 | #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 | 96 | #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 |
97 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229 | 97 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229 |
98 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a | 98 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a |
99 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b | 99 | #define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b |
100 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c | 100 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c |
101 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d | 101 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d |
102 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e | 102 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e |
103 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 | 103 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 |
104 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 | 104 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 |
105 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 | 105 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 |
106 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 | 106 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 |
107 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 | 107 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 |
108 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 | 108 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 |
109 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f | 109 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f |
110 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240 | 110 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240 |
111 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241 | 111 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241 |
112 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 | 112 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 |
113 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 | 113 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 |
114 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244 | 114 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244 |
115 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245 | 115 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI 0x0245 |
116 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246 | 116 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_ISO 0x0246 |
117 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247 | 117 | #define USB_DEVICE_ID_APPLE_WELLSPRING5_JIS 0x0247 |
118 | #define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f | 118 | #define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f |
119 | #define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250 | 119 | #define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250 |
120 | #define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251 | 120 | #define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251 |
121 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 | 121 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 |
122 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 | 122 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 |
123 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 | 123 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 |
124 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | 124 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 |
125 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | 125 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a |
126 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | 126 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b |
127 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 | 127 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 |
128 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a | 128 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a |
129 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b | 129 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b |
130 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c | 130 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c |
131 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d | 131 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d |
132 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e | 132 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e |
133 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | 133 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 |
134 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | 134 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 |
135 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | 135 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 |
136 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 | 136 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 |
137 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a | 137 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a |
138 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b | 138 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b |
139 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI 0x0255 | 139 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI 0x0255 |
140 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256 | 140 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256 |
141 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS 0x0257 | 141 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS 0x0257 |
142 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 | 142 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 |
143 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 | 143 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 |
144 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 | 144 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 |
145 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a | 145 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a |
146 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b | 146 | #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b |
147 | #define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240 | 147 | #define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240 |
148 | #define USB_DEVICE_ID_APPLE_IRCONTROL2 0x1440 | 148 | #define USB_DEVICE_ID_APPLE_IRCONTROL2 0x1440 |
149 | #define USB_DEVICE_ID_APPLE_IRCONTROL3 0x8241 | 149 | #define USB_DEVICE_ID_APPLE_IRCONTROL3 0x8241 |
150 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 | 150 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 |
151 | #define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243 | 151 | #define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243 |
152 | 152 | ||
153 | #define USB_VENDOR_ID_ASUS 0x0486 | 153 | #define USB_VENDOR_ID_ASUS 0x0486 |
154 | #define USB_DEVICE_ID_ASUS_T91MT 0x0185 | 154 | #define USB_DEVICE_ID_ASUS_T91MT 0x0185 |
155 | #define USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO 0x0186 | 155 | #define USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO 0x0186 |
156 | 156 | ||
157 | #define USB_VENDOR_ID_ASUSTEK 0x0b05 | 157 | #define USB_VENDOR_ID_ASUSTEK 0x0b05 |
158 | #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 | 158 | #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 |
159 | #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b | 159 | #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b |
160 | 160 | ||
161 | #define USB_VENDOR_ID_ATEN 0x0557 | 161 | #define USB_VENDOR_ID_ATEN 0x0557 |
162 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 | 162 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 |
163 | #define USB_DEVICE_ID_ATEN_CS124U 0x2202 | 163 | #define USB_DEVICE_ID_ATEN_CS124U 0x2202 |
164 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 | 164 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 |
165 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 | 165 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 |
166 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 | 166 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 |
167 | 167 | ||
168 | #define USB_VENDOR_ID_ATMEL 0x03eb | 168 | #define USB_VENDOR_ID_ATMEL 0x03eb |
169 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | 169 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c |
170 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 | 170 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 |
171 | #define USB_VENDOR_ID_ATMEL_V_USB 0x16c0 | 171 | #define USB_VENDOR_ID_ATMEL_V_USB 0x16c0 |
172 | #define USB_DEVICE_ID_ATMEL_V_USB 0x05df | 172 | #define USB_DEVICE_ID_ATMEL_V_USB 0x05df |
173 | 173 | ||
174 | #define USB_VENDOR_ID_AUREAL 0x0755 | 174 | #define USB_VENDOR_ID_AUREAL 0x0755 |
175 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 | 175 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 |
176 | 176 | ||
177 | #define USB_VENDOR_ID_AVERMEDIA 0x07ca | 177 | #define USB_VENDOR_ID_AVERMEDIA 0x07ca |
178 | #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 | 178 | #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 |
179 | 179 | ||
180 | #define USB_VENDOR_ID_AXENTIA 0x12cf | 180 | #define USB_VENDOR_ID_AXENTIA 0x12cf |
181 | #define USB_DEVICE_ID_AXENTIA_FM_RADIO 0x7111 | 181 | #define USB_DEVICE_ID_AXENTIA_FM_RADIO 0x7111 |
182 | 182 | ||
183 | #define USB_VENDOR_ID_BAANTO 0x2453 | 183 | #define USB_VENDOR_ID_BAANTO 0x2453 |
184 | #define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 | 184 | #define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 |
185 | 185 | ||
186 | #define USB_VENDOR_ID_BELKIN 0x050d | 186 | #define USB_VENDOR_ID_BELKIN 0x050d |
187 | #define USB_DEVICE_ID_FLIP_KVM 0x3201 | 187 | #define USB_DEVICE_ID_FLIP_KVM 0x3201 |
188 | 188 | ||
189 | #define USB_VENDOR_ID_BERKSHIRE 0x0c98 | 189 | #define USB_VENDOR_ID_BERKSHIRE 0x0c98 |
190 | #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 | 190 | #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 |
191 | 191 | ||
192 | #define USB_VENDOR_ID_BTC 0x046e | 192 | #define USB_VENDOR_ID_BTC 0x046e |
193 | #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 | 193 | #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 |
194 | #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577 | 194 | #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577 |
195 | 195 | ||
196 | #define USB_VENDOR_ID_CANDO 0x2087 | 196 | #define USB_VENDOR_ID_CANDO 0x2087 |
197 | #define USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH 0x0703 | 197 | #define USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH 0x0703 |
198 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 | 198 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 |
199 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1 0x0a02 | 199 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1 0x0a02 |
200 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 | 200 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 |
201 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01 | 201 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01 |
202 | 202 | ||
203 | #define USB_VENDOR_ID_CH 0x068e | 203 | #define USB_VENDOR_ID_CH 0x068e |
204 | #define USB_DEVICE_ID_CH_PRO_THROTTLE 0x00f1 | 204 | #define USB_DEVICE_ID_CH_PRO_THROTTLE 0x00f1 |
205 | #define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2 | 205 | #define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2 |
206 | #define USB_DEVICE_ID_CH_FIGHTERSTICK 0x00f3 | 206 | #define USB_DEVICE_ID_CH_FIGHTERSTICK 0x00f3 |
207 | #define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4 | 207 | #define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4 |
208 | #define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051 | 208 | #define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051 |
209 | #define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE 0x00ff | 209 | #define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE 0x00ff |
210 | #define USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK 0x00d3 | 210 | #define USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK 0x00d3 |
211 | #define USB_DEVICE_ID_CH_AXIS_295 0x001c | 211 | #define USB_DEVICE_ID_CH_AXIS_295 0x001c |
212 | 212 | ||
213 | #define USB_VENDOR_ID_CHERRY 0x046a | 213 | #define USB_VENDOR_ID_CHERRY 0x046a |
214 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 | 214 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 |
215 | #define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027 | 215 | #define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027 |
216 | 216 | ||
217 | #define USB_VENDOR_ID_CHIC 0x05fe | 217 | #define USB_VENDOR_ID_CHIC 0x05fe |
218 | #define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014 | 218 | #define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014 |
219 | 219 | ||
220 | #define USB_VENDOR_ID_CHICONY 0x04f2 | 220 | #define USB_VENDOR_ID_CHICONY 0x04f2 |
221 | #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 | 221 | #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 |
222 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d | 222 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d |
223 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 | 223 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 |
224 | #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 | 224 | #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 |
225 | #define USB_DEVICE_ID_CHICONY_AK1D 0x1125 | 225 | #define USB_DEVICE_ID_CHICONY_AK1D 0x1125 |
226 | 226 | ||
227 | #define USB_VENDOR_ID_CHUNGHWAT 0x2247 | 227 | #define USB_VENDOR_ID_CHUNGHWAT 0x2247 |
228 | #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 | 228 | #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 |
229 | 229 | ||
230 | #define USB_VENDOR_ID_CIDC 0x1677 | 230 | #define USB_VENDOR_ID_CIDC 0x1677 |
231 | 231 | ||
232 | #define USB_VENDOR_ID_CMEDIA 0x0d8c | 232 | #define USB_VENDOR_ID_CMEDIA 0x0d8c |
233 | #define USB_DEVICE_ID_CM109 0x000e | 233 | #define USB_DEVICE_ID_CM109 0x000e |
234 | 234 | ||
235 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 | 235 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 |
236 | #define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500 | 236 | #define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500 |
237 | #define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff | 237 | #define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff |
238 | 238 | ||
239 | #define USB_VENDOR_ID_CREATIVELABS 0x041e | 239 | #define USB_VENDOR_ID_CREATIVELABS 0x041e |
240 | #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801 | 240 | #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801 |
241 | 241 | ||
242 | #define USB_VENDOR_ID_CVTOUCH 0x1ff7 | 242 | #define USB_VENDOR_ID_CVTOUCH 0x1ff7 |
243 | #define USB_DEVICE_ID_CVTOUCH_SCREEN 0x0013 | 243 | #define USB_DEVICE_ID_CVTOUCH_SCREEN 0x0013 |
244 | 244 | ||
245 | #define USB_VENDOR_ID_CYGNAL 0x10c4 | 245 | #define USB_VENDOR_ID_CYGNAL 0x10c4 |
246 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a | 246 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a |
247 | #define USB_DEVICE_ID_FOCALTECH_FTXXXX_MULTITOUCH 0x81b9 | 247 | #define USB_DEVICE_ID_FOCALTECH_FTXXXX_MULTITOUCH 0x81b9 |
248 | #define USB_DEVICE_ID_CYGNAL_CP2112 0xea90 | 248 | #define USB_DEVICE_ID_CYGNAL_CP2112 0xea90 |
249 | 249 | ||
250 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI4713 0x8244 | 250 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI4713 0x8244 |
251 | 251 | ||
252 | #define USB_VENDOR_ID_CYPRESS 0x04b4 | 252 | #define USB_VENDOR_ID_CYPRESS 0x04b4 |
253 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 | 253 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 |
254 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 | 254 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 |
255 | #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417 | 255 | #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417 |
256 | #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 | 256 | #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 |
257 | #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 | 257 | #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 |
258 | #define USB_DEVICE_ID_CYPRESS_BARCODE_3 0xbca1 | 258 | #define USB_DEVICE_ID_CYPRESS_BARCODE_3 0xbca1 |
259 | #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81 | 259 | #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81 |
260 | #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 | 260 | #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 |
261 | 261 | ||
262 | #define USB_VENDOR_ID_DATA_MODUL 0x7374 | 262 | #define USB_VENDOR_ID_DATA_MODUL 0x7374 |
263 | #define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201 | 263 | #define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201 |
264 | 264 | ||
265 | #define USB_VENDOR_ID_DEALEXTREAME 0x10c5 | 265 | #define USB_VENDOR_ID_DEALEXTREAME 0x10c5 |
266 | #define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a | 266 | #define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a |
267 | 267 | ||
268 | #define USB_VENDOR_ID_DELORME 0x1163 | 268 | #define USB_VENDOR_ID_DELORME 0x1163 |
269 | #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 | 269 | #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 |
270 | #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 | 270 | #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 |
271 | 271 | ||
272 | #define USB_VENDOR_ID_DMI 0x0c0b | 272 | #define USB_VENDOR_ID_DMI 0x0c0b |
273 | #define USB_DEVICE_ID_DMI_ENC 0x5fab | 273 | #define USB_DEVICE_ID_DMI_ENC 0x5fab |
274 | 274 | ||
275 | #define USB_VENDOR_ID_DRAGONRISE 0x0079 | 275 | #define USB_VENDOR_ID_DRAGONRISE 0x0079 |
276 | 276 | ||
277 | #define USB_VENDOR_ID_DWAV 0x0eef | 277 | #define USB_VENDOR_ID_DWAV 0x0eef |
278 | #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 | 278 | #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 |
279 | #define USB_DEVICE_ID_DWAV_TOUCHCONTROLLER 0x0002 | 279 | #define USB_DEVICE_ID_DWAV_TOUCHCONTROLLER 0x0002 |
280 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D 0x480d | 280 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D 0x480d |
281 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E 0x480e | 281 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E 0x480e |
282 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207 0x7207 | 282 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207 0x7207 |
283 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c | 283 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c |
284 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224 0x7224 | 284 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224 0x7224 |
285 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A 0x722A | 285 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A 0x722A |
286 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E 0x725e | 286 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E 0x725e |
287 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262 0x7262 | 287 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262 0x7262 |
288 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b | 288 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b |
289 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1 | 289 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1 |
290 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA 0x72aa | 290 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA 0x72aa |
291 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4 0x72c4 | 291 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4 0x72c4 |
292 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0 0x72d0 | 292 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0 0x72d0 |
293 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA 0x72fa | 293 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA 0x72fa |
294 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302 | 294 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302 |
295 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349 | 295 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349 |
296 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7 | 296 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7 |
297 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 | 297 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 |
298 | 298 | ||
299 | #define USB_VENDOR_ID_ELAN 0x04f3 | 299 | #define USB_VENDOR_ID_ELAN 0x04f3 |
300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 | 300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 |
301 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b | 301 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b |
302 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 | 302 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 |
303 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c 0x010c | 303 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c 0x010c |
304 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f | 304 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f |
305 | 305 | ||
306 | #define USB_VENDOR_ID_ELECOM 0x056e | 306 | #define USB_VENDOR_ID_ELECOM 0x056e |
307 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 | 307 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 |
308 | 308 | ||
309 | #define USB_VENDOR_ID_DREAM_CHEEKY 0x1d34 | 309 | #define USB_VENDOR_ID_DREAM_CHEEKY 0x1d34 |
310 | 310 | ||
311 | #define USB_VENDOR_ID_ELITEGROUP 0x03fc | 311 | #define USB_VENDOR_ID_ELITEGROUP 0x03fc |
312 | #define USB_DEVICE_ID_ELITEGROUP_05D8 0x05d8 | 312 | #define USB_DEVICE_ID_ELITEGROUP_05D8 0x05d8 |
313 | 313 | ||
314 | #define USB_VENDOR_ID_ELO 0x04E7 | 314 | #define USB_VENDOR_ID_ELO 0x04E7 |
315 | #define USB_DEVICE_ID_ELO_TS2515 0x0022 | 315 | #define USB_DEVICE_ID_ELO_TS2515 0x0022 |
316 | #define USB_DEVICE_ID_ELO_TS2700 0x0020 | 316 | #define USB_DEVICE_ID_ELO_TS2700 0x0020 |
317 | 317 | ||
318 | #define USB_VENDOR_ID_EMS 0x2006 | 318 | #define USB_VENDOR_ID_EMS 0x2006 |
319 | #define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118 | 319 | #define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118 |
320 | 320 | ||
321 | #define USB_VENDOR_ID_FLATFROG 0x25b5 | 321 | #define USB_VENDOR_ID_FLATFROG 0x25b5 |
322 | #define USB_DEVICE_ID_MULTITOUCH_3200 0x0002 | 322 | #define USB_DEVICE_ID_MULTITOUCH_3200 0x0002 |
323 | 323 | ||
324 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f | 324 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f |
325 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 | 325 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 |
326 | 326 | ||
327 | #define USB_VENDOR_ID_ETT 0x0664 | 327 | #define USB_VENDOR_ID_ETT 0x0664 |
328 | #define USB_DEVICE_ID_TC5UH 0x0309 | 328 | #define USB_DEVICE_ID_TC5UH 0x0309 |
329 | #define USB_DEVICE_ID_TC4UM 0x0306 | 329 | #define USB_DEVICE_ID_TC4UM 0x0306 |
330 | 330 | ||
331 | #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 | 331 | #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 |
332 | #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 | 332 | #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 |
333 | #define USB_DEVICE_ID_ETURBOTOUCH_2968 0x2968 | 333 | #define USB_DEVICE_ID_ETURBOTOUCH_2968 0x2968 |
334 | 334 | ||
335 | #define USB_VENDOR_ID_EZKEY 0x0518 | 335 | #define USB_VENDOR_ID_EZKEY 0x0518 |
336 | #define USB_DEVICE_ID_BTC_8193 0x0002 | 336 | #define USB_DEVICE_ID_BTC_8193 0x0002 |
337 | 337 | ||
338 | #define USB_VENDOR_ID_FORMOSA 0x147a | 338 | #define USB_VENDOR_ID_FORMOSA 0x147a |
339 | #define USB_DEVICE_ID_FORMOSA_IR_RECEIVER 0xe03e | 339 | #define USB_DEVICE_ID_FORMOSA_IR_RECEIVER 0xe03e |
340 | 340 | ||
341 | #define USB_VENDOR_ID_FREESCALE 0x15A2 | 341 | #define USB_VENDOR_ID_FREESCALE 0x15A2 |
342 | #define USB_DEVICE_ID_FREESCALE_MX28 0x004F | 342 | #define USB_DEVICE_ID_FREESCALE_MX28 0x004F |
343 | 343 | ||
344 | #define USB_VENDOR_ID_FRUCTEL 0x25B6 | 344 | #define USB_VENDOR_ID_FRUCTEL 0x25B6 |
345 | #define USB_DEVICE_ID_GAMETEL_MT_MODE 0x0002 | 345 | #define USB_DEVICE_ID_GAMETEL_MT_MODE 0x0002 |
346 | 346 | ||
347 | #define USB_VENDOR_ID_GAMERON 0x0810 | 347 | #define USB_VENDOR_ID_GAMERON 0x0810 |
348 | #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 | 348 | #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 |
349 | #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 | 349 | #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 |
350 | 350 | ||
351 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc | 351 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc |
352 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 | 352 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 |
353 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS 0x0100 | 353 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS 0x0100 |
354 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0101 0x0101 | 354 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0101 0x0101 |
355 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0102 0x0102 | 355 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0102 0x0102 |
356 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0106 0x0106 | 356 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0106 0x0106 |
357 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a | 357 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a |
358 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 | 358 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 |
359 | 359 | ||
360 | #define USB_VENDOR_ID_GLAB 0x06c2 | 360 | #define USB_VENDOR_ID_GLAB 0x06c2 |
361 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 | 361 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 |
362 | #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 | 362 | #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 |
363 | #define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040 | 363 | #define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040 |
364 | #define USB_DEVICE_ID_0_16_16_IF_KIT 0x0044 | 364 | #define USB_DEVICE_ID_0_16_16_IF_KIT 0x0044 |
365 | #define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045 | 365 | #define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045 |
366 | #define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051 | 366 | #define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051 |
367 | #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 | 367 | #define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 |
368 | #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 | 368 | #define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 |
369 | 369 | ||
370 | #define USB_VENDOR_ID_GOODTOUCH 0x1aad | 370 | #define USB_VENDOR_ID_GOODTOUCH 0x1aad |
371 | #define USB_DEVICE_ID_GOODTOUCH_000f 0x000f | 371 | #define USB_DEVICE_ID_GOODTOUCH_000f 0x000f |
372 | 372 | ||
373 | #define USB_VENDOR_ID_GOTOP 0x08f2 | 373 | #define USB_VENDOR_ID_GOTOP 0x08f2 |
374 | #define USB_DEVICE_ID_SUPER_Q2 0x007f | 374 | #define USB_DEVICE_ID_SUPER_Q2 0x007f |
375 | #define USB_DEVICE_ID_GOGOPEN 0x00ce | 375 | #define USB_DEVICE_ID_GOGOPEN 0x00ce |
376 | #define USB_DEVICE_ID_PENPOWER 0x00f4 | 376 | #define USB_DEVICE_ID_PENPOWER 0x00f4 |
377 | 377 | ||
378 | #define USB_VENDOR_ID_GREENASIA 0x0e8f | 378 | #define USB_VENDOR_ID_GREENASIA 0x0e8f |
379 | #define USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD 0x3013 | 379 | #define USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD 0x3013 |
380 | 380 | ||
381 | #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 | 381 | #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 |
382 | #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 | 382 | #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 |
383 | 383 | ||
384 | #define USB_VENDOR_ID_GRIFFIN 0x077d | 384 | #define USB_VENDOR_ID_GRIFFIN 0x077d |
385 | #define USB_DEVICE_ID_POWERMATE 0x0410 | 385 | #define USB_DEVICE_ID_POWERMATE 0x0410 |
386 | #define USB_DEVICE_ID_SOUNDKNOB 0x04AA | 386 | #define USB_DEVICE_ID_SOUNDKNOB 0x04AA |
387 | #define USB_DEVICE_ID_RADIOSHARK 0x627a | 387 | #define USB_DEVICE_ID_RADIOSHARK 0x627a |
388 | 388 | ||
389 | #define USB_VENDOR_ID_GTCO 0x078c | 389 | #define USB_VENDOR_ID_GTCO 0x078c |
390 | #define USB_DEVICE_ID_GTCO_90 0x0090 | 390 | #define USB_DEVICE_ID_GTCO_90 0x0090 |
391 | #define USB_DEVICE_ID_GTCO_100 0x0100 | 391 | #define USB_DEVICE_ID_GTCO_100 0x0100 |
392 | #define USB_DEVICE_ID_GTCO_101 0x0101 | 392 | #define USB_DEVICE_ID_GTCO_101 0x0101 |
393 | #define USB_DEVICE_ID_GTCO_103 0x0103 | 393 | #define USB_DEVICE_ID_GTCO_103 0x0103 |
394 | #define USB_DEVICE_ID_GTCO_104 0x0104 | 394 | #define USB_DEVICE_ID_GTCO_104 0x0104 |
395 | #define USB_DEVICE_ID_GTCO_105 0x0105 | 395 | #define USB_DEVICE_ID_GTCO_105 0x0105 |
396 | #define USB_DEVICE_ID_GTCO_106 0x0106 | 396 | #define USB_DEVICE_ID_GTCO_106 0x0106 |
397 | #define USB_DEVICE_ID_GTCO_107 0x0107 | 397 | #define USB_DEVICE_ID_GTCO_107 0x0107 |
398 | #define USB_DEVICE_ID_GTCO_108 0x0108 | 398 | #define USB_DEVICE_ID_GTCO_108 0x0108 |
399 | #define USB_DEVICE_ID_GTCO_200 0x0200 | 399 | #define USB_DEVICE_ID_GTCO_200 0x0200 |
400 | #define USB_DEVICE_ID_GTCO_201 0x0201 | 400 | #define USB_DEVICE_ID_GTCO_201 0x0201 |
401 | #define USB_DEVICE_ID_GTCO_202 0x0202 | 401 | #define USB_DEVICE_ID_GTCO_202 0x0202 |
402 | #define USB_DEVICE_ID_GTCO_203 0x0203 | 402 | #define USB_DEVICE_ID_GTCO_203 0x0203 |
403 | #define USB_DEVICE_ID_GTCO_204 0x0204 | 403 | #define USB_DEVICE_ID_GTCO_204 0x0204 |
404 | #define USB_DEVICE_ID_GTCO_205 0x0205 | 404 | #define USB_DEVICE_ID_GTCO_205 0x0205 |
405 | #define USB_DEVICE_ID_GTCO_206 0x0206 | 405 | #define USB_DEVICE_ID_GTCO_206 0x0206 |
406 | #define USB_DEVICE_ID_GTCO_207 0x0207 | 406 | #define USB_DEVICE_ID_GTCO_207 0x0207 |
407 | #define USB_DEVICE_ID_GTCO_300 0x0300 | 407 | #define USB_DEVICE_ID_GTCO_300 0x0300 |
408 | #define USB_DEVICE_ID_GTCO_301 0x0301 | 408 | #define USB_DEVICE_ID_GTCO_301 0x0301 |
409 | #define USB_DEVICE_ID_GTCO_302 0x0302 | 409 | #define USB_DEVICE_ID_GTCO_302 0x0302 |
410 | #define USB_DEVICE_ID_GTCO_303 0x0303 | 410 | #define USB_DEVICE_ID_GTCO_303 0x0303 |
411 | #define USB_DEVICE_ID_GTCO_304 0x0304 | 411 | #define USB_DEVICE_ID_GTCO_304 0x0304 |
412 | #define USB_DEVICE_ID_GTCO_305 0x0305 | 412 | #define USB_DEVICE_ID_GTCO_305 0x0305 |
413 | #define USB_DEVICE_ID_GTCO_306 0x0306 | 413 | #define USB_DEVICE_ID_GTCO_306 0x0306 |
414 | #define USB_DEVICE_ID_GTCO_307 0x0307 | 414 | #define USB_DEVICE_ID_GTCO_307 0x0307 |
415 | #define USB_DEVICE_ID_GTCO_308 0x0308 | 415 | #define USB_DEVICE_ID_GTCO_308 0x0308 |
416 | #define USB_DEVICE_ID_GTCO_309 0x0309 | 416 | #define USB_DEVICE_ID_GTCO_309 0x0309 |
417 | #define USB_DEVICE_ID_GTCO_400 0x0400 | 417 | #define USB_DEVICE_ID_GTCO_400 0x0400 |
418 | #define USB_DEVICE_ID_GTCO_401 0x0401 | 418 | #define USB_DEVICE_ID_GTCO_401 0x0401 |
419 | #define USB_DEVICE_ID_GTCO_402 0x0402 | 419 | #define USB_DEVICE_ID_GTCO_402 0x0402 |
420 | #define USB_DEVICE_ID_GTCO_403 0x0403 | 420 | #define USB_DEVICE_ID_GTCO_403 0x0403 |
421 | #define USB_DEVICE_ID_GTCO_404 0x0404 | 421 | #define USB_DEVICE_ID_GTCO_404 0x0404 |
422 | #define USB_DEVICE_ID_GTCO_405 0x0405 | 422 | #define USB_DEVICE_ID_GTCO_405 0x0405 |
423 | #define USB_DEVICE_ID_GTCO_500 0x0500 | 423 | #define USB_DEVICE_ID_GTCO_500 0x0500 |
424 | #define USB_DEVICE_ID_GTCO_501 0x0501 | 424 | #define USB_DEVICE_ID_GTCO_501 0x0501 |
425 | #define USB_DEVICE_ID_GTCO_502 0x0502 | 425 | #define USB_DEVICE_ID_GTCO_502 0x0502 |
426 | #define USB_DEVICE_ID_GTCO_503 0x0503 | 426 | #define USB_DEVICE_ID_GTCO_503 0x0503 |
427 | #define USB_DEVICE_ID_GTCO_504 0x0504 | 427 | #define USB_DEVICE_ID_GTCO_504 0x0504 |
428 | #define USB_DEVICE_ID_GTCO_1000 0x1000 | 428 | #define USB_DEVICE_ID_GTCO_1000 0x1000 |
429 | #define USB_DEVICE_ID_GTCO_1001 0x1001 | 429 | #define USB_DEVICE_ID_GTCO_1001 0x1001 |
430 | #define USB_DEVICE_ID_GTCO_1002 0x1002 | 430 | #define USB_DEVICE_ID_GTCO_1002 0x1002 |
431 | #define USB_DEVICE_ID_GTCO_1003 0x1003 | 431 | #define USB_DEVICE_ID_GTCO_1003 0x1003 |
432 | #define USB_DEVICE_ID_GTCO_1004 0x1004 | 432 | #define USB_DEVICE_ID_GTCO_1004 0x1004 |
433 | #define USB_DEVICE_ID_GTCO_1005 0x1005 | 433 | #define USB_DEVICE_ID_GTCO_1005 0x1005 |
434 | #define USB_DEVICE_ID_GTCO_1006 0x1006 | 434 | #define USB_DEVICE_ID_GTCO_1006 0x1006 |
435 | #define USB_DEVICE_ID_GTCO_1007 0x1007 | 435 | #define USB_DEVICE_ID_GTCO_1007 0x1007 |
436 | 436 | ||
437 | #define USB_VENDOR_ID_GYRATION 0x0c16 | 437 | #define USB_VENDOR_ID_GYRATION 0x0c16 |
438 | #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 | 438 | #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 |
439 | #define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003 | 439 | #define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003 |
440 | #define USB_DEVICE_ID_GYRATION_REMOTE_3 0x0008 | 440 | #define USB_DEVICE_ID_GYRATION_REMOTE_3 0x0008 |
441 | 441 | ||
442 | #define USB_VENDOR_ID_HANWANG 0x0b57 | 442 | #define USB_VENDOR_ID_HANWANG 0x0b57 |
443 | #define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000 | 443 | #define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000 |
444 | #define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff | 444 | #define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff |
445 | 445 | ||
446 | #define USB_VENDOR_ID_HANVON 0x20b3 | 446 | #define USB_VENDOR_ID_HANVON 0x20b3 |
447 | #define USB_DEVICE_ID_HANVON_MULTITOUCH 0x0a18 | 447 | #define USB_DEVICE_ID_HANVON_MULTITOUCH 0x0a18 |
448 | 448 | ||
449 | #define USB_VENDOR_ID_HANVON_ALT 0x22ed | 449 | #define USB_VENDOR_ID_HANVON_ALT 0x22ed |
450 | #define USB_DEVICE_ID_HANVON_ALT_MULTITOUCH 0x1010 | 450 | #define USB_DEVICE_ID_HANVON_ALT_MULTITOUCH 0x1010 |
451 | 451 | ||
452 | #define USB_VENDOR_ID_HAPP 0x078b | 452 | #define USB_VENDOR_ID_HAPP 0x078b |
453 | #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 | 453 | #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 |
454 | #define USB_DEVICE_ID_UGCI_FLYING 0x0020 | 454 | #define USB_DEVICE_ID_UGCI_FLYING 0x0020 |
455 | #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 | 455 | #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 |
456 | 456 | ||
457 | #define USB_VENDOR_ID_HUION 0x256c | 457 | #define USB_VENDOR_ID_HUION 0x256c |
458 | #define USB_DEVICE_ID_HUION_TABLET 0x006e | 458 | #define USB_DEVICE_ID_HUION_TABLET 0x006e |
459 | 459 | ||
460 | #define USB_VENDOR_ID_IDEACOM 0x1cb6 | 460 | #define USB_VENDOR_ID_IDEACOM 0x1cb6 |
461 | #define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 | 461 | #define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 |
462 | #define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651 | 462 | #define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651 |
463 | 463 | ||
464 | #define USB_VENDOR_ID_ILITEK 0x222a | 464 | #define USB_VENDOR_ID_ILITEK 0x222a |
465 | #define USB_DEVICE_ID_ILITEK_MULTITOUCH 0x0001 | 465 | #define USB_DEVICE_ID_ILITEK_MULTITOUCH 0x0001 |
466 | 466 | ||
467 | #define USB_VENDOR_ID_INTEL_0 0x8086 | 467 | #define USB_VENDOR_ID_INTEL_0 0x8086 |
468 | #define USB_VENDOR_ID_INTEL_1 0x8087 | 468 | #define USB_VENDOR_ID_INTEL_1 0x8087 |
469 | #define USB_DEVICE_ID_INTEL_HID_SENSOR_0 0x09fa | 469 | #define USB_DEVICE_ID_INTEL_HID_SENSOR_0 0x09fa |
470 | #define USB_DEVICE_ID_INTEL_HID_SENSOR_1 0x0a04 | 470 | #define USB_DEVICE_ID_INTEL_HID_SENSOR_1 0x0a04 |
471 | 471 | ||
472 | #define USB_VENDOR_ID_STM_0 0x0483 | 472 | #define USB_VENDOR_ID_STM_0 0x0483 |
473 | #define USB_DEVICE_ID_STM_HID_SENSOR 0x91d1 | 473 | #define USB_DEVICE_ID_STM_HID_SENSOR 0x91d1 |
474 | #define USB_DEVICE_ID_STM_HID_SENSOR_1 0x9100 | 474 | #define USB_DEVICE_ID_STM_HID_SENSOR_1 0x9100 |
475 | 475 | ||
476 | #define USB_VENDOR_ID_ION 0x15e4 | 476 | #define USB_VENDOR_ID_ION 0x15e4 |
477 | #define USB_DEVICE_ID_ICADE 0x0132 | 477 | #define USB_DEVICE_ID_ICADE 0x0132 |
478 | 478 | ||
479 | #define USB_VENDOR_ID_HOLTEK 0x1241 | 479 | #define USB_VENDOR_ID_HOLTEK 0x1241 |
480 | #define USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP 0x5015 | 480 | #define USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP 0x5015 |
481 | 481 | ||
482 | #define USB_VENDOR_ID_HOLTEK_ALT 0x04d9 | 482 | #define USB_VENDOR_ID_HOLTEK_ALT 0x04d9 |
483 | #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 | 483 | #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 |
484 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a | 484 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a |
485 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 | 485 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 |
486 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A070 0xa070 | 486 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A070 0xa070 |
487 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072 0xa072 | 487 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072 0xa072 |
488 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081 | 488 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081 |
489 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2 0xa0c2 | 489 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2 0xa0c2 |
490 | #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096 0xa096 | 490 | #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096 0xa096 |
491 | 491 | ||
492 | #define USB_VENDOR_ID_IMATION 0x0718 | 492 | #define USB_VENDOR_ID_IMATION 0x0718 |
493 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 | 493 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 |
494 | 494 | ||
495 | #define USB_VENDOR_ID_IRTOUCHSYSTEMS 0x6615 | 495 | #define USB_VENDOR_ID_IRTOUCHSYSTEMS 0x6615 |
496 | #define USB_DEVICE_ID_IRTOUCH_INFRARED_USB 0x0070 | 496 | #define USB_DEVICE_ID_IRTOUCH_INFRARED_USB 0x0070 |
497 | 497 | ||
498 | #define USB_VENDOR_ID_JABRA 0x0b0e | 498 | #define USB_VENDOR_ID_JABRA 0x0b0e |
499 | #define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412 | 499 | #define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412 |
500 | #define USB_DEVICE_ID_JABRA_SPEAK_510 0x0420 | 500 | #define USB_DEVICE_ID_JABRA_SPEAK_510 0x0420 |
501 | #define USB_DEVICE_ID_JABRA_GN9350E 0x9350 | 501 | #define USB_DEVICE_ID_JABRA_GN9350E 0x9350 |
502 | 502 | ||
503 | #define USB_VENDOR_ID_JESS 0x0c45 | 503 | #define USB_VENDOR_ID_JESS 0x0c45 |
504 | #define USB_DEVICE_ID_JESS_YUREX 0x1010 | 504 | #define USB_DEVICE_ID_JESS_YUREX 0x1010 |
505 | 505 | ||
506 | #define USB_VENDOR_ID_JESS2 0x0f30 | 506 | #define USB_VENDOR_ID_JESS2 0x0f30 |
507 | #define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111 | 507 | #define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111 |
508 | 508 | ||
509 | #define USB_VENDOR_ID_KBGEAR 0x084e | 509 | #define USB_VENDOR_ID_KBGEAR 0x084e |
510 | #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 | 510 | #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 |
511 | 511 | ||
512 | #define USB_VENDOR_ID_KENSINGTON 0x047d | 512 | #define USB_VENDOR_ID_KENSINGTON 0x047d |
513 | #define USB_DEVICE_ID_KS_SLIMBLADE 0x2041 | 513 | #define USB_DEVICE_ID_KS_SLIMBLADE 0x2041 |
514 | 514 | ||
515 | #define USB_VENDOR_ID_KWORLD 0x1b80 | 515 | #define USB_VENDOR_ID_KWORLD 0x1b80 |
516 | #define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700 | 516 | #define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700 |
517 | 517 | ||
518 | #define USB_VENDOR_ID_KEYTOUCH 0x0926 | 518 | #define USB_VENDOR_ID_KEYTOUCH 0x0926 |
519 | #define USB_DEVICE_ID_KEYTOUCH_IEC 0x3333 | 519 | #define USB_DEVICE_ID_KEYTOUCH_IEC 0x3333 |
520 | 520 | ||
521 | #define USB_VENDOR_ID_KYE 0x0458 | 521 | #define USB_VENDOR_ID_KYE 0x0458 |
522 | #define USB_DEVICE_ID_KYE_ERGO_525V 0x0087 | 522 | #define USB_DEVICE_ID_KYE_ERGO_525V 0x0087 |
523 | #define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138 | 523 | #define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138 |
524 | #define USB_DEVICE_ID_GENIUS_MANTICORE 0x0153 | 524 | #define USB_DEVICE_ID_GENIUS_MANTICORE 0x0153 |
525 | #define USB_DEVICE_ID_GENIUS_GX_IMPERATOR 0x4018 | 525 | #define USB_DEVICE_ID_GENIUS_GX_IMPERATOR 0x4018 |
526 | #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 | 526 | #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 |
527 | #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010 | 527 | #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010 |
528 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 | 528 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 |
529 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501a | ||
529 | #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 | 530 | #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 |
530 | 531 | ||
531 | #define USB_VENDOR_ID_LABTEC 0x1020 | 532 | #define USB_VENDOR_ID_LABTEC 0x1020 |
532 | #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 | 533 | #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 |
533 | 534 | ||
534 | #define USB_VENDOR_ID_LCPOWER 0x1241 | 535 | #define USB_VENDOR_ID_LCPOWER 0x1241 |
535 | #define USB_DEVICE_ID_LCPOWER_LC1000 0xf767 | 536 | #define USB_DEVICE_ID_LCPOWER_LC1000 0xf767 |
536 | 537 | ||
537 | #define USB_VENDOR_ID_LD 0x0f11 | 538 | #define USB_VENDOR_ID_LD 0x0f11 |
538 | #define USB_DEVICE_ID_LD_CASSY 0x1000 | 539 | #define USB_DEVICE_ID_LD_CASSY 0x1000 |
539 | #define USB_DEVICE_ID_LD_CASSY2 0x1001 | 540 | #define USB_DEVICE_ID_LD_CASSY2 0x1001 |
540 | #define USB_DEVICE_ID_LD_POCKETCASSY 0x1010 | 541 | #define USB_DEVICE_ID_LD_POCKETCASSY 0x1010 |
541 | #define USB_DEVICE_ID_LD_POCKETCASSY2 0x1011 | 542 | #define USB_DEVICE_ID_LD_POCKETCASSY2 0x1011 |
542 | #define USB_DEVICE_ID_LD_MOBILECASSY 0x1020 | 543 | #define USB_DEVICE_ID_LD_MOBILECASSY 0x1020 |
543 | #define USB_DEVICE_ID_LD_MOBILECASSY2 0x1021 | 544 | #define USB_DEVICE_ID_LD_MOBILECASSY2 0x1021 |
544 | #define USB_DEVICE_ID_LD_MICROCASSYVOLTAGE 0x1031 | 545 | #define USB_DEVICE_ID_LD_MICROCASSYVOLTAGE 0x1031 |
545 | #define USB_DEVICE_ID_LD_MICROCASSYCURRENT 0x1032 | 546 | #define USB_DEVICE_ID_LD_MICROCASSYCURRENT 0x1032 |
546 | #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033 | 547 | #define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033 |
547 | #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035 | 548 | #define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035 |
548 | #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038 | 549 | #define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038 |
549 | #define USB_DEVICE_ID_LD_JWM 0x1080 | 550 | #define USB_DEVICE_ID_LD_JWM 0x1080 |
550 | #define USB_DEVICE_ID_LD_DMMP 0x1081 | 551 | #define USB_DEVICE_ID_LD_DMMP 0x1081 |
551 | #define USB_DEVICE_ID_LD_UMIP 0x1090 | 552 | #define USB_DEVICE_ID_LD_UMIP 0x1090 |
552 | #define USB_DEVICE_ID_LD_UMIC 0x10A0 | 553 | #define USB_DEVICE_ID_LD_UMIC 0x10A0 |
553 | #define USB_DEVICE_ID_LD_UMIB 0x10B0 | 554 | #define USB_DEVICE_ID_LD_UMIB 0x10B0 |
554 | #define USB_DEVICE_ID_LD_XRAY 0x1100 | 555 | #define USB_DEVICE_ID_LD_XRAY 0x1100 |
555 | #define USB_DEVICE_ID_LD_XRAY2 0x1101 | 556 | #define USB_DEVICE_ID_LD_XRAY2 0x1101 |
556 | #define USB_DEVICE_ID_LD_XRAYCT 0x1110 | 557 | #define USB_DEVICE_ID_LD_XRAYCT 0x1110 |
557 | #define USB_DEVICE_ID_LD_VIDEOCOM 0x1200 | 558 | #define USB_DEVICE_ID_LD_VIDEOCOM 0x1200 |
558 | #define USB_DEVICE_ID_LD_MOTOR 0x1210 | 559 | #define USB_DEVICE_ID_LD_MOTOR 0x1210 |
559 | #define USB_DEVICE_ID_LD_COM3LAB 0x2000 | 560 | #define USB_DEVICE_ID_LD_COM3LAB 0x2000 |
560 | #define USB_DEVICE_ID_LD_TELEPORT 0x2010 | 561 | #define USB_DEVICE_ID_LD_TELEPORT 0x2010 |
561 | #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 | 562 | #define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020 |
562 | #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 | 563 | #define USB_DEVICE_ID_LD_POWERCONTROL 0x2030 |
563 | #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 | 564 | #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 |
564 | #define USB_DEVICE_ID_LD_MOSTANALYSER 0x2050 | 565 | #define USB_DEVICE_ID_LD_MOSTANALYSER 0x2050 |
565 | #define USB_DEVICE_ID_LD_MOSTANALYSER2 0x2051 | 566 | #define USB_DEVICE_ID_LD_MOSTANALYSER2 0x2051 |
566 | #define USB_DEVICE_ID_LD_ABSESP 0x2060 | 567 | #define USB_DEVICE_ID_LD_ABSESP 0x2060 |
567 | #define USB_DEVICE_ID_LD_AUTODATABUS 0x2070 | 568 | #define USB_DEVICE_ID_LD_AUTODATABUS 0x2070 |
568 | #define USB_DEVICE_ID_LD_MCT 0x2080 | 569 | #define USB_DEVICE_ID_LD_MCT 0x2080 |
569 | #define USB_DEVICE_ID_LD_HYBRID 0x2090 | 570 | #define USB_DEVICE_ID_LD_HYBRID 0x2090 |
570 | #define USB_DEVICE_ID_LD_HEATCONTROL 0x20A0 | 571 | #define USB_DEVICE_ID_LD_HEATCONTROL 0x20A0 |
571 | 572 | ||
572 | #define USB_VENDOR_ID_LENOVO 0x17ef | 573 | #define USB_VENDOR_ID_LENOVO 0x17ef |
573 | #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 | 574 | #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 |
574 | #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047 | 575 | #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047 |
575 | #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048 | 576 | #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048 |
576 | 577 | ||
577 | #define USB_VENDOR_ID_LG 0x1fd2 | 578 | #define USB_VENDOR_ID_LG 0x1fd2 |
578 | #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 | 579 | #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 |
579 | 580 | ||
580 | #define USB_VENDOR_ID_LOGITECH 0x046d | 581 | #define USB_VENDOR_ID_LOGITECH 0x046d |
581 | #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e | 582 | #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e |
582 | #define USB_DEVICE_ID_LOGITECH_T651 0xb00c | 583 | #define USB_DEVICE_ID_LOGITECH_T651 0xb00c |
583 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 | 584 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 |
584 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 | 585 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 |
585 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f | 586 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f |
586 | #define USB_DEVICE_ID_LOGITECH_HARMONY_PS3 0x0306 | 587 | #define USB_DEVICE_ID_LOGITECH_HARMONY_PS3 0x0306 |
587 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD 0xc20a | 588 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD 0xc20a |
588 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211 | 589 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211 |
589 | #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215 | 590 | #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215 |
590 | #define USB_DEVICE_ID_LOGITECH_DUAL_ACTION 0xc216 | 591 | #define USB_DEVICE_ID_LOGITECH_DUAL_ACTION 0xc216 |
591 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218 | 592 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218 |
592 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 | 593 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 |
593 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 | 594 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 |
594 | #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 | 595 | #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 |
595 | #define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287 | 596 | #define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287 |
596 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG 0xc293 | 597 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG 0xc293 |
597 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 | 598 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 |
598 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 | 599 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 |
599 | #define USB_DEVICE_ID_LOGITECH_DFP_WHEEL 0xc298 | 600 | #define USB_DEVICE_ID_LOGITECH_DFP_WHEEL 0xc298 |
600 | #define USB_DEVICE_ID_LOGITECH_G25_WHEEL 0xc299 | 601 | #define USB_DEVICE_ID_LOGITECH_G25_WHEEL 0xc299 |
601 | #define USB_DEVICE_ID_LOGITECH_DFGT_WHEEL 0xc29a | 602 | #define USB_DEVICE_ID_LOGITECH_DFGT_WHEEL 0xc29a |
602 | #define USB_DEVICE_ID_LOGITECH_G27_WHEEL 0xc29b | 603 | #define USB_DEVICE_ID_LOGITECH_G27_WHEEL 0xc29b |
603 | #define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c | 604 | #define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c |
604 | #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a | 605 | #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a |
605 | #define USB_DEVICE_ID_S510_RECEIVER 0xc50c | 606 | #define USB_DEVICE_ID_S510_RECEIVER 0xc50c |
606 | #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 | 607 | #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 |
607 | #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512 | 608 | #define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512 |
608 | #define USB_DEVICE_ID_MX3000_RECEIVER 0xc513 | 609 | #define USB_DEVICE_ID_MX3000_RECEIVER 0xc513 |
609 | #define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER 0xc52b | 610 | #define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER 0xc52b |
610 | #define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2 0xc532 | 611 | #define USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2 0xc532 |
611 | #define USB_DEVICE_ID_SPACETRAVELLER 0xc623 | 612 | #define USB_DEVICE_ID_SPACETRAVELLER 0xc623 |
612 | #define USB_DEVICE_ID_SPACENAVIGATOR 0xc626 | 613 | #define USB_DEVICE_ID_SPACENAVIGATOR 0xc626 |
613 | #define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704 | 614 | #define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704 |
614 | #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 | 615 | #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 |
615 | #define USB_DEVICE_ID_DINOVO_MINI 0xc71f | 616 | #define USB_DEVICE_ID_DINOVO_MINI 0xc71f |
616 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03 | 617 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03 |
617 | #define USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL 0xca04 | 618 | #define USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL 0xca04 |
618 | 619 | ||
619 | #define USB_VENDOR_ID_LUMIO 0x202e | 620 | #define USB_VENDOR_ID_LUMIO 0x202e |
620 | #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 | 621 | #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 |
621 | #define USB_DEVICE_ID_CRYSTALTOUCH_DUAL 0x0007 | 622 | #define USB_DEVICE_ID_CRYSTALTOUCH_DUAL 0x0007 |
622 | 623 | ||
623 | #define USB_VENDOR_ID_MADCATZ 0x0738 | 624 | #define USB_VENDOR_ID_MADCATZ 0x0738 |
624 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 | 625 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 |
625 | #define USB_DEVICE_ID_MADCATZ_RAT9 0x1709 | 626 | #define USB_DEVICE_ID_MADCATZ_RAT9 0x1709 |
626 | 627 | ||
627 | #define USB_VENDOR_ID_MCC 0x09db | 628 | #define USB_VENDOR_ID_MCC 0x09db |
628 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | 629 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 |
629 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | 630 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a |
630 | 631 | ||
631 | #define USB_VENDOR_ID_MGE 0x0463 | 632 | #define USB_VENDOR_ID_MGE 0x0463 |
632 | #define USB_DEVICE_ID_MGE_UPS 0xffff | 633 | #define USB_DEVICE_ID_MGE_UPS 0xffff |
633 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 | 634 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 |
634 | 635 | ||
635 | #define USB_VENDOR_ID_MICROCHIP 0x04d8 | 636 | #define USB_VENDOR_ID_MICROCHIP 0x04d8 |
636 | #define USB_DEVICE_ID_PICKIT1 0x0032 | 637 | #define USB_DEVICE_ID_PICKIT1 0x0032 |
637 | #define USB_DEVICE_ID_PICKIT2 0x0033 | 638 | #define USB_DEVICE_ID_PICKIT2 0x0033 |
638 | #define USB_DEVICE_ID_PICOLCD 0xc002 | 639 | #define USB_DEVICE_ID_PICOLCD 0xc002 |
639 | #define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002 | 640 | #define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002 |
640 | 641 | ||
641 | #define USB_VENDOR_ID_MICROSOFT 0x045e | 642 | #define USB_VENDOR_ID_MICROSOFT 0x045e |
642 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b | 643 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b |
643 | #define USB_DEVICE_ID_MS_OFFICE_KB 0x0048 | 644 | #define USB_DEVICE_ID_MS_OFFICE_KB 0x0048 |
644 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d | 645 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d |
645 | #define USB_DEVICE_ID_MS_NE4K 0x00db | 646 | #define USB_DEVICE_ID_MS_NE4K 0x00db |
646 | #define USB_DEVICE_ID_MS_NE4K_JP 0x00dc | 647 | #define USB_DEVICE_ID_MS_NE4K_JP 0x00dc |
647 | #define USB_DEVICE_ID_MS_LK6K 0x00f9 | 648 | #define USB_DEVICE_ID_MS_LK6K 0x00f9 |
648 | #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 | 649 | #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 |
649 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 | 650 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 |
650 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 | 651 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 |
651 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c | 652 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c |
652 | #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 | 653 | #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 |
653 | #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 | 654 | #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 |
654 | #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 | 655 | #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 |
655 | #define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07dc | 656 | #define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07dc |
656 | 657 | ||
657 | #define USB_VENDOR_ID_MOJO 0x8282 | 658 | #define USB_VENDOR_ID_MOJO 0x8282 |
658 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 | 659 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 |
659 | 660 | ||
660 | #define USB_VENDOR_ID_MONTEREY 0x0566 | 661 | #define USB_VENDOR_ID_MONTEREY 0x0566 |
661 | #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 | 662 | #define USB_DEVICE_ID_GENIUS_KB29E 0x3004 |
662 | 663 | ||
663 | #define USB_VENDOR_ID_MSI 0x1770 | 664 | #define USB_VENDOR_ID_MSI 0x1770 |
664 | #define USB_DEVICE_ID_MSI_GT683R_LED_PANEL 0xff00 | 665 | #define USB_DEVICE_ID_MSI_GT683R_LED_PANEL 0xff00 |
665 | 666 | ||
666 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 | 667 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 |
667 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 | 668 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 |
668 | 669 | ||
669 | #define USB_VENDOR_ID_NATSU 0x08b7 | 670 | #define USB_VENDOR_ID_NATSU 0x08b7 |
670 | #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 | 671 | #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 |
671 | 672 | ||
672 | #define USB_VENDOR_ID_NCR 0x0404 | 673 | #define USB_VENDOR_ID_NCR 0x0404 |
673 | #define USB_DEVICE_ID_NCR_FIRST 0x0300 | 674 | #define USB_DEVICE_ID_NCR_FIRST 0x0300 |
674 | #define USB_DEVICE_ID_NCR_LAST 0x03ff | 675 | #define USB_DEVICE_ID_NCR_LAST 0x03ff |
675 | 676 | ||
676 | #define USB_VENDOR_ID_NEC 0x073e | 677 | #define USB_VENDOR_ID_NEC 0x073e |
677 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 | 678 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 |
678 | 679 | ||
679 | #define USB_VENDOR_ID_NEXIO 0x1870 | 680 | #define USB_VENDOR_ID_NEXIO 0x1870 |
680 | #define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d | 681 | #define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d |
681 | #define USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750 0x0110 | 682 | #define USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750 0x0110 |
682 | 683 | ||
683 | #define USB_VENDOR_ID_NEXTWINDOW 0x1926 | 684 | #define USB_VENDOR_ID_NEXTWINDOW 0x1926 |
684 | #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003 | 685 | #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003 |
685 | 686 | ||
686 | #define USB_VENDOR_ID_NINTENDO 0x057e | 687 | #define USB_VENDOR_ID_NINTENDO 0x057e |
687 | #define USB_DEVICE_ID_NINTENDO_WIIMOTE 0x0306 | 688 | #define USB_DEVICE_ID_NINTENDO_WIIMOTE 0x0306 |
688 | #define USB_DEVICE_ID_NINTENDO_WIIMOTE2 0x0330 | 689 | #define USB_DEVICE_ID_NINTENDO_WIIMOTE2 0x0330 |
689 | 690 | ||
690 | #define USB_VENDOR_ID_NOVATEK 0x0603 | 691 | #define USB_VENDOR_ID_NOVATEK 0x0603 |
691 | #define USB_DEVICE_ID_NOVATEK_PCT 0x0600 | 692 | #define USB_DEVICE_ID_NOVATEK_PCT 0x0600 |
692 | #define USB_DEVICE_ID_NOVATEK_MOUSE 0x1602 | 693 | #define USB_DEVICE_ID_NOVATEK_MOUSE 0x1602 |
693 | 694 | ||
694 | #define USB_VENDOR_ID_NTRIG 0x1b96 | 695 | #define USB_VENDOR_ID_NTRIG 0x1b96 |
695 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 | 696 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 |
696 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003 | 697 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003 |
697 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2 0x0004 | 698 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2 0x0004 |
698 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3 0x0005 | 699 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3 0x0005 |
699 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4 0x0006 | 700 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4 0x0006 |
700 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5 0x0007 | 701 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5 0x0007 |
701 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6 0x0008 | 702 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6 0x0008 |
702 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7 0x0009 | 703 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7 0x0009 |
703 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8 0x000A | 704 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8 0x000A |
704 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9 0x000B | 705 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9 0x000B |
705 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10 0x000C | 706 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10 0x000C |
706 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11 0x000D | 707 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11 0x000D |
707 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12 0x000E | 708 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12 0x000E |
708 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13 0x000F | 709 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13 0x000F |
709 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14 0x0010 | 710 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14 0x0010 |
710 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15 0x0011 | 711 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15 0x0011 |
711 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16 0x0012 | 712 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16 0x0012 |
712 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17 0x0013 | 713 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17 0x0013 |
713 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18 0x0014 | 714 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18 0x0014 |
714 | #define USB_DEVICE_ID_NTRIG_DUOSENSE 0x1500 | 715 | #define USB_DEVICE_ID_NTRIG_DUOSENSE 0x1500 |
715 | 716 | ||
716 | #define USB_VENDOR_ID_ONTRAK 0x0a07 | 717 | #define USB_VENDOR_ID_ONTRAK 0x0a07 |
717 | #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 | 718 | #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 |
718 | 719 | ||
719 | #define USB_VENDOR_ID_ORTEK 0x05a4 | 720 | #define USB_VENDOR_ID_ORTEK 0x05a4 |
720 | #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700 | 721 | #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700 |
721 | #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 | 722 | #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 |
722 | 723 | ||
723 | #define USB_VENDOR_ID_PLANTRONICS 0x047f | 724 | #define USB_VENDOR_ID_PLANTRONICS 0x047f |
724 | 725 | ||
725 | #define USB_VENDOR_ID_PANASONIC 0x04da | 726 | #define USB_VENDOR_ID_PANASONIC 0x04da |
726 | #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044 | 727 | #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044 |
727 | #define USB_DEVICE_ID_PANABOARD_UBT880 0x104d | 728 | #define USB_DEVICE_ID_PANABOARD_UBT880 0x104d |
728 | 729 | ||
729 | #define USB_VENDOR_ID_PANJIT 0x134c | 730 | #define USB_VENDOR_ID_PANJIT 0x134c |
730 | 731 | ||
731 | #define USB_VENDOR_ID_PANTHERLORD 0x0810 | 732 | #define USB_VENDOR_ID_PANTHERLORD 0x0810 |
732 | #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001 | 733 | #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001 |
733 | 734 | ||
734 | #define USB_VENDOR_ID_PENMOUNT 0x14e1 | 735 | #define USB_VENDOR_ID_PENMOUNT 0x14e1 |
735 | #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 | 736 | #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 |
736 | #define USB_DEVICE_ID_PENMOUNT_1610 0x1610 | 737 | #define USB_DEVICE_ID_PENMOUNT_1610 0x1610 |
737 | #define USB_DEVICE_ID_PENMOUNT_1640 0x1640 | 738 | #define USB_DEVICE_ID_PENMOUNT_1640 0x1640 |
738 | #define USB_DEVICE_ID_PENMOUNT_6000 0x6000 | 739 | #define USB_DEVICE_ID_PENMOUNT_6000 0x6000 |
739 | 740 | ||
740 | #define USB_VENDOR_ID_PETALYNX 0x18b1 | 741 | #define USB_VENDOR_ID_PETALYNX 0x18b1 |
741 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | 742 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 |
742 | 743 | ||
743 | #define USB_VENDOR_ID_PHILIPS 0x0471 | 744 | #define USB_VENDOR_ID_PHILIPS 0x0471 |
744 | #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617 | 745 | #define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617 |
745 | 746 | ||
746 | #define USB_VENDOR_ID_PI_ENGINEERING 0x05f3 | 747 | #define USB_VENDOR_ID_PI_ENGINEERING 0x05f3 |
747 | #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff | 748 | #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff |
748 | 749 | ||
749 | #define USB_VENDOR_ID_PIXART 0x093a | 750 | #define USB_VENDOR_ID_PIXART 0x093a |
750 | #define USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2 0x0137 | 751 | #define USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2 0x0137 |
751 | #define USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE 0x2510 | 752 | #define USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE 0x2510 |
752 | #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN 0x8001 | 753 | #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN 0x8001 |
753 | #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1 0x8002 | 754 | #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1 0x8002 |
754 | #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2 0x8003 | 755 | #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2 0x8003 |
755 | 756 | ||
756 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 | 757 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 |
757 | #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 | 758 | #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 |
758 | 759 | ||
759 | #define USB_VENDOR_ID_POWERCOM 0x0d9f | 760 | #define USB_VENDOR_ID_POWERCOM 0x0d9f |
760 | #define USB_DEVICE_ID_POWERCOM_UPS 0x0002 | 761 | #define USB_DEVICE_ID_POWERCOM_UPS 0x0002 |
761 | 762 | ||
762 | #define USB_VENDOR_ID_PRODIGE 0x05af | 763 | #define USB_VENDOR_ID_PRODIGE 0x05af |
763 | #define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062 | 764 | #define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062 |
764 | 765 | ||
765 | #define USB_VENDOR_ID_QUANTA 0x0408 | 766 | #define USB_VENDOR_ID_QUANTA 0x0408 |
766 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000 | 767 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000 |
767 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001 | 768 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001 |
768 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 | 769 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 |
769 | 770 | ||
770 | #define USB_VENDOR_ID_REALTEK 0x0bda | 771 | #define USB_VENDOR_ID_REALTEK 0x0bda |
771 | #define USB_DEVICE_ID_REALTEK_READER 0x0152 | 772 | #define USB_DEVICE_ID_REALTEK_READER 0x0152 |
772 | 773 | ||
773 | #define USB_VENDOR_ID_ROCCAT 0x1e7d | 774 | #define USB_VENDOR_ID_ROCCAT 0x1e7d |
774 | #define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4 | 775 | #define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4 |
775 | #define USB_DEVICE_ID_ROCCAT_ISKU 0x319c | 776 | #define USB_DEVICE_ID_ROCCAT_ISKU 0x319c |
776 | #define USB_DEVICE_ID_ROCCAT_ISKUFX 0x3264 | 777 | #define USB_DEVICE_ID_ROCCAT_ISKUFX 0x3264 |
777 | #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced | 778 | #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced |
778 | #define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51 | 779 | #define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51 |
779 | #define USB_DEVICE_ID_ROCCAT_KONEPURE 0x2dbe | 780 | #define USB_DEVICE_ID_ROCCAT_KONEPURE 0x2dbe |
780 | #define USB_DEVICE_ID_ROCCAT_KONEPURE_OPTICAL 0x2db4 | 781 | #define USB_DEVICE_ID_ROCCAT_KONEPURE_OPTICAL 0x2db4 |
781 | #define USB_DEVICE_ID_ROCCAT_KONEXTD 0x2e22 | 782 | #define USB_DEVICE_ID_ROCCAT_KONEXTD 0x2e22 |
782 | #define USB_DEVICE_ID_ROCCAT_KOVAPLUS 0x2d50 | 783 | #define USB_DEVICE_ID_ROCCAT_KOVAPLUS 0x2d50 |
783 | #define USB_DEVICE_ID_ROCCAT_LUA 0x2c2e | 784 | #define USB_DEVICE_ID_ROCCAT_LUA 0x2c2e |
784 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRED 0x2c24 | 785 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRED 0x2c24 |
785 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS 0x2cf6 | 786 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS 0x2cf6 |
786 | #define USB_DEVICE_ID_ROCCAT_RYOS_MK 0x3138 | 787 | #define USB_DEVICE_ID_ROCCAT_RYOS_MK 0x3138 |
787 | #define USB_DEVICE_ID_ROCCAT_RYOS_MK_GLOW 0x31ce | 788 | #define USB_DEVICE_ID_ROCCAT_RYOS_MK_GLOW 0x31ce |
788 | #define USB_DEVICE_ID_ROCCAT_RYOS_MK_PRO 0x3232 | 789 | #define USB_DEVICE_ID_ROCCAT_RYOS_MK_PRO 0x3232 |
789 | #define USB_DEVICE_ID_ROCCAT_SAVU 0x2d5a | 790 | #define USB_DEVICE_ID_ROCCAT_SAVU 0x2d5a |
790 | 791 | ||
791 | #define USB_VENDOR_ID_SAITEK 0x06a3 | 792 | #define USB_VENDOR_ID_SAITEK 0x06a3 |
792 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | 793 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 |
793 | #define USB_DEVICE_ID_SAITEK_PS1000 0x0621 | 794 | #define USB_DEVICE_ID_SAITEK_PS1000 0x0621 |
794 | #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 | 795 | #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 |
795 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 | 796 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 |
796 | 797 | ||
797 | #define USB_VENDOR_ID_SAMSUNG 0x0419 | 798 | #define USB_VENDOR_ID_SAMSUNG 0x0419 |
798 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | 799 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
799 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 | 800 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 |
800 | 801 | ||
801 | #define USB_VENDOR_ID_SEMICO 0x1a2c | 802 | #define USB_VENDOR_ID_SEMICO 0x1a2c |
802 | #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD 0x0023 | 803 | #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD 0x0023 |
803 | 804 | ||
804 | #define USB_VENDOR_ID_SENNHEISER 0x1395 | 805 | #define USB_VENDOR_ID_SENNHEISER 0x1395 |
805 | #define USB_DEVICE_ID_SENNHEISER_BTD500USB 0x002c | 806 | #define USB_DEVICE_ID_SENNHEISER_BTD500USB 0x002c |
806 | 807 | ||
807 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f | 808 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f |
808 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 | 809 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 |
809 | 810 | ||
810 | #define USB_VENDOR_ID_SIGMATEL 0x066F | 811 | #define USB_VENDOR_ID_SIGMATEL 0x066F |
811 | #define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 | 812 | #define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 |
812 | 813 | ||
813 | #define USB_VENDOR_ID_SIS_TOUCH 0x0457 | 814 | #define USB_VENDOR_ID_SIS_TOUCH 0x0457 |
814 | #define USB_DEVICE_ID_SIS9200_TOUCH 0x9200 | 815 | #define USB_DEVICE_ID_SIS9200_TOUCH 0x9200 |
815 | #define USB_DEVICE_ID_SIS817_TOUCH 0x0817 | 816 | #define USB_DEVICE_ID_SIS817_TOUCH 0x0817 |
816 | #define USB_DEVICE_ID_SIS_TS 0x1013 | 817 | #define USB_DEVICE_ID_SIS_TS 0x1013 |
817 | #define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 | 818 | #define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 |
818 | 819 | ||
819 | #define USB_VENDOR_ID_SKYCABLE 0x1223 | 820 | #define USB_VENDOR_ID_SKYCABLE 0x1223 |
820 | #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 | 821 | #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 |
821 | 822 | ||
822 | #define USB_VENDOR_ID_SMK 0x0609 | 823 | #define USB_VENDOR_ID_SMK 0x0609 |
823 | #define USB_DEVICE_ID_SMK_PS3_BDREMOTE 0x0306 | 824 | #define USB_DEVICE_ID_SMK_PS3_BDREMOTE 0x0306 |
824 | 825 | ||
825 | #define USB_VENDOR_ID_SONY 0x054c | 826 | #define USB_VENDOR_ID_SONY 0x054c |
826 | #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b | 827 | #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b |
827 | #define USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE 0x0374 | 828 | #define USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE 0x0374 |
828 | #define USB_DEVICE_ID_SONY_PS3_BDREMOTE 0x0306 | 829 | #define USB_DEVICE_ID_SONY_PS3_BDREMOTE 0x0306 |
829 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 | 830 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 |
830 | #define USB_DEVICE_ID_SONY_PS4_CONTROLLER 0x05c4 | 831 | #define USB_DEVICE_ID_SONY_PS4_CONTROLLER 0x05c4 |
831 | #define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f | 832 | #define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f |
832 | #define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER 0x0002 | 833 | #define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER 0x0002 |
833 | #define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER 0x1000 | 834 | #define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER 0x1000 |
834 | 835 | ||
835 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 | 836 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 |
836 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034 | 837 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034 |
837 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST 0x0046 | 838 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST 0x0046 |
838 | 839 | ||
839 | #define USB_VENDOR_ID_STANTUM 0x1f87 | 840 | #define USB_VENDOR_ID_STANTUM 0x1f87 |
840 | #define USB_DEVICE_ID_MTP 0x0002 | 841 | #define USB_DEVICE_ID_MTP 0x0002 |
841 | 842 | ||
842 | #define USB_VENDOR_ID_STANTUM_STM 0x0483 | 843 | #define USB_VENDOR_ID_STANTUM_STM 0x0483 |
843 | #define USB_DEVICE_ID_MTP_STM 0x3261 | 844 | #define USB_DEVICE_ID_MTP_STM 0x3261 |
844 | 845 | ||
845 | #define USB_VENDOR_ID_STANTUM_SITRONIX 0x1403 | 846 | #define USB_VENDOR_ID_STANTUM_SITRONIX 0x1403 |
846 | #define USB_DEVICE_ID_MTP_SITRONIX 0x5001 | 847 | #define USB_DEVICE_ID_MTP_SITRONIX 0x5001 |
847 | 848 | ||
848 | #define USB_VENDOR_ID_STEELSERIES 0x1038 | 849 | #define USB_VENDOR_ID_STEELSERIES 0x1038 |
849 | #define USB_DEVICE_ID_STEELSERIES_SRWS1 0x1410 | 850 | #define USB_DEVICE_ID_STEELSERIES_SRWS1 0x1410 |
850 | 851 | ||
851 | #define USB_VENDOR_ID_SUN 0x0430 | 852 | #define USB_VENDOR_ID_SUN 0x0430 |
852 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 853 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
853 | 854 | ||
854 | #define USB_VENDOR_ID_SUNPLUS 0x04fc | 855 | #define USB_VENDOR_ID_SUNPLUS 0x04fc |
855 | #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 | 856 | #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 |
856 | 857 | ||
857 | #define USB_VENDOR_ID_SYMBOL 0x05e0 | 858 | #define USB_VENDOR_ID_SYMBOL 0x05e0 |
858 | #define USB_DEVICE_ID_SYMBOL_SCANNER_1 0x0800 | 859 | #define USB_DEVICE_ID_SYMBOL_SCANNER_1 0x0800 |
859 | #define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300 | 860 | #define USB_DEVICE_ID_SYMBOL_SCANNER_2 0x1300 |
860 | 861 | ||
861 | #define USB_VENDOR_ID_SYNAPTICS 0x06cb | 862 | #define USB_VENDOR_ID_SYNAPTICS 0x06cb |
862 | #define USB_DEVICE_ID_SYNAPTICS_TP 0x0001 | 863 | #define USB_DEVICE_ID_SYNAPTICS_TP 0x0001 |
863 | #define USB_DEVICE_ID_SYNAPTICS_INT_TP 0x0002 | 864 | #define USB_DEVICE_ID_SYNAPTICS_INT_TP 0x0002 |
864 | #define USB_DEVICE_ID_SYNAPTICS_CPAD 0x0003 | 865 | #define USB_DEVICE_ID_SYNAPTICS_CPAD 0x0003 |
865 | #define USB_DEVICE_ID_SYNAPTICS_TS 0x0006 | 866 | #define USB_DEVICE_ID_SYNAPTICS_TS 0x0006 |
866 | #define USB_DEVICE_ID_SYNAPTICS_STICK 0x0007 | 867 | #define USB_DEVICE_ID_SYNAPTICS_STICK 0x0007 |
867 | #define USB_DEVICE_ID_SYNAPTICS_WP 0x0008 | 868 | #define USB_DEVICE_ID_SYNAPTICS_WP 0x0008 |
868 | #define USB_DEVICE_ID_SYNAPTICS_COMP_TP 0x0009 | 869 | #define USB_DEVICE_ID_SYNAPTICS_COMP_TP 0x0009 |
869 | #define USB_DEVICE_ID_SYNAPTICS_WTP 0x0010 | 870 | #define USB_DEVICE_ID_SYNAPTICS_WTP 0x0010 |
870 | #define USB_DEVICE_ID_SYNAPTICS_DPAD 0x0013 | 871 | #define USB_DEVICE_ID_SYNAPTICS_DPAD 0x0013 |
871 | #define USB_DEVICE_ID_SYNAPTICS_LTS1 0x0af8 | 872 | #define USB_DEVICE_ID_SYNAPTICS_LTS1 0x0af8 |
872 | #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10 | 873 | #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10 |
873 | #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3 | 874 | #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3 |
874 | #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 | 875 | #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 |
875 | #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 | 876 | #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 |
876 | 877 | ||
877 | #define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047 | 878 | #define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047 |
878 | #define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA 0x0855 | 879 | #define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA 0x0855 |
879 | 880 | ||
880 | #define USB_VENDOR_ID_THINGM 0x27b8 | 881 | #define USB_VENDOR_ID_THINGM 0x27b8 |
881 | #define USB_DEVICE_ID_BLINK1 0x01ed | 882 | #define USB_DEVICE_ID_BLINK1 0x01ed |
882 | 883 | ||
883 | #define USB_VENDOR_ID_THRUSTMASTER 0x044f | 884 | #define USB_VENDOR_ID_THRUSTMASTER 0x044f |
884 | 885 | ||
885 | #define USB_VENDOR_ID_TIVO 0x150a | 886 | #define USB_VENDOR_ID_TIVO 0x150a |
886 | #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 | 887 | #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 |
887 | #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 | 888 | #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 |
888 | 889 | ||
889 | #define USB_VENDOR_ID_TOPSEED 0x0766 | 890 | #define USB_VENDOR_ID_TOPSEED 0x0766 |
890 | #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 | 891 | #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 |
891 | 892 | ||
892 | #define USB_VENDOR_ID_TOPSEED2 0x1784 | 893 | #define USB_VENDOR_ID_TOPSEED2 0x1784 |
893 | #define USB_DEVICE_ID_TOPSEED2_RF_COMBO 0x0004 | 894 | #define USB_DEVICE_ID_TOPSEED2_RF_COMBO 0x0004 |
894 | #define USB_DEVICE_ID_TOPSEED2_PERIPAD_701 0x0016 | 895 | #define USB_DEVICE_ID_TOPSEED2_PERIPAD_701 0x0016 |
895 | 896 | ||
896 | #define USB_VENDOR_ID_TOPMAX 0x0663 | 897 | #define USB_VENDOR_ID_TOPMAX 0x0663 |
897 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 | 898 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 |
898 | 899 | ||
899 | #define USB_VENDOR_ID_TOUCH_INTL 0x1e5e | 900 | #define USB_VENDOR_ID_TOUCH_INTL 0x1e5e |
900 | #define USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH 0x0313 | 901 | #define USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH 0x0313 |
901 | 902 | ||
902 | #define USB_VENDOR_ID_TOUCHPACK 0x1bfd | 903 | #define USB_VENDOR_ID_TOUCHPACK 0x1bfd |
903 | #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 | 904 | #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 |
904 | 905 | ||
905 | #define USB_VENDOR_ID_TPV 0x25aa | 906 | #define USB_VENDOR_ID_TPV 0x25aa |
906 | #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN 0x8883 | 907 | #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN 0x8883 |
907 | 908 | ||
908 | #define USB_VENDOR_ID_TURBOX 0x062a | 909 | #define USB_VENDOR_ID_TURBOX 0x062a |
909 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 | 910 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 |
910 | #define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART 0x7100 | 911 | #define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART 0x7100 |
911 | 912 | ||
912 | #define USB_VENDOR_ID_TWINHAN 0x6253 | 913 | #define USB_VENDOR_ID_TWINHAN 0x6253 |
913 | #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 | 914 | #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 |
914 | 915 | ||
915 | #define USB_VENDOR_ID_UCLOGIC 0x5543 | 916 | #define USB_VENDOR_ID_UCLOGIC 0x5543 |
916 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 | 917 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 |
917 | #define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 | 918 | #define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 |
918 | #define USB_DEVICE_ID_UCLOGIC_TABLET_TWA60 0x0064 | 919 | #define USB_DEVICE_ID_UCLOGIC_TABLET_TWA60 0x0064 |
919 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 | 920 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 |
920 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 | 921 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 |
921 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 | 922 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 |
922 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP1062 0x0064 | 923 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP1062 0x0064 |
923 | #define USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850 0x0522 | 924 | #define USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850 0x0522 |
924 | #define USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60 0x0781 | 925 | #define USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60 0x0781 |
925 | 926 | ||
926 | #define USB_VENDOR_ID_UNITEC 0x227d | 927 | #define USB_VENDOR_ID_UNITEC 0x227d |
927 | #define USB_DEVICE_ID_UNITEC_USB_TOUCH_0709 0x0709 | 928 | #define USB_DEVICE_ID_UNITEC_USB_TOUCH_0709 0x0709 |
928 | #define USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19 0x0a19 | 929 | #define USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19 0x0a19 |
929 | 930 | ||
930 | #define USB_VENDOR_ID_VELLEMAN 0x10cf | 931 | #define USB_VENDOR_ID_VELLEMAN 0x10cf |
931 | #define USB_DEVICE_ID_VELLEMAN_K8055_FIRST 0x5500 | 932 | #define USB_DEVICE_ID_VELLEMAN_K8055_FIRST 0x5500 |
932 | #define USB_DEVICE_ID_VELLEMAN_K8055_LAST 0x5503 | 933 | #define USB_DEVICE_ID_VELLEMAN_K8055_LAST 0x5503 |
933 | #define USB_DEVICE_ID_VELLEMAN_K8061_FIRST 0x8061 | 934 | #define USB_DEVICE_ID_VELLEMAN_K8061_FIRST 0x8061 |
934 | #define USB_DEVICE_ID_VELLEMAN_K8061_LAST 0x8068 | 935 | #define USB_DEVICE_ID_VELLEMAN_K8061_LAST 0x8068 |
935 | 936 | ||
936 | #define USB_VENDOR_ID_VERNIER 0x08f7 | 937 | #define USB_VENDOR_ID_VERNIER 0x08f7 |
937 | #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 | 938 | #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 |
938 | #define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 | 939 | #define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 |
939 | #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 | 940 | #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 |
940 | #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 | 941 | #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 |
941 | #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006 | 942 | #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006 |
942 | 943 | ||
943 | #define USB_VENDOR_ID_VTL 0x0306 | 944 | #define USB_VENDOR_ID_VTL 0x0306 |
944 | #define USB_DEVICE_ID_VTL_MULTITOUCH_FF3F 0xff3f | 945 | #define USB_DEVICE_ID_VTL_MULTITOUCH_FF3F 0xff3f |
945 | 946 | ||
946 | #define USB_VENDOR_ID_WACOM 0x056a | 947 | #define USB_VENDOR_ID_WACOM 0x056a |
947 | #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81 | 948 | #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81 |
948 | #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0x00BD | 949 | #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0x00BD |
949 | 950 | ||
950 | #define USB_VENDOR_ID_WALTOP 0x172f | 951 | #define USB_VENDOR_ID_WALTOP 0x172f |
951 | #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH 0x0032 | 952 | #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH 0x0032 |
952 | #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH 0x0034 | 953 | #define USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH 0x0034 |
953 | #define USB_DEVICE_ID_WALTOP_Q_PAD 0x0037 | 954 | #define USB_DEVICE_ID_WALTOP_Q_PAD 0x0037 |
954 | #define USB_DEVICE_ID_WALTOP_PID_0038 0x0038 | 955 | #define USB_DEVICE_ID_WALTOP_PID_0038 0x0038 |
955 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH 0x0501 | 956 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH 0x0501 |
956 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH 0x0500 | 957 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH 0x0500 |
957 | #define USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET 0x0502 | 958 | #define USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET 0x0502 |
958 | 959 | ||
959 | #define USB_VENDOR_ID_WISEGROUP 0x0925 | 960 | #define USB_VENDOR_ID_WISEGROUP 0x0925 |
960 | #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 | 961 | #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 |
961 | #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 | 962 | #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 |
962 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 | 963 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 |
963 | #define USB_DEVICE_ID_8_8_4_IF_KIT 0x8201 | 964 | #define USB_DEVICE_ID_8_8_4_IF_KIT 0x8201 |
964 | #define USB_DEVICE_ID_SUPER_JOY_BOX_3 0x8888 | 965 | #define USB_DEVICE_ID_SUPER_JOY_BOX_3 0x8888 |
965 | #define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800 | 966 | #define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800 |
966 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 | 967 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 |
967 | 968 | ||
968 | #define USB_VENDOR_ID_WISEGROUP_LTD 0x6666 | 969 | #define USB_VENDOR_ID_WISEGROUP_LTD 0x6666 |
969 | #define USB_VENDOR_ID_WISEGROUP_LTD2 0x6677 | 970 | #define USB_VENDOR_ID_WISEGROUP_LTD2 0x6677 |
970 | #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802 | 971 | #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802 |
971 | #define USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO 0x8801 | 972 | #define USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO 0x8801 |
972 | #define USB_DEVICE_ID_SUPER_DUAL_BOX_PRO 0x8802 | 973 | #define USB_DEVICE_ID_SUPER_DUAL_BOX_PRO 0x8802 |
973 | #define USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO 0x8804 | 974 | #define USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO 0x8804 |
974 | 975 | ||
975 | #define USB_VENDOR_ID_WISTRON 0x0fb8 | 976 | #define USB_VENDOR_ID_WISTRON 0x0fb8 |
976 | #define USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH 0x1109 | 977 | #define USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH 0x1109 |
977 | 978 | ||
978 | #define USB_VENDOR_ID_X_TENSIONS 0x1ae7 | 979 | #define USB_VENDOR_ID_X_TENSIONS 0x1ae7 |
979 | #define USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE 0x9001 | 980 | #define USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE 0x9001 |
980 | 981 | ||
981 | #define USB_VENDOR_ID_XAT 0x2505 | 982 | #define USB_VENDOR_ID_XAT 0x2505 |
982 | #define USB_DEVICE_ID_XAT_CSR 0x0220 | 983 | #define USB_DEVICE_ID_XAT_CSR 0x0220 |
983 | 984 | ||
984 | #define USB_VENDOR_ID_XIN_MO 0x16c0 | 985 | #define USB_VENDOR_ID_XIN_MO 0x16c0 |
985 | #define USB_DEVICE_ID_XIN_MO_DUAL_ARCADE 0x05e1 | 986 | #define USB_DEVICE_ID_XIN_MO_DUAL_ARCADE 0x05e1 |
986 | 987 | ||
987 | #define USB_VENDOR_ID_XIROKU 0x1477 | 988 | #define USB_VENDOR_ID_XIROKU 0x1477 |
988 | #define USB_DEVICE_ID_XIROKU_SPX 0x1006 | 989 | #define USB_DEVICE_ID_XIROKU_SPX 0x1006 |
989 | #define USB_DEVICE_ID_XIROKU_MPX 0x1007 | 990 | #define USB_DEVICE_ID_XIROKU_MPX 0x1007 |
990 | #define USB_DEVICE_ID_XIROKU_CSR 0x100e | 991 | #define USB_DEVICE_ID_XIROKU_CSR 0x100e |
991 | #define USB_DEVICE_ID_XIROKU_SPX1 0x1021 | 992 | #define USB_DEVICE_ID_XIROKU_SPX1 0x1021 |
992 | #define USB_DEVICE_ID_XIROKU_CSR1 0x1022 | 993 | #define USB_DEVICE_ID_XIROKU_CSR1 0x1022 |
993 | #define USB_DEVICE_ID_XIROKU_MPX1 0x1023 | 994 | #define USB_DEVICE_ID_XIROKU_MPX1 0x1023 |
994 | #define USB_DEVICE_ID_XIROKU_SPX2 0x1024 | 995 | #define USB_DEVICE_ID_XIROKU_SPX2 0x1024 |
995 | #define USB_DEVICE_ID_XIROKU_CSR2 0x1025 | 996 | #define USB_DEVICE_ID_XIROKU_CSR2 0x1025 |
996 | #define USB_DEVICE_ID_XIROKU_MPX2 0x1026 | 997 | #define USB_DEVICE_ID_XIROKU_MPX2 0x1026 |
997 | 998 | ||
998 | #define USB_VENDOR_ID_YEALINK 0x6993 | 999 | #define USB_VENDOR_ID_YEALINK 0x6993 |
999 | #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001 | 1000 | #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001 |
1000 | 1001 | ||
1001 | #define USB_VENDOR_ID_ZEROPLUS 0x0c12 | 1002 | #define USB_VENDOR_ID_ZEROPLUS 0x0c12 |
1002 | 1003 | ||
1003 | #define USB_VENDOR_ID_ZYDACRON 0x13EC | 1004 | #define USB_VENDOR_ID_ZYDACRON 0x13EC |
1004 | #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 | 1005 | #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 |
1005 | 1006 | ||
1006 | #define USB_VENDOR_ID_ZYTRONIC 0x14c8 | 1007 | #define USB_VENDOR_ID_ZYTRONIC 0x14c8 |
1007 | #define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005 | 1008 | #define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005 |
1008 | 1009 | ||
1009 | #define USB_VENDOR_ID_PRIMAX 0x0461 | 1010 | #define USB_VENDOR_ID_PRIMAX 0x0461 |
1010 | #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 | 1011 | #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 |
1011 | 1012 | ||
1012 | 1013 | ||
1013 | #define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */ | 1014 | #define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */ |
1014 | #define USB_DEVICE_ID_RI_KA_WEBMAIL 0x1320 /* Webmail Notifier */ | 1015 | #define USB_DEVICE_ID_RI_KA_WEBMAIL 0x1320 /* Webmail Notifier */ |
1015 | 1016 | ||
1016 | #endif | 1017 | #endif |
1017 | 1018 |
drivers/hid/hid-input.c
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2001 Vojtech Pavlik | 2 | * Copyright (c) 2000-2001 Vojtech Pavlik |
3 | * Copyright (c) 2006-2010 Jiri Kosina | 3 | * Copyright (c) 2006-2010 Jiri Kosina |
4 | * | 4 | * |
5 | * HID to Linux Input mapping | 5 | * HID to Linux Input mapping |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
12 | * (at your option) any later version. | 12 | * (at your option) any later version. |
13 | * | 13 | * |
14 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | * GNU General Public License for more details. | 17 | * GNU General Public License for more details. |
18 | * | 18 | * |
19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software | 20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | * | 22 | * |
23 | * Should you need to contact me, the author, you can do so either by | 23 | * Should you need to contact me, the author, you can do so either by |
24 | * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: | 24 | * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: |
25 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | 25 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | 31 | ||
32 | #include <linux/hid.h> | 32 | #include <linux/hid.h> |
33 | #include <linux/hid-debug.h> | 33 | #include <linux/hid-debug.h> |
34 | 34 | ||
35 | #include "hid-ids.h" | 35 | #include "hid-ids.h" |
36 | 36 | ||
37 | #define unk KEY_UNKNOWN | 37 | #define unk KEY_UNKNOWN |
38 | 38 | ||
39 | static const unsigned char hid_keyboard[256] = { | 39 | static const unsigned char hid_keyboard[256] = { |
40 | 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, | 40 | 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, |
41 | 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3, | 41 | 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3, |
42 | 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26, | 42 | 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26, |
43 | 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64, | 43 | 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64, |
44 | 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106, | 44 | 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106, |
45 | 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, | 45 | 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, |
46 | 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190, | 46 | 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190, |
47 | 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113, | 47 | 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113, |
48 | 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk, | 48 | 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk, |
49 | 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,111,unk,unk,unk, | 49 | 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,111,unk,unk,unk, |
50 | unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, | 50 | unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, |
51 | unk,unk,unk,unk,unk,unk,179,180,unk,unk,unk,unk,unk,unk,unk,unk, | 51 | unk,unk,unk,unk,unk,unk,179,180,unk,unk,unk,unk,unk,unk,unk,unk, |
52 | unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, | 52 | unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, |
53 | unk,unk,unk,unk,unk,unk,unk,unk,111,unk,unk,unk,unk,unk,unk,unk, | 53 | unk,unk,unk,unk,unk,unk,unk,unk,111,unk,unk,unk,unk,unk,unk,unk, |
54 | 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113, | 54 | 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113, |
55 | 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk | 55 | 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static const struct { | 58 | static const struct { |
59 | __s32 x; | 59 | __s32 x; |
60 | __s32 y; | 60 | __s32 y; |
61 | } hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; | 61 | } hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; |
62 | 62 | ||
63 | #define map_abs(c) hid_map_usage(hidinput, usage, &bit, &max, EV_ABS, (c)) | 63 | #define map_abs(c) hid_map_usage(hidinput, usage, &bit, &max, EV_ABS, (c)) |
64 | #define map_rel(c) hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c)) | 64 | #define map_rel(c) hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c)) |
65 | #define map_key(c) hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c)) | 65 | #define map_key(c) hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c)) |
66 | #define map_led(c) hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c)) | 66 | #define map_led(c) hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c)) |
67 | 67 | ||
68 | #define map_abs_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ | 68 | #define map_abs_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ |
69 | &max, EV_ABS, (c)) | 69 | &max, EV_ABS, (c)) |
70 | #define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ | 70 | #define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ |
71 | &max, EV_KEY, (c)) | 71 | &max, EV_KEY, (c)) |
72 | 72 | ||
73 | static bool match_scancode(struct hid_usage *usage, | 73 | static bool match_scancode(struct hid_usage *usage, |
74 | unsigned int cur_idx, unsigned int scancode) | 74 | unsigned int cur_idx, unsigned int scancode) |
75 | { | 75 | { |
76 | return (usage->hid & (HID_USAGE_PAGE | HID_USAGE)) == scancode; | 76 | return (usage->hid & (HID_USAGE_PAGE | HID_USAGE)) == scancode; |
77 | } | 77 | } |
78 | 78 | ||
79 | static bool match_keycode(struct hid_usage *usage, | 79 | static bool match_keycode(struct hid_usage *usage, |
80 | unsigned int cur_idx, unsigned int keycode) | 80 | unsigned int cur_idx, unsigned int keycode) |
81 | { | 81 | { |
82 | /* | 82 | /* |
83 | * We should exclude unmapped usages when doing lookup by keycode. | 83 | * We should exclude unmapped usages when doing lookup by keycode. |
84 | */ | 84 | */ |
85 | return (usage->type == EV_KEY && usage->code == keycode); | 85 | return (usage->type == EV_KEY && usage->code == keycode); |
86 | } | 86 | } |
87 | 87 | ||
88 | static bool match_index(struct hid_usage *usage, | 88 | static bool match_index(struct hid_usage *usage, |
89 | unsigned int cur_idx, unsigned int idx) | 89 | unsigned int cur_idx, unsigned int idx) |
90 | { | 90 | { |
91 | return cur_idx == idx; | 91 | return cur_idx == idx; |
92 | } | 92 | } |
93 | 93 | ||
94 | typedef bool (*hid_usage_cmp_t)(struct hid_usage *usage, | 94 | typedef bool (*hid_usage_cmp_t)(struct hid_usage *usage, |
95 | unsigned int cur_idx, unsigned int val); | 95 | unsigned int cur_idx, unsigned int val); |
96 | 96 | ||
97 | static struct hid_usage *hidinput_find_key(struct hid_device *hid, | 97 | static struct hid_usage *hidinput_find_key(struct hid_device *hid, |
98 | hid_usage_cmp_t match, | 98 | hid_usage_cmp_t match, |
99 | unsigned int value, | 99 | unsigned int value, |
100 | unsigned int *usage_idx) | 100 | unsigned int *usage_idx) |
101 | { | 101 | { |
102 | unsigned int i, j, k, cur_idx = 0; | 102 | unsigned int i, j, k, cur_idx = 0; |
103 | struct hid_report *report; | 103 | struct hid_report *report; |
104 | struct hid_usage *usage; | 104 | struct hid_usage *usage; |
105 | 105 | ||
106 | for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { | 106 | for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { |
107 | list_for_each_entry(report, &hid->report_enum[k].report_list, list) { | 107 | list_for_each_entry(report, &hid->report_enum[k].report_list, list) { |
108 | for (i = 0; i < report->maxfield; i++) { | 108 | for (i = 0; i < report->maxfield; i++) { |
109 | for (j = 0; j < report->field[i]->maxusage; j++) { | 109 | for (j = 0; j < report->field[i]->maxusage; j++) { |
110 | usage = report->field[i]->usage + j; | 110 | usage = report->field[i]->usage + j; |
111 | if (usage->type == EV_KEY || usage->type == 0) { | 111 | if (usage->type == EV_KEY || usage->type == 0) { |
112 | if (match(usage, cur_idx, value)) { | 112 | if (match(usage, cur_idx, value)) { |
113 | if (usage_idx) | 113 | if (usage_idx) |
114 | *usage_idx = cur_idx; | 114 | *usage_idx = cur_idx; |
115 | return usage; | 115 | return usage; |
116 | } | 116 | } |
117 | cur_idx++; | 117 | cur_idx++; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | return NULL; | 123 | return NULL; |
124 | } | 124 | } |
125 | 125 | ||
126 | static struct hid_usage *hidinput_locate_usage(struct hid_device *hid, | 126 | static struct hid_usage *hidinput_locate_usage(struct hid_device *hid, |
127 | const struct input_keymap_entry *ke, | 127 | const struct input_keymap_entry *ke, |
128 | unsigned int *index) | 128 | unsigned int *index) |
129 | { | 129 | { |
130 | struct hid_usage *usage; | 130 | struct hid_usage *usage; |
131 | unsigned int scancode; | 131 | unsigned int scancode; |
132 | 132 | ||
133 | if (ke->flags & INPUT_KEYMAP_BY_INDEX) | 133 | if (ke->flags & INPUT_KEYMAP_BY_INDEX) |
134 | usage = hidinput_find_key(hid, match_index, ke->index, index); | 134 | usage = hidinput_find_key(hid, match_index, ke->index, index); |
135 | else if (input_scancode_to_scalar(ke, &scancode) == 0) | 135 | else if (input_scancode_to_scalar(ke, &scancode) == 0) |
136 | usage = hidinput_find_key(hid, match_scancode, scancode, index); | 136 | usage = hidinput_find_key(hid, match_scancode, scancode, index); |
137 | else | 137 | else |
138 | usage = NULL; | 138 | usage = NULL; |
139 | 139 | ||
140 | return usage; | 140 | return usage; |
141 | } | 141 | } |
142 | 142 | ||
143 | static int hidinput_getkeycode(struct input_dev *dev, | 143 | static int hidinput_getkeycode(struct input_dev *dev, |
144 | struct input_keymap_entry *ke) | 144 | struct input_keymap_entry *ke) |
145 | { | 145 | { |
146 | struct hid_device *hid = input_get_drvdata(dev); | 146 | struct hid_device *hid = input_get_drvdata(dev); |
147 | struct hid_usage *usage; | 147 | struct hid_usage *usage; |
148 | unsigned int scancode, index; | 148 | unsigned int scancode, index; |
149 | 149 | ||
150 | usage = hidinput_locate_usage(hid, ke, &index); | 150 | usage = hidinput_locate_usage(hid, ke, &index); |
151 | if (usage) { | 151 | if (usage) { |
152 | ke->keycode = usage->type == EV_KEY ? | 152 | ke->keycode = usage->type == EV_KEY ? |
153 | usage->code : KEY_RESERVED; | 153 | usage->code : KEY_RESERVED; |
154 | ke->index = index; | 154 | ke->index = index; |
155 | scancode = usage->hid & (HID_USAGE_PAGE | HID_USAGE); | 155 | scancode = usage->hid & (HID_USAGE_PAGE | HID_USAGE); |
156 | ke->len = sizeof(scancode); | 156 | ke->len = sizeof(scancode); |
157 | memcpy(ke->scancode, &scancode, sizeof(scancode)); | 157 | memcpy(ke->scancode, &scancode, sizeof(scancode)); |
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | return -EINVAL; | 161 | return -EINVAL; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int hidinput_setkeycode(struct input_dev *dev, | 164 | static int hidinput_setkeycode(struct input_dev *dev, |
165 | const struct input_keymap_entry *ke, | 165 | const struct input_keymap_entry *ke, |
166 | unsigned int *old_keycode) | 166 | unsigned int *old_keycode) |
167 | { | 167 | { |
168 | struct hid_device *hid = input_get_drvdata(dev); | 168 | struct hid_device *hid = input_get_drvdata(dev); |
169 | struct hid_usage *usage; | 169 | struct hid_usage *usage; |
170 | 170 | ||
171 | usage = hidinput_locate_usage(hid, ke, NULL); | 171 | usage = hidinput_locate_usage(hid, ke, NULL); |
172 | if (usage) { | 172 | if (usage) { |
173 | *old_keycode = usage->type == EV_KEY ? | 173 | *old_keycode = usage->type == EV_KEY ? |
174 | usage->code : KEY_RESERVED; | 174 | usage->code : KEY_RESERVED; |
175 | usage->code = ke->keycode; | 175 | usage->code = ke->keycode; |
176 | 176 | ||
177 | clear_bit(*old_keycode, dev->keybit); | 177 | clear_bit(*old_keycode, dev->keybit); |
178 | set_bit(usage->code, dev->keybit); | 178 | set_bit(usage->code, dev->keybit); |
179 | dbg_hid("Assigned keycode %d to HID usage code %x\n", | 179 | dbg_hid("Assigned keycode %d to HID usage code %x\n", |
180 | usage->code, usage->hid); | 180 | usage->code, usage->hid); |
181 | 181 | ||
182 | /* | 182 | /* |
183 | * Set the keybit for the old keycode if the old keycode is used | 183 | * Set the keybit for the old keycode if the old keycode is used |
184 | * by another key | 184 | * by another key |
185 | */ | 185 | */ |
186 | if (hidinput_find_key(hid, match_keycode, *old_keycode, NULL)) | 186 | if (hidinput_find_key(hid, match_keycode, *old_keycode, NULL)) |
187 | set_bit(*old_keycode, dev->keybit); | 187 | set_bit(*old_keycode, dev->keybit); |
188 | 188 | ||
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | 191 | ||
192 | return -EINVAL; | 192 | return -EINVAL; |
193 | } | 193 | } |
194 | 194 | ||
195 | 195 | ||
196 | /** | 196 | /** |
197 | * hidinput_calc_abs_res - calculate an absolute axis resolution | 197 | * hidinput_calc_abs_res - calculate an absolute axis resolution |
198 | * @field: the HID report field to calculate resolution for | 198 | * @field: the HID report field to calculate resolution for |
199 | * @code: axis code | 199 | * @code: axis code |
200 | * | 200 | * |
201 | * The formula is: | 201 | * The formula is: |
202 | * (logical_maximum - logical_minimum) | 202 | * (logical_maximum - logical_minimum) |
203 | * resolution = ---------------------------------------------------------- | 203 | * resolution = ---------------------------------------------------------- |
204 | * (physical_maximum - physical_minimum) * 10 ^ unit_exponent | 204 | * (physical_maximum - physical_minimum) * 10 ^ unit_exponent |
205 | * | 205 | * |
206 | * as seen in the HID specification v1.11 6.2.2.7 Global Items. | 206 | * as seen in the HID specification v1.11 6.2.2.7 Global Items. |
207 | * | 207 | * |
208 | * Only exponent 1 length units are processed. Centimeters and inches are | 208 | * Only exponent 1 length units are processed. Centimeters and inches are |
209 | * converted to millimeters. Degrees are converted to radians. | 209 | * converted to millimeters. Degrees are converted to radians. |
210 | */ | 210 | */ |
211 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | 211 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) |
212 | { | 212 | { |
213 | __s32 unit_exponent = field->unit_exponent; | 213 | __s32 unit_exponent = field->unit_exponent; |
214 | __s32 logical_extents = field->logical_maximum - | 214 | __s32 logical_extents = field->logical_maximum - |
215 | field->logical_minimum; | 215 | field->logical_minimum; |
216 | __s32 physical_extents = field->physical_maximum - | 216 | __s32 physical_extents = field->physical_maximum - |
217 | field->physical_minimum; | 217 | field->physical_minimum; |
218 | __s32 prev; | 218 | __s32 prev; |
219 | 219 | ||
220 | /* Check if the extents are sane */ | 220 | /* Check if the extents are sane */ |
221 | if (logical_extents <= 0 || physical_extents <= 0) | 221 | if (logical_extents <= 0 || physical_extents <= 0) |
222 | return 0; | 222 | return 0; |
223 | 223 | ||
224 | /* | 224 | /* |
225 | * Verify and convert units. | 225 | * Verify and convert units. |
226 | * See HID specification v1.11 6.2.2.7 Global Items for unit decoding | 226 | * See HID specification v1.11 6.2.2.7 Global Items for unit decoding |
227 | */ | 227 | */ |
228 | switch (code) { | 228 | switch (code) { |
229 | case ABS_X: | 229 | case ABS_X: |
230 | case ABS_Y: | 230 | case ABS_Y: |
231 | case ABS_Z: | 231 | case ABS_Z: |
232 | case ABS_MT_POSITION_X: | 232 | case ABS_MT_POSITION_X: |
233 | case ABS_MT_POSITION_Y: | 233 | case ABS_MT_POSITION_Y: |
234 | case ABS_MT_TOOL_X: | 234 | case ABS_MT_TOOL_X: |
235 | case ABS_MT_TOOL_Y: | 235 | case ABS_MT_TOOL_Y: |
236 | case ABS_MT_TOUCH_MAJOR: | 236 | case ABS_MT_TOUCH_MAJOR: |
237 | case ABS_MT_TOUCH_MINOR: | 237 | case ABS_MT_TOUCH_MINOR: |
238 | if (field->unit == 0x11) { /* If centimeters */ | 238 | if (field->unit == 0x11) { /* If centimeters */ |
239 | /* Convert to millimeters */ | 239 | /* Convert to millimeters */ |
240 | unit_exponent += 1; | 240 | unit_exponent += 1; |
241 | } else if (field->unit == 0x13) { /* If inches */ | 241 | } else if (field->unit == 0x13) { /* If inches */ |
242 | /* Convert to millimeters */ | 242 | /* Convert to millimeters */ |
243 | prev = physical_extents; | 243 | prev = physical_extents; |
244 | physical_extents *= 254; | 244 | physical_extents *= 254; |
245 | if (physical_extents < prev) | 245 | if (physical_extents < prev) |
246 | return 0; | 246 | return 0; |
247 | unit_exponent -= 1; | 247 | unit_exponent -= 1; |
248 | } else { | 248 | } else { |
249 | return 0; | 249 | return 0; |
250 | } | 250 | } |
251 | break; | 251 | break; |
252 | 252 | ||
253 | case ABS_RX: | 253 | case ABS_RX: |
254 | case ABS_RY: | 254 | case ABS_RY: |
255 | case ABS_RZ: | 255 | case ABS_RZ: |
256 | case ABS_TILT_X: | 256 | case ABS_TILT_X: |
257 | case ABS_TILT_Y: | 257 | case ABS_TILT_Y: |
258 | if (field->unit == 0x14) { /* If degrees */ | 258 | if (field->unit == 0x14) { /* If degrees */ |
259 | /* Convert to radians */ | 259 | /* Convert to radians */ |
260 | prev = logical_extents; | 260 | prev = logical_extents; |
261 | logical_extents *= 573; | 261 | logical_extents *= 573; |
262 | if (logical_extents < prev) | 262 | if (logical_extents < prev) |
263 | return 0; | 263 | return 0; |
264 | unit_exponent += 1; | 264 | unit_exponent += 1; |
265 | } else if (field->unit != 0x12) { /* If not radians */ | 265 | } else if (field->unit != 0x12) { /* If not radians */ |
266 | return 0; | 266 | return 0; |
267 | } | 267 | } |
268 | break; | 268 | break; |
269 | 269 | ||
270 | default: | 270 | default: |
271 | return 0; | 271 | return 0; |
272 | } | 272 | } |
273 | 273 | ||
274 | /* Apply negative unit exponent */ | 274 | /* Apply negative unit exponent */ |
275 | for (; unit_exponent < 0; unit_exponent++) { | 275 | for (; unit_exponent < 0; unit_exponent++) { |
276 | prev = logical_extents; | 276 | prev = logical_extents; |
277 | logical_extents *= 10; | 277 | logical_extents *= 10; |
278 | if (logical_extents < prev) | 278 | if (logical_extents < prev) |
279 | return 0; | 279 | return 0; |
280 | } | 280 | } |
281 | /* Apply positive unit exponent */ | 281 | /* Apply positive unit exponent */ |
282 | for (; unit_exponent > 0; unit_exponent--) { | 282 | for (; unit_exponent > 0; unit_exponent--) { |
283 | prev = physical_extents; | 283 | prev = physical_extents; |
284 | physical_extents *= 10; | 284 | physical_extents *= 10; |
285 | if (physical_extents < prev) | 285 | if (physical_extents < prev) |
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
288 | 288 | ||
289 | /* Calculate resolution */ | 289 | /* Calculate resolution */ |
290 | return DIV_ROUND_CLOSEST(logical_extents, physical_extents); | 290 | return DIV_ROUND_CLOSEST(logical_extents, physical_extents); |
291 | } | 291 | } |
292 | EXPORT_SYMBOL_GPL(hidinput_calc_abs_res); | 292 | EXPORT_SYMBOL_GPL(hidinput_calc_abs_res); |
293 | 293 | ||
294 | #ifdef CONFIG_HID_BATTERY_STRENGTH | 294 | #ifdef CONFIG_HID_BATTERY_STRENGTH |
295 | static enum power_supply_property hidinput_battery_props[] = { | 295 | static enum power_supply_property hidinput_battery_props[] = { |
296 | POWER_SUPPLY_PROP_PRESENT, | 296 | POWER_SUPPLY_PROP_PRESENT, |
297 | POWER_SUPPLY_PROP_ONLINE, | 297 | POWER_SUPPLY_PROP_ONLINE, |
298 | POWER_SUPPLY_PROP_CAPACITY, | 298 | POWER_SUPPLY_PROP_CAPACITY, |
299 | POWER_SUPPLY_PROP_MODEL_NAME, | 299 | POWER_SUPPLY_PROP_MODEL_NAME, |
300 | POWER_SUPPLY_PROP_STATUS, | 300 | POWER_SUPPLY_PROP_STATUS, |
301 | POWER_SUPPLY_PROP_SCOPE, | 301 | POWER_SUPPLY_PROP_SCOPE, |
302 | }; | 302 | }; |
303 | 303 | ||
304 | #define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */ | 304 | #define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */ |
305 | #define HID_BATTERY_QUIRK_FEATURE (1 << 1) /* ask for feature report */ | 305 | #define HID_BATTERY_QUIRK_FEATURE (1 << 1) /* ask for feature report */ |
306 | 306 | ||
307 | static const struct hid_device_id hid_battery_quirks[] = { | 307 | static const struct hid_device_id hid_battery_quirks[] = { |
308 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | 308 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
309 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), | 309 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
310 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | 310 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, |
311 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | 311 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
312 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), | 312 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), |
313 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | 313 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, |
314 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | 314 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
315 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), | ||
316 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | ||
317 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | ||
315 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), | 318 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), |
316 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | 319 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, |
317 | {} | 320 | {} |
318 | }; | 321 | }; |
319 | 322 | ||
320 | static unsigned find_battery_quirk(struct hid_device *hdev) | 323 | static unsigned find_battery_quirk(struct hid_device *hdev) |
321 | { | 324 | { |
322 | unsigned quirks = 0; | 325 | unsigned quirks = 0; |
323 | const struct hid_device_id *match; | 326 | const struct hid_device_id *match; |
324 | 327 | ||
325 | match = hid_match_id(hdev, hid_battery_quirks); | 328 | match = hid_match_id(hdev, hid_battery_quirks); |
326 | if (match != NULL) | 329 | if (match != NULL) |
327 | quirks = match->driver_data; | 330 | quirks = match->driver_data; |
328 | 331 | ||
329 | return quirks; | 332 | return quirks; |
330 | } | 333 | } |
331 | 334 | ||
332 | static int hidinput_get_battery_property(struct power_supply *psy, | 335 | static int hidinput_get_battery_property(struct power_supply *psy, |
333 | enum power_supply_property prop, | 336 | enum power_supply_property prop, |
334 | union power_supply_propval *val) | 337 | union power_supply_propval *val) |
335 | { | 338 | { |
336 | struct hid_device *dev = container_of(psy, struct hid_device, battery); | 339 | struct hid_device *dev = container_of(psy, struct hid_device, battery); |
337 | int ret = 0; | 340 | int ret = 0; |
338 | __u8 *buf; | 341 | __u8 *buf; |
339 | 342 | ||
340 | switch (prop) { | 343 | switch (prop) { |
341 | case POWER_SUPPLY_PROP_PRESENT: | 344 | case POWER_SUPPLY_PROP_PRESENT: |
342 | case POWER_SUPPLY_PROP_ONLINE: | 345 | case POWER_SUPPLY_PROP_ONLINE: |
343 | val->intval = 1; | 346 | val->intval = 1; |
344 | break; | 347 | break; |
345 | 348 | ||
346 | case POWER_SUPPLY_PROP_CAPACITY: | 349 | case POWER_SUPPLY_PROP_CAPACITY: |
347 | 350 | ||
348 | buf = kmalloc(2 * sizeof(__u8), GFP_KERNEL); | 351 | buf = kmalloc(2 * sizeof(__u8), GFP_KERNEL); |
349 | if (!buf) { | 352 | if (!buf) { |
350 | ret = -ENOMEM; | 353 | ret = -ENOMEM; |
351 | break; | 354 | break; |
352 | } | 355 | } |
353 | ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 2, | 356 | ret = hid_hw_raw_request(dev, dev->battery_report_id, buf, 2, |
354 | dev->battery_report_type, | 357 | dev->battery_report_type, |
355 | HID_REQ_GET_REPORT); | 358 | HID_REQ_GET_REPORT); |
356 | 359 | ||
357 | if (ret != 2) { | 360 | if (ret != 2) { |
358 | ret = -ENODATA; | 361 | ret = -ENODATA; |
359 | kfree(buf); | 362 | kfree(buf); |
360 | break; | 363 | break; |
361 | } | 364 | } |
362 | ret = 0; | 365 | ret = 0; |
363 | 366 | ||
364 | if (dev->battery_min < dev->battery_max && | 367 | if (dev->battery_min < dev->battery_max && |
365 | buf[1] >= dev->battery_min && | 368 | buf[1] >= dev->battery_min && |
366 | buf[1] <= dev->battery_max) | 369 | buf[1] <= dev->battery_max) |
367 | val->intval = (100 * (buf[1] - dev->battery_min)) / | 370 | val->intval = (100 * (buf[1] - dev->battery_min)) / |
368 | (dev->battery_max - dev->battery_min); | 371 | (dev->battery_max - dev->battery_min); |
369 | kfree(buf); | 372 | kfree(buf); |
370 | break; | 373 | break; |
371 | 374 | ||
372 | case POWER_SUPPLY_PROP_MODEL_NAME: | 375 | case POWER_SUPPLY_PROP_MODEL_NAME: |
373 | val->strval = dev->name; | 376 | val->strval = dev->name; |
374 | break; | 377 | break; |
375 | 378 | ||
376 | case POWER_SUPPLY_PROP_STATUS: | 379 | case POWER_SUPPLY_PROP_STATUS: |
377 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | 380 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; |
378 | break; | 381 | break; |
379 | 382 | ||
380 | case POWER_SUPPLY_PROP_SCOPE: | 383 | case POWER_SUPPLY_PROP_SCOPE: |
381 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; | 384 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; |
382 | break; | 385 | break; |
383 | 386 | ||
384 | default: | 387 | default: |
385 | ret = -EINVAL; | 388 | ret = -EINVAL; |
386 | break; | 389 | break; |
387 | } | 390 | } |
388 | 391 | ||
389 | return ret; | 392 | return ret; |
390 | } | 393 | } |
391 | 394 | ||
392 | static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type, struct hid_field *field) | 395 | static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type, struct hid_field *field) |
393 | { | 396 | { |
394 | struct power_supply *battery = &dev->battery; | 397 | struct power_supply *battery = &dev->battery; |
395 | int ret; | 398 | int ret; |
396 | unsigned quirks; | 399 | unsigned quirks; |
397 | s32 min, max; | 400 | s32 min, max; |
398 | 401 | ||
399 | if (field->usage->hid != HID_DC_BATTERYSTRENGTH) | 402 | if (field->usage->hid != HID_DC_BATTERYSTRENGTH) |
400 | return false; /* no match */ | 403 | return false; /* no match */ |
401 | 404 | ||
402 | if (battery->name != NULL) | 405 | if (battery->name != NULL) |
403 | goto out; /* already initialized? */ | 406 | goto out; /* already initialized? */ |
404 | 407 | ||
405 | battery->name = kasprintf(GFP_KERNEL, "hid-%s-battery", dev->uniq); | 408 | battery->name = kasprintf(GFP_KERNEL, "hid-%s-battery", dev->uniq); |
406 | if (battery->name == NULL) | 409 | if (battery->name == NULL) |
407 | goto out; | 410 | goto out; |
408 | 411 | ||
409 | battery->type = POWER_SUPPLY_TYPE_BATTERY; | 412 | battery->type = POWER_SUPPLY_TYPE_BATTERY; |
410 | battery->properties = hidinput_battery_props; | 413 | battery->properties = hidinput_battery_props; |
411 | battery->num_properties = ARRAY_SIZE(hidinput_battery_props); | 414 | battery->num_properties = ARRAY_SIZE(hidinput_battery_props); |
412 | battery->use_for_apm = 0; | 415 | battery->use_for_apm = 0; |
413 | battery->get_property = hidinput_get_battery_property; | 416 | battery->get_property = hidinput_get_battery_property; |
414 | 417 | ||
415 | quirks = find_battery_quirk(dev); | 418 | quirks = find_battery_quirk(dev); |
416 | 419 | ||
417 | hid_dbg(dev, "device %x:%x:%x %d quirks %d\n", | 420 | hid_dbg(dev, "device %x:%x:%x %d quirks %d\n", |
418 | dev->bus, dev->vendor, dev->product, dev->version, quirks); | 421 | dev->bus, dev->vendor, dev->product, dev->version, quirks); |
419 | 422 | ||
420 | min = field->logical_minimum; | 423 | min = field->logical_minimum; |
421 | max = field->logical_maximum; | 424 | max = field->logical_maximum; |
422 | 425 | ||
423 | if (quirks & HID_BATTERY_QUIRK_PERCENT) { | 426 | if (quirks & HID_BATTERY_QUIRK_PERCENT) { |
424 | min = 0; | 427 | min = 0; |
425 | max = 100; | 428 | max = 100; |
426 | } | 429 | } |
427 | 430 | ||
428 | if (quirks & HID_BATTERY_QUIRK_FEATURE) | 431 | if (quirks & HID_BATTERY_QUIRK_FEATURE) |
429 | report_type = HID_FEATURE_REPORT; | 432 | report_type = HID_FEATURE_REPORT; |
430 | 433 | ||
431 | dev->battery_min = min; | 434 | dev->battery_min = min; |
432 | dev->battery_max = max; | 435 | dev->battery_max = max; |
433 | dev->battery_report_type = report_type; | 436 | dev->battery_report_type = report_type; |
434 | dev->battery_report_id = field->report->id; | 437 | dev->battery_report_id = field->report->id; |
435 | 438 | ||
436 | ret = power_supply_register(&dev->dev, battery); | 439 | ret = power_supply_register(&dev->dev, battery); |
437 | if (ret != 0) { | 440 | if (ret != 0) { |
438 | hid_warn(dev, "can't register power supply: %d\n", ret); | 441 | hid_warn(dev, "can't register power supply: %d\n", ret); |
439 | kfree(battery->name); | 442 | kfree(battery->name); |
440 | battery->name = NULL; | 443 | battery->name = NULL; |
441 | } | 444 | } |
442 | 445 | ||
443 | power_supply_powers(battery, &dev->dev); | 446 | power_supply_powers(battery, &dev->dev); |
444 | 447 | ||
445 | out: | 448 | out: |
446 | return true; | 449 | return true; |
447 | } | 450 | } |
448 | 451 | ||
449 | static void hidinput_cleanup_battery(struct hid_device *dev) | 452 | static void hidinput_cleanup_battery(struct hid_device *dev) |
450 | { | 453 | { |
451 | if (!dev->battery.name) | 454 | if (!dev->battery.name) |
452 | return; | 455 | return; |
453 | 456 | ||
454 | power_supply_unregister(&dev->battery); | 457 | power_supply_unregister(&dev->battery); |
455 | kfree(dev->battery.name); | 458 | kfree(dev->battery.name); |
456 | dev->battery.name = NULL; | 459 | dev->battery.name = NULL; |
457 | } | 460 | } |
458 | #else /* !CONFIG_HID_BATTERY_STRENGTH */ | 461 | #else /* !CONFIG_HID_BATTERY_STRENGTH */ |
459 | static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type, | 462 | static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type, |
460 | struct hid_field *field) | 463 | struct hid_field *field) |
461 | { | 464 | { |
462 | return false; | 465 | return false; |
463 | } | 466 | } |
464 | 467 | ||
465 | static void hidinput_cleanup_battery(struct hid_device *dev) | 468 | static void hidinput_cleanup_battery(struct hid_device *dev) |
466 | { | 469 | { |
467 | } | 470 | } |
468 | #endif /* CONFIG_HID_BATTERY_STRENGTH */ | 471 | #endif /* CONFIG_HID_BATTERY_STRENGTH */ |
469 | 472 | ||
470 | static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field, | 473 | static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field, |
471 | struct hid_usage *usage) | 474 | struct hid_usage *usage) |
472 | { | 475 | { |
473 | struct input_dev *input = hidinput->input; | 476 | struct input_dev *input = hidinput->input; |
474 | struct hid_device *device = input_get_drvdata(input); | 477 | struct hid_device *device = input_get_drvdata(input); |
475 | int max = 0, code; | 478 | int max = 0, code; |
476 | unsigned long *bit = NULL; | 479 | unsigned long *bit = NULL; |
477 | 480 | ||
478 | field->hidinput = hidinput; | 481 | field->hidinput = hidinput; |
479 | 482 | ||
480 | if (field->flags & HID_MAIN_ITEM_CONSTANT) | 483 | if (field->flags & HID_MAIN_ITEM_CONSTANT) |
481 | goto ignore; | 484 | goto ignore; |
482 | 485 | ||
483 | /* Ignore if report count is out of bounds. */ | 486 | /* Ignore if report count is out of bounds. */ |
484 | if (field->report_count < 1) | 487 | if (field->report_count < 1) |
485 | goto ignore; | 488 | goto ignore; |
486 | 489 | ||
487 | /* only LED usages are supported in output fields */ | 490 | /* only LED usages are supported in output fields */ |
488 | if (field->report_type == HID_OUTPUT_REPORT && | 491 | if (field->report_type == HID_OUTPUT_REPORT && |
489 | (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { | 492 | (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { |
490 | goto ignore; | 493 | goto ignore; |
491 | } | 494 | } |
492 | 495 | ||
493 | if (device->driver->input_mapping) { | 496 | if (device->driver->input_mapping) { |
494 | int ret = device->driver->input_mapping(device, hidinput, field, | 497 | int ret = device->driver->input_mapping(device, hidinput, field, |
495 | usage, &bit, &max); | 498 | usage, &bit, &max); |
496 | if (ret > 0) | 499 | if (ret > 0) |
497 | goto mapped; | 500 | goto mapped; |
498 | if (ret < 0) | 501 | if (ret < 0) |
499 | goto ignore; | 502 | goto ignore; |
500 | } | 503 | } |
501 | 504 | ||
502 | switch (usage->hid & HID_USAGE_PAGE) { | 505 | switch (usage->hid & HID_USAGE_PAGE) { |
503 | case HID_UP_UNDEFINED: | 506 | case HID_UP_UNDEFINED: |
504 | goto ignore; | 507 | goto ignore; |
505 | 508 | ||
506 | case HID_UP_KEYBOARD: | 509 | case HID_UP_KEYBOARD: |
507 | set_bit(EV_REP, input->evbit); | 510 | set_bit(EV_REP, input->evbit); |
508 | 511 | ||
509 | if ((usage->hid & HID_USAGE) < 256) { | 512 | if ((usage->hid & HID_USAGE) < 256) { |
510 | if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; | 513 | if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; |
511 | map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); | 514 | map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); |
512 | } else | 515 | } else |
513 | map_key(KEY_UNKNOWN); | 516 | map_key(KEY_UNKNOWN); |
514 | 517 | ||
515 | break; | 518 | break; |
516 | 519 | ||
517 | case HID_UP_BUTTON: | 520 | case HID_UP_BUTTON: |
518 | code = ((usage->hid - 1) & HID_USAGE); | 521 | code = ((usage->hid - 1) & HID_USAGE); |
519 | 522 | ||
520 | switch (field->application) { | 523 | switch (field->application) { |
521 | case HID_GD_MOUSE: | 524 | case HID_GD_MOUSE: |
522 | case HID_GD_POINTER: code += BTN_MOUSE; break; | 525 | case HID_GD_POINTER: code += BTN_MOUSE; break; |
523 | case HID_GD_JOYSTICK: | 526 | case HID_GD_JOYSTICK: |
524 | if (code <= 0xf) | 527 | if (code <= 0xf) |
525 | code += BTN_JOYSTICK; | 528 | code += BTN_JOYSTICK; |
526 | else | 529 | else |
527 | code += BTN_TRIGGER_HAPPY - 0x10; | 530 | code += BTN_TRIGGER_HAPPY - 0x10; |
528 | break; | 531 | break; |
529 | case HID_GD_GAMEPAD: | 532 | case HID_GD_GAMEPAD: |
530 | if (code <= 0xf) | 533 | if (code <= 0xf) |
531 | code += BTN_GAMEPAD; | 534 | code += BTN_GAMEPAD; |
532 | else | 535 | else |
533 | code += BTN_TRIGGER_HAPPY - 0x10; | 536 | code += BTN_TRIGGER_HAPPY - 0x10; |
534 | break; | 537 | break; |
535 | default: | 538 | default: |
536 | switch (field->physical) { | 539 | switch (field->physical) { |
537 | case HID_GD_MOUSE: | 540 | case HID_GD_MOUSE: |
538 | case HID_GD_POINTER: code += BTN_MOUSE; break; | 541 | case HID_GD_POINTER: code += BTN_MOUSE; break; |
539 | case HID_GD_JOYSTICK: code += BTN_JOYSTICK; break; | 542 | case HID_GD_JOYSTICK: code += BTN_JOYSTICK; break; |
540 | case HID_GD_GAMEPAD: code += BTN_GAMEPAD; break; | 543 | case HID_GD_GAMEPAD: code += BTN_GAMEPAD; break; |
541 | default: code += BTN_MISC; | 544 | default: code += BTN_MISC; |
542 | } | 545 | } |
543 | } | 546 | } |
544 | 547 | ||
545 | map_key(code); | 548 | map_key(code); |
546 | break; | 549 | break; |
547 | 550 | ||
548 | case HID_UP_SIMULATION: | 551 | case HID_UP_SIMULATION: |
549 | switch (usage->hid & 0xffff) { | 552 | switch (usage->hid & 0xffff) { |
550 | case 0xba: map_abs(ABS_RUDDER); break; | 553 | case 0xba: map_abs(ABS_RUDDER); break; |
551 | case 0xbb: map_abs(ABS_THROTTLE); break; | 554 | case 0xbb: map_abs(ABS_THROTTLE); break; |
552 | case 0xc4: map_abs(ABS_GAS); break; | 555 | case 0xc4: map_abs(ABS_GAS); break; |
553 | case 0xc5: map_abs(ABS_BRAKE); break; | 556 | case 0xc5: map_abs(ABS_BRAKE); break; |
554 | case 0xc8: map_abs(ABS_WHEEL); break; | 557 | case 0xc8: map_abs(ABS_WHEEL); break; |
555 | default: goto ignore; | 558 | default: goto ignore; |
556 | } | 559 | } |
557 | break; | 560 | break; |
558 | 561 | ||
559 | case HID_UP_GENDESK: | 562 | case HID_UP_GENDESK: |
560 | if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ | 563 | if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ |
561 | switch (usage->hid & 0xf) { | 564 | switch (usage->hid & 0xf) { |
562 | case 0x1: map_key_clear(KEY_POWER); break; | 565 | case 0x1: map_key_clear(KEY_POWER); break; |
563 | case 0x2: map_key_clear(KEY_SLEEP); break; | 566 | case 0x2: map_key_clear(KEY_SLEEP); break; |
564 | case 0x3: map_key_clear(KEY_WAKEUP); break; | 567 | case 0x3: map_key_clear(KEY_WAKEUP); break; |
565 | case 0x4: map_key_clear(KEY_CONTEXT_MENU); break; | 568 | case 0x4: map_key_clear(KEY_CONTEXT_MENU); break; |
566 | case 0x5: map_key_clear(KEY_MENU); break; | 569 | case 0x5: map_key_clear(KEY_MENU); break; |
567 | case 0x6: map_key_clear(KEY_PROG1); break; | 570 | case 0x6: map_key_clear(KEY_PROG1); break; |
568 | case 0x7: map_key_clear(KEY_HELP); break; | 571 | case 0x7: map_key_clear(KEY_HELP); break; |
569 | case 0x8: map_key_clear(KEY_EXIT); break; | 572 | case 0x8: map_key_clear(KEY_EXIT); break; |
570 | case 0x9: map_key_clear(KEY_SELECT); break; | 573 | case 0x9: map_key_clear(KEY_SELECT); break; |
571 | case 0xa: map_key_clear(KEY_RIGHT); break; | 574 | case 0xa: map_key_clear(KEY_RIGHT); break; |
572 | case 0xb: map_key_clear(KEY_LEFT); break; | 575 | case 0xb: map_key_clear(KEY_LEFT); break; |
573 | case 0xc: map_key_clear(KEY_UP); break; | 576 | case 0xc: map_key_clear(KEY_UP); break; |
574 | case 0xd: map_key_clear(KEY_DOWN); break; | 577 | case 0xd: map_key_clear(KEY_DOWN); break; |
575 | case 0xe: map_key_clear(KEY_POWER2); break; | 578 | case 0xe: map_key_clear(KEY_POWER2); break; |
576 | case 0xf: map_key_clear(KEY_RESTART); break; | 579 | case 0xf: map_key_clear(KEY_RESTART); break; |
577 | default: goto unknown; | 580 | default: goto unknown; |
578 | } | 581 | } |
579 | break; | 582 | break; |
580 | } | 583 | } |
581 | 584 | ||
582 | if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ | 585 | if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ |
583 | switch (usage->hid) { | 586 | switch (usage->hid) { |
584 | case HID_GD_UP: usage->hat_dir = 1; break; | 587 | case HID_GD_UP: usage->hat_dir = 1; break; |
585 | case HID_GD_DOWN: usage->hat_dir = 5; break; | 588 | case HID_GD_DOWN: usage->hat_dir = 5; break; |
586 | case HID_GD_RIGHT: usage->hat_dir = 3; break; | 589 | case HID_GD_RIGHT: usage->hat_dir = 3; break; |
587 | case HID_GD_LEFT: usage->hat_dir = 7; break; | 590 | case HID_GD_LEFT: usage->hat_dir = 7; break; |
588 | default: goto unknown; | 591 | default: goto unknown; |
589 | } | 592 | } |
590 | if (field->dpad) { | 593 | if (field->dpad) { |
591 | map_abs(field->dpad); | 594 | map_abs(field->dpad); |
592 | goto ignore; | 595 | goto ignore; |
593 | } | 596 | } |
594 | map_abs(ABS_HAT0X); | 597 | map_abs(ABS_HAT0X); |
595 | break; | 598 | break; |
596 | } | 599 | } |
597 | 600 | ||
598 | switch (usage->hid) { | 601 | switch (usage->hid) { |
599 | /* These usage IDs map directly to the usage codes. */ | 602 | /* These usage IDs map directly to the usage codes. */ |
600 | case HID_GD_X: case HID_GD_Y: case HID_GD_Z: | 603 | case HID_GD_X: case HID_GD_Y: case HID_GD_Z: |
601 | case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: | 604 | case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: |
602 | if (field->flags & HID_MAIN_ITEM_RELATIVE) | 605 | if (field->flags & HID_MAIN_ITEM_RELATIVE) |
603 | map_rel(usage->hid & 0xf); | 606 | map_rel(usage->hid & 0xf); |
604 | else | 607 | else |
605 | map_abs_clear(usage->hid & 0xf); | 608 | map_abs_clear(usage->hid & 0xf); |
606 | break; | 609 | break; |
607 | 610 | ||
608 | case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: | 611 | case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: |
609 | if (field->flags & HID_MAIN_ITEM_RELATIVE) | 612 | if (field->flags & HID_MAIN_ITEM_RELATIVE) |
610 | map_rel(usage->hid & 0xf); | 613 | map_rel(usage->hid & 0xf); |
611 | else | 614 | else |
612 | map_abs(usage->hid & 0xf); | 615 | map_abs(usage->hid & 0xf); |
613 | break; | 616 | break; |
614 | 617 | ||
615 | case HID_GD_HATSWITCH: | 618 | case HID_GD_HATSWITCH: |
616 | usage->hat_min = field->logical_minimum; | 619 | usage->hat_min = field->logical_minimum; |
617 | usage->hat_max = field->logical_maximum; | 620 | usage->hat_max = field->logical_maximum; |
618 | map_abs(ABS_HAT0X); | 621 | map_abs(ABS_HAT0X); |
619 | break; | 622 | break; |
620 | 623 | ||
621 | case HID_GD_START: map_key_clear(BTN_START); break; | 624 | case HID_GD_START: map_key_clear(BTN_START); break; |
622 | case HID_GD_SELECT: map_key_clear(BTN_SELECT); break; | 625 | case HID_GD_SELECT: map_key_clear(BTN_SELECT); break; |
623 | 626 | ||
624 | default: goto unknown; | 627 | default: goto unknown; |
625 | } | 628 | } |
626 | 629 | ||
627 | break; | 630 | break; |
628 | 631 | ||
629 | case HID_UP_LED: | 632 | case HID_UP_LED: |
630 | switch (usage->hid & 0xffff) { /* HID-Value: */ | 633 | switch (usage->hid & 0xffff) { /* HID-Value: */ |
631 | case 0x01: map_led (LED_NUML); break; /* "Num Lock" */ | 634 | case 0x01: map_led (LED_NUML); break; /* "Num Lock" */ |
632 | case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */ | 635 | case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */ |
633 | case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */ | 636 | case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */ |
634 | case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */ | 637 | case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */ |
635 | case 0x05: map_led (LED_KANA); break; /* "Kana" */ | 638 | case 0x05: map_led (LED_KANA); break; /* "Kana" */ |
636 | case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */ | 639 | case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */ |
637 | case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */ | 640 | case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */ |
638 | case 0x09: map_led (LED_MUTE); break; /* "Mute" */ | 641 | case 0x09: map_led (LED_MUTE); break; /* "Mute" */ |
639 | case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */ | 642 | case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */ |
640 | case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */ | 643 | case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */ |
641 | case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */ | 644 | case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */ |
642 | 645 | ||
643 | default: goto ignore; | 646 | default: goto ignore; |
644 | } | 647 | } |
645 | break; | 648 | break; |
646 | 649 | ||
647 | case HID_UP_DIGITIZER: | 650 | case HID_UP_DIGITIZER: |
648 | switch (usage->hid & 0xff) { | 651 | switch (usage->hid & 0xff) { |
649 | case 0x00: /* Undefined */ | 652 | case 0x00: /* Undefined */ |
650 | goto ignore; | 653 | goto ignore; |
651 | 654 | ||
652 | case 0x30: /* TipPressure */ | 655 | case 0x30: /* TipPressure */ |
653 | if (!test_bit(BTN_TOUCH, input->keybit)) { | 656 | if (!test_bit(BTN_TOUCH, input->keybit)) { |
654 | device->quirks |= HID_QUIRK_NOTOUCH; | 657 | device->quirks |= HID_QUIRK_NOTOUCH; |
655 | set_bit(EV_KEY, input->evbit); | 658 | set_bit(EV_KEY, input->evbit); |
656 | set_bit(BTN_TOUCH, input->keybit); | 659 | set_bit(BTN_TOUCH, input->keybit); |
657 | } | 660 | } |
658 | map_abs_clear(ABS_PRESSURE); | 661 | map_abs_clear(ABS_PRESSURE); |
659 | break; | 662 | break; |
660 | 663 | ||
661 | case 0x32: /* InRange */ | 664 | case 0x32: /* InRange */ |
662 | switch (field->physical & 0xff) { | 665 | switch (field->physical & 0xff) { |
663 | case 0x21: map_key(BTN_TOOL_MOUSE); break; | 666 | case 0x21: map_key(BTN_TOOL_MOUSE); break; |
664 | case 0x22: map_key(BTN_TOOL_FINGER); break; | 667 | case 0x22: map_key(BTN_TOOL_FINGER); break; |
665 | default: map_key(BTN_TOOL_PEN); break; | 668 | default: map_key(BTN_TOOL_PEN); break; |
666 | } | 669 | } |
667 | break; | 670 | break; |
668 | 671 | ||
669 | case 0x3c: /* Invert */ | 672 | case 0x3c: /* Invert */ |
670 | map_key_clear(BTN_TOOL_RUBBER); | 673 | map_key_clear(BTN_TOOL_RUBBER); |
671 | break; | 674 | break; |
672 | 675 | ||
673 | case 0x3d: /* X Tilt */ | 676 | case 0x3d: /* X Tilt */ |
674 | map_abs_clear(ABS_TILT_X); | 677 | map_abs_clear(ABS_TILT_X); |
675 | break; | 678 | break; |
676 | 679 | ||
677 | case 0x3e: /* Y Tilt */ | 680 | case 0x3e: /* Y Tilt */ |
678 | map_abs_clear(ABS_TILT_Y); | 681 | map_abs_clear(ABS_TILT_Y); |
679 | break; | 682 | break; |
680 | 683 | ||
681 | case 0x33: /* Touch */ | 684 | case 0x33: /* Touch */ |
682 | case 0x42: /* TipSwitch */ | 685 | case 0x42: /* TipSwitch */ |
683 | case 0x43: /* TipSwitch2 */ | 686 | case 0x43: /* TipSwitch2 */ |
684 | device->quirks &= ~HID_QUIRK_NOTOUCH; | 687 | device->quirks &= ~HID_QUIRK_NOTOUCH; |
685 | map_key_clear(BTN_TOUCH); | 688 | map_key_clear(BTN_TOUCH); |
686 | break; | 689 | break; |
687 | 690 | ||
688 | case 0x44: /* BarrelSwitch */ | 691 | case 0x44: /* BarrelSwitch */ |
689 | map_key_clear(BTN_STYLUS); | 692 | map_key_clear(BTN_STYLUS); |
690 | break; | 693 | break; |
691 | 694 | ||
692 | case 0x46: /* TabletPick */ | 695 | case 0x46: /* TabletPick */ |
693 | case 0x5a: /* SecondaryBarrelSwitch */ | 696 | case 0x5a: /* SecondaryBarrelSwitch */ |
694 | map_key_clear(BTN_STYLUS2); | 697 | map_key_clear(BTN_STYLUS2); |
695 | break; | 698 | break; |
696 | 699 | ||
697 | case 0x5b: /* TransducerSerialNumber */ | 700 | case 0x5b: /* TransducerSerialNumber */ |
698 | usage->type = EV_MSC; | 701 | usage->type = EV_MSC; |
699 | usage->code = MSC_SERIAL; | 702 | usage->code = MSC_SERIAL; |
700 | bit = input->mscbit; | 703 | bit = input->mscbit; |
701 | max = MSC_MAX; | 704 | max = MSC_MAX; |
702 | break; | 705 | break; |
703 | 706 | ||
704 | default: goto unknown; | 707 | default: goto unknown; |
705 | } | 708 | } |
706 | break; | 709 | break; |
707 | 710 | ||
708 | case HID_UP_CONSUMER: /* USB HUT v1.12, pages 75-84 */ | 711 | case HID_UP_CONSUMER: /* USB HUT v1.12, pages 75-84 */ |
709 | switch (usage->hid & HID_USAGE) { | 712 | switch (usage->hid & HID_USAGE) { |
710 | case 0x000: goto ignore; | 713 | case 0x000: goto ignore; |
711 | case 0x030: map_key_clear(KEY_POWER); break; | 714 | case 0x030: map_key_clear(KEY_POWER); break; |
712 | case 0x031: map_key_clear(KEY_RESTART); break; | 715 | case 0x031: map_key_clear(KEY_RESTART); break; |
713 | case 0x032: map_key_clear(KEY_SLEEP); break; | 716 | case 0x032: map_key_clear(KEY_SLEEP); break; |
714 | case 0x034: map_key_clear(KEY_SLEEP); break; | 717 | case 0x034: map_key_clear(KEY_SLEEP); break; |
715 | case 0x035: map_key_clear(KEY_KBDILLUMTOGGLE); break; | 718 | case 0x035: map_key_clear(KEY_KBDILLUMTOGGLE); break; |
716 | case 0x036: map_key_clear(BTN_MISC); break; | 719 | case 0x036: map_key_clear(BTN_MISC); break; |
717 | 720 | ||
718 | case 0x040: map_key_clear(KEY_MENU); break; /* Menu */ | 721 | case 0x040: map_key_clear(KEY_MENU); break; /* Menu */ |
719 | case 0x041: map_key_clear(KEY_SELECT); break; /* Menu Pick */ | 722 | case 0x041: map_key_clear(KEY_SELECT); break; /* Menu Pick */ |
720 | case 0x042: map_key_clear(KEY_UP); break; /* Menu Up */ | 723 | case 0x042: map_key_clear(KEY_UP); break; /* Menu Up */ |
721 | case 0x043: map_key_clear(KEY_DOWN); break; /* Menu Down */ | 724 | case 0x043: map_key_clear(KEY_DOWN); break; /* Menu Down */ |
722 | case 0x044: map_key_clear(KEY_LEFT); break; /* Menu Left */ | 725 | case 0x044: map_key_clear(KEY_LEFT); break; /* Menu Left */ |
723 | case 0x045: map_key_clear(KEY_RIGHT); break; /* Menu Right */ | 726 | case 0x045: map_key_clear(KEY_RIGHT); break; /* Menu Right */ |
724 | case 0x046: map_key_clear(KEY_ESC); break; /* Menu Escape */ | 727 | case 0x046: map_key_clear(KEY_ESC); break; /* Menu Escape */ |
725 | case 0x047: map_key_clear(KEY_KPPLUS); break; /* Menu Value Increase */ | 728 | case 0x047: map_key_clear(KEY_KPPLUS); break; /* Menu Value Increase */ |
726 | case 0x048: map_key_clear(KEY_KPMINUS); break; /* Menu Value Decrease */ | 729 | case 0x048: map_key_clear(KEY_KPMINUS); break; /* Menu Value Decrease */ |
727 | 730 | ||
728 | case 0x060: map_key_clear(KEY_INFO); break; /* Data On Screen */ | 731 | case 0x060: map_key_clear(KEY_INFO); break; /* Data On Screen */ |
729 | case 0x061: map_key_clear(KEY_SUBTITLE); break; /* Closed Caption */ | 732 | case 0x061: map_key_clear(KEY_SUBTITLE); break; /* Closed Caption */ |
730 | case 0x063: map_key_clear(KEY_VCR); break; /* VCR/TV */ | 733 | case 0x063: map_key_clear(KEY_VCR); break; /* VCR/TV */ |
731 | case 0x065: map_key_clear(KEY_CAMERA); break; /* Snapshot */ | 734 | case 0x065: map_key_clear(KEY_CAMERA); break; /* Snapshot */ |
732 | case 0x069: map_key_clear(KEY_RED); break; | 735 | case 0x069: map_key_clear(KEY_RED); break; |
733 | case 0x06a: map_key_clear(KEY_GREEN); break; | 736 | case 0x06a: map_key_clear(KEY_GREEN); break; |
734 | case 0x06b: map_key_clear(KEY_BLUE); break; | 737 | case 0x06b: map_key_clear(KEY_BLUE); break; |
735 | case 0x06c: map_key_clear(KEY_YELLOW); break; | 738 | case 0x06c: map_key_clear(KEY_YELLOW); break; |
736 | case 0x06d: map_key_clear(KEY_ZOOM); break; | 739 | case 0x06d: map_key_clear(KEY_ZOOM); break; |
737 | 740 | ||
738 | case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; | 741 | case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; |
739 | case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; | 742 | case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; |
740 | case 0x072: map_key_clear(KEY_BRIGHTNESS_TOGGLE); break; | 743 | case 0x072: map_key_clear(KEY_BRIGHTNESS_TOGGLE); break; |
741 | case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN); break; | 744 | case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN); break; |
742 | case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; | 745 | case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; |
743 | case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; | 746 | case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; |
744 | 747 | ||
745 | case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; | 748 | case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; |
746 | case 0x083: map_key_clear(KEY_LAST); break; | 749 | case 0x083: map_key_clear(KEY_LAST); break; |
747 | case 0x084: map_key_clear(KEY_ENTER); break; | 750 | case 0x084: map_key_clear(KEY_ENTER); break; |
748 | case 0x088: map_key_clear(KEY_PC); break; | 751 | case 0x088: map_key_clear(KEY_PC); break; |
749 | case 0x089: map_key_clear(KEY_TV); break; | 752 | case 0x089: map_key_clear(KEY_TV); break; |
750 | case 0x08a: map_key_clear(KEY_WWW); break; | 753 | case 0x08a: map_key_clear(KEY_WWW); break; |
751 | case 0x08b: map_key_clear(KEY_DVD); break; | 754 | case 0x08b: map_key_clear(KEY_DVD); break; |
752 | case 0x08c: map_key_clear(KEY_PHONE); break; | 755 | case 0x08c: map_key_clear(KEY_PHONE); break; |
753 | case 0x08d: map_key_clear(KEY_PROGRAM); break; | 756 | case 0x08d: map_key_clear(KEY_PROGRAM); break; |
754 | case 0x08e: map_key_clear(KEY_VIDEOPHONE); break; | 757 | case 0x08e: map_key_clear(KEY_VIDEOPHONE); break; |
755 | case 0x08f: map_key_clear(KEY_GAMES); break; | 758 | case 0x08f: map_key_clear(KEY_GAMES); break; |
756 | case 0x090: map_key_clear(KEY_MEMO); break; | 759 | case 0x090: map_key_clear(KEY_MEMO); break; |
757 | case 0x091: map_key_clear(KEY_CD); break; | 760 | case 0x091: map_key_clear(KEY_CD); break; |
758 | case 0x092: map_key_clear(KEY_VCR); break; | 761 | case 0x092: map_key_clear(KEY_VCR); break; |
759 | case 0x093: map_key_clear(KEY_TUNER); break; | 762 | case 0x093: map_key_clear(KEY_TUNER); break; |
760 | case 0x094: map_key_clear(KEY_EXIT); break; | 763 | case 0x094: map_key_clear(KEY_EXIT); break; |
761 | case 0x095: map_key_clear(KEY_HELP); break; | 764 | case 0x095: map_key_clear(KEY_HELP); break; |
762 | case 0x096: map_key_clear(KEY_TAPE); break; | 765 | case 0x096: map_key_clear(KEY_TAPE); break; |
763 | case 0x097: map_key_clear(KEY_TV2); break; | 766 | case 0x097: map_key_clear(KEY_TV2); break; |
764 | case 0x098: map_key_clear(KEY_SAT); break; | 767 | case 0x098: map_key_clear(KEY_SAT); break; |
765 | case 0x09a: map_key_clear(KEY_PVR); break; | 768 | case 0x09a: map_key_clear(KEY_PVR); break; |
766 | 769 | ||
767 | case 0x09c: map_key_clear(KEY_CHANNELUP); break; | 770 | case 0x09c: map_key_clear(KEY_CHANNELUP); break; |
768 | case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; | 771 | case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; |
769 | case 0x0a0: map_key_clear(KEY_VCR2); break; | 772 | case 0x0a0: map_key_clear(KEY_VCR2); break; |
770 | 773 | ||
771 | case 0x0b0: map_key_clear(KEY_PLAY); break; | 774 | case 0x0b0: map_key_clear(KEY_PLAY); break; |
772 | case 0x0b1: map_key_clear(KEY_PAUSE); break; | 775 | case 0x0b1: map_key_clear(KEY_PAUSE); break; |
773 | case 0x0b2: map_key_clear(KEY_RECORD); break; | 776 | case 0x0b2: map_key_clear(KEY_RECORD); break; |
774 | case 0x0b3: map_key_clear(KEY_FASTFORWARD); break; | 777 | case 0x0b3: map_key_clear(KEY_FASTFORWARD); break; |
775 | case 0x0b4: map_key_clear(KEY_REWIND); break; | 778 | case 0x0b4: map_key_clear(KEY_REWIND); break; |
776 | case 0x0b5: map_key_clear(KEY_NEXTSONG); break; | 779 | case 0x0b5: map_key_clear(KEY_NEXTSONG); break; |
777 | case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break; | 780 | case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break; |
778 | case 0x0b7: map_key_clear(KEY_STOPCD); break; | 781 | case 0x0b7: map_key_clear(KEY_STOPCD); break; |
779 | case 0x0b8: map_key_clear(KEY_EJECTCD); break; | 782 | case 0x0b8: map_key_clear(KEY_EJECTCD); break; |
780 | case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break; | 783 | case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break; |
781 | case 0x0b9: map_key_clear(KEY_SHUFFLE); break; | 784 | case 0x0b9: map_key_clear(KEY_SHUFFLE); break; |
782 | case 0x0bf: map_key_clear(KEY_SLOW); break; | 785 | case 0x0bf: map_key_clear(KEY_SLOW); break; |
783 | 786 | ||
784 | case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; | 787 | case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; |
785 | case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; | 788 | case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; |
786 | case 0x0e0: map_abs_clear(ABS_VOLUME); break; | 789 | case 0x0e0: map_abs_clear(ABS_VOLUME); break; |
787 | case 0x0e2: map_key_clear(KEY_MUTE); break; | 790 | case 0x0e2: map_key_clear(KEY_MUTE); break; |
788 | case 0x0e5: map_key_clear(KEY_BASSBOOST); break; | 791 | case 0x0e5: map_key_clear(KEY_BASSBOOST); break; |
789 | case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; | 792 | case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; |
790 | case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; | 793 | case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; |
791 | case 0x0f5: map_key_clear(KEY_SLOW); break; | 794 | case 0x0f5: map_key_clear(KEY_SLOW); break; |
792 | 795 | ||
793 | case 0x181: map_key_clear(KEY_BUTTONCONFIG); break; | 796 | case 0x181: map_key_clear(KEY_BUTTONCONFIG); break; |
794 | case 0x182: map_key_clear(KEY_BOOKMARKS); break; | 797 | case 0x182: map_key_clear(KEY_BOOKMARKS); break; |
795 | case 0x183: map_key_clear(KEY_CONFIG); break; | 798 | case 0x183: map_key_clear(KEY_CONFIG); break; |
796 | case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; | 799 | case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; |
797 | case 0x185: map_key_clear(KEY_EDITOR); break; | 800 | case 0x185: map_key_clear(KEY_EDITOR); break; |
798 | case 0x186: map_key_clear(KEY_SPREADSHEET); break; | 801 | case 0x186: map_key_clear(KEY_SPREADSHEET); break; |
799 | case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break; | 802 | case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break; |
800 | case 0x188: map_key_clear(KEY_PRESENTATION); break; | 803 | case 0x188: map_key_clear(KEY_PRESENTATION); break; |
801 | case 0x189: map_key_clear(KEY_DATABASE); break; | 804 | case 0x189: map_key_clear(KEY_DATABASE); break; |
802 | case 0x18a: map_key_clear(KEY_MAIL); break; | 805 | case 0x18a: map_key_clear(KEY_MAIL); break; |
803 | case 0x18b: map_key_clear(KEY_NEWS); break; | 806 | case 0x18b: map_key_clear(KEY_NEWS); break; |
804 | case 0x18c: map_key_clear(KEY_VOICEMAIL); break; | 807 | case 0x18c: map_key_clear(KEY_VOICEMAIL); break; |
805 | case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break; | 808 | case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break; |
806 | case 0x18e: map_key_clear(KEY_CALENDAR); break; | 809 | case 0x18e: map_key_clear(KEY_CALENDAR); break; |
807 | case 0x18f: map_key_clear(KEY_TASKMANAGER); break; | 810 | case 0x18f: map_key_clear(KEY_TASKMANAGER); break; |
808 | case 0x190: map_key_clear(KEY_JOURNAL); break; | 811 | case 0x190: map_key_clear(KEY_JOURNAL); break; |
809 | case 0x191: map_key_clear(KEY_FINANCE); break; | 812 | case 0x191: map_key_clear(KEY_FINANCE); break; |
810 | case 0x192: map_key_clear(KEY_CALC); break; | 813 | case 0x192: map_key_clear(KEY_CALC); break; |
811 | case 0x193: map_key_clear(KEY_PLAYER); break; | 814 | case 0x193: map_key_clear(KEY_PLAYER); break; |
812 | case 0x194: map_key_clear(KEY_FILE); break; | 815 | case 0x194: map_key_clear(KEY_FILE); break; |
813 | case 0x196: map_key_clear(KEY_WWW); break; | 816 | case 0x196: map_key_clear(KEY_WWW); break; |
814 | case 0x199: map_key_clear(KEY_CHAT); break; | 817 | case 0x199: map_key_clear(KEY_CHAT); break; |
815 | case 0x19c: map_key_clear(KEY_LOGOFF); break; | 818 | case 0x19c: map_key_clear(KEY_LOGOFF); break; |
816 | case 0x19e: map_key_clear(KEY_COFFEE); break; | 819 | case 0x19e: map_key_clear(KEY_COFFEE); break; |
817 | case 0x19f: map_key_clear(KEY_CONTROLPANEL); break; | 820 | case 0x19f: map_key_clear(KEY_CONTROLPANEL); break; |
818 | case 0x1a2: map_key_clear(KEY_APPSELECT); break; | 821 | case 0x1a2: map_key_clear(KEY_APPSELECT); break; |
819 | case 0x1a3: map_key_clear(KEY_NEXT); break; | 822 | case 0x1a3: map_key_clear(KEY_NEXT); break; |
820 | case 0x1a4: map_key_clear(KEY_PREVIOUS); break; | 823 | case 0x1a4: map_key_clear(KEY_PREVIOUS); break; |
821 | case 0x1a6: map_key_clear(KEY_HELP); break; | 824 | case 0x1a6: map_key_clear(KEY_HELP); break; |
822 | case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; | 825 | case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; |
823 | case 0x1ab: map_key_clear(KEY_SPELLCHECK); break; | 826 | case 0x1ab: map_key_clear(KEY_SPELLCHECK); break; |
824 | case 0x1ae: map_key_clear(KEY_KEYBOARD); break; | 827 | case 0x1ae: map_key_clear(KEY_KEYBOARD); break; |
825 | case 0x1b1: map_key_clear(KEY_SCREENSAVER); break; | 828 | case 0x1b1: map_key_clear(KEY_SCREENSAVER); break; |
826 | case 0x1b4: map_key_clear(KEY_FILE); break; | 829 | case 0x1b4: map_key_clear(KEY_FILE); break; |
827 | case 0x1b6: map_key_clear(KEY_IMAGES); break; | 830 | case 0x1b6: map_key_clear(KEY_IMAGES); break; |
828 | case 0x1b7: map_key_clear(KEY_AUDIO); break; | 831 | case 0x1b7: map_key_clear(KEY_AUDIO); break; |
829 | case 0x1b8: map_key_clear(KEY_VIDEO); break; | 832 | case 0x1b8: map_key_clear(KEY_VIDEO); break; |
830 | case 0x1bc: map_key_clear(KEY_MESSENGER); break; | 833 | case 0x1bc: map_key_clear(KEY_MESSENGER); break; |
831 | case 0x1bd: map_key_clear(KEY_INFO); break; | 834 | case 0x1bd: map_key_clear(KEY_INFO); break; |
832 | case 0x201: map_key_clear(KEY_NEW); break; | 835 | case 0x201: map_key_clear(KEY_NEW); break; |
833 | case 0x202: map_key_clear(KEY_OPEN); break; | 836 | case 0x202: map_key_clear(KEY_OPEN); break; |
834 | case 0x203: map_key_clear(KEY_CLOSE); break; | 837 | case 0x203: map_key_clear(KEY_CLOSE); break; |
835 | case 0x204: map_key_clear(KEY_EXIT); break; | 838 | case 0x204: map_key_clear(KEY_EXIT); break; |
836 | case 0x207: map_key_clear(KEY_SAVE); break; | 839 | case 0x207: map_key_clear(KEY_SAVE); break; |
837 | case 0x208: map_key_clear(KEY_PRINT); break; | 840 | case 0x208: map_key_clear(KEY_PRINT); break; |
838 | case 0x209: map_key_clear(KEY_PROPS); break; | 841 | case 0x209: map_key_clear(KEY_PROPS); break; |
839 | case 0x21a: map_key_clear(KEY_UNDO); break; | 842 | case 0x21a: map_key_clear(KEY_UNDO); break; |
840 | case 0x21b: map_key_clear(KEY_COPY); break; | 843 | case 0x21b: map_key_clear(KEY_COPY); break; |
841 | case 0x21c: map_key_clear(KEY_CUT); break; | 844 | case 0x21c: map_key_clear(KEY_CUT); break; |
842 | case 0x21d: map_key_clear(KEY_PASTE); break; | 845 | case 0x21d: map_key_clear(KEY_PASTE); break; |
843 | case 0x21f: map_key_clear(KEY_FIND); break; | 846 | case 0x21f: map_key_clear(KEY_FIND); break; |
844 | case 0x221: map_key_clear(KEY_SEARCH); break; | 847 | case 0x221: map_key_clear(KEY_SEARCH); break; |
845 | case 0x222: map_key_clear(KEY_GOTO); break; | 848 | case 0x222: map_key_clear(KEY_GOTO); break; |
846 | case 0x223: map_key_clear(KEY_HOMEPAGE); break; | 849 | case 0x223: map_key_clear(KEY_HOMEPAGE); break; |
847 | case 0x224: map_key_clear(KEY_BACK); break; | 850 | case 0x224: map_key_clear(KEY_BACK); break; |
848 | case 0x225: map_key_clear(KEY_FORWARD); break; | 851 | case 0x225: map_key_clear(KEY_FORWARD); break; |
849 | case 0x226: map_key_clear(KEY_STOP); break; | 852 | case 0x226: map_key_clear(KEY_STOP); break; |
850 | case 0x227: map_key_clear(KEY_REFRESH); break; | 853 | case 0x227: map_key_clear(KEY_REFRESH); break; |
851 | case 0x22a: map_key_clear(KEY_BOOKMARKS); break; | 854 | case 0x22a: map_key_clear(KEY_BOOKMARKS); break; |
852 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; | 855 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; |
853 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; | 856 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; |
854 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; | 857 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; |
855 | case 0x233: map_key_clear(KEY_SCROLLUP); break; | 858 | case 0x233: map_key_clear(KEY_SCROLLUP); break; |
856 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; | 859 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; |
857 | case 0x238: map_rel(REL_HWHEEL); break; | 860 | case 0x238: map_rel(REL_HWHEEL); break; |
858 | case 0x23d: map_key_clear(KEY_EDIT); break; | 861 | case 0x23d: map_key_clear(KEY_EDIT); break; |
859 | case 0x25f: map_key_clear(KEY_CANCEL); break; | 862 | case 0x25f: map_key_clear(KEY_CANCEL); break; |
860 | case 0x269: map_key_clear(KEY_INSERT); break; | 863 | case 0x269: map_key_clear(KEY_INSERT); break; |
861 | case 0x26a: map_key_clear(KEY_DELETE); break; | 864 | case 0x26a: map_key_clear(KEY_DELETE); break; |
862 | case 0x279: map_key_clear(KEY_REDO); break; | 865 | case 0x279: map_key_clear(KEY_REDO); break; |
863 | 866 | ||
864 | case 0x289: map_key_clear(KEY_REPLY); break; | 867 | case 0x289: map_key_clear(KEY_REPLY); break; |
865 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; | 868 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; |
866 | case 0x28c: map_key_clear(KEY_SEND); break; | 869 | case 0x28c: map_key_clear(KEY_SEND); break; |
867 | 870 | ||
868 | case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; | 871 | case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; |
869 | case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; | 872 | case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; |
870 | case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; | 873 | case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; |
871 | case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break; | 874 | case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break; |
872 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; | 875 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; |
873 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; | 876 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; |
874 | 877 | ||
875 | default: map_key_clear(KEY_UNKNOWN); | 878 | default: map_key_clear(KEY_UNKNOWN); |
876 | } | 879 | } |
877 | break; | 880 | break; |
878 | 881 | ||
879 | case HID_UP_GENDEVCTRLS: | 882 | case HID_UP_GENDEVCTRLS: |
880 | if (hidinput_setup_battery(device, HID_INPUT_REPORT, field)) | 883 | if (hidinput_setup_battery(device, HID_INPUT_REPORT, field)) |
881 | goto ignore; | 884 | goto ignore; |
882 | else | 885 | else |
883 | goto unknown; | 886 | goto unknown; |
884 | break; | 887 | break; |
885 | 888 | ||
886 | case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ | 889 | case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ |
887 | set_bit(EV_REP, input->evbit); | 890 | set_bit(EV_REP, input->evbit); |
888 | switch (usage->hid & HID_USAGE) { | 891 | switch (usage->hid & HID_USAGE) { |
889 | case 0x021: map_key_clear(KEY_PRINT); break; | 892 | case 0x021: map_key_clear(KEY_PRINT); break; |
890 | case 0x070: map_key_clear(KEY_HP); break; | 893 | case 0x070: map_key_clear(KEY_HP); break; |
891 | case 0x071: map_key_clear(KEY_CAMERA); break; | 894 | case 0x071: map_key_clear(KEY_CAMERA); break; |
892 | case 0x072: map_key_clear(KEY_SOUND); break; | 895 | case 0x072: map_key_clear(KEY_SOUND); break; |
893 | case 0x073: map_key_clear(KEY_QUESTION); break; | 896 | case 0x073: map_key_clear(KEY_QUESTION); break; |
894 | case 0x080: map_key_clear(KEY_EMAIL); break; | 897 | case 0x080: map_key_clear(KEY_EMAIL); break; |
895 | case 0x081: map_key_clear(KEY_CHAT); break; | 898 | case 0x081: map_key_clear(KEY_CHAT); break; |
896 | case 0x082: map_key_clear(KEY_SEARCH); break; | 899 | case 0x082: map_key_clear(KEY_SEARCH); break; |
897 | case 0x083: map_key_clear(KEY_CONNECT); break; | 900 | case 0x083: map_key_clear(KEY_CONNECT); break; |
898 | case 0x084: map_key_clear(KEY_FINANCE); break; | 901 | case 0x084: map_key_clear(KEY_FINANCE); break; |
899 | case 0x085: map_key_clear(KEY_SPORT); break; | 902 | case 0x085: map_key_clear(KEY_SPORT); break; |
900 | case 0x086: map_key_clear(KEY_SHOP); break; | 903 | case 0x086: map_key_clear(KEY_SHOP); break; |
901 | default: goto ignore; | 904 | default: goto ignore; |
902 | } | 905 | } |
903 | break; | 906 | break; |
904 | 907 | ||
905 | case HID_UP_HPVENDOR2: | 908 | case HID_UP_HPVENDOR2: |
906 | set_bit(EV_REP, input->evbit); | 909 | set_bit(EV_REP, input->evbit); |
907 | switch (usage->hid & HID_USAGE) { | 910 | switch (usage->hid & HID_USAGE) { |
908 | case 0x003: map_key_clear(KEY_BRIGHTNESSDOWN); break; | 911 | case 0x003: map_key_clear(KEY_BRIGHTNESSDOWN); break; |
909 | case 0x004: map_key_clear(KEY_BRIGHTNESSUP); break; | 912 | case 0x004: map_key_clear(KEY_BRIGHTNESSUP); break; |
910 | default: goto ignore; | 913 | default: goto ignore; |
911 | } | 914 | } |
912 | break; | 915 | break; |
913 | 916 | ||
914 | case HID_UP_MSVENDOR: | 917 | case HID_UP_MSVENDOR: |
915 | goto ignore; | 918 | goto ignore; |
916 | 919 | ||
917 | case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ | 920 | case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ |
918 | set_bit(EV_REP, input->evbit); | 921 | set_bit(EV_REP, input->evbit); |
919 | goto ignore; | 922 | goto ignore; |
920 | 923 | ||
921 | case HID_UP_LOGIVENDOR: | 924 | case HID_UP_LOGIVENDOR: |
922 | goto ignore; | 925 | goto ignore; |
923 | 926 | ||
924 | case HID_UP_PID: | 927 | case HID_UP_PID: |
925 | switch (usage->hid & HID_USAGE) { | 928 | switch (usage->hid & HID_USAGE) { |
926 | case 0xa4: map_key_clear(BTN_DEAD); break; | 929 | case 0xa4: map_key_clear(BTN_DEAD); break; |
927 | default: goto ignore; | 930 | default: goto ignore; |
928 | } | 931 | } |
929 | break; | 932 | break; |
930 | 933 | ||
931 | default: | 934 | default: |
932 | unknown: | 935 | unknown: |
933 | if (field->report_size == 1) { | 936 | if (field->report_size == 1) { |
934 | if (field->report->type == HID_OUTPUT_REPORT) { | 937 | if (field->report->type == HID_OUTPUT_REPORT) { |
935 | map_led(LED_MISC); | 938 | map_led(LED_MISC); |
936 | break; | 939 | break; |
937 | } | 940 | } |
938 | map_key(BTN_MISC); | 941 | map_key(BTN_MISC); |
939 | break; | 942 | break; |
940 | } | 943 | } |
941 | if (field->flags & HID_MAIN_ITEM_RELATIVE) { | 944 | if (field->flags & HID_MAIN_ITEM_RELATIVE) { |
942 | map_rel(REL_MISC); | 945 | map_rel(REL_MISC); |
943 | break; | 946 | break; |
944 | } | 947 | } |
945 | map_abs(ABS_MISC); | 948 | map_abs(ABS_MISC); |
946 | break; | 949 | break; |
947 | } | 950 | } |
948 | 951 | ||
949 | mapped: | 952 | mapped: |
950 | if (device->driver->input_mapped && device->driver->input_mapped(device, | 953 | if (device->driver->input_mapped && device->driver->input_mapped(device, |
951 | hidinput, field, usage, &bit, &max) < 0) | 954 | hidinput, field, usage, &bit, &max) < 0) |
952 | goto ignore; | 955 | goto ignore; |
953 | 956 | ||
954 | set_bit(usage->type, input->evbit); | 957 | set_bit(usage->type, input->evbit); |
955 | 958 | ||
956 | while (usage->code <= max && test_and_set_bit(usage->code, bit)) | 959 | while (usage->code <= max && test_and_set_bit(usage->code, bit)) |
957 | usage->code = find_next_zero_bit(bit, max + 1, usage->code); | 960 | usage->code = find_next_zero_bit(bit, max + 1, usage->code); |
958 | 961 | ||
959 | if (usage->code > max) | 962 | if (usage->code > max) |
960 | goto ignore; | 963 | goto ignore; |
961 | 964 | ||
962 | 965 | ||
963 | if (usage->type == EV_ABS) { | 966 | if (usage->type == EV_ABS) { |
964 | 967 | ||
965 | int a = field->logical_minimum; | 968 | int a = field->logical_minimum; |
966 | int b = field->logical_maximum; | 969 | int b = field->logical_maximum; |
967 | 970 | ||
968 | if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) { | 971 | if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) { |
969 | a = field->logical_minimum = 0; | 972 | a = field->logical_minimum = 0; |
970 | b = field->logical_maximum = 255; | 973 | b = field->logical_maximum = 255; |
971 | } | 974 | } |
972 | 975 | ||
973 | if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) | 976 | if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) |
974 | input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); | 977 | input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); |
975 | else input_set_abs_params(input, usage->code, a, b, 0, 0); | 978 | else input_set_abs_params(input, usage->code, a, b, 0, 0); |
976 | 979 | ||
977 | input_abs_set_res(input, usage->code, | 980 | input_abs_set_res(input, usage->code, |
978 | hidinput_calc_abs_res(field, usage->code)); | 981 | hidinput_calc_abs_res(field, usage->code)); |
979 | 982 | ||
980 | /* use a larger default input buffer for MT devices */ | 983 | /* use a larger default input buffer for MT devices */ |
981 | if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) | 984 | if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) |
982 | input_set_events_per_packet(input, 60); | 985 | input_set_events_per_packet(input, 60); |
983 | } | 986 | } |
984 | 987 | ||
985 | if (usage->type == EV_ABS && | 988 | if (usage->type == EV_ABS && |
986 | (usage->hat_min < usage->hat_max || usage->hat_dir)) { | 989 | (usage->hat_min < usage->hat_max || usage->hat_dir)) { |
987 | int i; | 990 | int i; |
988 | for (i = usage->code; i < usage->code + 2 && i <= max; i++) { | 991 | for (i = usage->code; i < usage->code + 2 && i <= max; i++) { |
989 | input_set_abs_params(input, i, -1, 1, 0, 0); | 992 | input_set_abs_params(input, i, -1, 1, 0, 0); |
990 | set_bit(i, input->absbit); | 993 | set_bit(i, input->absbit); |
991 | } | 994 | } |
992 | if (usage->hat_dir && !field->dpad) | 995 | if (usage->hat_dir && !field->dpad) |
993 | field->dpad = usage->code; | 996 | field->dpad = usage->code; |
994 | } | 997 | } |
995 | 998 | ||
996 | /* for those devices which produce Consumer volume usage as relative, | 999 | /* for those devices which produce Consumer volume usage as relative, |
997 | * we emulate pressing volumeup/volumedown appropriate number of times | 1000 | * we emulate pressing volumeup/volumedown appropriate number of times |
998 | * in hidinput_hid_event() | 1001 | * in hidinput_hid_event() |
999 | */ | 1002 | */ |
1000 | if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && | 1003 | if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && |
1001 | (usage->code == ABS_VOLUME)) { | 1004 | (usage->code == ABS_VOLUME)) { |
1002 | set_bit(KEY_VOLUMEUP, input->keybit); | 1005 | set_bit(KEY_VOLUMEUP, input->keybit); |
1003 | set_bit(KEY_VOLUMEDOWN, input->keybit); | 1006 | set_bit(KEY_VOLUMEDOWN, input->keybit); |
1004 | } | 1007 | } |
1005 | 1008 | ||
1006 | if (usage->type == EV_KEY) { | 1009 | if (usage->type == EV_KEY) { |
1007 | set_bit(EV_MSC, input->evbit); | 1010 | set_bit(EV_MSC, input->evbit); |
1008 | set_bit(MSC_SCAN, input->mscbit); | 1011 | set_bit(MSC_SCAN, input->mscbit); |
1009 | } | 1012 | } |
1010 | 1013 | ||
1011 | ignore: | 1014 | ignore: |
1012 | return; | 1015 | return; |
1013 | 1016 | ||
1014 | } | 1017 | } |
1015 | 1018 | ||
1016 | void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) | 1019 | void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) |
1017 | { | 1020 | { |
1018 | struct input_dev *input; | 1021 | struct input_dev *input; |
1019 | unsigned *quirks = &hid->quirks; | 1022 | unsigned *quirks = &hid->quirks; |
1020 | 1023 | ||
1021 | if (!field->hidinput) | 1024 | if (!field->hidinput) |
1022 | return; | 1025 | return; |
1023 | 1026 | ||
1024 | input = field->hidinput->input; | 1027 | input = field->hidinput->input; |
1025 | 1028 | ||
1026 | if (!usage->type) | 1029 | if (!usage->type) |
1027 | return; | 1030 | return; |
1028 | 1031 | ||
1029 | if (usage->hat_min < usage->hat_max || usage->hat_dir) { | 1032 | if (usage->hat_min < usage->hat_max || usage->hat_dir) { |
1030 | int hat_dir = usage->hat_dir; | 1033 | int hat_dir = usage->hat_dir; |
1031 | if (!hat_dir) | 1034 | if (!hat_dir) |
1032 | hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; | 1035 | hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; |
1033 | if (hat_dir < 0 || hat_dir > 8) hat_dir = 0; | 1036 | if (hat_dir < 0 || hat_dir > 8) hat_dir = 0; |
1034 | input_event(input, usage->type, usage->code , hid_hat_to_axis[hat_dir].x); | 1037 | input_event(input, usage->type, usage->code , hid_hat_to_axis[hat_dir].x); |
1035 | input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y); | 1038 | input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y); |
1036 | return; | 1039 | return; |
1037 | } | 1040 | } |
1038 | 1041 | ||
1039 | if (usage->hid == (HID_UP_DIGITIZER | 0x003c)) { /* Invert */ | 1042 | if (usage->hid == (HID_UP_DIGITIZER | 0x003c)) { /* Invert */ |
1040 | *quirks = value ? (*quirks | HID_QUIRK_INVERT) : (*quirks & ~HID_QUIRK_INVERT); | 1043 | *quirks = value ? (*quirks | HID_QUIRK_INVERT) : (*quirks & ~HID_QUIRK_INVERT); |
1041 | return; | 1044 | return; |
1042 | } | 1045 | } |
1043 | 1046 | ||
1044 | if (usage->hid == (HID_UP_DIGITIZER | 0x0032)) { /* InRange */ | 1047 | if (usage->hid == (HID_UP_DIGITIZER | 0x0032)) { /* InRange */ |
1045 | if (value) { | 1048 | if (value) { |
1046 | input_event(input, usage->type, (*quirks & HID_QUIRK_INVERT) ? BTN_TOOL_RUBBER : usage->code, 1); | 1049 | input_event(input, usage->type, (*quirks & HID_QUIRK_INVERT) ? BTN_TOOL_RUBBER : usage->code, 1); |
1047 | return; | 1050 | return; |
1048 | } | 1051 | } |
1049 | input_event(input, usage->type, usage->code, 0); | 1052 | input_event(input, usage->type, usage->code, 0); |
1050 | input_event(input, usage->type, BTN_TOOL_RUBBER, 0); | 1053 | input_event(input, usage->type, BTN_TOOL_RUBBER, 0); |
1051 | return; | 1054 | return; |
1052 | } | 1055 | } |
1053 | 1056 | ||
1054 | if (usage->hid == (HID_UP_DIGITIZER | 0x0030) && (*quirks & HID_QUIRK_NOTOUCH)) { /* Pressure */ | 1057 | if (usage->hid == (HID_UP_DIGITIZER | 0x0030) && (*quirks & HID_QUIRK_NOTOUCH)) { /* Pressure */ |
1055 | int a = field->logical_minimum; | 1058 | int a = field->logical_minimum; |
1056 | int b = field->logical_maximum; | 1059 | int b = field->logical_maximum; |
1057 | input_event(input, EV_KEY, BTN_TOUCH, value > a + ((b - a) >> 3)); | 1060 | input_event(input, EV_KEY, BTN_TOUCH, value > a + ((b - a) >> 3)); |
1058 | } | 1061 | } |
1059 | 1062 | ||
1060 | if (usage->hid == (HID_UP_PID | 0x83UL)) { /* Simultaneous Effects Max */ | 1063 | if (usage->hid == (HID_UP_PID | 0x83UL)) { /* Simultaneous Effects Max */ |
1061 | dbg_hid("Maximum Effects - %d\n",value); | 1064 | dbg_hid("Maximum Effects - %d\n",value); |
1062 | return; | 1065 | return; |
1063 | } | 1066 | } |
1064 | 1067 | ||
1065 | if (usage->hid == (HID_UP_PID | 0x7fUL)) { | 1068 | if (usage->hid == (HID_UP_PID | 0x7fUL)) { |
1066 | dbg_hid("PID Pool Report\n"); | 1069 | dbg_hid("PID Pool Report\n"); |
1067 | return; | 1070 | return; |
1068 | } | 1071 | } |
1069 | 1072 | ||
1070 | if ((usage->type == EV_KEY) && (usage->code == 0)) /* Key 0 is "unassigned", not KEY_UNKNOWN */ | 1073 | if ((usage->type == EV_KEY) && (usage->code == 0)) /* Key 0 is "unassigned", not KEY_UNKNOWN */ |
1071 | return; | 1074 | return; |
1072 | 1075 | ||
1073 | if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && | 1076 | if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && |
1074 | (usage->code == ABS_VOLUME)) { | 1077 | (usage->code == ABS_VOLUME)) { |
1075 | int count = abs(value); | 1078 | int count = abs(value); |
1076 | int direction = value > 0 ? KEY_VOLUMEUP : KEY_VOLUMEDOWN; | 1079 | int direction = value > 0 ? KEY_VOLUMEUP : KEY_VOLUMEDOWN; |
1077 | int i; | 1080 | int i; |
1078 | 1081 | ||
1079 | for (i = 0; i < count; i++) { | 1082 | for (i = 0; i < count; i++) { |
1080 | input_event(input, EV_KEY, direction, 1); | 1083 | input_event(input, EV_KEY, direction, 1); |
1081 | input_sync(input); | 1084 | input_sync(input); |
1082 | input_event(input, EV_KEY, direction, 0); | 1085 | input_event(input, EV_KEY, direction, 0); |
1083 | input_sync(input); | 1086 | input_sync(input); |
1084 | } | 1087 | } |
1085 | return; | 1088 | return; |
1086 | } | 1089 | } |
1087 | 1090 | ||
1088 | /* | 1091 | /* |
1089 | * Ignore out-of-range values as per HID specification, | 1092 | * Ignore out-of-range values as per HID specification, |
1090 | * section 5.10 and 6.2.25. | 1093 | * section 5.10 and 6.2.25. |
1091 | * | 1094 | * |
1092 | * The logical_minimum < logical_maximum check is done so that we | 1095 | * The logical_minimum < logical_maximum check is done so that we |
1093 | * don't unintentionally discard values sent by devices which | 1096 | * don't unintentionally discard values sent by devices which |
1094 | * don't specify logical min and max. | 1097 | * don't specify logical min and max. |
1095 | */ | 1098 | */ |
1096 | if ((field->flags & HID_MAIN_ITEM_VARIABLE) && | 1099 | if ((field->flags & HID_MAIN_ITEM_VARIABLE) && |
1097 | (field->logical_minimum < field->logical_maximum) && | 1100 | (field->logical_minimum < field->logical_maximum) && |
1098 | (value < field->logical_minimum || | 1101 | (value < field->logical_minimum || |
1099 | value > field->logical_maximum)) { | 1102 | value > field->logical_maximum)) { |
1100 | dbg_hid("Ignoring out-of-range value %x\n", value); | 1103 | dbg_hid("Ignoring out-of-range value %x\n", value); |
1101 | return; | 1104 | return; |
1102 | } | 1105 | } |
1103 | 1106 | ||
1104 | /* report the usage code as scancode if the key status has changed */ | 1107 | /* report the usage code as scancode if the key status has changed */ |
1105 | if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value) | 1108 | if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value) |
1106 | input_event(input, EV_MSC, MSC_SCAN, usage->hid); | 1109 | input_event(input, EV_MSC, MSC_SCAN, usage->hid); |
1107 | 1110 | ||
1108 | input_event(input, usage->type, usage->code, value); | 1111 | input_event(input, usage->type, usage->code, value); |
1109 | 1112 | ||
1110 | if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY)) | 1113 | if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY)) |
1111 | input_event(input, usage->type, usage->code, 0); | 1114 | input_event(input, usage->type, usage->code, 0); |
1112 | } | 1115 | } |
1113 | 1116 | ||
1114 | void hidinput_report_event(struct hid_device *hid, struct hid_report *report) | 1117 | void hidinput_report_event(struct hid_device *hid, struct hid_report *report) |
1115 | { | 1118 | { |
1116 | struct hid_input *hidinput; | 1119 | struct hid_input *hidinput; |
1117 | 1120 | ||
1118 | if (hid->quirks & HID_QUIRK_NO_INPUT_SYNC) | 1121 | if (hid->quirks & HID_QUIRK_NO_INPUT_SYNC) |
1119 | return; | 1122 | return; |
1120 | 1123 | ||
1121 | list_for_each_entry(hidinput, &hid->inputs, list) | 1124 | list_for_each_entry(hidinput, &hid->inputs, list) |
1122 | input_sync(hidinput->input); | 1125 | input_sync(hidinput->input); |
1123 | } | 1126 | } |
1124 | EXPORT_SYMBOL_GPL(hidinput_report_event); | 1127 | EXPORT_SYMBOL_GPL(hidinput_report_event); |
1125 | 1128 | ||
1126 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field) | 1129 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field) |
1127 | { | 1130 | { |
1128 | struct hid_report *report; | 1131 | struct hid_report *report; |
1129 | int i, j; | 1132 | int i, j; |
1130 | 1133 | ||
1131 | list_for_each_entry(report, &hid->report_enum[HID_OUTPUT_REPORT].report_list, list) { | 1134 | list_for_each_entry(report, &hid->report_enum[HID_OUTPUT_REPORT].report_list, list) { |
1132 | for (i = 0; i < report->maxfield; i++) { | 1135 | for (i = 0; i < report->maxfield; i++) { |
1133 | *field = report->field[i]; | 1136 | *field = report->field[i]; |
1134 | for (j = 0; j < (*field)->maxusage; j++) | 1137 | for (j = 0; j < (*field)->maxusage; j++) |
1135 | if ((*field)->usage[j].type == type && (*field)->usage[j].code == code) | 1138 | if ((*field)->usage[j].type == type && (*field)->usage[j].code == code) |
1136 | return j; | 1139 | return j; |
1137 | } | 1140 | } |
1138 | } | 1141 | } |
1139 | return -1; | 1142 | return -1; |
1140 | } | 1143 | } |
1141 | EXPORT_SYMBOL_GPL(hidinput_find_field); | 1144 | EXPORT_SYMBOL_GPL(hidinput_find_field); |
1142 | 1145 | ||
1143 | struct hid_field *hidinput_get_led_field(struct hid_device *hid) | 1146 | struct hid_field *hidinput_get_led_field(struct hid_device *hid) |
1144 | { | 1147 | { |
1145 | struct hid_report *report; | 1148 | struct hid_report *report; |
1146 | struct hid_field *field; | 1149 | struct hid_field *field; |
1147 | int i, j; | 1150 | int i, j; |
1148 | 1151 | ||
1149 | list_for_each_entry(report, | 1152 | list_for_each_entry(report, |
1150 | &hid->report_enum[HID_OUTPUT_REPORT].report_list, | 1153 | &hid->report_enum[HID_OUTPUT_REPORT].report_list, |
1151 | list) { | 1154 | list) { |
1152 | for (i = 0; i < report->maxfield; i++) { | 1155 | for (i = 0; i < report->maxfield; i++) { |
1153 | field = report->field[i]; | 1156 | field = report->field[i]; |
1154 | for (j = 0; j < field->maxusage; j++) | 1157 | for (j = 0; j < field->maxusage; j++) |
1155 | if (field->usage[j].type == EV_LED) | 1158 | if (field->usage[j].type == EV_LED) |
1156 | return field; | 1159 | return field; |
1157 | } | 1160 | } |
1158 | } | 1161 | } |
1159 | return NULL; | 1162 | return NULL; |
1160 | } | 1163 | } |
1161 | EXPORT_SYMBOL_GPL(hidinput_get_led_field); | 1164 | EXPORT_SYMBOL_GPL(hidinput_get_led_field); |
1162 | 1165 | ||
1163 | unsigned int hidinput_count_leds(struct hid_device *hid) | 1166 | unsigned int hidinput_count_leds(struct hid_device *hid) |
1164 | { | 1167 | { |
1165 | struct hid_report *report; | 1168 | struct hid_report *report; |
1166 | struct hid_field *field; | 1169 | struct hid_field *field; |
1167 | int i, j; | 1170 | int i, j; |
1168 | unsigned int count = 0; | 1171 | unsigned int count = 0; |
1169 | 1172 | ||
1170 | list_for_each_entry(report, | 1173 | list_for_each_entry(report, |
1171 | &hid->report_enum[HID_OUTPUT_REPORT].report_list, | 1174 | &hid->report_enum[HID_OUTPUT_REPORT].report_list, |
1172 | list) { | 1175 | list) { |
1173 | for (i = 0; i < report->maxfield; i++) { | 1176 | for (i = 0; i < report->maxfield; i++) { |
1174 | field = report->field[i]; | 1177 | field = report->field[i]; |
1175 | for (j = 0; j < field->maxusage; j++) | 1178 | for (j = 0; j < field->maxusage; j++) |
1176 | if (field->usage[j].type == EV_LED && | 1179 | if (field->usage[j].type == EV_LED && |
1177 | field->value[j]) | 1180 | field->value[j]) |
1178 | count += 1; | 1181 | count += 1; |
1179 | } | 1182 | } |
1180 | } | 1183 | } |
1181 | return count; | 1184 | return count; |
1182 | } | 1185 | } |
1183 | EXPORT_SYMBOL_GPL(hidinput_count_leds); | 1186 | EXPORT_SYMBOL_GPL(hidinput_count_leds); |
1184 | 1187 | ||
1185 | static void hidinput_led_worker(struct work_struct *work) | 1188 | static void hidinput_led_worker(struct work_struct *work) |
1186 | { | 1189 | { |
1187 | struct hid_device *hid = container_of(work, struct hid_device, | 1190 | struct hid_device *hid = container_of(work, struct hid_device, |
1188 | led_work); | 1191 | led_work); |
1189 | struct hid_field *field; | 1192 | struct hid_field *field; |
1190 | struct hid_report *report; | 1193 | struct hid_report *report; |
1191 | int len, ret; | 1194 | int len, ret; |
1192 | __u8 *buf; | 1195 | __u8 *buf; |
1193 | 1196 | ||
1194 | field = hidinput_get_led_field(hid); | 1197 | field = hidinput_get_led_field(hid); |
1195 | if (!field) | 1198 | if (!field) |
1196 | return; | 1199 | return; |
1197 | 1200 | ||
1198 | /* | 1201 | /* |
1199 | * field->report is accessed unlocked regarding HID core. So there might | 1202 | * field->report is accessed unlocked regarding HID core. So there might |
1200 | * be another incoming SET-LED request from user-space, which changes | 1203 | * be another incoming SET-LED request from user-space, which changes |
1201 | * the LED state while we assemble our outgoing buffer. However, this | 1204 | * the LED state while we assemble our outgoing buffer. However, this |
1202 | * doesn't matter as hid_output_report() correctly converts it into a | 1205 | * doesn't matter as hid_output_report() correctly converts it into a |
1203 | * boolean value no matter what information is currently set on the LED | 1206 | * boolean value no matter what information is currently set on the LED |
1204 | * field (even garbage). So the remote device will always get a valid | 1207 | * field (even garbage). So the remote device will always get a valid |
1205 | * request. | 1208 | * request. |
1206 | * And in case we send a wrong value, a next led worker is spawned | 1209 | * And in case we send a wrong value, a next led worker is spawned |
1207 | * for every SET-LED request so the following worker will send the | 1210 | * for every SET-LED request so the following worker will send the |
1208 | * correct value, guaranteed! | 1211 | * correct value, guaranteed! |
1209 | */ | 1212 | */ |
1210 | 1213 | ||
1211 | report = field->report; | 1214 | report = field->report; |
1212 | 1215 | ||
1213 | /* use custom SET_REPORT request if possible (asynchronous) */ | 1216 | /* use custom SET_REPORT request if possible (asynchronous) */ |
1214 | if (hid->ll_driver->request) | 1217 | if (hid->ll_driver->request) |
1215 | return hid->ll_driver->request(hid, report, HID_REQ_SET_REPORT); | 1218 | return hid->ll_driver->request(hid, report, HID_REQ_SET_REPORT); |
1216 | 1219 | ||
1217 | /* fall back to generic raw-output-report */ | 1220 | /* fall back to generic raw-output-report */ |
1218 | len = hid_report_len(report); | 1221 | len = hid_report_len(report); |
1219 | buf = hid_alloc_report_buf(report, GFP_KERNEL); | 1222 | buf = hid_alloc_report_buf(report, GFP_KERNEL); |
1220 | if (!buf) | 1223 | if (!buf) |
1221 | return; | 1224 | return; |
1222 | 1225 | ||
1223 | hid_output_report(report, buf); | 1226 | hid_output_report(report, buf); |
1224 | /* synchronous output report */ | 1227 | /* synchronous output report */ |
1225 | ret = hid_hw_output_report(hid, buf, len); | 1228 | ret = hid_hw_output_report(hid, buf, len); |
1226 | if (ret == -ENOSYS) | 1229 | if (ret == -ENOSYS) |
1227 | hid_hw_raw_request(hid, report->id, buf, len, HID_OUTPUT_REPORT, | 1230 | hid_hw_raw_request(hid, report->id, buf, len, HID_OUTPUT_REPORT, |
1228 | HID_REQ_SET_REPORT); | 1231 | HID_REQ_SET_REPORT); |
1229 | kfree(buf); | 1232 | kfree(buf); |
1230 | } | 1233 | } |
1231 | 1234 | ||
1232 | static int hidinput_input_event(struct input_dev *dev, unsigned int type, | 1235 | static int hidinput_input_event(struct input_dev *dev, unsigned int type, |
1233 | unsigned int code, int value) | 1236 | unsigned int code, int value) |
1234 | { | 1237 | { |
1235 | struct hid_device *hid = input_get_drvdata(dev); | 1238 | struct hid_device *hid = input_get_drvdata(dev); |
1236 | struct hid_field *field; | 1239 | struct hid_field *field; |
1237 | int offset; | 1240 | int offset; |
1238 | 1241 | ||
1239 | if (type == EV_FF) | 1242 | if (type == EV_FF) |
1240 | return input_ff_event(dev, type, code, value); | 1243 | return input_ff_event(dev, type, code, value); |
1241 | 1244 | ||
1242 | if (type != EV_LED) | 1245 | if (type != EV_LED) |
1243 | return -1; | 1246 | return -1; |
1244 | 1247 | ||
1245 | if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) { | 1248 | if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) { |
1246 | hid_warn(dev, "event field not found\n"); | 1249 | hid_warn(dev, "event field not found\n"); |
1247 | return -1; | 1250 | return -1; |
1248 | } | 1251 | } |
1249 | 1252 | ||
1250 | hid_set_field(field, offset, value); | 1253 | hid_set_field(field, offset, value); |
1251 | 1254 | ||
1252 | schedule_work(&hid->led_work); | 1255 | schedule_work(&hid->led_work); |
1253 | return 0; | 1256 | return 0; |
1254 | } | 1257 | } |
1255 | 1258 | ||
1256 | static int hidinput_open(struct input_dev *dev) | 1259 | static int hidinput_open(struct input_dev *dev) |
1257 | { | 1260 | { |
1258 | struct hid_device *hid = input_get_drvdata(dev); | 1261 | struct hid_device *hid = input_get_drvdata(dev); |
1259 | 1262 | ||
1260 | return hid_hw_open(hid); | 1263 | return hid_hw_open(hid); |
1261 | } | 1264 | } |
1262 | 1265 | ||
1263 | static void hidinput_close(struct input_dev *dev) | 1266 | static void hidinput_close(struct input_dev *dev) |
1264 | { | 1267 | { |
1265 | struct hid_device *hid = input_get_drvdata(dev); | 1268 | struct hid_device *hid = input_get_drvdata(dev); |
1266 | 1269 | ||
1267 | hid_hw_close(hid); | 1270 | hid_hw_close(hid); |
1268 | } | 1271 | } |
1269 | 1272 | ||
1270 | static void report_features(struct hid_device *hid) | 1273 | static void report_features(struct hid_device *hid) |
1271 | { | 1274 | { |
1272 | struct hid_driver *drv = hid->driver; | 1275 | struct hid_driver *drv = hid->driver; |
1273 | struct hid_report_enum *rep_enum; | 1276 | struct hid_report_enum *rep_enum; |
1274 | struct hid_report *rep; | 1277 | struct hid_report *rep; |
1275 | int i, j; | 1278 | int i, j; |
1276 | 1279 | ||
1277 | rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; | 1280 | rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; |
1278 | list_for_each_entry(rep, &rep_enum->report_list, list) | 1281 | list_for_each_entry(rep, &rep_enum->report_list, list) |
1279 | for (i = 0; i < rep->maxfield; i++) { | 1282 | for (i = 0; i < rep->maxfield; i++) { |
1280 | /* Ignore if report count is out of bounds. */ | 1283 | /* Ignore if report count is out of bounds. */ |
1281 | if (rep->field[i]->report_count < 1) | 1284 | if (rep->field[i]->report_count < 1) |
1282 | continue; | 1285 | continue; |
1283 | 1286 | ||
1284 | for (j = 0; j < rep->field[i]->maxusage; j++) { | 1287 | for (j = 0; j < rep->field[i]->maxusage; j++) { |
1285 | /* Verify if Battery Strength feature is available */ | 1288 | /* Verify if Battery Strength feature is available */ |
1286 | hidinput_setup_battery(hid, HID_FEATURE_REPORT, rep->field[i]); | 1289 | hidinput_setup_battery(hid, HID_FEATURE_REPORT, rep->field[i]); |
1287 | 1290 | ||
1288 | if (drv->feature_mapping) | 1291 | if (drv->feature_mapping) |
1289 | drv->feature_mapping(hid, rep->field[i], | 1292 | drv->feature_mapping(hid, rep->field[i], |
1290 | rep->field[i]->usage + j); | 1293 | rep->field[i]->usage + j); |
1291 | } | 1294 | } |
1292 | } | 1295 | } |
1293 | } | 1296 | } |
1294 | 1297 | ||
1295 | static struct hid_input *hidinput_allocate(struct hid_device *hid) | 1298 | static struct hid_input *hidinput_allocate(struct hid_device *hid) |
1296 | { | 1299 | { |
1297 | struct hid_input *hidinput = kzalloc(sizeof(*hidinput), GFP_KERNEL); | 1300 | struct hid_input *hidinput = kzalloc(sizeof(*hidinput), GFP_KERNEL); |
1298 | struct input_dev *input_dev = input_allocate_device(); | 1301 | struct input_dev *input_dev = input_allocate_device(); |
1299 | if (!hidinput || !input_dev) { | 1302 | if (!hidinput || !input_dev) { |
1300 | kfree(hidinput); | 1303 | kfree(hidinput); |
1301 | input_free_device(input_dev); | 1304 | input_free_device(input_dev); |
1302 | hid_err(hid, "Out of memory during hid input probe\n"); | 1305 | hid_err(hid, "Out of memory during hid input probe\n"); |
1303 | return NULL; | 1306 | return NULL; |
1304 | } | 1307 | } |
1305 | 1308 | ||
1306 | input_set_drvdata(input_dev, hid); | 1309 | input_set_drvdata(input_dev, hid); |
1307 | input_dev->event = hidinput_input_event; | 1310 | input_dev->event = hidinput_input_event; |
1308 | input_dev->open = hidinput_open; | 1311 | input_dev->open = hidinput_open; |
1309 | input_dev->close = hidinput_close; | 1312 | input_dev->close = hidinput_close; |
1310 | input_dev->setkeycode = hidinput_setkeycode; | 1313 | input_dev->setkeycode = hidinput_setkeycode; |
1311 | input_dev->getkeycode = hidinput_getkeycode; | 1314 | input_dev->getkeycode = hidinput_getkeycode; |
1312 | 1315 | ||
1313 | input_dev->name = hid->name; | 1316 | input_dev->name = hid->name; |
1314 | input_dev->phys = hid->phys; | 1317 | input_dev->phys = hid->phys; |
1315 | input_dev->uniq = hid->uniq; | 1318 | input_dev->uniq = hid->uniq; |
1316 | input_dev->id.bustype = hid->bus; | 1319 | input_dev->id.bustype = hid->bus; |
1317 | input_dev->id.vendor = hid->vendor; | 1320 | input_dev->id.vendor = hid->vendor; |
1318 | input_dev->id.product = hid->product; | 1321 | input_dev->id.product = hid->product; |
1319 | input_dev->id.version = hid->version; | 1322 | input_dev->id.version = hid->version; |
1320 | input_dev->dev.parent = &hid->dev; | 1323 | input_dev->dev.parent = &hid->dev; |
1321 | hidinput->input = input_dev; | 1324 | hidinput->input = input_dev; |
1322 | list_add_tail(&hidinput->list, &hid->inputs); | 1325 | list_add_tail(&hidinput->list, &hid->inputs); |
1323 | 1326 | ||
1324 | return hidinput; | 1327 | return hidinput; |
1325 | } | 1328 | } |
1326 | 1329 | ||
1327 | static bool hidinput_has_been_populated(struct hid_input *hidinput) | 1330 | static bool hidinput_has_been_populated(struct hid_input *hidinput) |
1328 | { | 1331 | { |
1329 | int i; | 1332 | int i; |
1330 | unsigned long r = 0; | 1333 | unsigned long r = 0; |
1331 | 1334 | ||
1332 | for (i = 0; i < BITS_TO_LONGS(EV_CNT); i++) | 1335 | for (i = 0; i < BITS_TO_LONGS(EV_CNT); i++) |
1333 | r |= hidinput->input->evbit[i]; | 1336 | r |= hidinput->input->evbit[i]; |
1334 | 1337 | ||
1335 | for (i = 0; i < BITS_TO_LONGS(KEY_CNT); i++) | 1338 | for (i = 0; i < BITS_TO_LONGS(KEY_CNT); i++) |
1336 | r |= hidinput->input->keybit[i]; | 1339 | r |= hidinput->input->keybit[i]; |
1337 | 1340 | ||
1338 | for (i = 0; i < BITS_TO_LONGS(REL_CNT); i++) | 1341 | for (i = 0; i < BITS_TO_LONGS(REL_CNT); i++) |
1339 | r |= hidinput->input->relbit[i]; | 1342 | r |= hidinput->input->relbit[i]; |
1340 | 1343 | ||
1341 | for (i = 0; i < BITS_TO_LONGS(ABS_CNT); i++) | 1344 | for (i = 0; i < BITS_TO_LONGS(ABS_CNT); i++) |
1342 | r |= hidinput->input->absbit[i]; | 1345 | r |= hidinput->input->absbit[i]; |
1343 | 1346 | ||
1344 | for (i = 0; i < BITS_TO_LONGS(MSC_CNT); i++) | 1347 | for (i = 0; i < BITS_TO_LONGS(MSC_CNT); i++) |
1345 | r |= hidinput->input->mscbit[i]; | 1348 | r |= hidinput->input->mscbit[i]; |
1346 | 1349 | ||
1347 | for (i = 0; i < BITS_TO_LONGS(LED_CNT); i++) | 1350 | for (i = 0; i < BITS_TO_LONGS(LED_CNT); i++) |
1348 | r |= hidinput->input->ledbit[i]; | 1351 | r |= hidinput->input->ledbit[i]; |
1349 | 1352 | ||
1350 | for (i = 0; i < BITS_TO_LONGS(SND_CNT); i++) | 1353 | for (i = 0; i < BITS_TO_LONGS(SND_CNT); i++) |
1351 | r |= hidinput->input->sndbit[i]; | 1354 | r |= hidinput->input->sndbit[i]; |
1352 | 1355 | ||
1353 | for (i = 0; i < BITS_TO_LONGS(FF_CNT); i++) | 1356 | for (i = 0; i < BITS_TO_LONGS(FF_CNT); i++) |
1354 | r |= hidinput->input->ffbit[i]; | 1357 | r |= hidinput->input->ffbit[i]; |
1355 | 1358 | ||
1356 | for (i = 0; i < BITS_TO_LONGS(SW_CNT); i++) | 1359 | for (i = 0; i < BITS_TO_LONGS(SW_CNT); i++) |
1357 | r |= hidinput->input->swbit[i]; | 1360 | r |= hidinput->input->swbit[i]; |
1358 | 1361 | ||
1359 | return !!r; | 1362 | return !!r; |
1360 | } | 1363 | } |
1361 | 1364 | ||
1362 | static void hidinput_cleanup_hidinput(struct hid_device *hid, | 1365 | static void hidinput_cleanup_hidinput(struct hid_device *hid, |
1363 | struct hid_input *hidinput) | 1366 | struct hid_input *hidinput) |
1364 | { | 1367 | { |
1365 | struct hid_report *report; | 1368 | struct hid_report *report; |
1366 | int i, k; | 1369 | int i, k; |
1367 | 1370 | ||
1368 | list_del(&hidinput->list); | 1371 | list_del(&hidinput->list); |
1369 | input_free_device(hidinput->input); | 1372 | input_free_device(hidinput->input); |
1370 | 1373 | ||
1371 | for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { | 1374 | for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { |
1372 | if (k == HID_OUTPUT_REPORT && | 1375 | if (k == HID_OUTPUT_REPORT && |
1373 | hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) | 1376 | hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) |
1374 | continue; | 1377 | continue; |
1375 | 1378 | ||
1376 | list_for_each_entry(report, &hid->report_enum[k].report_list, | 1379 | list_for_each_entry(report, &hid->report_enum[k].report_list, |
1377 | list) { | 1380 | list) { |
1378 | 1381 | ||
1379 | for (i = 0; i < report->maxfield; i++) | 1382 | for (i = 0; i < report->maxfield; i++) |
1380 | if (report->field[i]->hidinput == hidinput) | 1383 | if (report->field[i]->hidinput == hidinput) |
1381 | report->field[i]->hidinput = NULL; | 1384 | report->field[i]->hidinput = NULL; |
1382 | } | 1385 | } |
1383 | } | 1386 | } |
1384 | 1387 | ||
1385 | kfree(hidinput); | 1388 | kfree(hidinput); |
1386 | } | 1389 | } |
1387 | 1390 | ||
1388 | /* | 1391 | /* |
1389 | * Register the input device; print a message. | 1392 | * Register the input device; print a message. |
1390 | * Configure the input layer interface | 1393 | * Configure the input layer interface |
1391 | * Read all reports and initialize the absolute field values. | 1394 | * Read all reports and initialize the absolute field values. |
1392 | */ | 1395 | */ |
1393 | 1396 | ||
1394 | int hidinput_connect(struct hid_device *hid, unsigned int force) | 1397 | int hidinput_connect(struct hid_device *hid, unsigned int force) |
1395 | { | 1398 | { |
1396 | struct hid_driver *drv = hid->driver; | 1399 | struct hid_driver *drv = hid->driver; |
1397 | struct hid_report *report; | 1400 | struct hid_report *report; |
1398 | struct hid_input *hidinput = NULL; | 1401 | struct hid_input *hidinput = NULL; |
1399 | int i, j, k; | 1402 | int i, j, k; |
1400 | 1403 | ||
1401 | INIT_LIST_HEAD(&hid->inputs); | 1404 | INIT_LIST_HEAD(&hid->inputs); |
1402 | INIT_WORK(&hid->led_work, hidinput_led_worker); | 1405 | INIT_WORK(&hid->led_work, hidinput_led_worker); |
1403 | 1406 | ||
1404 | if (!force) { | 1407 | if (!force) { |
1405 | for (i = 0; i < hid->maxcollection; i++) { | 1408 | for (i = 0; i < hid->maxcollection; i++) { |
1406 | struct hid_collection *col = &hid->collection[i]; | 1409 | struct hid_collection *col = &hid->collection[i]; |
1407 | if (col->type == HID_COLLECTION_APPLICATION || | 1410 | if (col->type == HID_COLLECTION_APPLICATION || |
1408 | col->type == HID_COLLECTION_PHYSICAL) | 1411 | col->type == HID_COLLECTION_PHYSICAL) |
1409 | if (IS_INPUT_APPLICATION(col->usage)) | 1412 | if (IS_INPUT_APPLICATION(col->usage)) |
1410 | break; | 1413 | break; |
1411 | } | 1414 | } |
1412 | 1415 | ||
1413 | if (i == hid->maxcollection) | 1416 | if (i == hid->maxcollection) |
1414 | return -1; | 1417 | return -1; |
1415 | } | 1418 | } |
1416 | 1419 | ||
1417 | report_features(hid); | 1420 | report_features(hid); |
1418 | 1421 | ||
1419 | for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { | 1422 | for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { |
1420 | if (k == HID_OUTPUT_REPORT && | 1423 | if (k == HID_OUTPUT_REPORT && |
1421 | hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) | 1424 | hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) |
1422 | continue; | 1425 | continue; |
1423 | 1426 | ||
1424 | list_for_each_entry(report, &hid->report_enum[k].report_list, list) { | 1427 | list_for_each_entry(report, &hid->report_enum[k].report_list, list) { |
1425 | 1428 | ||
1426 | if (!report->maxfield) | 1429 | if (!report->maxfield) |
1427 | continue; | 1430 | continue; |
1428 | 1431 | ||
1429 | if (!hidinput) { | 1432 | if (!hidinput) { |
1430 | hidinput = hidinput_allocate(hid); | 1433 | hidinput = hidinput_allocate(hid); |
1431 | if (!hidinput) | 1434 | if (!hidinput) |
1432 | goto out_unwind; | 1435 | goto out_unwind; |
1433 | } | 1436 | } |
1434 | 1437 | ||
1435 | for (i = 0; i < report->maxfield; i++) | 1438 | for (i = 0; i < report->maxfield; i++) |
1436 | for (j = 0; j < report->field[i]->maxusage; j++) | 1439 | for (j = 0; j < report->field[i]->maxusage; j++) |
1437 | hidinput_configure_usage(hidinput, report->field[i], | 1440 | hidinput_configure_usage(hidinput, report->field[i], |
1438 | report->field[i]->usage + j); | 1441 | report->field[i]->usage + j); |
1439 | 1442 | ||
1440 | if ((hid->quirks & HID_QUIRK_NO_EMPTY_INPUT) && | 1443 | if ((hid->quirks & HID_QUIRK_NO_EMPTY_INPUT) && |
1441 | !hidinput_has_been_populated(hidinput)) | 1444 | !hidinput_has_been_populated(hidinput)) |
1442 | continue; | 1445 | continue; |
1443 | 1446 | ||
1444 | if (hid->quirks & HID_QUIRK_MULTI_INPUT) { | 1447 | if (hid->quirks & HID_QUIRK_MULTI_INPUT) { |
1445 | /* This will leave hidinput NULL, so that it | 1448 | /* This will leave hidinput NULL, so that it |
1446 | * allocates another one if we have more inputs on | 1449 | * allocates another one if we have more inputs on |
1447 | * the same interface. Some devices (e.g. Happ's | 1450 | * the same interface. Some devices (e.g. Happ's |
1448 | * UGCI) cram a lot of unrelated inputs into the | 1451 | * UGCI) cram a lot of unrelated inputs into the |
1449 | * same interface. */ | 1452 | * same interface. */ |
1450 | hidinput->report = report; | 1453 | hidinput->report = report; |
1451 | if (drv->input_configured) | 1454 | if (drv->input_configured) |
1452 | drv->input_configured(hid, hidinput); | 1455 | drv->input_configured(hid, hidinput); |
1453 | if (input_register_device(hidinput->input)) | 1456 | if (input_register_device(hidinput->input)) |
1454 | goto out_cleanup; | 1457 | goto out_cleanup; |
1455 | hidinput = NULL; | 1458 | hidinput = NULL; |
1456 | } | 1459 | } |
1457 | } | 1460 | } |
1458 | } | 1461 | } |
1459 | 1462 | ||
1460 | if (hidinput && (hid->quirks & HID_QUIRK_NO_EMPTY_INPUT) && | 1463 | if (hidinput && (hid->quirks & HID_QUIRK_NO_EMPTY_INPUT) && |
1461 | !hidinput_has_been_populated(hidinput)) { | 1464 | !hidinput_has_been_populated(hidinput)) { |
1462 | /* no need to register an input device not populated */ | 1465 | /* no need to register an input device not populated */ |
1463 | hidinput_cleanup_hidinput(hid, hidinput); | 1466 | hidinput_cleanup_hidinput(hid, hidinput); |
1464 | hidinput = NULL; | 1467 | hidinput = NULL; |
1465 | } | 1468 | } |
1466 | 1469 | ||
1467 | if (list_empty(&hid->inputs)) { | 1470 | if (list_empty(&hid->inputs)) { |
1468 | hid_err(hid, "No inputs registered, leaving\n"); | 1471 | hid_err(hid, "No inputs registered, leaving\n"); |
1469 | goto out_unwind; | 1472 | goto out_unwind; |
1470 | } | 1473 | } |
1471 | 1474 | ||
1472 | if (hidinput) { | 1475 | if (hidinput) { |
1473 | if (drv->input_configured) | 1476 | if (drv->input_configured) |
1474 | drv->input_configured(hid, hidinput); | 1477 | drv->input_configured(hid, hidinput); |
1475 | if (input_register_device(hidinput->input)) | 1478 | if (input_register_device(hidinput->input)) |
1476 | goto out_cleanup; | 1479 | goto out_cleanup; |
1477 | } | 1480 | } |
1478 | 1481 | ||
1479 | return 0; | 1482 | return 0; |
1480 | 1483 | ||
1481 | out_cleanup: | 1484 | out_cleanup: |
1482 | list_del(&hidinput->list); | 1485 | list_del(&hidinput->list); |
1483 | input_free_device(hidinput->input); | 1486 | input_free_device(hidinput->input); |
1484 | kfree(hidinput); | 1487 | kfree(hidinput); |
1485 | out_unwind: | 1488 | out_unwind: |
1486 | /* unwind the ones we already registered */ | 1489 | /* unwind the ones we already registered */ |
1487 | hidinput_disconnect(hid); | 1490 | hidinput_disconnect(hid); |
1488 | 1491 | ||
1489 | return -1; | 1492 | return -1; |
1490 | } | 1493 | } |
1491 | EXPORT_SYMBOL_GPL(hidinput_connect); | 1494 | EXPORT_SYMBOL_GPL(hidinput_connect); |
1492 | 1495 | ||
1493 | void hidinput_disconnect(struct hid_device *hid) | 1496 | void hidinput_disconnect(struct hid_device *hid) |
1494 | { | 1497 | { |
1495 | struct hid_input *hidinput, *next; | 1498 | struct hid_input *hidinput, *next; |
1496 | 1499 | ||
1497 | hidinput_cleanup_battery(hid); | 1500 | hidinput_cleanup_battery(hid); |
1498 | 1501 | ||
1499 | list_for_each_entry_safe(hidinput, next, &hid->inputs, list) { | 1502 | list_for_each_entry_safe(hidinput, next, &hid->inputs, list) { |
1500 | list_del(&hidinput->list); | 1503 | list_del(&hidinput->list); |
1501 | input_unregister_device(hidinput->input); | 1504 | input_unregister_device(hidinput->input); |
1502 | kfree(hidinput); | 1505 | kfree(hidinput); |
1503 | } | 1506 | } |
1504 | 1507 | ||
1505 | /* led_work is spawned by input_dev callbacks, but doesn't access the | 1508 | /* led_work is spawned by input_dev callbacks, but doesn't access the |
1506 | * parent input_dev at all. Once all input devices are removed, we | 1509 | * parent input_dev at all. Once all input devices are removed, we |
1507 | * know that led_work will never get restarted, so we can cancel it | 1510 | * know that led_work will never get restarted, so we can cancel it |
1508 | * synchronously and are safe. */ | 1511 | * synchronously and are safe. */ |
1509 | cancel_work_sync(&hid->led_work); | 1512 | cancel_work_sync(&hid->led_work); |
1510 | } | 1513 | } |
1511 | EXPORT_SYMBOL_GPL(hidinput_disconnect); | 1514 | EXPORT_SYMBOL_GPL(hidinput_disconnect); |
1512 | 1515 | ||
1513 | 1516 |
drivers/hid/hid-kye.c
1 | /* | 1 | /* |
2 | * HID driver for Kye/Genius devices not fully compliant with HID standard | 2 | * HID driver for Kye/Genius devices not fully compliant with HID standard |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Jiri Kosina | 4 | * Copyright (c) 2009 Jiri Kosina |
5 | * Copyright (c) 2009 Tomas Hanak | 5 | * Copyright (c) 2009 Tomas Hanak |
6 | * Copyright (c) 2012 Nikolai Kondrashov | 6 | * Copyright (c) 2012 Nikolai Kondrashov |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * This program is free software; you can redistribute it and/or modify it | 10 | * This program is free software; you can redistribute it and/or modify it |
11 | * under the terms of the GNU General Public License as published by the Free | 11 | * under the terms of the GNU General Public License as published by the Free |
12 | * Software Foundation; either version 2 of the License, or (at your option) | 12 | * Software Foundation; either version 2 of the License, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/hid.h> | 17 | #include <linux/hid.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | 19 | ||
20 | #include "hid-ids.h" | 20 | #include "hid-ids.h" |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * See EasyPen i405X description, device and HID report descriptors at | 23 | * See EasyPen i405X description, device and HID report descriptors at |
24 | * http://sf.net/apps/mediawiki/digimend/?title=KYE_EasyPen_i405X | 24 | * http://sf.net/apps/mediawiki/digimend/?title=KYE_EasyPen_i405X |
25 | */ | 25 | */ |
26 | 26 | ||
27 | /* Original EasyPen i405X report descriptor size */ | 27 | /* Original EasyPen i405X report descriptor size */ |
28 | #define EASYPEN_I405X_RDESC_ORIG_SIZE 476 | 28 | #define EASYPEN_I405X_RDESC_ORIG_SIZE 476 |
29 | 29 | ||
30 | /* Fixed EasyPen i405X report descriptor */ | 30 | /* Fixed EasyPen i405X report descriptor */ |
31 | static __u8 easypen_i405x_rdesc_fixed[] = { | 31 | static __u8 easypen_i405x_rdesc_fixed[] = { |
32 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ | 32 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
33 | 0x09, 0x01, /* Usage (01h), */ | 33 | 0x09, 0x01, /* Usage (01h), */ |
34 | 0xA1, 0x01, /* Collection (Application), */ | 34 | 0xA1, 0x01, /* Collection (Application), */ |
35 | 0x85, 0x05, /* Report ID (5), */ | 35 | 0x85, 0x05, /* Report ID (5), */ |
36 | 0x09, 0x01, /* Usage (01h), */ | 36 | 0x09, 0x01, /* Usage (01h), */ |
37 | 0x15, 0x80, /* Logical Minimum (-128), */ | 37 | 0x15, 0x80, /* Logical Minimum (-128), */ |
38 | 0x25, 0x7F, /* Logical Maximum (127), */ | 38 | 0x25, 0x7F, /* Logical Maximum (127), */ |
39 | 0x75, 0x08, /* Report Size (8), */ | 39 | 0x75, 0x08, /* Report Size (8), */ |
40 | 0x95, 0x07, /* Report Count (7), */ | 40 | 0x95, 0x07, /* Report Count (7), */ |
41 | 0xB1, 0x02, /* Feature (Variable), */ | 41 | 0xB1, 0x02, /* Feature (Variable), */ |
42 | 0xC0, /* End Collection, */ | 42 | 0xC0, /* End Collection, */ |
43 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | 43 | 0x05, 0x0D, /* Usage Page (Digitizer), */ |
44 | 0x09, 0x02, /* Usage (Pen), */ | 44 | 0x09, 0x02, /* Usage (Pen), */ |
45 | 0xA1, 0x01, /* Collection (Application), */ | 45 | 0xA1, 0x01, /* Collection (Application), */ |
46 | 0x85, 0x10, /* Report ID (16), */ | 46 | 0x85, 0x10, /* Report ID (16), */ |
47 | 0x09, 0x20, /* Usage (Stylus), */ | 47 | 0x09, 0x20, /* Usage (Stylus), */ |
48 | 0xA0, /* Collection (Physical), */ | 48 | 0xA0, /* Collection (Physical), */ |
49 | 0x14, /* Logical Minimum (0), */ | 49 | 0x14, /* Logical Minimum (0), */ |
50 | 0x25, 0x01, /* Logical Maximum (1), */ | 50 | 0x25, 0x01, /* Logical Maximum (1), */ |
51 | 0x75, 0x01, /* Report Size (1), */ | 51 | 0x75, 0x01, /* Report Size (1), */ |
52 | 0x09, 0x42, /* Usage (Tip Switch), */ | 52 | 0x09, 0x42, /* Usage (Tip Switch), */ |
53 | 0x09, 0x44, /* Usage (Barrel Switch), */ | 53 | 0x09, 0x44, /* Usage (Barrel Switch), */ |
54 | 0x09, 0x46, /* Usage (Tablet Pick), */ | 54 | 0x09, 0x46, /* Usage (Tablet Pick), */ |
55 | 0x95, 0x03, /* Report Count (3), */ | 55 | 0x95, 0x03, /* Report Count (3), */ |
56 | 0x81, 0x02, /* Input (Variable), */ | 56 | 0x81, 0x02, /* Input (Variable), */ |
57 | 0x95, 0x04, /* Report Count (4), */ | 57 | 0x95, 0x04, /* Report Count (4), */ |
58 | 0x81, 0x03, /* Input (Constant, Variable), */ | 58 | 0x81, 0x03, /* Input (Constant, Variable), */ |
59 | 0x09, 0x32, /* Usage (In Range), */ | 59 | 0x09, 0x32, /* Usage (In Range), */ |
60 | 0x95, 0x01, /* Report Count (1), */ | 60 | 0x95, 0x01, /* Report Count (1), */ |
61 | 0x81, 0x02, /* Input (Variable), */ | 61 | 0x81, 0x02, /* Input (Variable), */ |
62 | 0x75, 0x10, /* Report Size (16), */ | 62 | 0x75, 0x10, /* Report Size (16), */ |
63 | 0x95, 0x01, /* Report Count (1), */ | 63 | 0x95, 0x01, /* Report Count (1), */ |
64 | 0xA4, /* Push, */ | 64 | 0xA4, /* Push, */ |
65 | 0x05, 0x01, /* Usage Page (Desktop), */ | 65 | 0x05, 0x01, /* Usage Page (Desktop), */ |
66 | 0x55, 0xFD, /* Unit Exponent (-3), */ | 66 | 0x55, 0xFD, /* Unit Exponent (-3), */ |
67 | 0x65, 0x13, /* Unit (Inch), */ | 67 | 0x65, 0x13, /* Unit (Inch), */ |
68 | 0x34, /* Physical Minimum (0), */ | 68 | 0x34, /* Physical Minimum (0), */ |
69 | 0x09, 0x30, /* Usage (X), */ | 69 | 0x09, 0x30, /* Usage (X), */ |
70 | 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */ | 70 | 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */ |
71 | 0x26, 0x00, 0x37, /* Logical Maximum (14080), */ | 71 | 0x26, 0x00, 0x37, /* Logical Maximum (14080), */ |
72 | 0x81, 0x02, /* Input (Variable), */ | 72 | 0x81, 0x02, /* Input (Variable), */ |
73 | 0x09, 0x31, /* Usage (Y), */ | 73 | 0x09, 0x31, /* Usage (Y), */ |
74 | 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */ | 74 | 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */ |
75 | 0x26, 0x00, 0x28, /* Logical Maximum (10240), */ | 75 | 0x26, 0x00, 0x28, /* Logical Maximum (10240), */ |
76 | 0x81, 0x02, /* Input (Variable), */ | 76 | 0x81, 0x02, /* Input (Variable), */ |
77 | 0xB4, /* Pop, */ | 77 | 0xB4, /* Pop, */ |
78 | 0x09, 0x30, /* Usage (Tip Pressure), */ | 78 | 0x09, 0x30, /* Usage (Tip Pressure), */ |
79 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | 79 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
80 | 0x81, 0x02, /* Input (Variable), */ | 80 | 0x81, 0x02, /* Input (Variable), */ |
81 | 0xC0, /* End Collection, */ | 81 | 0xC0, /* End Collection, */ |
82 | 0xC0 /* End Collection */ | 82 | 0xC0 /* End Collection */ |
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* | 85 | /* |
86 | * See MousePen i608X description, device and HID report descriptors at | 86 | * See MousePen i608X description, device and HID report descriptors at |
87 | * http://sf.net/apps/mediawiki/digimend/?title=KYE_MousePen_i608X | 87 | * http://sf.net/apps/mediawiki/digimend/?title=KYE_MousePen_i608X |
88 | */ | 88 | */ |
89 | 89 | ||
90 | /* Original MousePen i608X report descriptor size */ | 90 | /* Original MousePen i608X report descriptor size */ |
91 | #define MOUSEPEN_I608X_RDESC_ORIG_SIZE 476 | 91 | #define MOUSEPEN_I608X_RDESC_ORIG_SIZE 476 |
92 | 92 | ||
93 | /* Fixed MousePen i608X report descriptor */ | 93 | /* Fixed MousePen i608X report descriptor */ |
94 | static __u8 mousepen_i608x_rdesc_fixed[] = { | 94 | static __u8 mousepen_i608x_rdesc_fixed[] = { |
95 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ | 95 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
96 | 0x09, 0x01, /* Usage (01h), */ | 96 | 0x09, 0x01, /* Usage (01h), */ |
97 | 0xA1, 0x01, /* Collection (Application), */ | 97 | 0xA1, 0x01, /* Collection (Application), */ |
98 | 0x85, 0x05, /* Report ID (5), */ | 98 | 0x85, 0x05, /* Report ID (5), */ |
99 | 0x09, 0x01, /* Usage (01h), */ | 99 | 0x09, 0x01, /* Usage (01h), */ |
100 | 0x15, 0x80, /* Logical Minimum (-128), */ | 100 | 0x15, 0x80, /* Logical Minimum (-128), */ |
101 | 0x25, 0x7F, /* Logical Maximum (127), */ | 101 | 0x25, 0x7F, /* Logical Maximum (127), */ |
102 | 0x75, 0x08, /* Report Size (8), */ | 102 | 0x75, 0x08, /* Report Size (8), */ |
103 | 0x95, 0x07, /* Report Count (7), */ | 103 | 0x95, 0x07, /* Report Count (7), */ |
104 | 0xB1, 0x02, /* Feature (Variable), */ | 104 | 0xB1, 0x02, /* Feature (Variable), */ |
105 | 0xC0, /* End Collection, */ | 105 | 0xC0, /* End Collection, */ |
106 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | 106 | 0x05, 0x0D, /* Usage Page (Digitizer), */ |
107 | 0x09, 0x02, /* Usage (Pen), */ | 107 | 0x09, 0x02, /* Usage (Pen), */ |
108 | 0xA1, 0x01, /* Collection (Application), */ | 108 | 0xA1, 0x01, /* Collection (Application), */ |
109 | 0x85, 0x10, /* Report ID (16), */ | 109 | 0x85, 0x10, /* Report ID (16), */ |
110 | 0x09, 0x20, /* Usage (Stylus), */ | 110 | 0x09, 0x20, /* Usage (Stylus), */ |
111 | 0xA0, /* Collection (Physical), */ | 111 | 0xA0, /* Collection (Physical), */ |
112 | 0x14, /* Logical Minimum (0), */ | 112 | 0x14, /* Logical Minimum (0), */ |
113 | 0x25, 0x01, /* Logical Maximum (1), */ | 113 | 0x25, 0x01, /* Logical Maximum (1), */ |
114 | 0x75, 0x01, /* Report Size (1), */ | 114 | 0x75, 0x01, /* Report Size (1), */ |
115 | 0x09, 0x42, /* Usage (Tip Switch), */ | 115 | 0x09, 0x42, /* Usage (Tip Switch), */ |
116 | 0x09, 0x44, /* Usage (Barrel Switch), */ | 116 | 0x09, 0x44, /* Usage (Barrel Switch), */ |
117 | 0x09, 0x46, /* Usage (Tablet Pick), */ | 117 | 0x09, 0x46, /* Usage (Tablet Pick), */ |
118 | 0x95, 0x03, /* Report Count (3), */ | 118 | 0x95, 0x03, /* Report Count (3), */ |
119 | 0x81, 0x02, /* Input (Variable), */ | 119 | 0x81, 0x02, /* Input (Variable), */ |
120 | 0x95, 0x04, /* Report Count (4), */ | 120 | 0x95, 0x04, /* Report Count (4), */ |
121 | 0x81, 0x03, /* Input (Constant, Variable), */ | 121 | 0x81, 0x03, /* Input (Constant, Variable), */ |
122 | 0x09, 0x32, /* Usage (In Range), */ | 122 | 0x09, 0x32, /* Usage (In Range), */ |
123 | 0x95, 0x01, /* Report Count (1), */ | 123 | 0x95, 0x01, /* Report Count (1), */ |
124 | 0x81, 0x02, /* Input (Variable), */ | 124 | 0x81, 0x02, /* Input (Variable), */ |
125 | 0x75, 0x10, /* Report Size (16), */ | 125 | 0x75, 0x10, /* Report Size (16), */ |
126 | 0x95, 0x01, /* Report Count (1), */ | 126 | 0x95, 0x01, /* Report Count (1), */ |
127 | 0xA4, /* Push, */ | 127 | 0xA4, /* Push, */ |
128 | 0x05, 0x01, /* Usage Page (Desktop), */ | 128 | 0x05, 0x01, /* Usage Page (Desktop), */ |
129 | 0x55, 0xFD, /* Unit Exponent (-3), */ | 129 | 0x55, 0xFD, /* Unit Exponent (-3), */ |
130 | 0x65, 0x13, /* Unit (Inch), */ | 130 | 0x65, 0x13, /* Unit (Inch), */ |
131 | 0x34, /* Physical Minimum (0), */ | 131 | 0x34, /* Physical Minimum (0), */ |
132 | 0x09, 0x30, /* Usage (X), */ | 132 | 0x09, 0x30, /* Usage (X), */ |
133 | 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ | 133 | 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ |
134 | 0x26, 0x00, 0x50, /* Logical Maximum (20480), */ | 134 | 0x26, 0x00, 0x50, /* Logical Maximum (20480), */ |
135 | 0x81, 0x02, /* Input (Variable), */ | 135 | 0x81, 0x02, /* Input (Variable), */ |
136 | 0x09, 0x31, /* Usage (Y), */ | 136 | 0x09, 0x31, /* Usage (Y), */ |
137 | 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ | 137 | 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ |
138 | 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ | 138 | 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ |
139 | 0x81, 0x02, /* Input (Variable), */ | 139 | 0x81, 0x02, /* Input (Variable), */ |
140 | 0xB4, /* Pop, */ | 140 | 0xB4, /* Pop, */ |
141 | 0x09, 0x30, /* Usage (Tip Pressure), */ | 141 | 0x09, 0x30, /* Usage (Tip Pressure), */ |
142 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | 142 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
143 | 0x81, 0x02, /* Input (Variable), */ | 143 | 0x81, 0x02, /* Input (Variable), */ |
144 | 0xC0, /* End Collection, */ | 144 | 0xC0, /* End Collection, */ |
145 | 0xC0, /* End Collection, */ | 145 | 0xC0, /* End Collection, */ |
146 | 0x05, 0x01, /* Usage Page (Desktop), */ | 146 | 0x05, 0x01, /* Usage Page (Desktop), */ |
147 | 0x09, 0x02, /* Usage (Mouse), */ | 147 | 0x09, 0x02, /* Usage (Mouse), */ |
148 | 0xA1, 0x01, /* Collection (Application), */ | 148 | 0xA1, 0x01, /* Collection (Application), */ |
149 | 0x85, 0x11, /* Report ID (17), */ | 149 | 0x85, 0x11, /* Report ID (17), */ |
150 | 0x09, 0x01, /* Usage (Pointer), */ | 150 | 0x09, 0x01, /* Usage (Pointer), */ |
151 | 0xA0, /* Collection (Physical), */ | 151 | 0xA0, /* Collection (Physical), */ |
152 | 0x14, /* Logical Minimum (0), */ | 152 | 0x14, /* Logical Minimum (0), */ |
153 | 0xA4, /* Push, */ | 153 | 0xA4, /* Push, */ |
154 | 0x05, 0x09, /* Usage Page (Button), */ | 154 | 0x05, 0x09, /* Usage Page (Button), */ |
155 | 0x75, 0x01, /* Report Size (1), */ | 155 | 0x75, 0x01, /* Report Size (1), */ |
156 | 0x19, 0x01, /* Usage Minimum (01h), */ | 156 | 0x19, 0x01, /* Usage Minimum (01h), */ |
157 | 0x29, 0x03, /* Usage Maximum (03h), */ | 157 | 0x29, 0x03, /* Usage Maximum (03h), */ |
158 | 0x25, 0x01, /* Logical Maximum (1), */ | 158 | 0x25, 0x01, /* Logical Maximum (1), */ |
159 | 0x95, 0x03, /* Report Count (3), */ | 159 | 0x95, 0x03, /* Report Count (3), */ |
160 | 0x81, 0x02, /* Input (Variable), */ | 160 | 0x81, 0x02, /* Input (Variable), */ |
161 | 0x95, 0x05, /* Report Count (5), */ | 161 | 0x95, 0x05, /* Report Count (5), */ |
162 | 0x81, 0x01, /* Input (Constant), */ | 162 | 0x81, 0x01, /* Input (Constant), */ |
163 | 0xB4, /* Pop, */ | 163 | 0xB4, /* Pop, */ |
164 | 0x95, 0x01, /* Report Count (1), */ | 164 | 0x95, 0x01, /* Report Count (1), */ |
165 | 0xA4, /* Push, */ | 165 | 0xA4, /* Push, */ |
166 | 0x55, 0xFD, /* Unit Exponent (-3), */ | 166 | 0x55, 0xFD, /* Unit Exponent (-3), */ |
167 | 0x65, 0x13, /* Unit (Inch), */ | 167 | 0x65, 0x13, /* Unit (Inch), */ |
168 | 0x34, /* Physical Minimum (0), */ | 168 | 0x34, /* Physical Minimum (0), */ |
169 | 0x75, 0x10, /* Report Size (16), */ | 169 | 0x75, 0x10, /* Report Size (16), */ |
170 | 0x09, 0x30, /* Usage (X), */ | 170 | 0x09, 0x30, /* Usage (X), */ |
171 | 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ | 171 | 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ |
172 | 0x26, 0x00, 0x50, /* Logical Maximum (20480), */ | 172 | 0x26, 0x00, 0x50, /* Logical Maximum (20480), */ |
173 | 0x81, 0x02, /* Input (Variable), */ | 173 | 0x81, 0x02, /* Input (Variable), */ |
174 | 0x09, 0x31, /* Usage (Y), */ | 174 | 0x09, 0x31, /* Usage (Y), */ |
175 | 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ | 175 | 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ |
176 | 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ | 176 | 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ |
177 | 0x81, 0x02, /* Input (Variable), */ | 177 | 0x81, 0x02, /* Input (Variable), */ |
178 | 0xB4, /* Pop, */ | 178 | 0xB4, /* Pop, */ |
179 | 0x75, 0x08, /* Report Size (8), */ | 179 | 0x75, 0x08, /* Report Size (8), */ |
180 | 0x09, 0x38, /* Usage (Wheel), */ | 180 | 0x09, 0x38, /* Usage (Wheel), */ |
181 | 0x15, 0xFF, /* Logical Minimum (-1), */ | 181 | 0x15, 0xFF, /* Logical Minimum (-1), */ |
182 | 0x25, 0x01, /* Logical Maximum (1), */ | 182 | 0x25, 0x01, /* Logical Maximum (1), */ |
183 | 0x81, 0x06, /* Input (Variable, Relative), */ | 183 | 0x81, 0x06, /* Input (Variable, Relative), */ |
184 | 0x81, 0x01, /* Input (Constant), */ | 184 | 0x81, 0x01, /* Input (Constant), */ |
185 | 0xC0, /* End Collection, */ | 185 | 0xC0, /* End Collection, */ |
186 | 0xC0 /* End Collection */ | 186 | 0xC0 /* End Collection */ |
187 | }; | 187 | }; |
188 | 188 | ||
189 | /* | 189 | /* |
190 | * See EasyPen M610X description, device and HID report descriptors at | 190 | * See EasyPen M610X description, device and HID report descriptors at |
191 | * http://sf.net/apps/mediawiki/digimend/?title=KYE_EasyPen_M610X | 191 | * http://sf.net/apps/mediawiki/digimend/?title=KYE_EasyPen_M610X |
192 | */ | 192 | */ |
193 | 193 | ||
194 | /* Original EasyPen M610X report descriptor size */ | 194 | /* Original EasyPen M610X report descriptor size */ |
195 | #define EASYPEN_M610X_RDESC_ORIG_SIZE 476 | 195 | #define EASYPEN_M610X_RDESC_ORIG_SIZE 476 |
196 | 196 | ||
197 | /* Fixed EasyPen M610X report descriptor */ | 197 | /* Fixed EasyPen M610X report descriptor */ |
198 | static __u8 easypen_m610x_rdesc_fixed[] = { | 198 | static __u8 easypen_m610x_rdesc_fixed[] = { |
199 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ | 199 | 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
200 | 0x09, 0x01, /* Usage (01h), */ | 200 | 0x09, 0x01, /* Usage (01h), */ |
201 | 0xA1, 0x01, /* Collection (Application), */ | 201 | 0xA1, 0x01, /* Collection (Application), */ |
202 | 0x85, 0x05, /* Report ID (5), */ | 202 | 0x85, 0x05, /* Report ID (5), */ |
203 | 0x09, 0x01, /* Usage (01h), */ | 203 | 0x09, 0x01, /* Usage (01h), */ |
204 | 0x15, 0x80, /* Logical Minimum (-128), */ | 204 | 0x15, 0x80, /* Logical Minimum (-128), */ |
205 | 0x25, 0x7F, /* Logical Maximum (127), */ | 205 | 0x25, 0x7F, /* Logical Maximum (127), */ |
206 | 0x75, 0x08, /* Report Size (8), */ | 206 | 0x75, 0x08, /* Report Size (8), */ |
207 | 0x95, 0x07, /* Report Count (7), */ | 207 | 0x95, 0x07, /* Report Count (7), */ |
208 | 0xB1, 0x02, /* Feature (Variable), */ | 208 | 0xB1, 0x02, /* Feature (Variable), */ |
209 | 0xC0, /* End Collection, */ | 209 | 0xC0, /* End Collection, */ |
210 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | 210 | 0x05, 0x0D, /* Usage Page (Digitizer), */ |
211 | 0x09, 0x02, /* Usage (Pen), */ | 211 | 0x09, 0x02, /* Usage (Pen), */ |
212 | 0xA1, 0x01, /* Collection (Application), */ | 212 | 0xA1, 0x01, /* Collection (Application), */ |
213 | 0x85, 0x10, /* Report ID (16), */ | 213 | 0x85, 0x10, /* Report ID (16), */ |
214 | 0x09, 0x20, /* Usage (Stylus), */ | 214 | 0x09, 0x20, /* Usage (Stylus), */ |
215 | 0xA0, /* Collection (Physical), */ | 215 | 0xA0, /* Collection (Physical), */ |
216 | 0x14, /* Logical Minimum (0), */ | 216 | 0x14, /* Logical Minimum (0), */ |
217 | 0x25, 0x01, /* Logical Maximum (1), */ | 217 | 0x25, 0x01, /* Logical Maximum (1), */ |
218 | 0x75, 0x01, /* Report Size (1), */ | 218 | 0x75, 0x01, /* Report Size (1), */ |
219 | 0x09, 0x42, /* Usage (Tip Switch), */ | 219 | 0x09, 0x42, /* Usage (Tip Switch), */ |
220 | 0x09, 0x44, /* Usage (Barrel Switch), */ | 220 | 0x09, 0x44, /* Usage (Barrel Switch), */ |
221 | 0x09, 0x46, /* Usage (Tablet Pick), */ | 221 | 0x09, 0x46, /* Usage (Tablet Pick), */ |
222 | 0x95, 0x03, /* Report Count (3), */ | 222 | 0x95, 0x03, /* Report Count (3), */ |
223 | 0x81, 0x02, /* Input (Variable), */ | 223 | 0x81, 0x02, /* Input (Variable), */ |
224 | 0x95, 0x04, /* Report Count (4), */ | 224 | 0x95, 0x04, /* Report Count (4), */ |
225 | 0x81, 0x03, /* Input (Constant, Variable), */ | 225 | 0x81, 0x03, /* Input (Constant, Variable), */ |
226 | 0x09, 0x32, /* Usage (In Range), */ | 226 | 0x09, 0x32, /* Usage (In Range), */ |
227 | 0x95, 0x01, /* Report Count (1), */ | 227 | 0x95, 0x01, /* Report Count (1), */ |
228 | 0x81, 0x02, /* Input (Variable), */ | 228 | 0x81, 0x02, /* Input (Variable), */ |
229 | 0x75, 0x10, /* Report Size (16), */ | 229 | 0x75, 0x10, /* Report Size (16), */ |
230 | 0x95, 0x01, /* Report Count (1), */ | 230 | 0x95, 0x01, /* Report Count (1), */ |
231 | 0xA4, /* Push, */ | 231 | 0xA4, /* Push, */ |
232 | 0x05, 0x01, /* Usage Page (Desktop), */ | 232 | 0x05, 0x01, /* Usage Page (Desktop), */ |
233 | 0x55, 0xFD, /* Unit Exponent (-3), */ | 233 | 0x55, 0xFD, /* Unit Exponent (-3), */ |
234 | 0x65, 0x13, /* Unit (Inch), */ | 234 | 0x65, 0x13, /* Unit (Inch), */ |
235 | 0x34, /* Physical Minimum (0), */ | 235 | 0x34, /* Physical Minimum (0), */ |
236 | 0x09, 0x30, /* Usage (X), */ | 236 | 0x09, 0x30, /* Usage (X), */ |
237 | 0x46, 0x10, 0x27, /* Physical Maximum (10000), */ | 237 | 0x46, 0x10, 0x27, /* Physical Maximum (10000), */ |
238 | 0x27, 0x00, 0xA0, 0x00, 0x00, /* Logical Maximum (40960), */ | 238 | 0x27, 0x00, 0xA0, 0x00, 0x00, /* Logical Maximum (40960), */ |
239 | 0x81, 0x02, /* Input (Variable), */ | 239 | 0x81, 0x02, /* Input (Variable), */ |
240 | 0x09, 0x31, /* Usage (Y), */ | 240 | 0x09, 0x31, /* Usage (Y), */ |
241 | 0x46, 0x6A, 0x18, /* Physical Maximum (6250), */ | 241 | 0x46, 0x6A, 0x18, /* Physical Maximum (6250), */ |
242 | 0x26, 0x00, 0x64, /* Logical Maximum (25600), */ | 242 | 0x26, 0x00, 0x64, /* Logical Maximum (25600), */ |
243 | 0x81, 0x02, /* Input (Variable), */ | 243 | 0x81, 0x02, /* Input (Variable), */ |
244 | 0xB4, /* Pop, */ | 244 | 0xB4, /* Pop, */ |
245 | 0x09, 0x30, /* Usage (Tip Pressure), */ | 245 | 0x09, 0x30, /* Usage (Tip Pressure), */ |
246 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | 246 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
247 | 0x81, 0x02, /* Input (Variable), */ | 247 | 0x81, 0x02, /* Input (Variable), */ |
248 | 0xC0, /* End Collection, */ | 248 | 0xC0, /* End Collection, */ |
249 | 0xC0, /* End Collection, */ | 249 | 0xC0, /* End Collection, */ |
250 | 0x05, 0x0C, /* Usage Page (Consumer), */ | 250 | 0x05, 0x0C, /* Usage Page (Consumer), */ |
251 | 0x09, 0x01, /* Usage (Consumer Control), */ | 251 | 0x09, 0x01, /* Usage (Consumer Control), */ |
252 | 0xA1, 0x01, /* Collection (Application), */ | 252 | 0xA1, 0x01, /* Collection (Application), */ |
253 | 0x85, 0x12, /* Report ID (18), */ | 253 | 0x85, 0x12, /* Report ID (18), */ |
254 | 0x14, /* Logical Minimum (0), */ | 254 | 0x14, /* Logical Minimum (0), */ |
255 | 0x25, 0x01, /* Logical Maximum (1), */ | 255 | 0x25, 0x01, /* Logical Maximum (1), */ |
256 | 0x75, 0x01, /* Report Size (1), */ | 256 | 0x75, 0x01, /* Report Size (1), */ |
257 | 0x95, 0x04, /* Report Count (4), */ | 257 | 0x95, 0x04, /* Report Count (4), */ |
258 | 0x0A, 0x1A, 0x02, /* Usage (AC Undo), */ | 258 | 0x0A, 0x1A, 0x02, /* Usage (AC Undo), */ |
259 | 0x0A, 0x79, 0x02, /* Usage (AC Redo Or Repeat), */ | 259 | 0x0A, 0x79, 0x02, /* Usage (AC Redo Or Repeat), */ |
260 | 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ | 260 | 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ |
261 | 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ | 261 | 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ |
262 | 0x81, 0x02, /* Input (Variable), */ | 262 | 0x81, 0x02, /* Input (Variable), */ |
263 | 0x95, 0x01, /* Report Count (1), */ | 263 | 0x95, 0x01, /* Report Count (1), */ |
264 | 0x75, 0x14, /* Report Size (20), */ | 264 | 0x75, 0x14, /* Report Size (20), */ |
265 | 0x81, 0x03, /* Input (Constant, Variable), */ | 265 | 0x81, 0x03, /* Input (Constant, Variable), */ |
266 | 0x75, 0x20, /* Report Size (32), */ | 266 | 0x75, 0x20, /* Report Size (32), */ |
267 | 0x81, 0x03, /* Input (Constant, Variable), */ | 267 | 0x81, 0x03, /* Input (Constant, Variable), */ |
268 | 0xC0 /* End Collection */ | 268 | 0xC0 /* End Collection */ |
269 | }; | 269 | }; |
270 | 270 | ||
271 | static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc, | 271 | static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc, |
272 | unsigned int *rsize, int offset, const char *device_name) { | 272 | unsigned int *rsize, int offset, const char *device_name) { |
273 | /* | 273 | /* |
274 | * the fixup that need to be done: | 274 | * the fixup that need to be done: |
275 | * - change Usage Maximum in the Comsumer Control | 275 | * - change Usage Maximum in the Comsumer Control |
276 | * (report ID 3) to a reasonable value | 276 | * (report ID 3) to a reasonable value |
277 | */ | 277 | */ |
278 | if (*rsize >= offset + 31 && | 278 | if (*rsize >= offset + 31 && |
279 | /* Usage Page (Consumer Devices) */ | 279 | /* Usage Page (Consumer Devices) */ |
280 | rdesc[offset] == 0x05 && rdesc[offset + 1] == 0x0c && | 280 | rdesc[offset] == 0x05 && rdesc[offset + 1] == 0x0c && |
281 | /* Usage (Consumer Control) */ | 281 | /* Usage (Consumer Control) */ |
282 | rdesc[offset + 2] == 0x09 && rdesc[offset + 3] == 0x01 && | 282 | rdesc[offset + 2] == 0x09 && rdesc[offset + 3] == 0x01 && |
283 | /* Usage Maximum > 12287 */ | 283 | /* Usage Maximum > 12287 */ |
284 | rdesc[offset + 10] == 0x2a && rdesc[offset + 12] > 0x2f) { | 284 | rdesc[offset + 10] == 0x2a && rdesc[offset + 12] > 0x2f) { |
285 | hid_info(hdev, "fixing up %s report descriptor\n", device_name); | 285 | hid_info(hdev, "fixing up %s report descriptor\n", device_name); |
286 | rdesc[offset + 12] = 0x2f; | 286 | rdesc[offset + 12] = 0x2f; |
287 | } | 287 | } |
288 | return rdesc; | 288 | return rdesc; |
289 | } | 289 | } |
290 | 290 | ||
291 | static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 291 | static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
292 | unsigned int *rsize) | 292 | unsigned int *rsize) |
293 | { | 293 | { |
294 | switch (hdev->product) { | 294 | switch (hdev->product) { |
295 | case USB_DEVICE_ID_KYE_ERGO_525V: | 295 | case USB_DEVICE_ID_KYE_ERGO_525V: |
296 | /* the fixups that need to be done: | 296 | /* the fixups that need to be done: |
297 | * - change led usage page to button for extra buttons | 297 | * - change led usage page to button for extra buttons |
298 | * - report size 8 count 1 must be size 1 count 8 for button | 298 | * - report size 8 count 1 must be size 1 count 8 for button |
299 | * bitfield | 299 | * bitfield |
300 | * - change the button usage range to 4-7 for the extra | 300 | * - change the button usage range to 4-7 for the extra |
301 | * buttons | 301 | * buttons |
302 | */ | 302 | */ |
303 | if (*rsize >= 75 && | 303 | if (*rsize >= 75 && |
304 | rdesc[61] == 0x05 && rdesc[62] == 0x08 && | 304 | rdesc[61] == 0x05 && rdesc[62] == 0x08 && |
305 | rdesc[63] == 0x19 && rdesc[64] == 0x08 && | 305 | rdesc[63] == 0x19 && rdesc[64] == 0x08 && |
306 | rdesc[65] == 0x29 && rdesc[66] == 0x0f && | 306 | rdesc[65] == 0x29 && rdesc[66] == 0x0f && |
307 | rdesc[71] == 0x75 && rdesc[72] == 0x08 && | 307 | rdesc[71] == 0x75 && rdesc[72] == 0x08 && |
308 | rdesc[73] == 0x95 && rdesc[74] == 0x01) { | 308 | rdesc[73] == 0x95 && rdesc[74] == 0x01) { |
309 | hid_info(hdev, | 309 | hid_info(hdev, |
310 | "fixing up Kye/Genius Ergo Mouse " | 310 | "fixing up Kye/Genius Ergo Mouse " |
311 | "report descriptor\n"); | 311 | "report descriptor\n"); |
312 | rdesc[62] = 0x09; | 312 | rdesc[62] = 0x09; |
313 | rdesc[64] = 0x04; | 313 | rdesc[64] = 0x04; |
314 | rdesc[66] = 0x07; | 314 | rdesc[66] = 0x07; |
315 | rdesc[72] = 0x01; | 315 | rdesc[72] = 0x01; |
316 | rdesc[74] = 0x08; | 316 | rdesc[74] = 0x08; |
317 | } | 317 | } |
318 | break; | 318 | break; |
319 | case USB_DEVICE_ID_KYE_EASYPEN_I405X: | 319 | case USB_DEVICE_ID_KYE_EASYPEN_I405X: |
320 | if (*rsize == EASYPEN_I405X_RDESC_ORIG_SIZE) { | 320 | if (*rsize == EASYPEN_I405X_RDESC_ORIG_SIZE) { |
321 | rdesc = easypen_i405x_rdesc_fixed; | 321 | rdesc = easypen_i405x_rdesc_fixed; |
322 | *rsize = sizeof(easypen_i405x_rdesc_fixed); | 322 | *rsize = sizeof(easypen_i405x_rdesc_fixed); |
323 | } | 323 | } |
324 | break; | 324 | break; |
325 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: | 325 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: |
326 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: | ||
326 | if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { | 327 | if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { |
327 | rdesc = mousepen_i608x_rdesc_fixed; | 328 | rdesc = mousepen_i608x_rdesc_fixed; |
328 | *rsize = sizeof(mousepen_i608x_rdesc_fixed); | 329 | *rsize = sizeof(mousepen_i608x_rdesc_fixed); |
329 | } | 330 | } |
330 | break; | 331 | break; |
331 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: | 332 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: |
332 | if (*rsize == EASYPEN_M610X_RDESC_ORIG_SIZE) { | 333 | if (*rsize == EASYPEN_M610X_RDESC_ORIG_SIZE) { |
333 | rdesc = easypen_m610x_rdesc_fixed; | 334 | rdesc = easypen_m610x_rdesc_fixed; |
334 | *rsize = sizeof(easypen_m610x_rdesc_fixed); | 335 | *rsize = sizeof(easypen_m610x_rdesc_fixed); |
335 | } | 336 | } |
336 | break; | 337 | break; |
337 | case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE: | 338 | case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE: |
338 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, | 339 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, |
339 | "Genius Gila Gaming Mouse"); | 340 | "Genius Gila Gaming Mouse"); |
340 | break; | 341 | break; |
341 | case USB_DEVICE_ID_GENIUS_GX_IMPERATOR: | 342 | case USB_DEVICE_ID_GENIUS_GX_IMPERATOR: |
342 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, | 343 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, |
343 | "Genius Gx Imperator Keyboard"); | 344 | "Genius Gx Imperator Keyboard"); |
344 | break; | 345 | break; |
345 | case USB_DEVICE_ID_GENIUS_MANTICORE: | 346 | case USB_DEVICE_ID_GENIUS_MANTICORE: |
346 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, | 347 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, |
347 | "Genius Manticore Keyboard"); | 348 | "Genius Manticore Keyboard"); |
348 | break; | 349 | break; |
349 | } | 350 | } |
350 | return rdesc; | 351 | return rdesc; |
351 | } | 352 | } |
352 | 353 | ||
353 | /** | 354 | /** |
354 | * Enable fully-functional tablet mode by setting a special feature report. | 355 | * Enable fully-functional tablet mode by setting a special feature report. |
355 | * | 356 | * |
356 | * @hdev: HID device | 357 | * @hdev: HID device |
357 | * | 358 | * |
358 | * The specific report ID and data were discovered by sniffing the | 359 | * The specific report ID and data were discovered by sniffing the |
359 | * Windows driver traffic. | 360 | * Windows driver traffic. |
360 | */ | 361 | */ |
361 | static int kye_tablet_enable(struct hid_device *hdev) | 362 | static int kye_tablet_enable(struct hid_device *hdev) |
362 | { | 363 | { |
363 | struct list_head *list; | 364 | struct list_head *list; |
364 | struct list_head *head; | 365 | struct list_head *head; |
365 | struct hid_report *report; | 366 | struct hid_report *report; |
366 | __s32 *value; | 367 | __s32 *value; |
367 | 368 | ||
368 | list = &hdev->report_enum[HID_FEATURE_REPORT].report_list; | 369 | list = &hdev->report_enum[HID_FEATURE_REPORT].report_list; |
369 | list_for_each(head, list) { | 370 | list_for_each(head, list) { |
370 | report = list_entry(head, struct hid_report, list); | 371 | report = list_entry(head, struct hid_report, list); |
371 | if (report->id == 5) | 372 | if (report->id == 5) |
372 | break; | 373 | break; |
373 | } | 374 | } |
374 | 375 | ||
375 | if (head == list) { | 376 | if (head == list) { |
376 | hid_err(hdev, "tablet-enabling feature report not found\n"); | 377 | hid_err(hdev, "tablet-enabling feature report not found\n"); |
377 | return -ENODEV; | 378 | return -ENODEV; |
378 | } | 379 | } |
379 | 380 | ||
380 | if (report->maxfield < 1 || report->field[0]->report_count < 7) { | 381 | if (report->maxfield < 1 || report->field[0]->report_count < 7) { |
381 | hid_err(hdev, "invalid tablet-enabling feature report\n"); | 382 | hid_err(hdev, "invalid tablet-enabling feature report\n"); |
382 | return -ENODEV; | 383 | return -ENODEV; |
383 | } | 384 | } |
384 | 385 | ||
385 | value = report->field[0]->value; | 386 | value = report->field[0]->value; |
386 | 387 | ||
387 | value[0] = 0x12; | 388 | value[0] = 0x12; |
388 | value[1] = 0x10; | 389 | value[1] = 0x10; |
389 | value[2] = 0x11; | 390 | value[2] = 0x11; |
390 | value[3] = 0x12; | 391 | value[3] = 0x12; |
391 | value[4] = 0x00; | 392 | value[4] = 0x00; |
392 | value[5] = 0x00; | 393 | value[5] = 0x00; |
393 | value[6] = 0x00; | 394 | value[6] = 0x00; |
394 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); | 395 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); |
395 | 396 | ||
396 | return 0; | 397 | return 0; |
397 | } | 398 | } |
398 | 399 | ||
399 | static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) | 400 | static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) |
400 | { | 401 | { |
401 | int ret; | 402 | int ret; |
402 | 403 | ||
403 | ret = hid_parse(hdev); | 404 | ret = hid_parse(hdev); |
404 | if (ret) { | 405 | if (ret) { |
405 | hid_err(hdev, "parse failed\n"); | 406 | hid_err(hdev, "parse failed\n"); |
406 | goto err; | 407 | goto err; |
407 | } | 408 | } |
408 | 409 | ||
409 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 410 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
410 | if (ret) { | 411 | if (ret) { |
411 | hid_err(hdev, "hw start failed\n"); | 412 | hid_err(hdev, "hw start failed\n"); |
412 | goto err; | 413 | goto err; |
413 | } | 414 | } |
414 | 415 | ||
415 | switch (id->product) { | 416 | switch (id->product) { |
416 | case USB_DEVICE_ID_KYE_EASYPEN_I405X: | 417 | case USB_DEVICE_ID_KYE_EASYPEN_I405X: |
417 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: | 418 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: |
419 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: | ||
418 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: | 420 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: |
419 | ret = kye_tablet_enable(hdev); | 421 | ret = kye_tablet_enable(hdev); |
420 | if (ret) { | 422 | if (ret) { |
421 | hid_err(hdev, "tablet enabling failed\n"); | 423 | hid_err(hdev, "tablet enabling failed\n"); |
422 | goto enabling_err; | 424 | goto enabling_err; |
423 | } | 425 | } |
424 | break; | 426 | break; |
425 | case USB_DEVICE_ID_GENIUS_MANTICORE: | 427 | case USB_DEVICE_ID_GENIUS_MANTICORE: |
426 | /* | 428 | /* |
427 | * The manticore keyboard needs to have all the interfaces | 429 | * The manticore keyboard needs to have all the interfaces |
428 | * opened at least once to be fully functional. | 430 | * opened at least once to be fully functional. |
429 | */ | 431 | */ |
430 | if (hid_hw_open(hdev)) | 432 | if (hid_hw_open(hdev)) |
431 | hid_hw_close(hdev); | 433 | hid_hw_close(hdev); |
432 | break; | 434 | break; |
433 | } | 435 | } |
434 | 436 | ||
435 | return 0; | 437 | return 0; |
436 | enabling_err: | 438 | enabling_err: |
437 | hid_hw_stop(hdev); | 439 | hid_hw_stop(hdev); |
438 | err: | 440 | err: |
439 | return ret; | 441 | return ret; |
440 | } | 442 | } |
441 | 443 | ||
442 | static const struct hid_device_id kye_devices[] = { | 444 | static const struct hid_device_id kye_devices[] = { |
443 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, | 445 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, |
444 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 446 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
445 | USB_DEVICE_ID_KYE_EASYPEN_I405X) }, | 447 | USB_DEVICE_ID_KYE_EASYPEN_I405X) }, |
446 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 448 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
447 | USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, | 449 | USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, |
450 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | ||
451 | USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, | ||
448 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 452 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
449 | USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | 453 | USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
450 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 454 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
451 | USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, | 455 | USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, |
452 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 456 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
453 | USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, | 457 | USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, |
454 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 458 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
455 | USB_DEVICE_ID_GENIUS_MANTICORE) }, | 459 | USB_DEVICE_ID_GENIUS_MANTICORE) }, |
456 | { } | 460 | { } |
457 | }; | 461 | }; |
458 | MODULE_DEVICE_TABLE(hid, kye_devices); | 462 | MODULE_DEVICE_TABLE(hid, kye_devices); |
459 | 463 | ||
460 | static struct hid_driver kye_driver = { | 464 | static struct hid_driver kye_driver = { |
461 | .name = "kye", | 465 | .name = "kye", |
462 | .id_table = kye_devices, | 466 | .id_table = kye_devices, |
463 | .probe = kye_probe, | 467 | .probe = kye_probe, |
464 | .report_fixup = kye_report_fixup, | 468 | .report_fixup = kye_report_fixup, |
465 | }; | 469 | }; |
466 | module_hid_driver(kye_driver); | 470 | module_hid_driver(kye_driver); |
467 | 471 | ||
468 | MODULE_LICENSE("GPL"); | 472 | MODULE_LICENSE("GPL"); |
469 | 473 |
drivers/hid/hid-logitech-dj.c
1 | /* | 1 | /* |
2 | * HID driver for Logitech Unifying receivers | 2 | * HID driver for Logitech Unifying receivers |
3 | * | 3 | * |
4 | * Copyright (c) 2011 Logitech | 4 | * Copyright (c) 2011 Logitech |
5 | */ | 5 | */ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | 11 | ||
12 | * | 12 | * |
13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | 17 | * |
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | 24 | ||
25 | #include <linux/device.h> | 25 | #include <linux/device.h> |
26 | #include <linux/hid.h> | 26 | #include <linux/hid.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/usb.h> | 28 | #include <linux/usb.h> |
29 | #include <linux/kfifo.h> | 29 | #include <linux/kfifo.h> |
30 | #include <asm/unaligned.h> | 30 | #include <asm/unaligned.h> |
31 | #include "hid-ids.h" | 31 | #include "hid-ids.h" |
32 | 32 | ||
33 | #define DJ_MAX_PAIRED_DEVICES 6 | 33 | #define DJ_MAX_PAIRED_DEVICES 6 |
34 | #define DJ_MAX_NUMBER_NOTIFICATIONS 8 | 34 | #define DJ_MAX_NUMBER_NOTIFICATIONS 8 |
35 | #define DJ_RECEIVER_INDEX 0 | 35 | #define DJ_RECEIVER_INDEX 0 |
36 | #define DJ_DEVICE_INDEX_MIN 1 | 36 | #define DJ_DEVICE_INDEX_MIN 1 |
37 | #define DJ_DEVICE_INDEX_MAX 6 | 37 | #define DJ_DEVICE_INDEX_MAX 6 |
38 | 38 | ||
39 | #define DJREPORT_SHORT_LENGTH 15 | 39 | #define DJREPORT_SHORT_LENGTH 15 |
40 | #define DJREPORT_LONG_LENGTH 32 | 40 | #define DJREPORT_LONG_LENGTH 32 |
41 | 41 | ||
42 | #define REPORT_ID_DJ_SHORT 0x20 | 42 | #define REPORT_ID_DJ_SHORT 0x20 |
43 | #define REPORT_ID_DJ_LONG 0x21 | 43 | #define REPORT_ID_DJ_LONG 0x21 |
44 | 44 | ||
45 | #define REPORT_ID_HIDPP_SHORT 0x10 | 45 | #define REPORT_ID_HIDPP_SHORT 0x10 |
46 | #define REPORT_ID_HIDPP_LONG 0x11 | 46 | #define REPORT_ID_HIDPP_LONG 0x11 |
47 | 47 | ||
48 | #define HIDPP_REPORT_SHORT_LENGTH 7 | 48 | #define HIDPP_REPORT_SHORT_LENGTH 7 |
49 | #define HIDPP_REPORT_LONG_LENGTH 20 | 49 | #define HIDPP_REPORT_LONG_LENGTH 20 |
50 | 50 | ||
51 | #define HIDPP_RECEIVER_INDEX 0xff | 51 | #define HIDPP_RECEIVER_INDEX 0xff |
52 | 52 | ||
53 | #define REPORT_TYPE_RFREPORT_FIRST 0x01 | 53 | #define REPORT_TYPE_RFREPORT_FIRST 0x01 |
54 | #define REPORT_TYPE_RFREPORT_LAST 0x1F | 54 | #define REPORT_TYPE_RFREPORT_LAST 0x1F |
55 | 55 | ||
56 | /* Command Switch to DJ mode */ | 56 | /* Command Switch to DJ mode */ |
57 | #define REPORT_TYPE_CMD_SWITCH 0x80 | 57 | #define REPORT_TYPE_CMD_SWITCH 0x80 |
58 | #define CMD_SWITCH_PARAM_DEVBITFIELD 0x00 | 58 | #define CMD_SWITCH_PARAM_DEVBITFIELD 0x00 |
59 | #define CMD_SWITCH_PARAM_TIMEOUT_SECONDS 0x01 | 59 | #define CMD_SWITCH_PARAM_TIMEOUT_SECONDS 0x01 |
60 | #define TIMEOUT_NO_KEEPALIVE 0x00 | 60 | #define TIMEOUT_NO_KEEPALIVE 0x00 |
61 | 61 | ||
62 | /* Command to Get the list of Paired devices */ | 62 | /* Command to Get the list of Paired devices */ |
63 | #define REPORT_TYPE_CMD_GET_PAIRED_DEVICES 0x81 | 63 | #define REPORT_TYPE_CMD_GET_PAIRED_DEVICES 0x81 |
64 | 64 | ||
65 | /* Device Paired Notification */ | 65 | /* Device Paired Notification */ |
66 | #define REPORT_TYPE_NOTIF_DEVICE_PAIRED 0x41 | 66 | #define REPORT_TYPE_NOTIF_DEVICE_PAIRED 0x41 |
67 | #define SPFUNCTION_MORE_NOTIF_EXPECTED 0x01 | 67 | #define SPFUNCTION_MORE_NOTIF_EXPECTED 0x01 |
68 | #define SPFUNCTION_DEVICE_LIST_EMPTY 0x02 | 68 | #define SPFUNCTION_DEVICE_LIST_EMPTY 0x02 |
69 | #define DEVICE_PAIRED_PARAM_SPFUNCTION 0x00 | 69 | #define DEVICE_PAIRED_PARAM_SPFUNCTION 0x00 |
70 | #define DEVICE_PAIRED_PARAM_EQUAD_ID_LSB 0x01 | 70 | #define DEVICE_PAIRED_PARAM_EQUAD_ID_LSB 0x01 |
71 | #define DEVICE_PAIRED_PARAM_EQUAD_ID_MSB 0x02 | 71 | #define DEVICE_PAIRED_PARAM_EQUAD_ID_MSB 0x02 |
72 | #define DEVICE_PAIRED_RF_REPORT_TYPE 0x03 | 72 | #define DEVICE_PAIRED_RF_REPORT_TYPE 0x03 |
73 | 73 | ||
74 | /* Device Un-Paired Notification */ | 74 | /* Device Un-Paired Notification */ |
75 | #define REPORT_TYPE_NOTIF_DEVICE_UNPAIRED 0x40 | 75 | #define REPORT_TYPE_NOTIF_DEVICE_UNPAIRED 0x40 |
76 | 76 | ||
77 | 77 | ||
78 | /* Connection Status Notification */ | 78 | /* Connection Status Notification */ |
79 | #define REPORT_TYPE_NOTIF_CONNECTION_STATUS 0x42 | 79 | #define REPORT_TYPE_NOTIF_CONNECTION_STATUS 0x42 |
80 | #define CONNECTION_STATUS_PARAM_STATUS 0x00 | 80 | #define CONNECTION_STATUS_PARAM_STATUS 0x00 |
81 | #define STATUS_LINKLOSS 0x01 | 81 | #define STATUS_LINKLOSS 0x01 |
82 | 82 | ||
83 | /* Error Notification */ | 83 | /* Error Notification */ |
84 | #define REPORT_TYPE_NOTIF_ERROR 0x7F | 84 | #define REPORT_TYPE_NOTIF_ERROR 0x7F |
85 | #define NOTIF_ERROR_PARAM_ETYPE 0x00 | 85 | #define NOTIF_ERROR_PARAM_ETYPE 0x00 |
86 | #define ETYPE_KEEPALIVE_TIMEOUT 0x01 | 86 | #define ETYPE_KEEPALIVE_TIMEOUT 0x01 |
87 | 87 | ||
88 | /* supported DJ HID && RF report types */ | 88 | /* supported DJ HID && RF report types */ |
89 | #define REPORT_TYPE_KEYBOARD 0x01 | 89 | #define REPORT_TYPE_KEYBOARD 0x01 |
90 | #define REPORT_TYPE_MOUSE 0x02 | 90 | #define REPORT_TYPE_MOUSE 0x02 |
91 | #define REPORT_TYPE_CONSUMER_CONTROL 0x03 | 91 | #define REPORT_TYPE_CONSUMER_CONTROL 0x03 |
92 | #define REPORT_TYPE_SYSTEM_CONTROL 0x04 | 92 | #define REPORT_TYPE_SYSTEM_CONTROL 0x04 |
93 | #define REPORT_TYPE_MEDIA_CENTER 0x08 | 93 | #define REPORT_TYPE_MEDIA_CENTER 0x08 |
94 | #define REPORT_TYPE_LEDS 0x0E | 94 | #define REPORT_TYPE_LEDS 0x0E |
95 | 95 | ||
96 | /* RF Report types bitfield */ | 96 | /* RF Report types bitfield */ |
97 | #define STD_KEYBOARD 0x00000002 | 97 | #define STD_KEYBOARD 0x00000002 |
98 | #define STD_MOUSE 0x00000004 | 98 | #define STD_MOUSE 0x00000004 |
99 | #define MULTIMEDIA 0x00000008 | 99 | #define MULTIMEDIA 0x00000008 |
100 | #define POWER_KEYS 0x00000010 | 100 | #define POWER_KEYS 0x00000010 |
101 | #define MEDIA_CENTER 0x00000100 | 101 | #define MEDIA_CENTER 0x00000100 |
102 | #define KBD_LEDS 0x00004000 | 102 | #define KBD_LEDS 0x00004000 |
103 | 103 | ||
104 | struct dj_report { | 104 | struct dj_report { |
105 | u8 report_id; | 105 | u8 report_id; |
106 | u8 device_index; | 106 | u8 device_index; |
107 | u8 report_type; | 107 | u8 report_type; |
108 | u8 report_params[DJREPORT_SHORT_LENGTH - 3]; | 108 | u8 report_params[DJREPORT_SHORT_LENGTH - 3]; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | struct dj_receiver_dev { | 111 | struct dj_receiver_dev { |
112 | struct hid_device *hdev; | 112 | struct hid_device *hdev; |
113 | struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES + | 113 | struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES + |
114 | DJ_DEVICE_INDEX_MIN]; | 114 | DJ_DEVICE_INDEX_MIN]; |
115 | struct work_struct work; | 115 | struct work_struct work; |
116 | struct kfifo notif_fifo; | 116 | struct kfifo notif_fifo; |
117 | spinlock_t lock; | 117 | spinlock_t lock; |
118 | bool querying_devices; | 118 | bool querying_devices; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | struct dj_device { | 121 | struct dj_device { |
122 | struct hid_device *hdev; | 122 | struct hid_device *hdev; |
123 | struct dj_receiver_dev *dj_receiver_dev; | 123 | struct dj_receiver_dev *dj_receiver_dev; |
124 | u32 reports_supported; | 124 | u32 reports_supported; |
125 | u8 device_index; | 125 | u8 device_index; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | /* Keyboard descriptor (1) */ | 128 | /* Keyboard descriptor (1) */ |
129 | static const char kbd_descriptor[] = { | 129 | static const char kbd_descriptor[] = { |
130 | 0x05, 0x01, /* USAGE_PAGE (generic Desktop) */ | 130 | 0x05, 0x01, /* USAGE_PAGE (generic Desktop) */ |
131 | 0x09, 0x06, /* USAGE (Keyboard) */ | 131 | 0x09, 0x06, /* USAGE (Keyboard) */ |
132 | 0xA1, 0x01, /* COLLECTION (Application) */ | 132 | 0xA1, 0x01, /* COLLECTION (Application) */ |
133 | 0x85, 0x01, /* REPORT_ID (1) */ | 133 | 0x85, 0x01, /* REPORT_ID (1) */ |
134 | 0x95, 0x08, /* REPORT_COUNT (8) */ | 134 | 0x95, 0x08, /* REPORT_COUNT (8) */ |
135 | 0x75, 0x01, /* REPORT_SIZE (1) */ | 135 | 0x75, 0x01, /* REPORT_SIZE (1) */ |
136 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ | 136 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ |
137 | 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ | 137 | 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ |
138 | 0x05, 0x07, /* USAGE_PAGE (Keyboard) */ | 138 | 0x05, 0x07, /* USAGE_PAGE (Keyboard) */ |
139 | 0x19, 0xE0, /* USAGE_MINIMUM (Left Control) */ | 139 | 0x19, 0xE0, /* USAGE_MINIMUM (Left Control) */ |
140 | 0x29, 0xE7, /* USAGE_MAXIMUM (Right GUI) */ | 140 | 0x29, 0xE7, /* USAGE_MAXIMUM (Right GUI) */ |
141 | 0x81, 0x02, /* INPUT (Data,Var,Abs) */ | 141 | 0x81, 0x02, /* INPUT (Data,Var,Abs) */ |
142 | 0x95, 0x06, /* REPORT_COUNT (6) */ | 142 | 0x95, 0x06, /* REPORT_COUNT (6) */ |
143 | 0x75, 0x08, /* REPORT_SIZE (8) */ | 143 | 0x75, 0x08, /* REPORT_SIZE (8) */ |
144 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ | 144 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ |
145 | 0x26, 0xFF, 0x00, /* LOGICAL_MAXIMUM (255) */ | 145 | 0x26, 0xFF, 0x00, /* LOGICAL_MAXIMUM (255) */ |
146 | 0x05, 0x07, /* USAGE_PAGE (Keyboard) */ | 146 | 0x05, 0x07, /* USAGE_PAGE (Keyboard) */ |
147 | 0x19, 0x00, /* USAGE_MINIMUM (no event) */ | 147 | 0x19, 0x00, /* USAGE_MINIMUM (no event) */ |
148 | 0x2A, 0xFF, 0x00, /* USAGE_MAXIMUM (reserved) */ | 148 | 0x2A, 0xFF, 0x00, /* USAGE_MAXIMUM (reserved) */ |
149 | 0x81, 0x00, /* INPUT (Data,Ary,Abs) */ | 149 | 0x81, 0x00, /* INPUT (Data,Ary,Abs) */ |
150 | 0x85, 0x0e, /* REPORT_ID (14) */ | 150 | 0x85, 0x0e, /* REPORT_ID (14) */ |
151 | 0x05, 0x08, /* USAGE PAGE (LED page) */ | 151 | 0x05, 0x08, /* USAGE PAGE (LED page) */ |
152 | 0x95, 0x05, /* REPORT COUNT (5) */ | 152 | 0x95, 0x05, /* REPORT COUNT (5) */ |
153 | 0x75, 0x01, /* REPORT SIZE (1) */ | 153 | 0x75, 0x01, /* REPORT SIZE (1) */ |
154 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ | 154 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ |
155 | 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ | 155 | 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ |
156 | 0x19, 0x01, /* USAGE MINIMUM (1) */ | 156 | 0x19, 0x01, /* USAGE MINIMUM (1) */ |
157 | 0x29, 0x05, /* USAGE MAXIMUM (5) */ | 157 | 0x29, 0x05, /* USAGE MAXIMUM (5) */ |
158 | 0x91, 0x02, /* OUTPUT (Data, Variable, Absolute) */ | 158 | 0x91, 0x02, /* OUTPUT (Data, Variable, Absolute) */ |
159 | 0x95, 0x01, /* REPORT COUNT (1) */ | 159 | 0x95, 0x01, /* REPORT COUNT (1) */ |
160 | 0x75, 0x03, /* REPORT SIZE (3) */ | 160 | 0x75, 0x03, /* REPORT SIZE (3) */ |
161 | 0x91, 0x01, /* OUTPUT (Constant) */ | 161 | 0x91, 0x01, /* OUTPUT (Constant) */ |
162 | 0xC0 | 162 | 0xC0 |
163 | }; | 163 | }; |
164 | 164 | ||
165 | /* Mouse descriptor (2) */ | 165 | /* Mouse descriptor (2) */ |
166 | static const char mse_descriptor[] = { | 166 | static const char mse_descriptor[] = { |
167 | 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ | 167 | 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ |
168 | 0x09, 0x02, /* USAGE (Mouse) */ | 168 | 0x09, 0x02, /* USAGE (Mouse) */ |
169 | 0xA1, 0x01, /* COLLECTION (Application) */ | 169 | 0xA1, 0x01, /* COLLECTION (Application) */ |
170 | 0x85, 0x02, /* REPORT_ID = 2 */ | 170 | 0x85, 0x02, /* REPORT_ID = 2 */ |
171 | 0x09, 0x01, /* USAGE (pointer) */ | 171 | 0x09, 0x01, /* USAGE (pointer) */ |
172 | 0xA1, 0x00, /* COLLECTION (physical) */ | 172 | 0xA1, 0x00, /* COLLECTION (physical) */ |
173 | 0x05, 0x09, /* USAGE_PAGE (buttons) */ | 173 | 0x05, 0x09, /* USAGE_PAGE (buttons) */ |
174 | 0x19, 0x01, /* USAGE_MIN (1) */ | 174 | 0x19, 0x01, /* USAGE_MIN (1) */ |
175 | 0x29, 0x10, /* USAGE_MAX (16) */ | 175 | 0x29, 0x10, /* USAGE_MAX (16) */ |
176 | 0x15, 0x00, /* LOGICAL_MIN (0) */ | 176 | 0x15, 0x00, /* LOGICAL_MIN (0) */ |
177 | 0x25, 0x01, /* LOGICAL_MAX (1) */ | 177 | 0x25, 0x01, /* LOGICAL_MAX (1) */ |
178 | 0x95, 0x10, /* REPORT_COUNT (16) */ | 178 | 0x95, 0x10, /* REPORT_COUNT (16) */ |
179 | 0x75, 0x01, /* REPORT_SIZE (1) */ | 179 | 0x75, 0x01, /* REPORT_SIZE (1) */ |
180 | 0x81, 0x02, /* INPUT (data var abs) */ | 180 | 0x81, 0x02, /* INPUT (data var abs) */ |
181 | 0x05, 0x01, /* USAGE_PAGE (generic desktop) */ | 181 | 0x05, 0x01, /* USAGE_PAGE (generic desktop) */ |
182 | 0x16, 0x01, 0xF8, /* LOGICAL_MIN (-2047) */ | 182 | 0x16, 0x01, 0xF8, /* LOGICAL_MIN (-2047) */ |
183 | 0x26, 0xFF, 0x07, /* LOGICAL_MAX (2047) */ | 183 | 0x26, 0xFF, 0x07, /* LOGICAL_MAX (2047) */ |
184 | 0x75, 0x0C, /* REPORT_SIZE (12) */ | 184 | 0x75, 0x0C, /* REPORT_SIZE (12) */ |
185 | 0x95, 0x02, /* REPORT_COUNT (2) */ | 185 | 0x95, 0x02, /* REPORT_COUNT (2) */ |
186 | 0x09, 0x30, /* USAGE (X) */ | 186 | 0x09, 0x30, /* USAGE (X) */ |
187 | 0x09, 0x31, /* USAGE (Y) */ | 187 | 0x09, 0x31, /* USAGE (Y) */ |
188 | 0x81, 0x06, /* INPUT */ | 188 | 0x81, 0x06, /* INPUT */ |
189 | 0x15, 0x81, /* LOGICAL_MIN (-127) */ | 189 | 0x15, 0x81, /* LOGICAL_MIN (-127) */ |
190 | 0x25, 0x7F, /* LOGICAL_MAX (127) */ | 190 | 0x25, 0x7F, /* LOGICAL_MAX (127) */ |
191 | 0x75, 0x08, /* REPORT_SIZE (8) */ | 191 | 0x75, 0x08, /* REPORT_SIZE (8) */ |
192 | 0x95, 0x01, /* REPORT_COUNT (1) */ | 192 | 0x95, 0x01, /* REPORT_COUNT (1) */ |
193 | 0x09, 0x38, /* USAGE (wheel) */ | 193 | 0x09, 0x38, /* USAGE (wheel) */ |
194 | 0x81, 0x06, /* INPUT */ | 194 | 0x81, 0x06, /* INPUT */ |
195 | 0x05, 0x0C, /* USAGE_PAGE(consumer) */ | 195 | 0x05, 0x0C, /* USAGE_PAGE(consumer) */ |
196 | 0x0A, 0x38, 0x02, /* USAGE(AC Pan) */ | 196 | 0x0A, 0x38, 0x02, /* USAGE(AC Pan) */ |
197 | 0x95, 0x01, /* REPORT_COUNT (1) */ | 197 | 0x95, 0x01, /* REPORT_COUNT (1) */ |
198 | 0x81, 0x06, /* INPUT */ | 198 | 0x81, 0x06, /* INPUT */ |
199 | 0xC0, /* END_COLLECTION */ | 199 | 0xC0, /* END_COLLECTION */ |
200 | 0xC0, /* END_COLLECTION */ | 200 | 0xC0, /* END_COLLECTION */ |
201 | }; | 201 | }; |
202 | 202 | ||
203 | /* Consumer Control descriptor (3) */ | 203 | /* Consumer Control descriptor (3) */ |
204 | static const char consumer_descriptor[] = { | 204 | static const char consumer_descriptor[] = { |
205 | 0x05, 0x0C, /* USAGE_PAGE (Consumer Devices) */ | 205 | 0x05, 0x0C, /* USAGE_PAGE (Consumer Devices) */ |
206 | 0x09, 0x01, /* USAGE (Consumer Control) */ | 206 | 0x09, 0x01, /* USAGE (Consumer Control) */ |
207 | 0xA1, 0x01, /* COLLECTION (Application) */ | 207 | 0xA1, 0x01, /* COLLECTION (Application) */ |
208 | 0x85, 0x03, /* REPORT_ID = 3 */ | 208 | 0x85, 0x03, /* REPORT_ID = 3 */ |
209 | 0x75, 0x10, /* REPORT_SIZE (16) */ | 209 | 0x75, 0x10, /* REPORT_SIZE (16) */ |
210 | 0x95, 0x02, /* REPORT_COUNT (2) */ | 210 | 0x95, 0x02, /* REPORT_COUNT (2) */ |
211 | 0x15, 0x01, /* LOGICAL_MIN (1) */ | 211 | 0x15, 0x01, /* LOGICAL_MIN (1) */ |
212 | 0x26, 0x8C, 0x02, /* LOGICAL_MAX (652) */ | 212 | 0x26, 0x8C, 0x02, /* LOGICAL_MAX (652) */ |
213 | 0x19, 0x01, /* USAGE_MIN (1) */ | 213 | 0x19, 0x01, /* USAGE_MIN (1) */ |
214 | 0x2A, 0x8C, 0x02, /* USAGE_MAX (652) */ | 214 | 0x2A, 0x8C, 0x02, /* USAGE_MAX (652) */ |
215 | 0x81, 0x00, /* INPUT (Data Ary Abs) */ | 215 | 0x81, 0x00, /* INPUT (Data Ary Abs) */ |
216 | 0xC0, /* END_COLLECTION */ | 216 | 0xC0, /* END_COLLECTION */ |
217 | }; /* */ | 217 | }; /* */ |
218 | 218 | ||
219 | /* System control descriptor (4) */ | 219 | /* System control descriptor (4) */ |
220 | static const char syscontrol_descriptor[] = { | 220 | static const char syscontrol_descriptor[] = { |
221 | 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ | 221 | 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ |
222 | 0x09, 0x80, /* USAGE (System Control) */ | 222 | 0x09, 0x80, /* USAGE (System Control) */ |
223 | 0xA1, 0x01, /* COLLECTION (Application) */ | 223 | 0xA1, 0x01, /* COLLECTION (Application) */ |
224 | 0x85, 0x04, /* REPORT_ID = 4 */ | 224 | 0x85, 0x04, /* REPORT_ID = 4 */ |
225 | 0x75, 0x02, /* REPORT_SIZE (2) */ | 225 | 0x75, 0x02, /* REPORT_SIZE (2) */ |
226 | 0x95, 0x01, /* REPORT_COUNT (1) */ | 226 | 0x95, 0x01, /* REPORT_COUNT (1) */ |
227 | 0x15, 0x01, /* LOGICAL_MIN (1) */ | 227 | 0x15, 0x01, /* LOGICAL_MIN (1) */ |
228 | 0x25, 0x03, /* LOGICAL_MAX (3) */ | 228 | 0x25, 0x03, /* LOGICAL_MAX (3) */ |
229 | 0x09, 0x82, /* USAGE (System Sleep) */ | 229 | 0x09, 0x82, /* USAGE (System Sleep) */ |
230 | 0x09, 0x81, /* USAGE (System Power Down) */ | 230 | 0x09, 0x81, /* USAGE (System Power Down) */ |
231 | 0x09, 0x83, /* USAGE (System Wake Up) */ | 231 | 0x09, 0x83, /* USAGE (System Wake Up) */ |
232 | 0x81, 0x60, /* INPUT (Data Ary Abs NPrf Null) */ | 232 | 0x81, 0x60, /* INPUT (Data Ary Abs NPrf Null) */ |
233 | 0x75, 0x06, /* REPORT_SIZE (6) */ | 233 | 0x75, 0x06, /* REPORT_SIZE (6) */ |
234 | 0x81, 0x03, /* INPUT (Cnst Var Abs) */ | 234 | 0x81, 0x03, /* INPUT (Cnst Var Abs) */ |
235 | 0xC0, /* END_COLLECTION */ | 235 | 0xC0, /* END_COLLECTION */ |
236 | }; | 236 | }; |
237 | 237 | ||
238 | /* Media descriptor (8) */ | 238 | /* Media descriptor (8) */ |
239 | static const char media_descriptor[] = { | 239 | static const char media_descriptor[] = { |
240 | 0x06, 0xbc, 0xff, /* Usage Page 0xffbc */ | 240 | 0x06, 0xbc, 0xff, /* Usage Page 0xffbc */ |
241 | 0x09, 0x88, /* Usage 0x0088 */ | 241 | 0x09, 0x88, /* Usage 0x0088 */ |
242 | 0xa1, 0x01, /* BeginCollection */ | 242 | 0xa1, 0x01, /* BeginCollection */ |
243 | 0x85, 0x08, /* Report ID 8 */ | 243 | 0x85, 0x08, /* Report ID 8 */ |
244 | 0x19, 0x01, /* Usage Min 0x0001 */ | 244 | 0x19, 0x01, /* Usage Min 0x0001 */ |
245 | 0x29, 0xff, /* Usage Max 0x00ff */ | 245 | 0x29, 0xff, /* Usage Max 0x00ff */ |
246 | 0x15, 0x01, /* Logical Min 1 */ | 246 | 0x15, 0x01, /* Logical Min 1 */ |
247 | 0x26, 0xff, 0x00, /* Logical Max 255 */ | 247 | 0x26, 0xff, 0x00, /* Logical Max 255 */ |
248 | 0x75, 0x08, /* Report Size 8 */ | 248 | 0x75, 0x08, /* Report Size 8 */ |
249 | 0x95, 0x01, /* Report Count 1 */ | 249 | 0x95, 0x01, /* Report Count 1 */ |
250 | 0x81, 0x00, /* Input */ | 250 | 0x81, 0x00, /* Input */ |
251 | 0xc0, /* EndCollection */ | 251 | 0xc0, /* EndCollection */ |
252 | }; /* */ | 252 | }; /* */ |
253 | 253 | ||
254 | /* HIDPP descriptor */ | 254 | /* HIDPP descriptor */ |
255 | static const char hidpp_descriptor[] = { | 255 | static const char hidpp_descriptor[] = { |
256 | 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */ | 256 | 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */ |
257 | 0x09, 0x01, /* Usage (Vendor Usage 1) */ | 257 | 0x09, 0x01, /* Usage (Vendor Usage 1) */ |
258 | 0xa1, 0x01, /* Collection (Application) */ | 258 | 0xa1, 0x01, /* Collection (Application) */ |
259 | 0x85, 0x10, /* Report ID (16) */ | 259 | 0x85, 0x10, /* Report ID (16) */ |
260 | 0x75, 0x08, /* Report Size (8) */ | 260 | 0x75, 0x08, /* Report Size (8) */ |
261 | 0x95, 0x06, /* Report Count (6) */ | 261 | 0x95, 0x06, /* Report Count (6) */ |
262 | 0x15, 0x00, /* Logical Minimum (0) */ | 262 | 0x15, 0x00, /* Logical Minimum (0) */ |
263 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ | 263 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ |
264 | 0x09, 0x01, /* Usage (Vendor Usage 1) */ | 264 | 0x09, 0x01, /* Usage (Vendor Usage 1) */ |
265 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ | 265 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ |
266 | 0x09, 0x01, /* Usage (Vendor Usage 1) */ | 266 | 0x09, 0x01, /* Usage (Vendor Usage 1) */ |
267 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ | 267 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ |
268 | 0xc0, /* End Collection */ | 268 | 0xc0, /* End Collection */ |
269 | 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */ | 269 | 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */ |
270 | 0x09, 0x02, /* Usage (Vendor Usage 2) */ | 270 | 0x09, 0x02, /* Usage (Vendor Usage 2) */ |
271 | 0xa1, 0x01, /* Collection (Application) */ | 271 | 0xa1, 0x01, /* Collection (Application) */ |
272 | 0x85, 0x11, /* Report ID (17) */ | 272 | 0x85, 0x11, /* Report ID (17) */ |
273 | 0x75, 0x08, /* Report Size (8) */ | 273 | 0x75, 0x08, /* Report Size (8) */ |
274 | 0x95, 0x13, /* Report Count (19) */ | 274 | 0x95, 0x13, /* Report Count (19) */ |
275 | 0x15, 0x00, /* Logical Minimum (0) */ | 275 | 0x15, 0x00, /* Logical Minimum (0) */ |
276 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ | 276 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ |
277 | 0x09, 0x02, /* Usage (Vendor Usage 2) */ | 277 | 0x09, 0x02, /* Usage (Vendor Usage 2) */ |
278 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ | 278 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ |
279 | 0x09, 0x02, /* Usage (Vendor Usage 2) */ | 279 | 0x09, 0x02, /* Usage (Vendor Usage 2) */ |
280 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ | 280 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ |
281 | 0xc0, /* End Collection */ | 281 | 0xc0, /* End Collection */ |
282 | 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */ | 282 | 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */ |
283 | 0x09, 0x04, /* Usage (Vendor Usage 0x04) */ | 283 | 0x09, 0x04, /* Usage (Vendor Usage 0x04) */ |
284 | 0xa1, 0x01, /* Collection (Application) */ | 284 | 0xa1, 0x01, /* Collection (Application) */ |
285 | 0x85, 0x20, /* Report ID (32) */ | 285 | 0x85, 0x20, /* Report ID (32) */ |
286 | 0x75, 0x08, /* Report Size (8) */ | 286 | 0x75, 0x08, /* Report Size (8) */ |
287 | 0x95, 0x0e, /* Report Count (14) */ | 287 | 0x95, 0x0e, /* Report Count (14) */ |
288 | 0x15, 0x00, /* Logical Minimum (0) */ | 288 | 0x15, 0x00, /* Logical Minimum (0) */ |
289 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ | 289 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ |
290 | 0x09, 0x41, /* Usage (Vendor Usage 0x41) */ | 290 | 0x09, 0x41, /* Usage (Vendor Usage 0x41) */ |
291 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ | 291 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ |
292 | 0x09, 0x41, /* Usage (Vendor Usage 0x41) */ | 292 | 0x09, 0x41, /* Usage (Vendor Usage 0x41) */ |
293 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ | 293 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ |
294 | 0x85, 0x21, /* Report ID (33) */ | 294 | 0x85, 0x21, /* Report ID (33) */ |
295 | 0x95, 0x1f, /* Report Count (31) */ | 295 | 0x95, 0x1f, /* Report Count (31) */ |
296 | 0x15, 0x00, /* Logical Minimum (0) */ | 296 | 0x15, 0x00, /* Logical Minimum (0) */ |
297 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ | 297 | 0x26, 0xff, 0x00, /* Logical Maximum (255) */ |
298 | 0x09, 0x42, /* Usage (Vendor Usage 0x42) */ | 298 | 0x09, 0x42, /* Usage (Vendor Usage 0x42) */ |
299 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ | 299 | 0x81, 0x00, /* Input (Data,Arr,Abs) */ |
300 | 0x09, 0x42, /* Usage (Vendor Usage 0x42) */ | 300 | 0x09, 0x42, /* Usage (Vendor Usage 0x42) */ |
301 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ | 301 | 0x91, 0x00, /* Output (Data,Arr,Abs) */ |
302 | 0xc0, /* End Collection */ | 302 | 0xc0, /* End Collection */ |
303 | }; | 303 | }; |
304 | 304 | ||
305 | /* Maximum size of all defined hid reports in bytes (including report id) */ | 305 | /* Maximum size of all defined hid reports in bytes (including report id) */ |
306 | #define MAX_REPORT_SIZE 8 | 306 | #define MAX_REPORT_SIZE 8 |
307 | 307 | ||
308 | /* Make sure all descriptors are present here */ | 308 | /* Make sure all descriptors are present here */ |
309 | #define MAX_RDESC_SIZE \ | 309 | #define MAX_RDESC_SIZE \ |
310 | (sizeof(kbd_descriptor) + \ | 310 | (sizeof(kbd_descriptor) + \ |
311 | sizeof(mse_descriptor) + \ | 311 | sizeof(mse_descriptor) + \ |
312 | sizeof(consumer_descriptor) + \ | 312 | sizeof(consumer_descriptor) + \ |
313 | sizeof(syscontrol_descriptor) + \ | 313 | sizeof(syscontrol_descriptor) + \ |
314 | sizeof(media_descriptor) + \ | 314 | sizeof(media_descriptor) + \ |
315 | sizeof(hidpp_descriptor)) | 315 | sizeof(hidpp_descriptor)) |
316 | 316 | ||
317 | /* Number of possible hid report types that can be created by this driver. | 317 | /* Number of possible hid report types that can be created by this driver. |
318 | * | 318 | * |
319 | * Right now, RF report types have the same report types (or report id's) | 319 | * Right now, RF report types have the same report types (or report id's) |
320 | * than the hid report created from those RF reports. In the future | 320 | * than the hid report created from those RF reports. In the future |
321 | * this doesnt have to be true. | 321 | * this doesnt have to be true. |
322 | * | 322 | * |
323 | * For instance, RF report type 0x01 which has a size of 8 bytes, corresponds | 323 | * For instance, RF report type 0x01 which has a size of 8 bytes, corresponds |
324 | * to hid report id 0x01, this is standard keyboard. Same thing applies to mice | 324 | * to hid report id 0x01, this is standard keyboard. Same thing applies to mice |
325 | * reports and consumer control, etc. If a new RF report is created, it doesn't | 325 | * reports and consumer control, etc. If a new RF report is created, it doesn't |
326 | * has to have the same report id as its corresponding hid report, so an | 326 | * has to have the same report id as its corresponding hid report, so an |
327 | * translation may have to take place for future report types. | 327 | * translation may have to take place for future report types. |
328 | */ | 328 | */ |
329 | #define NUMBER_OF_HID_REPORTS 32 | 329 | #define NUMBER_OF_HID_REPORTS 32 |
330 | static const u8 hid_reportid_size_map[NUMBER_OF_HID_REPORTS] = { | 330 | static const u8 hid_reportid_size_map[NUMBER_OF_HID_REPORTS] = { |
331 | [1] = 8, /* Standard keyboard */ | 331 | [1] = 8, /* Standard keyboard */ |
332 | [2] = 8, /* Standard mouse */ | 332 | [2] = 8, /* Standard mouse */ |
333 | [3] = 5, /* Consumer control */ | 333 | [3] = 5, /* Consumer control */ |
334 | [4] = 2, /* System control */ | 334 | [4] = 2, /* System control */ |
335 | [8] = 2, /* Media Center */ | 335 | [8] = 2, /* Media Center */ |
336 | }; | 336 | }; |
337 | 337 | ||
338 | 338 | ||
339 | #define LOGITECH_DJ_INTERFACE_NUMBER 0x02 | 339 | #define LOGITECH_DJ_INTERFACE_NUMBER 0x02 |
340 | 340 | ||
341 | static struct hid_ll_driver logi_dj_ll_driver; | 341 | static struct hid_ll_driver logi_dj_ll_driver; |
342 | 342 | ||
343 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev); | 343 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev); |
344 | 344 | ||
345 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, | 345 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, |
346 | struct dj_report *dj_report) | 346 | struct dj_report *dj_report) |
347 | { | 347 | { |
348 | /* Called in delayed work context */ | 348 | /* Called in delayed work context */ |
349 | struct dj_device *dj_dev; | 349 | struct dj_device *dj_dev; |
350 | unsigned long flags; | 350 | unsigned long flags; |
351 | 351 | ||
352 | spin_lock_irqsave(&djrcv_dev->lock, flags); | 352 | spin_lock_irqsave(&djrcv_dev->lock, flags); |
353 | dj_dev = djrcv_dev->paired_dj_devices[dj_report->device_index]; | 353 | dj_dev = djrcv_dev->paired_dj_devices[dj_report->device_index]; |
354 | djrcv_dev->paired_dj_devices[dj_report->device_index] = NULL; | 354 | djrcv_dev->paired_dj_devices[dj_report->device_index] = NULL; |
355 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); | 355 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); |
356 | 356 | ||
357 | if (dj_dev != NULL) { | 357 | if (dj_dev != NULL) { |
358 | hid_destroy_device(dj_dev->hdev); | 358 | hid_destroy_device(dj_dev->hdev); |
359 | kfree(dj_dev); | 359 | kfree(dj_dev); |
360 | } else { | 360 | } else { |
361 | dev_err(&djrcv_dev->hdev->dev, "%s: can't destroy a NULL device\n", | 361 | dev_err(&djrcv_dev->hdev->dev, "%s: can't destroy a NULL device\n", |
362 | __func__); | 362 | __func__); |
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
366 | static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | 366 | static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, |
367 | struct dj_report *dj_report) | 367 | struct dj_report *dj_report) |
368 | { | 368 | { |
369 | /* Called in delayed work context */ | 369 | /* Called in delayed work context */ |
370 | struct hid_device *djrcv_hdev = djrcv_dev->hdev; | 370 | struct hid_device *djrcv_hdev = djrcv_dev->hdev; |
371 | struct usb_interface *intf = to_usb_interface(djrcv_hdev->dev.parent); | 371 | struct usb_interface *intf = to_usb_interface(djrcv_hdev->dev.parent); |
372 | struct usb_device *usbdev = interface_to_usbdev(intf); | 372 | struct usb_device *usbdev = interface_to_usbdev(intf); |
373 | struct hid_device *dj_hiddev; | 373 | struct hid_device *dj_hiddev; |
374 | struct dj_device *dj_dev; | 374 | struct dj_device *dj_dev; |
375 | 375 | ||
376 | /* Device index goes from 1 to 6, we need 3 bytes to store the | 376 | /* Device index goes from 1 to 6, we need 3 bytes to store the |
377 | * semicolon, the index, and a null terminator | 377 | * semicolon, the index, and a null terminator |
378 | */ | 378 | */ |
379 | unsigned char tmpstr[3]; | 379 | unsigned char tmpstr[3]; |
380 | 380 | ||
381 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & | 381 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & |
382 | SPFUNCTION_DEVICE_LIST_EMPTY) { | 382 | SPFUNCTION_DEVICE_LIST_EMPTY) { |
383 | dbg_hid("%s: device list is empty\n", __func__); | 383 | dbg_hid("%s: device list is empty\n", __func__); |
384 | djrcv_dev->querying_devices = false; | 384 | djrcv_dev->querying_devices = false; |
385 | return; | 385 | return; |
386 | } | 386 | } |
387 | 387 | ||
388 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { | 388 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { |
389 | /* The device is already known. No need to reallocate it. */ | 389 | /* The device is already known. No need to reallocate it. */ |
390 | dbg_hid("%s: device is already known\n", __func__); | 390 | dbg_hid("%s: device is already known\n", __func__); |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | 393 | ||
394 | dj_hiddev = hid_allocate_device(); | 394 | dj_hiddev = hid_allocate_device(); |
395 | if (IS_ERR(dj_hiddev)) { | 395 | if (IS_ERR(dj_hiddev)) { |
396 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", | 396 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", |
397 | __func__); | 397 | __func__); |
398 | return; | 398 | return; |
399 | } | 399 | } |
400 | 400 | ||
401 | dj_hiddev->ll_driver = &logi_dj_ll_driver; | 401 | dj_hiddev->ll_driver = &logi_dj_ll_driver; |
402 | 402 | ||
403 | dj_hiddev->dev.parent = &djrcv_hdev->dev; | 403 | dj_hiddev->dev.parent = &djrcv_hdev->dev; |
404 | dj_hiddev->bus = BUS_USB; | 404 | dj_hiddev->bus = BUS_USB; |
405 | dj_hiddev->vendor = le16_to_cpu(usbdev->descriptor.idVendor); | 405 | dj_hiddev->vendor = le16_to_cpu(usbdev->descriptor.idVendor); |
406 | dj_hiddev->product = | 406 | dj_hiddev->product = |
407 | (dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB] | 407 | (dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB] |
408 | << 8) | | 408 | << 8) | |
409 | dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB]; | 409 | dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB]; |
410 | snprintf(dj_hiddev->name, sizeof(dj_hiddev->name), | 410 | snprintf(dj_hiddev->name, sizeof(dj_hiddev->name), |
411 | "Logitech Unifying Device. Wireless PID:%04x", | 411 | "Logitech Unifying Device. Wireless PID:%04x", |
412 | dj_hiddev->product); | 412 | dj_hiddev->product); |
413 | 413 | ||
414 | dj_hiddev->group = HID_GROUP_LOGITECH_DJ_DEVICE; | 414 | dj_hiddev->group = HID_GROUP_LOGITECH_DJ_DEVICE; |
415 | 415 | ||
416 | usb_make_path(usbdev, dj_hiddev->phys, sizeof(dj_hiddev->phys)); | 416 | usb_make_path(usbdev, dj_hiddev->phys, sizeof(dj_hiddev->phys)); |
417 | snprintf(tmpstr, sizeof(tmpstr), ":%d", dj_report->device_index); | 417 | snprintf(tmpstr, sizeof(tmpstr), ":%d", dj_report->device_index); |
418 | strlcat(dj_hiddev->phys, tmpstr, sizeof(dj_hiddev->phys)); | 418 | strlcat(dj_hiddev->phys, tmpstr, sizeof(dj_hiddev->phys)); |
419 | 419 | ||
420 | dj_dev = kzalloc(sizeof(struct dj_device), GFP_KERNEL); | 420 | dj_dev = kzalloc(sizeof(struct dj_device), GFP_KERNEL); |
421 | 421 | ||
422 | if (!dj_dev) { | 422 | if (!dj_dev) { |
423 | dev_err(&djrcv_hdev->dev, "%s: failed allocating dj_device\n", | 423 | dev_err(&djrcv_hdev->dev, "%s: failed allocating dj_device\n", |
424 | __func__); | 424 | __func__); |
425 | goto dj_device_allocate_fail; | 425 | goto dj_device_allocate_fail; |
426 | } | 426 | } |
427 | 427 | ||
428 | dj_dev->reports_supported = get_unaligned_le32( | 428 | dj_dev->reports_supported = get_unaligned_le32( |
429 | dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE); | 429 | dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE); |
430 | dj_dev->hdev = dj_hiddev; | 430 | dj_dev->hdev = dj_hiddev; |
431 | dj_dev->dj_receiver_dev = djrcv_dev; | 431 | dj_dev->dj_receiver_dev = djrcv_dev; |
432 | dj_dev->device_index = dj_report->device_index; | 432 | dj_dev->device_index = dj_report->device_index; |
433 | dj_hiddev->driver_data = dj_dev; | 433 | dj_hiddev->driver_data = dj_dev; |
434 | 434 | ||
435 | djrcv_dev->paired_dj_devices[dj_report->device_index] = dj_dev; | 435 | djrcv_dev->paired_dj_devices[dj_report->device_index] = dj_dev; |
436 | 436 | ||
437 | if (hid_add_device(dj_hiddev)) { | 437 | if (hid_add_device(dj_hiddev)) { |
438 | dev_err(&djrcv_hdev->dev, "%s: failed adding dj_device\n", | 438 | dev_err(&djrcv_hdev->dev, "%s: failed adding dj_device\n", |
439 | __func__); | 439 | __func__); |
440 | goto hid_add_device_fail; | 440 | goto hid_add_device_fail; |
441 | } | 441 | } |
442 | 442 | ||
443 | return; | 443 | return; |
444 | 444 | ||
445 | hid_add_device_fail: | 445 | hid_add_device_fail: |
446 | djrcv_dev->paired_dj_devices[dj_report->device_index] = NULL; | 446 | djrcv_dev->paired_dj_devices[dj_report->device_index] = NULL; |
447 | kfree(dj_dev); | 447 | kfree(dj_dev); |
448 | dj_device_allocate_fail: | 448 | dj_device_allocate_fail: |
449 | hid_destroy_device(dj_hiddev); | 449 | hid_destroy_device(dj_hiddev); |
450 | } | 450 | } |
451 | 451 | ||
452 | static void delayedwork_callback(struct work_struct *work) | 452 | static void delayedwork_callback(struct work_struct *work) |
453 | { | 453 | { |
454 | struct dj_receiver_dev *djrcv_dev = | 454 | struct dj_receiver_dev *djrcv_dev = |
455 | container_of(work, struct dj_receiver_dev, work); | 455 | container_of(work, struct dj_receiver_dev, work); |
456 | 456 | ||
457 | struct dj_report dj_report; | 457 | struct dj_report dj_report; |
458 | unsigned long flags; | 458 | unsigned long flags; |
459 | int count; | 459 | int count; |
460 | int retval; | 460 | int retval; |
461 | 461 | ||
462 | dbg_hid("%s\n", __func__); | 462 | dbg_hid("%s\n", __func__); |
463 | 463 | ||
464 | spin_lock_irqsave(&djrcv_dev->lock, flags); | 464 | spin_lock_irqsave(&djrcv_dev->lock, flags); |
465 | 465 | ||
466 | count = kfifo_out(&djrcv_dev->notif_fifo, &dj_report, | 466 | count = kfifo_out(&djrcv_dev->notif_fifo, &dj_report, |
467 | sizeof(struct dj_report)); | 467 | sizeof(struct dj_report)); |
468 | 468 | ||
469 | if (count != sizeof(struct dj_report)) { | 469 | if (count != sizeof(struct dj_report)) { |
470 | dev_err(&djrcv_dev->hdev->dev, "%s: workitem triggered without " | 470 | dev_err(&djrcv_dev->hdev->dev, "%s: workitem triggered without " |
471 | "notifications available\n", __func__); | 471 | "notifications available\n", __func__); |
472 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); | 472 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); |
473 | return; | 473 | return; |
474 | } | 474 | } |
475 | 475 | ||
476 | if (!kfifo_is_empty(&djrcv_dev->notif_fifo)) { | 476 | if (!kfifo_is_empty(&djrcv_dev->notif_fifo)) { |
477 | if (schedule_work(&djrcv_dev->work) == 0) { | 477 | if (schedule_work(&djrcv_dev->work) == 0) { |
478 | dbg_hid("%s: did not schedule the work item, was " | 478 | dbg_hid("%s: did not schedule the work item, was " |
479 | "already queued\n", __func__); | 479 | "already queued\n", __func__); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | 482 | ||
483 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); | 483 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); |
484 | 484 | ||
485 | switch (dj_report.report_type) { | 485 | switch (dj_report.report_type) { |
486 | case REPORT_TYPE_NOTIF_DEVICE_PAIRED: | 486 | case REPORT_TYPE_NOTIF_DEVICE_PAIRED: |
487 | logi_dj_recv_add_djhid_device(djrcv_dev, &dj_report); | 487 | logi_dj_recv_add_djhid_device(djrcv_dev, &dj_report); |
488 | break; | 488 | break; |
489 | case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: | 489 | case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: |
490 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); | 490 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); |
491 | break; | 491 | break; |
492 | default: | 492 | default: |
493 | /* A normal report (i. e. not belonging to a pair/unpair notification) | 493 | /* A normal report (i. e. not belonging to a pair/unpair notification) |
494 | * arriving here, means that the report arrived but we did not have a | 494 | * arriving here, means that the report arrived but we did not have a |
495 | * paired dj_device associated to the report's device_index, this | 495 | * paired dj_device associated to the report's device_index, this |
496 | * means that the original "device paired" notification corresponding | 496 | * means that the original "device paired" notification corresponding |
497 | * to this dj_device never arrived to this driver. The reason is that | 497 | * to this dj_device never arrived to this driver. The reason is that |
498 | * hid-core discards all packets coming from a device while probe() is | 498 | * hid-core discards all packets coming from a device while probe() is |
499 | * executing. */ | 499 | * executing. */ |
500 | if (!djrcv_dev->paired_dj_devices[dj_report.device_index]) { | 500 | if (!djrcv_dev->paired_dj_devices[dj_report.device_index]) { |
501 | /* ok, we don't know the device, just re-ask the | 501 | /* ok, we don't know the device, just re-ask the |
502 | * receiver for the list of connected devices. */ | 502 | * receiver for the list of connected devices. */ |
503 | retval = logi_dj_recv_query_paired_devices(djrcv_dev); | 503 | retval = logi_dj_recv_query_paired_devices(djrcv_dev); |
504 | if (!retval) { | 504 | if (!retval) { |
505 | /* everything went fine, so just leave */ | 505 | /* everything went fine, so just leave */ |
506 | break; | 506 | break; |
507 | } | 507 | } |
508 | dev_err(&djrcv_dev->hdev->dev, | 508 | dev_err(&djrcv_dev->hdev->dev, |
509 | "%s:logi_dj_recv_query_paired_devices " | 509 | "%s:logi_dj_recv_query_paired_devices " |
510 | "error:%d\n", __func__, retval); | 510 | "error:%d\n", __func__, retval); |
511 | } | 511 | } |
512 | dbg_hid("%s: unexpected report type\n", __func__); | 512 | dbg_hid("%s: unexpected report type\n", __func__); |
513 | } | 513 | } |
514 | } | 514 | } |
515 | 515 | ||
516 | static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev, | 516 | static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev, |
517 | struct dj_report *dj_report) | 517 | struct dj_report *dj_report) |
518 | { | 518 | { |
519 | /* We are called from atomic context (tasklet && djrcv->lock held) */ | 519 | /* We are called from atomic context (tasklet && djrcv->lock held) */ |
520 | 520 | ||
521 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); | 521 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); |
522 | 522 | ||
523 | if (schedule_work(&djrcv_dev->work) == 0) { | 523 | if (schedule_work(&djrcv_dev->work) == 0) { |
524 | dbg_hid("%s: did not schedule the work item, was already " | 524 | dbg_hid("%s: did not schedule the work item, was already " |
525 | "queued\n", __func__); | 525 | "queued\n", __func__); |
526 | } | 526 | } |
527 | } | 527 | } |
528 | 528 | ||
529 | static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev, | 529 | static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev, |
530 | struct dj_report *dj_report) | 530 | struct dj_report *dj_report) |
531 | { | 531 | { |
532 | /* We are called from atomic context (tasklet && djrcv->lock held) */ | 532 | /* We are called from atomic context (tasklet && djrcv->lock held) */ |
533 | unsigned int i; | 533 | unsigned int i; |
534 | u8 reportbuffer[MAX_REPORT_SIZE]; | 534 | u8 reportbuffer[MAX_REPORT_SIZE]; |
535 | struct dj_device *djdev; | 535 | struct dj_device *djdev; |
536 | 536 | ||
537 | djdev = djrcv_dev->paired_dj_devices[dj_report->device_index]; | 537 | djdev = djrcv_dev->paired_dj_devices[dj_report->device_index]; |
538 | 538 | ||
539 | memset(reportbuffer, 0, sizeof(reportbuffer)); | 539 | memset(reportbuffer, 0, sizeof(reportbuffer)); |
540 | 540 | ||
541 | for (i = 0; i < NUMBER_OF_HID_REPORTS; i++) { | 541 | for (i = 0; i < NUMBER_OF_HID_REPORTS; i++) { |
542 | if (djdev->reports_supported & (1 << i)) { | 542 | if (djdev->reports_supported & (1 << i)) { |
543 | reportbuffer[0] = i; | 543 | reportbuffer[0] = i; |
544 | if (hid_input_report(djdev->hdev, | 544 | if (hid_input_report(djdev->hdev, |
545 | HID_INPUT_REPORT, | 545 | HID_INPUT_REPORT, |
546 | reportbuffer, | 546 | reportbuffer, |
547 | hid_reportid_size_map[i], 1)) { | 547 | hid_reportid_size_map[i], 1)) { |
548 | dbg_hid("hid_input_report error sending null " | 548 | dbg_hid("hid_input_report error sending null " |
549 | "report\n"); | 549 | "report\n"); |
550 | } | 550 | } |
551 | } | 551 | } |
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev, | 555 | static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev, |
556 | struct dj_report *dj_report) | 556 | struct dj_report *dj_report) |
557 | { | 557 | { |
558 | /* We are called from atomic context (tasklet && djrcv->lock held) */ | 558 | /* We are called from atomic context (tasklet && djrcv->lock held) */ |
559 | struct dj_device *dj_device; | 559 | struct dj_device *dj_device; |
560 | 560 | ||
561 | dj_device = djrcv_dev->paired_dj_devices[dj_report->device_index]; | 561 | dj_device = djrcv_dev->paired_dj_devices[dj_report->device_index]; |
562 | 562 | ||
563 | if ((dj_report->report_type > ARRAY_SIZE(hid_reportid_size_map) - 1) || | 563 | if ((dj_report->report_type > ARRAY_SIZE(hid_reportid_size_map) - 1) || |
564 | (hid_reportid_size_map[dj_report->report_type] == 0)) { | 564 | (hid_reportid_size_map[dj_report->report_type] == 0)) { |
565 | dbg_hid("invalid report type:%x\n", dj_report->report_type); | 565 | dbg_hid("invalid report type:%x\n", dj_report->report_type); |
566 | return; | 566 | return; |
567 | } | 567 | } |
568 | 568 | ||
569 | if (hid_input_report(dj_device->hdev, | 569 | if (hid_input_report(dj_device->hdev, |
570 | HID_INPUT_REPORT, &dj_report->report_type, | 570 | HID_INPUT_REPORT, &dj_report->report_type, |
571 | hid_reportid_size_map[dj_report->report_type], 1)) { | 571 | hid_reportid_size_map[dj_report->report_type], 1)) { |
572 | dbg_hid("hid_input_report error\n"); | 572 | dbg_hid("hid_input_report error\n"); |
573 | } | 573 | } |
574 | } | 574 | } |
575 | 575 | ||
576 | static void logi_dj_recv_forward_hidpp(struct dj_device *dj_dev, u8 *data, | 576 | static void logi_dj_recv_forward_hidpp(struct dj_device *dj_dev, u8 *data, |
577 | int size) | 577 | int size) |
578 | { | 578 | { |
579 | /* We are called from atomic context (tasklet && djrcv->lock held) */ | 579 | /* We are called from atomic context (tasklet && djrcv->lock held) */ |
580 | if (hid_input_report(dj_dev->hdev, HID_INPUT_REPORT, data, size, 1)) | 580 | if (hid_input_report(dj_dev->hdev, HID_INPUT_REPORT, data, size, 1)) |
581 | dbg_hid("hid_input_report error\n"); | 581 | dbg_hid("hid_input_report error\n"); |
582 | } | 582 | } |
583 | 583 | ||
584 | static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, | 584 | static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, |
585 | struct dj_report *dj_report) | 585 | struct dj_report *dj_report) |
586 | { | 586 | { |
587 | struct hid_device *hdev = djrcv_dev->hdev; | 587 | struct hid_device *hdev = djrcv_dev->hdev; |
588 | struct hid_report *report; | 588 | struct hid_report *report; |
589 | struct hid_report_enum *output_report_enum; | 589 | struct hid_report_enum *output_report_enum; |
590 | u8 *data = (u8 *)(&dj_report->device_index); | 590 | u8 *data = (u8 *)(&dj_report->device_index); |
591 | unsigned int i; | 591 | unsigned int i; |
592 | 592 | ||
593 | output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; | 593 | output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; |
594 | report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT]; | 594 | report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT]; |
595 | 595 | ||
596 | if (!report) { | 596 | if (!report) { |
597 | dev_err(&hdev->dev, "%s: unable to find dj report\n", __func__); | 597 | dev_err(&hdev->dev, "%s: unable to find dj report\n", __func__); |
598 | return -ENODEV; | 598 | return -ENODEV; |
599 | } | 599 | } |
600 | 600 | ||
601 | for (i = 0; i < DJREPORT_SHORT_LENGTH - 1; i++) | 601 | for (i = 0; i < DJREPORT_SHORT_LENGTH - 1; i++) |
602 | report->field[0]->value[i] = data[i]; | 602 | report->field[0]->value[i] = data[i]; |
603 | 603 | ||
604 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); | 604 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); |
605 | 605 | ||
606 | return 0; | 606 | return 0; |
607 | } | 607 | } |
608 | 608 | ||
609 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | 609 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) |
610 | { | 610 | { |
611 | struct dj_report *dj_report; | 611 | struct dj_report *dj_report; |
612 | int retval; | 612 | int retval; |
613 | 613 | ||
614 | /* no need to protect djrcv_dev->querying_devices */ | 614 | /* no need to protect djrcv_dev->querying_devices */ |
615 | if (djrcv_dev->querying_devices) | 615 | if (djrcv_dev->querying_devices) |
616 | return 0; | 616 | return 0; |
617 | 617 | ||
618 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); | 618 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); |
619 | if (!dj_report) | 619 | if (!dj_report) |
620 | return -ENOMEM; | 620 | return -ENOMEM; |
621 | dj_report->report_id = REPORT_ID_DJ_SHORT; | 621 | dj_report->report_id = REPORT_ID_DJ_SHORT; |
622 | dj_report->device_index = 0xFF; | 622 | dj_report->device_index = 0xFF; |
623 | dj_report->report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES; | 623 | dj_report->report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES; |
624 | retval = logi_dj_recv_send_report(djrcv_dev, dj_report); | 624 | retval = logi_dj_recv_send_report(djrcv_dev, dj_report); |
625 | kfree(dj_report); | 625 | kfree(dj_report); |
626 | return retval; | 626 | return retval; |
627 | } | 627 | } |
628 | 628 | ||
629 | 629 | ||
630 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, | 630 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, |
631 | unsigned timeout) | 631 | unsigned timeout) |
632 | { | 632 | { |
633 | struct hid_device *hdev = djrcv_dev->hdev; | 633 | struct hid_device *hdev = djrcv_dev->hdev; |
634 | struct dj_report *dj_report; | 634 | struct dj_report *dj_report; |
635 | u8 *buf; | 635 | u8 *buf; |
636 | int retval; | 636 | int retval; |
637 | 637 | ||
638 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); | 638 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); |
639 | if (!dj_report) | 639 | if (!dj_report) |
640 | return -ENOMEM; | 640 | return -ENOMEM; |
641 | dj_report->report_id = REPORT_ID_DJ_SHORT; | 641 | dj_report->report_id = REPORT_ID_DJ_SHORT; |
642 | dj_report->device_index = 0xFF; | 642 | dj_report->device_index = 0xFF; |
643 | dj_report->report_type = REPORT_TYPE_CMD_SWITCH; | 643 | dj_report->report_type = REPORT_TYPE_CMD_SWITCH; |
644 | dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F; | 644 | dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F; |
645 | dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; | 645 | dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; |
646 | retval = logi_dj_recv_send_report(djrcv_dev, dj_report); | 646 | retval = logi_dj_recv_send_report(djrcv_dev, dj_report); |
647 | 647 | ||
648 | /* | 648 | /* |
649 | * Ugly sleep to work around a USB 3.0 bug when the receiver is still | 649 | * Ugly sleep to work around a USB 3.0 bug when the receiver is still |
650 | * processing the "switch-to-dj" command while we send an other command. | 650 | * processing the "switch-to-dj" command while we send an other command. |
651 | * 50 msec should gives enough time to the receiver to be ready. | 651 | * 50 msec should gives enough time to the receiver to be ready. |
652 | */ | 652 | */ |
653 | msleep(50); | 653 | msleep(50); |
654 | 654 | ||
655 | /* | 655 | /* |
656 | * Magical bits to set up hidpp notifications when the dj devices | 656 | * Magical bits to set up hidpp notifications when the dj devices |
657 | * are connected/disconnected. | 657 | * are connected/disconnected. |
658 | * | 658 | * |
659 | * We can reuse dj_report because HIDPP_REPORT_SHORT_LENGTH is smaller | 659 | * We can reuse dj_report because HIDPP_REPORT_SHORT_LENGTH is smaller |
660 | * than DJREPORT_SHORT_LENGTH. | 660 | * than DJREPORT_SHORT_LENGTH. |
661 | */ | 661 | */ |
662 | buf = (u8 *)dj_report; | 662 | buf = (u8 *)dj_report; |
663 | 663 | ||
664 | memset(buf, 0, HIDPP_REPORT_SHORT_LENGTH); | 664 | memset(buf, 0, HIDPP_REPORT_SHORT_LENGTH); |
665 | 665 | ||
666 | buf[0] = REPORT_ID_HIDPP_SHORT; | 666 | buf[0] = REPORT_ID_HIDPP_SHORT; |
667 | buf[1] = 0xFF; | 667 | buf[1] = 0xFF; |
668 | buf[2] = 0x80; | 668 | buf[2] = 0x80; |
669 | buf[3] = 0x00; | 669 | buf[3] = 0x00; |
670 | buf[4] = 0x00; | 670 | buf[4] = 0x00; |
671 | buf[5] = 0x09; | 671 | buf[5] = 0x09; |
672 | buf[6] = 0x00; | 672 | buf[6] = 0x00; |
673 | 673 | ||
674 | hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf, | 674 | hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf, |
675 | HIDPP_REPORT_SHORT_LENGTH, HID_OUTPUT_REPORT, | 675 | HIDPP_REPORT_SHORT_LENGTH, HID_OUTPUT_REPORT, |
676 | HID_REQ_SET_REPORT); | 676 | HID_REQ_SET_REPORT); |
677 | 677 | ||
678 | kfree(dj_report); | 678 | kfree(dj_report); |
679 | return retval; | 679 | return retval; |
680 | } | 680 | } |
681 | 681 | ||
682 | 682 | ||
683 | static int logi_dj_ll_open(struct hid_device *hid) | 683 | static int logi_dj_ll_open(struct hid_device *hid) |
684 | { | 684 | { |
685 | dbg_hid("%s:%s\n", __func__, hid->phys); | 685 | dbg_hid("%s:%s\n", __func__, hid->phys); |
686 | return 0; | 686 | return 0; |
687 | 687 | ||
688 | } | 688 | } |
689 | 689 | ||
690 | static void logi_dj_ll_close(struct hid_device *hid) | 690 | static void logi_dj_ll_close(struct hid_device *hid) |
691 | { | 691 | { |
692 | dbg_hid("%s:%s\n", __func__, hid->phys); | 692 | dbg_hid("%s:%s\n", __func__, hid->phys); |
693 | } | 693 | } |
694 | 694 | ||
695 | static u8 unifying_name_query[] = {0x10, 0xff, 0x83, 0xb5, 0x40, 0x00, 0x00}; | 695 | static u8 unifying_name_query[] = {0x10, 0xff, 0x83, 0xb5, 0x40, 0x00, 0x00}; |
696 | static u8 unifying_name_answer[] = {0x11, 0xff, 0x83, 0xb5}; | 696 | static u8 unifying_name_answer[] = {0x11, 0xff, 0x83, 0xb5}; |
697 | 697 | ||
698 | static int logi_dj_ll_raw_request(struct hid_device *hid, | 698 | static int logi_dj_ll_raw_request(struct hid_device *hid, |
699 | unsigned char reportnum, __u8 *buf, | 699 | unsigned char reportnum, __u8 *buf, |
700 | size_t count, unsigned char report_type, | 700 | size_t count, unsigned char report_type, |
701 | int reqtype) | 701 | int reqtype) |
702 | { | 702 | { |
703 | struct dj_device *djdev = hid->driver_data; | 703 | struct dj_device *djdev = hid->driver_data; |
704 | struct dj_receiver_dev *djrcv_dev = djdev->dj_receiver_dev; | 704 | struct dj_receiver_dev *djrcv_dev = djdev->dj_receiver_dev; |
705 | u8 *out_buf; | 705 | u8 *out_buf; |
706 | int ret; | 706 | int ret; |
707 | 707 | ||
708 | if ((buf[0] == REPORT_ID_HIDPP_SHORT) || | 708 | if ((buf[0] == REPORT_ID_HIDPP_SHORT) || |
709 | (buf[0] == REPORT_ID_HIDPP_LONG)) { | 709 | (buf[0] == REPORT_ID_HIDPP_LONG)) { |
710 | if (count < 2) | 710 | if (count < 2) |
711 | return -EINVAL; | 711 | return -EINVAL; |
712 | 712 | ||
713 | /* special case where we should not overwrite | 713 | /* special case where we should not overwrite |
714 | * the device_index */ | 714 | * the device_index */ |
715 | if (count == 7 && !memcmp(buf, unifying_name_query, | 715 | if (count == 7 && !memcmp(buf, unifying_name_query, |
716 | sizeof(unifying_name_query))) | 716 | sizeof(unifying_name_query))) |
717 | buf[4] |= djdev->device_index - 1; | 717 | buf[4] |= djdev->device_index - 1; |
718 | else | 718 | else |
719 | buf[1] = djdev->device_index; | 719 | buf[1] = djdev->device_index; |
720 | return hid_hw_raw_request(djrcv_dev->hdev, reportnum, buf, | 720 | return hid_hw_raw_request(djrcv_dev->hdev, reportnum, buf, |
721 | count, report_type, reqtype); | 721 | count, report_type, reqtype); |
722 | } | 722 | } |
723 | 723 | ||
724 | if (buf[0] != REPORT_TYPE_LEDS) | 724 | if (buf[0] != REPORT_TYPE_LEDS) |
725 | return -EINVAL; | 725 | return -EINVAL; |
726 | 726 | ||
727 | out_buf = kzalloc(DJREPORT_SHORT_LENGTH, GFP_ATOMIC); | 727 | out_buf = kzalloc(DJREPORT_SHORT_LENGTH, GFP_ATOMIC); |
728 | if (!out_buf) | 728 | if (!out_buf) |
729 | return -ENOMEM; | 729 | return -ENOMEM; |
730 | 730 | ||
731 | if (count > DJREPORT_SHORT_LENGTH - 2) | 731 | if (count > DJREPORT_SHORT_LENGTH - 2) |
732 | count = DJREPORT_SHORT_LENGTH - 2; | 732 | count = DJREPORT_SHORT_LENGTH - 2; |
733 | 733 | ||
734 | out_buf[0] = REPORT_ID_DJ_SHORT; | 734 | out_buf[0] = REPORT_ID_DJ_SHORT; |
735 | out_buf[1] = djdev->device_index; | 735 | out_buf[1] = djdev->device_index; |
736 | memcpy(out_buf + 2, buf, count); | 736 | memcpy(out_buf + 2, buf, count); |
737 | 737 | ||
738 | ret = hid_hw_raw_request(djrcv_dev->hdev, out_buf[0], out_buf, | 738 | ret = hid_hw_raw_request(djrcv_dev->hdev, out_buf[0], out_buf, |
739 | DJREPORT_SHORT_LENGTH, report_type, reqtype); | 739 | DJREPORT_SHORT_LENGTH, report_type, reqtype); |
740 | 740 | ||
741 | kfree(out_buf); | 741 | kfree(out_buf); |
742 | return ret; | 742 | return ret; |
743 | } | 743 | } |
744 | 744 | ||
745 | static void rdcat(char *rdesc, unsigned int *rsize, const char *data, unsigned int size) | 745 | static void rdcat(char *rdesc, unsigned int *rsize, const char *data, unsigned int size) |
746 | { | 746 | { |
747 | memcpy(rdesc + *rsize, data, size); | 747 | memcpy(rdesc + *rsize, data, size); |
748 | *rsize += size; | 748 | *rsize += size; |
749 | } | 749 | } |
750 | 750 | ||
751 | static int logi_dj_ll_parse(struct hid_device *hid) | 751 | static int logi_dj_ll_parse(struct hid_device *hid) |
752 | { | 752 | { |
753 | struct dj_device *djdev = hid->driver_data; | 753 | struct dj_device *djdev = hid->driver_data; |
754 | unsigned int rsize = 0; | 754 | unsigned int rsize = 0; |
755 | char *rdesc; | 755 | char *rdesc; |
756 | int retval; | 756 | int retval; |
757 | 757 | ||
758 | dbg_hid("%s\n", __func__); | 758 | dbg_hid("%s\n", __func__); |
759 | 759 | ||
760 | djdev->hdev->version = 0x0111; | 760 | djdev->hdev->version = 0x0111; |
761 | djdev->hdev->country = 0x00; | 761 | djdev->hdev->country = 0x00; |
762 | 762 | ||
763 | rdesc = kmalloc(MAX_RDESC_SIZE, GFP_KERNEL); | 763 | rdesc = kmalloc(MAX_RDESC_SIZE, GFP_KERNEL); |
764 | if (!rdesc) | 764 | if (!rdesc) |
765 | return -ENOMEM; | 765 | return -ENOMEM; |
766 | 766 | ||
767 | if (djdev->reports_supported & STD_KEYBOARD) { | 767 | if (djdev->reports_supported & STD_KEYBOARD) { |
768 | dbg_hid("%s: sending a kbd descriptor, reports_supported: %x\n", | 768 | dbg_hid("%s: sending a kbd descriptor, reports_supported: %x\n", |
769 | __func__, djdev->reports_supported); | 769 | __func__, djdev->reports_supported); |
770 | rdcat(rdesc, &rsize, kbd_descriptor, sizeof(kbd_descriptor)); | 770 | rdcat(rdesc, &rsize, kbd_descriptor, sizeof(kbd_descriptor)); |
771 | } | 771 | } |
772 | 772 | ||
773 | if (djdev->reports_supported & STD_MOUSE) { | 773 | if (djdev->reports_supported & STD_MOUSE) { |
774 | dbg_hid("%s: sending a mouse descriptor, reports_supported: " | 774 | dbg_hid("%s: sending a mouse descriptor, reports_supported: " |
775 | "%x\n", __func__, djdev->reports_supported); | 775 | "%x\n", __func__, djdev->reports_supported); |
776 | rdcat(rdesc, &rsize, mse_descriptor, sizeof(mse_descriptor)); | 776 | rdcat(rdesc, &rsize, mse_descriptor, sizeof(mse_descriptor)); |
777 | } | 777 | } |
778 | 778 | ||
779 | if (djdev->reports_supported & MULTIMEDIA) { | 779 | if (djdev->reports_supported & MULTIMEDIA) { |
780 | dbg_hid("%s: sending a multimedia report descriptor: %x\n", | 780 | dbg_hid("%s: sending a multimedia report descriptor: %x\n", |
781 | __func__, djdev->reports_supported); | 781 | __func__, djdev->reports_supported); |
782 | rdcat(rdesc, &rsize, consumer_descriptor, sizeof(consumer_descriptor)); | 782 | rdcat(rdesc, &rsize, consumer_descriptor, sizeof(consumer_descriptor)); |
783 | } | 783 | } |
784 | 784 | ||
785 | if (djdev->reports_supported & POWER_KEYS) { | 785 | if (djdev->reports_supported & POWER_KEYS) { |
786 | dbg_hid("%s: sending a power keys report descriptor: %x\n", | 786 | dbg_hid("%s: sending a power keys report descriptor: %x\n", |
787 | __func__, djdev->reports_supported); | 787 | __func__, djdev->reports_supported); |
788 | rdcat(rdesc, &rsize, syscontrol_descriptor, sizeof(syscontrol_descriptor)); | 788 | rdcat(rdesc, &rsize, syscontrol_descriptor, sizeof(syscontrol_descriptor)); |
789 | } | 789 | } |
790 | 790 | ||
791 | if (djdev->reports_supported & MEDIA_CENTER) { | 791 | if (djdev->reports_supported & MEDIA_CENTER) { |
792 | dbg_hid("%s: sending a media center report descriptor: %x\n", | 792 | dbg_hid("%s: sending a media center report descriptor: %x\n", |
793 | __func__, djdev->reports_supported); | 793 | __func__, djdev->reports_supported); |
794 | rdcat(rdesc, &rsize, media_descriptor, sizeof(media_descriptor)); | 794 | rdcat(rdesc, &rsize, media_descriptor, sizeof(media_descriptor)); |
795 | } | 795 | } |
796 | 796 | ||
797 | if (djdev->reports_supported & KBD_LEDS) { | 797 | if (djdev->reports_supported & KBD_LEDS) { |
798 | dbg_hid("%s: need to send kbd leds report descriptor: %x\n", | 798 | dbg_hid("%s: need to send kbd leds report descriptor: %x\n", |
799 | __func__, djdev->reports_supported); | 799 | __func__, djdev->reports_supported); |
800 | } | 800 | } |
801 | 801 | ||
802 | rdcat(rdesc, &rsize, hidpp_descriptor, sizeof(hidpp_descriptor)); | 802 | rdcat(rdesc, &rsize, hidpp_descriptor, sizeof(hidpp_descriptor)); |
803 | 803 | ||
804 | retval = hid_parse_report(hid, rdesc, rsize); | 804 | retval = hid_parse_report(hid, rdesc, rsize); |
805 | kfree(rdesc); | 805 | kfree(rdesc); |
806 | 806 | ||
807 | return retval; | 807 | return retval; |
808 | } | 808 | } |
809 | 809 | ||
810 | static int logi_dj_ll_start(struct hid_device *hid) | 810 | static int logi_dj_ll_start(struct hid_device *hid) |
811 | { | 811 | { |
812 | dbg_hid("%s\n", __func__); | 812 | dbg_hid("%s\n", __func__); |
813 | return 0; | 813 | return 0; |
814 | } | 814 | } |
815 | 815 | ||
816 | static void logi_dj_ll_stop(struct hid_device *hid) | 816 | static void logi_dj_ll_stop(struct hid_device *hid) |
817 | { | 817 | { |
818 | dbg_hid("%s\n", __func__); | 818 | dbg_hid("%s\n", __func__); |
819 | } | 819 | } |
820 | 820 | ||
821 | 821 | ||
822 | static struct hid_ll_driver logi_dj_ll_driver = { | 822 | static struct hid_ll_driver logi_dj_ll_driver = { |
823 | .parse = logi_dj_ll_parse, | 823 | .parse = logi_dj_ll_parse, |
824 | .start = logi_dj_ll_start, | 824 | .start = logi_dj_ll_start, |
825 | .stop = logi_dj_ll_stop, | 825 | .stop = logi_dj_ll_stop, |
826 | .open = logi_dj_ll_open, | 826 | .open = logi_dj_ll_open, |
827 | .close = logi_dj_ll_close, | 827 | .close = logi_dj_ll_close, |
828 | .raw_request = logi_dj_ll_raw_request, | 828 | .raw_request = logi_dj_ll_raw_request, |
829 | }; | 829 | }; |
830 | 830 | ||
831 | static int logi_dj_dj_event(struct hid_device *hdev, | 831 | static int logi_dj_dj_event(struct hid_device *hdev, |
832 | struct hid_report *report, u8 *data, | 832 | struct hid_report *report, u8 *data, |
833 | int size) | 833 | int size) |
834 | { | 834 | { |
835 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); | 835 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); |
836 | struct dj_report *dj_report = (struct dj_report *) data; | 836 | struct dj_report *dj_report = (struct dj_report *) data; |
837 | unsigned long flags; | 837 | unsigned long flags; |
838 | 838 | ||
839 | /* | 839 | /* |
840 | * Here we receive all data coming from iface 2, there are 3 cases: | 840 | * Here we receive all data coming from iface 2, there are 3 cases: |
841 | * | 841 | * |
842 | * 1) Data is intended for this driver i. e. data contains arrival, | 842 | * 1) Data is intended for this driver i. e. data contains arrival, |
843 | * departure, etc notifications, in which case we queue them for delayed | 843 | * departure, etc notifications, in which case we queue them for delayed |
844 | * processing by the work queue. We return 1 to hid-core as no further | 844 | * processing by the work queue. We return 1 to hid-core as no further |
845 | * processing is required from it. | 845 | * processing is required from it. |
846 | * | 846 | * |
847 | * 2) Data informs a connection change, if the change means rf link | 847 | * 2) Data informs a connection change, if the change means rf link |
848 | * loss, then we must send a null report to the upper layer to discard | 848 | * loss, then we must send a null report to the upper layer to discard |
849 | * potentially pressed keys that may be repeated forever by the input | 849 | * potentially pressed keys that may be repeated forever by the input |
850 | * layer. Return 1 to hid-core as no further processing is required. | 850 | * layer. Return 1 to hid-core as no further processing is required. |
851 | * | 851 | * |
852 | * 3) Data is an actual input event from a paired DJ device in which | 852 | * 3) Data is an actual input event from a paired DJ device in which |
853 | * case we forward it to the correct hid device (via hid_input_report() | 853 | * case we forward it to the correct hid device (via hid_input_report() |
854 | * ) and return 1 so hid-core does not anything else with it. | 854 | * ) and return 1 so hid-core does not anything else with it. |
855 | */ | 855 | */ |
856 | 856 | ||
857 | if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || | 857 | if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || |
858 | (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { | 858 | (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { |
859 | /* | 859 | /* |
860 | * Device index is wrong, bail out. | 860 | * Device index is wrong, bail out. |
861 | * This driver can ignore safely the receiver notifications, | 861 | * This driver can ignore safely the receiver notifications, |
862 | * so ignore those reports too. | 862 | * so ignore those reports too. |
863 | */ | 863 | */ |
864 | if (dj_report->device_index != DJ_RECEIVER_INDEX) | 864 | if (dj_report->device_index != DJ_RECEIVER_INDEX) |
865 | dev_err(&hdev->dev, "%s: invalid device index:%d\n", | 865 | dev_err(&hdev->dev, "%s: invalid device index:%d\n", |
866 | __func__, dj_report->device_index); | 866 | __func__, dj_report->device_index); |
867 | return false; | 867 | return false; |
868 | } | 868 | } |
869 | 869 | ||
870 | spin_lock_irqsave(&djrcv_dev->lock, flags); | 870 | spin_lock_irqsave(&djrcv_dev->lock, flags); |
871 | 871 | ||
872 | if (!djrcv_dev->paired_dj_devices[dj_report->device_index]) { | 872 | if (!djrcv_dev->paired_dj_devices[dj_report->device_index]) { |
873 | /* received an event for an unknown device, bail out */ | 873 | /* received an event for an unknown device, bail out */ |
874 | logi_dj_recv_queue_notification(djrcv_dev, dj_report); | 874 | logi_dj_recv_queue_notification(djrcv_dev, dj_report); |
875 | goto out; | 875 | goto out; |
876 | } | 876 | } |
877 | 877 | ||
878 | switch (dj_report->report_type) { | 878 | switch (dj_report->report_type) { |
879 | case REPORT_TYPE_NOTIF_DEVICE_PAIRED: | 879 | case REPORT_TYPE_NOTIF_DEVICE_PAIRED: |
880 | /* pairing notifications are handled above the switch */ | 880 | /* pairing notifications are handled above the switch */ |
881 | break; | 881 | break; |
882 | case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: | 882 | case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: |
883 | logi_dj_recv_queue_notification(djrcv_dev, dj_report); | 883 | logi_dj_recv_queue_notification(djrcv_dev, dj_report); |
884 | break; | 884 | break; |
885 | case REPORT_TYPE_NOTIF_CONNECTION_STATUS: | 885 | case REPORT_TYPE_NOTIF_CONNECTION_STATUS: |
886 | if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == | 886 | if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == |
887 | STATUS_LINKLOSS) { | 887 | STATUS_LINKLOSS) { |
888 | logi_dj_recv_forward_null_report(djrcv_dev, dj_report); | 888 | logi_dj_recv_forward_null_report(djrcv_dev, dj_report); |
889 | } | 889 | } |
890 | break; | 890 | break; |
891 | default: | 891 | default: |
892 | logi_dj_recv_forward_report(djrcv_dev, dj_report); | 892 | logi_dj_recv_forward_report(djrcv_dev, dj_report); |
893 | } | 893 | } |
894 | 894 | ||
895 | out: | 895 | out: |
896 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); | 896 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); |
897 | 897 | ||
898 | return true; | 898 | return true; |
899 | } | 899 | } |
900 | 900 | ||
901 | static int logi_dj_hidpp_event(struct hid_device *hdev, | 901 | static int logi_dj_hidpp_event(struct hid_device *hdev, |
902 | struct hid_report *report, u8 *data, | 902 | struct hid_report *report, u8 *data, |
903 | int size) | 903 | int size) |
904 | { | 904 | { |
905 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); | 905 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); |
906 | struct dj_report *dj_report = (struct dj_report *) data; | 906 | struct dj_report *dj_report = (struct dj_report *) data; |
907 | unsigned long flags; | 907 | unsigned long flags; |
908 | u8 device_index = dj_report->device_index; | 908 | u8 device_index = dj_report->device_index; |
909 | 909 | ||
910 | if (device_index == HIDPP_RECEIVER_INDEX) { | 910 | if (device_index == HIDPP_RECEIVER_INDEX) { |
911 | /* special case were the device wants to know its unifying | 911 | /* special case were the device wants to know its unifying |
912 | * name */ | 912 | * name */ |
913 | if (size == HIDPP_REPORT_LONG_LENGTH && | 913 | if (size == HIDPP_REPORT_LONG_LENGTH && |
914 | !memcmp(data, unifying_name_answer, | 914 | !memcmp(data, unifying_name_answer, |
915 | sizeof(unifying_name_answer)) && | 915 | sizeof(unifying_name_answer)) && |
916 | ((data[4] & 0xF0) == 0x40)) | 916 | ((data[4] & 0xF0) == 0x40)) |
917 | device_index = (data[4] & 0x0F) + 1; | 917 | device_index = (data[4] & 0x0F) + 1; |
918 | else | 918 | else |
919 | return false; | 919 | return false; |
920 | } | 920 | } |
921 | 921 | ||
922 | /* | 922 | /* |
923 | * Data is from the HID++ collection, in this case, we forward the | 923 | * Data is from the HID++ collection, in this case, we forward the |
924 | * data to the corresponding child dj device and return 0 to hid-core | 924 | * data to the corresponding child dj device and return 0 to hid-core |
925 | * so he data also goes to the hidraw device of the receiver. This | 925 | * so he data also goes to the hidraw device of the receiver. This |
926 | * allows a user space application to implement the full HID++ routing | 926 | * allows a user space application to implement the full HID++ routing |
927 | * via the receiver. | 927 | * via the receiver. |
928 | */ | 928 | */ |
929 | 929 | ||
930 | if ((device_index < DJ_DEVICE_INDEX_MIN) || | 930 | if ((device_index < DJ_DEVICE_INDEX_MIN) || |
931 | (device_index > DJ_DEVICE_INDEX_MAX)) { | 931 | (device_index > DJ_DEVICE_INDEX_MAX)) { |
932 | /* | 932 | /* |
933 | * Device index is wrong, bail out. | 933 | * Device index is wrong, bail out. |
934 | * This driver can ignore safely the receiver notifications, | 934 | * This driver can ignore safely the receiver notifications, |
935 | * so ignore those reports too. | 935 | * so ignore those reports too. |
936 | */ | 936 | */ |
937 | dev_err(&hdev->dev, "%s: invalid device index:%d\n", | 937 | dev_err(&hdev->dev, "%s: invalid device index:%d\n", |
938 | __func__, dj_report->device_index); | 938 | __func__, dj_report->device_index); |
939 | return false; | 939 | return false; |
940 | } | 940 | } |
941 | 941 | ||
942 | spin_lock_irqsave(&djrcv_dev->lock, flags); | 942 | spin_lock_irqsave(&djrcv_dev->lock, flags); |
943 | 943 | ||
944 | if (!djrcv_dev->paired_dj_devices[device_index]) | 944 | if (!djrcv_dev->paired_dj_devices[device_index]) |
945 | /* received an event for an unknown device, bail out */ | 945 | /* received an event for an unknown device, bail out */ |
946 | goto out; | 946 | goto out; |
947 | 947 | ||
948 | logi_dj_recv_forward_hidpp(djrcv_dev->paired_dj_devices[device_index], | 948 | logi_dj_recv_forward_hidpp(djrcv_dev->paired_dj_devices[device_index], |
949 | data, size); | 949 | data, size); |
950 | 950 | ||
951 | out: | 951 | out: |
952 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); | 952 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); |
953 | 953 | ||
954 | return false; | 954 | return false; |
955 | } | 955 | } |
956 | 956 | ||
957 | static int logi_dj_raw_event(struct hid_device *hdev, | 957 | static int logi_dj_raw_event(struct hid_device *hdev, |
958 | struct hid_report *report, u8 *data, | 958 | struct hid_report *report, u8 *data, |
959 | int size) | 959 | int size) |
960 | { | 960 | { |
961 | dbg_hid("%s, size:%d\n", __func__, size); | 961 | dbg_hid("%s, size:%d\n", __func__, size); |
962 | 962 | ||
963 | switch (data[0]) { | 963 | switch (data[0]) { |
964 | case REPORT_ID_DJ_SHORT: | 964 | case REPORT_ID_DJ_SHORT: |
965 | if (size != DJREPORT_SHORT_LENGTH) { | ||
966 | dev_err(&hdev->dev, "DJ report of bad size (%d)", size); | ||
967 | return false; | ||
968 | } | ||
965 | return logi_dj_dj_event(hdev, report, data, size); | 969 | return logi_dj_dj_event(hdev, report, data, size); |
966 | case REPORT_ID_HIDPP_SHORT: | 970 | case REPORT_ID_HIDPP_SHORT: |
967 | /* intentional fallthrough */ | 971 | if (size != HIDPP_REPORT_SHORT_LENGTH) { |
972 | dev_err(&hdev->dev, | ||
973 | "Short HID++ report of bad size (%d)", size); | ||
974 | return false; | ||
975 | } | ||
976 | return logi_dj_hidpp_event(hdev, report, data, size); | ||
968 | case REPORT_ID_HIDPP_LONG: | 977 | case REPORT_ID_HIDPP_LONG: |
978 | if (size != HIDPP_REPORT_LONG_LENGTH) { | ||
979 | dev_err(&hdev->dev, | ||
980 | "Long HID++ report of bad size (%d)", size); | ||
981 | return false; | ||
982 | } | ||
969 | return logi_dj_hidpp_event(hdev, report, data, size); | 983 | return logi_dj_hidpp_event(hdev, report, data, size); |
970 | } | 984 | } |
971 | 985 | ||
972 | return false; | 986 | return false; |
973 | } | 987 | } |
974 | 988 | ||
975 | static int logi_dj_probe(struct hid_device *hdev, | 989 | static int logi_dj_probe(struct hid_device *hdev, |
976 | const struct hid_device_id *id) | 990 | const struct hid_device_id *id) |
977 | { | 991 | { |
978 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 992 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
979 | struct dj_receiver_dev *djrcv_dev; | 993 | struct dj_receiver_dev *djrcv_dev; |
980 | int retval; | 994 | int retval; |
981 | 995 | ||
982 | dbg_hid("%s called for ifnum %d\n", __func__, | 996 | dbg_hid("%s called for ifnum %d\n", __func__, |
983 | intf->cur_altsetting->desc.bInterfaceNumber); | 997 | intf->cur_altsetting->desc.bInterfaceNumber); |
984 | 998 | ||
985 | /* Ignore interfaces 0 and 1, they will not carry any data, dont create | 999 | /* Ignore interfaces 0 and 1, they will not carry any data, dont create |
986 | * any hid_device for them */ | 1000 | * any hid_device for them */ |
987 | if (intf->cur_altsetting->desc.bInterfaceNumber != | 1001 | if (intf->cur_altsetting->desc.bInterfaceNumber != |
988 | LOGITECH_DJ_INTERFACE_NUMBER) { | 1002 | LOGITECH_DJ_INTERFACE_NUMBER) { |
989 | dbg_hid("%s: ignoring ifnum %d\n", __func__, | 1003 | dbg_hid("%s: ignoring ifnum %d\n", __func__, |
990 | intf->cur_altsetting->desc.bInterfaceNumber); | 1004 | intf->cur_altsetting->desc.bInterfaceNumber); |
991 | return -ENODEV; | 1005 | return -ENODEV; |
992 | } | 1006 | } |
993 | 1007 | ||
994 | /* Treat interface 2 */ | 1008 | /* Treat interface 2 */ |
995 | 1009 | ||
996 | djrcv_dev = kzalloc(sizeof(struct dj_receiver_dev), GFP_KERNEL); | 1010 | djrcv_dev = kzalloc(sizeof(struct dj_receiver_dev), GFP_KERNEL); |
997 | if (!djrcv_dev) { | 1011 | if (!djrcv_dev) { |
998 | dev_err(&hdev->dev, | 1012 | dev_err(&hdev->dev, |
999 | "%s:failed allocating dj_receiver_dev\n", __func__); | 1013 | "%s:failed allocating dj_receiver_dev\n", __func__); |
1000 | return -ENOMEM; | 1014 | return -ENOMEM; |
1001 | } | 1015 | } |
1002 | djrcv_dev->hdev = hdev; | 1016 | djrcv_dev->hdev = hdev; |
1003 | INIT_WORK(&djrcv_dev->work, delayedwork_callback); | 1017 | INIT_WORK(&djrcv_dev->work, delayedwork_callback); |
1004 | spin_lock_init(&djrcv_dev->lock); | 1018 | spin_lock_init(&djrcv_dev->lock); |
1005 | if (kfifo_alloc(&djrcv_dev->notif_fifo, | 1019 | if (kfifo_alloc(&djrcv_dev->notif_fifo, |
1006 | DJ_MAX_NUMBER_NOTIFICATIONS * sizeof(struct dj_report), | 1020 | DJ_MAX_NUMBER_NOTIFICATIONS * sizeof(struct dj_report), |
1007 | GFP_KERNEL)) { | 1021 | GFP_KERNEL)) { |
1008 | dev_err(&hdev->dev, | 1022 | dev_err(&hdev->dev, |
1009 | "%s:failed allocating notif_fifo\n", __func__); | 1023 | "%s:failed allocating notif_fifo\n", __func__); |
1010 | kfree(djrcv_dev); | 1024 | kfree(djrcv_dev); |
1011 | return -ENOMEM; | 1025 | return -ENOMEM; |
1012 | } | 1026 | } |
1013 | hid_set_drvdata(hdev, djrcv_dev); | 1027 | hid_set_drvdata(hdev, djrcv_dev); |
1014 | 1028 | ||
1015 | /* Call to usbhid to fetch the HID descriptors of interface 2 and | 1029 | /* Call to usbhid to fetch the HID descriptors of interface 2 and |
1016 | * subsequently call to the hid/hid-core to parse the fetched | 1030 | * subsequently call to the hid/hid-core to parse the fetched |
1017 | * descriptors, this will in turn create the hidraw and hiddev nodes | 1031 | * descriptors, this will in turn create the hidraw and hiddev nodes |
1018 | * for interface 2 of the receiver */ | 1032 | * for interface 2 of the receiver */ |
1019 | retval = hid_parse(hdev); | 1033 | retval = hid_parse(hdev); |
1020 | if (retval) { | 1034 | if (retval) { |
1021 | dev_err(&hdev->dev, | 1035 | dev_err(&hdev->dev, |
1022 | "%s:parse of interface 2 failed\n", __func__); | 1036 | "%s:parse of interface 2 failed\n", __func__); |
1023 | goto hid_parse_fail; | 1037 | goto hid_parse_fail; |
1024 | } | 1038 | } |
1025 | 1039 | ||
1026 | if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, REPORT_ID_DJ_SHORT, | 1040 | if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, REPORT_ID_DJ_SHORT, |
1027 | 0, DJREPORT_SHORT_LENGTH - 1)) { | 1041 | 0, DJREPORT_SHORT_LENGTH - 1)) { |
1028 | retval = -ENODEV; | 1042 | retval = -ENODEV; |
1029 | goto hid_parse_fail; | 1043 | goto hid_parse_fail; |
1030 | } | 1044 | } |
1031 | 1045 | ||
1032 | /* Starts the usb device and connects to upper interfaces hiddev and | 1046 | /* Starts the usb device and connects to upper interfaces hiddev and |
1033 | * hidraw */ | 1047 | * hidraw */ |
1034 | retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 1048 | retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
1035 | if (retval) { | 1049 | if (retval) { |
1036 | dev_err(&hdev->dev, | 1050 | dev_err(&hdev->dev, |
1037 | "%s:hid_hw_start returned error\n", __func__); | 1051 | "%s:hid_hw_start returned error\n", __func__); |
1038 | goto hid_hw_start_fail; | 1052 | goto hid_hw_start_fail; |
1039 | } | 1053 | } |
1040 | 1054 | ||
1041 | retval = logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0); | 1055 | retval = logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0); |
1042 | if (retval < 0) { | 1056 | if (retval < 0) { |
1043 | dev_err(&hdev->dev, | 1057 | dev_err(&hdev->dev, |
1044 | "%s:logi_dj_recv_switch_to_dj_mode returned error:%d\n", | 1058 | "%s:logi_dj_recv_switch_to_dj_mode returned error:%d\n", |
1045 | __func__, retval); | 1059 | __func__, retval); |
1046 | goto switch_to_dj_mode_fail; | 1060 | goto switch_to_dj_mode_fail; |
1047 | } | 1061 | } |
1048 | 1062 | ||
1049 | /* This is enabling the polling urb on the IN endpoint */ | 1063 | /* This is enabling the polling urb on the IN endpoint */ |
1050 | retval = hid_hw_open(hdev); | 1064 | retval = hid_hw_open(hdev); |
1051 | if (retval < 0) { | 1065 | if (retval < 0) { |
1052 | dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n", | 1066 | dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n", |
1053 | __func__, retval); | 1067 | __func__, retval); |
1054 | goto llopen_failed; | 1068 | goto llopen_failed; |
1055 | } | 1069 | } |
1056 | 1070 | ||
1057 | /* Allow incoming packets to arrive: */ | 1071 | /* Allow incoming packets to arrive: */ |
1058 | hid_device_io_start(hdev); | 1072 | hid_device_io_start(hdev); |
1059 | 1073 | ||
1060 | retval = logi_dj_recv_query_paired_devices(djrcv_dev); | 1074 | retval = logi_dj_recv_query_paired_devices(djrcv_dev); |
1061 | if (retval < 0) { | 1075 | if (retval < 0) { |
1062 | dev_err(&hdev->dev, "%s:logi_dj_recv_query_paired_devices " | 1076 | dev_err(&hdev->dev, "%s:logi_dj_recv_query_paired_devices " |
1063 | "error:%d\n", __func__, retval); | 1077 | "error:%d\n", __func__, retval); |
1064 | goto logi_dj_recv_query_paired_devices_failed; | 1078 | goto logi_dj_recv_query_paired_devices_failed; |
1065 | } | 1079 | } |
1066 | 1080 | ||
1067 | return retval; | 1081 | return retval; |
1068 | 1082 | ||
1069 | logi_dj_recv_query_paired_devices_failed: | 1083 | logi_dj_recv_query_paired_devices_failed: |
1070 | hid_hw_close(hdev); | 1084 | hid_hw_close(hdev); |
1071 | 1085 | ||
1072 | llopen_failed: | 1086 | llopen_failed: |
1073 | switch_to_dj_mode_fail: | 1087 | switch_to_dj_mode_fail: |
1074 | hid_hw_stop(hdev); | 1088 | hid_hw_stop(hdev); |
1075 | 1089 | ||
1076 | hid_hw_start_fail: | 1090 | hid_hw_start_fail: |
1077 | hid_parse_fail: | 1091 | hid_parse_fail: |
1078 | kfifo_free(&djrcv_dev->notif_fifo); | 1092 | kfifo_free(&djrcv_dev->notif_fifo); |
1079 | kfree(djrcv_dev); | 1093 | kfree(djrcv_dev); |
1080 | hid_set_drvdata(hdev, NULL); | 1094 | hid_set_drvdata(hdev, NULL); |
1081 | return retval; | 1095 | return retval; |
1082 | 1096 | ||
1083 | } | 1097 | } |
1084 | 1098 | ||
1085 | #ifdef CONFIG_PM | 1099 | #ifdef CONFIG_PM |
1086 | static int logi_dj_reset_resume(struct hid_device *hdev) | 1100 | static int logi_dj_reset_resume(struct hid_device *hdev) |
1087 | { | 1101 | { |
1088 | int retval; | 1102 | int retval; |
1089 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); | 1103 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); |
1090 | 1104 | ||
1091 | retval = logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0); | 1105 | retval = logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0); |
1092 | if (retval < 0) { | 1106 | if (retval < 0) { |
1093 | dev_err(&hdev->dev, | 1107 | dev_err(&hdev->dev, |
1094 | "%s:logi_dj_recv_switch_to_dj_mode returned error:%d\n", | 1108 | "%s:logi_dj_recv_switch_to_dj_mode returned error:%d\n", |
1095 | __func__, retval); | 1109 | __func__, retval); |
1096 | } | 1110 | } |
1097 | 1111 | ||
1098 | return 0; | 1112 | return 0; |
1099 | } | 1113 | } |
1100 | #endif | 1114 | #endif |
1101 | 1115 | ||
1102 | static void logi_dj_remove(struct hid_device *hdev) | 1116 | static void logi_dj_remove(struct hid_device *hdev) |
1103 | { | 1117 | { |
1104 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); | 1118 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); |
1105 | struct dj_device *dj_dev; | 1119 | struct dj_device *dj_dev; |
1106 | int i; | 1120 | int i; |
1107 | 1121 | ||
1108 | dbg_hid("%s\n", __func__); | 1122 | dbg_hid("%s\n", __func__); |
1109 | 1123 | ||
1110 | cancel_work_sync(&djrcv_dev->work); | 1124 | cancel_work_sync(&djrcv_dev->work); |
1111 | 1125 | ||
1112 | hid_hw_close(hdev); | 1126 | hid_hw_close(hdev); |
1113 | hid_hw_stop(hdev); | 1127 | hid_hw_stop(hdev); |
1114 | 1128 | ||
1115 | /* I suppose that at this point the only context that can access | 1129 | /* I suppose that at this point the only context that can access |
1116 | * the djrecv_data is this thread as the work item is guaranteed to | 1130 | * the djrecv_data is this thread as the work item is guaranteed to |
1117 | * have finished and no more raw_event callbacks should arrive after | 1131 | * have finished and no more raw_event callbacks should arrive after |
1118 | * the remove callback was triggered so no locks are put around the | 1132 | * the remove callback was triggered so no locks are put around the |
1119 | * code below */ | 1133 | * code below */ |
1120 | for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) { | 1134 | for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) { |
1121 | dj_dev = djrcv_dev->paired_dj_devices[i]; | 1135 | dj_dev = djrcv_dev->paired_dj_devices[i]; |
1122 | if (dj_dev != NULL) { | 1136 | if (dj_dev != NULL) { |
1123 | hid_destroy_device(dj_dev->hdev); | 1137 | hid_destroy_device(dj_dev->hdev); |
1124 | kfree(dj_dev); | 1138 | kfree(dj_dev); |
1125 | djrcv_dev->paired_dj_devices[i] = NULL; | 1139 | djrcv_dev->paired_dj_devices[i] = NULL; |
1126 | } | 1140 | } |
1127 | } | 1141 | } |
1128 | 1142 | ||
1129 | kfifo_free(&djrcv_dev->notif_fifo); | 1143 | kfifo_free(&djrcv_dev->notif_fifo); |
1130 | kfree(djrcv_dev); | 1144 | kfree(djrcv_dev); |
1131 | hid_set_drvdata(hdev, NULL); | 1145 | hid_set_drvdata(hdev, NULL); |
1132 | } | 1146 | } |
1133 | 1147 | ||
1134 | static const struct hid_device_id logi_dj_receivers[] = { | 1148 | static const struct hid_device_id logi_dj_receivers[] = { |
1135 | {HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, | 1149 | {HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, |
1136 | USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER)}, | 1150 | USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER)}, |
1137 | {HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, | 1151 | {HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, |
1138 | USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2)}, | 1152 | USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2)}, |
1139 | {} | 1153 | {} |
1140 | }; | 1154 | }; |
1141 | 1155 | ||
1142 | MODULE_DEVICE_TABLE(hid, logi_dj_receivers); | 1156 | MODULE_DEVICE_TABLE(hid, logi_dj_receivers); |
1143 | 1157 | ||
1144 | static struct hid_driver logi_djreceiver_driver = { | 1158 | static struct hid_driver logi_djreceiver_driver = { |
1145 | .name = "logitech-djreceiver", | 1159 | .name = "logitech-djreceiver", |
1146 | .id_table = logi_dj_receivers, | 1160 | .id_table = logi_dj_receivers, |
1147 | .probe = logi_dj_probe, | 1161 | .probe = logi_dj_probe, |
1148 | .remove = logi_dj_remove, | 1162 | .remove = logi_dj_remove, |
1149 | .raw_event = logi_dj_raw_event, | 1163 | .raw_event = logi_dj_raw_event, |
1150 | #ifdef CONFIG_PM | 1164 | #ifdef CONFIG_PM |
1151 | .reset_resume = logi_dj_reset_resume, | 1165 | .reset_resume = logi_dj_reset_resume, |
1152 | #endif | 1166 | #endif |
1153 | }; | 1167 | }; |
1154 | 1168 | ||
1155 | module_hid_driver(logi_djreceiver_driver); | 1169 | module_hid_driver(logi_djreceiver_driver); |
1156 | 1170 | ||
1157 | MODULE_LICENSE("GPL"); | 1171 | MODULE_LICENSE("GPL"); |
1158 | MODULE_AUTHOR("Logitech"); | 1172 | MODULE_AUTHOR("Logitech"); |
1159 | MODULE_AUTHOR("Nestor Lopez Casado"); | 1173 | MODULE_AUTHOR("Nestor Lopez Casado"); |
1160 | MODULE_AUTHOR("nlopezcasad@logitech.com"); | 1174 | MODULE_AUTHOR("nlopezcasad@logitech.com"); |
1161 | 1175 |
drivers/hid/hid-logitech-hidpp.c
1 | /* | 1 | /* |
2 | * HIDPP protocol for Logitech Unifying receivers | 2 | * HIDPP protocol for Logitech Unifying receivers |
3 | * | 3 | * |
4 | * Copyright (c) 2011 Logitech (c) | 4 | * Copyright (c) 2011 Logitech (c) |
5 | * Copyright (c) 2012-2013 Google (c) | 5 | * Copyright (c) 2012-2013 Google (c) |
6 | * Copyright (c) 2013-2014 Red Hat Inc. | 6 | * Copyright (c) 2013-2014 Red Hat Inc. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * This program is free software; you can redistribute it and/or modify it | 10 | * This program is free software; you can redistribute it and/or modify it |
11 | * under the terms of the GNU General Public License as published by the Free | 11 | * under the terms of the GNU General Public License as published by the Free |
12 | * Software Foundation; version 2 of the License. | 12 | * Software Foundation; version 2 of the License. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
16 | 16 | ||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/hid.h> | 18 | #include <linux/hid.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/kfifo.h> | 22 | #include <linux/kfifo.h> |
23 | #include <linux/input/mt.h> | 23 | #include <linux/input/mt.h> |
24 | #include <asm/unaligned.h> | 24 | #include <asm/unaligned.h> |
25 | #include "hid-ids.h" | 25 | #include "hid-ids.h" |
26 | 26 | ||
27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
28 | MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); | 28 | MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); |
29 | MODULE_AUTHOR("Nestor Lopez Casado <nlopezcasad@logitech.com>"); | 29 | MODULE_AUTHOR("Nestor Lopez Casado <nlopezcasad@logitech.com>"); |
30 | 30 | ||
31 | #define REPORT_ID_HIDPP_SHORT 0x10 | 31 | #define REPORT_ID_HIDPP_SHORT 0x10 |
32 | #define REPORT_ID_HIDPP_LONG 0x11 | 32 | #define REPORT_ID_HIDPP_LONG 0x11 |
33 | 33 | ||
34 | #define HIDPP_REPORT_SHORT_LENGTH 7 | 34 | #define HIDPP_REPORT_SHORT_LENGTH 7 |
35 | #define HIDPP_REPORT_LONG_LENGTH 20 | 35 | #define HIDPP_REPORT_LONG_LENGTH 20 |
36 | 36 | ||
37 | #define HIDPP_QUIRK_CLASS_WTP BIT(0) | 37 | #define HIDPP_QUIRK_CLASS_WTP BIT(0) |
38 | 38 | ||
39 | /* bits 1..20 are reserved for classes */ | 39 | /* bits 1..20 are reserved for classes */ |
40 | #define HIDPP_QUIRK_DELAYED_INIT BIT(21) | 40 | #define HIDPP_QUIRK_DELAYED_INIT BIT(21) |
41 | #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) | 41 | #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) |
42 | #define HIDPP_QUIRK_MULTI_INPUT BIT(23) | 42 | #define HIDPP_QUIRK_MULTI_INPUT BIT(23) |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * There are two hidpp protocols in use, the first version hidpp10 is known | 45 | * There are two hidpp protocols in use, the first version hidpp10 is known |
46 | * as register access protocol or RAP, the second version hidpp20 is known as | 46 | * as register access protocol or RAP, the second version hidpp20 is known as |
47 | * feature access protocol or FAP | 47 | * feature access protocol or FAP |
48 | * | 48 | * |
49 | * Most older devices (including the Unifying usb receiver) use the RAP protocol | 49 | * Most older devices (including the Unifying usb receiver) use the RAP protocol |
50 | * where as most newer devices use the FAP protocol. Both protocols are | 50 | * where as most newer devices use the FAP protocol. Both protocols are |
51 | * compatible with the underlying transport, which could be usb, Unifiying, or | 51 | * compatible with the underlying transport, which could be usb, Unifiying, or |
52 | * bluetooth. The message lengths are defined by the hid vendor specific report | 52 | * bluetooth. The message lengths are defined by the hid vendor specific report |
53 | * descriptor for the HIDPP_SHORT report type (total message lenth 7 bytes) and | 53 | * descriptor for the HIDPP_SHORT report type (total message lenth 7 bytes) and |
54 | * the HIDPP_LONG report type (total message length 20 bytes) | 54 | * the HIDPP_LONG report type (total message length 20 bytes) |
55 | * | 55 | * |
56 | * The RAP protocol uses both report types, whereas the FAP only uses HIDPP_LONG | 56 | * The RAP protocol uses both report types, whereas the FAP only uses HIDPP_LONG |
57 | * messages. The Unifying receiver itself responds to RAP messages (device index | 57 | * messages. The Unifying receiver itself responds to RAP messages (device index |
58 | * is 0xFF for the receiver), and all messages (short or long) with a device | 58 | * is 0xFF for the receiver), and all messages (short or long) with a device |
59 | * index between 1 and 6 are passed untouched to the corresponding paired | 59 | * index between 1 and 6 are passed untouched to the corresponding paired |
60 | * Unifying device. | 60 | * Unifying device. |
61 | * | 61 | * |
62 | * The paired device can be RAP or FAP, it will receive the message untouched | 62 | * The paired device can be RAP or FAP, it will receive the message untouched |
63 | * from the Unifiying receiver. | 63 | * from the Unifiying receiver. |
64 | */ | 64 | */ |
65 | 65 | ||
66 | struct fap { | 66 | struct fap { |
67 | u8 feature_index; | 67 | u8 feature_index; |
68 | u8 funcindex_clientid; | 68 | u8 funcindex_clientid; |
69 | u8 params[HIDPP_REPORT_LONG_LENGTH - 4U]; | 69 | u8 params[HIDPP_REPORT_LONG_LENGTH - 4U]; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct rap { | 72 | struct rap { |
73 | u8 sub_id; | 73 | u8 sub_id; |
74 | u8 reg_address; | 74 | u8 reg_address; |
75 | u8 params[HIDPP_REPORT_LONG_LENGTH - 4U]; | 75 | u8 params[HIDPP_REPORT_LONG_LENGTH - 4U]; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | struct hidpp_report { | 78 | struct hidpp_report { |
79 | u8 report_id; | 79 | u8 report_id; |
80 | u8 device_index; | 80 | u8 device_index; |
81 | union { | 81 | union { |
82 | struct fap fap; | 82 | struct fap fap; |
83 | struct rap rap; | 83 | struct rap rap; |
84 | u8 rawbytes[sizeof(struct fap)]; | 84 | u8 rawbytes[sizeof(struct fap)]; |
85 | }; | 85 | }; |
86 | } __packed; | 86 | } __packed; |
87 | 87 | ||
88 | struct hidpp_device { | 88 | struct hidpp_device { |
89 | struct hid_device *hid_dev; | 89 | struct hid_device *hid_dev; |
90 | struct mutex send_mutex; | 90 | struct mutex send_mutex; |
91 | void *send_receive_buf; | 91 | void *send_receive_buf; |
92 | wait_queue_head_t wait; | 92 | wait_queue_head_t wait; |
93 | bool answer_available; | 93 | bool answer_available; |
94 | u8 protocol_major; | 94 | u8 protocol_major; |
95 | u8 protocol_minor; | 95 | u8 protocol_minor; |
96 | 96 | ||
97 | void *private_data; | 97 | void *private_data; |
98 | 98 | ||
99 | struct work_struct work; | 99 | struct work_struct work; |
100 | struct kfifo delayed_work_fifo; | 100 | struct kfifo delayed_work_fifo; |
101 | atomic_t connected; | 101 | atomic_t connected; |
102 | struct input_dev *delayed_input; | 102 | struct input_dev *delayed_input; |
103 | 103 | ||
104 | unsigned long quirks; | 104 | unsigned long quirks; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
108 | #define HIDPP_ERROR 0x8f | 108 | #define HIDPP_ERROR 0x8f |
109 | #define HIDPP_ERROR_SUCCESS 0x00 | 109 | #define HIDPP_ERROR_SUCCESS 0x00 |
110 | #define HIDPP_ERROR_INVALID_SUBID 0x01 | 110 | #define HIDPP_ERROR_INVALID_SUBID 0x01 |
111 | #define HIDPP_ERROR_INVALID_ADRESS 0x02 | 111 | #define HIDPP_ERROR_INVALID_ADRESS 0x02 |
112 | #define HIDPP_ERROR_INVALID_VALUE 0x03 | 112 | #define HIDPP_ERROR_INVALID_VALUE 0x03 |
113 | #define HIDPP_ERROR_CONNECT_FAIL 0x04 | 113 | #define HIDPP_ERROR_CONNECT_FAIL 0x04 |
114 | #define HIDPP_ERROR_TOO_MANY_DEVICES 0x05 | 114 | #define HIDPP_ERROR_TOO_MANY_DEVICES 0x05 |
115 | #define HIDPP_ERROR_ALREADY_EXISTS 0x06 | 115 | #define HIDPP_ERROR_ALREADY_EXISTS 0x06 |
116 | #define HIDPP_ERROR_BUSY 0x07 | 116 | #define HIDPP_ERROR_BUSY 0x07 |
117 | #define HIDPP_ERROR_UNKNOWN_DEVICE 0x08 | 117 | #define HIDPP_ERROR_UNKNOWN_DEVICE 0x08 |
118 | #define HIDPP_ERROR_RESOURCE_ERROR 0x09 | 118 | #define HIDPP_ERROR_RESOURCE_ERROR 0x09 |
119 | #define HIDPP_ERROR_REQUEST_UNAVAILABLE 0x0a | 119 | #define HIDPP_ERROR_REQUEST_UNAVAILABLE 0x0a |
120 | #define HIDPP_ERROR_INVALID_PARAM_VALUE 0x0b | 120 | #define HIDPP_ERROR_INVALID_PARAM_VALUE 0x0b |
121 | #define HIDPP_ERROR_WRONG_PIN_CODE 0x0c | 121 | #define HIDPP_ERROR_WRONG_PIN_CODE 0x0c |
122 | 122 | ||
123 | static void hidpp_connect_event(struct hidpp_device *hidpp_dev); | 123 | static void hidpp_connect_event(struct hidpp_device *hidpp_dev); |
124 | 124 | ||
125 | static int __hidpp_send_report(struct hid_device *hdev, | 125 | static int __hidpp_send_report(struct hid_device *hdev, |
126 | struct hidpp_report *hidpp_report) | 126 | struct hidpp_report *hidpp_report) |
127 | { | 127 | { |
128 | int fields_count, ret; | 128 | int fields_count, ret; |
129 | 129 | ||
130 | switch (hidpp_report->report_id) { | 130 | switch (hidpp_report->report_id) { |
131 | case REPORT_ID_HIDPP_SHORT: | 131 | case REPORT_ID_HIDPP_SHORT: |
132 | fields_count = HIDPP_REPORT_SHORT_LENGTH; | 132 | fields_count = HIDPP_REPORT_SHORT_LENGTH; |
133 | break; | 133 | break; |
134 | case REPORT_ID_HIDPP_LONG: | 134 | case REPORT_ID_HIDPP_LONG: |
135 | fields_count = HIDPP_REPORT_LONG_LENGTH; | 135 | fields_count = HIDPP_REPORT_LONG_LENGTH; |
136 | break; | 136 | break; |
137 | default: | 137 | default: |
138 | return -ENODEV; | 138 | return -ENODEV; |
139 | } | 139 | } |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * set the device_index as the receiver, it will be overwritten by | 142 | * set the device_index as the receiver, it will be overwritten by |
143 | * hid_hw_request if needed | 143 | * hid_hw_request if needed |
144 | */ | 144 | */ |
145 | hidpp_report->device_index = 0xff; | 145 | hidpp_report->device_index = 0xff; |
146 | 146 | ||
147 | ret = hid_hw_raw_request(hdev, hidpp_report->report_id, | 147 | ret = hid_hw_raw_request(hdev, hidpp_report->report_id, |
148 | (u8 *)hidpp_report, fields_count, HID_OUTPUT_REPORT, | 148 | (u8 *)hidpp_report, fields_count, HID_OUTPUT_REPORT, |
149 | HID_REQ_SET_REPORT); | 149 | HID_REQ_SET_REPORT); |
150 | 150 | ||
151 | return ret == fields_count ? 0 : -1; | 151 | return ret == fields_count ? 0 : -1; |
152 | } | 152 | } |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * hidpp_send_message_sync() returns 0 in case of success, and something else | 155 | * hidpp_send_message_sync() returns 0 in case of success, and something else |
156 | * in case of a failure. | 156 | * in case of a failure. |
157 | * - If ' something else' is positive, that means that an error has been raised | 157 | * - If ' something else' is positive, that means that an error has been raised |
158 | * by the protocol itself. | 158 | * by the protocol itself. |
159 | * - If ' something else' is negative, that means that we had a classic error | 159 | * - If ' something else' is negative, that means that we had a classic error |
160 | * (-ENOMEM, -EPIPE, etc...) | 160 | * (-ENOMEM, -EPIPE, etc...) |
161 | */ | 161 | */ |
162 | static int hidpp_send_message_sync(struct hidpp_device *hidpp, | 162 | static int hidpp_send_message_sync(struct hidpp_device *hidpp, |
163 | struct hidpp_report *message, | 163 | struct hidpp_report *message, |
164 | struct hidpp_report *response) | 164 | struct hidpp_report *response) |
165 | { | 165 | { |
166 | int ret; | 166 | int ret; |
167 | 167 | ||
168 | mutex_lock(&hidpp->send_mutex); | 168 | mutex_lock(&hidpp->send_mutex); |
169 | 169 | ||
170 | hidpp->send_receive_buf = response; | 170 | hidpp->send_receive_buf = response; |
171 | hidpp->answer_available = false; | 171 | hidpp->answer_available = false; |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * So that we can later validate the answer when it arrives | 174 | * So that we can later validate the answer when it arrives |
175 | * in hidpp_raw_event | 175 | * in hidpp_raw_event |
176 | */ | 176 | */ |
177 | *response = *message; | 177 | *response = *message; |
178 | 178 | ||
179 | ret = __hidpp_send_report(hidpp->hid_dev, message); | 179 | ret = __hidpp_send_report(hidpp->hid_dev, message); |
180 | 180 | ||
181 | if (ret) { | 181 | if (ret) { |
182 | dbg_hid("__hidpp_send_report returned err: %d\n", ret); | 182 | dbg_hid("__hidpp_send_report returned err: %d\n", ret); |
183 | memset(response, 0, sizeof(struct hidpp_report)); | 183 | memset(response, 0, sizeof(struct hidpp_report)); |
184 | goto exit; | 184 | goto exit; |
185 | } | 185 | } |
186 | 186 | ||
187 | if (!wait_event_timeout(hidpp->wait, hidpp->answer_available, | 187 | if (!wait_event_timeout(hidpp->wait, hidpp->answer_available, |
188 | 5*HZ)) { | 188 | 5*HZ)) { |
189 | dbg_hid("%s:timeout waiting for response\n", __func__); | 189 | dbg_hid("%s:timeout waiting for response\n", __func__); |
190 | memset(response, 0, sizeof(struct hidpp_report)); | 190 | memset(response, 0, sizeof(struct hidpp_report)); |
191 | ret = -ETIMEDOUT; | 191 | ret = -ETIMEDOUT; |
192 | } | 192 | } |
193 | 193 | ||
194 | if (response->report_id == REPORT_ID_HIDPP_SHORT && | 194 | if (response->report_id == REPORT_ID_HIDPP_SHORT && |
195 | response->fap.feature_index == HIDPP_ERROR) { | 195 | response->fap.feature_index == HIDPP_ERROR) { |
196 | ret = response->fap.params[1]; | 196 | ret = response->fap.params[1]; |
197 | dbg_hid("__hidpp_send_report got hidpp error %02X\n", ret); | 197 | dbg_hid("__hidpp_send_report got hidpp error %02X\n", ret); |
198 | goto exit; | 198 | goto exit; |
199 | } | 199 | } |
200 | 200 | ||
201 | exit: | 201 | exit: |
202 | mutex_unlock(&hidpp->send_mutex); | 202 | mutex_unlock(&hidpp->send_mutex); |
203 | return ret; | 203 | return ret; |
204 | 204 | ||
205 | } | 205 | } |
206 | 206 | ||
207 | static int hidpp_send_fap_command_sync(struct hidpp_device *hidpp, | 207 | static int hidpp_send_fap_command_sync(struct hidpp_device *hidpp, |
208 | u8 feat_index, u8 funcindex_clientid, u8 *params, int param_count, | 208 | u8 feat_index, u8 funcindex_clientid, u8 *params, int param_count, |
209 | struct hidpp_report *response) | 209 | struct hidpp_report *response) |
210 | { | 210 | { |
211 | struct hidpp_report *message; | 211 | struct hidpp_report *message; |
212 | int ret; | 212 | int ret; |
213 | 213 | ||
214 | if (param_count > sizeof(message->fap.params)) | 214 | if (param_count > sizeof(message->fap.params)) |
215 | return -EINVAL; | 215 | return -EINVAL; |
216 | 216 | ||
217 | message = kzalloc(sizeof(struct hidpp_report), GFP_KERNEL); | 217 | message = kzalloc(sizeof(struct hidpp_report), GFP_KERNEL); |
218 | if (!message) | 218 | if (!message) |
219 | return -ENOMEM; | 219 | return -ENOMEM; |
220 | message->report_id = REPORT_ID_HIDPP_LONG; | 220 | message->report_id = REPORT_ID_HIDPP_LONG; |
221 | message->fap.feature_index = feat_index; | 221 | message->fap.feature_index = feat_index; |
222 | message->fap.funcindex_clientid = funcindex_clientid; | 222 | message->fap.funcindex_clientid = funcindex_clientid; |
223 | memcpy(&message->fap.params, params, param_count); | 223 | memcpy(&message->fap.params, params, param_count); |
224 | 224 | ||
225 | ret = hidpp_send_message_sync(hidpp, message, response); | 225 | ret = hidpp_send_message_sync(hidpp, message, response); |
226 | kfree(message); | 226 | kfree(message); |
227 | return ret; | 227 | return ret; |
228 | } | 228 | } |
229 | 229 | ||
230 | static int hidpp_send_rap_command_sync(struct hidpp_device *hidpp_dev, | 230 | static int hidpp_send_rap_command_sync(struct hidpp_device *hidpp_dev, |
231 | u8 report_id, u8 sub_id, u8 reg_address, u8 *params, int param_count, | 231 | u8 report_id, u8 sub_id, u8 reg_address, u8 *params, int param_count, |
232 | struct hidpp_report *response) | 232 | struct hidpp_report *response) |
233 | { | 233 | { |
234 | struct hidpp_report *message; | 234 | struct hidpp_report *message; |
235 | int ret; | 235 | int ret; |
236 | 236 | ||
237 | if ((report_id != REPORT_ID_HIDPP_SHORT) && | 237 | if ((report_id != REPORT_ID_HIDPP_SHORT) && |
238 | (report_id != REPORT_ID_HIDPP_LONG)) | 238 | (report_id != REPORT_ID_HIDPP_LONG)) |
239 | return -EINVAL; | 239 | return -EINVAL; |
240 | 240 | ||
241 | if (param_count > sizeof(message->rap.params)) | 241 | if (param_count > sizeof(message->rap.params)) |
242 | return -EINVAL; | 242 | return -EINVAL; |
243 | 243 | ||
244 | message = kzalloc(sizeof(struct hidpp_report), GFP_KERNEL); | 244 | message = kzalloc(sizeof(struct hidpp_report), GFP_KERNEL); |
245 | if (!message) | 245 | if (!message) |
246 | return -ENOMEM; | 246 | return -ENOMEM; |
247 | message->report_id = report_id; | 247 | message->report_id = report_id; |
248 | message->rap.sub_id = sub_id; | 248 | message->rap.sub_id = sub_id; |
249 | message->rap.reg_address = reg_address; | 249 | message->rap.reg_address = reg_address; |
250 | memcpy(&message->rap.params, params, param_count); | 250 | memcpy(&message->rap.params, params, param_count); |
251 | 251 | ||
252 | ret = hidpp_send_message_sync(hidpp_dev, message, response); | 252 | ret = hidpp_send_message_sync(hidpp_dev, message, response); |
253 | kfree(message); | 253 | kfree(message); |
254 | return ret; | 254 | return ret; |
255 | } | 255 | } |
256 | 256 | ||
257 | static void delayed_work_cb(struct work_struct *work) | 257 | static void delayed_work_cb(struct work_struct *work) |
258 | { | 258 | { |
259 | struct hidpp_device *hidpp = container_of(work, struct hidpp_device, | 259 | struct hidpp_device *hidpp = container_of(work, struct hidpp_device, |
260 | work); | 260 | work); |
261 | hidpp_connect_event(hidpp); | 261 | hidpp_connect_event(hidpp); |
262 | } | 262 | } |
263 | 263 | ||
264 | static inline bool hidpp_match_answer(struct hidpp_report *question, | 264 | static inline bool hidpp_match_answer(struct hidpp_report *question, |
265 | struct hidpp_report *answer) | 265 | struct hidpp_report *answer) |
266 | { | 266 | { |
267 | return (answer->fap.feature_index == question->fap.feature_index) && | 267 | return (answer->fap.feature_index == question->fap.feature_index) && |
268 | (answer->fap.funcindex_clientid == question->fap.funcindex_clientid); | 268 | (answer->fap.funcindex_clientid == question->fap.funcindex_clientid); |
269 | } | 269 | } |
270 | 270 | ||
271 | static inline bool hidpp_match_error(struct hidpp_report *question, | 271 | static inline bool hidpp_match_error(struct hidpp_report *question, |
272 | struct hidpp_report *answer) | 272 | struct hidpp_report *answer) |
273 | { | 273 | { |
274 | return (answer->fap.feature_index == HIDPP_ERROR) && | 274 | return (answer->fap.feature_index == HIDPP_ERROR) && |
275 | (answer->fap.funcindex_clientid == question->fap.feature_index) && | 275 | (answer->fap.funcindex_clientid == question->fap.feature_index) && |
276 | (answer->fap.params[0] == question->fap.funcindex_clientid); | 276 | (answer->fap.params[0] == question->fap.funcindex_clientid); |
277 | } | 277 | } |
278 | 278 | ||
279 | static inline bool hidpp_report_is_connect_event(struct hidpp_report *report) | 279 | static inline bool hidpp_report_is_connect_event(struct hidpp_report *report) |
280 | { | 280 | { |
281 | return (report->report_id == REPORT_ID_HIDPP_SHORT) && | 281 | return (report->report_id == REPORT_ID_HIDPP_SHORT) && |
282 | (report->rap.sub_id == 0x41); | 282 | (report->rap.sub_id == 0x41); |
283 | } | 283 | } |
284 | 284 | ||
285 | /** | ||
286 | * hidpp_prefix_name() prefixes the current given name with "Logitech ". | ||
287 | */ | ||
288 | static void hidpp_prefix_name(char **name, int name_length) | ||
289 | { | ||
290 | #define PREFIX_LENGTH 9 /* "Logitech " */ | ||
291 | |||
292 | int new_length; | ||
293 | char *new_name; | ||
294 | |||
295 | if (name_length > PREFIX_LENGTH && | ||
296 | strncmp(*name, "Logitech ", PREFIX_LENGTH) == 0) | ||
297 | /* The prefix has is already in the name */ | ||
298 | return; | ||
299 | |||
300 | new_length = PREFIX_LENGTH + name_length; | ||
301 | new_name = kzalloc(new_length, GFP_KERNEL); | ||
302 | if (!new_name) | ||
303 | return; | ||
304 | |||
305 | snprintf(new_name, new_length, "Logitech %s", *name); | ||
306 | |||
307 | kfree(*name); | ||
308 | |||
309 | *name = new_name; | ||
310 | } | ||
311 | |||
285 | /* -------------------------------------------------------------------------- */ | 312 | /* -------------------------------------------------------------------------- */ |
286 | /* HIDP++ 1.0 commands */ | 313 | /* HIDP++ 1.0 commands */ |
287 | /* -------------------------------------------------------------------------- */ | 314 | /* -------------------------------------------------------------------------- */ |
288 | 315 | ||
289 | #define HIDPP_SET_REGISTER 0x80 | 316 | #define HIDPP_SET_REGISTER 0x80 |
290 | #define HIDPP_GET_REGISTER 0x81 | 317 | #define HIDPP_GET_REGISTER 0x81 |
291 | #define HIDPP_SET_LONG_REGISTER 0x82 | 318 | #define HIDPP_SET_LONG_REGISTER 0x82 |
292 | #define HIDPP_GET_LONG_REGISTER 0x83 | 319 | #define HIDPP_GET_LONG_REGISTER 0x83 |
293 | 320 | ||
294 | #define HIDPP_REG_PAIRING_INFORMATION 0xB5 | 321 | #define HIDPP_REG_PAIRING_INFORMATION 0xB5 |
295 | #define DEVICE_NAME 0x40 | 322 | #define DEVICE_NAME 0x40 |
296 | 323 | ||
297 | static char *hidpp_get_unifying_name(struct hidpp_device *hidpp_dev) | 324 | static char *hidpp_get_unifying_name(struct hidpp_device *hidpp_dev) |
298 | { | 325 | { |
299 | struct hidpp_report response; | 326 | struct hidpp_report response; |
300 | int ret; | 327 | int ret; |
301 | /* hid-logitech-dj is in charge of setting the right device index */ | 328 | /* hid-logitech-dj is in charge of setting the right device index */ |
302 | u8 params[1] = { DEVICE_NAME }; | 329 | u8 params[1] = { DEVICE_NAME }; |
303 | char *name; | 330 | char *name; |
304 | int len; | 331 | int len; |
305 | 332 | ||
306 | ret = hidpp_send_rap_command_sync(hidpp_dev, | 333 | ret = hidpp_send_rap_command_sync(hidpp_dev, |
307 | REPORT_ID_HIDPP_SHORT, | 334 | REPORT_ID_HIDPP_SHORT, |
308 | HIDPP_GET_LONG_REGISTER, | 335 | HIDPP_GET_LONG_REGISTER, |
309 | HIDPP_REG_PAIRING_INFORMATION, | 336 | HIDPP_REG_PAIRING_INFORMATION, |
310 | params, 1, &response); | 337 | params, 1, &response); |
311 | if (ret) | 338 | if (ret) |
312 | return NULL; | 339 | return NULL; |
313 | 340 | ||
314 | len = response.rap.params[1]; | 341 | len = response.rap.params[1]; |
315 | 342 | ||
316 | if (2 + len > sizeof(response.rap.params)) | 343 | if (2 + len > sizeof(response.rap.params)) |
317 | return NULL; | 344 | return NULL; |
318 | 345 | ||
319 | name = kzalloc(len + 1, GFP_KERNEL); | 346 | name = kzalloc(len + 1, GFP_KERNEL); |
320 | if (!name) | 347 | if (!name) |
321 | return NULL; | 348 | return NULL; |
322 | 349 | ||
323 | memcpy(name, &response.rap.params[2], len); | 350 | memcpy(name, &response.rap.params[2], len); |
351 | |||
352 | /* include the terminating '\0' */ | ||
353 | hidpp_prefix_name(&name, len + 1); | ||
354 | |||
324 | return name; | 355 | return name; |
325 | } | 356 | } |
326 | 357 | ||
327 | /* -------------------------------------------------------------------------- */ | 358 | /* -------------------------------------------------------------------------- */ |
328 | /* 0x0000: Root */ | 359 | /* 0x0000: Root */ |
329 | /* -------------------------------------------------------------------------- */ | 360 | /* -------------------------------------------------------------------------- */ |
330 | 361 | ||
331 | #define HIDPP_PAGE_ROOT 0x0000 | 362 | #define HIDPP_PAGE_ROOT 0x0000 |
332 | #define HIDPP_PAGE_ROOT_IDX 0x00 | 363 | #define HIDPP_PAGE_ROOT_IDX 0x00 |
333 | 364 | ||
334 | #define CMD_ROOT_GET_FEATURE 0x01 | 365 | #define CMD_ROOT_GET_FEATURE 0x01 |
335 | #define CMD_ROOT_GET_PROTOCOL_VERSION 0x11 | 366 | #define CMD_ROOT_GET_PROTOCOL_VERSION 0x11 |
336 | 367 | ||
337 | static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature, | 368 | static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature, |
338 | u8 *feature_index, u8 *feature_type) | 369 | u8 *feature_index, u8 *feature_type) |
339 | { | 370 | { |
340 | struct hidpp_report response; | 371 | struct hidpp_report response; |
341 | int ret; | 372 | int ret; |
342 | u8 params[2] = { feature >> 8, feature & 0x00FF }; | 373 | u8 params[2] = { feature >> 8, feature & 0x00FF }; |
343 | 374 | ||
344 | ret = hidpp_send_fap_command_sync(hidpp, | 375 | ret = hidpp_send_fap_command_sync(hidpp, |
345 | HIDPP_PAGE_ROOT_IDX, | 376 | HIDPP_PAGE_ROOT_IDX, |
346 | CMD_ROOT_GET_FEATURE, | 377 | CMD_ROOT_GET_FEATURE, |
347 | params, 2, &response); | 378 | params, 2, &response); |
348 | if (ret) | 379 | if (ret) |
349 | return ret; | 380 | return ret; |
350 | 381 | ||
351 | *feature_index = response.fap.params[0]; | 382 | *feature_index = response.fap.params[0]; |
352 | *feature_type = response.fap.params[1]; | 383 | *feature_type = response.fap.params[1]; |
353 | 384 | ||
354 | return ret; | 385 | return ret; |
355 | } | 386 | } |
356 | 387 | ||
357 | static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) | 388 | static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) |
358 | { | 389 | { |
359 | struct hidpp_report response; | 390 | struct hidpp_report response; |
360 | int ret; | 391 | int ret; |
361 | 392 | ||
362 | ret = hidpp_send_fap_command_sync(hidpp, | 393 | ret = hidpp_send_fap_command_sync(hidpp, |
363 | HIDPP_PAGE_ROOT_IDX, | 394 | HIDPP_PAGE_ROOT_IDX, |
364 | CMD_ROOT_GET_PROTOCOL_VERSION, | 395 | CMD_ROOT_GET_PROTOCOL_VERSION, |
365 | NULL, 0, &response); | 396 | NULL, 0, &response); |
366 | 397 | ||
367 | if (ret == HIDPP_ERROR_INVALID_SUBID) { | 398 | if (ret == HIDPP_ERROR_INVALID_SUBID) { |
368 | hidpp->protocol_major = 1; | 399 | hidpp->protocol_major = 1; |
369 | hidpp->protocol_minor = 0; | 400 | hidpp->protocol_minor = 0; |
370 | return 0; | 401 | return 0; |
371 | } | 402 | } |
372 | 403 | ||
373 | /* the device might not be connected */ | 404 | /* the device might not be connected */ |
374 | if (ret == HIDPP_ERROR_RESOURCE_ERROR) | 405 | if (ret == HIDPP_ERROR_RESOURCE_ERROR) |
375 | return -EIO; | 406 | return -EIO; |
376 | 407 | ||
377 | if (ret > 0) { | 408 | if (ret > 0) { |
378 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", | 409 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", |
379 | __func__, ret); | 410 | __func__, ret); |
380 | return -EPROTO; | 411 | return -EPROTO; |
381 | } | 412 | } |
382 | if (ret) | 413 | if (ret) |
383 | return ret; | 414 | return ret; |
384 | 415 | ||
385 | hidpp->protocol_major = response.fap.params[0]; | 416 | hidpp->protocol_major = response.fap.params[0]; |
386 | hidpp->protocol_minor = response.fap.params[1]; | 417 | hidpp->protocol_minor = response.fap.params[1]; |
387 | 418 | ||
388 | return ret; | 419 | return ret; |
389 | } | 420 | } |
390 | 421 | ||
391 | static bool hidpp_is_connected(struct hidpp_device *hidpp) | 422 | static bool hidpp_is_connected(struct hidpp_device *hidpp) |
392 | { | 423 | { |
393 | int ret; | 424 | int ret; |
394 | 425 | ||
395 | ret = hidpp_root_get_protocol_version(hidpp); | 426 | ret = hidpp_root_get_protocol_version(hidpp); |
396 | if (!ret) | 427 | if (!ret) |
397 | hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n", | 428 | hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n", |
398 | hidpp->protocol_major, hidpp->protocol_minor); | 429 | hidpp->protocol_major, hidpp->protocol_minor); |
399 | return ret == 0; | 430 | return ret == 0; |
400 | } | 431 | } |
401 | 432 | ||
402 | /* -------------------------------------------------------------------------- */ | 433 | /* -------------------------------------------------------------------------- */ |
403 | /* 0x0005: GetDeviceNameType */ | 434 | /* 0x0005: GetDeviceNameType */ |
404 | /* -------------------------------------------------------------------------- */ | 435 | /* -------------------------------------------------------------------------- */ |
405 | 436 | ||
406 | #define HIDPP_PAGE_GET_DEVICE_NAME_TYPE 0x0005 | 437 | #define HIDPP_PAGE_GET_DEVICE_NAME_TYPE 0x0005 |
407 | 438 | ||
408 | #define CMD_GET_DEVICE_NAME_TYPE_GET_COUNT 0x01 | 439 | #define CMD_GET_DEVICE_NAME_TYPE_GET_COUNT 0x01 |
409 | #define CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x11 | 440 | #define CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x11 |
410 | #define CMD_GET_DEVICE_NAME_TYPE_GET_TYPE 0x21 | 441 | #define CMD_GET_DEVICE_NAME_TYPE_GET_TYPE 0x21 |
411 | 442 | ||
412 | static int hidpp_devicenametype_get_count(struct hidpp_device *hidpp, | 443 | static int hidpp_devicenametype_get_count(struct hidpp_device *hidpp, |
413 | u8 feature_index, u8 *nameLength) | 444 | u8 feature_index, u8 *nameLength) |
414 | { | 445 | { |
415 | struct hidpp_report response; | 446 | struct hidpp_report response; |
416 | int ret; | 447 | int ret; |
417 | 448 | ||
418 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, | 449 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, |
419 | CMD_GET_DEVICE_NAME_TYPE_GET_COUNT, NULL, 0, &response); | 450 | CMD_GET_DEVICE_NAME_TYPE_GET_COUNT, NULL, 0, &response); |
420 | 451 | ||
421 | if (ret > 0) { | 452 | if (ret > 0) { |
422 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", | 453 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", |
423 | __func__, ret); | 454 | __func__, ret); |
424 | return -EPROTO; | 455 | return -EPROTO; |
425 | } | 456 | } |
426 | if (ret) | 457 | if (ret) |
427 | return ret; | 458 | return ret; |
428 | 459 | ||
429 | *nameLength = response.fap.params[0]; | 460 | *nameLength = response.fap.params[0]; |
430 | 461 | ||
431 | return ret; | 462 | return ret; |
432 | } | 463 | } |
433 | 464 | ||
434 | static int hidpp_devicenametype_get_device_name(struct hidpp_device *hidpp, | 465 | static int hidpp_devicenametype_get_device_name(struct hidpp_device *hidpp, |
435 | u8 feature_index, u8 char_index, char *device_name, int len_buf) | 466 | u8 feature_index, u8 char_index, char *device_name, int len_buf) |
436 | { | 467 | { |
437 | struct hidpp_report response; | 468 | struct hidpp_report response; |
438 | int ret, i; | 469 | int ret, i; |
439 | int count; | 470 | int count; |
440 | 471 | ||
441 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, | 472 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, |
442 | CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME, &char_index, 1, | 473 | CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME, &char_index, 1, |
443 | &response); | 474 | &response); |
444 | 475 | ||
445 | if (ret > 0) { | 476 | if (ret > 0) { |
446 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", | 477 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", |
447 | __func__, ret); | 478 | __func__, ret); |
448 | return -EPROTO; | 479 | return -EPROTO; |
449 | } | 480 | } |
450 | if (ret) | 481 | if (ret) |
451 | return ret; | 482 | return ret; |
452 | 483 | ||
453 | if (response.report_id == REPORT_ID_HIDPP_LONG) | 484 | if (response.report_id == REPORT_ID_HIDPP_LONG) |
454 | count = HIDPP_REPORT_LONG_LENGTH - 4; | 485 | count = HIDPP_REPORT_LONG_LENGTH - 4; |
455 | else | 486 | else |
456 | count = HIDPP_REPORT_SHORT_LENGTH - 4; | 487 | count = HIDPP_REPORT_SHORT_LENGTH - 4; |
457 | 488 | ||
458 | if (len_buf < count) | 489 | if (len_buf < count) |
459 | count = len_buf; | 490 | count = len_buf; |
460 | 491 | ||
461 | for (i = 0; i < count; i++) | 492 | for (i = 0; i < count; i++) |
462 | device_name[i] = response.fap.params[i]; | 493 | device_name[i] = response.fap.params[i]; |
463 | 494 | ||
464 | return count; | 495 | return count; |
465 | } | 496 | } |
466 | 497 | ||
467 | static char *hidpp_get_device_name(struct hidpp_device *hidpp) | 498 | static char *hidpp_get_device_name(struct hidpp_device *hidpp) |
468 | { | 499 | { |
469 | u8 feature_type; | 500 | u8 feature_type; |
470 | u8 feature_index; | 501 | u8 feature_index; |
471 | u8 __name_length; | 502 | u8 __name_length; |
472 | char *name; | 503 | char *name; |
473 | unsigned index = 0; | 504 | unsigned index = 0; |
474 | int ret; | 505 | int ret; |
475 | 506 | ||
476 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_GET_DEVICE_NAME_TYPE, | 507 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_GET_DEVICE_NAME_TYPE, |
477 | &feature_index, &feature_type); | 508 | &feature_index, &feature_type); |
478 | if (ret) | 509 | if (ret) |
479 | return NULL; | 510 | return NULL; |
480 | 511 | ||
481 | ret = hidpp_devicenametype_get_count(hidpp, feature_index, | 512 | ret = hidpp_devicenametype_get_count(hidpp, feature_index, |
482 | &__name_length); | 513 | &__name_length); |
483 | if (ret) | 514 | if (ret) |
484 | return NULL; | 515 | return NULL; |
485 | 516 | ||
486 | name = kzalloc(__name_length + 1, GFP_KERNEL); | 517 | name = kzalloc(__name_length + 1, GFP_KERNEL); |
487 | if (!name) | 518 | if (!name) |
488 | return NULL; | 519 | return NULL; |
489 | 520 | ||
490 | while (index < __name_length) { | 521 | while (index < __name_length) { |
491 | ret = hidpp_devicenametype_get_device_name(hidpp, | 522 | ret = hidpp_devicenametype_get_device_name(hidpp, |
492 | feature_index, index, name + index, | 523 | feature_index, index, name + index, |
493 | __name_length - index); | 524 | __name_length - index); |
494 | if (ret <= 0) { | 525 | if (ret <= 0) { |
495 | kfree(name); | 526 | kfree(name); |
496 | return NULL; | 527 | return NULL; |
497 | } | 528 | } |
498 | index += ret; | 529 | index += ret; |
499 | } | 530 | } |
500 | 531 | ||
532 | /* include the terminating '\0' */ | ||
533 | hidpp_prefix_name(&name, __name_length + 1); | ||
534 | |||
501 | return name; | 535 | return name; |
502 | } | 536 | } |
503 | 537 | ||
504 | /* -------------------------------------------------------------------------- */ | 538 | /* -------------------------------------------------------------------------- */ |
505 | /* 0x6100: TouchPadRawXY */ | 539 | /* 0x6100: TouchPadRawXY */ |
506 | /* -------------------------------------------------------------------------- */ | 540 | /* -------------------------------------------------------------------------- */ |
507 | 541 | ||
508 | #define HIDPP_PAGE_TOUCHPAD_RAW_XY 0x6100 | 542 | #define HIDPP_PAGE_TOUCHPAD_RAW_XY 0x6100 |
509 | 543 | ||
510 | #define CMD_TOUCHPAD_GET_RAW_INFO 0x01 | 544 | #define CMD_TOUCHPAD_GET_RAW_INFO 0x01 |
511 | #define CMD_TOUCHPAD_SET_RAW_REPORT_STATE 0x21 | 545 | #define CMD_TOUCHPAD_SET_RAW_REPORT_STATE 0x21 |
512 | 546 | ||
513 | #define EVENT_TOUCHPAD_RAW_XY 0x00 | 547 | #define EVENT_TOUCHPAD_RAW_XY 0x00 |
514 | 548 | ||
515 | #define TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT 0x01 | 549 | #define TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT 0x01 |
516 | #define TOUCHPAD_RAW_XY_ORIGIN_UPPER_LEFT 0x03 | 550 | #define TOUCHPAD_RAW_XY_ORIGIN_UPPER_LEFT 0x03 |
517 | 551 | ||
518 | struct hidpp_touchpad_raw_info { | 552 | struct hidpp_touchpad_raw_info { |
519 | u16 x_size; | 553 | u16 x_size; |
520 | u16 y_size; | 554 | u16 y_size; |
521 | u8 z_range; | 555 | u8 z_range; |
522 | u8 area_range; | 556 | u8 area_range; |
523 | u8 timestamp_unit; | 557 | u8 timestamp_unit; |
524 | u8 maxcontacts; | 558 | u8 maxcontacts; |
525 | u8 origin; | 559 | u8 origin; |
526 | u16 res; | 560 | u16 res; |
527 | }; | 561 | }; |
528 | 562 | ||
529 | struct hidpp_touchpad_raw_xy_finger { | 563 | struct hidpp_touchpad_raw_xy_finger { |
530 | u8 contact_type; | 564 | u8 contact_type; |
531 | u8 contact_status; | 565 | u8 contact_status; |
532 | u16 x; | 566 | u16 x; |
533 | u16 y; | 567 | u16 y; |
534 | u8 z; | 568 | u8 z; |
535 | u8 area; | 569 | u8 area; |
536 | u8 finger_id; | 570 | u8 finger_id; |
537 | }; | 571 | }; |
538 | 572 | ||
539 | struct hidpp_touchpad_raw_xy { | 573 | struct hidpp_touchpad_raw_xy { |
540 | u16 timestamp; | 574 | u16 timestamp; |
541 | struct hidpp_touchpad_raw_xy_finger fingers[2]; | 575 | struct hidpp_touchpad_raw_xy_finger fingers[2]; |
542 | u8 spurious_flag; | 576 | u8 spurious_flag; |
543 | u8 end_of_frame; | 577 | u8 end_of_frame; |
544 | u8 finger_count; | 578 | u8 finger_count; |
545 | u8 button; | 579 | u8 button; |
546 | }; | 580 | }; |
547 | 581 | ||
548 | static int hidpp_touchpad_get_raw_info(struct hidpp_device *hidpp, | 582 | static int hidpp_touchpad_get_raw_info(struct hidpp_device *hidpp, |
549 | u8 feature_index, struct hidpp_touchpad_raw_info *raw_info) | 583 | u8 feature_index, struct hidpp_touchpad_raw_info *raw_info) |
550 | { | 584 | { |
551 | struct hidpp_report response; | 585 | struct hidpp_report response; |
552 | int ret; | 586 | int ret; |
553 | u8 *params = (u8 *)response.fap.params; | 587 | u8 *params = (u8 *)response.fap.params; |
554 | 588 | ||
555 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, | 589 | ret = hidpp_send_fap_command_sync(hidpp, feature_index, |
556 | CMD_TOUCHPAD_GET_RAW_INFO, NULL, 0, &response); | 590 | CMD_TOUCHPAD_GET_RAW_INFO, NULL, 0, &response); |
557 | 591 | ||
558 | if (ret > 0) { | 592 | if (ret > 0) { |
559 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", | 593 | hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n", |
560 | __func__, ret); | 594 | __func__, ret); |
561 | return -EPROTO; | 595 | return -EPROTO; |
562 | } | 596 | } |
563 | if (ret) | 597 | if (ret) |
564 | return ret; | 598 | return ret; |
565 | 599 | ||
566 | raw_info->x_size = get_unaligned_be16(¶ms[0]); | 600 | raw_info->x_size = get_unaligned_be16(¶ms[0]); |
567 | raw_info->y_size = get_unaligned_be16(¶ms[2]); | 601 | raw_info->y_size = get_unaligned_be16(¶ms[2]); |
568 | raw_info->z_range = params[4]; | 602 | raw_info->z_range = params[4]; |
569 | raw_info->area_range = params[5]; | 603 | raw_info->area_range = params[5]; |
570 | raw_info->maxcontacts = params[7]; | 604 | raw_info->maxcontacts = params[7]; |
571 | raw_info->origin = params[8]; | 605 | raw_info->origin = params[8]; |
572 | /* res is given in unit per inch */ | 606 | /* res is given in unit per inch */ |
573 | raw_info->res = get_unaligned_be16(¶ms[13]) * 2 / 51; | 607 | raw_info->res = get_unaligned_be16(¶ms[13]) * 2 / 51; |
574 | 608 | ||
575 | return ret; | 609 | return ret; |
576 | } | 610 | } |
577 | 611 | ||
578 | static int hidpp_touchpad_set_raw_report_state(struct hidpp_device *hidpp_dev, | 612 | static int hidpp_touchpad_set_raw_report_state(struct hidpp_device *hidpp_dev, |
579 | u8 feature_index, bool send_raw_reports, | 613 | u8 feature_index, bool send_raw_reports, |
580 | bool sensor_enhanced_settings) | 614 | bool sensor_enhanced_settings) |
581 | { | 615 | { |
582 | struct hidpp_report response; | 616 | struct hidpp_report response; |
583 | 617 | ||
584 | /* | 618 | /* |
585 | * Params: | 619 | * Params: |
586 | * bit 0 - enable raw | 620 | * bit 0 - enable raw |
587 | * bit 1 - 16bit Z, no area | 621 | * bit 1 - 16bit Z, no area |
588 | * bit 2 - enhanced sensitivity | 622 | * bit 2 - enhanced sensitivity |
589 | * bit 3 - width, height (4 bits each) instead of area | 623 | * bit 3 - width, height (4 bits each) instead of area |
590 | * bit 4 - send raw + gestures (degrades smoothness) | 624 | * bit 4 - send raw + gestures (degrades smoothness) |
591 | * remaining bits - reserved | 625 | * remaining bits - reserved |
592 | */ | 626 | */ |
593 | u8 params = send_raw_reports | (sensor_enhanced_settings << 2); | 627 | u8 params = send_raw_reports | (sensor_enhanced_settings << 2); |
594 | 628 | ||
595 | return hidpp_send_fap_command_sync(hidpp_dev, feature_index, | 629 | return hidpp_send_fap_command_sync(hidpp_dev, feature_index, |
596 | CMD_TOUCHPAD_SET_RAW_REPORT_STATE, ¶ms, 1, &response); | 630 | CMD_TOUCHPAD_SET_RAW_REPORT_STATE, ¶ms, 1, &response); |
597 | } | 631 | } |
598 | 632 | ||
599 | static void hidpp_touchpad_touch_event(u8 *data, | 633 | static void hidpp_touchpad_touch_event(u8 *data, |
600 | struct hidpp_touchpad_raw_xy_finger *finger) | 634 | struct hidpp_touchpad_raw_xy_finger *finger) |
601 | { | 635 | { |
602 | u8 x_m = data[0] << 2; | 636 | u8 x_m = data[0] << 2; |
603 | u8 y_m = data[2] << 2; | 637 | u8 y_m = data[2] << 2; |
604 | 638 | ||
605 | finger->x = x_m << 6 | data[1]; | 639 | finger->x = x_m << 6 | data[1]; |
606 | finger->y = y_m << 6 | data[3]; | 640 | finger->y = y_m << 6 | data[3]; |
607 | 641 | ||
608 | finger->contact_type = data[0] >> 6; | 642 | finger->contact_type = data[0] >> 6; |
609 | finger->contact_status = data[2] >> 6; | 643 | finger->contact_status = data[2] >> 6; |
610 | 644 | ||
611 | finger->z = data[4]; | 645 | finger->z = data[4]; |
612 | finger->area = data[5]; | 646 | finger->area = data[5]; |
613 | finger->finger_id = data[6] >> 4; | 647 | finger->finger_id = data[6] >> 4; |
614 | } | 648 | } |
615 | 649 | ||
616 | static void hidpp_touchpad_raw_xy_event(struct hidpp_device *hidpp_dev, | 650 | static void hidpp_touchpad_raw_xy_event(struct hidpp_device *hidpp_dev, |
617 | u8 *data, struct hidpp_touchpad_raw_xy *raw_xy) | 651 | u8 *data, struct hidpp_touchpad_raw_xy *raw_xy) |
618 | { | 652 | { |
619 | memset(raw_xy, 0, sizeof(struct hidpp_touchpad_raw_xy)); | 653 | memset(raw_xy, 0, sizeof(struct hidpp_touchpad_raw_xy)); |
620 | raw_xy->end_of_frame = data[8] & 0x01; | 654 | raw_xy->end_of_frame = data[8] & 0x01; |
621 | raw_xy->spurious_flag = (data[8] >> 1) & 0x01; | 655 | raw_xy->spurious_flag = (data[8] >> 1) & 0x01; |
622 | raw_xy->finger_count = data[15] & 0x0f; | 656 | raw_xy->finger_count = data[15] & 0x0f; |
623 | raw_xy->button = (data[8] >> 2) & 0x01; | 657 | raw_xy->button = (data[8] >> 2) & 0x01; |
624 | 658 | ||
625 | if (raw_xy->finger_count) { | 659 | if (raw_xy->finger_count) { |
626 | hidpp_touchpad_touch_event(&data[2], &raw_xy->fingers[0]); | 660 | hidpp_touchpad_touch_event(&data[2], &raw_xy->fingers[0]); |
627 | hidpp_touchpad_touch_event(&data[9], &raw_xy->fingers[1]); | 661 | hidpp_touchpad_touch_event(&data[9], &raw_xy->fingers[1]); |
628 | } | 662 | } |
629 | } | 663 | } |
630 | 664 | ||
631 | /* ************************************************************************** */ | 665 | /* ************************************************************************** */ |
632 | /* */ | 666 | /* */ |
633 | /* Device Support */ | 667 | /* Device Support */ |
634 | /* */ | 668 | /* */ |
635 | /* ************************************************************************** */ | 669 | /* ************************************************************************** */ |
636 | 670 | ||
637 | /* -------------------------------------------------------------------------- */ | 671 | /* -------------------------------------------------------------------------- */ |
638 | /* Touchpad HID++ devices */ | 672 | /* Touchpad HID++ devices */ |
639 | /* -------------------------------------------------------------------------- */ | 673 | /* -------------------------------------------------------------------------- */ |
640 | 674 | ||
641 | #define WTP_MANUAL_RESOLUTION 39 | 675 | #define WTP_MANUAL_RESOLUTION 39 |
642 | 676 | ||
643 | struct wtp_data { | 677 | struct wtp_data { |
644 | struct input_dev *input; | 678 | struct input_dev *input; |
645 | u16 x_size, y_size; | 679 | u16 x_size, y_size; |
646 | u8 finger_count; | 680 | u8 finger_count; |
647 | u8 mt_feature_index; | 681 | u8 mt_feature_index; |
648 | u8 button_feature_index; | 682 | u8 button_feature_index; |
649 | u8 maxcontacts; | 683 | u8 maxcontacts; |
650 | bool flip_y; | 684 | bool flip_y; |
651 | unsigned int resolution; | 685 | unsigned int resolution; |
652 | }; | 686 | }; |
653 | 687 | ||
654 | static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, | 688 | static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
655 | struct hid_field *field, struct hid_usage *usage, | 689 | struct hid_field *field, struct hid_usage *usage, |
656 | unsigned long **bit, int *max) | 690 | unsigned long **bit, int *max) |
657 | { | 691 | { |
658 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 692 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
659 | 693 | ||
660 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && | 694 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && |
661 | (field->application == HID_GD_KEYBOARD)) | 695 | (field->application == HID_GD_KEYBOARD)) |
662 | return 0; | 696 | return 0; |
663 | 697 | ||
664 | return -1; | 698 | return -1; |
665 | } | 699 | } |
666 | 700 | ||
667 | static void wtp_populate_input(struct hidpp_device *hidpp, | 701 | static void wtp_populate_input(struct hidpp_device *hidpp, |
668 | struct input_dev *input_dev, bool origin_is_hid_core) | 702 | struct input_dev *input_dev, bool origin_is_hid_core) |
669 | { | 703 | { |
670 | struct wtp_data *wd = hidpp->private_data; | 704 | struct wtp_data *wd = hidpp->private_data; |
671 | 705 | ||
672 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && origin_is_hid_core) | 706 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && origin_is_hid_core) |
673 | /* this is the generic hid-input call */ | 707 | /* this is the generic hid-input call */ |
674 | return; | 708 | return; |
675 | 709 | ||
676 | __set_bit(EV_ABS, input_dev->evbit); | 710 | __set_bit(EV_ABS, input_dev->evbit); |
677 | __set_bit(EV_KEY, input_dev->evbit); | 711 | __set_bit(EV_KEY, input_dev->evbit); |
678 | __clear_bit(EV_REL, input_dev->evbit); | 712 | __clear_bit(EV_REL, input_dev->evbit); |
679 | __clear_bit(EV_LED, input_dev->evbit); | 713 | __clear_bit(EV_LED, input_dev->evbit); |
680 | 714 | ||
681 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, wd->x_size, 0, 0); | 715 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, wd->x_size, 0, 0); |
682 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, wd->resolution); | 716 | input_abs_set_res(input_dev, ABS_MT_POSITION_X, wd->resolution); |
683 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, wd->y_size, 0, 0); | 717 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, wd->y_size, 0, 0); |
684 | input_abs_set_res(input_dev, ABS_MT_POSITION_Y, wd->resolution); | 718 | input_abs_set_res(input_dev, ABS_MT_POSITION_Y, wd->resolution); |
685 | 719 | ||
686 | /* Max pressure is not given by the devices, pick one */ | 720 | /* Max pressure is not given by the devices, pick one */ |
687 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 50, 0, 0); | 721 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 50, 0, 0); |
688 | 722 | ||
689 | input_set_capability(input_dev, EV_KEY, BTN_LEFT); | 723 | input_set_capability(input_dev, EV_KEY, BTN_LEFT); |
690 | 724 | ||
691 | if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) | 725 | if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) |
692 | input_set_capability(input_dev, EV_KEY, BTN_RIGHT); | 726 | input_set_capability(input_dev, EV_KEY, BTN_RIGHT); |
693 | else | 727 | else |
694 | __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); | 728 | __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); |
695 | 729 | ||
696 | input_mt_init_slots(input_dev, wd->maxcontacts, INPUT_MT_POINTER | | 730 | input_mt_init_slots(input_dev, wd->maxcontacts, INPUT_MT_POINTER | |
697 | INPUT_MT_DROP_UNUSED); | 731 | INPUT_MT_DROP_UNUSED); |
698 | 732 | ||
699 | wd->input = input_dev; | 733 | wd->input = input_dev; |
700 | } | 734 | } |
701 | 735 | ||
702 | static void wtp_touch_event(struct wtp_data *wd, | 736 | static void wtp_touch_event(struct wtp_data *wd, |
703 | struct hidpp_touchpad_raw_xy_finger *touch_report) | 737 | struct hidpp_touchpad_raw_xy_finger *touch_report) |
704 | { | 738 | { |
705 | int slot; | 739 | int slot; |
706 | 740 | ||
707 | if (!touch_report->finger_id || touch_report->contact_type) | 741 | if (!touch_report->finger_id || touch_report->contact_type) |
708 | /* no actual data */ | 742 | /* no actual data */ |
709 | return; | 743 | return; |
710 | 744 | ||
711 | slot = input_mt_get_slot_by_key(wd->input, touch_report->finger_id); | 745 | slot = input_mt_get_slot_by_key(wd->input, touch_report->finger_id); |
712 | 746 | ||
713 | input_mt_slot(wd->input, slot); | 747 | input_mt_slot(wd->input, slot); |
714 | input_mt_report_slot_state(wd->input, MT_TOOL_FINGER, | 748 | input_mt_report_slot_state(wd->input, MT_TOOL_FINGER, |
715 | touch_report->contact_status); | 749 | touch_report->contact_status); |
716 | if (touch_report->contact_status) { | 750 | if (touch_report->contact_status) { |
717 | input_event(wd->input, EV_ABS, ABS_MT_POSITION_X, | 751 | input_event(wd->input, EV_ABS, ABS_MT_POSITION_X, |
718 | touch_report->x); | 752 | touch_report->x); |
719 | input_event(wd->input, EV_ABS, ABS_MT_POSITION_Y, | 753 | input_event(wd->input, EV_ABS, ABS_MT_POSITION_Y, |
720 | wd->flip_y ? wd->y_size - touch_report->y : | 754 | wd->flip_y ? wd->y_size - touch_report->y : |
721 | touch_report->y); | 755 | touch_report->y); |
722 | input_event(wd->input, EV_ABS, ABS_MT_PRESSURE, | 756 | input_event(wd->input, EV_ABS, ABS_MT_PRESSURE, |
723 | touch_report->area); | 757 | touch_report->area); |
724 | } | 758 | } |
725 | } | 759 | } |
726 | 760 | ||
727 | static void wtp_send_raw_xy_event(struct hidpp_device *hidpp, | 761 | static void wtp_send_raw_xy_event(struct hidpp_device *hidpp, |
728 | struct hidpp_touchpad_raw_xy *raw) | 762 | struct hidpp_touchpad_raw_xy *raw) |
729 | { | 763 | { |
730 | struct wtp_data *wd = hidpp->private_data; | 764 | struct wtp_data *wd = hidpp->private_data; |
731 | int i; | 765 | int i; |
732 | 766 | ||
733 | for (i = 0; i < 2; i++) | 767 | for (i = 0; i < 2; i++) |
734 | wtp_touch_event(wd, &(raw->fingers[i])); | 768 | wtp_touch_event(wd, &(raw->fingers[i])); |
735 | 769 | ||
736 | if (raw->end_of_frame && | 770 | if (raw->end_of_frame && |
737 | !(hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS)) | 771 | !(hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS)) |
738 | input_event(wd->input, EV_KEY, BTN_LEFT, raw->button); | 772 | input_event(wd->input, EV_KEY, BTN_LEFT, raw->button); |
739 | 773 | ||
740 | if (raw->end_of_frame || raw->finger_count <= 2) { | 774 | if (raw->end_of_frame || raw->finger_count <= 2) { |
741 | input_mt_sync_frame(wd->input); | 775 | input_mt_sync_frame(wd->input); |
742 | input_sync(wd->input); | 776 | input_sync(wd->input); |
743 | } | 777 | } |
744 | } | 778 | } |
745 | 779 | ||
746 | static int wtp_mouse_raw_xy_event(struct hidpp_device *hidpp, u8 *data) | 780 | static int wtp_mouse_raw_xy_event(struct hidpp_device *hidpp, u8 *data) |
747 | { | 781 | { |
748 | struct wtp_data *wd = hidpp->private_data; | 782 | struct wtp_data *wd = hidpp->private_data; |
749 | u8 c1_area = ((data[7] & 0xf) * (data[7] & 0xf) + | 783 | u8 c1_area = ((data[7] & 0xf) * (data[7] & 0xf) + |
750 | (data[7] >> 4) * (data[7] >> 4)) / 2; | 784 | (data[7] >> 4) * (data[7] >> 4)) / 2; |
751 | u8 c2_area = ((data[13] & 0xf) * (data[13] & 0xf) + | 785 | u8 c2_area = ((data[13] & 0xf) * (data[13] & 0xf) + |
752 | (data[13] >> 4) * (data[13] >> 4)) / 2; | 786 | (data[13] >> 4) * (data[13] >> 4)) / 2; |
753 | struct hidpp_touchpad_raw_xy raw = { | 787 | struct hidpp_touchpad_raw_xy raw = { |
754 | .timestamp = data[1], | 788 | .timestamp = data[1], |
755 | .fingers = { | 789 | .fingers = { |
756 | { | 790 | { |
757 | .contact_type = 0, | 791 | .contact_type = 0, |
758 | .contact_status = !!data[7], | 792 | .contact_status = !!data[7], |
759 | .x = get_unaligned_le16(&data[3]), | 793 | .x = get_unaligned_le16(&data[3]), |
760 | .y = get_unaligned_le16(&data[5]), | 794 | .y = get_unaligned_le16(&data[5]), |
761 | .z = c1_area, | 795 | .z = c1_area, |
762 | .area = c1_area, | 796 | .area = c1_area, |
763 | .finger_id = data[2], | 797 | .finger_id = data[2], |
764 | }, { | 798 | }, { |
765 | .contact_type = 0, | 799 | .contact_type = 0, |
766 | .contact_status = !!data[13], | 800 | .contact_status = !!data[13], |
767 | .x = get_unaligned_le16(&data[9]), | 801 | .x = get_unaligned_le16(&data[9]), |
768 | .y = get_unaligned_le16(&data[11]), | 802 | .y = get_unaligned_le16(&data[11]), |
769 | .z = c2_area, | 803 | .z = c2_area, |
770 | .area = c2_area, | 804 | .area = c2_area, |
771 | .finger_id = data[8], | 805 | .finger_id = data[8], |
772 | } | 806 | } |
773 | }, | 807 | }, |
774 | .finger_count = wd->maxcontacts, | 808 | .finger_count = wd->maxcontacts, |
775 | .spurious_flag = 0, | 809 | .spurious_flag = 0, |
776 | .end_of_frame = (data[0] >> 7) == 0, | 810 | .end_of_frame = (data[0] >> 7) == 0, |
777 | .button = data[0] & 0x01, | 811 | .button = data[0] & 0x01, |
778 | }; | 812 | }; |
779 | 813 | ||
780 | wtp_send_raw_xy_event(hidpp, &raw); | 814 | wtp_send_raw_xy_event(hidpp, &raw); |
781 | 815 | ||
782 | return 1; | 816 | return 1; |
783 | } | 817 | } |
784 | 818 | ||
785 | static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size) | 819 | static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size) |
786 | { | 820 | { |
787 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 821 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
788 | struct wtp_data *wd = hidpp->private_data; | 822 | struct wtp_data *wd = hidpp->private_data; |
789 | struct hidpp_report *report = (struct hidpp_report *)data; | 823 | struct hidpp_report *report = (struct hidpp_report *)data; |
790 | struct hidpp_touchpad_raw_xy raw; | 824 | struct hidpp_touchpad_raw_xy raw; |
791 | 825 | ||
792 | if (!wd || !wd->input) | 826 | if (!wd || !wd->input) |
793 | return 1; | 827 | return 1; |
794 | 828 | ||
795 | switch (data[0]) { | 829 | switch (data[0]) { |
796 | case 0x02: | 830 | case 0x02: |
831 | if (size < 2) { | ||
832 | hid_err(hdev, "Received HID report of bad size (%d)", | ||
833 | size); | ||
834 | return 1; | ||
835 | } | ||
797 | if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { | 836 | if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { |
798 | input_event(wd->input, EV_KEY, BTN_LEFT, | 837 | input_event(wd->input, EV_KEY, BTN_LEFT, |
799 | !!(data[1] & 0x01)); | 838 | !!(data[1] & 0x01)); |
800 | input_event(wd->input, EV_KEY, BTN_RIGHT, | 839 | input_event(wd->input, EV_KEY, BTN_RIGHT, |
801 | !!(data[1] & 0x02)); | 840 | !!(data[1] & 0x02)); |
802 | input_sync(wd->input); | 841 | input_sync(wd->input); |
842 | return 0; | ||
803 | } else { | 843 | } else { |
804 | if (size < 21) | 844 | if (size < 21) |
805 | return 1; | 845 | return 1; |
806 | return wtp_mouse_raw_xy_event(hidpp, &data[7]); | 846 | return wtp_mouse_raw_xy_event(hidpp, &data[7]); |
807 | } | 847 | } |
808 | case REPORT_ID_HIDPP_LONG: | 848 | case REPORT_ID_HIDPP_LONG: |
849 | /* size is already checked in hidpp_raw_event. */ | ||
809 | if ((report->fap.feature_index != wd->mt_feature_index) || | 850 | if ((report->fap.feature_index != wd->mt_feature_index) || |
810 | (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) | 851 | (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) |
811 | return 1; | 852 | return 1; |
812 | hidpp_touchpad_raw_xy_event(hidpp, data + 4, &raw); | 853 | hidpp_touchpad_raw_xy_event(hidpp, data + 4, &raw); |
813 | 854 | ||
814 | wtp_send_raw_xy_event(hidpp, &raw); | 855 | wtp_send_raw_xy_event(hidpp, &raw); |
815 | return 0; | 856 | return 0; |
816 | } | 857 | } |
817 | 858 | ||
818 | return 0; | 859 | return 0; |
819 | } | 860 | } |
820 | 861 | ||
821 | static int wtp_get_config(struct hidpp_device *hidpp) | 862 | static int wtp_get_config(struct hidpp_device *hidpp) |
822 | { | 863 | { |
823 | struct wtp_data *wd = hidpp->private_data; | 864 | struct wtp_data *wd = hidpp->private_data; |
824 | struct hidpp_touchpad_raw_info raw_info = {0}; | 865 | struct hidpp_touchpad_raw_info raw_info = {0}; |
825 | u8 feature_type; | 866 | u8 feature_type; |
826 | int ret; | 867 | int ret; |
827 | 868 | ||
828 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_TOUCHPAD_RAW_XY, | 869 | ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_TOUCHPAD_RAW_XY, |
829 | &wd->mt_feature_index, &feature_type); | 870 | &wd->mt_feature_index, &feature_type); |
830 | if (ret) | 871 | if (ret) |
831 | /* means that the device is not powered up */ | 872 | /* means that the device is not powered up */ |
832 | return ret; | 873 | return ret; |
833 | 874 | ||
834 | ret = hidpp_touchpad_get_raw_info(hidpp, wd->mt_feature_index, | 875 | ret = hidpp_touchpad_get_raw_info(hidpp, wd->mt_feature_index, |
835 | &raw_info); | 876 | &raw_info); |
836 | if (ret) | 877 | if (ret) |
837 | return ret; | 878 | return ret; |
838 | 879 | ||
839 | wd->x_size = raw_info.x_size; | 880 | wd->x_size = raw_info.x_size; |
840 | wd->y_size = raw_info.y_size; | 881 | wd->y_size = raw_info.y_size; |
841 | wd->maxcontacts = raw_info.maxcontacts; | 882 | wd->maxcontacts = raw_info.maxcontacts; |
842 | wd->flip_y = raw_info.origin == TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT; | 883 | wd->flip_y = raw_info.origin == TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT; |
843 | wd->resolution = raw_info.res; | 884 | wd->resolution = raw_info.res; |
844 | if (!wd->resolution) | 885 | if (!wd->resolution) |
845 | wd->resolution = WTP_MANUAL_RESOLUTION; | 886 | wd->resolution = WTP_MANUAL_RESOLUTION; |
846 | 887 | ||
847 | return 0; | 888 | return 0; |
848 | } | 889 | } |
849 | 890 | ||
850 | static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) | 891 | static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) |
851 | { | 892 | { |
852 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 893 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
853 | struct wtp_data *wd; | 894 | struct wtp_data *wd; |
854 | 895 | ||
855 | wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data), | 896 | wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data), |
856 | GFP_KERNEL); | 897 | GFP_KERNEL); |
857 | if (!wd) | 898 | if (!wd) |
858 | return -ENOMEM; | 899 | return -ENOMEM; |
859 | 900 | ||
860 | hidpp->private_data = wd; | 901 | hidpp->private_data = wd; |
861 | 902 | ||
862 | return 0; | 903 | return 0; |
863 | }; | 904 | }; |
864 | 905 | ||
865 | static void wtp_connect(struct hid_device *hdev, bool connected) | 906 | static void wtp_connect(struct hid_device *hdev, bool connected) |
866 | { | 907 | { |
867 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 908 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
868 | struct wtp_data *wd = hidpp->private_data; | 909 | struct wtp_data *wd = hidpp->private_data; |
869 | int ret; | 910 | int ret; |
870 | 911 | ||
871 | if (!connected) | 912 | if (!connected) |
872 | return; | 913 | return; |
873 | 914 | ||
874 | if (!wd->x_size) { | 915 | if (!wd->x_size) { |
875 | ret = wtp_get_config(hidpp); | 916 | ret = wtp_get_config(hidpp); |
876 | if (ret) { | 917 | if (ret) { |
877 | hid_err(hdev, "Can not get wtp config: %d\n", ret); | 918 | hid_err(hdev, "Can not get wtp config: %d\n", ret); |
878 | return; | 919 | return; |
879 | } | 920 | } |
880 | } | 921 | } |
881 | 922 | ||
882 | hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, | 923 | hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, |
883 | true, true); | 924 | true, true); |
884 | } | 925 | } |
885 | 926 | ||
886 | /* -------------------------------------------------------------------------- */ | 927 | /* -------------------------------------------------------------------------- */ |
887 | /* Generic HID++ devices */ | 928 | /* Generic HID++ devices */ |
888 | /* -------------------------------------------------------------------------- */ | 929 | /* -------------------------------------------------------------------------- */ |
889 | 930 | ||
890 | static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi, | 931 | static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
891 | struct hid_field *field, struct hid_usage *usage, | 932 | struct hid_field *field, struct hid_usage *usage, |
892 | unsigned long **bit, int *max) | 933 | unsigned long **bit, int *max) |
893 | { | 934 | { |
894 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 935 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
895 | 936 | ||
896 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 937 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) |
897 | return wtp_input_mapping(hdev, hi, field, usage, bit, max); | 938 | return wtp_input_mapping(hdev, hi, field, usage, bit, max); |
898 | 939 | ||
899 | return 0; | 940 | return 0; |
900 | } | 941 | } |
901 | 942 | ||
902 | static void hidpp_populate_input(struct hidpp_device *hidpp, | 943 | static void hidpp_populate_input(struct hidpp_device *hidpp, |
903 | struct input_dev *input, bool origin_is_hid_core) | 944 | struct input_dev *input, bool origin_is_hid_core) |
904 | { | 945 | { |
905 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 946 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) |
906 | wtp_populate_input(hidpp, input, origin_is_hid_core); | 947 | wtp_populate_input(hidpp, input, origin_is_hid_core); |
907 | } | 948 | } |
908 | 949 | ||
909 | static void hidpp_input_configured(struct hid_device *hdev, | 950 | static void hidpp_input_configured(struct hid_device *hdev, |
910 | struct hid_input *hidinput) | 951 | struct hid_input *hidinput) |
911 | { | 952 | { |
912 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 953 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
913 | struct input_dev *input = hidinput->input; | 954 | struct input_dev *input = hidinput->input; |
914 | 955 | ||
915 | hidpp_populate_input(hidpp, input, true); | 956 | hidpp_populate_input(hidpp, input, true); |
916 | } | 957 | } |
917 | 958 | ||
918 | static int hidpp_raw_hidpp_event(struct hidpp_device *hidpp, u8 *data, | 959 | static int hidpp_raw_hidpp_event(struct hidpp_device *hidpp, u8 *data, |
919 | int size) | 960 | int size) |
920 | { | 961 | { |
921 | struct hidpp_report *question = hidpp->send_receive_buf; | 962 | struct hidpp_report *question = hidpp->send_receive_buf; |
922 | struct hidpp_report *answer = hidpp->send_receive_buf; | 963 | struct hidpp_report *answer = hidpp->send_receive_buf; |
923 | struct hidpp_report *report = (struct hidpp_report *)data; | 964 | struct hidpp_report *report = (struct hidpp_report *)data; |
924 | 965 | ||
925 | /* | 966 | /* |
926 | * If the mutex is locked then we have a pending answer from a | 967 | * If the mutex is locked then we have a pending answer from a |
927 | * previoulsly sent command | 968 | * previoulsly sent command |
928 | */ | 969 | */ |
929 | if (unlikely(mutex_is_locked(&hidpp->send_mutex))) { | 970 | if (unlikely(mutex_is_locked(&hidpp->send_mutex))) { |
930 | /* | 971 | /* |
931 | * Check for a correct hidpp20 answer or the corresponding | 972 | * Check for a correct hidpp20 answer or the corresponding |
932 | * error | 973 | * error |
933 | */ | 974 | */ |
934 | if (hidpp_match_answer(question, report) || | 975 | if (hidpp_match_answer(question, report) || |
935 | hidpp_match_error(question, report)) { | 976 | hidpp_match_error(question, report)) { |
936 | *answer = *report; | 977 | *answer = *report; |
937 | hidpp->answer_available = true; | 978 | hidpp->answer_available = true; |
938 | wake_up(&hidpp->wait); | 979 | wake_up(&hidpp->wait); |
939 | /* | 980 | /* |
940 | * This was an answer to a command that this driver sent | 981 | * This was an answer to a command that this driver sent |
941 | * We return 1 to hid-core to avoid forwarding the | 982 | * We return 1 to hid-core to avoid forwarding the |
942 | * command upstream as it has been treated by the driver | 983 | * command upstream as it has been treated by the driver |
943 | */ | 984 | */ |
944 | 985 | ||
945 | return 1; | 986 | return 1; |
946 | } | 987 | } |
947 | } | 988 | } |
948 | 989 | ||
949 | if (unlikely(hidpp_report_is_connect_event(report))) { | 990 | if (unlikely(hidpp_report_is_connect_event(report))) { |
950 | atomic_set(&hidpp->connected, | 991 | atomic_set(&hidpp->connected, |
951 | !(report->rap.params[0] & (1 << 6))); | 992 | !(report->rap.params[0] & (1 << 6))); |
952 | if ((hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) && | 993 | if ((hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) && |
953 | (schedule_work(&hidpp->work) == 0)) | 994 | (schedule_work(&hidpp->work) == 0)) |
954 | dbg_hid("%s: connect event already queued\n", __func__); | 995 | dbg_hid("%s: connect event already queued\n", __func__); |
955 | return 1; | 996 | return 1; |
956 | } | 997 | } |
957 | 998 | ||
958 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 999 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) |
959 | return wtp_raw_event(hidpp->hid_dev, data, size); | 1000 | return wtp_raw_event(hidpp->hid_dev, data, size); |
960 | 1001 | ||
961 | return 0; | 1002 | return 0; |
962 | } | 1003 | } |
963 | 1004 | ||
964 | static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, | 1005 | static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, |
965 | u8 *data, int size) | 1006 | u8 *data, int size) |
966 | { | 1007 | { |
967 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 1008 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
968 | 1009 | ||
969 | switch (data[0]) { | 1010 | switch (data[0]) { |
970 | case REPORT_ID_HIDPP_LONG: | 1011 | case REPORT_ID_HIDPP_LONG: |
971 | if (size != HIDPP_REPORT_LONG_LENGTH) { | 1012 | if (size != HIDPP_REPORT_LONG_LENGTH) { |
972 | hid_err(hdev, "received hid++ report of bad size (%d)", | 1013 | hid_err(hdev, "received hid++ report of bad size (%d)", |
973 | size); | 1014 | size); |
974 | return 1; | 1015 | return 1; |
975 | } | 1016 | } |
976 | return hidpp_raw_hidpp_event(hidpp, data, size); | 1017 | return hidpp_raw_hidpp_event(hidpp, data, size); |
977 | case REPORT_ID_HIDPP_SHORT: | 1018 | case REPORT_ID_HIDPP_SHORT: |
978 | if (size != HIDPP_REPORT_SHORT_LENGTH) { | 1019 | if (size != HIDPP_REPORT_SHORT_LENGTH) { |
979 | hid_err(hdev, "received hid++ report of bad size (%d)", | 1020 | hid_err(hdev, "received hid++ report of bad size (%d)", |
980 | size); | 1021 | size); |
981 | return 1; | 1022 | return 1; |
982 | } | 1023 | } |
983 | return hidpp_raw_hidpp_event(hidpp, data, size); | 1024 | return hidpp_raw_hidpp_event(hidpp, data, size); |
984 | } | 1025 | } |
985 | 1026 | ||
986 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 1027 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) |
987 | return wtp_raw_event(hdev, data, size); | 1028 | return wtp_raw_event(hdev, data, size); |
988 | 1029 | ||
989 | return 0; | 1030 | return 0; |
990 | } | 1031 | } |
991 | 1032 | ||
992 | static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) | 1033 | static void hidpp_overwrite_name(struct hid_device *hdev, bool use_unifying) |
993 | { | 1034 | { |
994 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 1035 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
995 | char *name; | 1036 | char *name; |
996 | 1037 | ||
997 | if (use_unifying) | 1038 | if (use_unifying) |
998 | /* | 1039 | /* |
999 | * the device is connected through an Unifying receiver, and | 1040 | * the device is connected through an Unifying receiver, and |
1000 | * might not be already connected. | 1041 | * might not be already connected. |
1001 | * Ask the receiver for its name. | 1042 | * Ask the receiver for its name. |
1002 | */ | 1043 | */ |
1003 | name = hidpp_get_unifying_name(hidpp); | 1044 | name = hidpp_get_unifying_name(hidpp); |
1004 | else | 1045 | else |
1005 | name = hidpp_get_device_name(hidpp); | 1046 | name = hidpp_get_device_name(hidpp); |
1006 | 1047 | ||
1007 | if (!name) | 1048 | if (!name) |
1008 | hid_err(hdev, "unable to retrieve the name of the device"); | 1049 | hid_err(hdev, "unable to retrieve the name of the device"); |
1009 | else | 1050 | else |
1010 | snprintf(hdev->name, sizeof(hdev->name), "%s", name); | 1051 | snprintf(hdev->name, sizeof(hdev->name), "%s", name); |
1011 | 1052 | ||
1012 | kfree(name); | 1053 | kfree(name); |
1013 | } | 1054 | } |
1014 | 1055 | ||
1015 | static int hidpp_input_open(struct input_dev *dev) | 1056 | static int hidpp_input_open(struct input_dev *dev) |
1016 | { | 1057 | { |
1017 | struct hid_device *hid = input_get_drvdata(dev); | 1058 | struct hid_device *hid = input_get_drvdata(dev); |
1018 | 1059 | ||
1019 | return hid_hw_open(hid); | 1060 | return hid_hw_open(hid); |
1020 | } | 1061 | } |
1021 | 1062 | ||
1022 | static void hidpp_input_close(struct input_dev *dev) | 1063 | static void hidpp_input_close(struct input_dev *dev) |
1023 | { | 1064 | { |
1024 | struct hid_device *hid = input_get_drvdata(dev); | 1065 | struct hid_device *hid = input_get_drvdata(dev); |
1025 | 1066 | ||
1026 | hid_hw_close(hid); | 1067 | hid_hw_close(hid); |
1027 | } | 1068 | } |
1028 | 1069 | ||
1029 | static struct input_dev *hidpp_allocate_input(struct hid_device *hdev) | 1070 | static struct input_dev *hidpp_allocate_input(struct hid_device *hdev) |
1030 | { | 1071 | { |
1031 | struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev); | 1072 | struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev); |
1032 | 1073 | ||
1033 | if (!input_dev) | 1074 | if (!input_dev) |
1034 | return NULL; | 1075 | return NULL; |
1035 | 1076 | ||
1036 | input_set_drvdata(input_dev, hdev); | 1077 | input_set_drvdata(input_dev, hdev); |
1037 | input_dev->open = hidpp_input_open; | 1078 | input_dev->open = hidpp_input_open; |
1038 | input_dev->close = hidpp_input_close; | 1079 | input_dev->close = hidpp_input_close; |
1039 | 1080 | ||
1040 | input_dev->name = hdev->name; | 1081 | input_dev->name = hdev->name; |
1041 | input_dev->phys = hdev->phys; | 1082 | input_dev->phys = hdev->phys; |
1042 | input_dev->uniq = hdev->uniq; | 1083 | input_dev->uniq = hdev->uniq; |
1043 | input_dev->id.bustype = hdev->bus; | 1084 | input_dev->id.bustype = hdev->bus; |
1044 | input_dev->id.vendor = hdev->vendor; | 1085 | input_dev->id.vendor = hdev->vendor; |
1045 | input_dev->id.product = hdev->product; | 1086 | input_dev->id.product = hdev->product; |
1046 | input_dev->id.version = hdev->version; | 1087 | input_dev->id.version = hdev->version; |
1047 | input_dev->dev.parent = &hdev->dev; | 1088 | input_dev->dev.parent = &hdev->dev; |
1048 | 1089 | ||
1049 | return input_dev; | 1090 | return input_dev; |
1050 | } | 1091 | } |
1051 | 1092 | ||
1052 | static void hidpp_connect_event(struct hidpp_device *hidpp) | 1093 | static void hidpp_connect_event(struct hidpp_device *hidpp) |
1053 | { | 1094 | { |
1054 | struct hid_device *hdev = hidpp->hid_dev; | 1095 | struct hid_device *hdev = hidpp->hid_dev; |
1055 | int ret = 0; | 1096 | int ret = 0; |
1056 | bool connected = atomic_read(&hidpp->connected); | 1097 | bool connected = atomic_read(&hidpp->connected); |
1057 | struct input_dev *input; | 1098 | struct input_dev *input; |
1058 | char *name, *devm_name; | 1099 | char *name, *devm_name; |
1059 | 1100 | ||
1060 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 1101 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) |
1061 | wtp_connect(hdev, connected); | 1102 | wtp_connect(hdev, connected); |
1062 | 1103 | ||
1063 | if (!connected || hidpp->delayed_input) | 1104 | if (!connected || hidpp->delayed_input) |
1064 | return; | 1105 | return; |
1065 | 1106 | ||
1066 | if (!hidpp->protocol_major) { | 1107 | if (!hidpp->protocol_major) { |
1067 | ret = !hidpp_is_connected(hidpp); | 1108 | ret = !hidpp_is_connected(hidpp); |
1068 | if (ret) { | 1109 | if (ret) { |
1069 | hid_err(hdev, "Can not get the protocol version.\n"); | 1110 | hid_err(hdev, "Can not get the protocol version.\n"); |
1070 | return; | 1111 | return; |
1071 | } | 1112 | } |
1072 | } | 1113 | } |
1073 | 1114 | ||
1074 | /* the device is already connected, we can ask for its name and | 1115 | /* the device is already connected, we can ask for its name and |
1075 | * protocol */ | 1116 | * protocol */ |
1076 | hid_info(hdev, "HID++ %u.%u device connected.\n", | 1117 | hid_info(hdev, "HID++ %u.%u device connected.\n", |
1077 | hidpp->protocol_major, hidpp->protocol_minor); | 1118 | hidpp->protocol_major, hidpp->protocol_minor); |
1078 | 1119 | ||
1079 | input = hidpp_allocate_input(hdev); | 1120 | input = hidpp_allocate_input(hdev); |
1080 | if (!input) { | 1121 | if (!input) { |
1081 | hid_err(hdev, "cannot allocate new input device: %d\n", ret); | 1122 | hid_err(hdev, "cannot allocate new input device: %d\n", ret); |
1082 | return; | 1123 | return; |
1083 | } | 1124 | } |
1084 | 1125 | ||
1085 | name = hidpp_get_device_name(hidpp); | 1126 | name = hidpp_get_device_name(hidpp); |
1086 | if (!name) { | 1127 | if (!name) { |
1087 | hid_err(hdev, "unable to retrieve the name of the device"); | 1128 | hid_err(hdev, "unable to retrieve the name of the device"); |
1088 | } else { | 1129 | } else { |
1089 | devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL, "%s", name); | 1130 | devm_name = devm_kasprintf(&hdev->dev, GFP_KERNEL, "%s", name); |
1090 | if (devm_name) | 1131 | if (devm_name) |
1091 | input->name = devm_name; | 1132 | input->name = devm_name; |
1092 | kfree(name); | 1133 | kfree(name); |
1093 | } | 1134 | } |
1094 | 1135 | ||
1095 | hidpp_populate_input(hidpp, input, false); | 1136 | hidpp_populate_input(hidpp, input, false); |
1096 | 1137 | ||
1097 | ret = input_register_device(input); | 1138 | ret = input_register_device(input); |
1098 | if (ret) | 1139 | if (ret) |
1099 | input_free_device(input); | 1140 | input_free_device(input); |
1100 | 1141 | ||
1101 | hidpp->delayed_input = input; | 1142 | hidpp->delayed_input = input; |
1102 | } | 1143 | } |
1103 | 1144 | ||
1104 | static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) | 1145 | static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) |
1105 | { | 1146 | { |
1106 | struct hidpp_device *hidpp; | 1147 | struct hidpp_device *hidpp; |
1107 | int ret; | 1148 | int ret; |
1108 | bool connected; | 1149 | bool connected; |
1109 | unsigned int connect_mask = HID_CONNECT_DEFAULT; | 1150 | unsigned int connect_mask = HID_CONNECT_DEFAULT; |
1110 | 1151 | ||
1111 | hidpp = devm_kzalloc(&hdev->dev, sizeof(struct hidpp_device), | 1152 | hidpp = devm_kzalloc(&hdev->dev, sizeof(struct hidpp_device), |
1112 | GFP_KERNEL); | 1153 | GFP_KERNEL); |
1113 | if (!hidpp) | 1154 | if (!hidpp) |
1114 | return -ENOMEM; | 1155 | return -ENOMEM; |
1115 | 1156 | ||
1116 | hidpp->hid_dev = hdev; | 1157 | hidpp->hid_dev = hdev; |
1117 | hid_set_drvdata(hdev, hidpp); | 1158 | hid_set_drvdata(hdev, hidpp); |
1118 | 1159 | ||
1119 | hidpp->quirks = id->driver_data; | 1160 | hidpp->quirks = id->driver_data; |
1120 | 1161 | ||
1121 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { | 1162 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { |
1122 | ret = wtp_allocate(hdev, id); | 1163 | ret = wtp_allocate(hdev, id); |
1123 | if (ret) | 1164 | if (ret) |
1124 | goto wtp_allocate_fail; | 1165 | goto wtp_allocate_fail; |
1125 | } | 1166 | } |
1126 | 1167 | ||
1127 | INIT_WORK(&hidpp->work, delayed_work_cb); | 1168 | INIT_WORK(&hidpp->work, delayed_work_cb); |
1128 | mutex_init(&hidpp->send_mutex); | 1169 | mutex_init(&hidpp->send_mutex); |
1129 | init_waitqueue_head(&hidpp->wait); | 1170 | init_waitqueue_head(&hidpp->wait); |
1130 | 1171 | ||
1131 | ret = hid_parse(hdev); | 1172 | ret = hid_parse(hdev); |
1132 | if (ret) { | 1173 | if (ret) { |
1133 | hid_err(hdev, "%s:parse failed\n", __func__); | 1174 | hid_err(hdev, "%s:parse failed\n", __func__); |
1134 | goto hid_parse_fail; | 1175 | goto hid_parse_fail; |
1135 | } | 1176 | } |
1136 | 1177 | ||
1137 | /* Allow incoming packets */ | 1178 | /* Allow incoming packets */ |
1138 | hid_device_io_start(hdev); | 1179 | hid_device_io_start(hdev); |
1139 | 1180 | ||
1140 | connected = hidpp_is_connected(hidpp); | 1181 | connected = hidpp_is_connected(hidpp); |
1141 | if (id->group != HID_GROUP_LOGITECH_DJ_DEVICE) { | 1182 | if (id->group != HID_GROUP_LOGITECH_DJ_DEVICE) { |
1142 | if (!connected) { | 1183 | if (!connected) { |
1143 | hid_err(hdev, "Device not connected"); | 1184 | hid_err(hdev, "Device not connected"); |
1144 | hid_device_io_stop(hdev); | 1185 | hid_device_io_stop(hdev); |
1145 | goto hid_parse_fail; | 1186 | goto hid_parse_fail; |
1146 | } | 1187 | } |
1147 | 1188 | ||
1148 | hid_info(hdev, "HID++ %u.%u device connected.\n", | 1189 | hid_info(hdev, "HID++ %u.%u device connected.\n", |
1149 | hidpp->protocol_major, hidpp->protocol_minor); | 1190 | hidpp->protocol_major, hidpp->protocol_minor); |
1150 | } | 1191 | } |
1151 | 1192 | ||
1152 | hidpp_overwrite_name(hdev, id->group == HID_GROUP_LOGITECH_DJ_DEVICE); | 1193 | hidpp_overwrite_name(hdev, id->group == HID_GROUP_LOGITECH_DJ_DEVICE); |
1153 | atomic_set(&hidpp->connected, connected); | 1194 | atomic_set(&hidpp->connected, connected); |
1154 | 1195 | ||
1155 | if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)) { | 1196 | if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)) { |
1156 | ret = wtp_get_config(hidpp); | 1197 | ret = wtp_get_config(hidpp); |
1157 | if (ret) | 1198 | if (ret) |
1158 | goto hid_parse_fail; | 1199 | goto hid_parse_fail; |
1159 | } | 1200 | } |
1160 | 1201 | ||
1161 | /* Block incoming packets */ | 1202 | /* Block incoming packets */ |
1162 | hid_device_io_stop(hdev); | 1203 | hid_device_io_stop(hdev); |
1163 | 1204 | ||
1164 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) | 1205 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) |
1165 | connect_mask &= ~HID_CONNECT_HIDINPUT; | 1206 | connect_mask &= ~HID_CONNECT_HIDINPUT; |
1166 | 1207 | ||
1167 | /* Re-enable hidinput for multi-input devices */ | 1208 | /* Re-enable hidinput for multi-input devices */ |
1168 | if (hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) | 1209 | if (hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) |
1169 | connect_mask |= HID_CONNECT_HIDINPUT; | 1210 | connect_mask |= HID_CONNECT_HIDINPUT; |
1170 | 1211 | ||
1171 | ret = hid_hw_start(hdev, connect_mask); | 1212 | ret = hid_hw_start(hdev, connect_mask); |
1172 | if (ret) { | 1213 | if (ret) { |
1173 | hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); | 1214 | hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); |
1174 | goto hid_hw_start_fail; | 1215 | goto hid_hw_start_fail; |
1175 | } | 1216 | } |
1176 | 1217 | ||
1177 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) { | 1218 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) { |
1178 | /* Allow incoming packets */ | 1219 | /* Allow incoming packets */ |
1179 | hid_device_io_start(hdev); | 1220 | hid_device_io_start(hdev); |
1180 | 1221 | ||
1181 | hidpp_connect_event(hidpp); | 1222 | hidpp_connect_event(hidpp); |
1182 | } | 1223 | } |
1183 | 1224 | ||
1184 | return ret; | 1225 | return ret; |
1185 | 1226 | ||
1186 | hid_hw_start_fail: | 1227 | hid_hw_start_fail: |
1187 | hid_parse_fail: | 1228 | hid_parse_fail: |
1188 | cancel_work_sync(&hidpp->work); | 1229 | cancel_work_sync(&hidpp->work); |
1189 | mutex_destroy(&hidpp->send_mutex); | 1230 | mutex_destroy(&hidpp->send_mutex); |
1190 | wtp_allocate_fail: | 1231 | wtp_allocate_fail: |
1191 | hid_set_drvdata(hdev, NULL); | 1232 | hid_set_drvdata(hdev, NULL); |
1192 | return ret; | 1233 | return ret; |
1193 | } | 1234 | } |
1194 | 1235 | ||
1195 | static void hidpp_remove(struct hid_device *hdev) | 1236 | static void hidpp_remove(struct hid_device *hdev) |
1196 | { | 1237 | { |
1197 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 1238 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
1198 | 1239 | ||
1199 | cancel_work_sync(&hidpp->work); | 1240 | cancel_work_sync(&hidpp->work); |
1200 | mutex_destroy(&hidpp->send_mutex); | 1241 | mutex_destroy(&hidpp->send_mutex); |
1201 | hid_hw_stop(hdev); | 1242 | hid_hw_stop(hdev); |
1202 | } | 1243 | } |
1203 | 1244 | ||
1204 | static const struct hid_device_id hidpp_devices[] = { | 1245 | static const struct hid_device_id hidpp_devices[] = { |
1205 | { /* wireless touchpad */ | 1246 | { /* wireless touchpad */ |
1206 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | 1247 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1207 | USB_VENDOR_ID_LOGITECH, 0x4011), | 1248 | USB_VENDOR_ID_LOGITECH, 0x4011), |
1208 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT | | 1249 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT | |
1209 | HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS }, | 1250 | HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS }, |
1210 | { /* wireless touchpad T650 */ | 1251 | { /* wireless touchpad T650 */ |
1211 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | 1252 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1212 | USB_VENDOR_ID_LOGITECH, 0x4101), | 1253 | USB_VENDOR_ID_LOGITECH, 0x4101), |
1213 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT }, | 1254 | .driver_data = HIDPP_QUIRK_CLASS_WTP | HIDPP_QUIRK_DELAYED_INIT }, |
1214 | { /* wireless touchpad T651 */ | 1255 | { /* wireless touchpad T651 */ |
1215 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, | 1256 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
1216 | USB_DEVICE_ID_LOGITECH_T651), | 1257 | USB_DEVICE_ID_LOGITECH_T651), |
1217 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, | 1258 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, |
1218 | { /* Keyboard TK820 */ | 1259 | { /* Keyboard TK820 */ |
1219 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | 1260 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1220 | USB_VENDOR_ID_LOGITECH, 0x4102), | 1261 | USB_VENDOR_ID_LOGITECH, 0x4102), |
1221 | .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_MULTI_INPUT | | 1262 | .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_MULTI_INPUT | |
1222 | HIDPP_QUIRK_CLASS_WTP }, | 1263 | HIDPP_QUIRK_CLASS_WTP }, |
1223 | 1264 | ||
1224 | { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | 1265 | { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1225 | USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, | 1266 | USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, |
1226 | {} | 1267 | {} |
1227 | }; | 1268 | }; |
1228 | 1269 | ||
1229 | MODULE_DEVICE_TABLE(hid, hidpp_devices); | 1270 | MODULE_DEVICE_TABLE(hid, hidpp_devices); |
1230 | 1271 | ||
1231 | static struct hid_driver hidpp_driver = { | 1272 | static struct hid_driver hidpp_driver = { |
1232 | .name = "logitech-hidpp-device", | 1273 | .name = "logitech-hidpp-device", |
1233 | .id_table = hidpp_devices, | 1274 | .id_table = hidpp_devices, |
1234 | .probe = hidpp_probe, | 1275 | .probe = hidpp_probe, |
1235 | .remove = hidpp_remove, | 1276 | .remove = hidpp_remove, |
1236 | .raw_event = hidpp_raw_event, | 1277 | .raw_event = hidpp_raw_event, |
1237 | .input_configured = hidpp_input_configured, | 1278 | .input_configured = hidpp_input_configured, |
1238 | .input_mapping = hidpp_input_mapping, | 1279 | .input_mapping = hidpp_input_mapping, |
1239 | }; | 1280 | }; |
1240 | 1281 | ||
1241 | module_hid_driver(hidpp_driver); | 1282 | module_hid_driver(hidpp_driver); |
1242 | 1283 |
drivers/hid/hid-roccat-pyra.c
1 | /* | 1 | /* |
2 | * Roccat Pyra driver for Linux | 2 | * Roccat Pyra driver for Linux |
3 | * | 3 | * |
4 | * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net> | 4 | * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the Free | 9 | * under the terms of the GNU General Public License as published by the Free |
10 | * Software Foundation; either version 2 of the License, or (at your option) | 10 | * Software Foundation; either version 2 of the License, or (at your option) |
11 | * any later version. | 11 | * any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * Roccat Pyra is a mobile gamer mouse which comes in wired and wireless | 15 | * Roccat Pyra is a mobile gamer mouse which comes in wired and wireless |
16 | * variant. Wireless variant is not tested. | 16 | * variant. Wireless variant is not tested. |
17 | * Userland tools can be found at http://sourceforge.net/projects/roccat | 17 | * Userland tools can be found at http://sourceforge.net/projects/roccat |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/input.h> | 21 | #include <linux/input.h> |
22 | #include <linux/hid.h> | 22 | #include <linux/hid.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/hid-roccat.h> | 25 | #include <linux/hid-roccat.h> |
26 | #include "hid-ids.h" | 26 | #include "hid-ids.h" |
27 | #include "hid-roccat-common.h" | 27 | #include "hid-roccat-common.h" |
28 | #include "hid-roccat-pyra.h" | 28 | #include "hid-roccat-pyra.h" |
29 | 29 | ||
30 | static uint profile_numbers[5] = {0, 1, 2, 3, 4}; | 30 | static uint profile_numbers[5] = {0, 1, 2, 3, 4}; |
31 | 31 | ||
32 | /* pyra_class is used for creating sysfs attributes via roccat char device */ | 32 | /* pyra_class is used for creating sysfs attributes via roccat char device */ |
33 | static struct class *pyra_class; | 33 | static struct class *pyra_class; |
34 | 34 | ||
35 | static void profile_activated(struct pyra_device *pyra, | 35 | static void profile_activated(struct pyra_device *pyra, |
36 | unsigned int new_profile) | 36 | unsigned int new_profile) |
37 | { | 37 | { |
38 | if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) | ||
39 | return; | ||
38 | pyra->actual_profile = new_profile; | 40 | pyra->actual_profile = new_profile; |
39 | pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; | 41 | pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; |
40 | } | 42 | } |
41 | 43 | ||
42 | static int pyra_send_control(struct usb_device *usb_dev, int value, | 44 | static int pyra_send_control(struct usb_device *usb_dev, int value, |
43 | enum pyra_control_requests request) | 45 | enum pyra_control_requests request) |
44 | { | 46 | { |
45 | struct roccat_common2_control control; | 47 | struct roccat_common2_control control; |
46 | 48 | ||
47 | if ((request == PYRA_CONTROL_REQUEST_PROFILE_SETTINGS || | 49 | if ((request == PYRA_CONTROL_REQUEST_PROFILE_SETTINGS || |
48 | request == PYRA_CONTROL_REQUEST_PROFILE_BUTTONS) && | 50 | request == PYRA_CONTROL_REQUEST_PROFILE_BUTTONS) && |
49 | (value < 0 || value > 4)) | 51 | (value < 0 || value > 4)) |
50 | return -EINVAL; | 52 | return -EINVAL; |
51 | 53 | ||
52 | control.command = ROCCAT_COMMON_COMMAND_CONTROL; | 54 | control.command = ROCCAT_COMMON_COMMAND_CONTROL; |
53 | control.value = value; | 55 | control.value = value; |
54 | control.request = request; | 56 | control.request = request; |
55 | 57 | ||
56 | return roccat_common2_send(usb_dev, ROCCAT_COMMON_COMMAND_CONTROL, | 58 | return roccat_common2_send(usb_dev, ROCCAT_COMMON_COMMAND_CONTROL, |
57 | &control, sizeof(struct roccat_common2_control)); | 59 | &control, sizeof(struct roccat_common2_control)); |
58 | } | 60 | } |
59 | 61 | ||
60 | static int pyra_get_profile_settings(struct usb_device *usb_dev, | 62 | static int pyra_get_profile_settings(struct usb_device *usb_dev, |
61 | struct pyra_profile_settings *buf, int number) | 63 | struct pyra_profile_settings *buf, int number) |
62 | { | 64 | { |
63 | int retval; | 65 | int retval; |
64 | retval = pyra_send_control(usb_dev, number, | 66 | retval = pyra_send_control(usb_dev, number, |
65 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); | 67 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); |
66 | if (retval) | 68 | if (retval) |
67 | return retval; | 69 | return retval; |
68 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, | 70 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, |
69 | buf, PYRA_SIZE_PROFILE_SETTINGS); | 71 | buf, PYRA_SIZE_PROFILE_SETTINGS); |
70 | } | 72 | } |
71 | 73 | ||
72 | static int pyra_get_settings(struct usb_device *usb_dev, | 74 | static int pyra_get_settings(struct usb_device *usb_dev, |
73 | struct pyra_settings *buf) | 75 | struct pyra_settings *buf) |
74 | { | 76 | { |
75 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_SETTINGS, | 77 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_SETTINGS, |
76 | buf, PYRA_SIZE_SETTINGS); | 78 | buf, PYRA_SIZE_SETTINGS); |
77 | } | 79 | } |
78 | 80 | ||
79 | static int pyra_set_settings(struct usb_device *usb_dev, | 81 | static int pyra_set_settings(struct usb_device *usb_dev, |
80 | struct pyra_settings const *settings) | 82 | struct pyra_settings const *settings) |
81 | { | 83 | { |
82 | return roccat_common2_send_with_status(usb_dev, | 84 | return roccat_common2_send_with_status(usb_dev, |
83 | PYRA_COMMAND_SETTINGS, settings, | 85 | PYRA_COMMAND_SETTINGS, settings, |
84 | PYRA_SIZE_SETTINGS); | 86 | PYRA_SIZE_SETTINGS); |
85 | } | 87 | } |
86 | 88 | ||
87 | static ssize_t pyra_sysfs_read(struct file *fp, struct kobject *kobj, | 89 | static ssize_t pyra_sysfs_read(struct file *fp, struct kobject *kobj, |
88 | char *buf, loff_t off, size_t count, | 90 | char *buf, loff_t off, size_t count, |
89 | size_t real_size, uint command) | 91 | size_t real_size, uint command) |
90 | { | 92 | { |
91 | struct device *dev = | 93 | struct device *dev = |
92 | container_of(kobj, struct device, kobj)->parent->parent; | 94 | container_of(kobj, struct device, kobj)->parent->parent; |
93 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); | 95 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); |
94 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 96 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
95 | int retval; | 97 | int retval; |
96 | 98 | ||
97 | if (off >= real_size) | 99 | if (off >= real_size) |
98 | return 0; | 100 | return 0; |
99 | 101 | ||
100 | if (off != 0 || count != real_size) | 102 | if (off != 0 || count != real_size) |
101 | return -EINVAL; | 103 | return -EINVAL; |
102 | 104 | ||
103 | mutex_lock(&pyra->pyra_lock); | 105 | mutex_lock(&pyra->pyra_lock); |
104 | retval = roccat_common2_receive(usb_dev, command, buf, real_size); | 106 | retval = roccat_common2_receive(usb_dev, command, buf, real_size); |
105 | mutex_unlock(&pyra->pyra_lock); | 107 | mutex_unlock(&pyra->pyra_lock); |
106 | 108 | ||
107 | if (retval) | 109 | if (retval) |
108 | return retval; | 110 | return retval; |
109 | 111 | ||
110 | return real_size; | 112 | return real_size; |
111 | } | 113 | } |
112 | 114 | ||
113 | static ssize_t pyra_sysfs_write(struct file *fp, struct kobject *kobj, | 115 | static ssize_t pyra_sysfs_write(struct file *fp, struct kobject *kobj, |
114 | void const *buf, loff_t off, size_t count, | 116 | void const *buf, loff_t off, size_t count, |
115 | size_t real_size, uint command) | 117 | size_t real_size, uint command) |
116 | { | 118 | { |
117 | struct device *dev = | 119 | struct device *dev = |
118 | container_of(kobj, struct device, kobj)->parent->parent; | 120 | container_of(kobj, struct device, kobj)->parent->parent; |
119 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); | 121 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); |
120 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 122 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
121 | int retval; | 123 | int retval; |
122 | 124 | ||
123 | if (off != 0 || count != real_size) | 125 | if (off != 0 || count != real_size) |
124 | return -EINVAL; | 126 | return -EINVAL; |
125 | 127 | ||
126 | mutex_lock(&pyra->pyra_lock); | 128 | mutex_lock(&pyra->pyra_lock); |
127 | retval = roccat_common2_send_with_status(usb_dev, command, (void *)buf, real_size); | 129 | retval = roccat_common2_send_with_status(usb_dev, command, (void *)buf, real_size); |
128 | mutex_unlock(&pyra->pyra_lock); | 130 | mutex_unlock(&pyra->pyra_lock); |
129 | 131 | ||
130 | if (retval) | 132 | if (retval) |
131 | return retval; | 133 | return retval; |
132 | 134 | ||
133 | return real_size; | 135 | return real_size; |
134 | } | 136 | } |
135 | 137 | ||
136 | #define PYRA_SYSFS_W(thingy, THINGY) \ | 138 | #define PYRA_SYSFS_W(thingy, THINGY) \ |
137 | static ssize_t pyra_sysfs_write_ ## thingy(struct file *fp, \ | 139 | static ssize_t pyra_sysfs_write_ ## thingy(struct file *fp, \ |
138 | struct kobject *kobj, struct bin_attribute *attr, char *buf, \ | 140 | struct kobject *kobj, struct bin_attribute *attr, char *buf, \ |
139 | loff_t off, size_t count) \ | 141 | loff_t off, size_t count) \ |
140 | { \ | 142 | { \ |
141 | return pyra_sysfs_write(fp, kobj, buf, off, count, \ | 143 | return pyra_sysfs_write(fp, kobj, buf, off, count, \ |
142 | PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \ | 144 | PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \ |
143 | } | 145 | } |
144 | 146 | ||
145 | #define PYRA_SYSFS_R(thingy, THINGY) \ | 147 | #define PYRA_SYSFS_R(thingy, THINGY) \ |
146 | static ssize_t pyra_sysfs_read_ ## thingy(struct file *fp, \ | 148 | static ssize_t pyra_sysfs_read_ ## thingy(struct file *fp, \ |
147 | struct kobject *kobj, struct bin_attribute *attr, char *buf, \ | 149 | struct kobject *kobj, struct bin_attribute *attr, char *buf, \ |
148 | loff_t off, size_t count) \ | 150 | loff_t off, size_t count) \ |
149 | { \ | 151 | { \ |
150 | return pyra_sysfs_read(fp, kobj, buf, off, count, \ | 152 | return pyra_sysfs_read(fp, kobj, buf, off, count, \ |
151 | PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \ | 153 | PYRA_SIZE_ ## THINGY, PYRA_COMMAND_ ## THINGY); \ |
152 | } | 154 | } |
153 | 155 | ||
154 | #define PYRA_SYSFS_RW(thingy, THINGY) \ | 156 | #define PYRA_SYSFS_RW(thingy, THINGY) \ |
155 | PYRA_SYSFS_W(thingy, THINGY) \ | 157 | PYRA_SYSFS_W(thingy, THINGY) \ |
156 | PYRA_SYSFS_R(thingy, THINGY) | 158 | PYRA_SYSFS_R(thingy, THINGY) |
157 | 159 | ||
158 | #define PYRA_BIN_ATTRIBUTE_RW(thingy, THINGY) \ | 160 | #define PYRA_BIN_ATTRIBUTE_RW(thingy, THINGY) \ |
159 | PYRA_SYSFS_RW(thingy, THINGY); \ | 161 | PYRA_SYSFS_RW(thingy, THINGY); \ |
160 | static struct bin_attribute bin_attr_##thingy = { \ | 162 | static struct bin_attribute bin_attr_##thingy = { \ |
161 | .attr = { .name = #thingy, .mode = 0660 }, \ | 163 | .attr = { .name = #thingy, .mode = 0660 }, \ |
162 | .size = PYRA_SIZE_ ## THINGY, \ | 164 | .size = PYRA_SIZE_ ## THINGY, \ |
163 | .read = pyra_sysfs_read_ ## thingy, \ | 165 | .read = pyra_sysfs_read_ ## thingy, \ |
164 | .write = pyra_sysfs_write_ ## thingy \ | 166 | .write = pyra_sysfs_write_ ## thingy \ |
165 | } | 167 | } |
166 | 168 | ||
167 | #define PYRA_BIN_ATTRIBUTE_R(thingy, THINGY) \ | 169 | #define PYRA_BIN_ATTRIBUTE_R(thingy, THINGY) \ |
168 | PYRA_SYSFS_R(thingy, THINGY); \ | 170 | PYRA_SYSFS_R(thingy, THINGY); \ |
169 | static struct bin_attribute bin_attr_##thingy = { \ | 171 | static struct bin_attribute bin_attr_##thingy = { \ |
170 | .attr = { .name = #thingy, .mode = 0440 }, \ | 172 | .attr = { .name = #thingy, .mode = 0440 }, \ |
171 | .size = PYRA_SIZE_ ## THINGY, \ | 173 | .size = PYRA_SIZE_ ## THINGY, \ |
172 | .read = pyra_sysfs_read_ ## thingy, \ | 174 | .read = pyra_sysfs_read_ ## thingy, \ |
173 | } | 175 | } |
174 | 176 | ||
175 | #define PYRA_BIN_ATTRIBUTE_W(thingy, THINGY) \ | 177 | #define PYRA_BIN_ATTRIBUTE_W(thingy, THINGY) \ |
176 | PYRA_SYSFS_W(thingy, THINGY); \ | 178 | PYRA_SYSFS_W(thingy, THINGY); \ |
177 | static struct bin_attribute bin_attr_##thingy = { \ | 179 | static struct bin_attribute bin_attr_##thingy = { \ |
178 | .attr = { .name = #thingy, .mode = 0220 }, \ | 180 | .attr = { .name = #thingy, .mode = 0220 }, \ |
179 | .size = PYRA_SIZE_ ## THINGY, \ | 181 | .size = PYRA_SIZE_ ## THINGY, \ |
180 | .write = pyra_sysfs_write_ ## thingy \ | 182 | .write = pyra_sysfs_write_ ## thingy \ |
181 | } | 183 | } |
182 | 184 | ||
183 | PYRA_BIN_ATTRIBUTE_W(control, CONTROL); | 185 | PYRA_BIN_ATTRIBUTE_W(control, CONTROL); |
184 | PYRA_BIN_ATTRIBUTE_RW(info, INFO); | 186 | PYRA_BIN_ATTRIBUTE_RW(info, INFO); |
185 | PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS); | 187 | PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS); |
186 | PYRA_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS); | 188 | PYRA_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS); |
187 | 189 | ||
188 | static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, | 190 | static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, |
189 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 191 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
190 | loff_t off, size_t count) | 192 | loff_t off, size_t count) |
191 | { | 193 | { |
192 | struct device *dev = | 194 | struct device *dev = |
193 | container_of(kobj, struct device, kobj)->parent->parent; | 195 | container_of(kobj, struct device, kobj)->parent->parent; |
194 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 196 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
195 | ssize_t retval; | 197 | ssize_t retval; |
196 | 198 | ||
197 | retval = pyra_send_control(usb_dev, *(uint *)(attr->private), | 199 | retval = pyra_send_control(usb_dev, *(uint *)(attr->private), |
198 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); | 200 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); |
199 | if (retval) | 201 | if (retval) |
200 | return retval; | 202 | return retval; |
201 | 203 | ||
202 | return pyra_sysfs_read(fp, kobj, buf, off, count, | 204 | return pyra_sysfs_read(fp, kobj, buf, off, count, |
203 | PYRA_SIZE_PROFILE_SETTINGS, | 205 | PYRA_SIZE_PROFILE_SETTINGS, |
204 | PYRA_COMMAND_PROFILE_SETTINGS); | 206 | PYRA_COMMAND_PROFILE_SETTINGS); |
205 | } | 207 | } |
206 | 208 | ||
207 | static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, | 209 | static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, |
208 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 210 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
209 | loff_t off, size_t count) | 211 | loff_t off, size_t count) |
210 | { | 212 | { |
211 | struct device *dev = | 213 | struct device *dev = |
212 | container_of(kobj, struct device, kobj)->parent->parent; | 214 | container_of(kobj, struct device, kobj)->parent->parent; |
213 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 215 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
214 | ssize_t retval; | 216 | ssize_t retval; |
215 | 217 | ||
216 | retval = pyra_send_control(usb_dev, *(uint *)(attr->private), | 218 | retval = pyra_send_control(usb_dev, *(uint *)(attr->private), |
217 | PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); | 219 | PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); |
218 | if (retval) | 220 | if (retval) |
219 | return retval; | 221 | return retval; |
220 | 222 | ||
221 | return pyra_sysfs_read(fp, kobj, buf, off, count, | 223 | return pyra_sysfs_read(fp, kobj, buf, off, count, |
222 | PYRA_SIZE_PROFILE_BUTTONS, | 224 | PYRA_SIZE_PROFILE_BUTTONS, |
223 | PYRA_COMMAND_PROFILE_BUTTONS); | 225 | PYRA_COMMAND_PROFILE_BUTTONS); |
224 | } | 226 | } |
225 | 227 | ||
226 | #define PROFILE_ATTR(number) \ | 228 | #define PROFILE_ATTR(number) \ |
227 | static struct bin_attribute bin_attr_profile##number##_settings = { \ | 229 | static struct bin_attribute bin_attr_profile##number##_settings = { \ |
228 | .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ | 230 | .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ |
229 | .size = PYRA_SIZE_PROFILE_SETTINGS, \ | 231 | .size = PYRA_SIZE_PROFILE_SETTINGS, \ |
230 | .read = pyra_sysfs_read_profilex_settings, \ | 232 | .read = pyra_sysfs_read_profilex_settings, \ |
231 | .private = &profile_numbers[number-1], \ | 233 | .private = &profile_numbers[number-1], \ |
232 | }; \ | 234 | }; \ |
233 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ | 235 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ |
234 | .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ | 236 | .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ |
235 | .size = PYRA_SIZE_PROFILE_BUTTONS, \ | 237 | .size = PYRA_SIZE_PROFILE_BUTTONS, \ |
236 | .read = pyra_sysfs_read_profilex_buttons, \ | 238 | .read = pyra_sysfs_read_profilex_buttons, \ |
237 | .private = &profile_numbers[number-1], \ | 239 | .private = &profile_numbers[number-1], \ |
238 | }; | 240 | }; |
239 | PROFILE_ATTR(1); | 241 | PROFILE_ATTR(1); |
240 | PROFILE_ATTR(2); | 242 | PROFILE_ATTR(2); |
241 | PROFILE_ATTR(3); | 243 | PROFILE_ATTR(3); |
242 | PROFILE_ATTR(4); | 244 | PROFILE_ATTR(4); |
243 | PROFILE_ATTR(5); | 245 | PROFILE_ATTR(5); |
244 | 246 | ||
245 | static ssize_t pyra_sysfs_write_settings(struct file *fp, | 247 | static ssize_t pyra_sysfs_write_settings(struct file *fp, |
246 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 248 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
247 | loff_t off, size_t count) | 249 | loff_t off, size_t count) |
248 | { | 250 | { |
249 | struct device *dev = | 251 | struct device *dev = |
250 | container_of(kobj, struct device, kobj)->parent->parent; | 252 | container_of(kobj, struct device, kobj)->parent->parent; |
251 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); | 253 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); |
252 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 254 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
253 | int retval = 0; | 255 | int retval = 0; |
254 | struct pyra_roccat_report roccat_report; | 256 | struct pyra_roccat_report roccat_report; |
255 | struct pyra_settings const *settings; | 257 | struct pyra_settings const *settings; |
256 | 258 | ||
257 | if (off != 0 || count != PYRA_SIZE_SETTINGS) | 259 | if (off != 0 || count != PYRA_SIZE_SETTINGS) |
258 | return -EINVAL; | 260 | return -EINVAL; |
259 | 261 | ||
260 | mutex_lock(&pyra->pyra_lock); | ||
261 | |||
262 | settings = (struct pyra_settings const *)buf; | 262 | settings = (struct pyra_settings const *)buf; |
263 | if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) | ||
264 | return -EINVAL; | ||
265 | |||
266 | mutex_lock(&pyra->pyra_lock); | ||
263 | 267 | ||
264 | retval = pyra_set_settings(usb_dev, settings); | 268 | retval = pyra_set_settings(usb_dev, settings); |
265 | if (retval) { | 269 | if (retval) { |
266 | mutex_unlock(&pyra->pyra_lock); | 270 | mutex_unlock(&pyra->pyra_lock); |
267 | return retval; | 271 | return retval; |
268 | } | 272 | } |
269 | 273 | ||
270 | profile_activated(pyra, settings->startup_profile); | 274 | profile_activated(pyra, settings->startup_profile); |
271 | 275 | ||
272 | roccat_report.type = PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2; | 276 | roccat_report.type = PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2; |
273 | roccat_report.value = settings->startup_profile + 1; | 277 | roccat_report.value = settings->startup_profile + 1; |
274 | roccat_report.key = 0; | 278 | roccat_report.key = 0; |
275 | roccat_report_event(pyra->chrdev_minor, | 279 | roccat_report_event(pyra->chrdev_minor, |
276 | (uint8_t const *)&roccat_report); | 280 | (uint8_t const *)&roccat_report); |
277 | 281 | ||
278 | mutex_unlock(&pyra->pyra_lock); | 282 | mutex_unlock(&pyra->pyra_lock); |
279 | return PYRA_SIZE_SETTINGS; | 283 | return PYRA_SIZE_SETTINGS; |
280 | } | 284 | } |
281 | 285 | ||
282 | PYRA_SYSFS_R(settings, SETTINGS); | 286 | PYRA_SYSFS_R(settings, SETTINGS); |
283 | static struct bin_attribute bin_attr_settings = | 287 | static struct bin_attribute bin_attr_settings = |
284 | __BIN_ATTR(settings, (S_IWUSR | S_IRUGO), | 288 | __BIN_ATTR(settings, (S_IWUSR | S_IRUGO), |
285 | pyra_sysfs_read_settings, pyra_sysfs_write_settings, | 289 | pyra_sysfs_read_settings, pyra_sysfs_write_settings, |
286 | PYRA_SIZE_SETTINGS); | 290 | PYRA_SIZE_SETTINGS); |
287 | 291 | ||
288 | static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev, | 292 | static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev, |
289 | struct device_attribute *attr, char *buf) | 293 | struct device_attribute *attr, char *buf) |
290 | { | 294 | { |
291 | struct pyra_device *pyra = | 295 | struct pyra_device *pyra = |
292 | hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); | 296 | hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); |
293 | return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); | 297 | return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); |
294 | } | 298 | } |
295 | static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL); | 299 | static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL); |
296 | 300 | ||
297 | static ssize_t pyra_sysfs_show_actual_profile(struct device *dev, | 301 | static ssize_t pyra_sysfs_show_actual_profile(struct device *dev, |
298 | struct device_attribute *attr, char *buf) | 302 | struct device_attribute *attr, char *buf) |
299 | { | 303 | { |
300 | struct pyra_device *pyra = | 304 | struct pyra_device *pyra = |
301 | hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); | 305 | hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); |
302 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 306 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
303 | struct pyra_settings settings; | 307 | struct pyra_settings settings; |
304 | 308 | ||
305 | mutex_lock(&pyra->pyra_lock); | 309 | mutex_lock(&pyra->pyra_lock); |
306 | roccat_common2_receive(usb_dev, PYRA_COMMAND_SETTINGS, | 310 | roccat_common2_receive(usb_dev, PYRA_COMMAND_SETTINGS, |
307 | &settings, PYRA_SIZE_SETTINGS); | 311 | &settings, PYRA_SIZE_SETTINGS); |
308 | mutex_unlock(&pyra->pyra_lock); | 312 | mutex_unlock(&pyra->pyra_lock); |
309 | 313 | ||
310 | return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile); | 314 | return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile); |
311 | } | 315 | } |
312 | static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL); | 316 | static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL); |
313 | static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL); | 317 | static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL); |
314 | 318 | ||
315 | static ssize_t pyra_sysfs_show_firmware_version(struct device *dev, | 319 | static ssize_t pyra_sysfs_show_firmware_version(struct device *dev, |
316 | struct device_attribute *attr, char *buf) | 320 | struct device_attribute *attr, char *buf) |
317 | { | 321 | { |
318 | struct pyra_device *pyra; | 322 | struct pyra_device *pyra; |
319 | struct usb_device *usb_dev; | 323 | struct usb_device *usb_dev; |
320 | struct pyra_info info; | 324 | struct pyra_info info; |
321 | 325 | ||
322 | dev = dev->parent->parent; | 326 | dev = dev->parent->parent; |
323 | pyra = hid_get_drvdata(dev_get_drvdata(dev)); | 327 | pyra = hid_get_drvdata(dev_get_drvdata(dev)); |
324 | usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 328 | usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
325 | 329 | ||
326 | mutex_lock(&pyra->pyra_lock); | 330 | mutex_lock(&pyra->pyra_lock); |
327 | roccat_common2_receive(usb_dev, PYRA_COMMAND_INFO, | 331 | roccat_common2_receive(usb_dev, PYRA_COMMAND_INFO, |
328 | &info, PYRA_SIZE_INFO); | 332 | &info, PYRA_SIZE_INFO); |
329 | mutex_unlock(&pyra->pyra_lock); | 333 | mutex_unlock(&pyra->pyra_lock); |
330 | 334 | ||
331 | return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); | 335 | return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); |
332 | } | 336 | } |
333 | static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version, | 337 | static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version, |
334 | NULL); | 338 | NULL); |
335 | 339 | ||
336 | static struct attribute *pyra_attrs[] = { | 340 | static struct attribute *pyra_attrs[] = { |
337 | &dev_attr_actual_cpi.attr, | 341 | &dev_attr_actual_cpi.attr, |
338 | &dev_attr_actual_profile.attr, | 342 | &dev_attr_actual_profile.attr, |
339 | &dev_attr_firmware_version.attr, | 343 | &dev_attr_firmware_version.attr, |
340 | &dev_attr_startup_profile.attr, | 344 | &dev_attr_startup_profile.attr, |
341 | NULL, | 345 | NULL, |
342 | }; | 346 | }; |
343 | 347 | ||
344 | static struct bin_attribute *pyra_bin_attributes[] = { | 348 | static struct bin_attribute *pyra_bin_attributes[] = { |
345 | &bin_attr_control, | 349 | &bin_attr_control, |
346 | &bin_attr_info, | 350 | &bin_attr_info, |
347 | &bin_attr_profile_settings, | 351 | &bin_attr_profile_settings, |
348 | &bin_attr_profile_buttons, | 352 | &bin_attr_profile_buttons, |
349 | &bin_attr_settings, | 353 | &bin_attr_settings, |
350 | &bin_attr_profile1_settings, | 354 | &bin_attr_profile1_settings, |
351 | &bin_attr_profile2_settings, | 355 | &bin_attr_profile2_settings, |
352 | &bin_attr_profile3_settings, | 356 | &bin_attr_profile3_settings, |
353 | &bin_attr_profile4_settings, | 357 | &bin_attr_profile4_settings, |
354 | &bin_attr_profile5_settings, | 358 | &bin_attr_profile5_settings, |
355 | &bin_attr_profile1_buttons, | 359 | &bin_attr_profile1_buttons, |
356 | &bin_attr_profile2_buttons, | 360 | &bin_attr_profile2_buttons, |
357 | &bin_attr_profile3_buttons, | 361 | &bin_attr_profile3_buttons, |
358 | &bin_attr_profile4_buttons, | 362 | &bin_attr_profile4_buttons, |
359 | &bin_attr_profile5_buttons, | 363 | &bin_attr_profile5_buttons, |
360 | NULL, | 364 | NULL, |
361 | }; | 365 | }; |
362 | 366 | ||
363 | static const struct attribute_group pyra_group = { | 367 | static const struct attribute_group pyra_group = { |
364 | .attrs = pyra_attrs, | 368 | .attrs = pyra_attrs, |
365 | .bin_attrs = pyra_bin_attributes, | 369 | .bin_attrs = pyra_bin_attributes, |
366 | }; | 370 | }; |
367 | 371 | ||
368 | static const struct attribute_group *pyra_groups[] = { | 372 | static const struct attribute_group *pyra_groups[] = { |
369 | &pyra_group, | 373 | &pyra_group, |
370 | NULL, | 374 | NULL, |
371 | }; | 375 | }; |
372 | 376 | ||
373 | static int pyra_init_pyra_device_struct(struct usb_device *usb_dev, | 377 | static int pyra_init_pyra_device_struct(struct usb_device *usb_dev, |
374 | struct pyra_device *pyra) | 378 | struct pyra_device *pyra) |
375 | { | 379 | { |
376 | struct pyra_settings settings; | 380 | struct pyra_settings settings; |
377 | int retval, i; | 381 | int retval, i; |
378 | 382 | ||
379 | mutex_init(&pyra->pyra_lock); | 383 | mutex_init(&pyra->pyra_lock); |
380 | 384 | ||
381 | retval = pyra_get_settings(usb_dev, &settings); | 385 | retval = pyra_get_settings(usb_dev, &settings); |
382 | if (retval) | 386 | if (retval) |
383 | return retval; | 387 | return retval; |
384 | 388 | ||
385 | for (i = 0; i < 5; ++i) { | 389 | for (i = 0; i < 5; ++i) { |
386 | retval = pyra_get_profile_settings(usb_dev, | 390 | retval = pyra_get_profile_settings(usb_dev, |
387 | &pyra->profile_settings[i], i); | 391 | &pyra->profile_settings[i], i); |
388 | if (retval) | 392 | if (retval) |
389 | return retval; | 393 | return retval; |
390 | } | 394 | } |
391 | 395 | ||
392 | profile_activated(pyra, settings.startup_profile); | 396 | profile_activated(pyra, settings.startup_profile); |
393 | 397 | ||
394 | return 0; | 398 | return 0; |
395 | } | 399 | } |
396 | 400 | ||
397 | static int pyra_init_specials(struct hid_device *hdev) | 401 | static int pyra_init_specials(struct hid_device *hdev) |
398 | { | 402 | { |
399 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 403 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
400 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 404 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
401 | struct pyra_device *pyra; | 405 | struct pyra_device *pyra; |
402 | int retval; | 406 | int retval; |
403 | 407 | ||
404 | if (intf->cur_altsetting->desc.bInterfaceProtocol | 408 | if (intf->cur_altsetting->desc.bInterfaceProtocol |
405 | == USB_INTERFACE_PROTOCOL_MOUSE) { | 409 | == USB_INTERFACE_PROTOCOL_MOUSE) { |
406 | 410 | ||
407 | pyra = kzalloc(sizeof(*pyra), GFP_KERNEL); | 411 | pyra = kzalloc(sizeof(*pyra), GFP_KERNEL); |
408 | if (!pyra) { | 412 | if (!pyra) { |
409 | hid_err(hdev, "can't alloc device descriptor\n"); | 413 | hid_err(hdev, "can't alloc device descriptor\n"); |
410 | return -ENOMEM; | 414 | return -ENOMEM; |
411 | } | 415 | } |
412 | hid_set_drvdata(hdev, pyra); | 416 | hid_set_drvdata(hdev, pyra); |
413 | 417 | ||
414 | retval = pyra_init_pyra_device_struct(usb_dev, pyra); | 418 | retval = pyra_init_pyra_device_struct(usb_dev, pyra); |
415 | if (retval) { | 419 | if (retval) { |
416 | hid_err(hdev, "couldn't init struct pyra_device\n"); | 420 | hid_err(hdev, "couldn't init struct pyra_device\n"); |
417 | goto exit_free; | 421 | goto exit_free; |
418 | } | 422 | } |
419 | 423 | ||
420 | retval = roccat_connect(pyra_class, hdev, | 424 | retval = roccat_connect(pyra_class, hdev, |
421 | sizeof(struct pyra_roccat_report)); | 425 | sizeof(struct pyra_roccat_report)); |
422 | if (retval < 0) { | 426 | if (retval < 0) { |
423 | hid_err(hdev, "couldn't init char dev\n"); | 427 | hid_err(hdev, "couldn't init char dev\n"); |
424 | } else { | 428 | } else { |
425 | pyra->chrdev_minor = retval; | 429 | pyra->chrdev_minor = retval; |
426 | pyra->roccat_claimed = 1; | 430 | pyra->roccat_claimed = 1; |
427 | } | 431 | } |
428 | } else { | 432 | } else { |
429 | hid_set_drvdata(hdev, NULL); | 433 | hid_set_drvdata(hdev, NULL); |
430 | } | 434 | } |
431 | 435 | ||
432 | return 0; | 436 | return 0; |
433 | exit_free: | 437 | exit_free: |
434 | kfree(pyra); | 438 | kfree(pyra); |
435 | return retval; | 439 | return retval; |
436 | } | 440 | } |
437 | 441 | ||
438 | static void pyra_remove_specials(struct hid_device *hdev) | 442 | static void pyra_remove_specials(struct hid_device *hdev) |
439 | { | 443 | { |
440 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 444 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
441 | struct pyra_device *pyra; | 445 | struct pyra_device *pyra; |
442 | 446 | ||
443 | if (intf->cur_altsetting->desc.bInterfaceProtocol | 447 | if (intf->cur_altsetting->desc.bInterfaceProtocol |
444 | == USB_INTERFACE_PROTOCOL_MOUSE) { | 448 | == USB_INTERFACE_PROTOCOL_MOUSE) { |
445 | pyra = hid_get_drvdata(hdev); | 449 | pyra = hid_get_drvdata(hdev); |
446 | if (pyra->roccat_claimed) | 450 | if (pyra->roccat_claimed) |
447 | roccat_disconnect(pyra->chrdev_minor); | 451 | roccat_disconnect(pyra->chrdev_minor); |
448 | kfree(hid_get_drvdata(hdev)); | 452 | kfree(hid_get_drvdata(hdev)); |
449 | } | 453 | } |
450 | } | 454 | } |
451 | 455 | ||
452 | static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id) | 456 | static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id) |
453 | { | 457 | { |
454 | int retval; | 458 | int retval; |
455 | 459 | ||
456 | retval = hid_parse(hdev); | 460 | retval = hid_parse(hdev); |
457 | if (retval) { | 461 | if (retval) { |
458 | hid_err(hdev, "parse failed\n"); | 462 | hid_err(hdev, "parse failed\n"); |
459 | goto exit; | 463 | goto exit; |
460 | } | 464 | } |
461 | 465 | ||
462 | retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 466 | retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
463 | if (retval) { | 467 | if (retval) { |
464 | hid_err(hdev, "hw start failed\n"); | 468 | hid_err(hdev, "hw start failed\n"); |
465 | goto exit; | 469 | goto exit; |
466 | } | 470 | } |
467 | 471 | ||
468 | retval = pyra_init_specials(hdev); | 472 | retval = pyra_init_specials(hdev); |
469 | if (retval) { | 473 | if (retval) { |
470 | hid_err(hdev, "couldn't install mouse\n"); | 474 | hid_err(hdev, "couldn't install mouse\n"); |
471 | goto exit_stop; | 475 | goto exit_stop; |
472 | } | 476 | } |
473 | return 0; | 477 | return 0; |
474 | 478 | ||
475 | exit_stop: | 479 | exit_stop: |
476 | hid_hw_stop(hdev); | 480 | hid_hw_stop(hdev); |
477 | exit: | 481 | exit: |
478 | return retval; | 482 | return retval; |
479 | } | 483 | } |
480 | 484 | ||
481 | static void pyra_remove(struct hid_device *hdev) | 485 | static void pyra_remove(struct hid_device *hdev) |
482 | { | 486 | { |
483 | pyra_remove_specials(hdev); | 487 | pyra_remove_specials(hdev); |
484 | hid_hw_stop(hdev); | 488 | hid_hw_stop(hdev); |
485 | } | 489 | } |
486 | 490 | ||
487 | static void pyra_keep_values_up_to_date(struct pyra_device *pyra, | 491 | static void pyra_keep_values_up_to_date(struct pyra_device *pyra, |
488 | u8 const *data) | 492 | u8 const *data) |
489 | { | 493 | { |
490 | struct pyra_mouse_event_button const *button_event; | 494 | struct pyra_mouse_event_button const *button_event; |
491 | 495 | ||
492 | switch (data[0]) { | 496 | switch (data[0]) { |
493 | case PYRA_MOUSE_REPORT_NUMBER_BUTTON: | 497 | case PYRA_MOUSE_REPORT_NUMBER_BUTTON: |
494 | button_event = (struct pyra_mouse_event_button const *)data; | 498 | button_event = (struct pyra_mouse_event_button const *)data; |
495 | switch (button_event->type) { | 499 | switch (button_event->type) { |
496 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2: | 500 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2: |
497 | profile_activated(pyra, button_event->data1 - 1); | 501 | profile_activated(pyra, button_event->data1 - 1); |
498 | break; | 502 | break; |
499 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI: | 503 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI: |
500 | pyra->actual_cpi = button_event->data1; | 504 | pyra->actual_cpi = button_event->data1; |
501 | break; | 505 | break; |
502 | } | 506 | } |
503 | break; | 507 | break; |
504 | } | 508 | } |
505 | } | 509 | } |
506 | 510 | ||
507 | static void pyra_report_to_chrdev(struct pyra_device const *pyra, | 511 | static void pyra_report_to_chrdev(struct pyra_device const *pyra, |
508 | u8 const *data) | 512 | u8 const *data) |
509 | { | 513 | { |
510 | struct pyra_roccat_report roccat_report; | 514 | struct pyra_roccat_report roccat_report; |
511 | struct pyra_mouse_event_button const *button_event; | 515 | struct pyra_mouse_event_button const *button_event; |
512 | 516 | ||
513 | if (data[0] != PYRA_MOUSE_REPORT_NUMBER_BUTTON) | 517 | if (data[0] != PYRA_MOUSE_REPORT_NUMBER_BUTTON) |
514 | return; | 518 | return; |
515 | 519 | ||
516 | button_event = (struct pyra_mouse_event_button const *)data; | 520 | button_event = (struct pyra_mouse_event_button const *)data; |
517 | 521 | ||
518 | switch (button_event->type) { | 522 | switch (button_event->type) { |
519 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2: | 523 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2: |
520 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI: | 524 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI: |
521 | roccat_report.type = button_event->type; | 525 | roccat_report.type = button_event->type; |
522 | roccat_report.value = button_event->data1; | 526 | roccat_report.value = button_event->data1; |
523 | roccat_report.key = 0; | 527 | roccat_report.key = 0; |
524 | roccat_report_event(pyra->chrdev_minor, | 528 | roccat_report_event(pyra->chrdev_minor, |
525 | (uint8_t const *)&roccat_report); | 529 | (uint8_t const *)&roccat_report); |
526 | break; | 530 | break; |
527 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO: | 531 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO: |
528 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT: | 532 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT: |
529 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH: | 533 | case PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH: |
530 | if (button_event->data2 == PYRA_MOUSE_EVENT_BUTTON_PRESS) { | 534 | if (button_event->data2 == PYRA_MOUSE_EVENT_BUTTON_PRESS) { |
531 | roccat_report.type = button_event->type; | 535 | roccat_report.type = button_event->type; |
532 | roccat_report.key = button_event->data1; | 536 | roccat_report.key = button_event->data1; |
533 | /* | 537 | /* |
534 | * pyra reports profile numbers with range 1-5. | 538 | * pyra reports profile numbers with range 1-5. |
535 | * Keeping this behaviour. | 539 | * Keeping this behaviour. |
536 | */ | 540 | */ |
537 | roccat_report.value = pyra->actual_profile + 1; | 541 | roccat_report.value = pyra->actual_profile + 1; |
538 | roccat_report_event(pyra->chrdev_minor, | 542 | roccat_report_event(pyra->chrdev_minor, |
539 | (uint8_t const *)&roccat_report); | 543 | (uint8_t const *)&roccat_report); |
540 | } | 544 | } |
541 | break; | 545 | break; |
542 | } | 546 | } |
543 | } | 547 | } |
544 | 548 | ||
545 | static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report, | 549 | static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report, |
546 | u8 *data, int size) | 550 | u8 *data, int size) |
547 | { | 551 | { |
548 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 552 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
549 | struct pyra_device *pyra = hid_get_drvdata(hdev); | 553 | struct pyra_device *pyra = hid_get_drvdata(hdev); |
550 | 554 | ||
551 | if (intf->cur_altsetting->desc.bInterfaceProtocol | 555 | if (intf->cur_altsetting->desc.bInterfaceProtocol |
552 | != USB_INTERFACE_PROTOCOL_MOUSE) | 556 | != USB_INTERFACE_PROTOCOL_MOUSE) |
553 | return 0; | 557 | return 0; |
554 | 558 | ||
555 | if (pyra == NULL) | 559 | if (pyra == NULL) |
556 | return 0; | 560 | return 0; |
557 | 561 | ||
558 | pyra_keep_values_up_to_date(pyra, data); | 562 | pyra_keep_values_up_to_date(pyra, data); |
559 | 563 | ||
560 | if (pyra->roccat_claimed) | 564 | if (pyra->roccat_claimed) |
561 | pyra_report_to_chrdev(pyra, data); | 565 | pyra_report_to_chrdev(pyra, data); |
562 | 566 | ||
563 | return 0; | 567 | return 0; |
564 | } | 568 | } |
565 | 569 | ||
566 | static const struct hid_device_id pyra_devices[] = { | 570 | static const struct hid_device_id pyra_devices[] = { |
567 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, | 571 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, |
568 | USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, | 572 | USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, |
569 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, | 573 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, |
570 | USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, | 574 | USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, |
571 | { } | 575 | { } |
572 | }; | 576 | }; |
573 | 577 | ||
574 | MODULE_DEVICE_TABLE(hid, pyra_devices); | 578 | MODULE_DEVICE_TABLE(hid, pyra_devices); |
575 | 579 | ||
576 | static struct hid_driver pyra_driver = { | 580 | static struct hid_driver pyra_driver = { |
577 | .name = "pyra", | 581 | .name = "pyra", |
578 | .id_table = pyra_devices, | 582 | .id_table = pyra_devices, |
579 | .probe = pyra_probe, | 583 | .probe = pyra_probe, |
580 | .remove = pyra_remove, | 584 | .remove = pyra_remove, |
581 | .raw_event = pyra_raw_event | 585 | .raw_event = pyra_raw_event |
582 | }; | 586 | }; |
583 | 587 | ||
584 | static int __init pyra_init(void) | 588 | static int __init pyra_init(void) |
585 | { | 589 | { |
586 | int retval; | 590 | int retval; |
587 | 591 | ||
588 | /* class name has to be same as driver name */ | 592 | /* class name has to be same as driver name */ |
589 | pyra_class = class_create(THIS_MODULE, "pyra"); | 593 | pyra_class = class_create(THIS_MODULE, "pyra"); |
590 | if (IS_ERR(pyra_class)) | 594 | if (IS_ERR(pyra_class)) |
591 | return PTR_ERR(pyra_class); | 595 | return PTR_ERR(pyra_class); |
592 | pyra_class->dev_groups = pyra_groups; | 596 | pyra_class->dev_groups = pyra_groups; |
593 | 597 | ||
594 | retval = hid_register_driver(&pyra_driver); | 598 | retval = hid_register_driver(&pyra_driver); |
595 | if (retval) | 599 | if (retval) |
596 | class_destroy(pyra_class); | 600 | class_destroy(pyra_class); |
597 | return retval; | 601 | return retval; |
598 | } | 602 | } |
599 | 603 | ||
600 | static void __exit pyra_exit(void) | 604 | static void __exit pyra_exit(void) |
601 | { | 605 | { |
602 | hid_unregister_driver(&pyra_driver); | 606 | hid_unregister_driver(&pyra_driver); |
603 | class_destroy(pyra_class); | 607 | class_destroy(pyra_class); |
604 | } | 608 | } |
605 | 609 | ||
606 | module_init(pyra_init); | 610 | module_init(pyra_init); |
607 | module_exit(pyra_exit); | 611 | module_exit(pyra_exit); |
608 | 612 | ||
609 | MODULE_AUTHOR("Stefan Achatz"); | 613 | MODULE_AUTHOR("Stefan Achatz"); |
610 | MODULE_DESCRIPTION("USB Roccat Pyra driver"); | 614 | MODULE_DESCRIPTION("USB Roccat Pyra driver"); |
drivers/hid/i2c-hid/i2c-hid.c
1 | /* | 1 | /* |
2 | * HID over I2C protocol implementation | 2 | * HID over I2C protocol implementation |
3 | * | 3 | * |
4 | * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com> | 4 | * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com> |
5 | * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France | 5 | * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France |
6 | * Copyright (c) 2012 Red Hat, Inc | 6 | * Copyright (c) 2012 Red Hat, Inc |
7 | * | 7 | * |
8 | * This code is partly based on "USB HID support for Linux": | 8 | * This code is partly based on "USB HID support for Linux": |
9 | * | 9 | * |
10 | * Copyright (c) 1999 Andreas Gal | 10 | * Copyright (c) 1999 Andreas Gal |
11 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 11 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
12 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 12 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
13 | * Copyright (c) 2007-2008 Oliver Neukum | 13 | * Copyright (c) 2007-2008 Oliver Neukum |
14 | * Copyright (c) 2006-2010 Jiri Kosina | 14 | * Copyright (c) 2006-2010 Jiri Kosina |
15 | * | 15 | * |
16 | * This file is subject to the terms and conditions of the GNU General Public | 16 | * This file is subject to the terms and conditions of the GNU General Public |
17 | * License. See the file COPYING in the main directory of this archive for | 17 | * License. See the file COPYING in the main directory of this archive for |
18 | * more details. | 18 | * more details. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/i2c.h> | 22 | #include <linux/i2c.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/input.h> | 24 | #include <linux/input.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pm.h> | 27 | #include <linux/pm.h> |
28 | #include <linux/pm_runtime.h> | 28 | #include <linux/pm_runtime.h> |
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | #include <linux/wait.h> | 30 | #include <linux/wait.h> |
31 | #include <linux/err.h> | 31 | #include <linux/err.h> |
32 | #include <linux/string.h> | 32 | #include <linux/string.h> |
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/jiffies.h> | 34 | #include <linux/jiffies.h> |
35 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
36 | #include <linux/hid.h> | 36 | #include <linux/hid.h> |
37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
38 | #include <linux/acpi.h> | 38 | #include <linux/acpi.h> |
39 | #include <linux/of.h> | 39 | #include <linux/of.h> |
40 | 40 | ||
41 | #include <linux/i2c/i2c-hid.h> | 41 | #include <linux/i2c/i2c-hid.h> |
42 | 42 | ||
43 | /* flags */ | 43 | /* flags */ |
44 | #define I2C_HID_STARTED (1 << 0) | 44 | #define I2C_HID_STARTED (1 << 0) |
45 | #define I2C_HID_RESET_PENDING (1 << 1) | 45 | #define I2C_HID_RESET_PENDING (1 << 1) |
46 | #define I2C_HID_READ_PENDING (1 << 2) | 46 | #define I2C_HID_READ_PENDING (1 << 2) |
47 | 47 | ||
48 | #define I2C_HID_PWR_ON 0x00 | 48 | #define I2C_HID_PWR_ON 0x00 |
49 | #define I2C_HID_PWR_SLEEP 0x01 | 49 | #define I2C_HID_PWR_SLEEP 0x01 |
50 | 50 | ||
51 | /* debug option */ | 51 | /* debug option */ |
52 | static bool debug; | 52 | static bool debug; |
53 | module_param(debug, bool, 0444); | 53 | module_param(debug, bool, 0444); |
54 | MODULE_PARM_DESC(debug, "print a lot of debug information"); | 54 | MODULE_PARM_DESC(debug, "print a lot of debug information"); |
55 | 55 | ||
56 | #define i2c_hid_dbg(ihid, fmt, arg...) \ | 56 | #define i2c_hid_dbg(ihid, fmt, arg...) \ |
57 | do { \ | 57 | do { \ |
58 | if (debug) \ | 58 | if (debug) \ |
59 | dev_printk(KERN_DEBUG, &(ihid)->client->dev, fmt, ##arg); \ | 59 | dev_printk(KERN_DEBUG, &(ihid)->client->dev, fmt, ##arg); \ |
60 | } while (0) | 60 | } while (0) |
61 | 61 | ||
62 | struct i2c_hid_desc { | 62 | struct i2c_hid_desc { |
63 | __le16 wHIDDescLength; | 63 | __le16 wHIDDescLength; |
64 | __le16 bcdVersion; | 64 | __le16 bcdVersion; |
65 | __le16 wReportDescLength; | 65 | __le16 wReportDescLength; |
66 | __le16 wReportDescRegister; | 66 | __le16 wReportDescRegister; |
67 | __le16 wInputRegister; | 67 | __le16 wInputRegister; |
68 | __le16 wMaxInputLength; | 68 | __le16 wMaxInputLength; |
69 | __le16 wOutputRegister; | 69 | __le16 wOutputRegister; |
70 | __le16 wMaxOutputLength; | 70 | __le16 wMaxOutputLength; |
71 | __le16 wCommandRegister; | 71 | __le16 wCommandRegister; |
72 | __le16 wDataRegister; | 72 | __le16 wDataRegister; |
73 | __le16 wVendorID; | 73 | __le16 wVendorID; |
74 | __le16 wProductID; | 74 | __le16 wProductID; |
75 | __le16 wVersionID; | 75 | __le16 wVersionID; |
76 | __le32 reserved; | 76 | __le32 reserved; |
77 | } __packed; | 77 | } __packed; |
78 | 78 | ||
79 | struct i2c_hid_cmd { | 79 | struct i2c_hid_cmd { |
80 | unsigned int registerIndex; | 80 | unsigned int registerIndex; |
81 | __u8 opcode; | 81 | __u8 opcode; |
82 | unsigned int length; | 82 | unsigned int length; |
83 | bool wait; | 83 | bool wait; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | union command { | 86 | union command { |
87 | u8 data[0]; | 87 | u8 data[0]; |
88 | struct cmd { | 88 | struct cmd { |
89 | __le16 reg; | 89 | __le16 reg; |
90 | __u8 reportTypeID; | 90 | __u8 reportTypeID; |
91 | __u8 opcode; | 91 | __u8 opcode; |
92 | } __packed c; | 92 | } __packed c; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | #define I2C_HID_CMD(opcode_) \ | 95 | #define I2C_HID_CMD(opcode_) \ |
96 | .opcode = opcode_, .length = 4, \ | 96 | .opcode = opcode_, .length = 4, \ |
97 | .registerIndex = offsetof(struct i2c_hid_desc, wCommandRegister) | 97 | .registerIndex = offsetof(struct i2c_hid_desc, wCommandRegister) |
98 | 98 | ||
99 | /* fetch HID descriptor */ | 99 | /* fetch HID descriptor */ |
100 | static const struct i2c_hid_cmd hid_descr_cmd = { .length = 2 }; | 100 | static const struct i2c_hid_cmd hid_descr_cmd = { .length = 2 }; |
101 | /* fetch report descriptors */ | 101 | /* fetch report descriptors */ |
102 | static const struct i2c_hid_cmd hid_report_descr_cmd = { | 102 | static const struct i2c_hid_cmd hid_report_descr_cmd = { |
103 | .registerIndex = offsetof(struct i2c_hid_desc, | 103 | .registerIndex = offsetof(struct i2c_hid_desc, |
104 | wReportDescRegister), | 104 | wReportDescRegister), |
105 | .opcode = 0x00, | 105 | .opcode = 0x00, |
106 | .length = 2 }; | 106 | .length = 2 }; |
107 | /* commands */ | 107 | /* commands */ |
108 | static const struct i2c_hid_cmd hid_reset_cmd = { I2C_HID_CMD(0x01), | 108 | static const struct i2c_hid_cmd hid_reset_cmd = { I2C_HID_CMD(0x01), |
109 | .wait = true }; | 109 | .wait = true }; |
110 | static const struct i2c_hid_cmd hid_get_report_cmd = { I2C_HID_CMD(0x02) }; | 110 | static const struct i2c_hid_cmd hid_get_report_cmd = { I2C_HID_CMD(0x02) }; |
111 | static const struct i2c_hid_cmd hid_set_report_cmd = { I2C_HID_CMD(0x03) }; | 111 | static const struct i2c_hid_cmd hid_set_report_cmd = { I2C_HID_CMD(0x03) }; |
112 | static const struct i2c_hid_cmd hid_set_power_cmd = { I2C_HID_CMD(0x08) }; | 112 | static const struct i2c_hid_cmd hid_set_power_cmd = { I2C_HID_CMD(0x08) }; |
113 | static const struct i2c_hid_cmd hid_no_cmd = { .length = 0 }; | 113 | static const struct i2c_hid_cmd hid_no_cmd = { .length = 0 }; |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * These definitions are not used here, but are defined by the spec. | 116 | * These definitions are not used here, but are defined by the spec. |
117 | * Keeping them here for documentation purposes. | 117 | * Keeping them here for documentation purposes. |
118 | * | 118 | * |
119 | * static const struct i2c_hid_cmd hid_get_idle_cmd = { I2C_HID_CMD(0x04) }; | 119 | * static const struct i2c_hid_cmd hid_get_idle_cmd = { I2C_HID_CMD(0x04) }; |
120 | * static const struct i2c_hid_cmd hid_set_idle_cmd = { I2C_HID_CMD(0x05) }; | 120 | * static const struct i2c_hid_cmd hid_set_idle_cmd = { I2C_HID_CMD(0x05) }; |
121 | * static const struct i2c_hid_cmd hid_get_protocol_cmd = { I2C_HID_CMD(0x06) }; | 121 | * static const struct i2c_hid_cmd hid_get_protocol_cmd = { I2C_HID_CMD(0x06) }; |
122 | * static const struct i2c_hid_cmd hid_set_protocol_cmd = { I2C_HID_CMD(0x07) }; | 122 | * static const struct i2c_hid_cmd hid_set_protocol_cmd = { I2C_HID_CMD(0x07) }; |
123 | */ | 123 | */ |
124 | 124 | ||
125 | static DEFINE_MUTEX(i2c_hid_open_mut); | 125 | static DEFINE_MUTEX(i2c_hid_open_mut); |
126 | 126 | ||
127 | /* The main device structure */ | 127 | /* The main device structure */ |
128 | struct i2c_hid { | 128 | struct i2c_hid { |
129 | struct i2c_client *client; /* i2c client */ | 129 | struct i2c_client *client; /* i2c client */ |
130 | struct hid_device *hid; /* pointer to corresponding HID dev */ | 130 | struct hid_device *hid; /* pointer to corresponding HID dev */ |
131 | union { | 131 | union { |
132 | __u8 hdesc_buffer[sizeof(struct i2c_hid_desc)]; | 132 | __u8 hdesc_buffer[sizeof(struct i2c_hid_desc)]; |
133 | struct i2c_hid_desc hdesc; /* the HID Descriptor */ | 133 | struct i2c_hid_desc hdesc; /* the HID Descriptor */ |
134 | }; | 134 | }; |
135 | __le16 wHIDDescRegister; /* location of the i2c | 135 | __le16 wHIDDescRegister; /* location of the i2c |
136 | * register of the HID | 136 | * register of the HID |
137 | * descriptor. */ | 137 | * descriptor. */ |
138 | unsigned int bufsize; /* i2c buffer size */ | 138 | unsigned int bufsize; /* i2c buffer size */ |
139 | char *inbuf; /* Input buffer */ | 139 | char *inbuf; /* Input buffer */ |
140 | char *rawbuf; /* Raw Input buffer */ | 140 | char *rawbuf; /* Raw Input buffer */ |
141 | char *cmdbuf; /* Command buffer */ | 141 | char *cmdbuf; /* Command buffer */ |
142 | char *argsbuf; /* Command arguments buffer */ | 142 | char *argsbuf; /* Command arguments buffer */ |
143 | 143 | ||
144 | unsigned long flags; /* device flags */ | 144 | unsigned long flags; /* device flags */ |
145 | 145 | ||
146 | wait_queue_head_t wait; /* For waiting the interrupt */ | 146 | wait_queue_head_t wait; /* For waiting the interrupt */ |
147 | 147 | ||
148 | struct i2c_hid_platform_data pdata; | 148 | struct i2c_hid_platform_data pdata; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | static int __i2c_hid_command(struct i2c_client *client, | 151 | static int __i2c_hid_command(struct i2c_client *client, |
152 | const struct i2c_hid_cmd *command, u8 reportID, | 152 | const struct i2c_hid_cmd *command, u8 reportID, |
153 | u8 reportType, u8 *args, int args_len, | 153 | u8 reportType, u8 *args, int args_len, |
154 | unsigned char *buf_recv, int data_len) | 154 | unsigned char *buf_recv, int data_len) |
155 | { | 155 | { |
156 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 156 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
157 | union command *cmd = (union command *)ihid->cmdbuf; | 157 | union command *cmd = (union command *)ihid->cmdbuf; |
158 | int ret; | 158 | int ret; |
159 | struct i2c_msg msg[2]; | 159 | struct i2c_msg msg[2]; |
160 | int msg_num = 1; | 160 | int msg_num = 1; |
161 | 161 | ||
162 | int length = command->length; | 162 | int length = command->length; |
163 | bool wait = command->wait; | 163 | bool wait = command->wait; |
164 | unsigned int registerIndex = command->registerIndex; | 164 | unsigned int registerIndex = command->registerIndex; |
165 | 165 | ||
166 | /* special case for hid_descr_cmd */ | 166 | /* special case for hid_descr_cmd */ |
167 | if (command == &hid_descr_cmd) { | 167 | if (command == &hid_descr_cmd) { |
168 | cmd->c.reg = ihid->wHIDDescRegister; | 168 | cmd->c.reg = ihid->wHIDDescRegister; |
169 | } else { | 169 | } else { |
170 | cmd->data[0] = ihid->hdesc_buffer[registerIndex]; | 170 | cmd->data[0] = ihid->hdesc_buffer[registerIndex]; |
171 | cmd->data[1] = ihid->hdesc_buffer[registerIndex + 1]; | 171 | cmd->data[1] = ihid->hdesc_buffer[registerIndex + 1]; |
172 | } | 172 | } |
173 | 173 | ||
174 | if (length > 2) { | 174 | if (length > 2) { |
175 | cmd->c.opcode = command->opcode; | 175 | cmd->c.opcode = command->opcode; |
176 | cmd->c.reportTypeID = reportID | reportType << 4; | 176 | cmd->c.reportTypeID = reportID | reportType << 4; |
177 | } | 177 | } |
178 | 178 | ||
179 | memcpy(cmd->data + length, args, args_len); | 179 | memcpy(cmd->data + length, args, args_len); |
180 | length += args_len; | 180 | length += args_len; |
181 | 181 | ||
182 | i2c_hid_dbg(ihid, "%s: cmd=%*ph\n", __func__, length, cmd->data); | 182 | i2c_hid_dbg(ihid, "%s: cmd=%*ph\n", __func__, length, cmd->data); |
183 | 183 | ||
184 | msg[0].addr = client->addr; | 184 | msg[0].addr = client->addr; |
185 | msg[0].flags = client->flags & I2C_M_TEN; | 185 | msg[0].flags = client->flags & I2C_M_TEN; |
186 | msg[0].len = length; | 186 | msg[0].len = length; |
187 | msg[0].buf = cmd->data; | 187 | msg[0].buf = cmd->data; |
188 | if (data_len > 0) { | 188 | if (data_len > 0) { |
189 | msg[1].addr = client->addr; | 189 | msg[1].addr = client->addr; |
190 | msg[1].flags = client->flags & I2C_M_TEN; | 190 | msg[1].flags = client->flags & I2C_M_TEN; |
191 | msg[1].flags |= I2C_M_RD; | 191 | msg[1].flags |= I2C_M_RD; |
192 | msg[1].len = data_len; | 192 | msg[1].len = data_len; |
193 | msg[1].buf = buf_recv; | 193 | msg[1].buf = buf_recv; |
194 | msg_num = 2; | 194 | msg_num = 2; |
195 | set_bit(I2C_HID_READ_PENDING, &ihid->flags); | 195 | set_bit(I2C_HID_READ_PENDING, &ihid->flags); |
196 | } | 196 | } |
197 | 197 | ||
198 | if (wait) | 198 | if (wait) |
199 | set_bit(I2C_HID_RESET_PENDING, &ihid->flags); | 199 | set_bit(I2C_HID_RESET_PENDING, &ihid->flags); |
200 | 200 | ||
201 | ret = i2c_transfer(client->adapter, msg, msg_num); | 201 | ret = i2c_transfer(client->adapter, msg, msg_num); |
202 | 202 | ||
203 | if (data_len > 0) | 203 | if (data_len > 0) |
204 | clear_bit(I2C_HID_READ_PENDING, &ihid->flags); | 204 | clear_bit(I2C_HID_READ_PENDING, &ihid->flags); |
205 | 205 | ||
206 | if (ret != msg_num) | 206 | if (ret != msg_num) |
207 | return ret < 0 ? ret : -EIO; | 207 | return ret < 0 ? ret : -EIO; |
208 | 208 | ||
209 | ret = 0; | 209 | ret = 0; |
210 | 210 | ||
211 | if (wait) { | 211 | if (wait) { |
212 | i2c_hid_dbg(ihid, "%s: waiting...\n", __func__); | 212 | i2c_hid_dbg(ihid, "%s: waiting...\n", __func__); |
213 | if (!wait_event_timeout(ihid->wait, | 213 | if (!wait_event_timeout(ihid->wait, |
214 | !test_bit(I2C_HID_RESET_PENDING, &ihid->flags), | 214 | !test_bit(I2C_HID_RESET_PENDING, &ihid->flags), |
215 | msecs_to_jiffies(5000))) | 215 | msecs_to_jiffies(5000))) |
216 | ret = -ENODATA; | 216 | ret = -ENODATA; |
217 | i2c_hid_dbg(ihid, "%s: finished.\n", __func__); | 217 | i2c_hid_dbg(ihid, "%s: finished.\n", __func__); |
218 | } | 218 | } |
219 | 219 | ||
220 | return ret; | 220 | return ret; |
221 | } | 221 | } |
222 | 222 | ||
223 | static int i2c_hid_command(struct i2c_client *client, | 223 | static int i2c_hid_command(struct i2c_client *client, |
224 | const struct i2c_hid_cmd *command, | 224 | const struct i2c_hid_cmd *command, |
225 | unsigned char *buf_recv, int data_len) | 225 | unsigned char *buf_recv, int data_len) |
226 | { | 226 | { |
227 | return __i2c_hid_command(client, command, 0, 0, NULL, 0, | 227 | return __i2c_hid_command(client, command, 0, 0, NULL, 0, |
228 | buf_recv, data_len); | 228 | buf_recv, data_len); |
229 | } | 229 | } |
230 | 230 | ||
231 | static int i2c_hid_get_report(struct i2c_client *client, u8 reportType, | 231 | static int i2c_hid_get_report(struct i2c_client *client, u8 reportType, |
232 | u8 reportID, unsigned char *buf_recv, int data_len) | 232 | u8 reportID, unsigned char *buf_recv, int data_len) |
233 | { | 233 | { |
234 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 234 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
235 | u8 args[3]; | 235 | u8 args[3]; |
236 | int ret; | 236 | int ret; |
237 | int args_len = 0; | 237 | int args_len = 0; |
238 | u16 readRegister = le16_to_cpu(ihid->hdesc.wDataRegister); | 238 | u16 readRegister = le16_to_cpu(ihid->hdesc.wDataRegister); |
239 | 239 | ||
240 | i2c_hid_dbg(ihid, "%s\n", __func__); | 240 | i2c_hid_dbg(ihid, "%s\n", __func__); |
241 | 241 | ||
242 | if (reportID >= 0x0F) { | 242 | if (reportID >= 0x0F) { |
243 | args[args_len++] = reportID; | 243 | args[args_len++] = reportID; |
244 | reportID = 0x0F; | 244 | reportID = 0x0F; |
245 | } | 245 | } |
246 | 246 | ||
247 | args[args_len++] = readRegister & 0xFF; | 247 | args[args_len++] = readRegister & 0xFF; |
248 | args[args_len++] = readRegister >> 8; | 248 | args[args_len++] = readRegister >> 8; |
249 | 249 | ||
250 | ret = __i2c_hid_command(client, &hid_get_report_cmd, reportID, | 250 | ret = __i2c_hid_command(client, &hid_get_report_cmd, reportID, |
251 | reportType, args, args_len, buf_recv, data_len); | 251 | reportType, args, args_len, buf_recv, data_len); |
252 | if (ret) { | 252 | if (ret) { |
253 | dev_err(&client->dev, | 253 | dev_err(&client->dev, |
254 | "failed to retrieve report from device.\n"); | 254 | "failed to retrieve report from device.\n"); |
255 | return ret; | 255 | return ret; |
256 | } | 256 | } |
257 | 257 | ||
258 | return 0; | 258 | return 0; |
259 | } | 259 | } |
260 | 260 | ||
261 | /** | 261 | /** |
262 | * i2c_hid_set_or_send_report: forward an incoming report to the device | 262 | * i2c_hid_set_or_send_report: forward an incoming report to the device |
263 | * @client: the i2c_client of the device | 263 | * @client: the i2c_client of the device |
264 | * @reportType: 0x03 for HID_FEATURE_REPORT ; 0x02 for HID_OUTPUT_REPORT | 264 | * @reportType: 0x03 for HID_FEATURE_REPORT ; 0x02 for HID_OUTPUT_REPORT |
265 | * @reportID: the report ID | 265 | * @reportID: the report ID |
266 | * @buf: the actual data to transfer, without the report ID | 266 | * @buf: the actual data to transfer, without the report ID |
267 | * @len: size of buf | 267 | * @len: size of buf |
268 | * @use_data: true: use SET_REPORT HID command, false: send plain OUTPUT report | 268 | * @use_data: true: use SET_REPORT HID command, false: send plain OUTPUT report |
269 | */ | 269 | */ |
270 | static int i2c_hid_set_or_send_report(struct i2c_client *client, u8 reportType, | 270 | static int i2c_hid_set_or_send_report(struct i2c_client *client, u8 reportType, |
271 | u8 reportID, unsigned char *buf, size_t data_len, bool use_data) | 271 | u8 reportID, unsigned char *buf, size_t data_len, bool use_data) |
272 | { | 272 | { |
273 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 273 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
274 | u8 *args = ihid->argsbuf; | 274 | u8 *args = ihid->argsbuf; |
275 | const struct i2c_hid_cmd *hidcmd; | 275 | const struct i2c_hid_cmd *hidcmd; |
276 | int ret; | 276 | int ret; |
277 | u16 dataRegister = le16_to_cpu(ihid->hdesc.wDataRegister); | 277 | u16 dataRegister = le16_to_cpu(ihid->hdesc.wDataRegister); |
278 | u16 outputRegister = le16_to_cpu(ihid->hdesc.wOutputRegister); | 278 | u16 outputRegister = le16_to_cpu(ihid->hdesc.wOutputRegister); |
279 | u16 maxOutputLength = le16_to_cpu(ihid->hdesc.wMaxOutputLength); | 279 | u16 maxOutputLength = le16_to_cpu(ihid->hdesc.wMaxOutputLength); |
280 | 280 | ||
281 | /* hid_hw_* already checked that data_len < HID_MAX_BUFFER_SIZE */ | 281 | /* hid_hw_* already checked that data_len < HID_MAX_BUFFER_SIZE */ |
282 | u16 size = 2 /* size */ + | 282 | u16 size = 2 /* size */ + |
283 | (reportID ? 1 : 0) /* reportID */ + | 283 | (reportID ? 1 : 0) /* reportID */ + |
284 | data_len /* buf */; | 284 | data_len /* buf */; |
285 | int args_len = (reportID >= 0x0F ? 1 : 0) /* optional third byte */ + | 285 | int args_len = (reportID >= 0x0F ? 1 : 0) /* optional third byte */ + |
286 | 2 /* dataRegister */ + | 286 | 2 /* dataRegister */ + |
287 | size /* args */; | 287 | size /* args */; |
288 | int index = 0; | 288 | int index = 0; |
289 | 289 | ||
290 | i2c_hid_dbg(ihid, "%s\n", __func__); | 290 | i2c_hid_dbg(ihid, "%s\n", __func__); |
291 | 291 | ||
292 | if (!use_data && maxOutputLength == 0) | 292 | if (!use_data && maxOutputLength == 0) |
293 | return -ENOSYS; | 293 | return -ENOSYS; |
294 | 294 | ||
295 | if (reportID >= 0x0F) { | 295 | if (reportID >= 0x0F) { |
296 | args[index++] = reportID; | 296 | args[index++] = reportID; |
297 | reportID = 0x0F; | 297 | reportID = 0x0F; |
298 | } | 298 | } |
299 | 299 | ||
300 | /* | 300 | /* |
301 | * use the data register for feature reports or if the device does not | 301 | * use the data register for feature reports or if the device does not |
302 | * support the output register | 302 | * support the output register |
303 | */ | 303 | */ |
304 | if (use_data) { | 304 | if (use_data) { |
305 | args[index++] = dataRegister & 0xFF; | 305 | args[index++] = dataRegister & 0xFF; |
306 | args[index++] = dataRegister >> 8; | 306 | args[index++] = dataRegister >> 8; |
307 | hidcmd = &hid_set_report_cmd; | 307 | hidcmd = &hid_set_report_cmd; |
308 | } else { | 308 | } else { |
309 | args[index++] = outputRegister & 0xFF; | 309 | args[index++] = outputRegister & 0xFF; |
310 | args[index++] = outputRegister >> 8; | 310 | args[index++] = outputRegister >> 8; |
311 | hidcmd = &hid_no_cmd; | 311 | hidcmd = &hid_no_cmd; |
312 | } | 312 | } |
313 | 313 | ||
314 | args[index++] = size & 0xFF; | 314 | args[index++] = size & 0xFF; |
315 | args[index++] = size >> 8; | 315 | args[index++] = size >> 8; |
316 | 316 | ||
317 | if (reportID) | 317 | if (reportID) |
318 | args[index++] = reportID; | 318 | args[index++] = reportID; |
319 | 319 | ||
320 | memcpy(&args[index], buf, data_len); | 320 | memcpy(&args[index], buf, data_len); |
321 | 321 | ||
322 | ret = __i2c_hid_command(client, hidcmd, reportID, | 322 | ret = __i2c_hid_command(client, hidcmd, reportID, |
323 | reportType, args, args_len, NULL, 0); | 323 | reportType, args, args_len, NULL, 0); |
324 | if (ret) { | 324 | if (ret) { |
325 | dev_err(&client->dev, "failed to set a report to device.\n"); | 325 | dev_err(&client->dev, "failed to set a report to device.\n"); |
326 | return ret; | 326 | return ret; |
327 | } | 327 | } |
328 | 328 | ||
329 | return data_len; | 329 | return data_len; |
330 | } | 330 | } |
331 | 331 | ||
332 | static int i2c_hid_set_power(struct i2c_client *client, int power_state) | 332 | static int i2c_hid_set_power(struct i2c_client *client, int power_state) |
333 | { | 333 | { |
334 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 334 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
335 | int ret; | 335 | int ret; |
336 | 336 | ||
337 | i2c_hid_dbg(ihid, "%s\n", __func__); | 337 | i2c_hid_dbg(ihid, "%s\n", __func__); |
338 | 338 | ||
339 | ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state, | 339 | ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state, |
340 | 0, NULL, 0, NULL, 0); | 340 | 0, NULL, 0, NULL, 0); |
341 | if (ret) | 341 | if (ret) |
342 | dev_err(&client->dev, "failed to change power setting.\n"); | 342 | dev_err(&client->dev, "failed to change power setting.\n"); |
343 | 343 | ||
344 | return ret; | 344 | return ret; |
345 | } | 345 | } |
346 | 346 | ||
347 | static int i2c_hid_hwreset(struct i2c_client *client) | 347 | static int i2c_hid_hwreset(struct i2c_client *client) |
348 | { | 348 | { |
349 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 349 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
350 | int ret; | 350 | int ret; |
351 | 351 | ||
352 | i2c_hid_dbg(ihid, "%s\n", __func__); | 352 | i2c_hid_dbg(ihid, "%s\n", __func__); |
353 | 353 | ||
354 | ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); | 354 | ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); |
355 | if (ret) | 355 | if (ret) |
356 | return ret; | 356 | return ret; |
357 | 357 | ||
358 | i2c_hid_dbg(ihid, "resetting...\n"); | 358 | i2c_hid_dbg(ihid, "resetting...\n"); |
359 | 359 | ||
360 | ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0); | 360 | ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0); |
361 | if (ret) { | 361 | if (ret) { |
362 | dev_err(&client->dev, "failed to reset device.\n"); | 362 | dev_err(&client->dev, "failed to reset device.\n"); |
363 | i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); | 363 | i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); |
364 | return ret; | 364 | return ret; |
365 | } | 365 | } |
366 | 366 | ||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | static void i2c_hid_get_input(struct i2c_hid *ihid) | 370 | static void i2c_hid_get_input(struct i2c_hid *ihid) |
371 | { | 371 | { |
372 | int ret, ret_size; | 372 | int ret, ret_size; |
373 | int size = ihid->bufsize; | 373 | int size = ihid->bufsize; |
374 | 374 | ||
375 | ret = i2c_master_recv(ihid->client, ihid->inbuf, size); | 375 | ret = i2c_master_recv(ihid->client, ihid->inbuf, size); |
376 | if (ret != size) { | 376 | if (ret != size) { |
377 | if (ret < 0) | 377 | if (ret < 0) |
378 | return; | 378 | return; |
379 | 379 | ||
380 | dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n", | 380 | dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n", |
381 | __func__, ret, size); | 381 | __func__, ret, size); |
382 | return; | 382 | return; |
383 | } | 383 | } |
384 | 384 | ||
385 | ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8; | 385 | ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8; |
386 | 386 | ||
387 | if (!ret_size) { | 387 | if (!ret_size) { |
388 | /* host or device initiated RESET completed */ | 388 | /* host or device initiated RESET completed */ |
389 | if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags)) | 389 | if (test_and_clear_bit(I2C_HID_RESET_PENDING, &ihid->flags)) |
390 | wake_up(&ihid->wait); | 390 | wake_up(&ihid->wait); |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (ret_size > size) { | 394 | if (ret_size > size) { |
395 | dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", | 395 | dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", |
396 | __func__, size, ret_size); | 396 | __func__, size, ret_size); |
397 | return; | 397 | return; |
398 | } | 398 | } |
399 | 399 | ||
400 | i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf); | 400 | i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf); |
401 | 401 | ||
402 | if (test_bit(I2C_HID_STARTED, &ihid->flags)) | 402 | if (test_bit(I2C_HID_STARTED, &ihid->flags)) |
403 | hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2, | 403 | hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2, |
404 | ret_size - 2, 1); | 404 | ret_size - 2, 1); |
405 | 405 | ||
406 | return; | 406 | return; |
407 | } | 407 | } |
408 | 408 | ||
409 | static irqreturn_t i2c_hid_irq(int irq, void *dev_id) | 409 | static irqreturn_t i2c_hid_irq(int irq, void *dev_id) |
410 | { | 410 | { |
411 | struct i2c_hid *ihid = dev_id; | 411 | struct i2c_hid *ihid = dev_id; |
412 | 412 | ||
413 | if (test_bit(I2C_HID_READ_PENDING, &ihid->flags)) | 413 | if (test_bit(I2C_HID_READ_PENDING, &ihid->flags)) |
414 | return IRQ_HANDLED; | 414 | return IRQ_HANDLED; |
415 | 415 | ||
416 | i2c_hid_get_input(ihid); | 416 | i2c_hid_get_input(ihid); |
417 | 417 | ||
418 | return IRQ_HANDLED; | 418 | return IRQ_HANDLED; |
419 | } | 419 | } |
420 | 420 | ||
421 | static int i2c_hid_get_report_length(struct hid_report *report) | 421 | static int i2c_hid_get_report_length(struct hid_report *report) |
422 | { | 422 | { |
423 | return ((report->size - 1) >> 3) + 1 + | 423 | return ((report->size - 1) >> 3) + 1 + |
424 | report->device->report_enum[report->type].numbered + 2; | 424 | report->device->report_enum[report->type].numbered + 2; |
425 | } | 425 | } |
426 | 426 | ||
427 | static void i2c_hid_init_report(struct hid_report *report, u8 *buffer, | 427 | static void i2c_hid_init_report(struct hid_report *report, u8 *buffer, |
428 | size_t bufsize) | 428 | size_t bufsize) |
429 | { | 429 | { |
430 | struct hid_device *hid = report->device; | 430 | struct hid_device *hid = report->device; |
431 | struct i2c_client *client = hid->driver_data; | 431 | struct i2c_client *client = hid->driver_data; |
432 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 432 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
433 | unsigned int size, ret_size; | 433 | unsigned int size, ret_size; |
434 | 434 | ||
435 | size = i2c_hid_get_report_length(report); | 435 | size = i2c_hid_get_report_length(report); |
436 | if (i2c_hid_get_report(client, | 436 | if (i2c_hid_get_report(client, |
437 | report->type == HID_FEATURE_REPORT ? 0x03 : 0x01, | 437 | report->type == HID_FEATURE_REPORT ? 0x03 : 0x01, |
438 | report->id, buffer, size)) | 438 | report->id, buffer, size)) |
439 | return; | 439 | return; |
440 | 440 | ||
441 | i2c_hid_dbg(ihid, "report (len=%d): %*ph\n", size, size, buffer); | 441 | i2c_hid_dbg(ihid, "report (len=%d): %*ph\n", size, size, buffer); |
442 | 442 | ||
443 | ret_size = buffer[0] | (buffer[1] << 8); | 443 | ret_size = buffer[0] | (buffer[1] << 8); |
444 | 444 | ||
445 | if (ret_size != size) { | 445 | if (ret_size != size) { |
446 | dev_err(&client->dev, "error in %s size:%d / ret_size:%d\n", | 446 | dev_err(&client->dev, "error in %s size:%d / ret_size:%d\n", |
447 | __func__, size, ret_size); | 447 | __func__, size, ret_size); |
448 | return; | 448 | return; |
449 | } | 449 | } |
450 | 450 | ||
451 | /* hid->driver_lock is held as we are in probe function, | 451 | /* hid->driver_lock is held as we are in probe function, |
452 | * we just need to setup the input fields, so using | 452 | * we just need to setup the input fields, so using |
453 | * hid_report_raw_event is safe. */ | 453 | * hid_report_raw_event is safe. */ |
454 | hid_report_raw_event(hid, report->type, buffer + 2, size - 2, 1); | 454 | hid_report_raw_event(hid, report->type, buffer + 2, size - 2, 1); |
455 | } | 455 | } |
456 | 456 | ||
457 | /* | 457 | /* |
458 | * Initialize all reports | 458 | * Initialize all reports |
459 | */ | 459 | */ |
460 | static void i2c_hid_init_reports(struct hid_device *hid) | 460 | static void i2c_hid_init_reports(struct hid_device *hid) |
461 | { | 461 | { |
462 | struct hid_report *report; | 462 | struct hid_report *report; |
463 | struct i2c_client *client = hid->driver_data; | 463 | struct i2c_client *client = hid->driver_data; |
464 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 464 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
465 | u8 *inbuf = kzalloc(ihid->bufsize, GFP_KERNEL); | 465 | u8 *inbuf = kzalloc(ihid->bufsize, GFP_KERNEL); |
466 | 466 | ||
467 | if (!inbuf) { | 467 | if (!inbuf) { |
468 | dev_err(&client->dev, "can not retrieve initial reports\n"); | 468 | dev_err(&client->dev, "can not retrieve initial reports\n"); |
469 | return; | 469 | return; |
470 | } | 470 | } |
471 | 471 | ||
472 | /* | 472 | /* |
473 | * The device must be powered on while we fetch initial reports | 473 | * The device must be powered on while we fetch initial reports |
474 | * from it. | 474 | * from it. |
475 | */ | 475 | */ |
476 | pm_runtime_get_sync(&client->dev); | 476 | pm_runtime_get_sync(&client->dev); |
477 | 477 | ||
478 | list_for_each_entry(report, | 478 | list_for_each_entry(report, |
479 | &hid->report_enum[HID_FEATURE_REPORT].report_list, list) | 479 | &hid->report_enum[HID_FEATURE_REPORT].report_list, list) |
480 | i2c_hid_init_report(report, inbuf, ihid->bufsize); | 480 | i2c_hid_init_report(report, inbuf, ihid->bufsize); |
481 | 481 | ||
482 | pm_runtime_put(&client->dev); | 482 | pm_runtime_put(&client->dev); |
483 | 483 | ||
484 | kfree(inbuf); | 484 | kfree(inbuf); |
485 | } | 485 | } |
486 | 486 | ||
487 | /* | 487 | /* |
488 | * Traverse the supplied list of reports and find the longest | 488 | * Traverse the supplied list of reports and find the longest |
489 | */ | 489 | */ |
490 | static void i2c_hid_find_max_report(struct hid_device *hid, unsigned int type, | 490 | static void i2c_hid_find_max_report(struct hid_device *hid, unsigned int type, |
491 | unsigned int *max) | 491 | unsigned int *max) |
492 | { | 492 | { |
493 | struct hid_report *report; | 493 | struct hid_report *report; |
494 | unsigned int size; | 494 | unsigned int size; |
495 | 495 | ||
496 | /* We should not rely on wMaxInputLength, as some devices may set it to | 496 | /* We should not rely on wMaxInputLength, as some devices may set it to |
497 | * a wrong length. */ | 497 | * a wrong length. */ |
498 | list_for_each_entry(report, &hid->report_enum[type].report_list, list) { | 498 | list_for_each_entry(report, &hid->report_enum[type].report_list, list) { |
499 | size = i2c_hid_get_report_length(report); | 499 | size = i2c_hid_get_report_length(report); |
500 | if (*max < size) | 500 | if (*max < size) |
501 | *max = size; | 501 | *max = size; |
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
505 | static void i2c_hid_free_buffers(struct i2c_hid *ihid) | 505 | static void i2c_hid_free_buffers(struct i2c_hid *ihid) |
506 | { | 506 | { |
507 | kfree(ihid->inbuf); | 507 | kfree(ihid->inbuf); |
508 | kfree(ihid->rawbuf); | 508 | kfree(ihid->rawbuf); |
509 | kfree(ihid->argsbuf); | 509 | kfree(ihid->argsbuf); |
510 | kfree(ihid->cmdbuf); | 510 | kfree(ihid->cmdbuf); |
511 | ihid->inbuf = NULL; | 511 | ihid->inbuf = NULL; |
512 | ihid->rawbuf = NULL; | 512 | ihid->rawbuf = NULL; |
513 | ihid->cmdbuf = NULL; | 513 | ihid->cmdbuf = NULL; |
514 | ihid->argsbuf = NULL; | 514 | ihid->argsbuf = NULL; |
515 | ihid->bufsize = 0; | 515 | ihid->bufsize = 0; |
516 | } | 516 | } |
517 | 517 | ||
518 | static int i2c_hid_alloc_buffers(struct i2c_hid *ihid, size_t report_size) | 518 | static int i2c_hid_alloc_buffers(struct i2c_hid *ihid, size_t report_size) |
519 | { | 519 | { |
520 | /* the worst case is computed from the set_report command with a | 520 | /* the worst case is computed from the set_report command with a |
521 | * reportID > 15 and the maximum report length */ | 521 | * reportID > 15 and the maximum report length */ |
522 | int args_len = sizeof(__u8) + /* optional ReportID byte */ | 522 | int args_len = sizeof(__u8) + /* optional ReportID byte */ |
523 | sizeof(__u16) + /* data register */ | 523 | sizeof(__u16) + /* data register */ |
524 | sizeof(__u16) + /* size of the report */ | 524 | sizeof(__u16) + /* size of the report */ |
525 | report_size; /* report */ | 525 | report_size; /* report */ |
526 | 526 | ||
527 | ihid->inbuf = kzalloc(report_size, GFP_KERNEL); | 527 | ihid->inbuf = kzalloc(report_size, GFP_KERNEL); |
528 | ihid->rawbuf = kzalloc(report_size, GFP_KERNEL); | 528 | ihid->rawbuf = kzalloc(report_size, GFP_KERNEL); |
529 | ihid->argsbuf = kzalloc(args_len, GFP_KERNEL); | 529 | ihid->argsbuf = kzalloc(args_len, GFP_KERNEL); |
530 | ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL); | 530 | ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL); |
531 | 531 | ||
532 | if (!ihid->inbuf || !ihid->rawbuf || !ihid->argsbuf || !ihid->cmdbuf) { | 532 | if (!ihid->inbuf || !ihid->rawbuf || !ihid->argsbuf || !ihid->cmdbuf) { |
533 | i2c_hid_free_buffers(ihid); | 533 | i2c_hid_free_buffers(ihid); |
534 | return -ENOMEM; | 534 | return -ENOMEM; |
535 | } | 535 | } |
536 | 536 | ||
537 | ihid->bufsize = report_size; | 537 | ihid->bufsize = report_size; |
538 | 538 | ||
539 | return 0; | 539 | return 0; |
540 | } | 540 | } |
541 | 541 | ||
542 | static int i2c_hid_get_raw_report(struct hid_device *hid, | 542 | static int i2c_hid_get_raw_report(struct hid_device *hid, |
543 | unsigned char report_number, __u8 *buf, size_t count, | 543 | unsigned char report_number, __u8 *buf, size_t count, |
544 | unsigned char report_type) | 544 | unsigned char report_type) |
545 | { | 545 | { |
546 | struct i2c_client *client = hid->driver_data; | 546 | struct i2c_client *client = hid->driver_data; |
547 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 547 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
548 | size_t ret_count, ask_count; | 548 | size_t ret_count, ask_count; |
549 | int ret; | 549 | int ret; |
550 | 550 | ||
551 | if (report_type == HID_OUTPUT_REPORT) | 551 | if (report_type == HID_OUTPUT_REPORT) |
552 | return -EINVAL; | 552 | return -EINVAL; |
553 | 553 | ||
554 | /* +2 bytes to include the size of the reply in the query buffer */ | 554 | /* +2 bytes to include the size of the reply in the query buffer */ |
555 | ask_count = min(count + 2, (size_t)ihid->bufsize); | 555 | ask_count = min(count + 2, (size_t)ihid->bufsize); |
556 | 556 | ||
557 | ret = i2c_hid_get_report(client, | 557 | ret = i2c_hid_get_report(client, |
558 | report_type == HID_FEATURE_REPORT ? 0x03 : 0x01, | 558 | report_type == HID_FEATURE_REPORT ? 0x03 : 0x01, |
559 | report_number, ihid->rawbuf, ask_count); | 559 | report_number, ihid->rawbuf, ask_count); |
560 | 560 | ||
561 | if (ret < 0) | 561 | if (ret < 0) |
562 | return ret; | 562 | return ret; |
563 | 563 | ||
564 | ret_count = ihid->rawbuf[0] | (ihid->rawbuf[1] << 8); | 564 | ret_count = ihid->rawbuf[0] | (ihid->rawbuf[1] << 8); |
565 | 565 | ||
566 | if (ret_count <= 2) | 566 | if (ret_count <= 2) |
567 | return 0; | 567 | return 0; |
568 | 568 | ||
569 | ret_count = min(ret_count, ask_count); | 569 | ret_count = min(ret_count, ask_count); |
570 | 570 | ||
571 | /* The query buffer contains the size, dropping it in the reply */ | 571 | /* The query buffer contains the size, dropping it in the reply */ |
572 | count = min(count, ret_count - 2); | 572 | count = min(count, ret_count - 2); |
573 | memcpy(buf, ihid->rawbuf + 2, count); | 573 | memcpy(buf, ihid->rawbuf + 2, count); |
574 | 574 | ||
575 | return count; | 575 | return count; |
576 | } | 576 | } |
577 | 577 | ||
578 | static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf, | 578 | static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf, |
579 | size_t count, unsigned char report_type, bool use_data) | 579 | size_t count, unsigned char report_type, bool use_data) |
580 | { | 580 | { |
581 | struct i2c_client *client = hid->driver_data; | 581 | struct i2c_client *client = hid->driver_data; |
582 | int report_id = buf[0]; | 582 | int report_id = buf[0]; |
583 | int ret; | 583 | int ret; |
584 | 584 | ||
585 | if (report_type == HID_INPUT_REPORT) | 585 | if (report_type == HID_INPUT_REPORT) |
586 | return -EINVAL; | 586 | return -EINVAL; |
587 | 587 | ||
588 | if (report_id) { | 588 | if (report_id) { |
589 | buf++; | 589 | buf++; |
590 | count--; | 590 | count--; |
591 | } | 591 | } |
592 | 592 | ||
593 | ret = i2c_hid_set_or_send_report(client, | 593 | ret = i2c_hid_set_or_send_report(client, |
594 | report_type == HID_FEATURE_REPORT ? 0x03 : 0x02, | 594 | report_type == HID_FEATURE_REPORT ? 0x03 : 0x02, |
595 | report_id, buf, count, use_data); | 595 | report_id, buf, count, use_data); |
596 | 596 | ||
597 | if (report_id && ret >= 0) | 597 | if (report_id && ret >= 0) |
598 | ret++; /* add report_id to the number of transfered bytes */ | 598 | ret++; /* add report_id to the number of transfered bytes */ |
599 | 599 | ||
600 | return ret; | 600 | return ret; |
601 | } | 601 | } |
602 | 602 | ||
603 | static int i2c_hid_output_report(struct hid_device *hid, __u8 *buf, | 603 | static int i2c_hid_output_report(struct hid_device *hid, __u8 *buf, |
604 | size_t count) | 604 | size_t count) |
605 | { | 605 | { |
606 | return i2c_hid_output_raw_report(hid, buf, count, HID_OUTPUT_REPORT, | 606 | return i2c_hid_output_raw_report(hid, buf, count, HID_OUTPUT_REPORT, |
607 | false); | 607 | false); |
608 | } | 608 | } |
609 | 609 | ||
610 | static int i2c_hid_raw_request(struct hid_device *hid, unsigned char reportnum, | 610 | static int i2c_hid_raw_request(struct hid_device *hid, unsigned char reportnum, |
611 | __u8 *buf, size_t len, unsigned char rtype, | 611 | __u8 *buf, size_t len, unsigned char rtype, |
612 | int reqtype) | 612 | int reqtype) |
613 | { | 613 | { |
614 | switch (reqtype) { | 614 | switch (reqtype) { |
615 | case HID_REQ_GET_REPORT: | 615 | case HID_REQ_GET_REPORT: |
616 | return i2c_hid_get_raw_report(hid, reportnum, buf, len, rtype); | 616 | return i2c_hid_get_raw_report(hid, reportnum, buf, len, rtype); |
617 | case HID_REQ_SET_REPORT: | 617 | case HID_REQ_SET_REPORT: |
618 | if (buf[0] != reportnum) | 618 | if (buf[0] != reportnum) |
619 | return -EINVAL; | 619 | return -EINVAL; |
620 | return i2c_hid_output_raw_report(hid, buf, len, rtype, true); | 620 | return i2c_hid_output_raw_report(hid, buf, len, rtype, true); |
621 | default: | 621 | default: |
622 | return -EIO; | 622 | return -EIO; |
623 | } | 623 | } |
624 | } | 624 | } |
625 | 625 | ||
626 | static int i2c_hid_parse(struct hid_device *hid) | 626 | static int i2c_hid_parse(struct hid_device *hid) |
627 | { | 627 | { |
628 | struct i2c_client *client = hid->driver_data; | 628 | struct i2c_client *client = hid->driver_data; |
629 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 629 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
630 | struct i2c_hid_desc *hdesc = &ihid->hdesc; | 630 | struct i2c_hid_desc *hdesc = &ihid->hdesc; |
631 | unsigned int rsize; | 631 | unsigned int rsize; |
632 | char *rdesc; | 632 | char *rdesc; |
633 | int ret; | 633 | int ret; |
634 | int tries = 3; | 634 | int tries = 3; |
635 | 635 | ||
636 | i2c_hid_dbg(ihid, "entering %s\n", __func__); | 636 | i2c_hid_dbg(ihid, "entering %s\n", __func__); |
637 | 637 | ||
638 | rsize = le16_to_cpu(hdesc->wReportDescLength); | 638 | rsize = le16_to_cpu(hdesc->wReportDescLength); |
639 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { | 639 | if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) { |
640 | dbg_hid("weird size of report descriptor (%u)\n", rsize); | 640 | dbg_hid("weird size of report descriptor (%u)\n", rsize); |
641 | return -EINVAL; | 641 | return -EINVAL; |
642 | } | 642 | } |
643 | 643 | ||
644 | do { | 644 | do { |
645 | ret = i2c_hid_hwreset(client); | 645 | ret = i2c_hid_hwreset(client); |
646 | if (ret) | 646 | if (ret) |
647 | msleep(1000); | 647 | msleep(1000); |
648 | } while (tries-- > 0 && ret); | 648 | } while (tries-- > 0 && ret); |
649 | 649 | ||
650 | if (ret) | 650 | if (ret) |
651 | return ret; | 651 | return ret; |
652 | 652 | ||
653 | rdesc = kzalloc(rsize, GFP_KERNEL); | 653 | rdesc = kzalloc(rsize, GFP_KERNEL); |
654 | 654 | ||
655 | if (!rdesc) { | 655 | if (!rdesc) { |
656 | dbg_hid("couldn't allocate rdesc memory\n"); | 656 | dbg_hid("couldn't allocate rdesc memory\n"); |
657 | return -ENOMEM; | 657 | return -ENOMEM; |
658 | } | 658 | } |
659 | 659 | ||
660 | i2c_hid_dbg(ihid, "asking HID report descriptor\n"); | 660 | i2c_hid_dbg(ihid, "asking HID report descriptor\n"); |
661 | 661 | ||
662 | ret = i2c_hid_command(client, &hid_report_descr_cmd, rdesc, rsize); | 662 | ret = i2c_hid_command(client, &hid_report_descr_cmd, rdesc, rsize); |
663 | if (ret) { | 663 | if (ret) { |
664 | hid_err(hid, "reading report descriptor failed\n"); | 664 | hid_err(hid, "reading report descriptor failed\n"); |
665 | kfree(rdesc); | 665 | kfree(rdesc); |
666 | return -EIO; | 666 | return -EIO; |
667 | } | 667 | } |
668 | 668 | ||
669 | i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc); | 669 | i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc); |
670 | 670 | ||
671 | ret = hid_parse_report(hid, rdesc, rsize); | 671 | ret = hid_parse_report(hid, rdesc, rsize); |
672 | kfree(rdesc); | 672 | kfree(rdesc); |
673 | if (ret) { | 673 | if (ret) { |
674 | dbg_hid("parsing report descriptor failed\n"); | 674 | dbg_hid("parsing report descriptor failed\n"); |
675 | return ret; | 675 | return ret; |
676 | } | 676 | } |
677 | 677 | ||
678 | return 0; | 678 | return 0; |
679 | } | 679 | } |
680 | 680 | ||
681 | static int i2c_hid_start(struct hid_device *hid) | 681 | static int i2c_hid_start(struct hid_device *hid) |
682 | { | 682 | { |
683 | struct i2c_client *client = hid->driver_data; | 683 | struct i2c_client *client = hid->driver_data; |
684 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 684 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
685 | int ret; | 685 | int ret; |
686 | unsigned int bufsize = HID_MIN_BUFFER_SIZE; | 686 | unsigned int bufsize = HID_MIN_BUFFER_SIZE; |
687 | 687 | ||
688 | i2c_hid_find_max_report(hid, HID_INPUT_REPORT, &bufsize); | 688 | i2c_hid_find_max_report(hid, HID_INPUT_REPORT, &bufsize); |
689 | i2c_hid_find_max_report(hid, HID_OUTPUT_REPORT, &bufsize); | 689 | i2c_hid_find_max_report(hid, HID_OUTPUT_REPORT, &bufsize); |
690 | i2c_hid_find_max_report(hid, HID_FEATURE_REPORT, &bufsize); | 690 | i2c_hid_find_max_report(hid, HID_FEATURE_REPORT, &bufsize); |
691 | 691 | ||
692 | if (bufsize > ihid->bufsize) { | 692 | if (bufsize > ihid->bufsize) { |
693 | i2c_hid_free_buffers(ihid); | 693 | i2c_hid_free_buffers(ihid); |
694 | 694 | ||
695 | ret = i2c_hid_alloc_buffers(ihid, bufsize); | 695 | ret = i2c_hid_alloc_buffers(ihid, bufsize); |
696 | 696 | ||
697 | if (ret) | 697 | if (ret) |
698 | return ret; | 698 | return ret; |
699 | } | 699 | } |
700 | 700 | ||
701 | if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS)) | 701 | if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS)) |
702 | i2c_hid_init_reports(hid); | 702 | i2c_hid_init_reports(hid); |
703 | 703 | ||
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
707 | static void i2c_hid_stop(struct hid_device *hid) | 707 | static void i2c_hid_stop(struct hid_device *hid) |
708 | { | 708 | { |
709 | struct i2c_client *client = hid->driver_data; | ||
710 | struct i2c_hid *ihid = i2c_get_clientdata(client); | ||
711 | |||
712 | hid->claimed = 0; | 709 | hid->claimed = 0; |
713 | |||
714 | i2c_hid_free_buffers(ihid); | ||
715 | } | 710 | } |
716 | 711 | ||
717 | static int i2c_hid_open(struct hid_device *hid) | 712 | static int i2c_hid_open(struct hid_device *hid) |
718 | { | 713 | { |
719 | struct i2c_client *client = hid->driver_data; | 714 | struct i2c_client *client = hid->driver_data; |
720 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 715 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
721 | int ret = 0; | 716 | int ret = 0; |
722 | 717 | ||
723 | mutex_lock(&i2c_hid_open_mut); | 718 | mutex_lock(&i2c_hid_open_mut); |
724 | if (!hid->open++) { | 719 | if (!hid->open++) { |
725 | ret = pm_runtime_get_sync(&client->dev); | 720 | ret = pm_runtime_get_sync(&client->dev); |
726 | if (ret < 0) { | 721 | if (ret < 0) { |
727 | hid->open--; | 722 | hid->open--; |
728 | goto done; | 723 | goto done; |
729 | } | 724 | } |
730 | set_bit(I2C_HID_STARTED, &ihid->flags); | 725 | set_bit(I2C_HID_STARTED, &ihid->flags); |
731 | } | 726 | } |
732 | done: | 727 | done: |
733 | mutex_unlock(&i2c_hid_open_mut); | 728 | mutex_unlock(&i2c_hid_open_mut); |
734 | return ret < 0 ? ret : 0; | 729 | return ret < 0 ? ret : 0; |
735 | } | 730 | } |
736 | 731 | ||
737 | static void i2c_hid_close(struct hid_device *hid) | 732 | static void i2c_hid_close(struct hid_device *hid) |
738 | { | 733 | { |
739 | struct i2c_client *client = hid->driver_data; | 734 | struct i2c_client *client = hid->driver_data; |
740 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 735 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
741 | 736 | ||
742 | /* protecting hid->open to make sure we don't restart | 737 | /* protecting hid->open to make sure we don't restart |
743 | * data acquistion due to a resumption we no longer | 738 | * data acquistion due to a resumption we no longer |
744 | * care about | 739 | * care about |
745 | */ | 740 | */ |
746 | mutex_lock(&i2c_hid_open_mut); | 741 | mutex_lock(&i2c_hid_open_mut); |
747 | if (!--hid->open) { | 742 | if (!--hid->open) { |
748 | clear_bit(I2C_HID_STARTED, &ihid->flags); | 743 | clear_bit(I2C_HID_STARTED, &ihid->flags); |
749 | 744 | ||
750 | /* Save some power */ | 745 | /* Save some power */ |
751 | pm_runtime_put(&client->dev); | 746 | pm_runtime_put(&client->dev); |
752 | } | 747 | } |
753 | mutex_unlock(&i2c_hid_open_mut); | 748 | mutex_unlock(&i2c_hid_open_mut); |
754 | } | 749 | } |
755 | 750 | ||
756 | static int i2c_hid_power(struct hid_device *hid, int lvl) | 751 | static int i2c_hid_power(struct hid_device *hid, int lvl) |
757 | { | 752 | { |
758 | struct i2c_client *client = hid->driver_data; | 753 | struct i2c_client *client = hid->driver_data; |
759 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 754 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
760 | 755 | ||
761 | i2c_hid_dbg(ihid, "%s lvl:%d\n", __func__, lvl); | 756 | i2c_hid_dbg(ihid, "%s lvl:%d\n", __func__, lvl); |
762 | 757 | ||
763 | switch (lvl) { | 758 | switch (lvl) { |
764 | case PM_HINT_FULLON: | 759 | case PM_HINT_FULLON: |
765 | pm_runtime_get_sync(&client->dev); | 760 | pm_runtime_get_sync(&client->dev); |
766 | break; | 761 | break; |
767 | case PM_HINT_NORMAL: | 762 | case PM_HINT_NORMAL: |
768 | pm_runtime_put(&client->dev); | 763 | pm_runtime_put(&client->dev); |
769 | break; | 764 | break; |
770 | } | 765 | } |
771 | return 0; | 766 | return 0; |
772 | } | 767 | } |
773 | 768 | ||
774 | static struct hid_ll_driver i2c_hid_ll_driver = { | 769 | static struct hid_ll_driver i2c_hid_ll_driver = { |
775 | .parse = i2c_hid_parse, | 770 | .parse = i2c_hid_parse, |
776 | .start = i2c_hid_start, | 771 | .start = i2c_hid_start, |
777 | .stop = i2c_hid_stop, | 772 | .stop = i2c_hid_stop, |
778 | .open = i2c_hid_open, | 773 | .open = i2c_hid_open, |
779 | .close = i2c_hid_close, | 774 | .close = i2c_hid_close, |
780 | .power = i2c_hid_power, | 775 | .power = i2c_hid_power, |
781 | .output_report = i2c_hid_output_report, | 776 | .output_report = i2c_hid_output_report, |
782 | .raw_request = i2c_hid_raw_request, | 777 | .raw_request = i2c_hid_raw_request, |
783 | }; | 778 | }; |
784 | 779 | ||
785 | static int i2c_hid_init_irq(struct i2c_client *client) | 780 | static int i2c_hid_init_irq(struct i2c_client *client) |
786 | { | 781 | { |
787 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 782 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
788 | int ret; | 783 | int ret; |
789 | 784 | ||
790 | dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); | 785 | dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); |
791 | 786 | ||
792 | ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, | 787 | ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, |
793 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 788 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
794 | client->name, ihid); | 789 | client->name, ihid); |
795 | if (ret < 0) { | 790 | if (ret < 0) { |
796 | dev_warn(&client->dev, | 791 | dev_warn(&client->dev, |
797 | "Could not register for %s interrupt, irq = %d," | 792 | "Could not register for %s interrupt, irq = %d," |
798 | " ret = %d\n", | 793 | " ret = %d\n", |
799 | client->name, client->irq, ret); | 794 | client->name, client->irq, ret); |
800 | 795 | ||
801 | return ret; | 796 | return ret; |
802 | } | 797 | } |
803 | 798 | ||
804 | return 0; | 799 | return 0; |
805 | } | 800 | } |
806 | 801 | ||
807 | static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid) | 802 | static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid) |
808 | { | 803 | { |
809 | struct i2c_client *client = ihid->client; | 804 | struct i2c_client *client = ihid->client; |
810 | struct i2c_hid_desc *hdesc = &ihid->hdesc; | 805 | struct i2c_hid_desc *hdesc = &ihid->hdesc; |
811 | unsigned int dsize; | 806 | unsigned int dsize; |
812 | int ret; | 807 | int ret; |
813 | 808 | ||
814 | /* i2c hid fetch using a fixed descriptor size (30 bytes) */ | 809 | /* i2c hid fetch using a fixed descriptor size (30 bytes) */ |
815 | i2c_hid_dbg(ihid, "Fetching the HID descriptor\n"); | 810 | i2c_hid_dbg(ihid, "Fetching the HID descriptor\n"); |
816 | ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer, | 811 | ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer, |
817 | sizeof(struct i2c_hid_desc)); | 812 | sizeof(struct i2c_hid_desc)); |
818 | if (ret) { | 813 | if (ret) { |
819 | dev_err(&client->dev, "hid_descr_cmd failed\n"); | 814 | dev_err(&client->dev, "hid_descr_cmd failed\n"); |
820 | return -ENODEV; | 815 | return -ENODEV; |
821 | } | 816 | } |
822 | 817 | ||
823 | /* Validate the length of HID descriptor, the 4 first bytes: | 818 | /* Validate the length of HID descriptor, the 4 first bytes: |
824 | * bytes 0-1 -> length | 819 | * bytes 0-1 -> length |
825 | * bytes 2-3 -> bcdVersion (has to be 1.00) */ | 820 | * bytes 2-3 -> bcdVersion (has to be 1.00) */ |
826 | /* check bcdVersion == 1.0 */ | 821 | /* check bcdVersion == 1.0 */ |
827 | if (le16_to_cpu(hdesc->bcdVersion) != 0x0100) { | 822 | if (le16_to_cpu(hdesc->bcdVersion) != 0x0100) { |
828 | dev_err(&client->dev, | 823 | dev_err(&client->dev, |
829 | "unexpected HID descriptor bcdVersion (0x%04hx)\n", | 824 | "unexpected HID descriptor bcdVersion (0x%04hx)\n", |
830 | le16_to_cpu(hdesc->bcdVersion)); | 825 | le16_to_cpu(hdesc->bcdVersion)); |
831 | return -ENODEV; | 826 | return -ENODEV; |
832 | } | 827 | } |
833 | 828 | ||
834 | /* Descriptor length should be 30 bytes as per the specification */ | 829 | /* Descriptor length should be 30 bytes as per the specification */ |
835 | dsize = le16_to_cpu(hdesc->wHIDDescLength); | 830 | dsize = le16_to_cpu(hdesc->wHIDDescLength); |
836 | if (dsize != sizeof(struct i2c_hid_desc)) { | 831 | if (dsize != sizeof(struct i2c_hid_desc)) { |
837 | dev_err(&client->dev, "weird size of HID descriptor (%u)\n", | 832 | dev_err(&client->dev, "weird size of HID descriptor (%u)\n", |
838 | dsize); | 833 | dsize); |
839 | return -ENODEV; | 834 | return -ENODEV; |
840 | } | 835 | } |
841 | i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, ihid->hdesc_buffer); | 836 | i2c_hid_dbg(ihid, "HID Descriptor: %*ph\n", dsize, ihid->hdesc_buffer); |
842 | return 0; | 837 | return 0; |
843 | } | 838 | } |
844 | 839 | ||
845 | #ifdef CONFIG_ACPI | 840 | #ifdef CONFIG_ACPI |
846 | static int i2c_hid_acpi_pdata(struct i2c_client *client, | 841 | static int i2c_hid_acpi_pdata(struct i2c_client *client, |
847 | struct i2c_hid_platform_data *pdata) | 842 | struct i2c_hid_platform_data *pdata) |
848 | { | 843 | { |
849 | static u8 i2c_hid_guid[] = { | 844 | static u8 i2c_hid_guid[] = { |
850 | 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45, | 845 | 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45, |
851 | 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, | 846 | 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, |
852 | }; | 847 | }; |
853 | union acpi_object *obj; | 848 | union acpi_object *obj; |
854 | struct acpi_device *adev; | 849 | struct acpi_device *adev; |
855 | acpi_handle handle; | 850 | acpi_handle handle; |
856 | 851 | ||
857 | handle = ACPI_HANDLE(&client->dev); | 852 | handle = ACPI_HANDLE(&client->dev); |
858 | if (!handle || acpi_bus_get_device(handle, &adev)) | 853 | if (!handle || acpi_bus_get_device(handle, &adev)) |
859 | return -ENODEV; | 854 | return -ENODEV; |
860 | 855 | ||
861 | obj = acpi_evaluate_dsm_typed(handle, i2c_hid_guid, 1, 1, NULL, | 856 | obj = acpi_evaluate_dsm_typed(handle, i2c_hid_guid, 1, 1, NULL, |
862 | ACPI_TYPE_INTEGER); | 857 | ACPI_TYPE_INTEGER); |
863 | if (!obj) { | 858 | if (!obj) { |
864 | dev_err(&client->dev, "device _DSM execution failed\n"); | 859 | dev_err(&client->dev, "device _DSM execution failed\n"); |
865 | return -ENODEV; | 860 | return -ENODEV; |
866 | } | 861 | } |
867 | 862 | ||
868 | pdata->hid_descriptor_address = obj->integer.value; | 863 | pdata->hid_descriptor_address = obj->integer.value; |
869 | ACPI_FREE(obj); | 864 | ACPI_FREE(obj); |
870 | 865 | ||
871 | return 0; | 866 | return 0; |
872 | } | 867 | } |
873 | 868 | ||
874 | static const struct acpi_device_id i2c_hid_acpi_match[] = { | 869 | static const struct acpi_device_id i2c_hid_acpi_match[] = { |
875 | {"ACPI0C50", 0 }, | 870 | {"ACPI0C50", 0 }, |
876 | {"PNP0C50", 0 }, | 871 | {"PNP0C50", 0 }, |
877 | { }, | 872 | { }, |
878 | }; | 873 | }; |
879 | MODULE_DEVICE_TABLE(acpi, i2c_hid_acpi_match); | 874 | MODULE_DEVICE_TABLE(acpi, i2c_hid_acpi_match); |
880 | #else | 875 | #else |
881 | static inline int i2c_hid_acpi_pdata(struct i2c_client *client, | 876 | static inline int i2c_hid_acpi_pdata(struct i2c_client *client, |
882 | struct i2c_hid_platform_data *pdata) | 877 | struct i2c_hid_platform_data *pdata) |
883 | { | 878 | { |
884 | return -ENODEV; | 879 | return -ENODEV; |
885 | } | 880 | } |
886 | #endif | 881 | #endif |
887 | 882 | ||
888 | #ifdef CONFIG_OF | 883 | #ifdef CONFIG_OF |
889 | static int i2c_hid_of_probe(struct i2c_client *client, | 884 | static int i2c_hid_of_probe(struct i2c_client *client, |
890 | struct i2c_hid_platform_data *pdata) | 885 | struct i2c_hid_platform_data *pdata) |
891 | { | 886 | { |
892 | struct device *dev = &client->dev; | 887 | struct device *dev = &client->dev; |
893 | u32 val; | 888 | u32 val; |
894 | int ret; | 889 | int ret; |
895 | 890 | ||
896 | ret = of_property_read_u32(dev->of_node, "hid-descr-addr", &val); | 891 | ret = of_property_read_u32(dev->of_node, "hid-descr-addr", &val); |
897 | if (ret) { | 892 | if (ret) { |
898 | dev_err(&client->dev, "HID register address not provided\n"); | 893 | dev_err(&client->dev, "HID register address not provided\n"); |
899 | return -ENODEV; | 894 | return -ENODEV; |
900 | } | 895 | } |
901 | if (val >> 16) { | 896 | if (val >> 16) { |
902 | dev_err(&client->dev, "Bad HID register address: 0x%08x\n", | 897 | dev_err(&client->dev, "Bad HID register address: 0x%08x\n", |
903 | val); | 898 | val); |
904 | return -EINVAL; | 899 | return -EINVAL; |
905 | } | 900 | } |
906 | pdata->hid_descriptor_address = val; | 901 | pdata->hid_descriptor_address = val; |
907 | 902 | ||
908 | return 0; | 903 | return 0; |
909 | } | 904 | } |
910 | 905 | ||
911 | static const struct of_device_id i2c_hid_of_match[] = { | 906 | static const struct of_device_id i2c_hid_of_match[] = { |
912 | { .compatible = "hid-over-i2c" }, | 907 | { .compatible = "hid-over-i2c" }, |
913 | {}, | 908 | {}, |
914 | }; | 909 | }; |
915 | MODULE_DEVICE_TABLE(of, i2c_hid_of_match); | 910 | MODULE_DEVICE_TABLE(of, i2c_hid_of_match); |
916 | #else | 911 | #else |
917 | static inline int i2c_hid_of_probe(struct i2c_client *client, | 912 | static inline int i2c_hid_of_probe(struct i2c_client *client, |
918 | struct i2c_hid_platform_data *pdata) | 913 | struct i2c_hid_platform_data *pdata) |
919 | { | 914 | { |
920 | return -ENODEV; | 915 | return -ENODEV; |
921 | } | 916 | } |
922 | #endif | 917 | #endif |
923 | 918 | ||
924 | static int i2c_hid_probe(struct i2c_client *client, | 919 | static int i2c_hid_probe(struct i2c_client *client, |
925 | const struct i2c_device_id *dev_id) | 920 | const struct i2c_device_id *dev_id) |
926 | { | 921 | { |
927 | int ret; | 922 | int ret; |
928 | struct i2c_hid *ihid; | 923 | struct i2c_hid *ihid; |
929 | struct hid_device *hid; | 924 | struct hid_device *hid; |
930 | __u16 hidRegister; | 925 | __u16 hidRegister; |
931 | struct i2c_hid_platform_data *platform_data = client->dev.platform_data; | 926 | struct i2c_hid_platform_data *platform_data = client->dev.platform_data; |
932 | 927 | ||
933 | dbg_hid("HID probe called for i2c 0x%02x\n", client->addr); | 928 | dbg_hid("HID probe called for i2c 0x%02x\n", client->addr); |
934 | 929 | ||
935 | if (!client->irq) { | 930 | if (!client->irq) { |
936 | dev_err(&client->dev, | 931 | dev_err(&client->dev, |
937 | "HID over i2c has not been provided an Int IRQ\n"); | 932 | "HID over i2c has not been provided an Int IRQ\n"); |
938 | return -EINVAL; | 933 | return -EINVAL; |
939 | } | 934 | } |
940 | 935 | ||
941 | ihid = kzalloc(sizeof(struct i2c_hid), GFP_KERNEL); | 936 | ihid = kzalloc(sizeof(struct i2c_hid), GFP_KERNEL); |
942 | if (!ihid) | 937 | if (!ihid) |
943 | return -ENOMEM; | 938 | return -ENOMEM; |
944 | 939 | ||
945 | if (client->dev.of_node) { | 940 | if (client->dev.of_node) { |
946 | ret = i2c_hid_of_probe(client, &ihid->pdata); | 941 | ret = i2c_hid_of_probe(client, &ihid->pdata); |
947 | if (ret) | 942 | if (ret) |
948 | goto err; | 943 | goto err; |
949 | } else if (!platform_data) { | 944 | } else if (!platform_data) { |
950 | ret = i2c_hid_acpi_pdata(client, &ihid->pdata); | 945 | ret = i2c_hid_acpi_pdata(client, &ihid->pdata); |
951 | if (ret) { | 946 | if (ret) { |
952 | dev_err(&client->dev, | 947 | dev_err(&client->dev, |
953 | "HID register address not provided\n"); | 948 | "HID register address not provided\n"); |
954 | goto err; | 949 | goto err; |
955 | } | 950 | } |
956 | } else { | 951 | } else { |
957 | ihid->pdata = *platform_data; | 952 | ihid->pdata = *platform_data; |
958 | } | 953 | } |
959 | 954 | ||
960 | i2c_set_clientdata(client, ihid); | 955 | i2c_set_clientdata(client, ihid); |
961 | 956 | ||
962 | ihid->client = client; | 957 | ihid->client = client; |
963 | 958 | ||
964 | hidRegister = ihid->pdata.hid_descriptor_address; | 959 | hidRegister = ihid->pdata.hid_descriptor_address; |
965 | ihid->wHIDDescRegister = cpu_to_le16(hidRegister); | 960 | ihid->wHIDDescRegister = cpu_to_le16(hidRegister); |
966 | 961 | ||
967 | init_waitqueue_head(&ihid->wait); | 962 | init_waitqueue_head(&ihid->wait); |
968 | 963 | ||
969 | /* we need to allocate the command buffer without knowing the maximum | 964 | /* we need to allocate the command buffer without knowing the maximum |
970 | * size of the reports. Let's use HID_MIN_BUFFER_SIZE, then we do the | 965 | * size of the reports. Let's use HID_MIN_BUFFER_SIZE, then we do the |
971 | * real computation later. */ | 966 | * real computation later. */ |
972 | ret = i2c_hid_alloc_buffers(ihid, HID_MIN_BUFFER_SIZE); | 967 | ret = i2c_hid_alloc_buffers(ihid, HID_MIN_BUFFER_SIZE); |
973 | if (ret < 0) | 968 | if (ret < 0) |
974 | goto err; | 969 | goto err; |
975 | 970 | ||
976 | pm_runtime_get_noresume(&client->dev); | 971 | pm_runtime_get_noresume(&client->dev); |
977 | pm_runtime_set_active(&client->dev); | 972 | pm_runtime_set_active(&client->dev); |
978 | pm_runtime_enable(&client->dev); | 973 | pm_runtime_enable(&client->dev); |
979 | 974 | ||
980 | ret = i2c_hid_fetch_hid_descriptor(ihid); | 975 | ret = i2c_hid_fetch_hid_descriptor(ihid); |
981 | if (ret < 0) | 976 | if (ret < 0) |
982 | goto err_pm; | 977 | goto err_pm; |
983 | 978 | ||
984 | ret = i2c_hid_init_irq(client); | 979 | ret = i2c_hid_init_irq(client); |
985 | if (ret < 0) | 980 | if (ret < 0) |
986 | goto err_pm; | 981 | goto err_pm; |
987 | 982 | ||
988 | hid = hid_allocate_device(); | 983 | hid = hid_allocate_device(); |
989 | if (IS_ERR(hid)) { | 984 | if (IS_ERR(hid)) { |
990 | ret = PTR_ERR(hid); | 985 | ret = PTR_ERR(hid); |
991 | goto err_irq; | 986 | goto err_irq; |
992 | } | 987 | } |
993 | 988 | ||
994 | ihid->hid = hid; | 989 | ihid->hid = hid; |
995 | 990 | ||
996 | hid->driver_data = client; | 991 | hid->driver_data = client; |
997 | hid->ll_driver = &i2c_hid_ll_driver; | 992 | hid->ll_driver = &i2c_hid_ll_driver; |
998 | hid->dev.parent = &client->dev; | 993 | hid->dev.parent = &client->dev; |
999 | ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev)); | 994 | ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev)); |
1000 | hid->bus = BUS_I2C; | 995 | hid->bus = BUS_I2C; |
1001 | hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); | 996 | hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); |
1002 | hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); | 997 | hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); |
1003 | hid->product = le16_to_cpu(ihid->hdesc.wProductID); | 998 | hid->product = le16_to_cpu(ihid->hdesc.wProductID); |
1004 | 999 | ||
1005 | snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX", | 1000 | snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX", |
1006 | client->name, hid->vendor, hid->product); | 1001 | client->name, hid->vendor, hid->product); |
1007 | 1002 | ||
1008 | ret = hid_add_device(hid); | 1003 | ret = hid_add_device(hid); |
1009 | if (ret) { | 1004 | if (ret) { |
1010 | if (ret != -ENODEV) | 1005 | if (ret != -ENODEV) |
1011 | hid_err(client, "can't add hid device: %d\n", ret); | 1006 | hid_err(client, "can't add hid device: %d\n", ret); |
1012 | goto err_mem_free; | 1007 | goto err_mem_free; |
1013 | } | 1008 | } |
1014 | 1009 | ||
1015 | pm_runtime_put(&client->dev); | 1010 | pm_runtime_put(&client->dev); |
1016 | return 0; | 1011 | return 0; |
1017 | 1012 | ||
1018 | err_mem_free: | 1013 | err_mem_free: |
1019 | hid_destroy_device(hid); | 1014 | hid_destroy_device(hid); |
1020 | 1015 | ||
1021 | err_irq: | 1016 | err_irq: |
1022 | free_irq(client->irq, ihid); | 1017 | free_irq(client->irq, ihid); |
1023 | 1018 | ||
1024 | err_pm: | 1019 | err_pm: |
1025 | pm_runtime_put_noidle(&client->dev); | 1020 | pm_runtime_put_noidle(&client->dev); |
1026 | pm_runtime_disable(&client->dev); | 1021 | pm_runtime_disable(&client->dev); |
1027 | 1022 | ||
1028 | err: | 1023 | err: |
1029 | i2c_hid_free_buffers(ihid); | 1024 | i2c_hid_free_buffers(ihid); |
1030 | kfree(ihid); | 1025 | kfree(ihid); |
1031 | return ret; | 1026 | return ret; |
1032 | } | 1027 | } |
1033 | 1028 | ||
1034 | static int i2c_hid_remove(struct i2c_client *client) | 1029 | static int i2c_hid_remove(struct i2c_client *client) |
1035 | { | 1030 | { |
1036 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 1031 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
1037 | struct hid_device *hid; | 1032 | struct hid_device *hid; |
1038 | 1033 | ||
1039 | pm_runtime_get_sync(&client->dev); | 1034 | pm_runtime_get_sync(&client->dev); |
1040 | pm_runtime_disable(&client->dev); | 1035 | pm_runtime_disable(&client->dev); |
1041 | pm_runtime_set_suspended(&client->dev); | 1036 | pm_runtime_set_suspended(&client->dev); |
1042 | pm_runtime_put_noidle(&client->dev); | 1037 | pm_runtime_put_noidle(&client->dev); |
1043 | 1038 | ||
1044 | hid = ihid->hid; | 1039 | hid = ihid->hid; |
1045 | hid_destroy_device(hid); | 1040 | hid_destroy_device(hid); |
1046 | 1041 | ||
1047 | free_irq(client->irq, ihid); | 1042 | free_irq(client->irq, ihid); |
1048 | 1043 | ||
1049 | if (ihid->bufsize) | 1044 | if (ihid->bufsize) |
1050 | i2c_hid_free_buffers(ihid); | 1045 | i2c_hid_free_buffers(ihid); |
1051 | 1046 | ||
1052 | kfree(ihid); | 1047 | kfree(ihid); |
1053 | 1048 | ||
1054 | return 0; | 1049 | return 0; |
1055 | } | 1050 | } |
1056 | 1051 | ||
1057 | #ifdef CONFIG_PM_SLEEP | 1052 | #ifdef CONFIG_PM_SLEEP |
1058 | static int i2c_hid_suspend(struct device *dev) | 1053 | static int i2c_hid_suspend(struct device *dev) |
1059 | { | 1054 | { |
1060 | struct i2c_client *client = to_i2c_client(dev); | 1055 | struct i2c_client *client = to_i2c_client(dev); |
1061 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 1056 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
1062 | struct hid_device *hid = ihid->hid; | 1057 | struct hid_device *hid = ihid->hid; |
1063 | int ret = 0; | 1058 | int ret = 0; |
1064 | 1059 | ||
1065 | disable_irq(client->irq); | 1060 | disable_irq(client->irq); |
1066 | if (device_may_wakeup(&client->dev)) | 1061 | if (device_may_wakeup(&client->dev)) |
1067 | enable_irq_wake(client->irq); | 1062 | enable_irq_wake(client->irq); |
1068 | 1063 | ||
1069 | if (hid->driver && hid->driver->suspend) | 1064 | if (hid->driver && hid->driver->suspend) |
1070 | ret = hid->driver->suspend(hid, PMSG_SUSPEND); | 1065 | ret = hid->driver->suspend(hid, PMSG_SUSPEND); |
1071 | 1066 | ||
1072 | /* Save some power */ | 1067 | /* Save some power */ |
1073 | i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); | 1068 | i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); |
1074 | 1069 | ||
1075 | return ret; | 1070 | return ret; |
1076 | } | 1071 | } |
1077 | 1072 | ||
1078 | static int i2c_hid_resume(struct device *dev) | 1073 | static int i2c_hid_resume(struct device *dev) |
1079 | { | 1074 | { |
1080 | int ret; | 1075 | int ret; |
1081 | struct i2c_client *client = to_i2c_client(dev); | 1076 | struct i2c_client *client = to_i2c_client(dev); |
1082 | struct i2c_hid *ihid = i2c_get_clientdata(client); | 1077 | struct i2c_hid *ihid = i2c_get_clientdata(client); |
1083 | struct hid_device *hid = ihid->hid; | 1078 | struct hid_device *hid = ihid->hid; |
1084 | 1079 | ||
1085 | enable_irq(client->irq); | 1080 | enable_irq(client->irq); |
1086 | ret = i2c_hid_hwreset(client); | 1081 | ret = i2c_hid_hwreset(client); |
1087 | if (ret) | 1082 | if (ret) |
1088 | return ret; | 1083 | return ret; |
1089 | 1084 | ||
1090 | if (device_may_wakeup(&client->dev)) | 1085 | if (device_may_wakeup(&client->dev)) |
1091 | disable_irq_wake(client->irq); | 1086 | disable_irq_wake(client->irq); |
1092 | 1087 | ||
1093 | if (hid->driver && hid->driver->reset_resume) { | 1088 | if (hid->driver && hid->driver->reset_resume) { |
1094 | ret = hid->driver->reset_resume(hid); | 1089 | ret = hid->driver->reset_resume(hid); |
1095 | return ret; | 1090 | return ret; |
1096 | } | 1091 | } |
1097 | 1092 | ||
1098 | return 0; | 1093 | return 0; |
1099 | } | 1094 | } |
1100 | #endif | 1095 | #endif |
1101 | 1096 | ||
1102 | #ifdef CONFIG_PM | 1097 | #ifdef CONFIG_PM |
1103 | static int i2c_hid_runtime_suspend(struct device *dev) | 1098 | static int i2c_hid_runtime_suspend(struct device *dev) |
1104 | { | 1099 | { |
1105 | struct i2c_client *client = to_i2c_client(dev); | 1100 | struct i2c_client *client = to_i2c_client(dev); |
1106 | 1101 | ||
1107 | i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); | 1102 | i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); |
1108 | disable_irq(client->irq); | 1103 | disable_irq(client->irq); |
1109 | return 0; | 1104 | return 0; |
1110 | } | 1105 | } |
1111 | 1106 | ||
1112 | static int i2c_hid_runtime_resume(struct device *dev) | 1107 | static int i2c_hid_runtime_resume(struct device *dev) |
1113 | { | 1108 | { |
1114 | struct i2c_client *client = to_i2c_client(dev); | 1109 | struct i2c_client *client = to_i2c_client(dev); |
1115 | 1110 | ||
1116 | enable_irq(client->irq); | 1111 | enable_irq(client->irq); |
1117 | i2c_hid_set_power(client, I2C_HID_PWR_ON); | 1112 | i2c_hid_set_power(client, I2C_HID_PWR_ON); |
1118 | return 0; | 1113 | return 0; |
1119 | } | 1114 | } |
1120 | #endif | 1115 | #endif |
1121 | 1116 | ||
1122 | static const struct dev_pm_ops i2c_hid_pm = { | 1117 | static const struct dev_pm_ops i2c_hid_pm = { |
1123 | SET_SYSTEM_SLEEP_PM_OPS(i2c_hid_suspend, i2c_hid_resume) | 1118 | SET_SYSTEM_SLEEP_PM_OPS(i2c_hid_suspend, i2c_hid_resume) |
1124 | SET_RUNTIME_PM_OPS(i2c_hid_runtime_suspend, i2c_hid_runtime_resume, | 1119 | SET_RUNTIME_PM_OPS(i2c_hid_runtime_suspend, i2c_hid_runtime_resume, |
1125 | NULL) | 1120 | NULL) |
1126 | }; | 1121 | }; |
1127 | 1122 | ||
1128 | static const struct i2c_device_id i2c_hid_id_table[] = { | 1123 | static const struct i2c_device_id i2c_hid_id_table[] = { |
1129 | { "hid", 0 }, | 1124 | { "hid", 0 }, |
1130 | { }, | 1125 | { }, |
1131 | }; | 1126 | }; |
1132 | MODULE_DEVICE_TABLE(i2c, i2c_hid_id_table); | 1127 | MODULE_DEVICE_TABLE(i2c, i2c_hid_id_table); |
1133 | 1128 | ||
1134 | 1129 | ||
1135 | static struct i2c_driver i2c_hid_driver = { | 1130 | static struct i2c_driver i2c_hid_driver = { |
1136 | .driver = { | 1131 | .driver = { |
1137 | .name = "i2c_hid", | 1132 | .name = "i2c_hid", |
1138 | .owner = THIS_MODULE, | 1133 | .owner = THIS_MODULE, |
1139 | .pm = &i2c_hid_pm, | 1134 | .pm = &i2c_hid_pm, |
1140 | .acpi_match_table = ACPI_PTR(i2c_hid_acpi_match), | 1135 | .acpi_match_table = ACPI_PTR(i2c_hid_acpi_match), |
1141 | .of_match_table = of_match_ptr(i2c_hid_of_match), | 1136 | .of_match_table = of_match_ptr(i2c_hid_of_match), |
1142 | }, | 1137 | }, |
1143 | 1138 | ||
1144 | .probe = i2c_hid_probe, | 1139 | .probe = i2c_hid_probe, |
1145 | .remove = i2c_hid_remove, | 1140 | .remove = i2c_hid_remove, |
1146 | 1141 | ||
1147 | .id_table = i2c_hid_id_table, | 1142 | .id_table = i2c_hid_id_table, |
1148 | }; | 1143 | }; |
1149 | 1144 | ||
1150 | module_i2c_driver(i2c_hid_driver); | 1145 | module_i2c_driver(i2c_hid_driver); |
1151 | 1146 | ||
1152 | MODULE_DESCRIPTION("HID over I2C core driver"); | 1147 | MODULE_DESCRIPTION("HID over I2C core driver"); |
1153 | MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); | 1148 | MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); |
1154 | MODULE_LICENSE("GPL"); | 1149 | MODULE_LICENSE("GPL"); |
1155 | 1150 |
drivers/hid/usbhid/hid-quirks.c
1 | /* | 1 | /* |
2 | * USB HID quirks support for Linux | 2 | * USB HID quirks support for Linux |
3 | * | 3 | * |
4 | * Copyright (c) 1999 Andreas Gal | 4 | * Copyright (c) 1999 Andreas Gal |
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
7 | * Copyright (c) 2006-2007 Jiri Kosina | 7 | * Copyright (c) 2006-2007 Jiri Kosina |
8 | * Copyright (c) 2007 Paul Walmsley | 8 | * Copyright (c) 2007 Paul Walmsley |
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * This program is free software; you can redistribute it and/or modify it | 12 | * This program is free software; you can redistribute it and/or modify it |
13 | * under the terms of the GNU General Public License as published by the Free | 13 | * under the terms of the GNU General Public License as published by the Free |
14 | * Software Foundation; either version 2 of the License, or (at your option) | 14 | * Software Foundation; either version 2 of the License, or (at your option) |
15 | * any later version. | 15 | * any later version. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/hid.h> | 18 | #include <linux/hid.h> |
19 | #include <linux/export.h> | 19 | #include <linux/export.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | 21 | ||
22 | #include "../hid-ids.h" | 22 | #include "../hid-ids.h" |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Alphabetically sorted blacklist by quirk type. | 25 | * Alphabetically sorted blacklist by quirk type. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | static const struct hid_blacklist { | 28 | static const struct hid_blacklist { |
29 | __u16 idVendor; | 29 | __u16 idVendor; |
30 | __u16 idProduct; | 30 | __u16 idProduct; |
31 | __u32 quirks; | 31 | __u32 quirks; |
32 | } hid_blacklist[] = { | 32 | } hid_blacklist[] = { |
33 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, | 33 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, |
34 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, | 34 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, |
35 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, | 35 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, |
36 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, | 36 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, |
37 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, | 37 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, |
38 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, | 38 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, |
39 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 39 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
40 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 40 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
41 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 41 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
42 | { USB_VENDOR_ID_NATSU, USB_DEVICE_ID_NATSU_GAMEPAD, HID_QUIRK_BADPAD }, | 42 | { USB_VENDOR_ID_NATSU, USB_DEVICE_ID_NATSU_GAMEPAD, HID_QUIRK_BADPAD }, |
43 | { USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD }, | 43 | { USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD }, |
44 | { USB_VENDOR_ID_NEXTWINDOW, USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN, HID_QUIRK_MULTI_INPUT}, | 44 | { USB_VENDOR_ID_NEXTWINDOW, USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN, HID_QUIRK_MULTI_INPUT}, |
45 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, | 45 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, |
46 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, | 46 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, |
47 | 47 | ||
48 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, | 48 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, |
49 | 49 | ||
50 | { USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II, HID_QUIRK_MULTI_INPUT }, | 50 | { USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II, HID_QUIRK_MULTI_INPUT }, |
51 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, | 51 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, |
52 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH_2968, HID_QUIRK_MULTI_INPUT }, | 52 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH_2968, HID_QUIRK_MULTI_INPUT }, |
53 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, | 53 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, |
54 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 54 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
55 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, | 55 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, |
56 | { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT }, | 56 | { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT }, |
57 | 57 | ||
58 | { USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET }, | 58 | { USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET }, |
59 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, | 59 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, |
60 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, | 60 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, |
61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, | 61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, |
62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, | 62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, |
63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
64 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, | 64 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, |
65 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, | 65 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, |
66 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, | 66 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, |
67 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET }, | 67 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET }, |
68 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_THROTTLE, HID_QUIRK_NOGET }, | 68 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_THROTTLE, HID_QUIRK_NOGET }, |
69 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET }, | 69 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET }, |
70 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, | 70 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, |
71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, | 71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, |
72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, | 73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, |
74 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, | 74 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, |
75 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, | 75 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, |
76 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL }, | 76 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL }, |
77 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, | 77 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, |
78 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 78 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
79 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 79 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
80 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 80 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
81 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, | 81 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, |
82 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, | 82 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, |
83 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, | 83 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, |
84 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, | 84 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, |
85 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, | 85 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, |
86 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1610, HID_QUIRK_NOGET }, | 86 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1610, HID_QUIRK_NOGET }, |
87 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1640, HID_QUIRK_NOGET }, | 87 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1640, HID_QUIRK_NOGET }, |
88 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, | 88 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, |
89 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2, HID_QUIRK_ALWAYS_POLL }, | 89 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2, HID_QUIRK_ALWAYS_POLL }, |
90 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, | 90 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, |
91 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, | 91 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, |
92 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, | 92 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, |
93 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, | 93 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, |
94 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001, HID_QUIRK_NOGET }, | 94 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001, HID_QUIRK_NOGET }, |
95 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, | 95 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, |
96 | { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS }, | 96 | { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS }, |
97 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, | 97 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, |
98 | { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, | 98 | { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, |
99 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET }, | 99 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET }, |
100 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET }, | 100 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET }, |
101 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS_TS, HID_QUIRK_NO_INIT_REPORTS }, | 101 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS_TS, HID_QUIRK_NO_INIT_REPORTS }, |
102 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS1030_TOUCH, HID_QUIRK_NOGET }, | 102 | { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS1030_TOUCH, HID_QUIRK_NOGET }, |
103 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | 103 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
104 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, | 104 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, |
105 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, | 105 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, |
106 | { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN, HID_QUIRK_NOGET }, | 106 | { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN, HID_QUIRK_NOGET }, |
107 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | 107 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, |
108 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, | 108 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, |
109 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, | 109 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, |
110 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, | 110 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, |
111 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT }, | 111 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT }, |
112 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, | 112 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, |
113 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, | 113 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, |
114 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, | 114 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, |
115 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH, HID_QUIRK_MULTI_INPUT }, | 115 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH, HID_QUIRK_MULTI_INPUT }, |
116 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET, HID_QUIRK_MULTI_INPUT }, | 116 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET, HID_QUIRK_MULTI_INPUT }, |
117 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 117 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
118 | 118 | ||
119 | { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 119 | { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
120 | 120 | ||
121 | { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, | 121 | { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, |
122 | 122 | ||
123 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH, HID_QUIRK_MULTI_INPUT }, | 123 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH, HID_QUIRK_MULTI_INPUT }, |
124 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT }, | 124 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT }, |
125 | { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS }, | 125 | { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS }, |
126 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, | 126 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, |
127 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT }, | ||
127 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, | 128 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, |
128 | { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, | 129 | { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, |
129 | { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS }, | 130 | { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS }, |
130 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS }, | 131 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS }, |
131 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2, HID_QUIRK_NO_INIT_REPORTS }, | 132 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2, HID_QUIRK_NO_INIT_REPORTS }, |
132 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_HD, HID_QUIRK_NO_INIT_REPORTS }, | 133 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_HD, HID_QUIRK_NO_INIT_REPORTS }, |
133 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD, HID_QUIRK_NO_INIT_REPORTS }, | 134 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD, HID_QUIRK_NO_INIT_REPORTS }, |
134 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103, HID_QUIRK_NO_INIT_REPORTS }, | 135 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103, HID_QUIRK_NO_INIT_REPORTS }, |
135 | { USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096, HID_QUIRK_NO_INIT_INPUT_REPORTS }, | 136 | { USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096, HID_QUIRK_NO_INIT_INPUT_REPORTS }, |
136 | 137 | ||
137 | { 0, 0 } | 138 | { 0, 0 } |
138 | }; | 139 | }; |
139 | 140 | ||
140 | /* Dynamic HID quirks list - specified at runtime */ | 141 | /* Dynamic HID quirks list - specified at runtime */ |
141 | struct quirks_list_struct { | 142 | struct quirks_list_struct { |
142 | struct hid_blacklist hid_bl_item; | 143 | struct hid_blacklist hid_bl_item; |
143 | struct list_head node; | 144 | struct list_head node; |
144 | }; | 145 | }; |
145 | 146 | ||
146 | static LIST_HEAD(dquirks_list); | 147 | static LIST_HEAD(dquirks_list); |
147 | static DECLARE_RWSEM(dquirks_rwsem); | 148 | static DECLARE_RWSEM(dquirks_rwsem); |
148 | 149 | ||
149 | /* Runtime ("dynamic") quirks manipulation functions */ | 150 | /* Runtime ("dynamic") quirks manipulation functions */ |
150 | 151 | ||
151 | /** | 152 | /** |
152 | * usbhid_exists_dquirk: find any dynamic quirks for a USB HID device | 153 | * usbhid_exists_dquirk: find any dynamic quirks for a USB HID device |
153 | * @idVendor: the 16-bit USB vendor ID, in native byteorder | 154 | * @idVendor: the 16-bit USB vendor ID, in native byteorder |
154 | * @idProduct: the 16-bit USB product ID, in native byteorder | 155 | * @idProduct: the 16-bit USB product ID, in native byteorder |
155 | * | 156 | * |
156 | * Description: | 157 | * Description: |
157 | * Scans dquirks_list for a matching dynamic quirk and returns | 158 | * Scans dquirks_list for a matching dynamic quirk and returns |
158 | * the pointer to the relevant struct hid_blacklist if found. | 159 | * the pointer to the relevant struct hid_blacklist if found. |
159 | * Must be called with a read lock held on dquirks_rwsem. | 160 | * Must be called with a read lock held on dquirks_rwsem. |
160 | * | 161 | * |
161 | * Returns: NULL if no quirk found, struct hid_blacklist * if found. | 162 | * Returns: NULL if no quirk found, struct hid_blacklist * if found. |
162 | */ | 163 | */ |
163 | static struct hid_blacklist *usbhid_exists_dquirk(const u16 idVendor, | 164 | static struct hid_blacklist *usbhid_exists_dquirk(const u16 idVendor, |
164 | const u16 idProduct) | 165 | const u16 idProduct) |
165 | { | 166 | { |
166 | struct quirks_list_struct *q; | 167 | struct quirks_list_struct *q; |
167 | struct hid_blacklist *bl_entry = NULL; | 168 | struct hid_blacklist *bl_entry = NULL; |
168 | 169 | ||
169 | list_for_each_entry(q, &dquirks_list, node) { | 170 | list_for_each_entry(q, &dquirks_list, node) { |
170 | if (q->hid_bl_item.idVendor == idVendor && | 171 | if (q->hid_bl_item.idVendor == idVendor && |
171 | q->hid_bl_item.idProduct == idProduct) { | 172 | q->hid_bl_item.idProduct == idProduct) { |
172 | bl_entry = &q->hid_bl_item; | 173 | bl_entry = &q->hid_bl_item; |
173 | break; | 174 | break; |
174 | } | 175 | } |
175 | } | 176 | } |
176 | 177 | ||
177 | if (bl_entry != NULL) | 178 | if (bl_entry != NULL) |
178 | dbg_hid("Found dynamic quirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", | 179 | dbg_hid("Found dynamic quirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", |
179 | bl_entry->quirks, bl_entry->idVendor, | 180 | bl_entry->quirks, bl_entry->idVendor, |
180 | bl_entry->idProduct); | 181 | bl_entry->idProduct); |
181 | 182 | ||
182 | return bl_entry; | 183 | return bl_entry; |
183 | } | 184 | } |
184 | 185 | ||
185 | 186 | ||
186 | /** | 187 | /** |
187 | * usbhid_modify_dquirk: add/replace a HID quirk | 188 | * usbhid_modify_dquirk: add/replace a HID quirk |
188 | * @idVendor: the 16-bit USB vendor ID, in native byteorder | 189 | * @idVendor: the 16-bit USB vendor ID, in native byteorder |
189 | * @idProduct: the 16-bit USB product ID, in native byteorder | 190 | * @idProduct: the 16-bit USB product ID, in native byteorder |
190 | * @quirks: the u32 quirks value to add/replace | 191 | * @quirks: the u32 quirks value to add/replace |
191 | * | 192 | * |
192 | * Description: | 193 | * Description: |
193 | * If an dynamic quirk exists in memory for this (idVendor, | 194 | * If an dynamic quirk exists in memory for this (idVendor, |
194 | * idProduct) pair, replace its quirks value with what was | 195 | * idProduct) pair, replace its quirks value with what was |
195 | * provided. Otherwise, add the quirk to the dynamic quirks list. | 196 | * provided. Otherwise, add the quirk to the dynamic quirks list. |
196 | * | 197 | * |
197 | * Returns: 0 OK, -error on failure. | 198 | * Returns: 0 OK, -error on failure. |
198 | */ | 199 | */ |
199 | static int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, | 200 | static int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, |
200 | const u32 quirks) | 201 | const u32 quirks) |
201 | { | 202 | { |
202 | struct quirks_list_struct *q_new, *q; | 203 | struct quirks_list_struct *q_new, *q; |
203 | int list_edited = 0; | 204 | int list_edited = 0; |
204 | 205 | ||
205 | if (!idVendor) { | 206 | if (!idVendor) { |
206 | dbg_hid("Cannot add a quirk with idVendor = 0\n"); | 207 | dbg_hid("Cannot add a quirk with idVendor = 0\n"); |
207 | return -EINVAL; | 208 | return -EINVAL; |
208 | } | 209 | } |
209 | 210 | ||
210 | q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL); | 211 | q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL); |
211 | if (!q_new) { | 212 | if (!q_new) { |
212 | dbg_hid("Could not allocate quirks_list_struct\n"); | 213 | dbg_hid("Could not allocate quirks_list_struct\n"); |
213 | return -ENOMEM; | 214 | return -ENOMEM; |
214 | } | 215 | } |
215 | 216 | ||
216 | q_new->hid_bl_item.idVendor = idVendor; | 217 | q_new->hid_bl_item.idVendor = idVendor; |
217 | q_new->hid_bl_item.idProduct = idProduct; | 218 | q_new->hid_bl_item.idProduct = idProduct; |
218 | q_new->hid_bl_item.quirks = quirks; | 219 | q_new->hid_bl_item.quirks = quirks; |
219 | 220 | ||
220 | down_write(&dquirks_rwsem); | 221 | down_write(&dquirks_rwsem); |
221 | 222 | ||
222 | list_for_each_entry(q, &dquirks_list, node) { | 223 | list_for_each_entry(q, &dquirks_list, node) { |
223 | 224 | ||
224 | if (q->hid_bl_item.idVendor == idVendor && | 225 | if (q->hid_bl_item.idVendor == idVendor && |
225 | q->hid_bl_item.idProduct == idProduct) { | 226 | q->hid_bl_item.idProduct == idProduct) { |
226 | 227 | ||
227 | list_replace(&q->node, &q_new->node); | 228 | list_replace(&q->node, &q_new->node); |
228 | kfree(q); | 229 | kfree(q); |
229 | list_edited = 1; | 230 | list_edited = 1; |
230 | break; | 231 | break; |
231 | 232 | ||
232 | } | 233 | } |
233 | 234 | ||
234 | } | 235 | } |
235 | 236 | ||
236 | if (!list_edited) | 237 | if (!list_edited) |
237 | list_add_tail(&q_new->node, &dquirks_list); | 238 | list_add_tail(&q_new->node, &dquirks_list); |
238 | 239 | ||
239 | up_write(&dquirks_rwsem); | 240 | up_write(&dquirks_rwsem); |
240 | 241 | ||
241 | return 0; | 242 | return 0; |
242 | } | 243 | } |
243 | 244 | ||
244 | /** | 245 | /** |
245 | * usbhid_remove_all_dquirks: remove all runtime HID quirks from memory | 246 | * usbhid_remove_all_dquirks: remove all runtime HID quirks from memory |
246 | * | 247 | * |
247 | * Description: | 248 | * Description: |
248 | * Free all memory associated with dynamic quirks - called before | 249 | * Free all memory associated with dynamic quirks - called before |
249 | * module unload. | 250 | * module unload. |
250 | * | 251 | * |
251 | */ | 252 | */ |
252 | static void usbhid_remove_all_dquirks(void) | 253 | static void usbhid_remove_all_dquirks(void) |
253 | { | 254 | { |
254 | struct quirks_list_struct *q, *temp; | 255 | struct quirks_list_struct *q, *temp; |
255 | 256 | ||
256 | down_write(&dquirks_rwsem); | 257 | down_write(&dquirks_rwsem); |
257 | list_for_each_entry_safe(q, temp, &dquirks_list, node) { | 258 | list_for_each_entry_safe(q, temp, &dquirks_list, node) { |
258 | list_del(&q->node); | 259 | list_del(&q->node); |
259 | kfree(q); | 260 | kfree(q); |
260 | } | 261 | } |
261 | up_write(&dquirks_rwsem); | 262 | up_write(&dquirks_rwsem); |
262 | 263 | ||
263 | } | 264 | } |
264 | 265 | ||
265 | /** | 266 | /** |
266 | * usbhid_quirks_init: apply USB HID quirks specified at module load time | 267 | * usbhid_quirks_init: apply USB HID quirks specified at module load time |
267 | */ | 268 | */ |
268 | int usbhid_quirks_init(char **quirks_param) | 269 | int usbhid_quirks_init(char **quirks_param) |
269 | { | 270 | { |
270 | u16 idVendor, idProduct; | 271 | u16 idVendor, idProduct; |
271 | u32 quirks; | 272 | u32 quirks; |
272 | int n = 0, m; | 273 | int n = 0, m; |
273 | 274 | ||
274 | for (; n < MAX_USBHID_BOOT_QUIRKS && quirks_param[n]; n++) { | 275 | for (; n < MAX_USBHID_BOOT_QUIRKS && quirks_param[n]; n++) { |
275 | 276 | ||
276 | m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", | 277 | m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", |
277 | &idVendor, &idProduct, &quirks); | 278 | &idVendor, &idProduct, &quirks); |
278 | 279 | ||
279 | if (m != 3 || | 280 | if (m != 3 || |
280 | usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) { | 281 | usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) { |
281 | printk(KERN_WARNING | 282 | printk(KERN_WARNING |
282 | "Could not parse HID quirk module param %s\n", | 283 | "Could not parse HID quirk module param %s\n", |
283 | quirks_param[n]); | 284 | quirks_param[n]); |
284 | } | 285 | } |
285 | } | 286 | } |
286 | 287 | ||
287 | return 0; | 288 | return 0; |
288 | } | 289 | } |
289 | 290 | ||
290 | /** | 291 | /** |
291 | * usbhid_quirks_exit: release memory associated with dynamic_quirks | 292 | * usbhid_quirks_exit: release memory associated with dynamic_quirks |
292 | * | 293 | * |
293 | * Description: | 294 | * Description: |
294 | * Release all memory associated with dynamic quirks. Called upon | 295 | * Release all memory associated with dynamic quirks. Called upon |
295 | * module unload. | 296 | * module unload. |
296 | * | 297 | * |
297 | * Returns: nothing | 298 | * Returns: nothing |
298 | */ | 299 | */ |
299 | void usbhid_quirks_exit(void) | 300 | void usbhid_quirks_exit(void) |
300 | { | 301 | { |
301 | usbhid_remove_all_dquirks(); | 302 | usbhid_remove_all_dquirks(); |
302 | } | 303 | } |
303 | 304 | ||
304 | /** | 305 | /** |
305 | * usbhid_exists_squirk: return any static quirks for a USB HID device | 306 | * usbhid_exists_squirk: return any static quirks for a USB HID device |
306 | * @idVendor: the 16-bit USB vendor ID, in native byteorder | 307 | * @idVendor: the 16-bit USB vendor ID, in native byteorder |
307 | * @idProduct: the 16-bit USB product ID, in native byteorder | 308 | * @idProduct: the 16-bit USB product ID, in native byteorder |
308 | * | 309 | * |
309 | * Description: | 310 | * Description: |
310 | * Given a USB vendor ID and product ID, return a pointer to | 311 | * Given a USB vendor ID and product ID, return a pointer to |
311 | * the hid_blacklist entry associated with that device. | 312 | * the hid_blacklist entry associated with that device. |
312 | * | 313 | * |
313 | * Returns: pointer if quirk found, or NULL if no quirks found. | 314 | * Returns: pointer if quirk found, or NULL if no quirks found. |
314 | */ | 315 | */ |
315 | static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor, | 316 | static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor, |
316 | const u16 idProduct) | 317 | const u16 idProduct) |
317 | { | 318 | { |
318 | const struct hid_blacklist *bl_entry = NULL; | 319 | const struct hid_blacklist *bl_entry = NULL; |
319 | int n = 0; | 320 | int n = 0; |
320 | 321 | ||
321 | for (; hid_blacklist[n].idVendor; n++) | 322 | for (; hid_blacklist[n].idVendor; n++) |
322 | if (hid_blacklist[n].idVendor == idVendor && | 323 | if (hid_blacklist[n].idVendor == idVendor && |
323 | hid_blacklist[n].idProduct == idProduct) | 324 | hid_blacklist[n].idProduct == idProduct) |
324 | bl_entry = &hid_blacklist[n]; | 325 | bl_entry = &hid_blacklist[n]; |
325 | 326 | ||
326 | if (bl_entry != NULL) | 327 | if (bl_entry != NULL) |
327 | dbg_hid("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", | 328 | dbg_hid("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", |
328 | bl_entry->quirks, bl_entry->idVendor, | 329 | bl_entry->quirks, bl_entry->idVendor, |
329 | bl_entry->idProduct); | 330 | bl_entry->idProduct); |
330 | return bl_entry; | 331 | return bl_entry; |
331 | } | 332 | } |
332 | 333 | ||
333 | /** | 334 | /** |
334 | * usbhid_lookup_quirk: return any quirks associated with a USB HID device | 335 | * usbhid_lookup_quirk: return any quirks associated with a USB HID device |
335 | * @idVendor: the 16-bit USB vendor ID, in native byteorder | 336 | * @idVendor: the 16-bit USB vendor ID, in native byteorder |
336 | * @idProduct: the 16-bit USB product ID, in native byteorder | 337 | * @idProduct: the 16-bit USB product ID, in native byteorder |
337 | * | 338 | * |
338 | * Description: | 339 | * Description: |
339 | * Given a USB vendor ID and product ID, return any quirks associated | 340 | * Given a USB vendor ID and product ID, return any quirks associated |
340 | * with that device. | 341 | * with that device. |
341 | * | 342 | * |
342 | * Returns: a u32 quirks value. | 343 | * Returns: a u32 quirks value. |
343 | */ | 344 | */ |
344 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct) | 345 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct) |
345 | { | 346 | { |
346 | u32 quirks = 0; | 347 | u32 quirks = 0; |
347 | const struct hid_blacklist *bl_entry = NULL; | 348 | const struct hid_blacklist *bl_entry = NULL; |
348 | 349 | ||
349 | /* NCR devices must not be queried for reports */ | 350 | /* NCR devices must not be queried for reports */ |
350 | if (idVendor == USB_VENDOR_ID_NCR && | 351 | if (idVendor == USB_VENDOR_ID_NCR && |
351 | idProduct >= USB_DEVICE_ID_NCR_FIRST && | 352 | idProduct >= USB_DEVICE_ID_NCR_FIRST && |
352 | idProduct <= USB_DEVICE_ID_NCR_LAST) | 353 | idProduct <= USB_DEVICE_ID_NCR_LAST) |
353 | return HID_QUIRK_NO_INIT_REPORTS; | 354 | return HID_QUIRK_NO_INIT_REPORTS; |
354 | 355 | ||
355 | down_read(&dquirks_rwsem); | 356 | down_read(&dquirks_rwsem); |
356 | bl_entry = usbhid_exists_dquirk(idVendor, idProduct); | 357 | bl_entry = usbhid_exists_dquirk(idVendor, idProduct); |
357 | if (!bl_entry) | 358 | if (!bl_entry) |
358 | bl_entry = usbhid_exists_squirk(idVendor, idProduct); | 359 | bl_entry = usbhid_exists_squirk(idVendor, idProduct); |
359 | if (bl_entry) | 360 | if (bl_entry) |
360 | quirks = bl_entry->quirks; | 361 | quirks = bl_entry->quirks; |
361 | up_read(&dquirks_rwsem); | 362 | up_read(&dquirks_rwsem); |
362 | 363 | ||
363 | return quirks; | 364 | return quirks; |
364 | } | 365 | } |
365 | 366 | ||
366 | EXPORT_SYMBOL_GPL(usbhid_lookup_quirk); | 367 | EXPORT_SYMBOL_GPL(usbhid_lookup_quirk); |
367 | 368 |