* Re: udev doesn't know about devices further up the tree.
2006-06-16 8:05 udev doesn't know about devices further up the tree Simon Huggins
@ 2006-06-16 8:35 ` Kay Sievers
2006-06-16 8:50 ` Simon Huggins
2006-06-16 8:57 ` Kay Sievers
2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2006-06-16 8:35 UTC (permalink / raw)
To: linux-hotplug
On Fri, 2006-06-16 at 09:05 +0100, Simon Huggins wrote:
> I wrote my first udev rule the other day.
>
> It reads:
> KERNEL="sd*", PROGRAM="/home/huggie/bin/camera %k", SYMLINK+="%c"
> where bin/camera does:
> DEV=$1
> DISK=`echo $DEV|sed -e 's/.*\(sd.\).*/\1/;'`
> udevinfo -a -p /block/$DISK/$DEV|grep manuf|grep PENTAX >/dev/null 2>&1 && \
> echo camera && exit 0
>
> i.e. basically if the usb device (or any device because I'm not that
> fussy) above the block device is made by PENTAX then echo camera
> otherwise I just echo $DEV back again.
>
> But it strikes me as a bug that I have to spawn out of udevd to run
> udevinfo in order to just name the device based on what it is.
>
>
> Why aren't SYSFS attributes from higher up the device path available
> somehow when writing rules?
Adding a single SYSFS attribute:
SYSFS{vendor}="PENTAX"
or
SYSFS{manufacturer}="PENTAX"
should do it and will try to find the value on all devices up the chain,
but you can't mix SYSFS, BUS or ID values from different devices.
Kay
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: udev doesn't know about devices further up the tree.
2006-06-16 8:05 udev doesn't know about devices further up the tree Simon Huggins
2006-06-16 8:35 ` Kay Sievers
@ 2006-06-16 8:50 ` Simon Huggins
2006-06-16 8:57 ` Kay Sievers
2 siblings, 0 replies; 4+ messages in thread
From: Simon Huggins @ 2006-06-16 8:50 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1.1: Type: text/plain, Size: 2239 bytes --]
On Fri, Jun 16, 2006 at 10:35:33AM +0200, Kay Sievers wrote:
> On Fri, 2006-06-16 at 09:05 +0100, Simon Huggins wrote:
> > I wrote my first udev rule the other day.
> > It reads:
> > KERNEL=="sd*", PROGRAM="/home/huggie/bin/camera %k", SYMLINK+="%c"
> > where bin/camera does:
> > DEV=$1
> > DISK=`echo $DEV|sed -e 's/.*\(sd.\).*/\1/;'`
> > udevinfo -a -p /block/$DISK/$DEV|grep manuf|grep PENTAX >/dev/null 2>&1 && \
> > echo camera && exit 0
> > i.e. basically if the usb device (or any device because I'm not that
> > fussy) above the block device is made by PENTAX then echo camera
> > otherwise I just echo $DEV back again.
> > But it strikes me as a bug that I have to spawn out of udevd to run
> > udevinfo in order to just name the device based on what it is.
> > Why aren't SYSFS attributes from higher up the device path available
> > somehow when writing rules?
> Adding a single SYSFS attribute:
> SYSFS{vendor}=="PENTAX"
> or
> SYSFS{manufacturer}=="PENTAX"
> should do it and will try to find the value on all devices up the chain,
> but you can't mix SYSFS, BUS or ID values from different devices.
Hmm, ok it's working now. I must have fucked up the rule somehow
originally sorry for wasting your time.
Can I suggest that the part in
http://www.reactivated.net/writing_udev_rules.html
which says:
This is to demonstrate that you generally can not mix-and-match
attributes from different sections of the udevinfo output - your
rule will not work.
be reworded or removed then. I'm not quite sure what it should say - I
just failed and then read more of the docs and came across this and
thought that what I was trying was never going to work.
I now have:
KERNEL=="sd*", SUBSYSTEM=="block", SYSFS{manufacturer}=="PENTAX",
SYMLINK+="camera"
which appears to work fine yet the block and the PENTAX are indeed in
different sections of the udevinfo output.
--
,--huggie-at-earth-dot-li--------stuff-thing-stuff----------DF5CE2B4--.
_| "Don't worry, understanding of the topic being discussed has been |_
| optional for a long time on debian-devel@." -- Md |
`- http://www.earth.li/~huggie/ - http://www.blackcatnetworks.co.uk/ -'
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
[-- Attachment #3: Type: text/plain, Size: 226 bytes --]
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: udev doesn't know about devices further up the tree.
2006-06-16 8:05 udev doesn't know about devices further up the tree Simon Huggins
2006-06-16 8:35 ` Kay Sievers
2006-06-16 8:50 ` Simon Huggins
@ 2006-06-16 8:57 ` Kay Sievers
2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2006-06-16 8:57 UTC (permalink / raw)
To: linux-hotplug
On Fri, 2006-06-16 at 09:50 +0100, Simon Huggins wrote:
> On Fri, Jun 16, 2006 at 10:35:33AM +0200, Kay Sievers wrote:
> > On Fri, 2006-06-16 at 09:05 +0100, Simon Huggins wrote:
> > > I wrote my first udev rule the other day.
> > > It reads:
> > > KERNEL="sd*", PROGRAM="/home/huggie/bin/camera %k", SYMLINK+="%c"
> > > where bin/camera does:
> > > DEV=$1
> > > DISK=`echo $DEV|sed -e 's/.*\(sd.\).*/\1/;'`
> > > udevinfo -a -p /block/$DISK/$DEV|grep manuf|grep PENTAX >/dev/null 2>&1 && \
> > > echo camera && exit 0
> > > i.e. basically if the usb device (or any device because I'm not that
> > > fussy) above the block device is made by PENTAX then echo camera
> > > otherwise I just echo $DEV back again.
> > > But it strikes me as a bug that I have to spawn out of udevd to run
> > > udevinfo in order to just name the device based on what it is.
> > > Why aren't SYSFS attributes from higher up the device path available
> > > somehow when writing rules?
> > Adding a single SYSFS attribute:
> > SYSFS{vendor}="PENTAX"
> > or
> > SYSFS{manufacturer}="PENTAX"
>
> > should do it and will try to find the value on all devices up the chain,
> > but you can't mix SYSFS, BUS or ID values from different devices.
>
> Hmm, ok it's working now. I must have fucked up the rule somehow
> originally sorry for wasting your time.
>
> Can I suggest that the part in
> http://www.reactivated.net/writing_udev_rules.html
> which says:
>
> This is to demonstrate that you generally can not mix-and-match
> attributes from different sections of the udevinfo output - your
> rule will not work.
>
> be reworded or removed then. I'm not quite sure what it should say - I
> just failed and then read more of the docs and came across this and
> thought that what I was trying was never going to work.
>
> I now have:
> KERNEL="sd*", SUBSYSTEM="block", SYSFS{manufacturer}="PENTAX",
> SYMLINK+="camera"
> which appears to work fine yet the block and the PENTAX are indeed in
> different sections of the udevinfo output.
Right, I means, you can't mix attributes of different parent devices.
The attributes for the device itself, which "block" belongs to, will
always match. Say:
SYSFS{vendor}="PENTAX", SYSFS{manufacturer}="PENTAX"
would not match, even when both single keys are matching.
Kay
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread