2008-01-18

Hama DVB-T-Stick USB 2.0

How to get a "Hama DVB-T-Stick USB 2.0" or any other
af9015-based DVB-t -stick to work in linux.
(This howto was written 2007-01-18 and may no longer
be required by the time you read this if more then
a few month have passed.)


check the device-id
Let us see if this is really the device this howto talks about:
lsusb -v
This should show a device with device-id: 0x9015 or 0x9016
and AfaTech: 0x15a4 as the manufacturer-id.


# get v4l (latest version [2007-01-18])
# (does not include the 9015-driver)
hg clone http://linuxtv.org/hg/v4l-dvb

# get driver (this works but does not fit the current
# V4l-infrastructure anymore)
wget http://af.zsolttech.com/af901x-Taiwan.tar.gz
tar -xzf af901x-Taiwan.tar.gz

# copy driver into v4l
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/af901x* linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/MT2060* linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/mt_errordef.h linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/*biu_reg.h linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/usbdma_biu_reg.h linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/dummy_ram.h linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/error.h linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/define.h linux/drivers/media/dvb/dvb-usb/
cp v4l-dvb-39c2d2041e6e/linux/drivers/media/dvb/dvb-usb/tuner_init_Microtune*.h linux/drivers/media/dvb/dvb-usb/

# note: if an af9015.c or af901x.c already exits, just skip this and do only "make menuconfig && make && make install"
# because then this driver has been integrated into the stock v4l -tree.

# add driver to makefiles
vi linux/drivers/media/dvb/dvb-usb/Makefile
add:
dvb-usb-af9015-objs = af901x-core.o af901x-devices.o af901x-drv.o af901x-usb.o af901x-fe.o MT2060.o MT2060init.o MT2060M.o
obj-$(CONFIG_DVB_USB_AF9015) += dvb-usb-af9015.o

# add driver to config-dialog
vi linux/drivers/media/dvb/dvb-usb/KConfig
add:
config DVB_USB_AF9015
tristate "Afatech AF9015 DVB-T USB2.0 HDTV 1080i support"
depends on DVB_USB && EXPERIMENTAL
select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
select DVB_TUNER_QT1010 if !DVB_FE_CUSTOMISE
help
Say Y here to support the Afatech AF9013/15 based receiver

# select multimedia devices->DVB-adapters->9015
make menuconfig
make && make install && tail -f /var/log/kernel
# now stick the device into the USB-slot...
you should see something like this:
kernel: input: Afatech DVB-T 2 as /class/input/input18
kernel: input: USB HID v1.01 Keyboard [Afatech DVB-T 2] on usb-0000:00:1d.7-1
kernel: AF901X: af901x_module_init
kernel: dvb-usb: found a 'Afatech USB2.0 DVB-T Recevier' in warm state.
kernel: dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
kernel: DVB: registering new adapter (Afatech USB2.0 DVB-T Recevier)
kernel: DVB: registering frontend 0 (AF901X USB DVB-T)...
kernel: dvb-usb: Afatech USB2.0 DVB-T Recevier successfully initialized and connected.
kernel: usbcore: registered new interface driver dvb_usb_af901x

Lets see TV now

# get the DVB-utils-package
apt-get install dvb-utils # (this is how it's done for debian)

# get all frequencies to scan
wget http://www.johannes-bauer.com/dvbt/dvbt-scanaid-0.03.tar.bz2 && tar -xjf dvbt-scanaid-0.03.tar.bz2 && cd dvbt-scanaid-0.03/ && dvbt-scanaid-0.03/
enter: "y" twice
# scan all these frequencies for transponders
scan Scanlist.txt > channels.conf
cp channels.conf ~/.mplayer/

now you can do: (ARD is the name of a found tv-station)
mplayer dvb://ARD
mencoder dvb://ARD -o recorded_news_without_header.avi -oac copy -ovc copy && mencoder recorded_news_without_header.avi -o recorded_news_final.avi -forceidx -oac copy -ovc copy



Links
http://www.johannes-bauer.com/dvbt/ (german)