X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=rc%2Fbin%2Fnusbrc;h=338438935690ce4d7276bac100fcce1ec87ab1bb;hb=8a0cefb237a90ab08baf5b062991f6dc7e78bcde;hp=85f9e768d77f5ae5095e829c4e39df0fe297cf39;hpb=04fa57de3a0393c690b6c1abcdf6e815e4cae4d0;p=plan9front.git diff --git a/rc/bin/nusbrc b/rc/bin/nusbrc old mode 100644 new mode 100755 index 85f9e768d..338438935 --- a/rc/bin/nusbrc +++ b/rc/bin/nusbrc @@ -4,29 +4,42 @@ if(! test -e '#σ/usb/usbevent') exit if(! bind -a '#u' /dev) exit - @{ rfork ne fn attach { + id=$1 + if(~ $#* 5 && ! test -e /env/nousbhname) + id=$1:$5 switch($4){ case *01 - nusb/audio $1 + nusb/audio $id case *02 # serial and ethernet - nusb/serial $1 + nusb/serial $id + # handled /sys/src/9/boot/nusbrc + # nusb/ether $id case *03 # handled /sys/src/9/boot/nusbrc - # nusb/kb $1 + # nusb/kb $id case *08 # handled /sys/src/9/boot/nusbrc - # nusb/disk $1 - case *10106 - nusb/ptp $1 + # nusb/disk $id + case 010106 + nusb/ptp $id + case * + # HUAWEI E220 modem + if(~ $2$3 12d11003) + nusb/serial $id + # FTDI + if(~ $2 0403) + nusb/serial $id } } fn detach { + # handled /sys/src/9/boot/nusbrc } rc < '#σ/usb/usbevent' & } -bind -a '#σ/usb' /dev +bind -qa '#σ/usb' /dev +bind -qa '#σ/usbnet' /net