]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/nusbrc
1bff5073b6736fa5c074a926091ded7730e6b471
[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                 }
30         }
31         fn detach {
32                 # handled /sys/src/9/boot/nusbrc
33         }
34         rc < '#σ/usb/usbevent' &
35 }
36
37 bind -qa '#σ/usb' /dev
38 bind -qa '#σ/usbnet' /net