Re: [RFC PATCH] Choose dvb adapter number with a driver specific module option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oliver Endriss wrote:
> Janne Grunau wrote:
>> Dynamic loading of modules by udev on startup (aka coldplugging) doesn't
>> result in deterministic dvb adapter numbers.
>>
>> Besides following changes in dvb-core and dvb-usb core the patch adds to
>> all drivers 
>> ...
> 
> While I don't care much whether there is an option for this in the
> driver, I'd like to point out that this is the wrong approach (imho).
> 
> Citing Greg Kroah-Hartman (udev-113/docs/udev_vs_devfs):
> |    ...
> |    2) udev does not care about the major/minor number schemes.  If the
> |       kernel tomorrow switches to randomly assign major and minor numbers
> |       to different devices, it would work just fine (this is exactly
> |       what I am proposing to do in 2.7...)
> |    3) This is the main reason udev is around.  It provides the ability
> |       to name devices in a persistent manner.  More on that below.
> |    ...
> 
> According to this, adding such an option is a step into the wrong
> direction. The right way is to fix the udev scripts...

I've just written udev rules for my set-up.  udev may be the correct way 
to do this but it is far from easy.  Having the adapter number specified 
as a driver option would be much simpler.

I have an Opera DVB-S USB device and a Nova T-500 containing two DVB-T 
devices.  Depending on whether the Opera is in warm or cold state the 
kernel may number the Opera as 0 and the two Nova devices as 1 and 2 or 
the Nova as 0 and 1 with the Opera as 2. For Myth, though, I want to be 
sure that the Opera has a specific device (e.g. /dev/dvb/adapter7/*) 
while the Nova devices have two other specific devices (e.g. 
/dev/dvb/adapter0/* and /dev/dvb/adapter1/*).

Writing a udev rule to pin the Opera to a specific adapter number was 
fairly easy.  Since there is only a single device I could match on the 
USB identifiers.  The Nova, though, has two devices and these are 
indistinguishable, at least from what udevinfo provides.  That means 
that it isn't possible to write a udev rule that would match one device 
and make it /dev/dvb/adapter0 and a different rule to make the other 
/dev/dvb/adapter1.  I was reduced to writing a script that would detect 
whether /dev/dvb/adapter{0,1} existed and if it did whether the entries 
that were already in that directory had the same minor device number 
divided by 64 as the minor device number of new device, divided by 64. 
This was the only way to make sure that /dev/dvb/adapter0 and 
/dev/dvb/adapter1 contained the correct devices and entries weren't 
mixed up.

There may be another way to do this but I couldn't think of one.  Maybe 
the Nova device driver should be changed to ensure the two devices are 
distinguishable in some way.  If udev is being relied upon as the only 
way to pin device entries there needs to be a library of udev rules for 
each device that people can copy.  Otherwise I think Janne's patch is a 
sensible way to go.

David.


_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux