18 #include <linux/device.h>
19 #include <linux/hid.h>
20 #include <linux/module.h>
21 #include <linux/slab.h>
26 #define VAIO_RDESC_CONSTANT (1 << 0)
27 #define SIXAXIS_CONTROLLER_USB (1 << 1)
28 #define SIXAXIS_CONTROLLER_BT (1 << 2)
30 static const u8 sixaxis_rdesc_fixup[] = {
31 0x95, 0x13, 0x09, 0x01, 0x81, 0x02, 0x95, 0x0C,
32 0x81, 0x01, 0x75, 0x10, 0x95, 0x04, 0x26, 0xFF,
33 0x03, 0x46, 0xFF, 0x03, 0x09, 0x01, 0x81, 0x02
44 struct sony_sc *
sc = hid_get_drvdata(hdev);
47 *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) {
48 hid_info(hdev,
"Fixing up Sony Vaio VGX report descriptor\n");
56 hid_info(hdev,
"Fixing up Sony Sixaxis report descriptor\n");
57 memcpy((
void *)&rdesc[83], (
void *)&sixaxis_rdesc_fixup,
58 sizeof(sixaxis_rdesc_fixup));
66 struct sony_sc *sc = hid_get_drvdata(hdev);
72 rd[0] == 0x01 && size == 49) {
93 size_t count,
unsigned char report_type)
96 struct usb_device *
dev = interface_to_usbdev(intf);
97 struct usb_host_interface *
interface = intf->cur_altsetting;
98 int report_id = buf[0];
110 ((report_type + 1) << 8) | report_id,
111 interface->desc.bInterfaceNumber, buf, count,
112 USB_CTRL_SET_TIMEOUT);
126 static int sixaxis_set_operational_usb(
struct hid_device *hdev)
129 struct usb_device *dev = interface_to_usbdev(intf);
130 __u16 ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
141 (3 << 8) | 0xf2, ifnum, buf, 17,
142 USB_CTRL_GET_TIMEOUT);
144 hid_err(hdev,
"can't set operational mode\n");
151 static int sixaxis_set_operational_bt(
struct hid_device *hdev)
153 unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
160 unsigned long quirks =
id->driver_data;
165 hid_err(hdev,
"can't alloc sony descriptor\n");
170 hid_set_drvdata(hdev, sc);
172 ret = hid_parse(hdev);
174 hid_err(hdev,
"parse failed\n");
181 hid_err(hdev,
"hw start failed\n");
187 ret = sixaxis_set_operational_usb(hdev);
190 ret = sixaxis_set_operational_bt(hdev);
205 static void sony_remove(
struct hid_device *hdev)
208 kfree(hid_get_drvdata(hdev));
226 .id_table = sony_devices,
228 .remove = sony_remove,
229 .report_fixup = sony_report_fixup,
230 .raw_event = sony_raw_event
233 static int __init sony_init(
void)
238 static void __exit sony_exit(
void)