plan9front/rc/bin/nusbrc
cinap_lenrek afe12c32f3 nusbrc: add Prolific and CP2102 serial uart
also reorganize the switches: match vid/did first,
then generic device class.
2024-11-24 17:18:59 +00:00

45 lines
813 B
Bash
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/rc
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($2$3){
case 12d11003 1a867523 10c4ea60 0403* 1a867523 # HUAWEI, Prolific, CP2102, FTDI, pine64
nusb/serial $id
case 59862113
nusb/cam $id
case *
switch($4){
case *01
nusb/audio $id
case ff0202
# RNDIS; handled by /sys/src/9/boot/nusbrc
case *02
# serial and ethernet
nusb/serial $id
case *03
# handled /sys/src/9/boot/nusbrc
# nusb/kb $id
case *08
# handled /sys/src/9/boot/nusbrc
# nusb/disk $id
case 010106
nusb/ptp $id
}
}
}
fn detach {
# handled /sys/src/9/boot/nusbrc
}
rc < '#σ/usb/usbevent' &
}
bind -qa '#σ/usb' /dev
bind -qa '#σ/usbnet' /net