]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/nusbrc
remove ipv6on, update ipconfig(8)
[plan9front.git] / rc / bin / nusbrc
1 #!/bin/rc
2
3 if(! test -e '#σ/usb/usbevent')
4         exit
5 if(! bind -a '#u' /dev)
6         exit
7 @{
8         rfork ne
9         fn attach {
10                 id=$1
11                 if(~ $#* 5 && ! test -e /env/nousbhname)
12                         id=$1:$5
13                 switch($4){
14                 case *01
15                         nusb/audio $id
16                 case *02
17                         # serial and ethernet
18                         nusb/serial $id
19                         # handled /sys/src/9/boot/nusbrc
20                         # nusb/ether $id
21                 case *03
22                         # handled /sys/src/9/boot/nusbrc
23                         # nusb/kb $id
24                 case *08
25                         # handled /sys/src/9/boot/nusbrc
26                         # nusb/disk $id
27                 case 010106
28                         nusb/ptp $id
29                 case *
30                         # HUAWEI E220 modem
31                         if(~ $2$3 12d11003)
32                                 nusb/serial $id
33                         # FTDI
34                         if(~ $2 0403)
35                                 nusb/serial $id
36                 }
37         }
38         fn detach {
39                 # handled /sys/src/9/boot/nusbrc
40         }
41         rc < '#σ/usb/usbevent' &
42 }
43
44 bind -qa '#σ/usb' /dev
45 bind -qa '#σ/usbnet' /net