Fix serious ugliness introduced in 1.61, which leads to long delay in boot
sequence when machine is started without attached USB mouse. Only do repeated attempts to re-open device if the usb module has been actually loaded. Also fix broken logic in doing delays between open attempts - do delays between attempts, not after each attempt. Due to previous behaviour being very annoying for notebook owners this is a good 5.2 MFC candidate. MFC after: 2 days
This commit is contained in:
parent
65c30ff68d
commit
3ec9ac0946
@ -756,8 +756,8 @@ main(int argc, char *argv[])
|
||||
|
||||
retry = 1;
|
||||
if (strncmp(rodent.portname, "/dev/ums", 8) == 0) {
|
||||
usbmodule();
|
||||
retry = 5;
|
||||
if (usbmodule() != 0)
|
||||
retry = 5;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@ -767,10 +767,11 @@ main(int argc, char *argv[])
|
||||
signal(SIGQUIT, cleanup);
|
||||
signal(SIGTERM, cleanup);
|
||||
for (i = 0; i < retry; ++i) {
|
||||
if (i > 0)
|
||||
sleep(2);
|
||||
rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK);
|
||||
if (rodent.mfd != -1 || errno != ENOENT)
|
||||
break;
|
||||
sleep(2);
|
||||
}
|
||||
if (rodent.mfd == -1)
|
||||
logerr(1, "unable to open %s", rodent.portname);
|
||||
@ -855,8 +856,13 @@ usbmodule(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!loaded && kldload("ums") == -1 && errno != EEXIST)
|
||||
logerr(1, "unable to load USB mouse driver");
|
||||
if (!loaded) {
|
||||
if (kldload("ums") != -1)
|
||||
return 1;
|
||||
if (errno != EEXIST)
|
||||
logerr(1, "unable to load USB mouse driver");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user