From patchwork Wed Oct 13 22:54:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 251551 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9DMtCJQ026905 for ; Wed, 13 Oct 2010 22:55:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753635Ab0JMWzM (ORCPT ); Wed, 13 Oct 2010 18:55:12 -0400 Received: from smtp206.alice.it ([82.57.200.102]:57487 "EHLO smtp206.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753503Ab0JMWzL (ORCPT ); Wed, 13 Oct 2010 18:55:11 -0400 Received: from jcn (79.3.140.53) by smtp206.alice.it (8.5.124.08) id 4C1A268C0789BE1C; Thu, 14 Oct 2010 00:55:05 +0200 Received: from ao2 by jcn with local (Exim 4.72) (envelope-from ) id 1P6ADv-0002BI-OC; Thu, 14 Oct 2010 00:55:03 +0200 From: Antonio Ospite To: Alan Ott Cc: Antonio Ospite , linux-input@vger.kernel.org, Jiri Kosina , Jim Paris , Ranulf Doswell , =?UTF-8?q?Mikko=20Virkkil=C3=A4?= , falktx@gmail.com Subject: [RFC, PATCH] HID: hid-sony, override usbhid_output_raw_report for Sixaxis Date: Thu, 14 Oct 2010 00:54:40 +0200 Message-Id: <1287010481-8356-1-git-send-email-ospite@studenti.unina.it> X-Mailer: git-send-email 1.7.1 In-Reply-To: <4CB62F69.1070809@signal11.us> References: <4CB62F69.1070809@signal11.us> X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 13 Oct 2010 22:55:13 +0000 (UTC) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 7b0c70a..d1007f4 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -46,6 +46,38 @@ 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 ret; + int skipped_report_id = 0; + int report_id = buf[0]; + + printk(KERN_DEBUG "%s: Overriding usbhid_output_raw_report\n", __func__); + + if (buf[0] == 0x0) { + /* Don't send the Report ID */ + buf++; + count--; + skipped_report_id = 1; + } + 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); + /* count also the report id, if this was a numbered report. */ + if (ret > 0 && skipped_report_id) + ret++; + + 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 @@ -111,8 +143,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) } if (sc->quirks & SIXAXIS_CONTROLLER_USB) { + hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; ret = sixaxis_set_operational_usb(hdev); - hdev->quirks |= HID_QUIRK_FORCE_OUT_CONTROL_EP; } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) ret = sixaxis_set_operational_bt(hdev);