From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Brownell Date: Fri, 17 Jun 2005 19:26:52 +0000 Subject: Re: udev vs. devfs Message-Id: <200506171226.53160.david-b@pacbell.net> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Boundary-00=_9PysCB8Ik/+boLf" List-Id: References: In-Reply-To: To: linux-hotplug@vger.kernel.org --Boundary-00=_9PysCB8Ik/+boLf Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Friday 17 June 2005 12:21 pm, David Brownell wrote: > On Thursday 16 June 2005 10:10 am, Vassilis Virvilis wrote: > > ... > > I am sure somebody will popup with a better script/procedure or something > > but anyway here are my 2dr. > > It hit the spot for me, pretty much. Here are my updated versions; > Whoops, HERE they are. --Boundary-00=_9PysCB8Ik/+boLf Content-Type: text/plain; charset="us-ascii"; name="coldplug" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="coldplug" #!/bin/ash # # "coldplug" ensures every hardware device present has its driver loaded, # even if its hotplug event was ignored since it was too early in system # startup for hotplug processing to work. Loading the driver will cause # another hotplug event that will lead to /dev node creation. # # Run this during system startup shortly after /dev has been initialized # using udevstart. if [ ! -d /sys/devices ] then exit 1 fi # "new style" kernel hotplug has module-init-tools do the thinking cd /sys/devices for DIR in $(find . -type d) do if [ -f $DIR/modalias -a ! -f $DIR/driver ] then modprobe -q $(cat $DIR/modalias) fi done # FIXME will MODULE_ALIAS("name.*") work for "name.3" devices? cd /sys/devices/platform for DEV in * do if [ ! -L $DEV/driver ] then # some platform drivers will need a MODULE_ALIAS() modprobe -q $DEV fi done # REVISIT pcmcia doesn't yet have "modalias" files if [ -d /sys/bus/pcmcia/devices ] then cd /sys/bus/pcmcia/devices for F in * do modprobe -q $(pcmcia-modalias $F) done fi --Boundary-00=_9PysCB8Ik/+boLf Content-Type: text/plain; charset="us-ascii"; name="hotplug" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="hotplug" #!/bin/ash # # "hotplug" initializes devices ... hardware drivers get modprobed and # create class devices. then later udev handles /dev node creation and # invokes programs that make userspace aware of the new device node. # # install as /sbin/hotplug if [ ! -d /sys ] then exit 1 fi cd /sys if [ "$ACTION" = "add" -a "$SUBSYSTEM" = "mmc" ] then # MMC doesn't support modalias yet, but mmc_block is # the only useful option until Linux gets SDIO support. MODALIAS=mmc_block fi if [ "$ACTION" = "add" -a -n "$MODALIAS" -a ! -L $DEVPATH/driver ] then # REVISIT: pcmcia currently needs special cases here, # for non-static mapped sockets and many CF memory cards. # most important subsystems now have $MODALIAS support: modprobe -q $MODALIAS fi if [ -n "$DEVPATH" ] then /sbin/udevsend $1 fi --Boundary-00=_9PysCB8Ik/+boLf-- ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ 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