EC168 DVB-T Linux Driver (e3C)

Device : PC-Basic GRTNTUSBV4_USB_TNT_Basic_LIGHT (V5 seems to have the same ec168 controller, and same firmware)
http://www.linuxtv.org/wiki/index.php/E3C_EC168#GRTNTUSBV4_USB_TNT_Basic_LIGHT

UPDATE (mar 2009) : Linux Driver Mercurial Branch : http://linuxtv.org/hg/~anttip/ec168/summary
UPDATE (jan 2010) : Antti has merged driver in v4l-dvb master. . It is also merged to the kernel 2.6.33 which will be released about one month from that day.
UPDATE (jun 2010) : Finally seen myself in menuconfig of kernel 2.6.35 rc1 :)
UPDATE (dec 2010) : Please read the Compile HowTo if you have problems at the bottom...

IMG_0130.jpg large_IMG_0182.jpg

Direct Firmware Utility - dfu-ec168 v0.2 (Updated 23 Dec 2008)

You can download the sources of an utility made to upload manually the firmware in the device.
Made and tested under Ubuntu 8.10 x86_64

The version 0.2 can read and write to the device... Power function is not working (test purpose)

Package libusb-dev is required

Copy .bin file in /lib/firmware, then compile the sources with :

root@nux:~/dfu-ec168# apt-get install libusb-dev
root@nux:~/dfu-ec168# ./configure
root@nux:~/dfu-ec168# ./go
 
dfu-ec168 - (C) 2008 by Tanguy Pruvot.
This program is Free Software and has ABSOLUTELY NO WARRANTY
 
