usb/disk: add a 100ms sleep after ums reset

This commit is contained in:
Giacomo Tesio 2018-05-18 00:26:13 +02:00
parent 414c882682
commit ca2300aa65
1 changed files with 9 additions and 8 deletions

View File

@ -64,7 +64,7 @@ Part *
lookpart(Umsc *lun, char *name) lookpart(Umsc *lun, char *name)
{ {
Part *part, *p; Part *part, *p;
part = lun->part; part = lun->part;
for(p=part; p < &part[Qmax]; p++){ for(p=part; p < &part[Qmax]; p++){
if(p->inuse && strcmp(p->name, name) == 0) if(p->inuse && strcmp(p->name, name) == 0)
@ -77,7 +77,7 @@ Part *
freepart(Umsc *lun) freepart(Umsc *lun)
{ {
Part *part, *p; Part *part, *p;
part = lun->part; part = lun->part;
for(p=part; p < &part[Qmax]; p++){ for(p=part; p < &part[Qmax]; p++){
if(!p->inuse) if(!p->inuse)
@ -139,7 +139,7 @@ void
fixlength(Umsc *lun, int64_t blocks) fixlength(Umsc *lun, int64_t blocks)
{ {
Part *part, *p; Part *part, *p;
part = lun->part; part = lun->part;
part[Qdata].length = blocks; part[Qdata].length = blocks;
for(p=&part[Qdata+1]; p < &part[Qmax]; p++){ for(p=&part[Qdata+1]; p < &part[Qmax]; p++){
@ -171,7 +171,7 @@ ctlstring(Umsc *lun)
{ {
Part *p, *part; Part *p, *part;
Fmt fmt; Fmt fmt;
part = &lun->part[0]; part = &lun->part[0];
fmtstrinit(&fmt); fmtstrinit(&fmt);
@ -194,7 +194,7 @@ ctlparse(Umsc *lun, char *msg)
int64_t start, end; int64_t start, end;
char *argv[16]; char *argv[16];
int argc; int argc;
argc = tokenize(msg, argv, nelem(argv)); argc = tokenize(msg, argv, nelem(argv));
if(argc < 1){ if(argc < 1){
@ -265,6 +265,7 @@ umsreset(void)
fprint(2, "disk: reset: %r\n"); fprint(2, "disk: reset: %r\n");
return -1; return -1;
} }
sleep(100);
return 0; return 0;
} }
@ -574,7 +575,7 @@ dirgen(int n, Dir* d, void *aux)
{ {
Umsc *lun; Umsc *lun;
int i; int i;
lun = aux; lun = aux;
for(i = Qctl; i < Qmax; i++){ for(i = Qctl; i < Qmax; i++){
if(lun->part[i].inuse == 0) if(lun->part[i].inuse == 0)
@ -1043,7 +1044,7 @@ umsdevfree(void *a)
* for windows driver installation. switch mode here * for windows driver installation. switch mode here
* and exit if we detect one so the real driver can * and exit if we detect one so the real driver can
* attach it. * attach it.
*/ */
static void static void
notreallyums(Dev *dev) notreallyums(Dev *dev)
{ {
@ -1083,7 +1084,7 @@ main(int argc, char **argv)
}ARGEND }ARGEND
if(argc != 1) if(argc != 1)
usage(); usage();
dev = getdev(*argv); dev = getdev(*argv);
if(dev == nil) if(dev == nil)
sysfatal("getdev: %r"); sysfatal("getdev: %r");