diff --git a/rc/bin/nusbrc b/rc/bin/nusbrc index 71fe5734e..546803a4b 100755 --- a/rc/bin/nusbrc +++ b/rc/bin/nusbrc @@ -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 diff --git a/sys/src/9/boot/local.rc b/sys/src/9/boot/local.rc index 6166ac7c3..1937a9788 100755 --- a/sys/src/9/boot/local.rc +++ b/sys/src/9/boot/local.rc @@ -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 $* + } } } diff --git a/sys/src/9/boot/nusbrc b/sys/src/9/boot/nusbrc index afa8ac5dc..955520f66 100755 --- a/sys/src/9/boot/nusbrc +++ b/sys/src/9/boot/nusbrc @@ -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 diff --git a/sys/src/9/port/bootfs.proto b/sys/src/9/port/bootfs.proto index a7a767543..641fc628b 100644 --- a/sys/src/9/port/bootfs.proto +++ b/sys/src/9/port/bootfs.proto @@ -34,6 +34,7 @@ $objtype unmount nusb usbd + ether disk kb xd