sabato 8 novembre 2008
venerdì 7 novembre 2008
giovedì 6 novembre 2008
mercoledì 5 novembre 2008
How to - webcam & tv tuner at the same time with Ubuntu 8.10
Do you own a tv tuner and you would like to use it under linux, but you can't 'cause it conflicts with your system webcam and you are going to get crazy with modules and nodes?
Ubuntu 8.10 (and the 2.6.27 linux kernel in particular) are a lifebelt in this sense!

It works! :D
A better handling of videodev modules and, consequently, a smarter creation of /dev/video nodes from the kernel, let all of us use multiple input video devices at the same time!
My devices are the built in webcam in an Asus A6j laptop, that works like a charm with the Syntek drivers embedded in this release, and a Terratec Tv tuner model Cinergy Hybrid T usb XS, that works with the em28xx-dvb modules.
Since on the net is pretty difficult to find a complete guide (I couldn't find one...) I've decided to write a couple of lines about it.
The procedure is mainly described in mcentral.de, then some good "old" googling, searching for minor fixes has completed the frame.
First of all, a consideration: this procedure works well with my hardware, since I've done no testing with other configurations I cannot guarantee that it will suite for your hw... However I will be glad to try to solve any problem that could come out e I will be even more happy to have feedback on working configurations!
3,2,1...Let's go!
We will need some software during the procedure, it is better to install it first: cheese for the webcam, kaffeine for the tv tuner (for the dvb-t transmissions, to be precise), mercurial to download the driver's sources and build-essential for all the tools needed for compiling.
Note that Kaffeine is not the only software capable of visualizing the digital straming from the tv tuner, but, imho, it is the simplest, more intuitive and more functional piece of software that you can find for this scope!
You can install everything at once, by opening a terminal and paste:
sudo apt-get install kaffeine build-essential cheese mercurial
Now you can download the sources for the tv tuner with this command
hg clone http://mcentral.de/hg/~mrec/v4l-dvb-experimental
and move to the downloaded directory
cd v4l-dvb-experimental
We could now compile with the classic make && make install commands, but there is a script (build.sh) that is designed exactly for this scope, it's up to you to chose which way to use.
With the script (that, obviously needs admin rights) the commands are:
sudo ./build.sh build
for compiling and then
sudo ./build.sh install
sudo ./build.sh load
to load them in the kernel.
Unfortunately with both methods, here come the problems: when you start compiling, the compiler breaks with this error message (I've cut'n'pasted just the last lines):
...
make: *** [default] Error 2
cp: cannot stat `drx3973d/drx3973d.ko': No such file or directory
cp: cannot stat `tvp5150/tvp5150.ko': No such file or directory
cp: cannot stat `lgdt3304/lgdt3304.ko': No such file or directory
cp: cannot stat `zl10353/zl10353.ko': No such file or directory
cp: cannot stat `cx25843/em28xx-cx25843.ko': No such file or directory
cp: cannot stat `xc3028/tuner-xc3028.ko': No such file or directory
cp: cannot stat `xc5000/tuner-xc5000.ko': No such file or directory
cp: cannot stat `em28xx.ko': No such file or directory
cp: cannot stat `em28xx-audio.ko': No such file or directory
cp: cannot stat `em28xx-aad.ko': No such file or directory
cp: cannot stat `em28xx-audioep.ko': No such file or directory
cp: cannot stat `em28xx-dvb.ko': No such file or directory
cp: cannot stat `qt1010/qt1010.ko': No such file or directory
cp: cannot stat `mt2060/mt2060.ko': No such file or directory
The solution is actually simple, you have to copy three files from kernel sources.
Let's download the sources with
sudo apt-get install linux-source
move to /usr/src and unarchive the downloaded package (io use nautilus with admin rights 'cause I'm used to, but tar -xjvf is perfect too!)
When the archive is extracted, copy the files with
sudo cp linux-source-2.6.27/drivers/media/dvb/dvb-core/*.h linux-headers-2.6.27-7-generic/drivers/media/dvb/dvb-core/
sudo cp linux-source-2.6.27/drivers/media/dvb/frontends/lgdt330x.h linux-headers-2.6.27-7/drivers/media/dvb/frontends/
sudo cp linux-source-2.6.27/drivers/media/video/msp3400-driver.h linux-headers-2.6.27-7/drivers/media/dvb/frontends/
(of course the kernel number may be different depending on your kernel version!)
and, after coming back to the directory that contains the drivers (v4l-experimental), you can execute the compiling procedure once again.
When you have done, control whether the module has been correctly installed in the kernel with
lsmod | grep em28xx
If nothing comes out, it is sufficinet to reload the module with
sudo modprobe em28xx
We have almost done! ...you have now to download the correct firmware (that will be saved on the hd, not writed in the tuner memory!) for your tv tuner...
Let's move to /lib/firmware
and download the correct firmware with
sudo wget http://konstantin.filtschew.de/v4l-firmware/FIRMWARE
where, insted of FIRMWARE, you have to insert the name of the correct firmware for your device. There are four different firmware versions: firmware_v1.tgz, firmware_v2.tgz, firmware_v3.tgz and firmware_v4.tgz
In theory the highest the number the better the firmware (since it is more recent), but Terratec model Cinergy hybrid T XS needs version 3 (and a small group of those devices, pricipally the French version, recognizable from the ID 0ccd:005e with the command lsusb, need version 2 of the firmware).
However it is not a big deal to try one firmware and, eventually, change it with another one.
No it is sufficient to plug the tv tuner and, launching kaffeine you will find an extra button for digital tv (and by pressing "C" you can open the frequency scanner to tune the device and find all the channels).
Those are the results of tail -f /var/log/messages when the device is plugged after the modules have been correctly loaded:
... em28xx: new video device (0ccd:005e): interface 0, class 255
... em28xx: device is attached to a USB 2.0 bus
...
... attach_inform: tvp5150 detected.
... tvp5150 3-005c: tvp5150am1 detected.
... successfully attached tuner
... em28xx #0: V4L2 VBI device registered as /dev/vbi0
... V4L2 device registered as /dev/video1
... em28xx-audio.c: probing for em28x1 non standard usbaudio
... em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
... em2880-dvb.c: DVB Init
... register disabled
... DVB: registering new adapter (em2880 DVB-T)
... DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
... input: em2880/em2870 remote control as /devices/virtual/input/input10
... em28xx-input.c: remote control handler attached
... em28xx #0: Found Empia Hybrid ATSC (em2882)
A guide for using the analog receiver of the Cinergy Hybrid device will be posted as soon as I find all the info to make it work properly.
So, now more than anytime, stay tuned! :D
---
M
Labels:
English,
linux,
Tips 'n' Tricks,
ubuntu
How to - webcam & scheda tv in contemporanea su Ubuntu 8.10
Avete una scheda tv e siete impazziti a farla andare d'accordo con la vostra webcam fino ad ora? Per fortuna Ubuntu 8.10 (e in particolare il nuovo kernel 2.6.27 integrato in questa distribuzione) ha grosse novità al riguardo!

Una gestione più razionale dei moduli relativi alle periferiche di input video, con conseguente creazione dei nodi corretti in /dev/video da parte del kernel, permette infatti di compilare e caricare (e usare!) contemporaneamente i driver per vari dispositivi video, nel mio caso una webcam integrata sul portatile Asus, perfettamente funzionante coi driver syntek che si trovano di default in questa release di Ubuntu e una scheda tv della Terratec, modello Cinergy Hybrid T usb XS, che funziona con i moduli em28xx-dvb.
Siccome su internet è abbastanza difficile trovare una guida completa (io non ne ho trovate...) ho pensato di scrivere due righe per tutti...
Il procedimento su cui mi baso è tratto principalmente da mcentral.de e poi da un po' di sano Googling alla ricerca di possibili soluzioni agli errori.
Premetto che la procedura qui riportata funziona alla perfezione per il mio hardware, ma che non ho eseguito nessun test al di fuori della configurazione descritta sopra, non è detto quindi che sia valida per tutti... sarò però lieto di cercare di riolvere assieme a voi eventuali problemi che dovessero capitare e sarò ancora più felice se vorrete postare le configurazioni funzionanti con la procedura.
3,2,1...Si comincia!
Prima di tutto dovete installare alcuni componenti base sulla vostra linux box: cheese per la webcam, kaffeine per usare la scheda tv (per le trasmissioni dvb-t, ossia il digitale terrestre, per la precisione), mercurial per scaricare i sorgenti dei driver e build-essential per avere tutti gli strumenti base per la compilazione.
Nota: Kaffeine non è l'unico programma in grado di usare il flusso video proveniente dalla scheda tv, ma, a mio avviso, è quello più semplice, intuitivo e funzionale!
Per installarli tutti in un solo colpo, aprite un terminale e digitate:
sudo apt-get install kaffeine build-essential cheese mercurial
A questo punto, sempre da terminale, scaricate i sorgenti dei driver per la scheda tv con
hg clone http://mcentral.de/hg/~mrec/v4l-dvb-experimental
e posizionatevi nella directory appena scaricata con
cd v4l-dvb-experimental
Potremmo adesso procedere con la solita compilazione manuale a base di make e make install, ma uno script già bello e pronto (build.sh) permette di installare facilmente i driver, scegliete voi quale strada preferite seguire.
Con lo script (che ovviamente necessita dei privilegi di amministratore per funzionare) servono questi comandi:
sudo ./build.sh build
per compilare i moduli e, successivamente
sudo ./build.sh install
sudo ./build.sh load
per caricarli nel kernel.
Purtroppo, sia che stiate usando il tradizionale make, sia che abbiate deciso per lo script, qui arrivano i problemi: al momento della compilazione, viene restituito un messaggio di errore di cui riporto solo le ultime righe:
...
make: *** [default] Error 2
cp: cannot stat `drx3973d/drx3973d.ko': No such file or directory
cp: cannot stat `tvp5150/tvp5150.ko': No such file or directory
cp: cannot stat `lgdt3304/lgdt3304.ko': No such file or directory
cp: cannot stat `zl10353/zl10353.ko': No such file or directory
cp: cannot stat `cx25843/em28xx-cx25843.ko': No such file or directory
cp: cannot stat `xc3028/tuner-xc3028.ko': No such file or directory
cp: cannot stat `xc5000/tuner-xc5000.ko': No such file or directory
cp: cannot stat `em28xx.ko': No such file or directory
cp: cannot stat `em28xx-audio.ko': No such file or directory
cp: cannot stat `em28xx-aad.ko': No such file or directory
cp: cannot stat `em28xx-audioep.ko': No such file or directory
cp: cannot stat `em28xx-dvb.ko': No such file or directory
cp: cannot stat `qt1010/qt1010.ko': No such file or directory
cp: cannot stat `mt2060/mt2060.ko': No such file or directory
Fortunatamente, cercando un po' in rete, la soluzione si riduce a copiare un paio di file dal sorgente del kernel.
Scarichiamo quindi i sorgenti del kernel con
sudo apt-get install linux-source
a questo punto spostiamoci in /usr/src e scompattiamo l'archivio compresso appena scaricato (io lo faccio da nautilus con privilegi di amministratore per abitudine, ma anche il buon vecchio tar -xjvf va benissimo!)
Una volta estratto l'archivio contenente i sorgenti, copiamo i tre file necessari alla corretta compilazione
sudo cp linux-source-2.6.27/drivers/media/dvb/dvb-core/*.h linux-headers-2.6.27-7-generic/drivers/media/dvb/dvb-core/
sudo cp linux-source-2.6.27/drivers/media/dvb/frontends/lgdt330x.h linux-headers-2.6.27-7/drivers/media/dvb/frontends/
sudo cp linux-source-2.6.27/drivers/media/video/msp3400-driver.h linux-headers-2.6.27-7/drivers/media/dvb/frontends/
(naturalmente la versione del kernel può variare da quella specificata!)
e, dopo essere ritornati nella directory contenente i driver (v4l-experimental), eseguiamo nuovamente i passaggi di compilazione.
Una volta fatto controllate che il modulo sia correttamente installato nel kernel con
lsmod | grep em28xx
Se non compare nulla, basta caricare il modulo con
sudo modprobe em28xx
Abbiamo quasi finito... si tratta ora di scaricare il firmware corretto (che verrà salvato su hard disk, non scritto nella periferica!) per la vostra scheda tv...
Spostiamoci quindi in /lib/firmware
e scarichiamo il firmware corretto con
sudo wget http://konstantin.filtschew.de/v4l-firmware/FIRMWARE
dove, al posto di FIRMWARE dovrete inserire il nome del firmware corretto per la vostra periferica.
Esistono, ad oggi, quattro firmware scaricabili: firmware_v1.tgz, firmware_v2.tgz, firmware_v3.tgz e firmware_v4.tgz.
In linea di principio quello con il numero più alto è il più recente e quindi teoricamente il migliore, ma le schede tv serie Cinergy hybrid T XS hanno bisogno del firmware versione 3 (e un sottogruppo di queste schede, principalmente destinate al mercato francese, riconoscibili per l'ID 0ccd:005e con il comando lsusb, necessitano della versione 2).
In ogni caso non farete un gran danno a provare un firmware ed eventualmente a sostituirlo con un altro.
A questo punto basta attaccare la scheda tv (nel mio caso usb) e in kaffeine troverete un bottone extra preposto alla tv digitale (e premendo "C" potrete passare alla sintonizzazione dei canali, pratica da effettuare la prima volta).
Questi sono i risultati di tail -f /var/log/messages quando la periferica viene connessa dopo che i moduli sono stati caricati:
... em28xx: new video device (0ccd:005e): interface 0, class 255
... em28xx: device is attached to a USB 2.0 bus
...
... attach_inform: tvp5150 detected.
... tvp5150 3-005c: tvp5150am1 detected.
... successfully attached tuner
... em28xx #0: V4L2 VBI device registered as /dev/vbi0
... V4L2 device registered as /dev/video1
... em28xx-audio.c: probing for em28x1 non standard usbaudio
... em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
... em2880-dvb.c: DVB Init
... register disabled
... DVB: registering new adapter (em2880 DVB-T)
... DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
... input: em2880/em2870 remote control as /devices/virtual/input/input10
... em28xx-input.c: remote control handler attached
... em28xx #0: Found Empia Hybrid ATSC (em2882)
Presto una guida per l'uso della parte di ricezione analogica di questa scheda (appena trovo tutte le informazioni per farla funzionare correttamente!)
---
M
Labels:
linux,
Tips 'n' Tricks,
ubuntu
martedì 4 novembre 2008
Lei per chi ha votato?
Mi?... pe'l negher!
(da pronunciare rigorosamente con cadenza lombarda)
E' per questo che questa volta credo meno che mai ai sondaggi (e per le molte, ripetute e incredibili cantonate che hanno preso i sondaggisti). Quello che spero e che mi sembra di intravedere, però, è che gli strateghi di Obama ne siano ben consci e anche tutti i suoi elettori! Solo così, con il fuoco al culo, si potrà evitare di adagiarsi sugli allori virtuali a cui Gallup e company ci hanno abituato.

Il problema è che, per quanto ammiri molto gli Stati Uniti (non sono certo 8 anni di gestione psicolabile a farmi cambiare idea, al massimo me li fa andare un po' di traverso), ci sono intere regioni di quel vasto paese dove il razzismo regna sovrano, e non mi riferisco alle zone rurali dove fino all'altro ieri i neri erano schiavizzati, lì il razzismo è palese e palpabile.
Mi riferisco a un razzismo ancora più schifoso perchè serpeggiante, di quelle persone che non fanno una piega e poi sussurrano "sporco negro" alle spalle o che lasciano un cappio appeso alla porta del professore di colore come il kuklux clan dei tempi migliori...
La mia speranza è che la maggioranza della popolazione sia per bene e, oggi, un'intera nazione avrà la possibilità di dimostrare a me e a voi tutti che queste speranze sono ben riposte.
Visto, Michelino, che è proprio un'auto scura targata Illinois?! :D Speriamo sia premonitorio! A tal proposito, Henry Gibson conciato in quel modo somiglia in giovane a McCain o è solo una mia impressione?
GET OUT THE VOTE FOR OBAMA!
---
M
Scienza in Piazza
Come dicevo in chiusura nel post precedente, abbiamo la fortuna qui, nel dipartimento di fisica di Trieste, di avere tre studentesse che, non paghe di farsi il culo tutto il giorno sui libri per mantenere le loro medie attorno al 29 (a fisica, roba da paura!), regalano il loro tempo libero per organizzare una meravigliosa serie di incontri e conferenze per far sì che tutta la popolazione possa rendersi conto di cosa sia, in pratica, la ricerca e perchè non se ne può proprio fare a meno! (Facinorose, vero?!)

Per questo vi invito tutti a partecipare alle lezioni che si svolgeranno ogni giorno a partire da oggi, martedì 4 novembre, in Piazza dell'Unità d'Italia a Trieste alle ore 17:00 seguendo il programma che potrete trovare a questo indirizzo:
http://sites.google.com/site/scienzainpiazza/
Noi studenti dobbiamo anche ringraziare i professori che si sono dimostrati generosissimi con il loro tempo libero per preparare e svolgere queste conferenze, ma niente di tutto questo sarebbe stato possibile senza il continuo, costante e instancabile lavoro di Agnese Fabris, Elisa Benedetti e Maria Ricci!
Siete toste, continuate sempre così!
---
M
Labels:
eventi,
fisica,
protesta,
scienza,
ScienzaInPiazza
Iscriviti a:
Post (Atom)



