2011-08-01 00:55:39 +00:00
|
|
|
|
#!/bin/rc
|
|
|
|
|
|
|
|
|
|
if(! test -e '#σ/usb/usbevent')
|
|
|
|
|
exit
|
|
|
|
|
if(! bind -a '#u' /dev)
|
|
|
|
|
exit
|
|
|
|
|
|
2012-01-09 20:44:27 +00:00
|
|
|
|
mkdir -p -m 700 '#σc/usbnet'
|
|
|
|
|
|
2011-08-01 00:55:39 +00:00
|
|
|
|
@{
|
|
|
|
|
rfork ne
|
|
|
|
|
fn attach {
|
|
|
|
|
switch($4){
|
|
|
|
|
case *01
|
|
|
|
|
nusb/audio $1
|
|
|
|
|
case *02
|
|
|
|
|
# serial and ethernet
|
|
|
|
|
nusb/serial $1
|
2012-01-09 20:44:27 +00:00
|
|
|
|
nusb/ether $1
|
2011-08-01 00:55:39 +00:00
|
|
|
|
case *03
|
|
|
|
|
# handled /sys/src/9/boot/nusbrc
|
|
|
|
|
# nusb/kb $1
|
|
|
|
|
case *08
|
|
|
|
|
# handled /sys/src/9/boot/nusbrc
|
|
|
|
|
# nusb/disk $1
|
2011-08-15 23:50:46 +00:00
|
|
|
|
case *10106
|
|
|
|
|
nusb/ptp $1
|
2011-08-01 00:55:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fn detach {
|
2012-01-09 20:44:27 +00:00
|
|
|
|
switch($4){
|
|
|
|
|
case *02
|
|
|
|
|
rm -f '#σ/usbnet/'^$1.*
|
|
|
|
|
}
|
2011-08-01 00:55:39 +00:00
|
|
|
|
}
|
|
|
|
|
rc < '#σ/usb/usbevent' &
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bind -a '#σ/usb' /dev
|
2012-01-09 20:44:27 +00:00
|
|
|
|
bind -a '#σ/usbnet' /net
|