From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: "David Härdeman" <david@hardeman.nu>
Cc: linux-media@vger.kernel.org, sean@mess.org
Subject: Re: [PATCH 6/6] rc-core: add protocol to EVIOC[GS]KEYCODE_V2 ioctl
Date: Fri, 28 Apr 2017 08:31:33 -0300 [thread overview]
Message-ID: <20170428083133.2e6621bd@vento.lan> (raw)
In-Reply-To: <149332526341.32431.11307248841385136294.stgit@zeus.hardeman.nu>
Em Thu, 27 Apr 2017 22:34:23 +0200
David Härdeman <david@hardeman.nu> escreveu:
> It is currently impossible to distinguish between scancodes which have
> been generated using different protocols (and scancodes can, and will,
> overlap).
>
> For example:
> RC5 message to address 0x00, command 0x03 has scancode 0x00000503
> JVC message to address 0x00, command 0x03 has scancode 0x00000503
>
> It is only possible to distinguish (and parse) scancodes by known the
> scancode *and* the protocol.
>
> Setting and getting keycodes in the input subsystem used to be done via
> the EVIOC[GS]KEYCODE ioctl and "unsigned int[2]" (one int for scancode
> and one for the keycode).
>
> The interface has now been extended to use the EVIOC[GS]KEYCODE_V2 ioctl
> which uses the following struct:
>
> struct input_keymap_entry {
> __u8 flags;
> __u8 len;
> __u16 index;
> __u32 keycode;
> __u8 scancode[32];
> };
>
> (scancode can of course be even bigger, thanks to the len member).
>
> This patch changes how the "input_keymap_entry" struct is interpreted
> by rc-core by casting it to "rc_keymap_entry":
>
> struct rc_scancode {
> __u16 protocol;
> __u16 reserved[3];
> __u64 scancode;
> }
>
> struct rc_keymap_entry {
> __u8 flags;
> __u8 len;
> __u16 index;
> __u32 keycode;
> union {
> struct rc_scancode rc;
> __u8 raw[32];
> };
> };
>
> The u64 scancode member is large enough for all current protocols and it
> would be possible to extend it in the future should it be necessary for
> some exotic protocol.
>
> The main advantage with this change is that the protocol is made explicit,
> which means that we're not throwing away data (the protocol type).
>
> This also means that struct rc_map no longer hardcodes the protocol, meaning
> that keytables with mixed entries are possible.
>
> Heuristics are also added to hopefully do the right thing with older
> ioctls in order to preserve backwards compatibility.
>
> Note that the heuristics are not 100% guaranteed to get things right.
> That is unavoidable since the protocol information simply isn't there
> when userspace calls the previous ioctl() types.
>
> However, that is somewhat mitigated by the fact that the "only"
> userspace binary which might need to change is ir-keytable. Userspace
> programs which simply consume input events (i.e. the vast majority)
> won't have to change.
Nack.
No userspace breakages are allowed. There's no way to warrant that
ir-keytable version is compatible with a certain Kernel version.
Thanks,
Mauro
next prev parent reply other threads:[~2017-04-28 11:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 20:33 [PATCH 0/6] rc-core - protocol in keytables David Härdeman
2017-04-27 20:33 ` [PATCH 1/6] rc-core: fix input repeat handling David Härdeman
2017-04-27 20:34 ` [PATCH 2/6] rc-core: cleanup rc_register_device David Härdeman
2017-05-01 16:49 ` Sean Young
2017-05-01 17:47 ` David Härdeman
2017-05-02 18:53 ` David Härdeman
2017-05-02 20:48 ` Sean Young
2017-05-03 9:49 ` David Härdeman
2017-04-27 20:34 ` [PATCH 3/6] rc-core: cleanup rc_register_device pt2 David Härdeman
2017-04-27 20:34 ` [PATCH 4/6] rc-core: use the full 32 bits for NEC scancodes in wakefilters David Härdeman
2017-04-27 20:34 ` [PATCH 5/6] rc-core: use the full 32 bits for NEC scancodes David Härdeman
2017-04-28 11:58 ` Sean Young
2017-04-28 16:42 ` David Härdeman
2017-04-27 20:34 ` [PATCH 6/6] rc-core: add protocol to EVIOC[GS]KEYCODE_V2 ioctl David Härdeman
2017-04-28 11:31 ` Mauro Carvalho Chehab [this message]
2017-04-28 16:59 ` David Härdeman
2017-04-28 19:42 ` Sean Young
2017-04-29 8:44 ` David Härdeman
2017-06-11 16:17 ` Sean Young
2017-06-17 11:20 ` David Härdeman
2017-04-28 11:40 ` Sean Young
2017-04-28 16:46 ` David Härdeman
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=20170428083133.2e6621bd@vento.lan \
--to=mchehab@s-opensource.com \
--cc=david@hardeman.nu \
--cc=linux-media@vger.kernel.org \
--cc=sean@mess.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