Opening USB Device 0x18b4:0x1001...
Claiming USB DFU Runtime Interface 1...
Determining device status:
dfu_get_status: firmware present
0902320002010080 3209040000010301 0100092111010001 22
usb_get_descriptor result 25 ## Class=3 ## No error
state = dfuDNLOAD-IDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0x18b4:0x1001] devnum=14, cfg=0, intf=0, alt=0, name="UNDEFINED"
Claiming USB DFU Interface...
Setting Alternate Setting ...
dfu_get_status: firmware present
0902320002010080 3209040000010301 0100092111010001 22
usb_get_descriptor result 25 ## Class=3 ## No error
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0800
bytes_per_hash=142
dfu_before_download: F 4004 1 8 0 0 res=0 No error
 
 
Starting download 7109 bytes : [##################################################] finished!
dfu_after_download: F 4001 0 1 0 0 res=0 No error
dfu_get_status: firmware present
0902320002010080 fa09040000010301 0100092111010001 22
usb_get_descriptor result 25 ## Class=3 ## No error
state(2) = dfuIDLE, status(0) = No error condition is present
Done!

And the device led will be working...

I found these USB requests... the firmware utility use the 0x00 request to upload firmware...

#define CMD_EC168_RAM       0x00 //RW- Read/Write RAM (Firmware go to addr 0-0x1EFF)
#define CMD_EC168_GETSTATUS 0x01 //R-- ex: dfu_ctrl_get(device,0x01,0,1,buffer,1);
#define CMD_EC168_STREAM    0x03 //R-X ex: dfu_ctrl(device,0x03,0/0x20,0xFF00);
                                 //    disable/enable streaming 
#define CMD_EC168_GPIO      0x04 //R-X ex: dfu_ctrl(device,0x04,0/1, index); dfu_ctrl_get(device, 0x04,0,index,buffer,1);
                                 //    disable/enable LED
                                 //    indexes seen: (8,9,A,B,206,208) - Not a Binary Mask !
#define CMD_EC168_UNKNOWN   0x10 //--X ???
#define CMD_EC168_READ_BUF  0x20 //R-- ex: dfu_ctrl_get(device,0x20,0x0000,0x01A0,buffer,0x1A); 
#define CMD_EC168_WRITE_BUF 0x21 //-W- 
#define CMD_EC168_SET       0x30 //--X ex: dfu_ctrl(device, 0x30, 0x0709, 0x1A);

Remote Control
The Remote Control codes looks like standard, same as PCTV Basic PCI Card which are supported by linux...

After upload of the IRKey table, i'm able to read the 0x81 endpoint via usb_interrupt_read... after an initial usb_clear_halt.
Another way to do that is by reading RAM, two bytes at offset 0x1F5E, they contains the last code received... First Byte is the Key number.. second one... i dunno.. maybe raw IR code part...

dfu_ctrl_get(device,0x00,0,0x1F5E,buffer,2);

Sources : This first version can only send firmware file into the device, i'm working on a second version, which is able to retrieve firmware from RAM, and will maybe have some other functions...

How to compile module in Kernel 2.6.35 (Ubuntu 10.10) :

# get sources and headers of your current kernel
apt-get install kernel-headers kernel-sources
 
#extract kernel sources
cd /usr/src/
tar -xpjvf linux-source-2.6.35.tar.bz2
 
cd linux-source-2.6.35
cp /boot/config-2.6.35-23-generic ./
cp config-2.6.35-23-generic .config
cp /boot/System.map-2.6.35-23-generic System.map
cp /usr/src/linux/Module.symvers Module.symvers # (linux link is current kernel-headers)
 
vi .config # search CONFIG_DVB_USB_EC168 and replace by CONFIG_DVB_USB_EC168=m and CONFIG_DVB_EC100=m
make oldconfig
vi Makefile # check EXTRAVERSION, and set it same as your kernel version (uname -a), ex for 2.6.35-23-generic, set "-23-generic"
 
make # stop it after /kernel compilation by Ctrl+C... dont waste time and disk space ;)
make modules M=drivers/media/common/tuners
make modules M=drivers/media/dvb/frontends
make modules M=drivers/media/dvb/dvb-usb
make modules_install M=drivers/media/common/tuners
make modules_install M=drivers/media/dvb/frontends
make modules_install M=drivers/media/dvb/dvb-usb
 
modprobe dvb_core
modprobe mxl5005s
modprobe ec100
# check you have the firmware dvb-usb-ec168.fw in /lib/firmware/
# else download it here, FirmwareEC168.zip in file list, but use EC168BDA.bin
modprobe dvb_usb_ec168
dmesg -c

Note: If you get an error 110 (in dmesg) while loading firmware... my dfu-tool can help you..

rm /lib/firmware/dvb-usb-ec168.fw
# extract EC168BDA.bin and rename it to /lib/firmware/dvb-usb-ec168.bin
# replug your device to reload driver without firmware
# get dfu-ec168.tar.bz2, extract, 
./configure
./src/dfu-ec168 -v -d 0x18b4:0x1001 -i 0 -t 512 -R -D /lib/firmware/dvb-usb-ec168.bin
modprobe -r dvb-usb-ec168
modprobe dvb-usb-ec168

dmesg output if ok :

[79926.045739] dvb-usb: found a 'E3C EC168 DVB-T USB2.0 reference design' in cold state, will try to load a firmware
[79926.050628] dvb-usb: did not find the firmware file. (dvb-usb-ec168.fw) Please see linux/Documentation/dvb/ for more details on firmware-problems. (-2)
[79926.050667] dvb_usb_ec168: probe of 1-1:1.1 failed with error -2
...
[79975.813050] usbcore: deregistering interface driver dvb_usb_ec168
[79979.109875] dvb-usb: found a 'E3C EC168 DVB-T USB2.0 reference design' in warm state.
[79979.110392] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[79979.110732] DVB: registering new adapter (E3C EC168 DVB-T USB2.0 reference design)
[79979.120496] DVB: registering adapter 0 frontend 0 (E3C EC100 DVB-T)...
[79979.121865] MXL5005S: Attached at address 0xc6
[79979.121877] dvb-usb: E3C EC168 DVB-T USB2.0 reference design successfully initialized and connected.
[79979.122009] usbcore: registered new interface driver dvb_usb_ec168

To tune antenna reception on ubuntu, install w_scan and dvbtune
first do a w_scan to get the first frequency...
then
dvbtune -m -f 474167 with the first number (its in KHz, not Hz said in the command line help)
you can now move your antenna to enhance signal and reduce Verror rate
You can also use femon from dvb-apps package

Fichier attachéTailleDownloadsLast Download
FirmwareEC168.zip (ihex,bin,fw)19.11 Ko12891il y a 6 jours 15h
dfu-ec168.tar.bz2 (firmware upload utility src - alpha version)97.7 Ko12984il y a 5 jours 11h
usbspy_initlog_vista_xml.zip38.41 Ko11640il y a 6 jours 10h
dfu-ec168.v1.tar.bz2 dfu-ec168.tar.bz2 (firmware upload utility binary ubuntu x64 - alpha version)660.45 Ko12522il y a 5 jours 11h
dfu-ec168.v0.2-test.tar.bz2 (src + bin64 ubuntu - alpha version)479.89 Ko12189il y a 5 jours 11h

Commentaires

Options d'affichage des commentaires

Sélectionnez la méthode d'affichage des commentaires que vous préférez, puis cliquez sur "Sauvegarder les paramètres" pour activer vos changements.

il faut compiler v4L

il faut compiler v4L http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-D...) et placer le bin dans /lib/firmware
brancher usb dmesg | tail -n 30 pour voire si tout va bien

