aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/moused
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
commit23090366f729c56cab62de74c7a51792357e98a9 (patch)
treec511c885796e28ec571b5267e8f11f3b103d35e9 /usr.sbin/moused
parent7750ad47a9a7dbc83f87158464170c8640723293 (diff)
parent22ff74b2f44234d31540b1f7fd6c91489c37cad3 (diff)
downloadsrc-23090366f729c56cab62de74c7a51792357e98a9.tar.gz
src-23090366f729c56cab62de74c7a51792357e98a9.zip
Sync from head
Notes
Notes: svn path=/projects/bmake/; revision=242545
Diffstat (limited to 'usr.sbin/moused')
-rw-r--r--usr.sbin/moused/moused.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/usr.sbin/moused/moused.c b/usr.sbin/moused/moused.c
index 78e65fa9f52e..93eec9909368 100644
--- a/usr.sbin/moused/moused.c
+++ b/usr.sbin/moused/moused.c
@@ -408,6 +408,7 @@ static struct rodentparam {
int cfd; /* /dev/consolectl file descriptor */
int mremsfd; /* mouse remote server file descriptor */
int mremcfd; /* mouse remote client file descriptor */
+ int is_removable; /* set if device is removable, like USB */
long clickthreshold; /* double click speed in msec */
long button2timeout; /* 3 button emulation timeout */
mousehw_t hw; /* mouse device hardware information */
@@ -434,6 +435,7 @@ static struct rodentparam {
.cfd = -1,
.mremsfd = -1,
.mremcfd = -1,
+ .is_removable = 0,
.clickthreshold = DFLT_CLICKTHRESHOLD,
.button2timeout = DFLT_BUTTON2TIMEOUT,
.accelx = 1.0,
@@ -570,7 +572,6 @@ main(int argc, char *argv[])
int c;
int i;
int j;
- static int retry;
for (i = 0; i < MOUSE_MAXBUTTON; ++i)
mstate[i] = &bstate[i];
@@ -876,10 +877,8 @@ main(int argc, char *argv[])
usage();
}
- retry = 1;
- if (strncmp(rodent.portname, "/dev/ums", 8) == 0) {
- retry = 5;
- }
+ if (strncmp(rodent.portname, "/dev/ums", 8) == 0)
+ rodent.is_removable = 1;
for (;;) {
if (setjmp(env) == 0) {
@@ -888,13 +887,8 @@ main(int argc, char *argv[])
signal(SIGQUIT, cleanup);
signal(SIGTERM, cleanup);
signal(SIGUSR1, pause_mouse);
- 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;
- }
+
+ rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK);
if (rodent.mfd == -1)
logerr(1, "unable to open %s", rodent.portname);
if (r_identify() == MOUSE_PROTO_UNKNOWN) {
@@ -944,6 +938,8 @@ main(int argc, char *argv[])
if (rodent.cfd != -1)
close(rodent.cfd);
rodent.mfd = rodent.cfd = -1;
+ if (rodent.is_removable)
+ exit(0);
}
/* NOT REACHED */