FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-03-2012, 09:07 AM
Budnev Vladimir
 
Default UDEV identical devices. How to?

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.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FF2B662.1050803@gmail.com">http://lists.debian.org/4FF2B662.1050803@gmail.com
 
Old 07-03-2012, 10:29 PM
Andrew Reid
 
Default UDEV identical devices. How to?

If you're set on using udev, it should be possible to find the
devices under /sys somewhere (/sys/bus/pci/...), and query them
for udev-sensitive attributes using udevinfo (or the appropriate
udevadm commands), until you find something that differs between
the two. Udev certainly can create device nodes, but I am not
an expert on that part.

But, you may find it simpler to just create static devices. It used
to be possible to create static devices in /lib/udev/devices -- at
boot-time, the device tree at that location gets copied over to
/dev, and after that, udev runs and does all the magic to create
the dynamic devices. If you know the right major and minor numbers,
and if they're consistent across reboots, and if there are no
conflicting udev devices, then the right mkdev should work.
It won't appear in /dev until reboot, but the /lib/udev/devices
entries will persist across reboots.

This is still true in the 2.6.32 kernels ("squeeze"), but
may not be true in the 3.0 series.

> 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.
--
Andrew Reid / reidac@bellatlantic.net


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 201207031829.19974.reidac@bellatlantic.net">http://lists.debian.org/201207031829.19974.reidac@bellatlantic.net
 
Old 07-04-2012, 09:38 AM
Budnev Vladimir
 
Default UDEV identical devices. How to?

07/04/12 02:29, Andrew Reid пишет:

If you're set on using udev, it should be possible to find the
devices under /sys somewhere (/sys/bus/pci/...), and query them
for udev-sensitive attributes using udevinfo (or the appropriate
udevadm commands), until you find something that differs between
the two. Udev certainly can create device nodes, but I am not
an expert on that part.

But, you may find it simpler to just create static devices. It used
to be possible to create static devices in /lib/udev/devices -- at
boot-time, the device tree at that location gets copied over to
/dev, and after that, udev runs and does all the magic to create
the dynamic devices. If you know the right major and minor numbers,
and if they're consistent across reboots, and if there are no
conflicting udev devices, then the right mkdev should work.
It won't appear in /dev until reboot, but the /lib/udev/devices
entries will persist across reboots.

This is still true in the 2.6.32 kernels ("squeeze"), but
may not be true in the 3.0 series.


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.

--
Andrew Reid / reidac@bellatlantic.net


Tnx for pointing to /lib/udev/devices. Following that way we'v found the
cause.


First we'v created /lib/udev/devices/dvb/adapter0 and populated it with
mknod with correct major and minor numbers(got them from exicted ls -l
/dev/adapter0/ output). Rebooted ... Strange, but no effect.major/minor
nodes in /dev/dvb/adapter0 was not the same as we made in
/lib/udev/devices/dvb/adapter0/. Ok we created different path
/lib/udev/devices/adapter0 (without dvb) and populated it the same way.
Rebooted and everything works as described in articles like "tmpfs /dev
created then content of /lib/udev/devices/ copied ..etc."


Ok but the problem with /dev/dvb dir looked strange. We'v cleared rules
in udev/rules.d and we thought that there will be no adapters in
/dev/dvb but after reboot adapters was added even with no rules in udev.
Wtf?


And then we faced with random article where was described that dvb
kernel modules populate /dev/ by themselvs. Tbh it looks for us like
ugly if-then-else code like "Ohe yeah its up tu udev to populate /dev
dir... but dvb kernel modules do such thing themselvs...".Ok mb 1000
other modules and diffferen utils do the same how do peape should know
that when struggling with udev rules with no result? Mb that should be
mentioned in manuals?


So now seems it's all clear and easy to fix for us. Tnx again for
pointing the right way.






--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FF40F0B.6010500@gmail.com">http://lists.debian.org/4FF40F0B.6010500@gmail.com
 

Thread Tools




All times are GMT. The time now is 03:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org