diff options
Diffstat (limited to 'drivers/hid/hid-kye.c')
-rw-r--r-- | drivers/hid/hid-kye.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c index 1e2ee2aa84a0..73845120295e 100644 --- a/drivers/hid/hid-kye.c +++ b/drivers/hid/hid-kye.c | |||
@@ -268,6 +268,26 @@ static __u8 easypen_m610x_rdesc_fixed[] = { | |||
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, | ||
272 | unsigned int *rsize, int offset, const char *device_name) { | ||
273 | /* | ||
274 | * the fixup that need to be done: | ||
275 | * - change Usage Maximum in the Comsumer Control | ||
276 | * (report ID 3) to a reasonable value | ||
277 | */ | ||
278 | if (*rsize >= offset + 31 && | ||
279 | /* Usage Page (Consumer Devices) */ | ||
280 | rdesc[offset] == 0x05 && rdesc[offset + 1] == 0x0c && | ||
281 | /* Usage (Consumer Control) */ | ||
282 | rdesc[offset + 2] == 0x09 && rdesc[offset + 3] == 0x01 && | ||
283 | /* Usage Maximum > 12287 */ | ||
284 | rdesc[offset + 10] == 0x2a && rdesc[offset + 12] > 0x2f) { | ||
285 | hid_info(hdev, "fixing up %s report descriptor\n", device_name); | ||
286 | rdesc[offset + 12] = 0x2f; | ||
287 | } | ||
288 | return rdesc; | ||
289 | } | ||
290 | |||
271 | static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 291 | static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
272 | unsigned int *rsize) | 292 | unsigned int *rsize) |
273 | { | 293 | { |
@@ -315,23 +335,12 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
315 | } | 335 | } |
316 | break; | 336 | break; |
317 | case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE: | 337 | case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE: |
318 | /* | 338 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, |
319 | * the fixup that need to be done: | 339 | "Genius Gila Gaming Mouse"); |
320 | * - change Usage Maximum in the Comsumer Control | 340 | break; |
321 | * (report ID 3) to a reasonable value | 341 | case USB_DEVICE_ID_GENIUS_GX_IMPERATOR: |
322 | */ | 342 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, |
323 | if (*rsize >= 135 && | 343 | "Genius Gx Imperator Keyboard"); |
324 | /* Usage Page (Consumer Devices) */ | ||
325 | rdesc[104] == 0x05 && rdesc[105] == 0x0c && | ||
326 | /* Usage (Consumer Control) */ | ||
327 | rdesc[106] == 0x09 && rdesc[107] == 0x01 && | ||
328 | /* Usage Maximum > 12287 */ | ||
329 | rdesc[114] == 0x2a && rdesc[116] > 0x2f) { | ||
330 | hid_info(hdev, | ||
331 | "fixing up Genius Gila Gaming Mouse " | ||
332 | "report descriptor\n"); | ||
333 | rdesc[116] = 0x2f; | ||
334 | } | ||
335 | break; | 344 | break; |
336 | } | 345 | } |
337 | return rdesc; | 346 | return rdesc; |
@@ -428,6 +437,8 @@ static const struct hid_device_id kye_devices[] = { | |||
428 | USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | 437 | USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
429 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 438 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
430 | USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, | 439 | USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, |
440 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | ||
441 | USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, | ||
431 | { } | 442 | { } |
432 | }; | 443 | }; |
433 | MODULE_DEVICE_TABLE(hid, kye_devices); | 444 | MODULE_DEVICE_TABLE(hid, kye_devices); |