smdev

suckless mdev
git clone git://git.suckless.org/smdev
Log | Files | Refs | README | LICENSE

simevent (323B)


      1 #!/bin/sh
      2 #
      3 # Simulate add/remove events by writing directly
      4 # into the uevent files.
      5 
      6 if [ "$#" -ne 1 ] || [ "$1" != add ] && [ "$1" != remove ]; then
      7 	echo "usage: simevent add|remove" 1>&2
      8 	exit 1
      9 fi
     10 
     11 find /sys/devices -type f -path '*/dev' -exec \
     12 	sh -c 'for f do printf %s\\n "$0" > "${f%/*}"/uevent; done' "$1" {} +