From: Alan Ott <alan@signal11.us>
To: simon@mungewell.org, linux-usb@vger.kernel.org,
linux-input@vger.kernel.org, Jiri Kosina <jkosina@suse.cz>,
Marcel Holtmann <marcel@holtmann.org>,
Antonio Ospite <ospite@studenti.unina.it>
Subject: Re: Help: Writing to USB feature port from within kernel driver
Date: Sun, 12 Sep 2010 22:41:46 -0400 [thread overview]
Message-ID: <4C8D8F6A.8080406@signal11.us> (raw)
In-Reply-To: <7fcc69ce35dc284d573651e282337a69.squirrel@host171.canaca.com>
On 09/12/2010 07:02 PM, simon@mungewell.org wrote:
> Hi Alan,
> I believe you submitted a patch a couple of months ago
> (https://patchwork.kernel.org/patch/105169/).
>
It's not in the mainline. We are waiting on the bluetooth maintainer
(Marcel Holtmann) to sign off on it.
> It looks like this hasn't been applied to 2.6 mainline yet, and I am
> having problems with trying to write a feature report to set up a device
> in it's driver...
>
>
The gist of the patch is that it adds feature reports to user space, but
this section of the patch:
@@ -807,7 +834,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co
struct usb_host_interface *interface = intf->cur_altsetting;
int ret;
- if (usbhid->urbout) {
+ if (usbhid->urbout&& report_type != HID_FEATURE_REPORT) {
fixes the problem you are describing below, forcing FEATURE reports to
go out on the control endpoint.
> ---------------------------- Original Message ----------------------------
> Subject: Help: Writing to USB feature port from within kernel driver
> From: simon@mungewell.org
> Date: Fri, September 10, 2010 3:23 pm
> To: linux-usb@vger.kernel.org
> --------------------------------------------------------------------------
>
> Hi,
> I'm attempting to write to the feature port of a USB HID device during
> config, however this doesn't seem to be functioning the same as the python
> test code I have.
>
What does this Python test code do and look like? Do you have some kind
of Python wrapper around hiddev or libusb or something?
> From looking at the USBMon output it looks like (although I'm not sure)
> that my kernel code is using an interrupt write ('Io') where as the
> 'working' python code is using a control write ('Co').
>
>
This is a bug, as stated above. Feature reports are always to use the
control endpoint.
I'll get a patch in which fixes this for .35 and .36. In the mean time,
you can just send the report using usb_control_msg(). See
drivers/hid/hid-sony.c for an example. Note that the part which says (3
<< 8) is indicating a FEATURE report (feature = 3 on the USB bus, but
the constant HID_FEATURE_REPORT in the kernel is 2. Don't get tripped up
on that.). That example RECEIVES an input transfer, so you'll have to
modify it slightly to SEND one.
Sorry for the bother. More of my broken code, it seems.
Alan.
next parent reply other threads:[~2010-09-13 2:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <7fcc69ce35dc284d573651e282337a69.squirrel@host171.canaca.com>
2010-09-13 2:41 ` Alan Ott [this message]
2010-09-10 6:47 Help: Writing to USB feature port from within kernel driver simon
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=4C8D8F6A.8080406@signal11.us \
--to=alan@signal11.us \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=ospite@studenti.unina.it \
--cc=simon@mungewell.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).