linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* UDEV identical devices. How to?
@ 2012-07-03  9:20 Budnev Vladimir
  2012-07-03  9:36 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Budnev Vladimir @ 2012-07-03  9:20 UTC (permalink / raw)
  To: linux-hotplug

Good day to all

I am not sure which list this quistions should be send to so some 
overkill maybe.

We have Debian 2.6.32 and DVB cards with two/four tunners on the each 
card. We want to assign specific number in /dev/dvb/ tree for each tuner.

The problems is that from udev point of view those devices(tuners) are 
absolutely equal(udefinfo gives absolutely identical output), because 
tuners are placed in one dvb card.

We'v googled and found that theoretically we can assign numbers in 
specific order with using ENV options in udev rules.

Here is a working example which creates symlinks:
# Create a symlinks for both tuners of Kworld device
SUBSYSTEM="dvb", ATTRS{idVendor}="1b80", ATTRS{idProduct}="e399", 
ENV{kworld}!="two", ENV{kworld}="two", PROGRAM="/bin/sh -c 'K=%k; 
K=$${K#dvb}; printf dvb/adapter_kw1/%%s $${K#*.}'", SYMLINK+="%c"
SUBSYSTEM="dvb", ATTRS{idVendor}="1b80", ATTRS{idProduct}="e399", 
ENV{kworld}="two", ENV{kworld}="one", PROGRAM="/bin/sh -c 'K=%k; 
K=$${K#dvb}; printf dvb/adapter_kw2/%%s $${K#*.}'", SYMLINK+="%c"

But we do want devices instead of symlinks, like e.g. /dev/dvb/adapterX

We'v tried such rules, but has no luck:

SUBSYSTEM="dvb", KERNELS="0000:04:00.0", ENV{kworld}!="two", 
ENV{kworld}="one", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf 
dvb/adapter1/%%s $${K#*.}'", NAME="%c", GROUP="video"
SUBSYSTEM="dvb", KERNELS="0000:04:00.0", ENV{kworld}="two", 
ENV{kworld}="one", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf 
dvb/adapter2/%%s $${K#*.}'", NAME="%c", GROUP="video"

Can someone give an advice how to properly construct rules to assign 
devices. It woul be great with an example string
Mb we missing some global udev option to enable such constructions?

Tnx in advance.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: UDEV identical devices. How to?
  2012-07-03  9:20 UDEV identical devices. How to? Budnev Vladimir
@ 2012-07-03  9:36 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2012-07-03  9:36 UTC (permalink / raw)
  To: linux-hotplug

On Tue, Jul 3, 2012 at 11:20 AM, Budnev Vladimir
<vladimir.budnev@gmail.com> wrote:
> We have Debian 2.6.32 and DVB cards with two/four tunners on the each card.
> We want to assign specific number in /dev/dvb/ tree for each tuner.
>
> The problems is that from udev point of view those devices(tuners) are
> absolutely equal(udefinfo gives absolutely identical output), because tuners
> are placed in one dvb card.
>
> We'v googled and found that theoretically we can assign numbers in specific
> order with using ENV options in udev rules.
>
> Here is a working example which creates symlinks:
> # Create a symlinks for both tuners of Kworld device
> SUBSYSTEM="dvb", ATTRS{idVendor}="1b80", ATTRS{idProduct}="e399",
> ENV{kworld}!="two", ENV{kworld}="two", PROGRAM="/bin/sh -c 'K=%k;
> K=$${K#dvb}; printf dvb/adapter_kw1/%%s $${K#*.}'", SYMLINK+="%c"
> SUBSYSTEM="dvb", ATTRS{idVendor}="1b80", ATTRS{idProduct}="e399",
> ENV{kworld}="two", ENV{kworld}="one", PROGRAM="/bin/sh -c 'K=%k;
> K=$${K#dvb}; printf dvb/adapter_kw2/%%s $${K#*.}'", SYMLINK+="%c"
>
> But we do want devices instead of symlinks, like e.g. /dev/dvb/adapterX
>
> We'v tried such rules, but has no luck:
>
> SUBSYSTEM="dvb", KERNELS="0000:04:00.0", ENV{kworld}!="two",
> ENV{kworld}="one", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf
> dvb/adapter1/%%s $${K#*.}'", NAME="%c", GROUP="video"
> SUBSYSTEM="dvb", KERNELS="0000:04:00.0", ENV{kworld}="two",
> ENV{kworld}="one", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf
> dvb/adapter2/%%s $${K#*.}'", NAME="%c", GROUP="video"
>
> Can someone give an advice how to properly construct rules to assign
> devices. It woul be great with an example string
> Mb we missing some global udev option to enable such constructions?

You can't. You have to use symlinks.

http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/5503/focusU04

Kay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-03  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-03  9:20 UDEV identical devices. How to? Budnev Vladimir
2012-07-03  9:36 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).