2011-08-01 00:55:39 +00:00
|
|
|
|
#!/bin/rc
|
|
|
|
|
|
|
|
|
|
if(! test -e '#σ/usb/usbevent')
|
|
|
|
|
exit
|
|
|
|
|
if(! bind -a '#u' /dev)
|
|
|
|
|
exit
|
|
|
|
|
@{
|
|
|
|
|
rfork ne
|
|
|
|
|
fn attach {
|
2014-06-28 16:09:43 +00:00
|
|
|
|
id=$1
|
|
|
|
|
if(~ $#* 5 && ! test -e /env/nousbhname)
|
|
|
|
|
id=$1:$5
|
2011-08-01 00:55:39 +00:00
|
|
|
|
switch($4){
|
|
|
|
|
case *01
|
2014-06-28 16:09:43 +00:00
|
|
|
|
nusb/audio $id
|
2021-04-08 19:57:24 +00:00
|
|
|
|
case ff0202
|
|
|
|
|
# RNDIS; handled by /sys/src/9/boot/nusbrc
|
2011-08-01 00:55:39 +00:00
|
|
|
|
case *02
|
|
|
|
|
# serial and ethernet
|
2014-06-28 16:09:43 +00:00
|
|
|
|
nusb/serial $id
|
2012-12-05 12:53:34 +00:00
|
|
|
|
# handled /sys/src/9/boot/nusbrc
|
2014-06-28 16:09:43 +00:00
|
|
|
|
# nusb/ether $id
|
2011-08-01 00:55:39 +00:00
|
|
|
|
case *03
|
|
|
|
|
# handled /sys/src/9/boot/nusbrc
|
2014-06-28 16:09:43 +00:00
|
|
|
|
# nusb/kb $id
|
2011-08-01 00:55:39 +00:00
|
|
|
|
case *08
|
|
|
|
|
# handled /sys/src/9/boot/nusbrc
|
2014-06-28 16:09:43 +00:00
|
|
|
|
# nusb/disk $id
|
|
|
|
|
case 010106
|
|
|
|
|
nusb/ptp $id
|
2014-07-05 21:19:13 +00:00
|
|
|
|
case *
|
2020-12-23 00:23:09 +00:00
|
|
|
|
switch($2$3){
|
2022-02-06 00:11:49 +00:00
|
|
|
|
case 12d11003 0403* # HUAWEI, FTDI
|
2014-12-24 10:04:18 +00:00
|
|
|
|
nusb/serial $id
|
2020-12-23 00:23:09 +00:00
|
|
|
|
case 59862113
|
|
|
|
|
nusb/cam $id
|
|
|
|
|
}
|
2011-08-01 00:55:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fn detach {
|
2012-12-05 12:53:34 +00:00
|
|
|
|
# handled /sys/src/9/boot/nusbrc
|
2011-08-01 00:55:39 +00:00
|
|
|
|
}
|
|
|
|
|
rc < '#σ/usb/usbevent' &
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-05 12:53:34 +00:00
|
|
|
|
bind -qa '#σ/usb' /dev
|
|
|
|
|
bind -qa '#σ/usbnet' /net
|