Digital TV in Linux
Watching digital tv in Linux with em2880 devices
Note: This post is from my earlier site. I moved it over here because I see that a lot of people are trying to access it without finding it. It is written in 2007, so all content may not be up to date. You can report successes/failures in the comments so I know if it needs to be updated.
I found a really cheap refurbished Pinnacle PCTV USB DVB-T receiver in my local computer store and after googling to make sure it supported Linux I bought it. Here’s how I made it work in Linux.
The USB stick itself is fairly small, although it is just wide enough to block the other USB port on my laptop. It came with a small antenna with a magnetic stand and a tiny remote. The antenna is connected to the USB stick with a regular antenna connector, you can easily connect it to a better antenna if needed.
In this article I’ll show you how I first set up the drivers for the tuner, then setting up kaffeine for viewing TV and lastly configuring the remote. The steps should be fairly easy to follow if you’ve used the console before – if not, just copy n paste and you should be fine.
This article is about the Pinnacle PCTV USB Stick DVB-T receiver, but the same steps should work for any device using the em2880 driver. According to the em28xx wiki, these devices should also work:
- Pinnacle/800e|Pinnacle HD Pro Stick (North American version, NTSC/ATSC)
- Kworld 350 U DVB-T
- Kworld 310 U
- MSI DigiVox A/D (USB2.0)
- Hauppauge HVR 950 (NTSC/ATSC)
- Hauppauge WinTV HVR 900 M/R: 65008/A1C0
- Terratec Cinergy Hybrid T XS – ZL10353
- Terratec Cinergy Hybrid T XS – MT352
- Terratec Cinergy Hybrid T XS France
- Terratec Prodigy Hybrid T XS
- Terratec Cinergy T XS – xc3028
- Terratec Cinergy T XS – mt2060
- Pinnacle PCTV USB Stick
- DNT DA2 Hybrid
- Pinnacle PCTV Hybrid Pro Stick
- Empire USB 2.0 Pen Dual TV
- BestBuy Easy TV USB hybrid
- Usbgear VD204v9
- Leadtek Winfast USB II deluxe
- SIIG AVTuner-PVR
- Prolink PlayTV USB 2.0
- Terratec Cinergy 250 USB
- Pinnacle PCTV USB 2
- Hauppauge WinTV USB 2
- MSI VOX USB 2.0
- Pinnacle Dazzle DVC 90
- Kworld PVR TV 2800 RF
- Hercules Smart TV USB 2.0
- MSI Movie Vox
- D-Link DUB-T210 TV Tuner
- Gadmei UTV 330
- Gadmei UTV 310
- Supertronindia Supercomp TV USB 2.0
You will need the following programs for this to work, we’ll install everything up front so we can concentrate on the more interesting stuff later.
- a recent kernel with sources, 2.6.15 and newer should be fine (install kernel-sources in SuSE)
- Hg from http://www.selenic.com/mercurial/ (in SuSE you should find a package named mercurial)
- kaffeine with the xine engine (in SuSE, add packman and guru repositories and install kaffeine, libxine and libxine-dvb)
- lineak with kde plugin (on SuSE, install lineakd, lineakd_kde and lineak_defaultplugin)
- gcc compiler, is included on most distros by default
- dvb package (dvb in SuSE)
For Ubuntu (Edgy) you’ll need the following packages:
All should be available from the default repositories, make sure to have the “Universe” repositories enabled (under System>Administration>Software Sources).
- linux-headers-`uname -r` (the linux headers for your specific kernel version)
- kaffeine (version 0.8 or above. Other dvb watching applications will work as well but only kaffeine will be covered here)
Otherwise the install works the same as for SuSE.
Downloading and compiling the driver
Some users will need a firmware file to make their devices work, if you see your device listed here follow the directions, if not continue on to installing the driver.
These devices need firmware version 1:
- Terratec Cinergy Hybrid T XS (french edition)
- Terratec Cinergy T XS
- DNT DA2 Hybrid
- Kworld 350U
These devices need firmware version 2:
- MSI DigiVox A/D
- Kworld 310U
- Terratec Cinergy Hybrid T XS (USB ID=0ccd:005e)
These devices need firmware version 3:
- HVR 900 B2C0(sticker on the dev.)
- HVR 900 A1C0
- Terratec Cinergy Hybrid T XS
- Pinnacle PCTV Hybrid Pro
- Pinnacle PCTV Hybrid Pro Stick (320e) (USB ID=eb1a:2881)
These devices need firmware version 4:
- Pinnacle HD Pro Stick (North American version, NTSC/ATSC)
IMPORTANT: Download the file into /lib/firmware, then extract them with “sudo tar zxvf filename.tar.gz”
Getting and installing the driver
Create a folder somewhere convenient.
Now, go into that directory and type
hg clone http://mcentral.de/hg/~mrec/v4l-dvb-kernel
Which will download a copy of the driver sources to your directory.
Compiling the driver varies a bit depending on if you had to download the firmware or not. If you had to download it keep reading here, if not skip on to part b.
cd v4l-dvb-kernel/v4l make sudo make install
You now need to reboot (bookmark this page so you’ll find it again).
The fun part
Hi and welcome back, I hope the boot didn’t take too long.
If everything has gone well you should be a few short steps away from viewing tv on your computer.
We still need to load the driver we compiled earlier, as root type in the following.
You shouldn’t get any messages, just be returned to the prompt.
Open up kaffeine either from the menu, or from the console by typing ‘kaffeine’. It should recognize that you
have a dvb adapter and ask you for some additional info.
Select your location and check that everything else is in order and then continue.
In kaffeine you have in the menu bar a DVB menu, select channels from that. Now just press scan and hope. If all went well you’ll soon start seeing all the channels that have been found. If you can’t find any channels its most likely because of the tiny little antenna that came with the tuner, either try going to some place with better reception, or plug the antenna cable to a roof-top antenna.
If you’re happy controlling your viewing with a mouse and keyboard, you’re done. If you want to get the remote to work as well stay with me for a little while longer.
Setting up the remote
The remote is just another input device to the system, just like the extra buttons on newer keyboards, so I decided to use lineak for the task.
I used xev to get the different key codes the buttons on the remote are sending, unfortunately not all of them sent anything. I don’t know if this is just something that’s wrong with my remote, or a “feature”.
Anyway, here is the section to that I added to /etc/lineakkb.def:
#### Pinnacle PCTV USB Stick Remote #### [PCTV] brandname = "Pinnacle" modelname = "PCTV USB Stick Remote Control" [KEYS] Mute = 160 Record = 177 Power = 222 Rewind = 152 Stop = 232 Play|Pause = 110 Forward = 233 VolumeUp = 176 VolumeDown = 174 [END KEYS] [END PCTV] #### END Pinnacle PCTV USB Stick Remote ####
If you find the missing key codes, please leave a comment and I’ll update this.
Save the lineakkb.def file and as a regular user type:
lineakd -c PCTV
It will create a configuration file for your keyboard in ~/.lineak/ named lineakd.conf
In this file you can set up what you want all the buttons to do, below is a mine as a sample:
# LinEAK - Linux support for Easy Access and Internet Keyboards # Copyright (c) 2001,2002, 2003 # Sheldon Lee Wen <email@example.com> (Current Maintainer) # and Mark Smulders <Mark@PIRnet.nl> # http://lineak.sourceforge.net # # lineakd configuration file # # example key configuration: # play = "xmms --play-pause" # eject = EAK_EJECT # # Lineakd supports the following modifier keys: # control alt shift mod2 mod3 mod4 mod5 CdromDevice = /dev/cdrom Display_align = center Display_color = 0aff00 Display_font = -adobe-helvetica-bold-r-normal-*-*-240-*-*-p-*-*-* Display_hoffset = 0 Display_plugin = internal Display_pos = bottom Display_soffset = 1 Display_timeout = 3 Display_voffset = 50 KeyboardType = PCTV MixerDevice = /dev/mixer RAWCommands = Screensaver = conffilename = /home/marcus/.lineak/lineakd.conf keystate_capslock = keystate_numlock = keystate_scrolllock = Forward = "dcop kaffeine KaffeineIface posPlus" Mute = "KMIX_MUTE" Play|Pause = "dcop kaffeine KaffeineIface pause" Power = "kaffeine DVB" Record = "dcop kaffeine KaffeineIface fullscreen" Rewind = "dcop kaffeine KaffeineIface posMinus" Stop = "dcop kaffeine KaffeineIface stop" VolumeDown = "KMIX_VOLDOWN" VolumeUp = "KMIX_VOLUP"
As you see, I had to put the record button to control full screen toggling, as I couldn’t get the key code for the real full screen button. Please check the lineak documentation for additional commands, as well as typing ‘dcop kaffeine KaffeineIface’ to get a list of all the commands you can send to kaffeine.
To start type
To start lineak automatically with KDE make a symbolic link like this:
ln -s /usr/bin/lineakd /home/marcus/.kde/Autostart/
So that’s it, now you should be able to enjoy your favorite tv shows on your computer and control it with the remote (although the effective distance on the remote is probably less than the length of your arm
The em28xx wiki check this wiki if you have any problems, they are probably solved there.