linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC v2 0/1] User-space HID I/O Driver
@ 2012-03-26 20:20 David Herrmann
  2012-03-26 20:20 ` [RFC v2 1/1] HID: User-space I/O driver support for HID subsystem David Herrmann
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: David Herrmann @ 2012-03-26 20:20 UTC (permalink / raw)
  To: linux-input
  Cc: jkosina, chen.ganir, claudio.takahasi, jprvita, linux-bluetooth,
	anderson.lizardo, marcel, David Herrmann

Hi

This is the second revision of the UHID driver. It basically allows to register
hid_ll_drivers in user-space. This is needed to implement Bluetooth HoG (HID
over GATT) as discussed earlier.

Changes:
 - Improved documentation
 - Added example which emulates a 3-button mouse with wheel in user-space
 - Fixed some remaining bugs

I didn't change any major parts. I checked that writev/readv work correctly and
I documented how to use it in ./Documentation/hid/uhid.txt.

For a full example please see ./samples/uhid/uhid-example.c.

While developing it I also considered moving HIDP to user-space. If we do BT-HoG
in user-space, it should be easier to also move HIDP to user-space. The current
in-kernel HIDP is buggy, anyway.

Still open points:
 - How do I get a proper "parent" pointer for uhid->hid->dev.parent? I could use
   the uhid misc device as parent or is there some device-struct inside "struct
   file"?
 - Should user-space be able to provide "uniq" and "phys" names for HID-devices?
 - uhid_event is quite big (>4KB) which makes uhid_device really big (~70KB).
   Should I allocate the ring-buffer dynamically to avoid this?
 - Should I provide the quirks field to user-space? Probably as part of
   UHID_START?
 - Could someone review x32 COMPAT stuff? I tried to align all the public
   structures correctly so I could even remove the __packed attribute. Anyway, I
   thought keeping it is probably better for future extensions.

I spent some time on the locks and they seem all fine. I couldn't find any
races.

Jiri, Marcel, could you review the design and tell me what you think?

A short notice about the protocol:
User-space is allowed to send only as much data as is needed for the event. That
is, when sending the UHID_DESTROY event (which has no payload) it would be
actually enough to only send a __u32 field (ev->type) with write().
This is not to speed up the write()s or read()s but rather to allow extending
the uhid_event structure in the future. We can actually add arbitrary extra
event-types and still keep ABI compatibility. Therefore, I thought of adding an
"uhid_version" field to UHID_CREATE so user-space can define what UHID protocol
it is using.

Regards
David

David Herrmann (1):
  HID: User-space I/O driver support for HID subsystem

 Documentation/hid/uhid.txt  |  152 ++++++++++++++
 drivers/hid/Kconfig         |   21 ++
 drivers/hid/Makefile        |    2 +-
 drivers/hid/uhid.c          |  473 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/Kbuild        |    1 +
 include/linux/uhid.h        |   84 ++++++++
 samples/uhid/Makefile       |   10 +
 samples/uhid/uhid-example.c |  381 ++++++++++++++++++++++++++++++++++
 8 files changed, 1123 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/hid/uhid.txt
 create mode 100644 drivers/hid/uhid.c
 create mode 100644 include/linux/uhid.h
 create mode 100644 samples/uhid/Makefile
 create mode 100644 samples/uhid/uhid-example.c

-- 
1.7.9.4


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-04-26 18:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-26 20:20 [RFC v2 0/1] User-space HID I/O Driver David Herrmann
2012-03-26 20:20 ` [RFC v2 1/1] HID: User-space I/O driver support for HID subsystem David Herrmann
2012-03-27 19:13   ` Marcel Holtmann
2012-03-27 21:51     ` David Herrmann
     [not found]       ` <CANq1E4TnjzNG4sT_qt5qmrYMHp39HAJUcG1D4w=kcWoBkrThqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-27 22:22         ` Marcel Holtmann
2012-03-28 11:15       ` Nicolas Pouillon
2012-03-29 12:28         ` David Herrmann
2012-03-27 18:43 ` [RFC v2 0/1] User-space HID I/O Driver Joao Paulo Rechi Vita
2012-04-03 17:55   ` Joao Paulo Rechi Vita
     [not found]     ` <CAAngNMaOHRRfTy5yT9ys0Cv5yB5t-zEVxwcZWuK64BEA4oRy2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-03 22:14       ` Jiri Kosina
2012-04-04 22:59         ` Joao Paulo Rechi Vita
     [not found]           ` <CAAngNMYx4YcC8kEuZkEgojbFLf7BtchTCEDs927P+oqfr_oKnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-26 17:22             ` Claudio Takahasi
2012-04-26 17:54               ` David Herrmann
2012-04-26 18:19                 ` Joao Paulo Rechi Vita
     [not found] ` <1332793209-2950-1-git-send-email-dh.herrmann-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-03-28 10:50   ` Jiri Kosina

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).