usb hid maybe

Try to blacklist generic-usb and and usb hid stuff, i think it could create a conflict when "loading" firmware to the device... maybe a module load order problem...

dvb_usb_ec168: probe of 2-1:1.1 failed with error -71

Hello
Your driver used to work perfectly on my ubuntu installation (thank you very much)
Some day ago it stopped working. This is the syslog:
Furthermore after this error lsusb doesnt list my stick. I have to delete /lib/firmware/dvb-usb-ec168.fw and replug the stick to have it listed:
Bus 002 Device 002: ID 18b4:1689 e3C Technologies DUTV009

Apr 3 18:08:30 enzotv kernel: [ 4592.732060] usb 2-1: new high speed USB device using ehci_hcd and address 8
Apr 3 18:08:30 enzotv kernel: [ 4592.868033] input: HID 18b4:1689 as /devices/pci0000:00/0000:00:06.1/usb2/2-1/2-1:1.0/input/input9
Apr 3 18:08:30 enzotv kernel: [ 4592.868733] generic-usb 0003:18B4:1689.0008: input,hidraw3: USB HID v1.11 Keyboard [HID 18b4:1689] on usb-0000:00:06.1-1/input0
Apr 3 18:08:30 enzotv kernel: [ 4592.881398] dvb-usb: found a 'E3C EC168 DVB-T USB2.0 reference design' in cold state, will try to load a firmware
Apr 3 18:08:30 enzotv kernel: [ 4592.886340] dvb-usb: downloading firmware from file 'dvb-usb-ec168.fw'
Apr 3 18:08:30 enzotv kernel: [ 4592.974439] dvb_usb_ec168: probe of 2-1:1.1 failed with error -71
Apr 3 18:08:30 enzotv kernel: [ 4592.974553] usb 2-1: USB disconnect, address 8
Apr 3 18:08:30 enzotv kernel: [ 4593.332048] usb 2-1: new high speed USB device using ehci_hcd and address 9

Thanks

Guess I'll have to wait

The easiest way is to wait

The easiest way is to wait for a real driver, which will upload firmware into device on plug... Without this firmware, the IR cannot work...

So how does a normal user can make the remote work?

Nice article, although I didn't get the remote part, tried compiling lirc with pinaclle support and got nowhere, any ideas on how to progress?

Thanks :)

Yes, i tried

But no answer...

Nice work :)

Thanks for the Mercurial branch, i will try it next week end... and look how you have resolved the usb pipes problem i had in my driver...

EC168 works!

Just got my usb stick working, find the description here:

https://www.dealextreme.com/forums/Default.dx/sku.8325~threadid.278942

Current Status?

Hi there,
what is the current status of getting the ec168 to work under Linux?
Do you need any help on it?

Regards,

Georg

Are you trying to write a driver?

If so, did you try to contact e3c if they're willing to provide information?
At http://www.e3ctech.com they don't list any contact email, but there is one available in whois

libusb-dev package is missing...

Il faut installer le package libusb-dev
Ive uploaded version 0.2, which have more abilities... you need to execute the tool 2 times more to upload again...

problème

Bo jour
Je ne peux pas executer votre programme. J'ai copié les .ihex, .bin et .fw dan lib/firmware.
Après dans terminal j'ai ça:
[root@localhost user]# cd Downloads/dfu-ec168
[root@localhost dfu-ec168]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
checking usbpath.h usability... no
checking usbpath.h presence... no
checking for usbpath.h... no
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

[root@localhost dfu-ec168]# ./go
....
main.c:778: let op: impliciete declaratie van functie ‘usb_get_descriptor’
make[3]: *** [main.o] Fout 1
make[3]: Map '/home/user/Downloads/dfu-ec168/src' wordt verlaten
make[2]: *** [all] Fout 2
make[2]: Map '/home/user/Downloads/dfu-ec168/src' wordt verlaten
make[1]: *** [all-recursive] Fout 1
make[1]: Map '/home/user/Downloads/dfu-ec168' wordt verlaten
make: *** [all] Fout 2
./go: line 2: ./src/dfu-ec168: is a directory
[root@localhost dfu-ec168]#

Qu'est-ce que je fais mauvais? Merci d'avance pour votre réponse. Dirk