On 20/08/2013 18:48, Brian-Imap wrote:
On 8/20/2013 6:28 PM, Brian-Imap wrote:
On 8/19/2013 11:10 PM, Marc wrote:
On 19/08/2013 21:11, Brian-Imap wrote:
Hi,
well Its exactly what I was doing, and I cant see a difference. Here an example of two of the Cine S2 Tuners:

VDR-test-cellar (SDB1): udevadm info -a -p $(udevadm info -q path -n /dev/dvb/adapter3/frontend0)

Udevadm info 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 '/devices/pci0000:00/0000:00:0d.0/0000:02:00.0/dvb/dvb3.frontend0':
    KERNEL=="dvb3.frontend0"
    SUBSYSTEM=="dvb"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:0d.0/0000:02:00.0':
    KERNELS=="0000:02:00.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="DDBridge"
    ATTRS{irq}=="16"
    ATTRS{subsystem_vendor}=="0xdd01"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x048000"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="ff"
    ATTRS{device}=="0x0003"
    ATTRS{enable}=="1"
    ATTRS{msi_bus}==""
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0xdd01"
    ATTRS{subsystem_device}=="0x0020"

  looking at parent device '/devices/pci0000:00/0000:00:0d.0':
    KERNELS=="0000:00:0d.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="pcieport"
    ATTRS{irq}=="40"
    ATTRS{subsystem_vendor}=="0x10de"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060400"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="ff"
    ATTRS{device}=="0x0378"
    ATTRS{enable}=="2"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0x10de"
    ATTRS{subsystem_device}=="0x0000"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

VDR-test-cellar (SDB1): udevadm info -a -p $(udevadm info -q path -n /dev/dvb/adapter4/frontend0)

Udevadm info 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 '/devices/pci0000:00/0000:00:0d.0/0000:02:00.0/dvb/dvb4.frontend0':
    KERNEL=="dvb4.frontend0"
    SUBSYSTEM=="dvb"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:0d.0/0000:02:00.0':
    KERNELS=="0000:02:00.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="DDBridge"
    ATTRS{irq}=="16"
    ATTRS{subsystem_vendor}=="0xdd01"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x048000"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="ff"
    ATTRS{device}=="0x0003"
    ATTRS{enable}=="1"
    ATTRS{msi_bus}==""
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0xdd01"
    ATTRS{subsystem_device}=="0x0020"

  looking at parent device '/devices/pci0000:00/0000:00:0d.0':
    KERNELS=="0000:00:0d.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="pcieport"
    ATTRS{irq}=="40"
    ATTRS{subsystem_vendor}=="0x10de"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060400"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="ff"
    ATTRS{device}=="0x0378"
    ATTRS{enable}=="2"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0x10de"
    ATTRS{subsystem_device}=="0x0000"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

In this case, you can write an external program witch output the name when you match a front end of ddbridge :
KERNEL=="dvb[0-9]*.frontend0", SUBSYSTEMS=="pci", DRIVERS=="DDBridge", PROGRAM="/your/program %k", NAME="%c"

Something like :
if [ ! -a /path/frontendname1 ]; then echo frontendname1; exit; fi;
same with frontendname2 and frontendname3

The kernel name of the device is available if needed (%k in the udev rule).

Marc.
Hi Marc,
you've lost me. 

If FE0/0 is a DDBridge tuner, and I make the FF card tuner FE0/0, then I still need to rename the DDBridge Tuner that
was FE0/0 to another one within FE{1-3}/0. That means potentially overwriting the names of some of the other DDBridge
tuners, and then renaming them later on too.
Unfortunately the same rule will pop for all four DDBridge tuners, so I guess I must keep track of what I have already renamed.
That's what the external program is intended for. It will be launched for every tuner of the ddbridge. The example I give is basic, if the node of the first front end isn't already created, then echo the name of the first front end. If not, test the second node and do the same thing for all the 4 fronts end. Maybe you can use a better logic by passing some parameters.

Of course, this is possible only if the tuners of the ddbridge keep the same order but if would be weird if the driver doesn't use the same order every time (no module loading order at this level).

You still need a rule for the FF card because there are more node created for each adapter. Without a rule the number of this card could change too despite the rule for the ddbridge.

To avoid overwriting when a new tuner (without a udev rule) is added, perhaps you can start numbering at 10 or more if vdr can handle it.

Or, hows about I just go in and rename the devices, same scheme every time.  I think that would work if I knew
how to differentiate between the 4 Cine S2 tuners, currently I dont know how to do that.

That's a more standard way but according to the output of udevadm, there is only an empty DRIVER field after the ddbridge, nothing to write the rule witch differentiate the tuners.

Marc

Cheers Brian