]> Zhao Yanbai Git Server - minix.git/commitdiff
Add hot plugging infrastructure in rc file.
authorKees Jongenburger <kees.jongenburger@gmail.com>
Mon, 4 Jun 2012 11:15:23 +0000 (11:15 +0000)
committerKees Jongenburger <kees.jongenburger@gmail.com>
Mon, 18 Jun 2012 07:31:14 +0000 (09:31 +0200)
Adding hot plugging infrastructure in rc file. This includes
starting the devman service, mounting it's file system and
starting the corresponding devmand daemon.

This patch also provide error free shutdown of the USB sub-system.

The USB sub system needs to be shutdown in a certain order but also
consists of components living in /usr/pkg/. By checking the
existence of usbd we can stop it in the correct order.

etc/rc

diff --git a/etc/rc b/etc/rc
index a8c137b9e444433d025db12dea5424f73ee4f0fb..74d45912b5adc42c595811cd9613fd7b2ab6855c 100755 (executable)
--- a/etc/rc
+++ b/etc/rc
@@ -189,10 +189,41 @@ start)
        cp /usr/lib/em* /usr/lib/cpp* /lib
     esac
 
+    echo -n "Starting hotplugging infrastructure... "
+    service up /sbin/devman
+    if [ ! -d /sys ]
+    then
+        mkdir /sys
+    fi
+    mount -e -t devman none /sys
+    rm -f /var/tmp/devmand_control
+    rm -f /var/run/devmand.pid
+    devmand -d /etc/devmand -d /usr/pkg/etc/devmand &
+    echo "done."
+
     # Things should be alright now.
     ;;
 down|stop)
     sync
+    if [ -f /var/run/devmand.pid ]
+    then
+       kill -INT `cat /var/run/devmand.pid`
+        # without this delay the following will 
+        # be printed in the console
+        # RS: devman not running?
+        sleep 1
+    fi
+    #
+    # usbd needs to be stopped exactly 
+    # at this stage(before stopping devman
+    # and after stopping the services
+    # stated by devmand)
+    if [ -x /usr/pkg/etc/rc.d/usbd ]
+    then 
+       /usr/pkg/etc/rc.d/usbd stop
+    fi
+    umount -e /sys
+    service down devman
     # Tell RS server we're going down.
     service shutdown
     ;;