Configure your tv card on linux
This faq is for people using debian and distributions which are based on (ubuntu, xandros etc). Unless otherwise noted against the following commands will require administrator rights and should be launched as root or via sudo.
This faq was made for the card Winfast TV 2000 XP on debian lenny and remote its remote control Leadtek Y0400046.
Step1: Card Installation
Bttv module used for this map is provided directly by the linux-image package. Just configure it according to the model of the TV card. To do this we create / fix / etc / modprobe.d / bttv and put in:
options bttv radio=0 card=34 tuner=24 gbuffers=8
Warning: This is specific to the TV card and so it will probably fix it if you use another card model.
So that the module is loaded at startup it also fixes / etc / modules by adding in the bttv module. You can already load the bttv module by typing:
modprobe bttv
In my case the device associated with the TV card is / dev/video0
Step 2: Tvtime Installation
There are several software to watch TV under linux. KdeTV I tried but unfortunately with my card, a green strip appears on the right side of the image in full screen mode for a reason quite obscure.
Sub tvtime, no problem, everything works perfect. To install
aptitude update
aptitude safe-upgrade
aptitude install tvtime
So now you have to launch TVTime to scan the TV channels with time (everything can be done with the mouse). If the tuner and card are properly configured at the time to load the bttv module that should not be a problem. In my case
- Video source: TV
- Sound Mode: pal-i
- Standard received: secam
Step 3: Remote control configuration
This is where everything becomes complicated. So that the remote is supported is through lirc.
However, the use of lirc is quite complex for the novice and the few tutorials that I could not pass the general public or news. In particular it is frequently made to a module that no longer exists lirc_gpio on recent kernels.
Lirc Installation
We start by installing the module that will allow the management of the remote. I recommend you go through module-assistant, and archives available on the website of lirc are unlikely to compile unless you have compiled your own kernel.
aptitude install module-assistant lirc-modules-source lirc-x
module-assistant
In the interface module wizard, choose lirc-modules-source (Get, Build, Install). If everything went well assistant module-A module was packaged as a debian package in / usr / src and installed.
If all goes well the card is visible when you type the command:
cat /proc/bus/input/devices
In my case:
...
I: Bus=0001 Vendor=107d Product=6606 Version=0001
N: Name="bttv IR (card=34)"
P: Phys=pci-0000:01:07.0/ir0
S: Sysfs=/class/input/input6
U: Uniq=
H: Handlers=kbd event6
B: EV=100003
B: KEY=10afc336 2150a48 0 0 0 404 80010007 80000190 4801 1e0000 4400 100000 10000ffc
...
It is important to raise the device that has the remote. Indeed it little different in your case, you have to adapt accordingly in what follows. In the following, I consider it event6.
lircd -d /dev/input/event6 -H dev/input
This command creates the device / dev / lircd to be used by lircd to receive signals from the remote.
Then correct the file / etc / lirc / hardware.conf so to have:
#Chosen Remote Control
REMOTE="Winfast TV2000/XP (card=34)"
# Arguments which will be used when launching lircd
LIRCD_ARGS=""
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false
#Try to load appropriate kernel modules
LOAD_MODULES=true
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="dev/input"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE="/dev/input/event6"
MODULES=""
# Default configuration files for your hardware if any
LIRCD_CONF="/etc/lirc/lircd.conf"
LIRCMD_CONF=""
Attention to correct variables and REMOTE DEVICE according to your hardware! Then (re) launche lirc:
/etc/init.d/lirc restart
First Test
At this stage it is usually possible to begin to recover the signals from the remote with the IRW. This program can be launched by user. While running, you can press the buttons on the remote control to retrieve the IDs of keys (in bold below) that will be used in configuration files lirc. These identifiers depend on the remote. For example at home, here is what appeared in pressing the "channel +", "finetune +", "8", "6" and "5":
(mando@aldur) (~) $ irw
0000000080010192 00 CH_UP Leadtek-RM0010
000000008001004e 00 FINETUNE+ Leadtek-RM0010
0000000080010009 00 8 Leadtek-RM0010
0000000080010007 00 6 Leadtek-RM0010
0000000080010006 00 5 Leadtek-RM0010
Now we must tell lirc how these signals.
Note: When lirc_gpio was created, this module creates a device / dev / lirc and it was possible to use mode2 codes to retrieve keys. For me this device no longer exists and the mode2 does more.
Configure Lirc
Can be reclaimed on the site of a map lirc remote almost usable. You can download an archive here containing many files can be used to fill / etc / lirc / lircd.conf
http://www.lirc.org/remotes.tar.bz2
In my case I used one of the remote Y0400052 because I do not have much courage to rebuild. Here is what my / etc / lirc / lircd.conf:
#/etc/lirc/lircd.conf
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.8.3-CVS(dev/input) on Sat Jan 12 17:04:54 2008
#
# contributed by: Mike Treichler
#
# brand: LeadTek
# model no. of remote control: Y0400046 (bundled with Winfast 2000XP Deluxe)
# devices being controlled by this remote: LeadTek Winfast 2000XP Deluxe
# brand: Leadtek
# model: Y0400052 (bundeled with Winfast PVR2000 TV-card)
#
# Note: Only CH_UP, CH_DOWN, VOL_UP and VOL_DOWN will repeat. This
# seems to be a limitation of the remote control.
begin remote
name Leadtek-RM0010
bits 16
eps 30
aeps 100
one 0 0
zero 0 0
pre_data_bits 16
pre_data 0x8001
gap 423871
toggle_bit_mask 0x0
begin codes
POWER 0x0074
MTS 0x0188
TV/FM 0x0182
VIDEO 0x0189
DISPLAY 0x0166
CH_UP 0x0192
CH_DOWN 0x0193
VOL_DOWN 0x0072
VOL_UP 0x0073
FULLSCREEN 0x0174
TELETEXT 0x0184
SLEEP 0x008E
BOSSKEY 0x0163
MUTE 0x0071
RED 0x018E
GREEN 0x018F
YELLOW 0x0190
BLUE 0x0191
1 0x0002
2 0x0003
3 0x0004
4 0x0005
5 0x0006
6 0x0007
7 0x0008
8 0x0009
9 0x000A
0 0x000B
. 0x0034
FINETUNE+ 0x004E
FINETUNE- 0x004A
PIP 0x00E2
ENTER 0x001C
RECALL 0x0195
BACK 0x019C
PLAY 0x00A4
NEXT 0x0197
TIMESHIFTING 0x0169
STOP 0x0080
REC 0x00A7
SNAPSHOT 0x00EA
end codes
end remote
I said that if you use the same remote keys BOSS KEY, PIP, color (green, red, blue, yellow), ZZ and VCR buttons are poorly recognized (but anyway they are not very useful so good ... ). Anyway the IRW or irrecord can fix it, I leave that to the brave ... Example:
0000000080010192 00 CH_UP Leadtek RM0010 -
... corresponds to the line
CH_UP 0x0192
Configure the behavior of buttons
At this stage the key codes are properly associated with identifiers, but it does not use lirc provided (that would be too easy ...).
Now we must intercept these events or with irexec, either with irxevent and transmit to the various software launched. This is done with rules. They define what will happen when you press a particular key. Things to Remember:
- Irexec allows to run a command shell
- Irxevent can launch the equivalent of an action on the keyboard (perhaps to a particular application).
This is not necessarily intuitive, is that the two programs read the same configuration file, by default ~ /. Lircrc. They must run in the background to run (demons). Each found his ball with the tag "prog" (see below).
Example
These two rules are equivalent: under tvtime, key f can switch to full screen.
a) with irxevent:
begin
prog = irxevent
button = FULLSCREEN
config = Key f tvtime
end
b) with irxevent:
begin
prog = irexec
button = FULLSCREEN
config = tvtime-command TOGGLE_FULLSCREEN
end
These rules are usually in ~ /. Lircrc. Personally I put in / etc / lirc / lircrc, allowing them to share all the profiles of the machine. Then create a symbolic link in its home.
ln-s / etc / lirc / lircrc ~ /. lircrc
Whichever method is chosen, we must not lose sight of the key identifiers contained in ~ /. Lircrc and / etc / lirc / lircd.conf must be consistent otherwise nothing will happen!
Here's an example what a ~ /. Lircrc consistent with the example that I presented to pilot tvtime:
begin
prog = irexec
button = CH_DOWN
config = tvtime-command CHANNEL_DOWN
end
begin
prog = irexec
button = CH_UP
config = tvtime-command CHANNEL_UP
end
begin
prog = irexec
button = VOL_DOWN
config = tvtime-command MIXER_DOWN
end
begin
prog = irexec
button = VOL_UP
config = tvtime-command MIXER_UP
end
begin
prog = irexec
button = FULLSCREEN
config = tvtime-command TOGGLE_FULLSCREEN
end
begin
prog = irexec
button = 1
config = tvtime-command CHANNEL_1
end
begin
prog = irexec
button = 2
config = tvtime-command CHANNEL_2
end
begin
prog = irexec
button = 3
config = tvtime-command CHANNEL_3
end
begin
prog = irexec
button = 4
config = tvtime-command CHANNEL_4
end
begin
prog = irexec
button = 5
config = tvtime-command CHANNEL_5
end
begin
prog = irexec
button = 6
config = tvtime-command CHANNEL_6
end
begin
prog = irexec
button = 7
config = tvtime-command CHANNEL_7
end
begin
prog = irexec
button = 8
config = tvtime-command CHANNEL_8
end
begin
prog = irexec
button = 9
config = tvtime-command CHANNEL_9
end
begin
prog = irexec
button = 0
config = tvtime-command CHANNEL_0
end
Once the file is completed or corrected, on (re) launches irexec and irxevent in the background to be considered:
irxevent -d /etc/lirc/lircrc
irexec -d /etc/lirc/lircrc
Autorun
To avoid having to start at every restart, the simplest is to start automatically when you log. For example in KDE, just create a file ~ / .kde / Autostart / remote.sh and put in:
#! / bin / sh
irxevent-d / etc / lirc / lircrc
irexec-d / etc / lirc / lircrc
Then we put in execution rights:
chmod u + x ~ / .kde / Autostart / remote.sh
You can check ubuntu forums for more details!