10/2001

dgi productions presents

Installing FlyVideo 98' on a linux box


What's this?
This page is the story of how of how I  fully installed a FlyVideo 98' card on my linux box. You can follow the steps for using the FlyVideo completely. It will tell you how to compile a kernel, configure the modules, install LIRC and xawtv.
Currently on my computer I have ManDrake 7.2 with a 2.4.3 kernel, which I compiled my self, I added to it LIRC modules (to get the control remote working),  xawtv 3.30 which I needed to compile myself, because the version which comes in Mandrake 7.2 is not compiled with LIRC support.

I use the remote control also to control xmms. There is a plug-in which lets you control xmms with LIRC. I use the channels up/down to change songs and volume up/down to change the volume and Mute to pause, Enter and Cancel (the 2 buttons or either side of the 0) to start playing and stop playing.

I also use irexec to execute xawtv with the power button. I use a script which the first time you run it, it will execute xawtv. The second time it will call xawtv-remote EXIT, so the only thing I needed to do is configure irexec so that each time I press power it will call that script. The reason why I did this is that when irexec calls xawtv (with the power button) and xawtv exits with the same button,  when I power down the TV it gets powered on again by irexec. Is there a better way? Click here to d/l the scripts.

I want to configure the remote control so that when I am at KDM it will log in as TV (by pressing a button) and then the user TV will  run xawtv in full-screen. When I press power again, it will exit back to KDM, and then to shut down the computer I just need to press again power from the remote control. I would be better if I had APM (I have an old 233 MHz whit no APM). If somebody knows how that can be done contact me. What I want to do is something like this:

