* Re: [RFC] Infrared Keycode standardization
@ 2009-08-27 22:06 ` Devin Heitmueller
0 siblings, 0 replies; 39+ messages in thread
From: Devin Heitmueller @ 2009-08-27 22:06 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Ville Syrjälä, Linux Media Mailing List, Linux Input
On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
Chehab<mchehab@infradead.org> wrote:
> Em Thu, 27 Aug 2009 21:36:36 +0300
> Ville Syrjälä <syrjala@sci.fi> escreveu:
>
>
>> I welcome this effort. It would be nice to have some kind of consistent
>> behaviour between devices. But just limiting the effort to IR devices
>> doesn't make sense. It shouldn't matter how the device is connected.
>
> Agreed.
>
>>
>> FASTWORWARD,REWIND,FORWARD and BACK aren't very clear. To me it would
>> make most sense if FASTFORWARD and REWIND were paired and FORWARD and
>> BACK were paired. I actually have those two a bit confused in
>> ati_remote2 too where I used FASTFORWARD and BACK. I suppose it should
>> be REWIND instead.
>
> Makes sense. I updated it at the wiki. I also tried to group the keycodes by
> function there.
>
>> Also I should probably use ZOOM for the maximize/restore button (it's
>> FRONT now), and maybe SETUP instead of ENTER for another. It has a
>> picture of a checkbox, Windows software apparently shows a setup menu
>> when it's pressed.
>>
>> There are also a couple of buttons where no keycode really seems to
>> match. One is the mouse button drag. I suppose I could implement the
>> drag lock feature in the driver but I'm not sure if that's a good idea.
>> It would make that button special and unmappable. Currently I have that
>> mapped to EDIT IIRC.
>
> I'm not sure what we should do with those buttons.
>
> Probably, the most complete IR spec is the RC5 codes:
> http://c6000.spectrumdigital.com/davincievm/revf/files/msp430/rc5_codes.pdf
> (not sure if this table is complete or accurate, but on a search I did
> today, this is the one that gave me a better documentation)
>
> I suspect that, after solving the most used cases, we'll need to take a better look on it,
> identifying the missing cases of the real implementations and add them to input.h.
>
>> The other oddball button has a picture of a stopwatch (I think, it's
>> not very clear). Currently it uses COFFEE, but maybe TIMER or something
>> like that should be added. The Windows software's manual just say it
>> toggles TV-on-demand, but I have no idea what that actually is.
>
> Hmm... Maybe TV-on-demand is another name for pay-per-view?
>
>
>
> Cheers,
> Mauro
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Since we're on the topic of IR support, there are probably a couple of
other things we may want to be thinking about if we plan on
refactoring the API at all:
1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
only have the second byte. In theory, they should have both bytes
since the vendor byte helps prevents receiving spurious commands from
unrelated remote controls. We should include the ability to "ignore
the vendor byte" so we can continue to support all the remotes
currently in the ir-keymaps.c where we don't know what the vendor byte
should contain.
2.. The fact that the current API provides no real way to change the
mode of operation for the IR receiver, for those receivers that
support multiple modes (NEC/RC5/RC6). While you have the ability to
change the mapping table from userland via the keytable program, there
is currently no way to tell the IR receiver which mode to operate in.
One would argue that the above keymaps structure should include new
fields to indicate what type of remote it is (NEC/RC5/RC6 etc), as
well as field to indicate that the vendor codes are absent from the
key mapping for that remote). Given this, I can change the dib0700
and em28xx IR receivers to automatically set the IR capture mode
appropriate based on which remote is in the device profile.
Devin
--
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-27 22:06 ` Devin Heitmueller
(?)
@ 2009-08-28 3:46 ` Mauro Carvalho Chehab
2009-08-28 7:14 ` Mauro Carvalho Chehab
-1 siblings, 1 reply; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 3:46 UTC (permalink / raw)
To: Devin Heitmueller
Cc: Ville Syrjälä, Linux Media Mailing List, Linux Input
Em Thu, 27 Aug 2009 18:06:51 -0400
Devin Heitmueller <dheitmueller@kernellabs.com> escreveu:
> Since we're on the topic of IR support, there are probably a couple of
> other things we may want to be thinking about if we plan on
> refactoring the API at all:
>
> 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> only have the second byte. In theory, they should have both bytes
> since the vendor byte helps prevents receiving spurious commands from
> unrelated remote controls. We should include the ability to "ignore
> the vendor byte" so we can continue to support all the remotes
> currently in the ir-keymaps.c where we don't know what the vendor byte
> should contain.
This were done due to at least two reasons:
1) Several boards uses a few GPIO bits (in general 7 or less bits) for IR.
There's one logic at ir-common.ko to convert a 32 bits GPIO read into a 7 bits
scancode.
2) In order to properly support the default EVIOCGKEYCODE/EVIOCSKEYCODE
handlers, we need to have keycode table, where the scan code is the index. So,
if we use 14 bits for it, this means that this table would reserve 16384 bytes,
and will probably a very few of those bytes (on a IR with 64 keys, it would
need only 64 entries).
As it seems that there are some ways to replace the default
getkeycode/setkeycode handlers, I suspect that we can get rid of this limitation.
I'll do some tests here with a dib0700 and an em28xx devices.
> 2.. The fact that the current API provides no real way to change the
> mode of operation for the IR receiver, for those receivers that
> support multiple modes (NEC/RC5/RC6). While you have the ability to
> change the mapping table from userland via the keytable program, there
> is currently no way to tell the IR receiver which mode to operate in.
In this case, we'll need to have a set of new ioctls at the event interface, to
allow enum/get/set the IR protocol type(s) per event device.
> One would argue that the above keymaps structure should include new
> fields to indicate what type of remote it is (NEC/RC5/RC6 etc), as
> well as field to indicate that the vendor codes are absent from the
> key mapping for that remote). Given this, I can change the dib0700
> and em28xx IR receivers to automatically set the IR capture mode
> appropriate based on which remote is in the device profile.
Let's go step by step. Adding the ability of dynamically change the type of
remote will likely cause major changes at the GPIO polling code, since we'll
need to move some code from bttv and saa7134 into ir-functions.c and rework on
it. We'll probably end by converting the remaining polling code to use high
precision timers as we've done with cx88.
So, we need a sort of TODO list for IR changes. A start point (on a random
order) would be something like:
1) Standardize the keycodes;
2) Implement a v4l handler for EVIOCGKEYCODE/EVIOCSKEYCODE;
3) use a different arrangement for IR tables to not spend 16 K for IR table,
yet allowing RC5 full table;
4) Use the common IR framework at the dvb drivers with their own iplementation;
5) Allow getkeycode/setkeycode to work with the dvb framework using the new
methods;
6) implement new event ioctls (EVIOEPROTO/EVIOGPROTO/EVIOSPROTO ?), to allow
enumerating/getting/setting the IR protocol types;
7) Change the non-gpio drivers to support IR protocol type;
8) Create a gpio handler that supports changing the protocol type;
9) Migrate the remaining drivers to the new gpio handler methods;
10) Merge pertinent lirc drivers;
11) Add missing keys at input.h.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 3:46 ` Mauro Carvalho Chehab
@ 2009-08-28 7:14 ` Mauro Carvalho Chehab
2009-08-28 10:13 ` Peter Brouwer
2009-08-28 10:50 ` Patrick Boettcher
0 siblings, 2 replies; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 7:14 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Devin Heitmueller, Ville Syrjälä, Linux Input,
Patrick Boettcher
Em Fri, 28 Aug 2009 00:46:28 -0300
Mauro Carvalho Chehab <mchehab@infradead.org> escreveu:
> So, we need a sort of TODO list for IR changes. A start point (on a random
> order) would be something like:
>
> 2) Implement a v4l handler for EVIOCGKEYCODE/EVIOCSKEYCODE;
> 3) use a different arrangement for IR tables to not spend 16 K for IR table,
> yet allowing RC5 full table;
> 4) Use the common IR framework at the dvb drivers with their own iplementation;
> 5) Allow getkeycode/setkeycode to work with the dvb framework using the new
> methods;
Ok, I have a code that handles the above for dvb-usb. Se enclosed. It turned to be
simpler than what I've expected originally ;)
Tested with kernel 2.6.30.3 and a dibcom device.
While this patch works fine, for now, it is just a proof of concept, since there are a few
details to be decided/solved for a version 2, as described bellow.
I'm committing at the development tree some improvements at keytable util for
it to handle those 16 bits tables
Cheers,
Mauro
---
dvb-usb: allow userspace replacement of IR keycodes
Implements handler for EVIOCGKEYCODE/EVIOCSKEYCODE via adding two new callbacks
to the input device.
Since on dvb-usb a scan code has 16 bits, to fulfill rc5 standard codes, the default
getkeycode/setkeycode input methods would require the driver to spend up to 64 Kb of
a sparse table. Instead, add two new callbacks to the event device.
With this, it is now possible to replace the keycode tables. There are, however, a few
implementation details at the current patch:
1) It will replace the existing device keytable, instead of creating an instance
of the data. This works. However, if two devices pointing to the same table
were connected, changing the IR table of one will also change the IR table for
the other (the solution for this one is simple: just kmalloc some memory);
2) In order to change the scan code, you need first to change the key to
KEY_RESERVED or KEY_UNKNOWN to free some space at the table (solution: allocate
some additional space for newer scan codes or allow dynamic table grow);
3) The table size cannot be extended. It would be easy to allow the table to
grow dynamically: just calling kmalloc(size+1); kfree(old). Yet, maybe we can
just create a bigger table with a fixed size, like for example a table with 128
entries. This should be enough even for a very big IR.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff -r ec87db9cb8db linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c Fri Aug 28 02:12:12 2009 -0300
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c Fri Aug 28 03:46:35 2009 -0300
@@ -12,6 +12,65 @@
#include <linux/usb_input.h>
#endif
+static int dvb_usb_getkeycode(struct input_dev *dev,
+ int scancode, int *keycode)
+{
+ struct dvb_usb_device *d = input_get_drvdata(dev);
+
+ struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
+ int custom = (scancode >> 8) & 0xff;
+ int data = scancode & 0xff;
+ int i;
+
+ /* See if we can match the raw key code. */
+ for (i = 0; i < d->props.rc_key_map_size; i++)
+ if (keymap[i].custom == custom &&
+ keymap[i].data == data) {
+ *keycode = keymap[i].event;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+static int dvb_usb_setkeycode(struct input_dev *dev,
+ int scancode, int keycode)
+{
+ struct dvb_usb_device *d = input_get_drvdata(dev);
+
+ struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
+ int custom = (scancode >> 8) & 0xff;
+ int data = scancode & 0xff;
+ int i;
+
+ /* Search if it is replacing an existing keycode */
+ for (i = 0; i < d->props.rc_key_map_size; i++)
+ if (keymap[i].custom == custom &&
+ keymap[i].data == data) {
+ keymap[i].event = keycode;
+ return 0;
+ }
+
+ /* Search if is there a clean entry. If so, use it */
+ for (i = 0; i < d->props.rc_key_map_size; i++)
+ if (keymap[i].event == KEY_RESERVED ||
+ keymap[i].event == KEY_UNKNOWN) {
+ keymap[i].custom = custom;
+ keymap[i].data = data;
+ keymap[i].event = keycode;
+ return 0;
+ }
+
+ /*
+ * FIXME: Currently, it is not possible to increase the size of
+ * scancode table. For it to happen, one possibility
+ * would be to allocate a table with key_map_size + 1,
+ * copying data, appending the new key on it, and freeing
+ * the old one - or maybe just allocating some spare space
+ */
+
+ return -EINVAL;
+}
+
/* Remote-control poll function - called every dib->rc_query_interval ms to see
* whether the remote control has received anything.
*
@@ -127,6 +186,8 @@
#else
input_dev->cdev.dev = &d->udev->dev;
#endif
+ input_dev->getkeycode = dvb_usb_getkeycode;
+ input_dev->setkeycode = dvb_usb_setkeycode;
/* set the bits for the keys */
deb_rc("key map size: %d\n", d->props.rc_key_map_size);
@@ -144,6 +205,8 @@
input_dev->rep[REP_PERIOD] = d->props.rc_interval;
input_dev->rep[REP_DELAY] = d->props.rc_interval + 150;
+ input_set_drvdata(input_dev, d);
+
err = input_register_device(input_dev);
if (err) {
input_free_device(input_dev);
^ permalink raw reply [flat|nested] 39+ messages in thread* Re: [RFC] Infrared Keycode standardization
2009-08-28 7:14 ` Mauro Carvalho Chehab
@ 2009-08-28 10:13 ` Peter Brouwer
2009-08-28 12:36 ` Mauro Carvalho Chehab
2009-08-28 14:22 ` Alistair Buxton
2009-08-28 10:50 ` Patrick Boettcher
1 sibling, 2 replies; 39+ messages in thread
From: Peter Brouwer @ 2009-08-28 10:13 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Devin Heitmueller,
Ville Syrjälä, Linux Input, Patrick Boettcher
Would like to add one more dimension to the discussion.
The situation of having multiple DVB type boards in one system.
Using one remote would be enough to control the system. So we should have a
mechanism/kernel config option, to enable/disable an IR device on a board.
For multiple boards of the same type, enable the first and disable any
subsequently detected boards.
Peter
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 10:13 ` Peter Brouwer
@ 2009-08-28 12:36 ` Mauro Carvalho Chehab
2009-08-28 14:22 ` Alistair Buxton
1 sibling, 0 replies; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 12:36 UTC (permalink / raw)
To: Peter Brouwer
Cc: Linux Media Mailing List, Devin Heitmueller,
Ville Syrjälä, Linux Input, Patrick Boettcher
Em Fri, 28 Aug 2009 11:13:33 +0100
Peter Brouwer <pb.maillists@googlemail.com> escreveu:
>
> Would like to add one more dimension to the discussion.
>
> The situation of having multiple DVB type boards in one system.
>
> Using one remote would be enough to control the system. So we should have a
> mechanism/kernel config option, to enable/disable an IR device on a board.
> For multiple boards of the same type, enable the first and disable any
> subsequently detected boards.
I agree that this feature would be useful, but we shouldn't assume that the
user doesn't expect to have more than one IR working. With USB keyboard/mouse
and computers supporting video cards with multiple heads, it is possible to use
one server to handle several virtual machines with their own keyboard, mouse,
video and IR (in fact, I've already seen similar scenarios on some expositions).
Anyway, for this to happen with all drivers, the better way would be to use a
common IR framework.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 10:13 ` Peter Brouwer
2009-08-28 12:36 ` Mauro Carvalho Chehab
@ 2009-08-28 14:22 ` Alistair Buxton
1 sibling, 0 replies; 39+ messages in thread
From: Alistair Buxton @ 2009-08-28 14:22 UTC (permalink / raw)
To: Peter Brouwer
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Devin Heitmueller, Ville Syrjälä, Linux Input,
Patrick Boettcher
2009/8/28 Peter Brouwer <pb.maillists@googlemail.com>:
>
> Would like to add one more dimension to the discussion.
>
> The situation of having multiple DVB type boards in one system.
>
> Using one remote would be enough to control the system. So we should have a
> mechanism/kernel config option, to enable/disable an IR device on a board.
> For multiple boards of the same type, enable the first and disable any
> subsequently detected boards.
Don't forget that completely different boards can have identical
remotes. For example the RTL2831 driver has an almost identical copy
of dvb-usb IR code in it. See here for in depth explanation and patch
that makes it use dvb-usb instead:
http://patchwork.kernel.org/patch/38794/
Now I'm not really familiar with frontends and tuners so it may be
that the RTL driver should be reimplemented within dvb-usb instead,
but if it can't be it would be nice if that IR code could be shared
without pulling in all the rest of dvb-usb modules too. I'm told that
the excessive code duplication is the reason this driver isn't in
mainline yet - I've been using it with no problems for over two years
now.
--
Alistair Buxton
a.j.buxton@gmail.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 7:14 ` Mauro Carvalho Chehab
2009-08-28 10:13 ` Peter Brouwer
@ 2009-08-28 10:50 ` Patrick Boettcher
2009-08-28 12:30 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 39+ messages in thread
From: Patrick Boettcher @ 2009-08-28 10:50 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Devin Heitmueller,
Ville Syrjälä, Linux Input
Hi Mauro,
On Fri, 28 Aug 2009, Mauro Carvalho Chehab wrote:
> Em Fri, 28 Aug 2009 00:46:28 -0300
> Mauro Carvalho Chehab <mchehab@infradead.org> escreveu:
>
>> So, we need a sort of TODO list for IR changes. A start point (on a random
>> order) would be something like:
>>
>> 2) Implement a v4l handler for EVIOCGKEYCODE/EVIOCSKEYCODE;
>> 3) use a different arrangement for IR tables to not spend 16 K for IR table,
>> yet allowing RC5 full table;
>> 4) Use the common IR framework at the dvb drivers with their own iplementation;
>> 5) Allow getkeycode/setkeycode to work with the dvb framework using the new
>> methods;
>
> Ok, I have a code that handles the above for dvb-usb. Se enclosed. It turned to be
> simpler than what I've expected originally ;)
Yeah, this is due to the nature of modularity of dvb-usb. Saying that, all
drivers which have (re)implemented IR-handling needs to ported as well. Or
included in dvb-usb :P .
> Tested with kernel 2.6.30.3 and a dibcom device.
>
> While this patch works fine, for now, it is just a proof of concept, since there are a few
> details to be decided/solved for a version 2, as described bellow.
This is the answer to the question I had several times in the past years.
Very good job. It will solve the memory waste in the driver for
key-tables filled up with keys for different remotes where the user of
one board only has one. The code will also be smaller and easier to read.
This also allows the user to use any remote with any (sensitive)
ir-sensor in a USB device.
Is there a feature in 'input' which allows to request a file (like
request_firmware)? This would be ideal for a transition from
in-kernel-keymaps to user-space-keymap-loading: By default it would
request the file corresponding to the remote delivered with the device.
Is that possible somehow?
Patrick.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 10:50 ` Patrick Boettcher
@ 2009-08-28 12:30 ` Mauro Carvalho Chehab
2009-08-29 18:45 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 12:30 UTC (permalink / raw)
To: Patrick Boettcher
Cc: Linux Media Mailing List, Devin Heitmueller,
Ville Syrjälä, Linux Input
Em Fri, 28 Aug 2009 12:50:27 +0200 (CEST)
Patrick Boettcher <pboettcher@kernellabs.com> escreveu:
> Hi Mauro,
>
> On Fri, 28 Aug 2009, Mauro Carvalho Chehab wrote:
>
> > Em Fri, 28 Aug 2009 00:46:28 -0300
> > Mauro Carvalho Chehab <mchehab@infradead.org> escreveu:
> >
> >> So, we need a sort of TODO list for IR changes. A start point (on a random
> >> order) would be something like:
> >>
> >> 2) Implement a v4l handler for EVIOCGKEYCODE/EVIOCSKEYCODE;
> >> 3) use a different arrangement for IR tables to not spend 16 K for IR table,
> >> yet allowing RC5 full table;
> >> 4) Use the common IR framework at the dvb drivers with their own iplementation;
> >> 5) Allow getkeycode/setkeycode to work with the dvb framework using the new
> >> methods;
> >
> > Ok, I have a code that handles the above for dvb-usb. Se enclosed. It turned to be
> > simpler than what I've expected originally ;)
>
> Yeah, this is due to the nature of modularity of dvb-usb.
Yes, but I was afraid that we would need to use a different struct for IR's.
This feature is already available for years at V4L, but the tables needed to
use scancode as their indexes to use the default handlers (I'm not sure, but
afaik, in the past there weren't ways to override them).
> Saying that, all
> drivers which have (re)implemented IR-handling needs to ported as well. Or
> included in dvb-usb :P .
My suggestion is to port the current implementation to ir-common.ko. This
module is not dependent of any other V4L or DVB specifics and has already
some code to handle GPIO polling based and GPIO IRQ based IR's. It contains
some IR tables for IR's that are used also on dvb-usb, like Hauppauge IR
keycodes.
Yet, we will need first to change ir-common.ko, since it is currently using the
tables indexed by a 7bit scancode (due to size constraints, V4L code discards
one RC5 byte), but this is already on our todo list (due to keycode
standardization).
> > Tested with kernel 2.6.30.3 and a dibcom device.
> >
> > While this patch works fine, for now, it is just a proof of concept, since there are a few
> > details to be decided/solved for a version 2, as described bellow.
>
> This is the answer to the question I had several times in the past years.
>
> Very good job. It will solve the memory waste in the driver for
> key-tables filled up with keys for different remotes where the user of
> one board only has one. The code will also be smaller and easier to read.
>
> This also allows the user to use any remote with any (sensitive)
> ir-sensor in a USB device.
True.
> Is there a feature in 'input' which allows to request a file (like
> request_firmware)? This would be ideal for a transition from
> in-kernel-keymaps to user-space-keymap-loading: By default it would
> request the file corresponding to the remote delivered with the device.
>
> Is that possible somehow?
There's nothing that I'm aware of, but I suspect that it shouldn't be hard to do it
via udev.
We'll need to do some work there, in order to be sure that each V4L and DVB
device will have their own unique IR board ID's. We may then do an application
based on v4l2-apps/util/keytable that will use the IR board ID to
dynamically load the keytable, with a default config of loading the board's own
IR, but allowing the user to replace it by a custom one.
Currently, the Makefile at v4l2-apps/util creates a directory (keycodes) that
contains lots of IR tables. It does it by parsing the existing IR tables at V4L
side. After having all tables looking the same, it won't be hard to change it
to parse all MCE tables, creating an updated repository of the existing
scancode/keycode association.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 12:30 ` Mauro Carvalho Chehab
@ 2009-08-29 18:45 ` Mauro Carvalho Chehab
2009-08-31 5:47 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-29 18:45 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Patrick Boettcher, Linux Media Mailing List, Devin Heitmueller,
Ville Syrjälä, Linux Input
Em Fri, 28 Aug 2009 09:30:42 -0300
Mauro Carvalho Chehab <mchehab@infradead.org> escreveu:
> Em Fri, 28 Aug 2009 12:50:27 +0200 (CEST)
> Patrick Boettcher <pboettcher@kernellabs.com> escreveu:
>
> > Hi Mauro,
> >
> > On Fri, 28 Aug 2009, Mauro Carvalho Chehab wrote:
> >
> > > Em Fri, 28 Aug 2009 00:46:28 -0300
> > > Mauro Carvalho Chehab <mchehab@infradead.org> escreveu:
> > >
> > >> So, we need a sort of TODO list for IR changes. A start point (on a random
> > >> order) would be something like:
> > >>
> > >> 2) Implement a v4l handler for EVIOCGKEYCODE/EVIOCSKEYCODE;
> > >> 3) use a different arrangement for IR tables to not spend 16 K for IR table,
> > >> yet allowing RC5 full table;
> > >> 4) Use the common IR framework at the dvb drivers with their own iplementation;
> > >> 5) Allow getkeycode/setkeycode to work with the dvb framework using the new
> > >> methods;
> > >
> > > Ok, I have a code that handles the above for dvb-usb. Se enclosed. It turned to be
> > > simpler than what I've expected originally ;)
> >
> > Yeah, this is due to the nature of modularity of dvb-usb.
>
> Yes, but I was afraid that we would need to use a different struct for IR's.
> This feature is already available for years at V4L, but the tables needed to
> use scancode as their indexes to use the default handlers (I'm not sure, but
> afaik, in the past there weren't ways to override them).
>
> > Saying that, all
> > drivers which have (re)implemented IR-handling needs to ported as well. Or
> > included in dvb-usb :P .
>
> My suggestion is to port the current implementation to ir-common.ko. This
> module is not dependent of any other V4L or DVB specifics and has already
> some code to handle GPIO polling based and GPIO IRQ based IR's. It contains
> some IR tables for IR's that are used also on dvb-usb, like Hauppauge IR
> keycodes.
>
> Yet, we will need first to change ir-common.ko, since it is currently using the
> tables indexed by a 7bit scancode (due to size constraints, V4L code discards
> one RC5 byte), but this is already on our todo list (due to keycode
> standardization).
Ok, I've did several changes on both V4L and dvb-usb IR implementations. They
scancode tables are now implemented at the same way, at:
http://linuxtv.org/hg/~mchehab/IR
I've also added there the current version of the getkeycode/setkeycode patch.
Ah, the v4l2-apps/util/Makefile will now generate the scancode userspace tables
for DVB IR's as well (currently, we have 85 IR layouts generated from source files).
What's still missing:
- For now, V4L is still using internally the old decoding process, based on the
7bit array of keycode.
- I haven't yet added some extra empty data at dvb scancode tables;
- although they're using the same structs, the code is still different.
Please review.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-29 18:45 ` Mauro Carvalho Chehab
@ 2009-08-31 5:47 ` Mauro Carvalho Chehab
2009-09-01 1:38 ` Dmitry Torokhov
0 siblings, 1 reply; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-31 5:47 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Patrick Boettcher, Linux Media Mailing List, Devin Heitmueller,
Ville Syrjälä, Linux Input
Em Sat, 29 Aug 2009 15:45:28 -0300
Mauro Carvalho Chehab <mchehab@infradead.org> escreveu:
> Ok, I've did several changes on both V4L and dvb-usb IR implementations. They
> scancode tables are now implemented at the same way, at:
> http://linuxtv.org/hg/~mchehab/IR
Ok, I've also updated the V4L2 API spec with the default keyboard mapping on
the above URL. If nobody complains, I'll update our development tree with the
above changes likely today (Aug, 31) night, and prepare the changesets to be
added at linux-next.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-31 5:47 ` Mauro Carvalho Chehab
@ 2009-09-01 1:38 ` Dmitry Torokhov
0 siblings, 0 replies; 39+ messages in thread
From: Dmitry Torokhov @ 2009-09-01 1:38 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Patrick Boettcher, Linux Media Mailing List, Devin Heitmueller,
Ville Syrjälä, Linux Input
Mauro,
On Mon, Aug 31, 2009 at 02:47:41AM -0300, Mauro Carvalho Chehab wrote:
> Em Sat, 29 Aug 2009 15:45:28 -0300
> Mauro Carvalho Chehab <mchehab@infradead.org> escreveu:
>
> > Ok, I've did several changes on both V4L and dvb-usb IR implementations. They
> > scancode tables are now implemented at the same way, at:
> > http://linuxtv.org/hg/~mchehab/IR
>
> Ok, I've also updated the V4L2 API spec with the default keyboard mapping on
> the above URL. If nobody complains, I'll update our development tree with the
> above changes likely today (Aug, 31) night, and prepare the changesets to be
> added at linux-next.
>
I see that you changed from KEY_KP* to KEY_*, unfortunately this change
will break users who have digits in upper register. KEY_KP* were not
perfect either since they are affected by NumLock state. I would
recommend moving to KEY_NUMERIC_* which should be unaffected by either
register, shift state or NumLock state.
Of course there is an issue of them being absent from most keymaps; but
nothing is perfect in thsi world ;)
--
Dmitry
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-27 22:06 ` Devin Heitmueller
@ 2009-08-28 4:00 ` Jarod Wilson
-1 siblings, 0 replies; 39+ messages in thread
From: Jarod Wilson @ 2009-08-28 4:00 UTC (permalink / raw)
To: Devin Heitmueller
Cc: Mauro Carvalho Chehab, Ville Syrjälä,
Linux Media Mailing List, Linux Input
On Thursday 27 August 2009 18:06:51 Devin Heitmueller wrote:
> On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> Chehab<mchehab@infradead.org> wrote:
> > Em Thu, 27 Aug 2009 21:36:36 +0300
> > Ville Syrjälä <syrjala@sci.fi> escreveu:
> >
> >
> >> I welcome this effort. It would be nice to have some kind of consistent
> >> behaviour between devices. But just limiting the effort to IR devices
> >> doesn't make sense. It shouldn't matter how the device is connected.
> >
> > Agreed.
> >
> >>
> >> FASTWORWARD,REWIND,FORWARD and BACK aren't very clear. To me it would
> >> make most sense if FASTFORWARD and REWIND were paired and FORWARD and
> >> BACK were paired. I actually have those two a bit confused in
> >> ati_remote2 too where I used FASTFORWARD and BACK. I suppose it should
> >> be REWIND instead.
> >
> > Makes sense. I updated it at the wiki. I also tried to group the keycodes by
> > function there.
> >
> >> Also I should probably use ZOOM for the maximize/restore button (it's
> >> FRONT now), and maybe SETUP instead of ENTER for another. It has a
> >> picture of a checkbox, Windows software apparently shows a setup menu
> >> when it's pressed.
> >>
> >> There are also a couple of buttons where no keycode really seems to
> >> match. One is the mouse button drag. I suppose I could implement the
> >> drag lock feature in the driver but I'm not sure if that's a good idea.
> >> It would make that button special and unmappable. Currently I have that
> >> mapped to EDIT IIRC.
> >
> > I'm not sure what we should do with those buttons.
> >
> > Probably, the most complete IR spec is the RC5 codes:
> > http://c6000.spectrumdigital.com/davincievm/revf/files/msp430/rc5_codes.pdf
> > (not sure if this table is complete or accurate, but on a search I did
> > today, this is the one that gave me a better documentation)
> >
> > I suspect that, after solving the most used cases, we'll need to take a better look on it,
> > identifying the missing cases of the real implementations and add them to input.h.
> >
> >> The other oddball button has a picture of a stopwatch (I think, it's
> >> not very clear). Currently it uses COFFEE, but maybe TIMER or something
> >> like that should be added. The Windows software's manual just say it
> >> toggles TV-on-demand, but I have no idea what that actually is.
> >
> > Hmm... Maybe TV-on-demand is another name for pay-per-view?
> >
> >
> >
> > Cheers,
> > Mauro
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-media" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
>
> Since we're on the topic of IR support, there are probably a couple of
> other things we may want to be thinking about if we plan on
> refactoring the API at all:
>
> 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> only have the second byte. In theory, they should have both bytes
> since the vendor byte helps prevents receiving spurious commands from
> unrelated remote controls. We should include the ability to "ignore
> the vendor byte" so we can continue to support all the remotes
> currently in the ir-keymaps.c where we don't know what the vendor byte
> should contain.
>
> 2.. The fact that the current API provides no real way to change the
> mode of operation for the IR receiver, for those receivers that
> support multiple modes (NEC/RC5/RC6). While you have the ability to
> change the mapping table from userland via the keytable program, there
> is currently no way to tell the IR receiver which mode to operate in.
>
> One would argue that the above keymaps structure should include new
> fields to indicate what type of remote it is (NEC/RC5/RC6 etc), as
> well as field to indicate that the vendor codes are absent from the
> key mapping for that remote). Given this, I can change the dib0700
> and em28xx IR receivers to automatically set the IR capture mode
> appropriate based on which remote is in the device profile.
Jon Smirl actually wrote some fully functional proof-of-concept IR
handling code about a year ago, that included auto-detection and auto
decoding of several protocols. Perhaps some of that is relevant and
reusable here? (I still have a copy of the tree here somewhere...)
I've been toying with the notion of extending the input device support
that was added to the lirc_imon driver a bit ago, and add a full key
map that delivers events (we already do this for mouse functionality),
but include the ability to also use the remote and/or receiver in a
raw IR mode with lircd. Wouldn't be terribly difficult I think to do
something similar for the standard MCE remotes and receivers... Just
a simple matter of some time and some code. Unfortunately, I'm a bit
short on the time part right now...
--
Jarod Wilson
jarod@wilsonet.com
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
@ 2009-08-28 4:00 ` Jarod Wilson
0 siblings, 0 replies; 39+ messages in thread
From: Jarod Wilson @ 2009-08-28 4:00 UTC (permalink / raw)
To: Devin Heitmueller
Cc: Mauro Carvalho Chehab, Ville Syrjälä,
Linux Media Mailing List, Linux Input
On Thursday 27 August 2009 18:06:51 Devin Heitmueller wrote:
> On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> Chehab<mchehab@infradead.org> wrote:
> > Em Thu, 27 Aug 2009 21:36:36 +0300
> > Ville Syrjälä <syrjala@sci.fi> escreveu:
> >
> >
> >> I welcome this effort. It would be nice to have some kind of consistent
> >> behaviour between devices. But just limiting the effort to IR devices
> >> doesn't make sense. It shouldn't matter how the device is connected.
> >
> > Agreed.
> >
> >>
> >> FASTWORWARD,REWIND,FORWARD and BACK aren't very clear. To me it would
> >> make most sense if FASTFORWARD and REWIND were paired and FORWARD and
> >> BACK were paired. I actually have those two a bit confused in
> >> ati_remote2 too where I used FASTFORWARD and BACK. I suppose it should
> >> be REWIND instead.
> >
> > Makes sense. I updated it at the wiki. I also tried to group the keycodes by
> > function there.
> >
> >> Also I should probably use ZOOM for the maximize/restore button (it's
> >> FRONT now), and maybe SETUP instead of ENTER for another. It has a
> >> picture of a checkbox, Windows software apparently shows a setup menu
> >> when it's pressed.
> >>
> >> There are also a couple of buttons where no keycode really seems to
> >> match. One is the mouse button drag. I suppose I could implement the
> >> drag lock feature in the driver but I'm not sure if that's a good idea.
> >> It would make that button special and unmappable. Currently I have that
> >> mapped to EDIT IIRC.
> >
> > I'm not sure what we should do with those buttons.
> >
> > Probably, the most complete IR spec is the RC5 codes:
> > http://c6000.spectrumdigital.com/davincievm/revf/files/msp430/rc5_codes.pdf
> > (not sure if this table is complete or accurate, but on a search I did
> > today, this is the one that gave me a better documentation)
> >
> > I suspect that, after solving the most used cases, we'll need to take a better look on it,
> > identifying the missing cases of the real implementations and add them to input.h.
> >
> >> The other oddball button has a picture of a stopwatch (I think, it's
> >> not very clear). Currently it uses COFFEE, but maybe TIMER or something
> >> like that should be added. The Windows software's manual just say it
> >> toggles TV-on-demand, but I have no idea what that actually is.
> >
> > Hmm... Maybe TV-on-demand is another name for pay-per-view?
> >
> >
> >
> > Cheers,
> > Mauro
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-media" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
>
> Since we're on the topic of IR support, there are probably a couple of
> other things we may want to be thinking about if we plan on
> refactoring the API at all:
>
> 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> only have the second byte. In theory, they should have both bytes
> since the vendor byte helps prevents receiving spurious commands from
> unrelated remote controls. We should include the ability to "ignore
> the vendor byte" so we can continue to support all the remotes
> currently in the ir-keymaps.c where we don't know what the vendor byte
> should contain.
>
> 2.. The fact that the current API provides no real way to change the
> mode of operation for the IR receiver, for those receivers that
> support multiple modes (NEC/RC5/RC6). While you have the ability to
> change the mapping table from userland via the keytable program, there
> is currently no way to tell the IR receiver which mode to operate in.
>
> One would argue that the above keymaps structure should include new
> fields to indicate what type of remote it is (NEC/RC5/RC6 etc), as
> well as field to indicate that the vendor codes are absent from the
> key mapping for that remote). Given this, I can change the dib0700
> and em28xx IR receivers to automatically set the IR capture mode
> appropriate based on which remote is in the device profile.
Jon Smirl actually wrote some fully functional proof-of-concept IR
handling code about a year ago, that included auto-detection and auto
decoding of several protocols. Perhaps some of that is relevant and
reusable here? (I still have a copy of the tree here somewhere...)
I've been toying with the notion of extending the input device support
that was added to the lirc_imon driver a bit ago, and add a full key
map that delivers events (we already do this for mouse functionality),
but include the ability to also use the remote and/or receiver in a
raw IR mode with lircd. Wouldn't be terribly difficult I think to do
something similar for the standard MCE remotes and receivers... Just
a simple matter of some time and some code. Unfortunately, I'm a bit
short on the time part right now...
--
Jarod Wilson
jarod@wilsonet.com
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 4:00 ` Jarod Wilson
@ 2009-08-28 14:05 ` Mauro Carvalho Chehab
-1 siblings, 0 replies; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 14:05 UTC (permalink / raw)
To: Jarod Wilson
Cc: Devin Heitmueller, Ville Syrjälä,
Linux Media Mailing List, Linux Input
Em Fri, 28 Aug 2009 00:00:54 -0400
Jarod Wilson <jarod@wilsonet.com> escreveu:
> On Thursday 27 August 2009 18:06:51 Devin Heitmueller wrote:
> > On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> > Chehab<mchehab@infradead.org> wrote:
> > > Em Thu, 27 Aug 2009 21:36:36 +0300
> > > Ville Syrjälä <syrjala@sci.fi> escreveu:
> > >
> > >
> > >> I welcome this effort. It would be nice to have some kind of consistent
> > >> behaviour between devices. But just limiting the effort to IR devices
> > >> doesn't make sense. It shouldn't matter how the device is connected.
> > >
> > > Agreed.
> > >
> > >>
> > >> FASTWORWARD,REWIND,FORWARD and BACK aren't very clear. To me it would
> > >> make most sense if FASTFORWARD and REWIND were paired and FORWARD and
> > >> BACK were paired. I actually have those two a bit confused in
> > >> ati_remote2 too where I used FASTFORWARD and BACK. I suppose it should
> > >> be REWIND instead.
> > >
> > > Makes sense. I updated it at the wiki. I also tried to group the keycodes by
> > > function there.
> > >
> > >> Also I should probably use ZOOM for the maximize/restore button (it's
> > >> FRONT now), and maybe SETUP instead of ENTER for another. It has a
> > >> picture of a checkbox, Windows software apparently shows a setup menu
> > >> when it's pressed.
> > >>
> > >> There are also a couple of buttons where no keycode really seems to
> > >> match. One is the mouse button drag. I suppose I could implement the
> > >> drag lock feature in the driver but I'm not sure if that's a good idea.
> > >> It would make that button special and unmappable. Currently I have that
> > >> mapped to EDIT IIRC.
> > >
> > > I'm not sure what we should do with those buttons.
> > >
> > > Probably, the most complete IR spec is the RC5 codes:
> > > http://c6000.spectrumdigital.com/davincievm/revf/files/msp430/rc5_codes.pdf
> > > (not sure if this table is complete or accurate, but on a search I did
> > > today, this is the one that gave me a better documentation)
> > >
> > > I suspect that, after solving the most used cases, we'll need to take a better look on it,
> > > identifying the missing cases of the real implementations and add them to input.h.
> > >
> > >> The other oddball button has a picture of a stopwatch (I think, it's
> > >> not very clear). Currently it uses COFFEE, but maybe TIMER or something
> > >> like that should be added. The Windows software's manual just say it
> > >> toggles TV-on-demand, but I have no idea what that actually is.
> > >
> > > Hmm... Maybe TV-on-demand is another name for pay-per-view?
> > >
> > >
> > >
> > > Cheers,
> > > Mauro
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-media" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > >
> >
> > Since we're on the topic of IR support, there are probably a couple of
> > other things we may want to be thinking about if we plan on
> > refactoring the API at all:
> >
> > 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> > only have the second byte. In theory, they should have both bytes
> > since the vendor byte helps prevents receiving spurious commands from
> > unrelated remote controls. We should include the ability to "ignore
> > the vendor byte" so we can continue to support all the remotes
> > currently in the ir-keymaps.c where we don't know what the vendor byte
> > should contain.
> >
> > 2.. The fact that the current API provides no real way to change the
> > mode of operation for the IR receiver, for those receivers that
> > support multiple modes (NEC/RC5/RC6). While you have the ability to
> > change the mapping table from userland via the keytable program, there
> > is currently no way to tell the IR receiver which mode to operate in.
> >
> > One would argue that the above keymaps structure should include new
> > fields to indicate what type of remote it is (NEC/RC5/RC6 etc), as
> > well as field to indicate that the vendor codes are absent from the
> > key mapping for that remote). Given this, I can change the dib0700
> > and em28xx IR receivers to automatically set the IR capture mode
> > appropriate based on which remote is in the device profile.
>
> Jon Smirl actually wrote some fully functional proof-of-concept IR
> handling code about a year ago, that included auto-detection and auto
> decoding of several protocols. Perhaps some of that is relevant and
> reusable here? (I still have a copy of the tree here somewhere...)
Yes, it seems interesting. We may try to merge his code at ir-functions.
> I've been toying with the notion of extending the input device support
> that was added to the lirc_imon driver a bit ago, and add a full key
> map that delivers events (we already do this for mouse functionality),
> but include the ability to also use the remote and/or receiver in a
> raw IR mode with lircd. Wouldn't be terribly difficult I think to do
> something similar for the standard MCE remotes and receivers... Just
> a simple matter of some time and some code. Unfortunately, I'm a bit
> short on the time part right now...
Interesting. This could work fine with the IR's that are directly connected to
a GPIO pin at the MCE receivers.
Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
@ 2009-08-28 14:05 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 14:05 UTC (permalink / raw)
To: Jarod Wilson
Cc: Devin Heitmueller, Ville Syrjälä,
Linux Media Mailing List, Linux Input
Em Fri, 28 Aug 2009 00:00:54 -0400
Jarod Wilson <jarod@wilsonet.com> escreveu:
> On Thursday 27 August 2009 18:06:51 Devin Heitmueller wrote:
> > On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> > Chehab<mchehab@infradead.org> wrote:
> > > Em Thu, 27 Aug 2009 21:36:36 +0300
> > > Ville Syrjälä <syrjala@sci.fi> escreveu:
> > >
> > >
> > >> I welcome this effort. It would be nice to have some kind of consistent
> > >> behaviour between devices. But just limiting the effort to IR devices
> > >> doesn't make sense. It shouldn't matter how the device is connected.
> > >
> > > Agreed.
> > >
> > >>
> > >> FASTWORWARD,REWIND,FORWARD and BACK aren't very clear. To me it would
> > >> make most sense if FASTFORWARD and REWIND were paired and FORWARD and
> > >> BACK were paired. I actually have those two a bit confused in
> > >> ati_remote2 too where I used FASTFORWARD and BACK. I suppose it should
> > >> be REWIND instead.
> > >
> > > Makes sense. I updated it at the wiki. I also tried to group the keycodes by
> > > function there.
> > >
> > >> Also I should probably use ZOOM for the maximize/restore button (it's
> > >> FRONT now), and maybe SETUP instead of ENTER for another. It has a
> > >> picture of a checkbox, Windows software apparently shows a setup menu
> > >> when it's pressed.
> > >>
> > >> There are also a couple of buttons where no keycode really seems to
> > >> match. One is the mouse button drag. I suppose I could implement the
> > >> drag lock feature in the driver but I'm not sure if that's a good idea.
> > >> It would make that button special and unmappable. Currently I have that
> > >> mapped to EDIT IIRC.
> > >
> > > I'm not sure what we should do with those buttons.
> > >
> > > Probably, the most complete IR spec is the RC5 codes:
> > > http://c6000.spectrumdigital.com/davincievm/revf/files/msp430/rc5_codes.pdf
> > > (not sure if this table is complete or accurate, but on a search I did
> > > today, this is the one that gave me a better documentation)
> > >
> > > I suspect that, after solving the most used cases, we'll need to take a better look on it,
> > > identifying the missing cases of the real implementations and add them to input.h.
> > >
> > >> The other oddball button has a picture of a stopwatch (I think, it's
> > >> not very clear). Currently it uses COFFEE, but maybe TIMER or something
> > >> like that should be added. The Windows software's manual just say it
> > >> toggles TV-on-demand, but I have no idea what that actually is.
> > >
> > > Hmm... Maybe TV-on-demand is another name for pay-per-view?
> > >
> > >
> > >
> > > Cheers,
> > > Mauro
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-media" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > >
> >
> > Since we're on the topic of IR support, there are probably a couple of
> > other things we may want to be thinking about if we plan on
> > refactoring the API at all:
> >
> > 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> > only have the second byte. In theory, they should have both bytes
> > since the vendor byte helps prevents receiving spurious commands from
> > unrelated remote controls. We should include the ability to "ignore
> > the vendor byte" so we can continue to support all the remotes
> > currently in the ir-keymaps.c where we don't know what the vendor byte
> > should contain.
> >
> > 2.. The fact that the current API provides no real way to change the
> > mode of operation for the IR receiver, for those receivers that
> > support multiple modes (NEC/RC5/RC6). While you have the ability to
> > change the mapping table from userland via the keytable program, there
> > is currently no way to tell the IR receiver which mode to operate in.
> >
> > One would argue that the above keymaps structure should include new
> > fields to indicate what type of remote it is (NEC/RC5/RC6 etc), as
> > well as field to indicate that the vendor codes are absent from the
> > key mapping for that remote). Given this, I can change the dib0700
> > and em28xx IR receivers to automatically set the IR capture mode
> > appropriate based on which remote is in the device profile.
>
> Jon Smirl actually wrote some fully functional proof-of-concept IR
> handling code about a year ago, that included auto-detection and auto
> decoding of several protocols. Perhaps some of that is relevant and
> reusable here? (I still have a copy of the tree here somewhere...)
Yes, it seems interesting. We may try to merge his code at ir-functions.
> I've been toying with the notion of extending the input device support
> that was added to the lirc_imon driver a bit ago, and add a full key
> map that delivers events (we already do this for mouse functionality),
> but include the ability to also use the remote and/or receiver in a
> raw IR mode with lircd. Wouldn't be terribly difficult I think to do
> something similar for the standard MCE remotes and receivers... Just
> a simple matter of some time and some code. Unfortunately, I'm a bit
> short on the time part right now...
Interesting. This could work fine with the IR's that are directly connected to
a GPIO pin at the MCE receivers.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-27 22:06 ` Devin Heitmueller
@ 2009-08-28 11:41 ` Andy Walls
-1 siblings, 0 replies; 39+ messages in thread
From: Andy Walls @ 2009-08-28 11:41 UTC (permalink / raw)
To: Devin Heitmueller
Cc: Mauro Carvalho Chehab, Ville Syrjälä,
Linux Media Mailing List, Linux Input
On Thu, 2009-08-27 at 18:06 -0400, Devin Heitmueller wrote:
> On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> Chehab<mchehab@infradead.org> wrote:
> > Em Thu, 27 Aug 2009 21:36:36 +0300
> > Ville Syrjälä <syrjala@sci.fi> escreveu:
> Since we're on the topic of IR support, there are probably a couple of
> other things we may want to be thinking about if we plan on
> refactoring the API at all:
>
> 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> only have the second byte. In theory, they should have both bytes
> since the vendor byte helps prevents receiving spurious commands from
> unrelated remote controls. We should include the ability to "ignore
> the vendor byte" so we can continue to support all the remotes
> currently in the ir-keymaps.c where we don't know what the vendor byte
> should contain.
Since I uncovered this in my research, I thought I'd share...
RC-6A has a third (or thrid and fouth) byte:
http://www.picbasic.nl/frameload_uk.htm?http://www.picbasic.nl/info_rc6_uk.htm
for the "Customer Identifier".
It appears that the mode bits in the header determine if RC-6 (mode 0)
or RC-6A is in use. The position of the mode bits in the header are
documented here:
http://www.sbprojects.com/knowledge/ir/rc6.htm
I'm guesing some MCE remotes use RC-6A. When I get CX23888 IR support
to the point of actually working, I'll check both of my MCE remotes.
Regards,
Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
@ 2009-08-28 11:41 ` Andy Walls
0 siblings, 0 replies; 39+ messages in thread
From: Andy Walls @ 2009-08-28 11:41 UTC (permalink / raw)
To: Devin Heitmueller
Cc: Mauro Carvalho Chehab, Ville Syrjälä,
Linux Media Mailing List, Linux Input
On Thu, 2009-08-27 at 18:06 -0400, Devin Heitmueller wrote:
> On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> Chehab<mchehab@infradead.org> wrote:
> > Em Thu, 27 Aug 2009 21:36:36 +0300
> > Ville Syrjälä <syrjala@sci.fi> escreveu:
> Since we're on the topic of IR support, there are probably a couple of
> other things we may want to be thinking about if we plan on
> refactoring the API at all:
>
> 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> only have the second byte. In theory, they should have both bytes
> since the vendor byte helps prevents receiving spurious commands from
> unrelated remote controls. We should include the ability to "ignore
> the vendor byte" so we can continue to support all the remotes
> currently in the ir-keymaps.c where we don't know what the vendor byte
> should contain.
Since I uncovered this in my research, I thought I'd share...
RC-6A has a third (or thrid and fouth) byte:
http://www.picbasic.nl/frameload_uk.htm?http://www.picbasic.nl/info_rc6_uk.htm
for the "Customer Identifier".
It appears that the mode bits in the header determine if RC-6 (mode 0)
or RC-6A is in use. The position of the mode bits in the header are
documented here:
http://www.sbprojects.com/knowledge/ir/rc6.htm
I'm guesing some MCE remotes use RC-6A. When I get CX23888 IR support
to the point of actually working, I'll check both of my MCE remotes.
Regards,
Andy
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [RFC] Infrared Keycode standardization
2009-08-28 11:41 ` Andy Walls
@ 2009-08-28 14:02 ` Mauro Carvalho Chehab
-1 siblings, 0 replies; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 14:02 UTC (permalink / raw)
To: Andy Walls
Cc: Devin Heitmueller, Ville Syrjälä,
Linux Media Mailing List, Linux Input
Em Fri, 28 Aug 2009 07:41:22 -0400
Andy Walls <awalls@radix.net> escreveu:
> On Thu, 2009-08-27 at 18:06 -0400, Devin Heitmueller wrote:
> > On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> > Chehab<mchehab@infradead.org> wrote:
> > > Em Thu, 27 Aug 2009 21:36:36 +0300
> > > Ville Syrjälä <syrjala@sci.fi> escreveu:
>
> > Since we're on the topic of IR support, there are probably a couple of
> > other things we may want to be thinking about if we plan on
> > refactoring the API at all:
> >
> > 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> > only have the second byte. In theory, they should have both bytes
> > since the vendor byte helps prevents receiving spurious commands from
> > unrelated remote controls. We should include the ability to "ignore
> > the vendor byte" so we can continue to support all the remotes
> > currently in the ir-keymaps.c where we don't know what the vendor byte
> > should contain.
>
> Since I uncovered this in my research, I thought I'd share...
>
> RC-6A has a third (or thrid and fouth) byte:
>
> http://www.picbasic.nl/frameload_uk.htm?http://www.picbasic.nl/info_rc6_uk.htm
>
> for the "Customer Identifier".
>
> It appears that the mode bits in the header determine if RC-6 (mode 0)
> or RC-6A is in use. The position of the mode bits in the header are
> documented here:
>
> http://www.sbprojects.com/knowledge/ir/rc6.htm
>
> I'm guesing some MCE remotes use RC-6A. When I get CX23888 IR support
> to the point of actually working, I'll check both of my MCE remotes.
Andy,
If you look at the get_key functions at ir-kbd-i2c, you'll see that some
remotes (and/or maybe the ir decoding chip) sends code with up to 6 chars (some
bits were used there for keycode sync). So, probably, there are already some
rc6 IR's around.
While it would theoretically be possible to still use
EVIOCGKEYCODE/EVIOCSKEYCODE for handling 24 or 32 bits scan codes at the way I've
proposed, I suspect that this won't scale. In order to get the current keycode
table, userspace needs to do something like:
for (i = 0; i <= LAST_SCANCODE; i++)
ioctl(fd, EVIOCGKEYCODE, codes);
On a set operation, it will do about the same loop 4 times - since internally a
set operation also calls a get, and since we need first to clean the entire
table before adding the new codes (so, we'll have 2^32 to 2^34 get/set
operations).
On my tests, with MAX_SCANCODE of 0xffff (the maximum currently supported by
dvb-usb), this happens really fast. Still, this is not an efficient code, since a
real table size is generally lower than 40 scancodes wide, but as keycode table
load is not a frequent operation (generally, it will happen only during boot
time, on a real case), I don't think we should bother with optimizing it for
2^16.
I haven't tested, but I doubt that seeking for a 4 byte scancode would be fast
enough, since it is a wild goose chase to seek for 40 valid codes in the
middle of 2^32 to 2^34 codes, during a keycode table load/save operation.
I can see a few possible solutions for it:
1) send some IR mask to the driver (or hardcode the mask) for the driver to
filter just the valid the IR codes, and use a 16 bit scancode for it. This will
use a strategy similar to what we currently have at ir-common, and could mean
that we'll have to discuss the approach again some years later;
2) create some EVIOCGKEYCODE/EVIOCSKEYCODE variants that will be based on a sequencial
index, not based on scancode.
3) create some table load/save methods at the input system, to allow
changing the entire table at once, maybe using an approach similar to
request_firmware.
Currently, V4L drivers have their IR tables declared as:
u32 ir_table[IR_KEYTAB_SIZE]; /* IR_KEYTAB_SIZE is the size of the scantable, currently 128 */
while dvb-usb (and some other DVB drivers) use:
struct dvb_usb_rc_key {
u8 custom,data;
u32 event;
};
In order to implement the second approach, the better would be to use something like:
struct {
be32 scancode;
u32 keycode;
};
It shouldn't be hard to write a few scripts for doing this conversion for both
DVB and V4L type of tables.
Even if we opt for a different approach, I still think that the better is to
merge "custom" and "data" at scancode, since it would be easier to extend
the number of bits, if later needed.
Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 39+ messages in thread* Re: [RFC] Infrared Keycode standardization
@ 2009-08-28 14:02 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 39+ messages in thread
From: Mauro Carvalho Chehab @ 2009-08-28 14:02 UTC (permalink / raw)
To: Andy Walls
Cc: Devin Heitmueller, Ville Syrjälä,
Linux Media Mailing List, Linux Input
Em Fri, 28 Aug 2009 07:41:22 -0400
Andy Walls <awalls@radix.net> escreveu:
> On Thu, 2009-08-27 at 18:06 -0400, Devin Heitmueller wrote:
> > On Thu, Aug 27, 2009 at 5:58 PM, Mauro Carvalho
> > Chehab<mchehab@infradead.org> wrote:
> > > Em Thu, 27 Aug 2009 21:36:36 +0300
> > > Ville Syrjälä <syrjala@sci.fi> escreveu:
>
> > Since we're on the topic of IR support, there are probably a couple of
> > other things we may want to be thinking about if we plan on
> > refactoring the API at all:
> >
> > 1. The fact that for RC5 remote controls, the tables in ir-keymaps.c
> > only have the second byte. In theory, they should have both bytes
> > since the vendor byte helps prevents receiving spurious commands from
> > unrelated remote controls. We should include the ability to "ignore
> > the vendor byte" so we can continue to support all the remotes
> > currently in the ir-keymaps.c where we don't know what the vendor byte
> > should contain.
>
> Since I uncovered this in my research, I thought I'd share...
>
> RC-6A has a third (or thrid and fouth) byte:
>
> http://www.picbasic.nl/frameload_uk.htm?http://www.picbasic.nl/info_rc6_uk.htm
>
> for the "Customer Identifier".
>
> It appears that the mode bits in the header determine if RC-6 (mode 0)
> or RC-6A is in use. The position of the mode bits in the header are
> documented here:
>
> http://www.sbprojects.com/knowledge/ir/rc6.htm
>
> I'm guesing some MCE remotes use RC-6A. When I get CX23888 IR support
> to the point of actually working, I'll check both of my MCE remotes.
Andy,
If you look at the get_key functions at ir-kbd-i2c, you'll see that some
remotes (and/or maybe the ir decoding chip) sends code with up to 6 chars (some
bits were used there for keycode sync). So, probably, there are already some
rc6 IR's around.
While it would theoretically be possible to still use
EVIOCGKEYCODE/EVIOCSKEYCODE for handling 24 or 32 bits scan codes at the way I've
proposed, I suspect that this won't scale. In order to get the current keycode
table, userspace needs to do something like:
for (i = 0; i <= LAST_SCANCODE; i++)
ioctl(fd, EVIOCGKEYCODE, codes);
On a set operation, it will do about the same loop 4 times - since internally a
set operation also calls a get, and since we need first to clean the entire
table before adding the new codes (so, we'll have 2^32 to 2^34 get/set
operations).
On my tests, with MAX_SCANCODE of 0xffff (the maximum currently supported by
dvb-usb), this happens really fast. Still, this is not an efficient code, since a
real table size is generally lower than 40 scancodes wide, but as keycode table
load is not a frequent operation (generally, it will happen only during boot
time, on a real case), I don't think we should bother with optimizing it for
2^16.
I haven't tested, but I doubt that seeking for a 4 byte scancode would be fast
enough, since it is a wild goose chase to seek for 40 valid codes in the
middle of 2^32 to 2^34 codes, during a keycode table load/save operation.
I can see a few possible solutions for it:
1) send some IR mask to the driver (or hardcode the mask) for the driver to
filter just the valid the IR codes, and use a 16 bit scancode for it. This will
use a strategy similar to what we currently have at ir-common, and could mean
that we'll have to discuss the approach again some years later;
2) create some EVIOCGKEYCODE/EVIOCSKEYCODE variants that will be based on a sequencial
index, not based on scancode.
3) create some table load/save methods at the input system, to allow
changing the entire table at once, maybe using an approach similar to
request_firmware.
Currently, V4L drivers have their IR tables declared as:
u32 ir_table[IR_KEYTAB_SIZE]; /* IR_KEYTAB_SIZE is the size of the scantable, currently 128 */
while dvb-usb (and some other DVB drivers) use:
struct dvb_usb_rc_key {
u8 custom,data;
u32 event;
};
In order to implement the second approach, the better would be to use something like:
struct {
be32 scancode;
u32 keycode;
};
It shouldn't be hard to write a few scripts for doing this conversion for both
DVB and V4L type of tables.
Even if we opt for a different approach, I still think that the better is to
merge "custom" and "data" at scancode, since it would be easier to extend
the number of bits, if later needed.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 39+ messages in thread