From: juuso.alasuutari@tamperelainen.org Date: Sat, 04 Mar 2006 02:49:43 +0000 Subject: Re: How to check if driver is in-built or module? Message-Id: <1141440583.440900475fa2c@cs1.alpha12.l-secure.net> List-Id: References: <1141418150.4408a8a625721@cs1.alpha12.l-secure.net> In-Reply-To: <1141418150.4408a8a625721@cs1.alpha12.l-secure.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org > > How can I tell udev to modprobe only if 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&kid0944&bid$1720&dat1642 _______________________________________________ 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