From: Antonio Ospite <ospite@studenti.unina.it>
To: linux-input@vger.kernel.org
Cc: Antonio Ospite <ospite@studenti.unina.it>,
linux-bluetooth@vger.kernel.org, Jiri Kosina <jkosina@suse.cz>,
Marcel Holtmann <marcel@holtmann.org>,
"Gustavo F. Padovan" <padovan@profusion.mobi>,
Bastien Nocera <hadess@hadess.net>, Alan Ott <alan@signal11.us>,
Jim Paris <jim@jtan.com>, "pascal@pabr.org" <pascal@pabr.org>
Subject: [PATCH 1/2] hid-sony.c: Fix sending Output reports to the Sixaxis
Date: Sun, 20 Feb 2011 18:26:45 +0100 [thread overview]
Message-ID: <1298222806-19433-2-git-send-email-ospite@studenti.unina.it> (raw)
In-Reply-To: <1298222806-19433-1-git-send-email-ospite@studenti.unina.it>
The Sixaxis does not want the report_id as part of the data packet in
Output reports, so we have to discard buf[0] when sending the actual
control message.
Add also some documentation about that and about why
hdev->hid_output_raw_report needs to be overridden.
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
---
drivers/hid/hid-sony.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 68d7b36..93819a0 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -46,6 +46,16 @@ static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
return rdesc;
}
+/*
+ * The Sony Sixaxis does not handle HID Output Reports on the Interrupt EP
+ * like it should according to usbhid/hid-core.c::usbhid_output_raw_report()
+ * so we need to override that forcing HID Output Reports on the Control EP.
+ *
+ * There is also another issue about HID Output Reports via USB, the Sixaxis
+ * does not want the report_id as part of the data packet, so we have to
+ * discard buf[0] when sending the actual control message, even for numbered
+ * reports, humpf!
+ */
static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
size_t count, unsigned char report_type)
{
@@ -55,6 +65,12 @@ static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
int report_id = buf[0];
int ret;
+ if (report_type == HID_OUTPUT_REPORT) {
+ /* Don't send the Report ID */
+ buf++;
+ count--;
+ }
+
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
HID_REQ_SET_REPORT,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
@@ -62,6 +78,10 @@ static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
interface->desc.bInterfaceNumber, buf, count,
USB_CTRL_SET_TIMEOUT);
+ /* Count also the Report ID, in case of an Output report. */
+ if (ret > 0 && report_type == HID_OUTPUT_REPORT)
+ ret++;
+
return ret;
}
--
1.7.4.1
next prev parent reply other threads:[~2011-02-20 17:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-30 13:54 hidp_output_raw_report, HID_OUTPUT_REPORT and Sixaxis Antonio Ospite
2010-11-30 14:06 ` Antonio Ospite
2010-11-30 17:40 ` pascal
2010-12-01 21:06 ` Antonio Ospite
2010-12-01 22:40 ` pascal
2011-02-17 14:19 ` Antonio Ospite
[not found] ` <20110217151931.d7ee7e29.ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.org>
2011-02-18 8:45 ` Jiri Kosina
2011-02-20 17:26 ` [PATCH 0/2] Fix sending Output reports to the Sony Sixaxis Antonio Ospite
2011-02-20 17:26 ` Antonio Ospite [this message]
2011-02-21 12:49 ` [PATCH 1/2] hid-sony.c: Fix sending Output reports to the Sixaxis Jiri Kosina
2011-02-20 17:26 ` [PATCH 2/2] bt hidp: send Output reports using SET_REPORT on the Control channel Antonio Ospite
[not found] ` <1298222806-19433-3-git-send-email-ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.org>
2011-02-21 3:45 ` Alan Ott
2011-02-21 12:50 ` Jiri Kosina
2011-02-21 21:09 ` Gustavo F. Padovan
2011-02-22 10:09 ` Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1298222806-19433-2-git-send-email-ospite@studenti.unina.it \
--to=ospite@studenti.unina.it \
--cc=alan@signal11.us \
--cc=hadess@hadess.net \
--cc=jim@jtan.com \
--cc=jkosina@suse.cz \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=padovan@profusion.mobi \
--cc=pascal@pabr.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).