aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorAntonio Ospite <ospite@studenti.unina.it>2010-10-19 10:13:10 -0400
committerJiri Kosina <jkosina@suse.cz>2010-10-20 10:50:24 -0400
commit569b10a506c4d5bc7398d040930539d84d3a2186 (patch)
treee276b2bbf56a7c426588a83e212ba001549a02cd /drivers/hid
parent4ea6e4ffb4acdaaf9ba7687dbd84ae36e26cef9e (diff)
HID: hid-sony: override usbhid_output_raw_report for Sixaxis
Override usbhid_output_raw_report in order to force output reports (sent via hidraw_write, for instance) on the control endpoint. The Sony Sixaxis (PS3 Controller) accepts output reports only on the control endpoint, it silently discards them when they arrive over the interrupt endpoint where usbhid would normally deliver them. Signed-off-by: Antonio Ospite <ospite@studenti.unina.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-sony.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index d61f26840afe..0c164b3dce3a 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -46,6 +46,25 @@ static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
46 } 46 }
47} 47}
48 48
49static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
50 size_t count, unsigned char report_type)
51{
52 struct usb_interface *intf = to_usb_interface(hid->dev.parent);
53 struct usb_device *dev = interface_to_usbdev(intf);
54 struct usb_host_interface *interface = intf->cur_altsetting;
55 int report_id = buf[0];
56 int ret;
57
58 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
59 HID_REQ_SET_REPORT,
60 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
61 ((report_type + 1) << 8) | report_id,
62 interface->desc.bInterfaceNumber, buf, count,
63 USB_CTRL_SET_TIMEOUT);
64
65 return ret;
66}
67
49/* 68/*
50 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller 69 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller
51 * to "operational". Without this, the ps3 controller will not report any 70 * to "operational". Without this, the ps3 controller will not report any
@@ -110,8 +129,10 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
110 goto err_free; 129 goto err_free;
111 } 130 }
112 131
113 if (sc->quirks & SIXAXIS_CONTROLLER_USB) 132 if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
133 hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
114 ret = sixaxis_set_operational_usb(hdev); 134 ret = sixaxis_set_operational_usb(hdev);
135 }
115 else if (sc->quirks & SIXAXIS_CONTROLLER_BT) 136 else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
116 ret = sixaxis_set_operational_bt(hdev); 137 ret = sixaxis_set_operational_bt(hdev);
117 else 138 else