blob: 9a9f70754ab0553296a92556353d228614cd724e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/rc
if(! bind -a '#u' /dev)
exit
mkdir -p -m 700 '#σc/usb'
mkdir -p -m 700 '#σc/usbnet'
if(! nusb/usbd)
exit
@{
rfork ne
fn attach {
switch($2$3){
case 0b957720 0b95772a 0db0a877 13b10018 15577720 20013c05 07d13c05 05ac1402
nusb/ether -t a88772 $etherargs $1 &
case 0b951780 14eaab11 17370039 0411006e 050d5055
nusb/ether -t a88178 $etherargs $1 &
case *
switch($4){
case *03
nusb/kb $1 &
case *02
# CDC ethernet
nusb/ether $etherargs $1 &
case *08
@{
rfork ne
nusb/disk $1
cd '#σ/usb'
for(dev in sdU^$1.*) if(test -d $dev) {
diskparts $dev
for(part in $dev/dos* $dev/9fat) if(test -r $part) {
mkdir -m 0700 '#σc/'^$dev || exit
{dossrv -s -f $part &} <[0=1] |
echo 0 >'#σc/'^$dev/dos
exit
}
}
} &
case *
if(~ $2 0424)
nusb/ether -t smsc $etherargs $1 &
}
}
}
fn detach {
rm -rf '#σc/usb/'^$1.* '#σc/sdU'^$1.* '#σc/usbnet/'^$1.*
}
rc < '#σ/usb/usbevent' &
}
bind -a '#σ/usb' /dev
bind -a '#σ/usbnet' /net
|