From 61881417faf2ce8a67428d177f00a749d00622e3 Mon Sep 17 00:00:00 2001 From: Raf Czlonka Date: Wed, 25 Mar 2020 01:59:59 +0000 Subject: [PATCH] Provide a working hotplugd(8) attach example Current example not only doesn't work but also hard-codes `ugen0` device name. Fix whitespace while there. --- tools/openbsd/attach | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/openbsd/attach b/tools/openbsd/attach index b6c98c8c6..9dc3e1e6f 100755 --- a/tools/openbsd/attach +++ b/tools/openbsd/attach @@ -8,13 +8,12 @@ case $DEVCLASS in # generic devices case "$DEVNAME" in ugen*) - BUSNAME=`usbdevs -v -d | egrep "Controller|$DEVNAME\$" | grep -B 1 ugen0$ | head -n 1 | sed -e 's,Controller ,,' -e 's,:$,,' ` - echo $BUSNAME > /var/run/${DEVNAME}.bus + BUSNAME=$(usbdevs -vv | egrep "Controller|$DEVNAME\$" | grep -B 1 "$DEVNAME\$" | awk -F'[ :]' '/^Controller/ { print $2 }') + echo $BUSNAME > /var/run/${DEVNAME}.bus # probably our scanner chgrp usb /dev/"$DEVNAME".* chgrp usb /dev/"$BUSNAME" ;; esac - - ;; + ;; esac