summaryrefslogtreecommitdiff
path: root/tools/openbsd
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-10-06 14:00:40 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-10-06 14:00:40 +0200
commit6e9c41a892ed0e0da326e0278b3221ce3f5713b8 (patch)
tree2e301d871bbeeb44aa57ff9cc070fcf3be484487 /tools/openbsd
Initial import of sane-backends version 1.0.24-1.2
Diffstat (limited to 'tools/openbsd')
-rwxr-xr-xtools/openbsd/attach20
-rwxr-xr-xtools/openbsd/detach22
2 files changed, 42 insertions, 0 deletions
diff --git a/tools/openbsd/attach b/tools/openbsd/attach
new file mode 100755
index 0000000..b6c98c8
--- /dev/null
+++ b/tools/openbsd/attach
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+DEVCLASS=$1
+DEVNAME=$2
+
+case $DEVCLASS in
+0)
+ # 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
+ # probably our scanner
+ chgrp usb /dev/"$DEVNAME".*
+ chgrp usb /dev/"$BUSNAME"
+ ;;
+ esac
+
+ ;;
+esac
diff --git a/tools/openbsd/detach b/tools/openbsd/detach
new file mode 100755
index 0000000..a5c209c
--- /dev/null
+++ b/tools/openbsd/detach
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+DEVCLASS=$1
+DEVNAME=$2
+
+case $DEVCLASS in
+0)
+ # generic devices
+ case "$DEVNAME" in
+ ugen*)
+ BUSNAME=`cat /var/run/${DEVNAME}.bus`
+ rm -f /var/run/${DEVNAME}.bus
+ # probably our scanner
+ chgrp wheel /dev/"$DEVNAME".*
+ if [ x$BUSNAME != x ] ; then
+ chgrp wheel /dev/"$BUSNAME"
+ fi
+ ;;
+ esac
+
+ ;;
+esac