smdev

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

commit 6ba112096e874651ad6fcc960fa608c501aaab2d
parent a6903cbf34a395db271573304ab3c5cf931c96f1
Author: sin <sin@2f30.org>
Date:   Thu, 22 Aug 2013 16:58:47 +0100

Add simevent

Diffstat:
Asimevent | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/simevent b/simevent @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Simulate add/remove events by writing directly +# into the uevent files. + +if [[ -z $1 ]]; then + echo "usage: $(basename $0) add|remove" 2>&1 + exit 1 +fi + +ev=$1 +for i in $(find /sys/devices -type f); do + f=$(basename $i) + if [[ $f = "dev" ]]; then + d=$(dirname $i) + echo $ev > $d/uevent + fi +done