move usb ethernet in bootfs.paq

This commit is contained in:
cinap_lenrek 2012-12-05 13:53:34 +01:00
parent 96cc3eb2ee
commit 0750687012
4 changed files with 39 additions and 28 deletions

View file

@ -4,9 +4,6 @@ if(! test -e '#σ/usb/usbevent')
exit
if(! bind -a '#u' /dev)
exit
mkdir -p -m 700 '#σc/usbnet'
@{
rfork ne
fn attach {
@ -16,7 +13,8 @@ mkdir -p -m 700 '#σc/usbnet'
case *02
# serial and ethernet
nusb/serial $1
nusb/ether $1
# handled /sys/src/9/boot/nusbrc
# nusb/ether $1
case *03
# handled /sys/src/9/boot/nusbrc
# nusb/kb $1
@ -28,13 +26,10 @@ mkdir -p -m 700 '#σc/usbnet'
}
}
fn detach {
switch($4){
case *02
rm -f '#σ/usbnet/'^$1.*
}
# handled /sys/src/9/boot/nusbrc
}
rc < '#σ/usb/usbevent' &
}
bind -a '#σ/usb' /dev
bind -a '#σ/usbnet' /net
bind -qa '#σ/usb' /dev
bind -qa '#σ/usbnet' /net

View file

@ -49,22 +49,27 @@ fn bootfs{
}
fn connectlocal{
if(test -f $1)
t=`{fstype $1}
if not {
t=$1; shift
if(~ $#* 0){
echo local method needs an argument
}
switch($t){
case ''
fatal unknown fstype $1
case 9660
bootfs 9660srv $*
case dos
bootfs dossrv $*
case kfs
bootfs disk/kfs $*
case *
bootfs $t $*
if not {
if(test -f $1)
t=`{fstype $1}
if not {
t=$1; shift
}
switch($t){
case ''
fatal unknown fstype $1
case 9660
bootfs 9660srv $*
case dos
bootfs dossrv $*
case kfs
bootfs disk/kfs $*
case *
bootfs $t $*
}
}
}

View file

@ -1,7 +1,10 @@
#!/bin/rc
if(! bind -a '#u' /dev)
exit
mkdir -m 0700 '#σc/usb'
mkdir -p -m 700 '#σc/usb'
mkdir -p -m 700 '#σc/usbnet'
if(! nusb/usbd)
exit
@ -11,6 +14,8 @@ if(! nusb/usbd)
switch($4){
case *03
nusb/kb $1 &
case *02
nusb/ether $1 &
case *08
@{
rfork ne
@ -26,13 +31,18 @@ if(! nusb/usbd)
}
}
} &
case *
if(~ $2 0424 && ~ $3 ec00){
# raspberry pi ethernet
nusb/ether $1 &
}
}
}
fn detach {
rm -rf '#σc/usb/'^$1.* '#σc/sdU'^$1.*
rm -rf '#σc/usb/'^$1.* '#σc/sdU'^$1.* '#σc/usbnet/'^$1.*
}
rc < '#σ/usb/usbevent' &
}
bind -a '#σ/usb' /dev
bind -a '#σ/usbnet' /net

View file

@ -34,6 +34,7 @@ $objtype
unmount
nusb
usbd
ether
disk
kb
xd