* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
@ 2006-03-03 21:01 ` Marco d'Itri
2006-03-04 0:12 ` Scott James Remnant
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Marco d'Itri @ 2006-03-03 21:01 UTC (permalink / raw)
To: linux-hotplug
On Mar 03, juuso.alasuutari@tamperelainen.org wrote:
> How can I tell udev to modprobe <module> only if <module> exists and hasn't been
> compiled in the kernel? In my experience modules are visible to udev only when
# check if the device has already been claimed by a driver
ENV{PHYSDEVDRIVER}="?*", GOTO="hotplug_driver_loaded"
ENV{MODALIAS}="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
LABEL="hotplug_driver_loaded"
Look at the Debian rules files for details.
> I need this feature for those modules that aren't autoloaded, such as rtc. The
> idea would not be to modprobe all modules that exist, but to add conditional
> that would run modprobe only if necessary.
I doubt that this buys you much anyway.
--
ciao,
Marco
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
2006-03-03 21:01 ` Marco d'Itri
@ 2006-03-04 0:12 ` Scott James Remnant
2006-03-04 0:51 ` Greg KH
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Scott James Remnant @ 2006-03-04 0:12 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
On Fri, 2006-03-03 at 22:01 +0100, Marco d'Itri wrote:
> On Mar 03, juuso.alasuutari@tamperelainen.org wrote:
>
> > How can I tell udev to modprobe <module> only if <module> exists and hasn't been
> > compiled in the kernel? In my experience modules are visible to udev only when
>
> # check if the device has already been claimed by a driver
> ENV{PHYSDEVDRIVER}=="?*", GOTO="hotplug_driver_loaded"
>
> ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
>
> LABEL="hotplug_driver_loaded"
>
This breaks drivers like joydev which augment an existing loaded driver.
PHYSDEVDRIVER contains usbhid, so you never load joydev (which is
expanded by the MODALIAS).
Scott
--
Scott James Remnant
scott@ubuntu.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
2006-03-03 21:01 ` Marco d'Itri
2006-03-04 0:12 ` Scott James Remnant
@ 2006-03-04 0:51 ` Greg KH
2006-03-04 2:49 ` juuso.alasuutari
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2006-03-04 0:51 UTC (permalink / raw)
To: linux-hotplug
On Fri, Mar 03, 2006 at 10:35:50PM +0200, juuso.alasuutari@tamperelainen.org wrote:
> Hello. This is my first post on this list, and I hope I'm not asking something
> that's already been dealt with. (I searched the docs and this list before
> posting.)
>
> How can I tell udev to modprobe <module> only if <module> exists and hasn't been
> compiled in the kernel? In my experience modules are visible to udev only when
> and after they are loaded, which makes finding a solution to my problem a bit
> of a paradox.
Look in /sys/module/ That will have the module name if the module is
loaded _or_ if the module is built into the kernel.
If it's not there, then it should be safe to load it.
Or you can always just try to load the thing, as if it's already in the
kernel built in, it will not be present in the tree as a module.
Hope this helps,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (2 preceding siblings ...)
2006-03-04 0:51 ` Greg KH
@ 2006-03-04 2:49 ` juuso.alasuutari
2006-03-04 5:42 ` Greg KH
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: juuso.alasuutari @ 2006-03-04 2:49 UTC (permalink / raw)
To: linux-hotplug
> > How can I tell udev to modprobe <module> only if <module> exists and hasn't
> been
> > compiled in the kernel? In my experience modules are visible to udev only
> when
> > and after they are loaded, which makes finding a solution to my problem a
> bit
> > of a paradox.
>
> Look in /sys/module/ That will have the module name if the module is
> loaded _or_ if the module is built into the kernel.
>
> If it's not there, then it should be safe to load it.
Thanks, that helped a lot. I wrote the following rules for snd_pcm_oss and rtc
based on your hint:
# Load ALSA OSS emulation sound module if not already loaded.
KERNEL!="snd_pcm_oss", SUBSYSTEM!="module", ACTION="add", RUN+="/sbin/modprobe
snd_pcm_oss"
# Load real time clock module if not already loaded.
KERNEL!="rtc", SUBSYSTEM!="module", RUN+="/sbin/modprobe rtc"
They work at least when running udevstart in console, haven't yet rebooted.
One thing bugs me, though. I tried to be smart and make it so that snd_pcm_oss
wouldn't try to load unless snd_pcm was loaded, but snd_pcm_oss refused to load
altogether. Here's what I wrote:
KERNEL!="snd_pcm", SUBSYSTEM!="module", GOTO="bypass_oss"
KERNEL!="snd_pcm_oss", SUBSYSTEM!="module", ACTION="add", RUN+="/sbin/modprobe
snd_pcm_oss"
LABEL="bypass_oss"
What might be wrong with it?
Juuso
----------------------------------------------------------------
This mail sent through L-secure: http://www.l-secure.net/
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (3 preceding siblings ...)
2006-03-04 2:49 ` juuso.alasuutari
@ 2006-03-04 5:42 ` Greg KH
2006-03-04 12:07 ` juuso.alasuutari
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2006-03-04 5:42 UTC (permalink / raw)
To: linux-hotplug
On Sat, Mar 04, 2006 at 04:49:43AM +0200, juuso.alasuutari@tamperelainen.org wrote:
> > > How can I tell udev to modprobe <module> only if <module> exists and hasn't
> > been
> > > compiled in the kernel? In my experience modules are visible to udev only
> > when
> > > and after they are loaded, which makes finding a solution to my problem a
> > bit
> > > of a paradox.
> >
> > Look in /sys/module/ That will have the module name if the module is
> > loaded _or_ if the module is built into the kernel.
> >
> > If it's not there, then it should be safe to load it.
>
> Thanks, that helped a lot. I wrote the following rules for snd_pcm_oss and rtc
> based on your hint:
>
> # Load ALSA OSS emulation sound module if not already loaded.
> KERNEL!="snd_pcm_oss", SUBSYSTEM!="module", ACTION="add", RUN+="/sbin/modprobe
> snd_pcm_oss"
>
> # Load real time clock module if not already loaded.
> KERNEL!="rtc", SUBSYSTEM!="module", RUN+="/sbin/modprobe rtc"
No, this kind of thing belongs in your distro's "load these modules at
boot time" list. Everyone has this, it's just in different locations
(/etc/sysconfig/modules in SuSE, /etc/modules.autoload/kernel-2.6/ for
Gentoo, etc.)
Don't mess with udev rules for things like this, it's just not worth it.
Use the infrastructure that is already present and solves this today.
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (4 preceding siblings ...)
2006-03-04 5:42 ` Greg KH
@ 2006-03-04 12:07 ` juuso.alasuutari
2006-03-04 12:10 ` Marco d'Itri
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: juuso.alasuutari @ 2006-03-04 12:07 UTC (permalink / raw)
To: linux-hotplug
Quoting Greg KH <greg@kroah.com>:
> > # Load ALSA OSS emulation sound module if not already loaded.
> > KERNEL!="snd_pcm_oss", SUBSYSTEM!="module", ACTION="add",
> RUN+="/sbin/modprobe
> > snd_pcm_oss"
> >
> > # Load real time clock module if not already loaded.
> > KERNEL!="rtc", SUBSYSTEM!="module", RUN+="/sbin/modprobe rtc"
>
> No, this kind of thing belongs in your distro's "load these modules at
> boot time" list. Everyone has this, it's just in different locations
> (/etc/sysconfig/modules in SuSE, /etc/modules.autoload/kernel-2.6/ for
> Gentoo, etc.)
>
> Don't mess with udev rules for things like this, it's just not worth it.
> Use the infrastructure that is already present and solves this today.
>
> thanks,
>
> greg k-h
>
OK. I'm using Source Mage, and there indeed exists a file /etc/modules.
The reason I wanted a udev rule for rtc (among many) is because the udev
autoload rule isn't doing everything that hotplug was. rtc is one example of
modules that were loaded by hotplug before but not by udev now. Same goes for
the irda modules. Obviously I didn't have entries for them in /etc/modules back
then, so I am hoping to figure out why they aren't loading and if there's
anything I can do about that with udev.
Any thoughts on this?
Sincerelly,
Juuso
PS: As I really enjoy messing with udev stuff and also contribute to Source
Mage's development, I would like to know if there are any dangers in loading
these modules with udev. If so, I'll just use the approach pointed out to me.
But if it's possible to use udev, why not edit Source Mage's own udev rules to
load those modules that are all-around useful, and leave it to the user to put
others in /etc/modules?
(I have to admit that right now I don't have a clear image of which modules
really are "all-around useful", so I'm just assuming that all modules which
were loaded by hotplug are such, rtc being one example.)
----------------------------------------------------------------
This mail sent through L-secure: http://www.l-secure.net/
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (5 preceding siblings ...)
2006-03-04 12:07 ` juuso.alasuutari
@ 2006-03-04 12:10 ` Marco d'Itri
2006-03-06 23:45 ` juuso.alasuutari
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Marco d'Itri @ 2006-03-04 12:10 UTC (permalink / raw)
To: linux-hotplug
On Mar 04, juuso.alasuutari@tamperelainen.org wrote:
> Any thoughts on this?
These modules are not being loaded automatically because they lack the
needed aliases. I added these to the debian package:
alias pnp:dPNP0510 irtty-sir
alias pnp:dPNP0511 irtty-sir
alias pnp:dPNP0700 floppy
alias pnp:dPNP0800 pcspkr
alias pnp:dPNP0b00 rtc
alias pnp:dPNP0303 atkbd
alias pnp:dPNP0f13 psmouse
alias pnp:dPNPb02f analog
And then I use this rule:
SUBSYSTEM="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'"
It's still not perfect, drivers which have card PNP aliases do not
export them to sysfs.
--
ciao,
Marco
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (6 preceding siblings ...)
2006-03-04 12:10 ` Marco d'Itri
@ 2006-03-06 23:45 ` juuso.alasuutari
2006-03-08 9:38 ` Andrey Borzenkov
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: juuso.alasuutari @ 2006-03-06 23:45 UTC (permalink / raw)
To: linux-hotplug
Quoting Marco d'Itri <md@Linux.IT>:
> These modules are not being loaded automatically because they lack the
> needed aliases. I added these to the debian package:
>
> alias pnp:dPNP0510 irtty-sir
> alias pnp:dPNP0511 irtty-sir
> alias pnp:dPNP0700 floppy
> alias pnp:dPNP0800 pcspkr
> alias pnp:dPNP0b00 rtc
> alias pnp:dPNP0303 atkbd
> alias pnp:dPNP0f13 psmouse
> alias pnp:dPNPb02f analog
>
> And then I use this rule:
>
> SUBSYSTEM="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read
> id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'"
>
> It's still not perfect, drivers which have card PNP aliases do not
> export them to sysfs.
Where do those "alias ..." lines go exactly?
How did hotplug manage to load these modules without them having aliases, by the
way? And are there any tools for finding out what modules lack this necessary
info, except hands-on experimentation?
What would it take to make these kind of special arrangements unnecessary? On
what level would the changes have to happen? In udev, or in the kernel perhaps?
In whose court is the ball on this matter?
Juuso
----------------------------------------------------------------
This mail sent through L-secure: http://www.l-secure.net/
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (7 preceding siblings ...)
2006-03-06 23:45 ` juuso.alasuutari
@ 2006-03-08 9:38 ` Andrey Borzenkov
2006-03-31 20:52 ` juuso.alasuutari
2006-04-01 1:05 ` Greg KH
10 siblings, 0 replies; 12+ messages in thread
From: Andrey Borzenkov @ 2006-03-08 9:38 UTC (permalink / raw)
To: linux-hotplug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 07 March 2006 02:45, juuso.alasuutari@tamperelainen.org wrote:
> Quoting Marco d'Itri <md@Linux.IT>:
> > These modules are not being loaded automatically because they lack the
> > needed aliases. I added these to the debian package:
> >
> > alias pnp:dPNP0510 irtty-sir
> > alias pnp:dPNP0511 irtty-sir
> > alias pnp:dPNP0700 floppy
> > alias pnp:dPNP0800 pcspkr
> > alias pnp:dPNP0b00 rtc
> > alias pnp:dPNP0303 atkbd
> > alias pnp:dPNP0f13 psmouse
> > alias pnp:dPNPb02f analog
> >
> > And then I use this rule:
> >
> > SUBSYSTEM="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while
> > read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'"
> >
> > It's still not perfect, drivers which have card PNP aliases do not
> > export them to sysfs.
>
> Where do those "alias ..." lines go exactly?
>
/etc/modprobe.conf I assume
> How did hotplug manage to load these modules without them having aliases,
> by the way?
It could have some built-in list of modules.
> And are there any tools for finding out what modules lack this
> necessary info, except hands-on experimentation?
>
I doubt it. If you know that device has PNP id and know its driver, check for
existence of MODULE_DEVICE_TABLE(pnp,...). If it is missing, driver does not
export PNP IDs it supports and no module aliases are created.
> What would it take to make these kind of special arrangements unnecessary?
> On what level would the changes have to happen? In udev, or in the kernel
> perhaps? In whose court is the ball on this matter?
>
This is kernel issue. And adding ID table is not enough because PNP subsystem
does not support modalias (at least here, 2.6.15.6, it is missing). So you
still need the above hack even if module properly defines aliases.
- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)
iD8DBQFEDqYlR6LMutpd94wRAmGtAJwOZ8pUaeKvOOYotAoearVIKHsRSwCfTO+I
lZ8gkVdgM5hN8H3NCpUXu60=Sa0X
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (8 preceding siblings ...)
2006-03-08 9:38 ` Andrey Borzenkov
@ 2006-03-31 20:52 ` juuso.alasuutari
2006-04-01 1:05 ` Greg KH
10 siblings, 0 replies; 12+ messages in thread
From: juuso.alasuutari @ 2006-03-31 20:52 UTC (permalink / raw)
To: linux-hotplug
Returning again to the module autoloading issue.
First of all, thank you very much for the help! :) I've managed to exile hotplug
from my system.
I still have a question, though: Does autoloading modules & firmware with udev
also work with kernels older than 2.6.15?
Sincerelly,
Juuso Alasuutari
----------------------------------------------------------------
This mail sent through L-secure: http://www.l-secure.net/
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread* Re: How to check if driver is in-built or module?
2006-03-03 20:35 How to check if driver is in-built or module? juuso.alasuutari
` (9 preceding siblings ...)
2006-03-31 20:52 ` juuso.alasuutari
@ 2006-04-01 1:05 ` Greg KH
10 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2006-04-01 1:05 UTC (permalink / raw)
To: linux-hotplug
On Fri, Mar 31, 2006 at 11:52:25PM +0300, juuso.alasuutari@tamperelainen.org wrote:
> Returning again to the module autoloading issue.
>
> First of all, thank you very much for the help! :) I've managed to exile hotplug
> from my system.
>
> I still have a question, though: Does autoloading modules & firmware with udev
> also work with kernels older than 2.6.15?
Yes, it should.
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
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] 12+ messages in thread