nusb: add /rc/bin/nusbrc
This commit is contained in:
parent
b43de8eb1f
commit
6f3039351a
3 changed files with 37 additions and 2 deletions
|
@ -7,7 +7,9 @@ for(i in m i P S t u '$')
|
||||||
bind -a '#'^$i /dev >/dev/null >[2=1]
|
bind -a '#'^$i /dev >/dev/null >[2=1]
|
||||||
|
|
||||||
mount -qb /srv/cons /dev
|
mount -qb /srv/cons /dev
|
||||||
mount -qa /srv/usb /dev
|
|
||||||
|
# usb listener
|
||||||
|
nusbrc
|
||||||
|
|
||||||
# mount points
|
# mount points
|
||||||
mntgen -s slashn && chmod 666 /srv/slashn
|
mntgen -s slashn && chmod 666 /srv/slashn
|
||||||
|
|
31
rc/bin/nusbrc
Normal file
31
rc/bin/nusbrc
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/rc
|
||||||
|
|
||||||
|
if(! test -e '#σ/usb/usbevent')
|
||||||
|
exit
|
||||||
|
if(! bind -a '#u' /dev)
|
||||||
|
exit
|
||||||
|
|
||||||
|
@{
|
||||||
|
rfork ne
|
||||||
|
fn attach {
|
||||||
|
switch($4){
|
||||||
|
case *01
|
||||||
|
nusb/audio $1
|
||||||
|
case *02
|
||||||
|
# serial and ethernet
|
||||||
|
nusb/serial $1
|
||||||
|
case *03
|
||||||
|
# handled /sys/src/9/boot/nusbrc
|
||||||
|
# nusb/kb $1
|
||||||
|
case *08
|
||||||
|
# handled /sys/src/9/boot/nusbrc
|
||||||
|
# nusb/disk $1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn detach {
|
||||||
|
# handled /sys/src/9/boot/nusbrc
|
||||||
|
}
|
||||||
|
rc < '#σ/usb/usbevent' &
|
||||||
|
}
|
||||||
|
|
||||||
|
bind -a '#σ/usb' /dev
|
|
@ -10,7 +10,9 @@ for(i in S f k t m i v L P u U A '$' Σ κ)
|
||||||
rm -f /env/i
|
rm -f /env/i
|
||||||
|
|
||||||
mount -qb /srv/cons /dev
|
mount -qb /srv/cons /dev
|
||||||
mount -qa /srv/usb /dev
|
|
||||||
|
# usb listener
|
||||||
|
nusbrc
|
||||||
|
|
||||||
# set up any partitions
|
# set up any partitions
|
||||||
diskparts
|
diskparts
|
||||||
|
|
Loading…
Reference in a new issue