From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: Peter Hutterer <peter.hutterer@who-t.net>,
Benjamin Tissoires <benjamin.tissoires@gmail.com>,
"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
Dmitry Torokhov <dtor@google.com>
Subject: Re: [RFC RESEND 5/5] Input: evdev - add new EVIOCGABSRANGE ioctl
Date: Fri, 8 Aug 2014 10:47:42 -0700 [thread overview]
Message-ID: <20140808174742.GG26820@core.coreip.homeip.net> (raw)
In-Reply-To: <CANq1E4QB3wiHRTjb_4xmVvXwOZvdpOQR9nZtnaZt=k2GaLJAmw@mail.gmail.com>
On Fri, Aug 08, 2014 at 03:26:56PM +0200, David Herrmann wrote:
> Hi
>
> On Wed, Aug 6, 2014 at 3:35 AM, Peter Hutterer <peter.hutterer@who-t.net> wrote:
> >> +
> >> +/**
> >> + * EVIOCGABSRANGE - Fetch range of ABS values
> >> + *
> >> + * This fetches the current values of a range of ABS codes atomically. The range
> >> + * of codes to fetch and the buffer-types are passed as "struct input_absrange",
> >> + * which has the following fields:
> >> + * slots: Number of MT slots to fetch data for.
> >> + * code: First ABS axis to query.
> >> + * count: Number of ABS axes to query starting at @code.
> >> + * buffer: Pointer to a receive buffer where to store the fetched ABS
> >> + * values. This buffer must be an array of __s32 with at least
> >> + * (@slots * @code) elements. The buffer is interpreted as two
> >> + * dimensional __s32 array, declared as: __s32[slots][codes]
> >
> > tbh this seems more complicated than necessary. Have you thought about
> > just dumping the events into the client buffer as if they came fresh in from
> > the device? So to sync, the client calls the ioctl with a buffer and a
> > buffer size, and the kernel simply writes a series of struct input_events
> > into that buffer, with ABS_MT_SLOT as required for all slots, (optionally?)
> > followed by a SYN_DROPPED. So the buffer afterwards could look like this:
> > EV_ABS ABS_X 30
> > EV_ABS ABS_X 1202
> > EV_ABS ABS_MT_SLOT 0
> > EV_ABS ABS_MT_POSITION_X 30
> > EV_ABS ABS_MT_POSITION_Y 1202
> > EV_ABS ABS_MT_SLOT 1
> > EV_ABS ABS_MT_POSITION_X 80
> > EV_ABS ABS_MT_POSITION_Y 1800
> > EV_SYN SYN_REPORT 0
> >
> > the client can then go through and just process the events on-by-one as it
> > would otherwise with real events.
> >
> > This approach could be even extended to include EV_KEY, etc. providing a
> > single ioctl to sync the whole state of the device atomically.
> >
> > comments?
I like it.
>
> So you mean instead of passing a __32 array we pass a "struct
> input_event" array and write it there? So bypassing the receive-queue?
> That does sound quite nice, indeed. We could replace all the other
> "sync" ioctls and just provide a way to receive all the events
> directly.
>
> Something like:
>
> EVIOCQUERY(struct input_query)
>
> struct input_query {
> __u16 type;
> __u16 start_code;
> __u16 end_code;
> __u16 slots;
>
> struct input_event buffer[];
> };
No, it is more like EVIOCRESYNC(void) which makes input core to dump all
existing state into the client's standard event queue so that here is no
need to reconcile/reconstruct anything. We could give a new SYN marker
to indicate end-of-state boundary.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2014-08-08 17:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-19 13:10 [PATCH RESEND 0/5] Evdev Extensions David Herrmann
2014-07-19 13:10 ` [PATCH RESEND 1/5] Input: evdev - add event-mask API David Herrmann
2014-07-19 13:10 ` [PATCH RESEND 2/5] Input: uinput - uinput_validate_absbits() cleanup David Herrmann
2014-07-21 0:34 ` Dmitry Torokhov
2014-07-19 13:10 ` [PATCH RESEND 3/5] Input: uinput - add UI_GET_VERSION ioctl David Herrmann
2014-07-21 0:34 ` Dmitry Torokhov
2014-07-19 13:10 ` [PATCH RESEND 4/5] Input: uinput - add new UINPUT_DEV_SETUP ioctl David Herrmann
2014-07-21 1:01 ` Dmitry Torokhov
2014-07-21 6:22 ` David Herrmann
2014-07-21 20:11 ` Dmitry Torokhov
2014-07-21 21:08 ` David Herrmann
2014-07-19 13:10 ` [RFC RESEND 5/5] Input: evdev - add new EVIOCGABSRANGE ioctl David Herrmann
2014-08-06 1:35 ` Peter Hutterer
2014-08-08 13:26 ` David Herrmann
2014-08-08 17:47 ` Dmitry Torokhov [this message]
2014-08-10 15:21 ` David Herrmann
2014-08-10 23:17 ` Peter Hutterer
2014-08-11 0:01 ` Dmitry Torokhov
2014-08-11 2:13 ` Peter Hutterer
2014-08-11 10:02 ` David Herrmann
2014-08-11 10:00 ` David Herrmann
2014-07-21 0:37 ` [PATCH RESEND 0/5] Evdev Extensions Dmitry Torokhov
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=20140808174742.GG26820@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=benjamin.tissoires@gmail.com \
--cc=dh.herrmann@gmail.com \
--cc=dtor@google.com \
--cc=linux-input@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
/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).