I decided to add a second tuner to my Myth system. The current tuner I have is a Gigabyte U7100 which serves me fine except for the fact that the remote does not work. The computer shop did not have any of these in stock so I brought a Leadtek DTV Gold USB. It was much cheaper than the Gigabyte at $36 and a quick check beforehand on some posts showed that some people had it working with Linux.
The Leadtek Gold has an Afatech af9015 chip with a TDA18271 tuner. There is also an af9013 in there somewhere. Note that some older Leadtek Gold’s have a different tuner chip.
Doing some searching found that it was not supported by default in Fedora 10 (FC10) but was easy to install. The instructions are on so many blogs and posts so I will not go into the details, see
but the brief steps are
1. Download v4l for the af9015
2. Build the source by running make
You will need to have the kernel development files installed. Many posts tell you to get build-essentials and kernel-headers but this is an Ubuntu thing. For Fedora do a yum groupinstall “Development Tools”
3. Download the firmware
from http://www.otit.fi/~crope/v4l-vb/af9015/af9015_firmware_cutter/firmware_files/ and put it in /lib/firmware
4. Then you can do a make install. I chose not to do this and just inserted the modules from the build directory – v4l.
5. Insert the modules by doing the following, if the current ones are loaded you will need to unload them first
6. Then just plug in the Leadtek Gold
To check that it has installed ok use dmesg or run tail –f /var/log/messages before you insert the Leadtek.
The output should be something like
Apr 27 21:05:23 mythtv kernel: usb 1-1: new high speed USB device using ehci_hcd and address 4 Apr 27 21:05:23 mythtv kernel: usb 1-1: configuration #1 chosen from 1 choice Apr 27 21:05:23 mythtv kernel: dvb-usb: found a 'Leadtek WinFast DTV Dongle Gold' in cold state, will try to load a firmware Apr 27 21:05:23 mythtv kernel: firmware: requesting dvb-usb-af9015.fw Apr 27 21:05:23 mythtv kernel: dvb-usb: downloading firmware from file 'dvb-usb- af9015.fw' Apr 27 21:05:23 mythtv kernel: dvb-usb: found a 'Leadtek WinFast DTV Dongle Gold' in warm state. Apr 27 21:05:23 mythtv kernel: dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer. Apr 27 21:05:23 mythtv kernel: DVB: registering new adapter (Leadtek WinFast DTV Dongle Gold) Apr 27 21:05:24 mythtv kernel: af9013: firmware version:4.95.0 Apr 27 21:05:24 mythtv kernel: DVB: registering adapter 1 frontend 0 (Afatech AF9013 DVB-T)... Apr 27 21:05:24 mythtv kernel: tda18271 2-00c0: creating new instance Apr 27 21:05:24 mythtv kernel: TDA18271HD/C2 detected @ 2-00c0 Apr 27 21:05:24 mythtv kernel: input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:1d.7/usb1/1-1/input/input10 Apr 27 21:05:24 mythtv kernel: dvb-usb: schedule remote query interval to 150 msecs. Apr 27 21:05:24 mythtv kernel: dvb-usb: Leadtek WinFast DTV Dongle Gold successfully initialized and connected. Apr 27 21:05:24 mythtv kernel: usb 1-1: New USB device found, idVendor=0413, idProduct=6029 Apr 27 21:05:24 mythtv kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Apr 27 21:05:24 mythtv kernel: usb 1-1: Product: WinFast DTV Dongle Gold Apr 27 21:05:24 mythtv kernel: usb 1-1: Manufacturer: Leadtek
Be sure to check that the firmware was installed
Running ls /dev/dvb/adapter should show demux0 dvr0 frontend0 net0
To test it I did the following, you will need to have dvb-utils installed to do this (yum dvb-utils)
1. Create a channels file by running scandvb /usr/share/dvb/dvb-t/au-Sydney_North_Shore > ~/.mplayer/channels.conf
2. Run mplayer as mplayer dvb://
3. Use h and l to change channels
Next was to get the remote working. You may have noticed from the install messages that a HID device was created when the Leadtek was installed. This is because the Leadtek is recognised as an usbhid device. However there seems to be a problem with this, a key is recognized by the dvb remote module and the hid module and both are sent to /dev/input and are presented to the active application. This has some advantages in that you do not need to run something like lirc, the keys pressed are passed to the current application just as if it was pressed on a USB keyboard. Although it means that you get 2 keys pressed for every one. What is worse is that there seems to be a key repeating problem, when a key is pressed it initially appears and then keeps on repeating This seems to be coming from the usbhid module rather than the dvb-usb-remote module as I disabled the code in dvb-usb-remote and it still happened. A bit of searching showed that usbhid has a quirks mechanism where you can disable usbhid for specified USB Vendor Id. In this case for the Leadtek Gold the Vendor Id is 0×0413:0×6029. On Ubuntu this is quite easy as the usbhid is loaded as a module and therefore can be done in /etc/modprobe.conf by adding option usbhid quirks=0×0000:0×0000:0×04.
With Fedora, the usbhid is load with the kernel so it has to be dome on the kernel command line. This can be done by changing the bootloader. I use Grub so just edit /boot/grub/grub.conf and change
kernel /vmlinuz-22.214.171.124-117.fc10.i686 ro root=UUID=254134e3-d72f-46b2-b857-75753693b7aa rhgb quiet
kernel /vmlinuz-126.96.36.199-117.fc10.i686 ro root=UUID=254134e3-d72f-46b2-b857-75753693b7aa rhgb quiet usbhid.quirks=0×0413:0×6029:0×04
Once this was done I had the remote working. No repeats and a single character appearing for each remote key press.
The remote emulates a keyboard with MCE functionality these however are not standard MythTv keys. There are a number of ways to fix this
1. Change the MythTv key mappings – this has the disadvantage that the keyboard can not be used to control MythTv,
2. Do linux key mappings, this has the same disadvantage as the first option.
3. Use lirc to do the mapping.
Lirc setup requires a device to read from, a setup file and a remote config file. When the Leadtek Gold is inserted it creates an input at /dev/input/eventx. The event number allocated can be determined by looking at /proc/ bus/input/devices
So to pass the keys from the dvb driver to lirc change /etc/sysconfig/lirc to
# Remote settings required by gnome-lirc-properties MODEL="DTV Gold" VENDOR="Leadtek" # Remote settings required by gnome-lirc-properties LIRC_DRIVER="dev/input" MODULES="" LIRC_DEVICE="/dev/input/event10" LIRCD_CONF="''" # Receiver settings required by gnome-lirc-properties RECEIVER_MODEL="DTV" RECEIVER_VENDOR="Leadtek" Then put the lirc config file in /etc/lircd.conf # /etc/lirc/lircd.conf # brand: Leadtek # model no. of remote control: Y04G0051 # devices being controlled by this remote: DTV2000H (Rev. J) begin remote name Y04G0051 bits 16 eps 30 aeps 100 one 0 0 zero 0 0 gap 263992 pre_data_bits 16 pre_data 0x8001 begin codes POWER 0x0164 TV 0x0179 SKIPB 0x00A8 PLAY 0x00CF SKIPF 0x00D0 TIME 0x0167 REW 0x019C STOP 0x0080 FWD 0x0197 RECORD 0x00A7 1 0x0002 2 0x0003 3 0x0004 4 0x0005 5 0x0006 6 0x0007 7 0x0008 8 0x0009 9 0x000A EPG 0x016D FULLSCREEN 0x0177 PREV 0x0081 SNAPSHOT 0x00D4 DOT 0x0034 0 0x000B MENU 0x008B RECORDSTOP 0x0080 UP 0x0067 DOWN 0x006C OK 0x0160 LEFT 0x0069 RIGHT 0x006A MUTE 0x0071 XXX 0x008E VOL_UP 0x0073 VOL_DOWN 0x0072 CH_UP 0x0192 CH_DOWN 0x0193 VIDEO 0x0189 AUDIO 0x0188 RED 0x018E GREEN 0x018F YELLOW 0x0190 BLUE 0x0191 TELETEXT 0x0184 CHSURF 0x016B PIP 0x00B5 BOSS 0x0001 end codes end remote