mirror of
https://github.com/troglobit/libuev.git
synced 2026-11-13 17:01:02 +00:00
populate
This commit is contained in:
1 parent
df97341950
commit
76952a692c
6 files changed
+166
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/ash
|
||||
|
||||
exec 1>/dev/console 2>&1
|
||||
|
||||
P=/sys$DEVPATH
|
||||
[ -r $P/uevent ] && . $P/uevent
|
||||
|
||||
# Exit unless proper type
|
||||
[ $SUBSYSTEM = "usb-serial" -a -n "$DRIVER" ] || exit 0
|
||||
|
||||
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
|
||||
ME=${0##*/}
|
||||
say ()
|
||||
{
|
||||
echo "$ME: $@"
|
||||
logger -t $ME "$@"
|
||||
}
|
||||
|
||||
MANU=$( ( test -r $P/../manufacturer && cat $P/../manufacturer ) || \
|
||||
( test -r $P/../../manufacturer && cat $P/../../manufacturer ) || echo "generic" )
|
||||
|
||||
PORT=$( cat $P/port_number )
|
||||
DEV_NM="$DRIVER-$(cat $P/../../idVendor)-$(cat $P/../../idProduct)"
|
||||
DEVP=/dev/ttyusb/$DEV_NM
|
||||
|
||||
if [ $ACTION = "add" ] ;then
|
||||
mkdir -p $DEVP
|
||||
ln -sf /dev/$MDEV $DEVP/$PORT
|
||||
say "Add $DEVP/$PORT -> /dev/$MDEV MANU $MANU"
|
||||
elif [ $ACTION = "remove" ] ;then
|
||||
rm -f /dev/ttyusb/$MANU/$DEV_NM/$PORT
|
||||
say "Rem $DEVP/$PORT -> /dev/$MDEV MANU $MANU"
|
||||
else
|
||||
say "Unknown action $ACTION for $MDEV $MANU $DEV_NM"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user