Wednesday, 29 November 2006

Leadtek Winfast TV2000 XP on gentoo (part 1 - infrared remote)

The TV2000 XP is a tv/radio tuner card with a video input slot and an infrared pilot (CoolCommand). It is based on Conexant CX23880/1/2/3 PCI Video and Audio Decoder. Complete output of lspci -vv looks like this:

02:02.0 Multimedia video controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
Subsystem: LeadTek Research Inc. Unknown device 6611
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32 (5000ns min, 13750ns max), Cache Line Size 08
Interrupt: pin A routed to IRQ 22
Region 0: Memory at fa000000 (32-bit, non-prefetchable) [size=16M]
Capabilities: [44] Vital Product Data
Capabilities: [4c] Power Management version 2
Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

Linux kernel (2.6.17) contains drivers for this device in the Video For Linux section. You have to enable the following options:

Device Drivers --->
Multimedia Devices --->
<*> Video For Linux
[*] Enable Video For Linux API 1 (DEPRECATED)
[*] Enable Video For Linux API 1 compatible Layer
Video Capture Adapters --->
<M> Conexant 2388x (bt878 successor) support
<M> Conexant 2388x DMA audio support

For the infrared pilot to work you have to enable the evdev event interface:

Device Drivers  --->
Input Device Support --->
<*> Event Interface

Now recompile (make install && make modules modules_install for gentoo-sources) and reboot. After the system boots again, load the module cx8800 (modprobe cx8800). dmesg | tail -n 15 should report something similar to this:

cx2388x v4l2 driver version 0.0.5 loaded
ACPI: PCI Interrupt 0000:02:02.0[A] -> GSI 22 (level, low) -> IRQ 22
CORE cx88[0]: subsystem: 107d:6611, board: Leadtek Winfast 2000XP Expert [card=5,autodetected]
TV tuner 44 at 0x1fe, Radio tuner -1 at 0x1fe
cx88[0]: Leadtek Winfast 2000XP Expert config: tuner=38, eeprom[0]=0x01
input: cx88 IR (Leadtek Winfast 2000XP as /class/input/input2
cx88[0]/0: found at 0000:02:02.0, rev: 5, irq: 22, latency: 32, mmio: 0xfa000000
tuner 0-0060: All bytes are equal. It is not a TEA5767
tuner 0-0060: chip found @ 0xc0 (cx88[0])
tuner 0-0060: type set to 38 (Philips PAL/SECAM multi (FM1216ME MK3))
tda9887 0-0043: chip found @ 0x86 (cx88[0])
cx88[0]/0: registered device video0 [v4l2]
cx88[0]/0: registered device vbi0
cx88[0]/0: registered device radio0

and ls -l /dev/v4l/ should show devices radio0, vbi0 and video0, all belonging to user root and group video. Also, please note the line input: cx88 IR (Leadtek Winfast 2000XP as /class/input/input2. There should be a new event device in /dev/input/ with the same number (in this case, it will be /dev/input/event2). Unfortunately, device's name depends on the order in which devices are created by udev, and this might change. In order to find a static name of the remote, inspect the /dev/input/by-path directory. It contains device symlinks that udev created using devices' physical addresses. This is enough for a PCI card, because it will be constatant as long as the slot the card is plugged won't change. In my case, the infrared control is visible as /dev/input/by-path/pci-0000:02:03.0--event-ir.

Add cx8800 to /etc/modules.autoload/kernel-2.6 , so it will be loaded each time system starts. Now, in your /etc/make.conf, add lirc v4l v4l2 to USE flags and add a line LIRC_DEVICES="devinput". Although lirc has a driver for Leadtek Winfast TV2000 XP (named leadtek_0010), I was unable to get it to work under kernel 2.6.17 (it did not create a device node, and all attempts to use it resulted in lircd crashing and irw reporting "could not connect to socket"). Emerge lirc (and kdelirc if you want an easy way to control all KDE applications with your remote) and then execute emerge -avuDN world.

First, check if the remote works. Run lircd -d /dev/input/by-path/pci-0000:02:03.0--event-ir -n and press some buttons on the remote. Lircd should report them (although, sadly, not all keys work through the event interface). Edit /etc/conf.d/lircd and set LIRCD_OPTS="-d /dev/input/by-path/pci-0000:02:03.0--event-ir" (change the path to match your configuration). Save Leadtek Winfast TV2000 XP lirc configuration as /etc/lircd.conf. Save lirc configuration for xmms, mplayer and vlc as /etc/lircrc.

Now kill the manually started daemon and start the system one (/etc/init.d/lircd start). Add it to the runlevel (rc-update add lircd default). Start xmms/mplayer/vlc to test how your remote works. If you encounter any problems, verify that irw reports key names correctly.


  1. dobry wpis - męczyła mnie ta karta już z 2 tygodnie :(

  2. The LIRC_DEVICES in make.conf instructs portage to build only selected lirc drivers. As it won’t understand what you put in there, it will build all available ones. So yes, it should work, but might complain during installation :-)

  3. Thanks man, that tutorial saved me a lot of time.

    I don’t know if its ok but in LIRC_DEVICES=„devinput” instead devinput I wrote my /dev/input/by-path/pci-0000:02:03.0—event-ir. But, it works so never mind :)

    Also I have done:
    rc-update add lircd default

    Thanks again.

  4. Siemanko, sluchajcie, mam problem ze swoim coolcomandem. mam wszystko ale nie mam sterownikow i za acholere nie moge znalezc tego w necie. jesli jestescie w stanie mi pomoc, to prosze, napiszcie mi maila co i jak, lub wyslijcie mi od razu te sterowniki. z gory dzieki, Zrozpaczony poszukiwacz <———- :(

  5. Sorry my bad english.
    What is lastest operable lirc version, and kernel version for this funnction?

  6. The ‘XP’ stands for ‘expert’.

  7. Do You have leadtek winfast tv 2000 expert or deluxe card?

  8. Kernel 2.6.19, a karta, hmm, nie TV2000 a DV2000, ale pilot mam do niej taki sam (Y0400052), poza tym działa właśnie na tym chipie. Wszystko w logach wygląda dokładnie tak samo oprócz tej linii z input. Karty różnią się chyba jedynie tym że moja ma jeszcze port firewire.

  9. Karta na pewno ta sama? I jaka wersja kernela?

  10. a u mnie się nie pojawia ta linia z input:

    i nie wiem cholera czemu :/

    w kernelu wszystko jest co napisałeś

  11. Wiem. Tytuł też nie wygląda, jak powinien, kiedy zajął dwie linijki. Tylko na razie brak czasu na poprawki.

  12. Zrób coś z layoutem, bo Ci fragmenty kodu wjeżdżają na sidebar..