/etc/X11/prefdm will point to a script which:

  •  runs xkbset , configured to emulate the keys "tv\ntv\n" (user tv, paswoord tv)
  • When a key is pressed some keys are passed to the topmost window (kdm). How do I do it?
  • when the user tv logs in, it will run a small scrcipt that will execute xawtv  wait a second (or two...) and then calls xawtv-remote fullscreen, to set the TV on full screen. xawtv and lirc will be configured to close the TV app when the POWER button is pressed. No desktop of window manager at all.
  • After the user logs out, the X server will be closed (default beheaviour of X?) and restarted with xkbset.
  • Now the user will be able to close the computer with POWER button, by executing halt or init 6.
  • I also had some problems when running FBTV (frame buffer application for streaming video). I had no sound. Then it hit me!!!  The tuner module was working and even the mixer of the TV Card, but the TV card is connected to the Sound Card which it was not working (no module/program asked it so it was never inserted into the kernel and by that it was not working...). So I had to change the /etc/modules.conf so that tuner will need also sound. Then it worked flawlessly.

    I also configured xawtv and fbtv to use the same channels as the memir in Matav/Gvannim. You can get it here.

    Compiling a kernel
    Is always a good idea.  Recent distros have 2.4 kernel so it's not so important to upgrade, but you will still need a configured kernel source.
    You can get the latest version in http://www.kernel.org. Israel users can get it here . (Iglu mirror). The best idea is to get the latest kernel and patching it . Move it to /usr/src and type:

       gzip -cd linux-kernel-version-minorversion.tar.gz | tar -xfv

    and this will decompress the kernel source. bzip users should replace gzip with bzip2, bzip2 is better because it is smaller which means that you have less to download from the net. Something good for people like me with a slow internet connection.

    The source decompress itself to a  new directory called linux .  In most systems it is a symbolic link to the real kernel (so you can have the source of 2.2.17 and 2.4.3).  Some systems depend on kernel headers to supply other stuff, for example a compiler. This is in the case of Mandrake and RedHat. So sometimes you have the headers of a really old kernel and a new Kernel. I had this on RedHat 6 and now on ManDrake 7.2. I recommend to unlink the corresponding directory and then uncompress the kernel, and then rename the directory linux to linux-your_kernel_verion ,  and then link the directory back to the new kernel you just decompressed.

    Now type 

        make xconfig
     
    This will open a menu in X for configuring the kernel. On console you can run

        make menuconfig

    1. You need to change the processor type (for 2.4 kernel series the default is Pentium III). If you choose the wrong one the kernel will not load. happened to me. (I have an MMX computer)
    2. In Loadable module support YES.
    3. In I2O  device support, I2O as module.
    4. In Character devices, I2C support, I2C bit-banging interfaces as module.
    5. MutiMedia devices. Video4Linux module.
      1. BT848 Video4linux module.
    6. In sound, Sound Card support as Module.
      1. Choose you sound card. and set it as module also.
      2. TVCard (bt848) mixer support also as module.
    If you need other stuff,  add them as modules. If you don't know how, ask somebody who knows, or read the fucking manuals. You will need them for configuring the net stuff.
    Now, in the main menu there is a button for exiting and  saving. If you want to compile the kernel at a shell type:

       make dep && make bzImage

    If you are building LIRC for a pre-compiled kernel, you do not need to rebuild the source: just configure it and make the dependecies for it. If it is under /usr/src/linux the lirc ./configure script will use it and will compile OK.

    Installing a kernel and configuring it right
    There are many ways to install, a kernel. This is my own way.  You can also use linuxconf. Look it out.
    Make a new directory /boot/2.4. cd arch/i386/boot. copy vmlinuz into /boot/2.4. If you dot know how to do these things do as I do. Type  at the prompt mc and you have a Norton Commander. easy for ex-dos users.
    Now edit /etc/lilo.conf. Again I use Midnight Commander. But vi or emacs or kwrite or gedit are also cool. Add these lines to the file:

    image=/boot/2.4/bzimage
    label=linux-24
    root=/dev/hda9
    Note that this is my root  partition, probably yours is different. Change it to yours.
    Now type lilo. And you have the new kernel installed. Reboot the computer. At the lilo prompt choose the new kernel.
    cd /usr/src/linux. and type:
    make modules && make modules_install.
    This will install the modules.  If you want you can do it even before the boot. This will be usefull if you hate rebotting. Now we need to setup the BT848 module for FlyVideo card. Edit /etc/modules.conf you should add something like:
     
    alias char-major-81 bttv
    pre-install bttv modprobe -k tuner
    options tuner type=1
    If you can not see anything in xawtv add
    options bttv card=30 pll=1
    card 30 is FlyVideo 98 (if not auto detected) and pll=1  is something about the PLL crystal, which I dot really understand why, but it works. The card can be omited in most cases, add it when it does not work and you really know your TV-Card manufactor. The PLL steeing are right for israel PAL-B. If you are not in Israel, try moving here, or just changing the PLL setting until it will be OK.

    If you can't hear sound add to the bttv pre-install modprobe -k sound , or as your system calls it. On Mandrake 7.2 it called sound-slot-0 while in RedHat 6 just sound. This will activate the sound card each time you use the TV (Fly Video is connected to some input on the sound card).

    LIRC Background
    Linux Infrared Remote Control is not a part of the kernel. It is just development driver for all types of remote controls. FlyVideo 98 works fine for me. It needs the kernel sources, that's the reason for the Kernel compilation. Get it from here .
    The FlyVideo driver needs Video4Linux BT848 source code and includes. It will look for it on /usr/src/linux (I think). It will make 2 kernel modules modules, and a daemon for reading information about it.

    How LIRC works?
    Since every remote  control generates another code all are translated into text , and a user application should expect a string, like POWER or VOL_UP. This way it will work with a correctly configured remote control. But here it gets worse Not all remote controls have the same buttons. Most have the same basic ones, but the rest are unike to that device (for example a VCR remote control and the FlyVideo control), So the application instead of reading the button pressed (scancode or an string generated containing the button name), it should read a string from another device, that string should say the application what action to do.

    For example:
    When you press VOL + you should send the TV application the string  "VOLUME INC"
    These things are done from /dev/lircd and ~/.lircrc .
    The daemon is the one that translates the key presses to strings in  / dev/lircd , ~./lircrc is the file from which it gets the configuration . So it should be run in the system start. I will explain later how.

    Compiling LIRC
    Unpack the LIRC source. Much like the kernel, into /usr/src. cd LIRC-VERSION, latest version is 0.6.4. Type ./setup. This will bring up the setup dialog. Change the first option (driver configuration) to TVCard, and choose FlyVideo. I like to install software to /usr and not to /usr/local, so I run ./configure.sh --prefix=/usr.  If you don't bother installing to /usr/local you can just type ./configure.sh instead of all this mess....

    After configuration,  compile and install (make && make install).
    Edit /etc/modules.conf to contain:

    alias char-major -61 lirc_gpio
    pre-install lirc_gpio modprobe -k lirc_dev
    The code for FlyVideo remote control was separated once but now is in lirc_gpio.o. The installation also made a /usr/etc/lircd.conf which translates the codes send from the remote control to the Infra-Red device, into strings (for example POWER ==0x00,  FULL_SCREEN==0x08 and so on).

    Testing the remote control
    The program which translated the codes into string should be run. This daemon is called LIRCD . In the contrib directory there are some scripts to add to the directory /etc/rc.d/init.d . (this way Infrared device support is part of the boot sequence, a real good one :)  You should copy the correct script to your distro into that directory. Then link it into the run levels that you want. I have rc4.d/S01lirc and rc5/S01lirc. You need these names because the /etc/rc.d/rd init script depends on it. If you installed in /usr and not in /usr/local (default) you should edit the script manually (I did). BTW: also change the script name to lirc.

    This will load The Infrared devices on the startup and if you configured the modules right it will load automatically all the kernel modules needed. If not you will have to dig up.
    For now to simply test it type init -Q (reread /etc/rd.d/init.d ) . Now type lsmod. This is my lsmod (kernel 2.4.3):

    Module                  Size  Used by
    lirc_gpio               4752   1  (autoclean)
    lirc_dev                8048   1  (autoclean) [lirc_gpio]
    es1370                 27232   1  (autoclean)
    soundcore               4336   4  (autoclean) [es1370]
    ide-cd                 26192   1  (autoclean)
    cdrom                  27232   0  (autoclean) [ide-cd]
    isofs                  18576   1  (autoclean)
    vfat                   10512   4  (autoclean)
    fat                    31520   0  (autoclean) [vfat]
    tvaudio                 8240   0  (autoclean) (unused)
    bttv                   58864   0  [lirc_gpio]
    tuner                   4160   1  (autoclean)
    videodev                5088   2  [bttv]
    i2c-algo-bit            7232   1  [bttv]
    i2c-core               13232   0  [tvaudio bttv tuner i2c-algo-bit]
    Now type /etc/rc.d/rd/lirc status (or what ever you called it). It should say if is installed or not. If it is still not just type lircd. Which will activate the daemon. For the test itself just type "irw", and press the remote control buttons. You should see each button press on the screen. To quit the program just type CTRL-C (break the program, since the program will quit by itself only on error). I also recommen chmod 666 /dev/lirc* , so that  everybody will be able to enjoy lirc and not just root .

    Seeing TV
    Now you will need to install xawtv, or compile yourslef. The latest is better since pre-copmiled binaries do not have always LIRC support on. Install by rpm:

    rpm -i xawtv-whateverversionyouhave.rpm
    From source it's just:
    ./configure --prefix=/usr
    make
    make install
    Official xawtv packed TGZ can be builded into RPM's
     rpm -tb xawtv-version.tgz

    The RPM's will be on /usr/RPM/RPMS/i586/ or something else. Look it up. Then install those RPM.

    If you have installed LIRC the compilation will support also the remote control also.

    Run xawtv (just type xawtv at a terminal or run it from KDE/GNOME menu). When it load up press the letter E. This will bring up the channel editor. Use it to find channels. You can find here pre-definied channels for Matav-Gvanim (Israel) written by me. 

    To see the TV in full screen type F. If you see an ugly window instead, and the image is small in the middle quit the program and edit ~/.xawtv, you will need to add a FullScreen=640x480 seccion. If you like higher resolution change it. My XFree86 3.36 crashed with 320x240.  Now you should be able to run xawtv in full-screen mode. Full screen means that you see no windows, only the TV image on the hole screen and not a small image in the middle (that is what happens if you do not set FullScreen). Otherwise it a bug. Contact Gred knorr <kraxel@goldbanck.in.berlin.de>.
     

    Using the Remote control
    Now the only part left to do is use the remote control. I will explain how to use ierxec first. irexec is a daemon which can execute bash commands on  a keypress. It could be used to opeb the TV application or xmms, log of a user or even shut down the computer. Open an editor and write this:

    begin
        prog = irexec
        button = 1
        config = echo "You pressed the buton 1"
    end

    Save it as ~/.lircrc. After it's been saved run irexec and press the button "1" on your control remote (if you have one... otherwise just change the button name to one that your comtrol remote supports, the full list is on /usr/etc/lircd ).  The prog tag names the application that will handle this button. Each lirc client (a program that uses lirc )  registers itself with the program name. Basicly it's the application name. This means that if a few programs that support lirc are running in the same time and you press a button in the remote control all will get it. I had this problem when the POWER button closed both xmms and xawtv. I decided that xmms swill stop using the POWER button...

    You can also configure the remote control to move the mouse. RTFM in lirc on that. I dit have not tired to do it, since it seems usless to me.

    There is a plugin for xmms for controling it with lirc . Get it from http://www.xmms.org in the Plugins/Misc secction. It comes as source only, so you will need to compile. It's a small compilation. Install it. Now you have to configure xmms. Here are some examples (which I use on my copmuter):

    begin
       prog = xmms
       button = POWER
       config = QUIT
    end

    begin
      prog   = xmms
      button = ENTER
      config = PLAYPAUSE
      repeat = 0
    end

    begin
      prog   = xmms
      button = CANCEL
      config = STOP
      repeat = 0
    end

    Using the remote control on xawtv
    There are two options how to use the control remote to control to control xawtv. The first is install lirc and re-configure and re-compile xawtv, then xawtv will use the control rmeote internally. But if you dont have a compiler on your system or you do not want to re-compile the program, there is a "hack". There is a program called xawtvremote which lets you control the application from a scpript, so what we should do is just run irexec and comfigure it to pass the correct commands to the main application.

    If you want, you can get my .lircrc config file.

    BTW: here is the file for MATAV/GVANIM for xawtv

    If you need more information, fell free to contact me dgi_il<at>hotmail.com .

    [back ]