From: Bastien Nocera <hadess@hadess.net>
To: Michael Poole <mdpoole@troilus.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Jiri Kosina <jkosina@suse.cz>, "Gunn, Brian" <bgunn@solekai.com>,
Ping <pinglinux@gmail.com>,
linux-kernel@vger.kernel.org,
BlueZ development <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH 0/3] HID: make raw output callback more flexible
Date: Wed, 03 Feb 2010 09:47:20 +0000 [thread overview]
Message-ID: <1265190440.32444.8417.camel@localhost.localdomain> (raw)
In-Reply-To: <87bpg7glf7.fsf@troilus.org>
On Tue, 2010-02-02 at 20:25 -0500, Michael Poole wrote:
> Bastien Nocera writes:
>
> > On Fri, 2010-01-29 at 19:46 -0500, Michael Poole wrote:
> >> > [1]: Comments on the patch at
> >> > http://thread.gmane.org/gmane.linux.bluez.kernel/4279 would be
> >> > appreciated
> >>
> >> This patch does not work for me. Before, the first time after each
> >> boot
> >> that I tried to connect to an Apple Magic Mouse, it failed with -14
> >> (EFAULT). With this patch, it fails with -22 (EINVAL) instead. The
> >> -EFAULT *was* due to hidp_parse()'s copy_from_user(). I have not
> >> looked
> >> yet to see where the -EINVAL is coming from -- would that help? (Both
> >> with and without your patch, the second attempt to connect works.)
> >
> > I don't get -EFAULT anymore (it was failing to copy the rd_data from
> > user-space), but I do get -EINVALs now. I haven't investigated it
> > though. My guess is that the hid parser fails.
> >
> > Could you compare the sizes of the data gathered in user-space?
>
> The bug mysteriously disappeared when I tried to apply kgdb to the
> problem. Your patch won't do the trick because the hidp_connadd_req
> structure has also gone out of scope by the time the hid-(whatever)
> probe function is called. The ioctl has returned to the user, but the
> new hid-(whatever) module is not yet loaded.
Right. I knew that rd_data would already be out of scope, didn't think
about the hidp_connadd_req structure itself.
I guess we should make a copy of the rd_data/rd_size in hidp_setup_hid()
instead.
> That is, the sequence looks like this:
>
> - Application triggers hidp_sock_ioctl(socket, HIDPCONNADD, &connadd).
> - This starts the connection, and returns 0...
> - ... but also indicates that some other module needs to be loaded.
>
> - User-space loads the appropriate module does init_module()...
> - which calls the module_init() function...
> - which calls hid_register_driver()...
> - which eventually attaches the new driver to the device...
> - triggering the module's probe() function to call hid_parse()...
> - hid_parse() fails because its hidp_connadd_req is gone.
>
> Marcel, I think this is a case where the subsystem maintainer should
> make the call on how to fix it. I can write and locally test a patch,
> but I don't want to assume that (for example) the desired solution is to
> keep a copy of the Report descriptor in the hidp_session.
I would think it would be the cleanest way to do it. Quite a few members
of the hidp_connadd_req structure are already copied into the session in
hidp_setup_hid().
> The USB HID
> core sends a GET_DESCRIPTOR request for the Report descriptor, which
> isn't practical here because that descriptor is only available through
> SDP.
And we only do SDP queries in user-space...
If you're not going to work on it shortly, I can take a look at cooking
a patch by the end of the week. Otherwise, I'd be happy testing your
patches.
Cheers
next prev parent reply other threads:[~2010-02-03 9:47 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 14:20 [PATCH 0/3] HID: make raw output callback more flexible Jiri Kosina
2010-01-29 14:20 ` [PATCH 1/3] HID: make raw reports possible for both feature and output reports Jiri Kosina
2010-01-29 14:20 ` [PATCH 2/3] HID: Implement Wacom quirk in the kernel Jiri Kosina
2010-01-29 17:14 ` Ping Cheng
2010-02-03 14:50 ` Jiri Kosina
2010-01-29 14:21 ` [PATCH 3/3] HID: Enable Sixaxis controller over Bluetooth Jiri Kosina
2010-01-29 16:39 ` [PATCH 0/3] HID: make raw output callback more flexible Bastien Nocera
2010-01-30 0:46 ` Michael Poole
2010-01-30 14:11 ` Bastien Nocera
2010-01-31 3:27 ` Michael Poole
2010-02-03 1:25 ` Michael Poole
2010-02-03 9:47 ` Bastien Nocera [this message]
[not found] ` <alpine.LNX.2.00.1002031202040.15395@pobox.suse.cz>
2010-02-03 12:48 ` Jiri Kosina
2010-02-03 12:49 ` [PATCH 1/3] HID: make raw reports possible for both feature and output reports Jiri Kosina
2010-02-03 14:14 ` Marcel Holtmann
2010-02-03 14:37 ` Jiri Kosina
2010-02-03 12:49 ` [PATCH 2/3] HID: Implement Wacom quirk in the kernel Jiri Kosina
2010-02-03 14:19 ` Marcel Holtmann
2010-02-03 14:40 ` Jiri Kosina
2010-02-03 12:50 ` [PATCH 3/3] HID: Enable Sixaxis controller over Bluetooth Jiri Kosina
2010-02-03 14:17 ` Marcel Holtmann
2010-02-03 14:42 ` Jiri Kosina
2010-02-04 12:26 ` [PATCH] Bluetooth: Keep a copy of each HID device's report descriptor Michael Poole
2010-02-04 14:23 ` Marcel Holtmann
2010-02-05 17:23 ` Michael Poole
2010-02-05 17:51 ` Marcel Holtmann
2010-02-09 2:06 ` Ed Tomlinson
2010-02-09 7:22 ` Justin Mattock
2010-02-09 10:14 ` Bastien Nocera
2010-02-09 12:36 ` Ed Tomlinson
2010-02-09 12:40 ` Jiri Kosina
2010-02-09 13:10 ` [PATCH 0/2] Provide a driver for the Apple Magic Mouse Michael Poole
2010-02-09 13:11 ` [PATCH 1/2] " Michael Poole
2010-02-09 13:13 ` [PATCH 2/2] Add a device " Michael Poole
2010-02-10 13:06 ` Jiri Kosina
2010-02-10 13:58 ` Jiri Kosina
2010-02-10 18:20 ` Dmitry Torokhov
2010-02-10 20:31 ` Michael Poole
2010-02-11 5:32 ` [PATCH] hid-magicmouse: Coding style and probe failure fixes Michael Poole
2010-02-11 6:55 ` Dmitry Torokhov
2010-02-11 10:26 ` Jiri Kosina
2010-02-11 23:10 ` Michael Poole
2010-02-11 3:05 ` [PATCH 2/2] Add a device driver for the Apple Magic Mouse Ed Tomlinson
2010-02-11 3:20 ` Michael Poole
2010-02-11 12:51 ` [PATCH 2/2] Add a device driver for the Apple Magic Mouse (2.6.32.8) Ed Tomlinson
2010-02-09 21:37 ` [PATCH 0/2] Provide a driver for the Apple Magic Mouse Justin P. Mattock
2010-02-10 13:57 ` Jiri Kosina
2010-02-13 19:29 ` [PATCH 0/2] Provide a driver for the Apple Magic Mouse - opps Ed Tomlinson
2010-02-14 8:03 ` Dmitry Torokhov
2010-02-14 14:22 ` Ed Tomlinson
2010-02-15 7:11 ` Dmitry Torokhov
2010-02-15 12:42 ` Ed Tomlinson
2010-02-15 12:44 ` Ed Tomlinson
2010-02-16 12:57 ` Jiri Kosina
2010-02-16 12:34 ` Ed Tomlinson
2010-02-16 12:55 ` Jiri Kosina
2010-02-14 22:24 ` [PATCH 1/1] Enable xy scrolling for Apple Magic Mouse Ed Tomlinson
2010-02-14 22:51 ` Michael Poole
2010-02-14 23:58 ` Ed Tomlinson
2010-02-15 7:18 ` Dmitry Torokhov
2010-02-15 12:50 ` Ed Tomlinson
2010-02-15 0:18 ` Ed Tomlinson
2010-02-09 15:03 ` [PATCH] Bluetooth: Keep a copy of each HID device's report descriptor Justin P. Mattock
2010-02-05 12:49 ` Bastien Nocera
2010-02-05 13:27 ` Marcel Holtmann
2010-01-30 14:13 ` [PATCH 0/3] HID: make raw output callback more flexible Marcel Holtmann
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=1265190440.32444.8417.camel@localhost.localdomain \
--to=hadess@hadess.net \
--cc=bgunn@solekai.com \
--cc=jkosina@suse.cz \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=mdpoole@troilus.org \
--cc=pinglinux@gmail.com \
/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).