2 * HID driver for Saitek devices, currently only the PS1000 (USB gamepad).
3 * Fixes the HID report descriptor by removing a non-existent axis and
4 * clearing the constant bit on the input reports for buttons and d-pad.
5 * (This module is based on "hid-ortek".)
7 * Copyright (c) 2012 Andreas Hübner
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; either version 2 of the License, or (at your option)
17 #include <linux/device.h>
18 #include <linux/hid.h>
19 #include <linux/module.h>
20 #include <linux/kernel.h>
24 static __u8
*saitek_report_fixup(struct hid_device
*hdev
, __u8
*rdesc
,
27 if (*rsize
== 137 && rdesc
[20] == 0x09 && rdesc
[21] == 0x33
28 && rdesc
[94] == 0x81 && rdesc
[95] == 0x03
29 && rdesc
[110] == 0x81 && rdesc
[111] == 0x03) {
31 hid_info(hdev
, "Fixing up Saitek PS1000 report descriptor\n");
33 /* convert spurious axis to a "noop" Logical Minimum (0) */
37 /* clear constant bit on buttons and d-pad */
45 static const struct hid_device_id saitek_devices
[] = {
46 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK
, USB_DEVICE_ID_SAITEK_PS1000
)},
50 MODULE_DEVICE_TABLE(hid
, saitek_devices
);
52 static struct hid_driver saitek_driver
= {
54 .id_table
= saitek_devices
,
55 .report_fixup
= saitek_report_fixup
58 static int __init
saitek_init(void)
60 return hid_register_driver(&saitek_driver
);
63 static void __exit
saitek_exit(void)
65 hid_unregister_driver(&saitek_driver
);
68 module_init(saitek_init
);
69 module_exit(saitek_exit
);
70 MODULE_LICENSE("GPL");