summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Ospite <ospite@studenti.unina.it>2010-10-19 16:13:10 +0200
committerJiri Kosina <jkosina@suse.cz>2010-10-20 16:50:24 +0200
commit569b10a506c4d5bc7398d040930539d84d3a2186 (patch)
treee276b2bbf56a7c426588a83e212ba001549a02cd
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>
-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,
}
}
+static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
+ size_t count, unsigned char report_type)
+{
+ struct usb_interface *intf = to_usb_interface(hid->dev.parent);
+ struct usb_device *dev = interface_to_usbdev(intf);
+ struct usb_host_interface *interface = intf->cur_altsetting;
+ int report_id = buf[0];
+ int ret;
+
+ ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+ HID_REQ_SET_REPORT,
+ USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+ ((report_type + 1) << 8) | report_id,
+ interface->desc.bInterfaceNumber, buf, count,
+ USB_CTRL_SET_TIMEOUT);
+
+ return ret;
+}
+
/*
* Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller
* 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)
goto err_free;
}
- if (sc->quirks & SIXAXIS_CONTROLLER_USB)
+ if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
+ hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
ret = sixaxis_set_operational_usb(hdev);
+ }
else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
ret = sixaxis_set_operational_bt(hdev);
else