summaryrefslogtreecommitdiff
path: root/tools/openbsd/attach
blob: 16ce31ff81c30c66af4e70c123602a1229c7eddc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

DEVCLASS=$1
DEVNAME=$2

case $DEVCLASS in
0)
	case "$DEVNAME" in
	ugen*)
		BUSNAME=$(usbdevs -vv | egrep "Controller|$DEVNAME\$" | grep -B 1 "$DEVNAME\$" | awk -F'[ :]' '/^Controller/ { print $2 }')
		echo $BUSNAME > /var/run/${DEVNAME}.bus
		chown _cups:_saned /dev/${DEVNAME}.* &&
			chmod 660 /dev/${DEVNAME}.*
		chown _cups:_saned $BUSNAME &&
			chmod 660 $BUSNAME
		;;
	esac
	;;
esac