shithub: riscv

Download patch

ref: 972f60a794bb58d9c99014dc28ec88e7883cea5d
parent: 93d0474f7766cffe95249b5ca8981841b9049834
author: cinap_lenrek <[email protected]>
date: Wed Jun 4 19:59:17 EDT 2014

nusbrc: dont fork usb drivers into background

probing needs to run synchronous to avoid races with other
readers of /dev/usbevent.

--- a/sys/src/9/boot/nusbrc
+++ b/sys/src/9/boot/nusbrc
@@ -13,26 +13,25 @@
 	fn attach {
 		switch($2$3){
 		case 0b957720 0b95772a 0db0a877 13b10018 15577720 20013c05 07d13c05 05ac1402
-			nusb/ether -t a88772 $etherargs $1 &
+			nusb/ether -t a88772 $etherargs $1
 		case 0b951780 14eaab11 17370039 0411006e 050d5055
-			nusb/ether -t a88178 $etherargs $1 &
+			nusb/ether -t a88178 $etherargs $1
 		case 2001abc1
-			nusb/ether -t aue $etherargs $1 &
+			nusb/ether -t aue $etherargs $1
 		case 0bda8150
-			nusb/ether -t url $etherargs $1 &
+			nusb/ether -t url $etherargs $1
 		case 18d14ee3 0bb40003
-			nusb/ether -t rndis $etherargs $1 &
+			nusb/ether -t rndis $etherargs $1
 		case *
 			switch($4){
 			case *03
-				nusb/kb $1 &
+				nusb/kb $1
 			case *02
 				# CDC ethernet
-				nusb/ether $etherargs $1 &
+				nusb/ether $etherargs $1
 			case *08
-				@{
+				if(nusb/disk $1) {@{
 					rfork ne
-					nusb/disk $1
 					cd '#σ/usb'
 					for(dev in sdU^$1.*) if(test -d $dev) {
 						diskparts $dev
@@ -43,10 +42,10 @@
 							exit
 						}
 					}
-				} &
+				}&}
 			case *
 				if(~ $2 0424)
-					nusb/ether -t smsc $etherargs $1 &
+					nusb/ether -t smsc $etherargs $1
 			}
 		}
 	}