2004-06-19 15:18:38

by Darren Hart

[permalink] [raw]
Subject: IR Remotes under 2.6

I had some thoughts regarding the >=2.6.6 approach to handling remotes
as keyboards (specifically the ir-kbd-i2c driver).

1) First, I believe the kernel can really only recognize the receiver,
not the remote. This means that one receiver could be used for several
different remotes (like with the Hauppauge PVR-[23]50 for example which
has at least 3 different remotes that I am aware of). Unfortunately,
the keytabs are hardcoded into the kernel (ir-common.c). IMO, the
system would be much more useful if a keytab could be loaded in much the
same way some USB devices load firmware.

2) The current hardcoded keytabs use KEY_* event codes. IMO people
don't think of remotes as keyboards, the closest parallel would be more
like a joystick. My remote has keys that are bound to keyboard keys
that I don't like, but unless I recompile the kernel I can't really
change that. It seems to me that remotes should use BTN_* event codes
rather than KEY_* codes. That way all the buttons on the remote can be
configured. As KEY_* codes, I find that X grabs the ones it recognizes
before I can assign them a function. The '0' button for instance always
sends a 0 to the focused window. There are many situations where a user
would want 0 on the remote to behave differently than 0 on their
keyboard. The use of BTN_0 would make it configurable through userspace
applications such as the gnome media keys or lirc (although once more
apps have input event support, lirc wouldn't be necessary at all).

Thoughts?

Thanks,

Darren Hart


2004-06-19 17:53:44

by Brad Campbell

[permalink] [raw]
Subject: Re: IR Remotes under 2.6

Darren Hart wrote:
> I had some thoughts regarding the >=2.6.6 approach to handling remotes
> as keyboards (specifically the ir-kbd-i2c driver).
>
> 1) First, I believe the kernel can really only recognize the receiver,

> Thoughts?

Something completely different.. Perhaps userspace?

I'm using a streamzap USB ir remote with lirc. I have a modified version of Nils Faebers kbdd
package that does the translation and injects the packets into /dev/misc/uinput.
Whammo. Userspace IR remote to keyboard translator.

You may want to do it in kernel space however. I'm just throwing it out there.
Modified version here http://www.wasp.net.au/~brad/kbdd-lirc-0.01.tar.gz
Ugly and bad code is most probably mine :p)

If you have a good reason to keep it in kernel space, them my argument is null and void :p)
It's nice being able to specify Remote->Key maps on a per app basis depending on what you are
running at the time.

Makes controlling bash scripts using dialog really easy by remote :p)

Regards,
Brad