Zapping · ZVBI | |
Zapping supports the LIRC (Linux Infrared Remote Control)
infrastructure. Visit http://www.lirc.org for more information about LIRC.
To use LIRC you must create a .lircrc
file in your
home directory. For each remote control button add an entry
like these:
begin prog = zapping_lirc button = VOL_UP config = zapping.volume_incr(+5) end begin prog = zapping_lirc button = 0 config = SETCHANNEL 0 end begin prog = zapping_lirc button = 1 config = SETCHANNEL 1 end begin prog = zapping_lirc button = 9 config = SETCHANNEL 9 end
zapping_lirc
./etc/lircd.conf
, this file
lists all available buttons.Suppose your remote control has a TV/RADIO
button and you want to switch between two layers of commands,
much like Shift Lock switches between lower and upper case
characters. This can be accomplished by embracing the entries
above within a zapping_lirc
section, and
programming the TV/RADIO
button to enable this
section, "switch to this mode" in LIRC speak.
begin zapping_lirc begin button = TV/RADIO mode = radio end Zapping entries … end zapping_lirc begin radio begin button = TV/RADIO mode = zapping_lirc end Other entries … end radio Mode-independend entries …
Which mode will be initially selected? Well, none. But when
you start Zapping it automatically switches to
zapping_lirc
mode, if such a section exists.
LIRC applications are
supposed to cooperate by using .lircrc
, but there
is no way (or was, at the time the LIRC plugin was written) two
applications can agree on the current mode, so they may both
respond to a button press.
For further instructions please see the LIRC documentation.
Editing a config file isn't exactly what users of Gnome app should have to do. By default Zapping should find out which model of RC the user has and automatically assign actions to each button. If that's not possible it should prompt the user with a list of known models. In any case actions must be editable, and zapping should provide a GUI which lists all buttons and their current action. That being either a simple description like "Go to next channel" from a list or menu, or a Python command for experienced users.
SETCHANNEL
is particularly odd. We take for
granted that all keyboards send the same key codes, at least
for the standard keys. Why can't LIRC do that? Life would be
easier if Zapping could handle number keys collectively.
Why do we have to store our configuration in
.lircrc
anyway? It would be easier to register
modifiers like TV/RADIO
with the lirc daemon, to
synchronize clients, then filter button events and translate to
actions ourselves.
Another issue: buttons may change their function depending
on the Zapping mode Video, Teletext, EPG, Recording etc.
SETCHANNEL
could change semantics, but in the long
run we probably need more LIRC modes.