SOURCES: start_udev - retrigger events/wait for events

freetz freetz at pld-linux.org
Thu Jan 26 17:57:50 CET 2006


Author: freetz                       Date: Thu Jan 26 16:57:47 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- retrigger events/wait for events

---- Files affected:
SOURCES:
   start_udev (1.30 -> 1.31) 

---- Diffs:

================================================================
Index: SOURCES/start_udev
diff -u SOURCES/start_udev:1.30 SOURCES/start_udev:1.31
--- SOURCES/start_udev:1.30	Thu Jan 26 17:49:20 2006
+++ SOURCES/start_udev	Thu Jan 26 17:57:42 2006
@@ -106,17 +106,54 @@
 
 if [ -f "/sys/class/tty/console/uevent" ]; then
 	# Start udevd daemon
-	udevd -d
+	udevd --daemon
 	
         # Making extra nodes
 	make_extra_nodes
 	
         # Setting default hotplug handler
 	set_hotplug_handler
+	
+	# retrigger all events
+	mkdir -p /dev/.udev/queue
+	list=$(echo /sys/bus/*/devices/*/uevent)
+	list="$list $(echo /sys/class/*/*/uevent)"
+	list="$list $(echo /sys/block/*/uevent /sys/block/*/*/uevent)"
+	for i in $list; do
+	    case "$i" in
+		*/device/uevent|*\**)
+		    continue
+		    ;;
+		*/class/mem/*|*/class/tty/*)
+		    first="$first $i"
+		    ;;
+		*/block/md*)
+		    last="$last $i"
+		    ;;
+		*/*)
+		    default="$default $i"
+		    ;;
+	    esac
+	done
+
+	# trigger the sorted events
+	for i in $first $default $last; do
+	    echo "add" > "$i"
+	done
+
+
+	# wait for the events to finish
+	loop=300
+	while test -d /dev/.udev/queue; do
+	    sleep 0.1;
+	    test "$loop" -gt 0 || break
+	    loop=$(($loop - 1))
+	done
 else
-    echo "udev requires a kernel >= 2.6.15, not started."
-    exit 0                                                
+	echo "udev requires a kernel >= 2.6.15, not started."
+	exit 0                                                
 fi
+
 ret=$(( $ret + $? ))
 [ $ret -eq 0 ] && ok || fail
 exit 0
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/start_udev?r1=1.30&r2=1.31&f=u



More information about the pld-cvs-commit mailing list