diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-11-22 03:17:15 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-11-22 03:17:15 +0100 |
commit | 7e3b2cdb557b49e0862079f38f14c777b9240e0f (patch) | |
tree | 11c45d322e720853cd4171b93d48c87a5e4521d4 /sys/src/9 | |
parent | 98363cb27276b29ff3795d1ef93e4ea2e82e106f (diff) |
usbd: intoruce /env/usbbusy
to solve the usb device enumeration race on boot, usbd creates /env/usbbusy
on startup and once all devices have been enumerated and readers have consumed
all the events, we remove the file so nusbrc/bootrc can continue. this makes
sure all the usb devices that where plugged in on boot are made available.
Diffstat (limited to 'sys/src/9')
-rwxr-xr-x | sys/src/9/boot/nusbrc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/src/9/boot/nusbrc b/sys/src/9/boot/nusbrc index 56ee25332..6c8ee5715 100755 --- a/sys/src/9/boot/nusbrc +++ b/sys/src/9/boot/nusbrc @@ -33,7 +33,7 @@ if(! nusb/usbd) # CDC ethernet nusb/ether $etherargs $id case *08 - if(nusb/disk $id) {@{ + if(nusb/disk $id) @{ rfork ne cd '#σ/usb' devs=sdU^($1 $5) @@ -46,7 +46,7 @@ if(! nusb/usbd) exit } } - }&} + } case * # Raspberry Pi ethernet will always appear as /net/etherU0 if(~ $2 0424) @@ -61,5 +61,9 @@ if(! nusb/usbd) rc < '#σ/usb/usbevent' & } +# usbd removes this file once all devices have been enumerated +while(test -e /env/usbbusy) + sleep 1 + bind -a '#σ/usb' /dev bind -a '#σ/usbnet' /net |