From: Marcel Holtmann <marcel@holtmann.org>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Alan Ott <alan@signal11.us>, David S Miller <davem@davemloft.net>,
Michael Poole <mdpoole@troilus.org>,
Bastien Nocera <hadess@hadess.net>,
Eric Dumazet <eric.dumazet@gmail.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH 1/1] Bluetooth: hidp: Add support for hidraw HIDIOCGFEATURE and HIDIOCSFEATURE
Date: Thu, 22 Jul 2010 08:21:55 -0700 [thread overview]
Message-ID: <1279812115.2621.6.camel@localhost.localdomain> (raw)
In-Reply-To: <alpine.LNX.2.00.1007221612450.4741@pobox.suse.cz>
Hi Jiri,
> > > >>> what is usb-hid.ko doing here? I would expect a bunch of code
> > > >>> duplication with minor difference between USB and Bluetooth.
> > > >>>
> > > >> usbhid doesn't have a lot of code for hidraw. Two functions are involved:
> > > >> usbhid_output_raw_report()
> > > >> - calls usb_control_msg() with Get_Report
> > > >> usbhid_get_raw_report()
> > > >> - calls usb_control_msg() with Set_Report
> > > >> OR
> > > >> - calls usb_interrupt_msg() on the Ouput pipe.
> > > >>
> > > >> This is of course easier than bluetooth because usb_control_msg() is
> > > >> synchronous, even when requesting reports, mostly because of the nature
> > > >> of USB, where the request and response are part of the same transfer.
> > > >>
> > > >> For Bluetooth, it's a bit more complicated since the kernel treats it
> > > >> more like a networking interface (and indeed it is). My understanding is
> > > >> that to make a synchronous transfer in bluetooth, one must:
> > > >> - send the request packet
> > > >> - block (wait_event_*())
> > > >> - when the response is received in the input handler, wake_up_*().
> > > >>
> > > >> There's not really any code duplication, mostly because initiating
> > > >> synchronous USB transfers (input and output) is easy (because of the
> > > >> usb_*_msg() functions), while making synchronous Bluetooth transfers
> > > >> must be done manually. If there's a nice, convenient, synchronous
> > > >> function in Bluetooth similar to usb_control_msg() that I've missed,
> > > >> then let me know, as it would simplify this whole thing.
> > > >>
> > > > there is not and I don't think we ever get one. My question here was
> > > > more in the direction why HID core is doing these synchronously in the
> > > > first place. Especially since USB can do everything async as well.
> > >
> > > I'm open to suggestions. The way I see it is from a user space
> > > perspective. With Get_Feature being on an ioctl(), I don't see any clean
> > > way to do it other than synchronously. Other operating systems (I can
> > > say for sure Windows, Mac OS X, and FreeBSD) handle Get/Set Feature the
> > > same way (synchronously) from user space.
> > >
> > > You seem to be proposing an asynchronous interface. What would that look
> > > like from user space?
> >
> > not necessarily from user space, but at least from HID core to HIDP and
> > usb-hid transports. At least that is what I would expect, Jiri?
>
> Sorry for this taking too long (vacations, conferences, you name it) for
> me to respond.
>
> As all the _raw() callbacks are purely intended for userspace interaction
> anyway, it's perfectly fine (and in fact desirable) for the low-level
> transport drivers to perform these operations synchronously (and that's
> what USB implementation does as well).
>
> Marcel, if your opposition to synchronous interface is strong, we'll have
> to think about other aproaches, but from my POV, the patch is fine as-is
> for Bluetooth.
that the ioctl() API is synchronous is fine to me, however pushing that
down to the transport drivers seems wrong to me. I think the HID core
should be able to handle a fully asynchronous transport driver. I know
that with the USB subsystem you are little bit spoiled here, but for
Bluetooth it is not the case. And in the end even using the asynchronous
USB URB calls would be nice as well.
So why not make the core actually wait for responses from the transport
driver. I would make the transport drivers a lot simpler in the long
run. And I know that most likely besides Bluetooth and USB you won't see
another, but you never know.
Regards
Marcel
next prev parent reply other threads:[~2010-07-22 15:22 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1276467601-9066-1-git-send-email-alan@signal11.us>
2010-06-19 17:49 ` [PATCH 1/1] Bluetooth: hidp: Add support for hidraw HIDIOCGFEATURE and HIDIOCSFEATURE Jiri Kosina
2010-06-28 11:14 ` Antonio Ospite
[not found] ` <20100628131437.bde782b6.ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.org>
2010-06-29 7:12 ` David Miller
2010-06-29 8:50 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1006291047560.13809-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2010-06-29 9:07 ` Johan Hedberg
[not found] ` <20100629.001216.91341775.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-06-29 12:40 ` Andrei Emeltchenko
2010-07-08 21:08 ` Marcel Holtmann
2010-07-08 21:11 ` Marcel Holtmann
[not found] ` <1278623485.10421.73.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-07-09 3:51 ` Alan Ott
2010-07-09 8:01 ` Marcel Holtmann
[not found] ` <1278662497.10421.94.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-07-09 13:02 ` Alan Ott
[not found] ` <4C371DE8.9020002-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-07-09 13:06 ` Marcel Holtmann
[not found] ` <1278680790.10421.106.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-07-09 14:06 ` Alan Ott
[not found] ` <4C372CEE.3070109-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-07-09 17:33 ` Marcel Holtmann
[not found] ` <1278696815.10421.137.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-07-09 18:24 ` Alan Ott
2010-07-22 14:14 ` Jiri Kosina
2010-07-22 15:21 ` Marcel Holtmann [this message]
2010-07-22 16:58 ` Alan Ott
[not found] ` <4C4878C2.9000903-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-08-10 11:46 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1008101344480.29919-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2010-08-10 12:12 ` Marcel Holtmann
2010-08-16 20:20 ` [PATCH v4 0/2] Get and Set Feature Reports on HIDRAW (USB and Bluetooth) Alan Ott
2010-08-16 20:20 ` [PATCH v4 1/2] HID: Add Support for Setting and Getting Feature Reports from hidraw Alan Ott
2010-09-28 13:30 ` Antonio Ospite
[not found] ` <20100928153011.32750e5d.ospite-aNJ+ML1ZbiP93QAQaVx+gl6hYfS7NtTn@public.gmane.org>
2010-10-01 13:30 ` Jiri Kosina
2010-08-16 20:20 ` [PATCH v4 2/2] Bluetooth: hidp: Add support for hidraw HIDIOCGFEATURE and HIDIOCSFEATURE Alan Ott
[not found] ` <1281990059-3562-1-git-send-email-alan@signal11.us>
2010-08-23 13:00 ` [PATCH v4 0/2] Get and Set Feature Reports on HIDRAW (USB and Bluetooth) Jiri Kosina
2010-09-02 15:25 ` Jiri Kosina
2010-09-22 12:09 ` Jiri Kosina
2010-11-01 19:23 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1011011523150.15851-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2010-11-08 11:17 ` Antonio Ospite
[not found] ` <1281990059-3562-1-git-send-email-alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-09-23 16:25 ` Ville Tervo
2010-09-23 17:07 ` Ping Cheng
[not found] ` <AANLkTinJXYbZh_MvG81iJMu84LKBOKL3s-Gbfe77Vq7q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-23 20:16 ` Przemo Firszt
2010-09-23 23:40 ` Alan Ott
[not found] ` <1281990059-3562-3-git-send-email-alan@signal11.us>
[not found] ` <1281990059-3562-3-git-send-email-alan-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>
2010-09-23 11:51 ` [PATCH v4 2/2] Bluetooth: hidp: Add support for hidraw HIDIOCGFEATURE and HIDIOCSFEATURE Ville Tervo
2010-09-23 14:16 ` Alan Ott
2010-09-24 10:47 ` Antonio Ospite
2010-06-13 22:20 [PATCH 1/1] " Alan Ott
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=1279812115.2621.6.camel@localhost.localdomain \
--to=marcel@holtmann.org \
--cc=alan@signal11.us \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=hadess@hadess.net \
--cc=jkosina@suse.cz \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdpoole@troilus.org \
--cc=netdev@vger.kernel.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).