linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Wright <anthony@communitymesh.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: The DRIVER rule doesn't seem to work
Date: Thu, 03 Aug 2006 08:40:12 +0000	[thread overview]
Message-ID: <44D1B66C.9010401@communitymesh.com> (raw)
In-Reply-To: <44CCAD5F.9010407@communitymesh.com>

Kay Sievers wrote:
>> 1)
>> ENV{PHYSDEVDRIVER}="?*", GOTO="driver_already_loaded"
>> ACTION="add", ENV{MODALIAS}="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
>> # <other modprobe rules>
>> LABEL="driver_already_loaded"
>>
>> 2)
>> PROGRAM="/bin/sh -c '[ -e /sys$$DEVPATH/driver -o -e 
>> /sys$$DEVPATH/device/driver ]'", GOTO="driver_already_loaded"
>> ACTION="add", ENV{MODALIAS}="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
>> # <other modprobe rules>
>> LABEL="driver_already_loaded"
>>
>> 3)
>> DRIVER="?*", GOTO="driver_already_loaded"
>> ACTION="add", ENV{MODALIAS}="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
>> # <other modprobe rules>
>> LABEL="driver_already_loaded"
>>
>> Of these (1) I understand uses an obsolete variable that will be removed 
>> in kernel 2.6.18,
>>     
>
> PHYSDEV* will not go away with the next kernel. It will be scheduled for
> removal when we converted all users of sysfs to /sys/devices, which will
> take a while.
>   
>> (1) and (2) give identical results on my machine, and are the results I 
>> expect (some of my devices don't have drivers). (3) gives different 
>> results, returning no driver for devices which I know have drivers, and 
>> drivers for devices which I know do not have drivers.
>>
>> What I believe is happening is that DRIVER is looking at the device's 
>> ancestor's drivers (parent, grandparent etc, but not the device itself), 
>> and returning their driver if they have one.
>>     
>
> Sure, it looks a the device itself, but also walks up the parents and
> finds a DRIVER value there.
>   
I had a good look at this, and from what I can tell it only looks at the 
device's parents, not the device itself. I compiled and ran udev with 
debug to see what was going on (and have lots of logs if you're 
interested), but the short version is that while udev makes a DRIVER 
test for the device, it looks like the driver field hasn't been loaded 
for the device, only for the device's parents. From my  logs, it seems 
that to load values for the device the function 
sysfs_device_set_values() is called in isolation, while for the parents 
sysfs_device_get() is called which calls sysfs_device_set_values(), but 
also sets the driver field.

While I felt this was rather strange, i also noticed that udevinfo -a -p 
<path> only displays a driver for the parents, not for the driver 
itself. Since both pieces of code are consistant, I wondered if this was 
intentional behaviour, even though I couldn't work out why you would 
want it that way, and it's the opposite of what I need.

>> I believe DRIVER should return only the driver of the device, and not 
>> its ancestors.
>>     
> It's like all not event-specific rule keys work, they look up the chain
> of parents. Only ACTION, KERNEL, SUBSYSTEM, DEVPATH are matched against
> the event device only. DRIVER, BUS, ID, SYSFS walks up the chain.
>
> Usually you just select the device you want to match the DRIVER value
> with BUS= (which is the subsystem value of the parent). The difference
> between BUS and SUBSYSTEM is only, that BUS matches also against the
> parents. Same logic for KERNEL and ID. That all has historical reasons
> only, cause it took us quite a while to find out what we really need for
> the rules.
>
> In your case DRIVER can't work, that's right. In a lot of other cases it
> is useful that it looks at the parent.
>
> So, ideally we would just have:
>   KERNEL=
>   SUBSYSTEM=
>   DRIVER=
>   SYSFS{}=
>
> deprecate the use of:
>   BUS=
>   ID=
>
> and use some syntax switch at KERNEL, SUBSYSTEM, DRIVER, SYSFS to
> signify if we want to look at the parents or not. That may be more
> consistent, than the current key names?
>   
Something like this would be exactly what I'm looking for.

Thanks,

Tony.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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

  parent reply	other threads:[~2006-08-03  8:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-30 12:58 The DRIVER rule doesn't seem to work Anthony Wright
2006-07-30 14:20 ` Kay Sievers
2006-08-03  8:40 ` Anthony Wright [this message]
2006-08-03  8:44 ` Kay Sievers
2006-08-03  9:45 ` Anthony Wright
2006-08-03 18:12 ` Kay Sievers
2006-08-11 21:59 ` Anthony Wright
2006-08-13  3:23 ` Kay Sievers
2006-08-14  7:29 ` Anthony Wright
2006-08-14 10:59 ` Kay Sievers
2006-08-23  0:05 ` Kay Sievers
2006-08-23  0:16 ` Kay Sievers
2006-08-24 14:34 ` Anthony Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44D1B66C.9010401@communitymesh.com \
    --to=anthony@communitymesh.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).