git: 9front

Download patch

ref: e43190dd835bacecd41f88a9d8316b879e0e952a
parent: 1179293fa7e065cd3466bc4a2eb6787d18ecee56
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sat Mar 9 23:06:42 EST 2013

nusb/disk: add small delay after unit start command (for thinkpad sdcard reader)

diskparts fails on thinkpad x200 sdcard reader if we dont
give the unit some time to startup. the device took about
100ms to become ready so status poll loop with a long
timeout would be overkill.

--- a/sys/src/cmd/nusb/disk/disk.c
+++ b/sys/src/cmd/nusb/disk/disk.c
@@ -345,8 +345,10 @@
 		if(SRready(lun) < 0 && SRready(lun) < 0 && SRready(lun) < 0)
 			dprint(2, "disk: lun %d not ready\n", i);
 
-		if((lun->inquiry[0] & 0x1F) == 0)
+		if((lun->inquiry[0] & 0x1F) == 0){
 			SRstart(lun, 1);
+			sleep(250);
+		}
 
 		/*
 		 * we ignore the device type reported by inquiry.
--