Introduction

Winfast and Hauppauge remotes supported in kernel

Kernel version remote control support for Leadtek Winfast remote controls, shipped with both bttv and cx88 cards, and for Hauppauge Remote Control (the newer, gray remotes; seems there are multiple slightly different versions), shipped with cx88 and ivtv cards, was added in 2.6.12:

ir-kbd-gpio and ir-kbd-i2c don't support all the cards that lirc supports
(yet), mainly for the reason that the code of lirc_i2c and lirc_gpio
was very confusing and I decided to basically start over from scratch.
Feel free to contact me in case of trouble. Note that the ir-kbd-*
modules work on 2.6.x kernels only through ...

How it works

The modules register the remote as keyboard within the linux input
layer, i.e. you'll see the keys of the remote as normal key strokes
(if CONFIG_INPUT_KEYBOARD is enabled).

Using the event devices (CONFIG_INPUT_EVDEV) it is possible for
applications to access the remote via /dev/input/event<n> devices.
You might have to create the special files using "/sbin/MAKEDEV
input". The input layer tools mentioned above use the event device.

The input layer tools are nice for troubleshooting, i.e. to check
whenever the input device is really present, which of the devices it
is, check whenever pressing keys on the remote actually generates
events and the like. You can also use the kbd utility to change the
keymaps (2.6.x kernels only through).

Using with lircd

Using without lircd

XFree86 likely can be configured to recognise the remote keys. Once I
simply tried to configure one of the multimedia keyboards as an input
device, which had the effect that XFree86 recognised some of the keys
of my remote control and passed volume up/down key-presses as
XF86AudioRaiseVolume and XF86AudioLowerVolume key events to the X11
clients.

It likely is possible to make that fly with a nice xkb config file,
I know next to nothing about that through.

Note that the linux keyboard driver interface (the really old one, not the linux input layer added in 2.4) has a limitation on the number of keys it can distingish -- it's 200 plus something. That is inherited from PS/2. As long as X11 still used the old kbd driver instead of the linux input layer, it will have problems supporting all keys :-/

Have fun,

Gerd

--
Gerd Knorr <kraxel@bytesex.org>

How to add remote control support to a card

The operation is as follows (at least it is how i did it):

you make detinitions of your board to have remote control (in saa7134-cards.c).

in saa7134-input.c, you add a case for it into the switch statement, with mask_keycode=0. Use any ir_codes array for the start. Well, you should also determine whenever polling is needed, too.

Load saa7134 module with ir_debug=1 parameter.

press the keys on your remote control and watch syslog (dmesg). You will see something like

build_key gpio=0x12345 mask=0x0 data=0

in dmesg output after each key press/release.

Pay attention to gpio=0x... stuff. You will see some bits which does not change, and some which do. The ones which changes should be in your mask_keycode and mask_keydown (mask_keycode should contain not more than 8 bits set to 1, others should be set to 0). Mask_keyup and mask_keydown - those are easy to determine if you see some bit is always on when you press a key and off when you release it, or the reverse.

Ie, you will have to determine which bits in gpio value represents the key# pressed/released, and which indicate whenever it is the
press or release.

After this, recompile saa7134 module with correct mask_* stuff in your saa7134_input_init1() routine. Now, the dmesg output should look like

build_key gpio=0x12345 mask=0x<mask_value> data=5

Ensure the data= value is different for each key, if not, you'll have to modify mask_keycode again.

Next, build the key table, by writing a file with one line for every of your key, with two fields -- key name and the data=value assotiated with it.