|
Torna all'indice
Hardware (regole udev)
Se disponete di più di una scheda DVB il sistema operativo all'avvio potrebbe non dare sempre lo stesso nome alla stessa scheda. Per esempio nel mio caso ho una scheda DVB-T ed una scheda DVB-S. Il sistema operativo potrebbe assegnare come nome alla scheda DVB-T /dev/dvb/adapter0 ed alla scheda DVB-S /dev/dvb/adapter1. Purtroppo a volte i nomi vengono scambiati. Alcuni programmi come Kaffeine non hanno problemi a funzionare lo stesso mentre MythTV dopo la configurazione, se i nomi vengono invertiti non funzionerà.
Per risolvere questo problema è necessario definire una regola per udev.
Ecco come:
Rinominiamo la scheda /dev/adapter0. Vediamo che ci dice udevinfo:
magellano:/home/mythtv# udevinfo -a -p $(udevinfo -q path -n /dev/dvb/adapter0/frontend0)
Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/class/dvb/dvb2.frontend0':
KERNEL=="dvb2.frontend0"
SUBSYSTEM=="dvb"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:09.2/usb3/3-2':
KERNELS=="3-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}==""
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="80"
ATTRS{bMaxPower}=="476mA"
ATTRS{urbnum}=="28727057"
ATTRS{idVendor}=="0ccd"
ATTRS{idProduct}=="0038"
ATTRS{bcdDevice}=="0106"
ATTRS{bDeviceClass}=="ff"
ATTRS{bDeviceSubClass}=="ff"
ATTRS{bDeviceProtocol}=="ff"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{speed}=="480"
ATTRS{busnum}=="3"
ATTRS{devnum}=="3"
ATTRS{version}==" 2.00"
ATTRS{maxchild}=="0"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="TerraTec GmbH"
looking at parent device '/devices/pci0000:00/0000:00:09.2/usb3':
KERNELS=="usb3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}==""
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bMaxPower}==" 0mA"
ATTRS{urbnum}=="49"
ATTRS{idVendor}=="1d6b"
ATTRS{idProduct}=="0002"
ATTRS{bcdDevice}=="0206"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{speed}=="480"
ATTRS{busnum}=="3"
ATTRS{devnum}=="1"
ATTRS{version}==" 2.00"
ATTRS{maxchild}=="4"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="Linux 2.6.26-1-686 ehci_hcd"
ATTRS{product}=="EHCI Host Controller"
ATTRS{serial}=="0000:00:09.2"
ATTRS{authorized_default}=="1"
looking at parent device '/devices/pci0000:00/0000:00:09.2':
KERNELS=="0000:00:09.2"
SUBSYSTEMS=="pci"
DRIVERS=="ehci_hcd"
ATTRS{vendor}=="0x1106"
ATTRS{device}=="0x3104"
ATTRS{subsystem_vendor}=="0x1043"
ATTRS{subsystem_device}=="0x8080"
ATTRS{class}=="0x0c0320"
ATTRS{irq}=="17"
ATTRS{local_cpus}=="ff"
ATTRS{local_cpulist}=="0-7"
ATTRS{modalias}=="pci:v00001106d00003104sv00001043sd00008080bc0Csc03i20"
ATTRS{enable}=="1"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}==""
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
Si tratta della scheda DVB-T. Voglio rinominarla in adapter101
Ecco la regola:
SUBSYSTEM=="dvb",ATTRS{manufacturer}=="TerraTec GmbH", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter101/%%s $${K#*.}'", SYMLINK+="%c"
che andrò ad inserire in un file chiamato 001-TerraTecGmbH.rules contenuto nella cartella /etc/udev/rules.d.
In questo modo udev riconoscerà la scheda dal costruttore e le assegnerà il nome adapter101.
Facciamo la stessa cosa anche con la scheda DVB-S
magellano:/dev/dvb# udevinfo -a -p $(udevinfo -q path -n /dev/dvb/adapter1/frontend0)
Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/class/dvb/dvb1.frontend0':
KERNEL=="dvb1.frontend0"
SUBSYSTEM=="dvb"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:0e.0':
KERNELS=="0000:00:0e.0"
SUBSYSTEMS=="pci"
DRIVERS=="b2c2_flexcop_pci"
ATTRS{vendor}=="0x13d0"
ATTRS{device}=="0x2103"
ATTRS{subsystem_vendor}=="0x13d0"
ATTRS{subsystem_device}=="0x2103"
ATTRS{class}=="0x028000"
ATTRS{irq}=="17"
ATTRS{local_cpus}=="ff"
ATTRS{local_cpulist}=="0-7"
ATTRS{modalias}=="pci:v000013D0d00002103sv000013D0sd00002103bc02sc80i00"
ATTRS{enable}=="1"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}==""
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
Ecco la regola:
SUBSYSTEM=="dvb", ATTRS{vendor}=="0x13d0", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter102/%%s $${K#*.}'", SYMLINK+="%c"
che andrò ad inserire in un file chiamato 002-TechnisatSkyStar2.rules contenuto nella cartella /etc/udev/rules.d.
In questo modo udev riconoscerà la scheda dal costruttore e le assegnerà il nome adapter102.
Perché tutto funzioni correttamente è però necessario commentare le regole generiche presenti in udev. Nel mio caso il file si chiama 50-udev.rules. Alla sezione video devices commenterò la regola KERNEL==”dvb”
Vediamo ora cosa accade scollegando e reinserendo la scheda. Controlliamo il contenuto della cartella /dev/dvb...
magellano:/dev/dvb# ls -l
totale 0
drwxr-xr-x 2 root root 120 3 gen 20:05 adapter101
drwxr-xr-x 2 root root 120 3 gen 17:30 adapter102
magellano:/dev/dvb#
Perfetto!
Torna all'indice
|