aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-steelseries-srws1.c
diff options
context:
space:
mode:
authorSimon Wood <simon@mungewell.org>2013-01-31 10:07:08 -0500
committerJiri Kosina <jkosina@suse.cz>2013-01-31 10:39:31 -0500
commit5492606dc39b2f1ce67cf718f09ade373a35f4eb (patch)
treebc9140e93364900dc2afcd81cde93c855b5108a8 /drivers/hid/hid-steelseries-srws1.c
parent75dbb9530f73da521b871ba3c4bd32f301a62635 (diff)
USB: HID: Steelseries SRW-S1 Add support for dials
This patch to the SRW-S1 driver re-writes the HID descriptor to insert a section for the 3 dials on the device, previously these were contained within a 'Manufacturer Specific' usage page. Signed-off-by: Simon Wood <simon@mungewell.org> Tested-by: John Murphy <rosegardener@freeode.co.uk> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-steelseries-srws1.c')
-rw-r--r--drivers/hid/hid-steelseries-srws1.c86
1 files changed, 82 insertions, 4 deletions
diff --git a/drivers/hid/hid-steelseries-srws1.c b/drivers/hid/hid-steelseries-srws1.c
index 161917c91ca8..e95434d733eb 100644
--- a/drivers/hid/hid-steelseries-srws1.c
+++ b/drivers/hid/hid-steelseries-srws1.c
@@ -17,16 +17,94 @@
17 17
18#include "hid-ids.h" 18#include "hid-ids.h"
19 19
20/* Fixed report descriptor for Steelseries SRW-S1 wheel controller
21 *
22 * The original descriptor hides the sensitivity and assists dials
23 * a custom vendor usage page. This inserts a patch to make them
24 * appear in the 'Generic Desktop' usage.
25 */
26
27static __u8 steelseries_srws1_rdesc_fixed[] = {
280x05, 0x01, /* Usage Page (Desktop) */
290x09, 0x08, /* Usage (MultiAxis), Changed */
300xA1, 0x01, /* Collection (Application), */
310xA1, 0x02, /* Collection (Logical), */
320x95, 0x01, /* Report Count (1), */
330x05, 0x01, /* Changed Usage Page (Desktop), */
340x09, 0x30, /* Changed Usage (X), */
350x16, 0xF8, 0xF8, /* Logical Minimum (-1800), */
360x26, 0x08, 0x07, /* Logical Maximum (1800), */
370x65, 0x14, /* Unit (Degrees), */
380x55, 0x0F, /* Unit Exponent (15), */
390x75, 0x10, /* Report Size (16), */
400x81, 0x02, /* Input (Variable), */
410x09, 0x31, /* Changed Usage (Y), */
420x15, 0x00, /* Logical Minimum (0), */
430x26, 0xFF, 0x03, /* Logical Maximum (1023), */
440x75, 0x0C, /* Report Size (12), */
450x81, 0x02, /* Input (Variable), */
460x09, 0x32, /* Changed Usage (Z), */
470x15, 0x00, /* Logical Minimum (0), */
480x26, 0xFF, 0x03, /* Logical Maximum (1023), */
490x75, 0x0C, /* Report Size (12), */
500x81, 0x02, /* Input (Variable), */
510x05, 0x01, /* Usage Page (Desktop), */
520x09, 0x39, /* Usage (Hat Switch), */
530x25, 0x07, /* Logical Maximum (7), */
540x35, 0x00, /* Physical Minimum (0), */
550x46, 0x3B, 0x01, /* Physical Maximum (315), */
560x65, 0x14, /* Unit (Degrees), */
570x75, 0x04, /* Report Size (4), */
580x95, 0x01, /* Report Count (1), */
590x81, 0x02, /* Input (Variable), */
600x25, 0x01, /* Logical Maximum (1), */
610x45, 0x01, /* Physical Maximum (1), */
620x65, 0x00, /* Unit, */
630x75, 0x01, /* Report Size (1), */
640x95, 0x03, /* Report Count (3), */
650x81, 0x01, /* Input (Constant), */
660x05, 0x09, /* Usage Page (Button), */
670x19, 0x01, /* Usage Minimum (01h), */
680x29, 0x11, /* Usage Maximum (11h), */
690x95, 0x11, /* Report Count (17), */
700x81, 0x02, /* Input (Variable), */
71 /* ---- Dial patch starts here ---- */
720x05, 0x01, /* Usage Page (Desktop), */
730x09, 0x33, /* Usage (RX), */
740x75, 0x04, /* Report Size (4), */
750x95, 0x02, /* Report Count (2), */
760x15, 0x00, /* Logical Minimum (0), */
770x25, 0x0b, /* Logical Maximum (b), */
780x81, 0x02, /* Input (Variable), */
790x09, 0x35, /* Usage (RZ), */
800x75, 0x04, /* Report Size (4), */
810x95, 0x01, /* Report Count (1), */
820x25, 0x03, /* Logical Maximum (3), */
830x81, 0x02, /* Input (Variable), */
84 /* ---- Dial patch ends here ---- */
850x06, 0x00, 0xFF, /* Usage Page (FF00h), */
860x09, 0x01, /* Usage (01h), */
870x75, 0x04, /* Changed Report Size (4), */
880x95, 0x0D, /* Changed Report Count (13), */
890x81, 0x02, /* Input (Variable), */
900xC0, /* End Collection, */
910xA1, 0x02, /* Collection (Logical), */
920x09, 0x02, /* Usage (02h), */
930x75, 0x08, /* Report Size (8), */
940x95, 0x10, /* Report Count (16), */
950x91, 0x02, /* Output (Variable), */
960xC0, /* End Collection, */
970xC0 /* End Collection */
98};
99
20static __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev, __u8 *rdesc, 100static __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev, __u8 *rdesc,
21 unsigned int *rsize) 101 unsigned int *rsize)
22{ 102{
23 if (*rsize >= 115 && rdesc[11] == 0x02 && rdesc[13] == 0xc8 103 if (*rsize >= 115 && rdesc[11] == 0x02 && rdesc[13] == 0xc8
24 && rdesc[29] == 0xbb && rdesc[40] == 0xc5) { 104 && rdesc[29] == 0xbb && rdesc[40] == 0xc5) {
25 hid_info(hdev, "Fixing up Steelseries SRW-S1 report descriptor\n"); 105 hid_info(hdev, "Fixing up Steelseries SRW-S1 report descriptor\n");
26 rdesc[11] = 0x01; 106 rdesc = steelseries_srws1_rdesc_fixed;
27 rdesc[13] = 0x30; 107 *rsize = sizeof(steelseries_srws1_rdesc_fixed);
28 rdesc[29] = 0x31;
29 rdesc[40] = 0x32;
30 } 108 }
31 return rdesc; 109 return rdesc;
32} 110}