From: Mauro Carvalho Chehab <maurochehab@gmail.com>
To: "David Härdeman" <david@hardeman.nu>
Cc: Malcolm Priestley <tvboxspy@gmail.com>, linux-media@vger.kernel.org
Subject: Re: [PATCH 00/10] rc-core: my current patchqueue
Date: Wed, 04 May 2011 12:13:49 -0300 [thread overview]
Message-ID: <4DC16D2D.2080205@gmail.com> (raw)
In-Reply-To: <fb1dfe1e7035bbcf648a4bf908a7d1a4@hardeman.nu>
Em 29-04-2011 05:08, David Härdeman escreveu:
> On Thu, 28 Apr 2011 21:13:22 +0100, Malcolm Priestley <tvboxspy@gmail.com>
> wrote:
>> On Thu, 2011-04-28 at 17:13 +0200, David Härdeman wrote:
>>> The following series is what's in my current patch queue for rc-core.
>>>
>>> It only been lightly tested so far and it's based on the "for_v2.6.39"
>>> branch,
>>> but I still wanted to send it to the list so that I can get some
>>> feedback while
>>> I refresh the patches to "for_v2.6.40" and do more testing.
>>
>> Patch [06/10] hasn't made it to gmane or spinics servers.
>
> Looking through the postfix logs, vger.kernel.org did accept the mail. My
> guess is that it wasn't distributed (or indexed) because of its size.
>
> I've put patch 6/10 at http://david.hardeman.nu/rc-proto.patch for now,
> and I've included the patch description inline below:
Big patches like that makes harder to comment. So, I'll just get one small
piece of the patch to add my comments.
> 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) and that
> it'll be easier to support multiple protocols with one decoder (think rc5
> and rc5-streamzap).
>
> Further down the road we should also have a way to report the protocol of
> a received keypress to userspace.
>
> Signed-off-by: David Härdeman <david@hardeman.nu>
<snip/>
>- rc_keydown(d->rc_dev, priv->rc_keycode, 0);
>+ rc_keydown(d->rc_dev, RC_TYPE_NEC, priv->rc_keycode, 0);
I'm OK with a change like the above, as it allows having some sort of input raw event
to describe the protocol type, helping, for example, to have an userspace program that
will help people to create keytable maps.
<snip/>
> diff --git a/drivers/media/rc/keymaps/rc-videomate-s350.c b/drivers/media/rc/keymaps/rc-videomate-s350.c
> index 26ca260..2f0ec1f 100644
> --- a/drivers/media/rc/keymaps/rc-videomate-s350.c
> +++ b/drivers/media/rc/keymaps/rc-videomate-s350.c
> @@ -13,57 +13,56 @@
> #include <media/rc-map.h>
>
> static struct rc_map_table videomate_s350[] = {
> - { 0x00, KEY_TV},
> - { 0x01, KEY_DVD},
> - { 0x04, KEY_RECORD},
> - { 0x05, KEY_VIDEO}, /* TV/Video */
> - { 0x07, KEY_STOP},
> - { 0x08, KEY_PLAYPAUSE},
> - { 0x0a, KEY_REWIND},
> - { 0x0f, KEY_FASTFORWARD},
> - { 0x10, KEY_CHANNELUP},
> - { 0x12, KEY_VOLUMEUP},
> - { 0x13, KEY_CHANNELDOWN},
> - { 0x14, KEY_MUTE},
> - { 0x15, KEY_VOLUMEDOWN},
> - { 0x16, KEY_1},
> - { 0x17, KEY_2},
> - { 0x18, KEY_3},
> - { 0x19, KEY_4},
> - { 0x1a, KEY_5},
> - { 0x1b, KEY_6},
> - { 0x1c, KEY_7},
> - { 0x1d, KEY_8},
> - { 0x1e, KEY_9},
> - { 0x1f, KEY_0},
> - { 0x21, KEY_SLEEP},
> - { 0x24, KEY_ZOOM},
> - { 0x25, KEY_LAST}, /* Recall */
> - { 0x26, KEY_SUBTITLE}, /* CC */
> - { 0x27, KEY_LANGUAGE}, /* MTS */
> - { 0x29, KEY_CHANNEL}, /* SURF */
> - { 0x2b, KEY_A},
> - { 0x2c, KEY_B},
> - { 0x2f, KEY_CAMERA}, /* Snapshot */
> - { 0x23, KEY_RADIO},
> - { 0x02, KEY_PREVIOUSSONG},
> - { 0x06, KEY_NEXTSONG},
> - { 0x03, KEY_EPG},
> - { 0x09, KEY_SETUP},
> - { 0x22, KEY_BACKSPACE},
> - { 0x0c, KEY_UP},
> - { 0x0e, KEY_DOWN},
> - { 0x0b, KEY_LEFT},
> - { 0x0d, KEY_RIGHT},
> - { 0x11, KEY_ENTER},
> - { 0x20, KEY_TEXT},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x00), KEY_TV},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x01), KEY_DVD},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x04), KEY_RECORD},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x05), KEY_VIDEO}, /* TV/Video */
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x07), KEY_STOP},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x08), KEY_PLAYPAUSE},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0a), KEY_REWIND},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0f), KEY_FASTFORWARD},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x10), KEY_CHANNELUP},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x12), KEY_VOLUMEUP},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x13), KEY_CHANNELDOWN},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x14), KEY_MUTE},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x15), KEY_VOLUMEDOWN},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x16), KEY_1},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x17), KEY_2},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x18), KEY_3},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x19), KEY_4},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x1a), KEY_5},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x1b), KEY_6},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x1c), KEY_7},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x1d), KEY_8},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x1e), KEY_9},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x1f), KEY_0},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x21), KEY_SLEEP},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x24), KEY_ZOOM},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x25), KEY_LAST}, /* Recall */
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x26), KEY_SUBTITLE}, /* CC */
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x27), KEY_LANGUAGE}, /* MTS */
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x29), KEY_CHANNEL}, /* SURF */
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x2b), KEY_A},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x2c), KEY_B},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x2f), KEY_CAMERA}, /* Snapshot */
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x23), KEY_RADIO},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x02), KEY_PREVIOUSSONG},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x06), KEY_NEXTSONG},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x03), KEY_EPG},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x09), KEY_SETUP},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x22), KEY_BACKSPACE},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0c), KEY_UP},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0e), KEY_DOWN},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0b), KEY_LEFT},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x0d), KEY_RIGHT},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x11), KEY_ENTER},
> + { RC_TYPE_UNKNOWN, RC_SCANCODE_UNKNOWN(0x20), KEY_TEXT},
> };
However, changes like the above makes the keymaps confusing and breaks the
v4l-utils sync scripts without a good reason.
A keymap maps one remote. All keys have the same protocol, so it doesn't make
sense to mix the RC_TYPEs inside each key definition.
Before you answer tha above, you may be thinking on showing some some special
remote type that might have more than one protocol. If this ever happens,
just create two keymap tables for it. I'm sure that 99% of the remotes
just use one protocol (except, of course, for Universal remotes,
but no default keymap table covers this case).
Mauro.
next prev parent reply other threads:[~2011-05-04 15:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 15:13 [PATCH 00/10] rc-core: my current patchqueue David Härdeman
2011-04-28 15:13 ` [PATCH 01/10] rc-core: int to bool conversion for winbond-cir David Härdeman
2011-04-28 15:13 ` [PATCH 02/10] rc-core: add TX support to the winbond-cir driver David Härdeman
2011-04-28 15:13 ` [PATCH 03/10] rc-core: use ir_raw_event_store_with_filter in winbond-cir David Härdeman
2011-04-28 15:13 ` [PATCH 04/10] rc-core: add trailing silence in rc-loopback tx David Härdeman
2011-04-28 15:13 ` [PATCH 05/10] rc-core: add separate defines for protocol bitmaps and numbers David Härdeman
2011-05-04 14:56 ` Mauro Carvalho Chehab
2011-05-06 12:23 ` David Härdeman
2011-04-28 15:13 ` [PATCH 07/10] rc-core: use the full 32 bits for NEC scancodes David Härdeman
2011-05-04 15:16 ` Mauro Carvalho Chehab
2011-05-06 9:58 ` David Härdeman
2011-04-28 15:13 ` [PATCH 08/10] rc-core: merge rc5 and streamzap decoders David Härdeman
2011-05-04 15:19 ` Mauro Carvalho Chehab
2011-05-06 11:33 ` David Härdeman
2011-04-28 15:13 ` [PATCH 09/10] rc-core: lirc use unsigned int David Härdeman
2011-05-04 15:23 ` Mauro Carvalho Chehab
2011-05-06 9:46 ` David Härdeman
2011-06-11 12:16 ` Mauro Carvalho Chehab
2011-04-28 15:14 ` [PATCH 10/10] rc-core: move timeout and checks to lirc David Härdeman
2011-09-21 16:40 ` Mauro Carvalho Chehab
2011-04-28 20:13 ` [PATCH 00/10] rc-core: my current patchqueue Malcolm Priestley
2011-04-29 8:08 ` David Härdeman
2011-05-04 15:13 ` Mauro Carvalho Chehab [this message]
2011-05-06 10:06 ` David Härdeman
2011-05-02 17:58 ` Mauro Carvalho Chehab
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=4DC16D2D.2080205@gmail.com \
--to=maurochehab@gmail.com \
--cc=david@hardeman.nu \
--cc=linux-media@vger.kernel.org \
--cc=tvboxspy@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.