shithub: riscv

Download patch

ref: d1799f65ca4835cbb896f802b297b39e518b9cc6
parent: 7a3f0998a0ce7470d70c1a13bc4646abafdcc236
author: cinap_lenrek <[email protected]>
date: Wed Dec 24 06:04:18 EST 2014

nusb/serial: fix nusb/serial hang with ftdi

have to create process, not a thread in ftdi code so main
process can exit after posting fs service.

--- a/rc/bin/nusbrc
+++ b/rc/bin/nusbrc
@@ -30,6 +30,9 @@
 			# HUAWEI E220 modem
 			if(~ $2$3 12d11003)
 				nusb/serial $id
+			# FTDI
+			if(~ $2 0403)
+				nusb/serial $id
 		}
 	}
 	fn detach {
--- a/sys/src/cmd/nusb/serial/ftdi.c
+++ b/sys/src/cmd/nusb/serial/ftdi.c
@@ -1470,7 +1470,7 @@
 		ftdiwrite(p, BMMPSSE|0x0b, 0, FTSETBITMODE);
 	}
 	incref(ser->dev);
-	threadcreate(statusreader, p, 8*1024);
+	proccreate(statusreader, p, 8*1024);
 	return 0;
 }
 
--- a/sys/src/cmd/nusb/serial/serial.c
+++ b/sys/src/cmd/nusb/serial/serial.c
@@ -747,10 +747,10 @@
 	ser->nifcs = 1;
 
 	/* probe all the drivers */
-	if(plprobe(ser)
-	&& uconsprobe(ser)
+	if(uconsprobe(ser)
 	&& ftprobe(ser)
-	&& slprobe(ser))
+	&& slprobe(ser)
+	&& plprobe(ser))
 		sysfatal("no serial devices found");
 
 	for(i = 0; i < ser->nifcs; i++){