Simon Wood | 75dbb95 | 2013-01-31 08:07:07 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * HID driver for Steelseries SRW-S1 |
| 3 | * |
| 4 | * Copyright (c) 2013 Simon Wood |
| 5 | */ |
| 6 | |
| 7 | /* |
| 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 |
| 10 | * Software Foundation; either version 2 of the License, or (at your option) |
| 11 | * any later version. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/device.h> |
| 15 | #include <linux/hid.h> |
| 16 | #include <linux/module.h> |
| 17 | |
| 18 | #include "hid-ids.h" |
| 19 | |
| 20 | static __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
| 21 | unsigned int *rsize) |
| 22 | { |
| 23 | if (*rsize >= 115 && rdesc[11] == 0x02 && rdesc[13] == 0xc8 |
| 24 | && rdesc[29] == 0xbb && rdesc[40] == 0xc5) { |
| 25 | hid_info(hdev, "Fixing up Steelseries SRW-S1 report descriptor\n"); |
| 26 | rdesc[11] = 0x01; |
| 27 | rdesc[13] = 0x30; |
| 28 | rdesc[29] = 0x31; |
| 29 | rdesc[40] = 0x32; |
| 30 | } |
| 31 | return rdesc; |
| 32 | } |
| 33 | |
| 34 | static const struct hid_device_id steelseries_srws1_devices[] = { |
| 35 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, |
| 36 | { } |
| 37 | }; |
| 38 | MODULE_DEVICE_TABLE(hid, steelseries_srws1_devices); |
| 39 | |
| 40 | static struct hid_driver steelseries_srws1_driver = { |
| 41 | .name = "steelseries_srws1", |
| 42 | .id_table = steelseries_srws1_devices, |
| 43 | .report_fixup = steelseries_srws1_report_fixup |
| 44 | }; |
| 45 | |
| 46 | static int __init steelseries_srws1_init(void) |
| 47 | { |
| 48 | return hid_register_driver(&steelseries_srws1_driver); |
| 49 | } |
| 50 | |
| 51 | static void __exit steelseries_srws1_exit(void) |
| 52 | { |
| 53 | hid_unregister_driver(&steelseries_srws1_driver); |
| 54 | } |
| 55 | |
| 56 | module_init(steelseries_srws1_init); |
| 57 | module_exit(steelseries_srws1_exit); |
| 58 | MODULE_LICENSE("GPL"); |