]> git.lizzy.rs Git - plan9front.git/blobdiff - rc/bin/nusbrc
fstype: make copy of first sector in /env to avoid unaligned reads on the disk (for...
[plan9front.git] / rc / bin / nusbrc
index a9efcf8a69c30b79fb05775cc54af3d93696a6f3..338438935690ce4d7276bac100fcce1ec87ab1bb 100755 (executable)
@@ -4,24 +4,35 @@ 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 {
@@ -30,4 +41,5 @@ if(! bind -a '#u' /dev)
        rc < '#σ/usb/usbevent' &
 }
 
-bind -a '#σ/usb' /dev
+bind -qa '#σ/usb' /dev
+bind -qa '#σ/usbnet' /net