diff options
author | sobomax <sobomax@FreeBSD.org> | 2004-01-10 13:09:21 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2004-01-10 13:09:21 +0000 |
commit | 3ec9ac09464b1ea3e809f39753aac1ceb9913ee4 (patch) | |
tree | 399818951cb0894568f950ec4b48b7a70fcc6524 /usr.sbin/moused | |
parent | 65c30ff68da7d4bb0901d4be15f80a149ee9f71f (diff) | |
download | FreeBSD-src-3ec9ac09464b1ea3e809f39753aac1ceb9913ee4.zip FreeBSD-src-3ec9ac09464b1ea3e809f39753aac1ceb9913ee4.tar.gz |
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
Diffstat (limited to 'usr.sbin/moused')
-rw-r--r-- | usr.sbin/moused/moused.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/moused/moused.c b/usr.sbin/moused/moused.c index 0bca756..b08365f 100644 --- a/usr.sbin/moused/moused.c +++ b/usr.sbin/moused/moused.c @@ -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 |