Browse Source

Get rid of the BMAFR behavior of the boot code that starts usbd

There's way too much of this nonsense in Plan 9.

Does not work because we're not building usbd yet.

Change-Id: Ifaa94244fed29f0bd288b9e7728f3f06bc900b26
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 years ago
parent
commit
99988d5421
1 changed files with 24 additions and 12 deletions
  1. 24 12
      sys/src/9/boot/boot.c

+ 24 - 12
sys/src/9/boot/boot.c

@@ -270,18 +270,30 @@ usbinit(void)
 {
 	static char usbd[] = "/boot/usbd";
 	static char *argv[] = {"usbd"};
-	if(access("#u/usb/ctl", 0) >= 0 &&
-	   bind("#u", "/dev", MAFTER) >= 0 &&
-	   access(usbd, AEXIST) >= 0) {
-		switch(fork()){
-		case -1:
-			print("usbinit: fork failed: %r\n");
-		case 0:
-			exec(usbd, argv);
-			fatal("can't exec usbd");
-		default:
-			break;
-		}
+
+	if (access(usbd, AEXIST) < 0) {
+		print("usbinit: no %s\n", usbd);
+		return;
+	}
+
+	if(access("#u/usb/ctl", 0) < 0){
+		print("usbinit: no #u/usb/ctl\n");
+		return;
+	}
+
+	if (bind("#u", "/dev", MAFTER) < 0) {
+		print("usbinit: can't bind #u to /dev: %r\n");
+		return;
+	}
+
+	switch(fork()){
+	case -1:
+		print("usbinit: fork failed: %r\n");
+	case 0:
+		exec(usbd, argv);
+		fatal("can't exec usbd");
+	default:
+		break;
 	}
 }