UDEV_BIN=/sbin/udevd
test -x $UDEV_BIN || exit 5

# Check for config file and read it
UDEV_CONFIG=/etc/udev/udev.conf
test -r $UDEV_CONFIG || exit 6
. $UDEV_CONFIG

case "$1" in
    start)
        printf "Populating ${udev_root:-/dev} using udev: "
#        printf '\000\000\000\000' > /proc/sys/kernel/hotplug
        $UDEV_BIN -d || (echo "FAIL" && exit 1)
        udevadm trigger --type=subsystems --action=add
        udevadm trigger --type=devices --action=add
        udevadm settle --timeout=60 || logger -p 1 "!!! udevadm settle failed !!!"
        ;;
    stop)
        # Stop execution of events
        udevadm control --stop-exec-queue
        killall udevd
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac
