bin/77786: moused dies when unplugging mouse

Robert Millan rmh at debian.org
Sun Feb 20 16:40:29 GMT 2005


>Number:         77786
>Category:       bin
>Synopsis:       moused dies when unplugging mouse
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 20 16:40:28 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Robert Millan
>Release:        GNU/kFreeBSD 5.3-3 i686
>Organization:
Debian
>Environment:
System: GNU/kFreeBSD aragorn 5.3-3 #0: Thu Feb 10 15:39:57 CET 2005 i686 GNU/KFreeBSD


	
>Description:
	When moused is being used to process input from an USB mouse, and the
	mouse is dettached, causing the /dev/ums0 to disappear, moused will
	die (complains about open() failing).  So after reattaching the mouse
	you'll have to restart the daemon manualy.

	With this patch, moused's behaviour is closer to what you'd expect from
	a daemon and instead of diing it polls de device untill it can be
	open again.
>How-To-Repeat:
	
>Fix:

I'm not sure if this is exactly what you want.  Perhaps you prefer to get
rid of the strncmp check or comment it out?  Anyway, this works well for me.

--- src.old/usr.sbin/moused/moused.c    2005-02-20 16:47:05.000000000 +0100
+++ src/usr.sbin/moused/moused.c        2005-02-20 16:46:25.000000000 +0100
@@ -778,9 +778,9 @@
        usage();
     }
 
-    retry = 1;
+    retry = 0;
     if (strncmp(rodent.portname, "/dev/ums", 8) == 0) {
-       if (usbmodule() != 0)
+       if ((retry != 0) && (usbmodule() != 0))
            retry = 5;
     }
 
@@ -790,7 +790,7 @@
            signal(SIGINT , cleanup);
            signal(SIGQUIT, cleanup);
            signal(SIGTERM, cleanup);
-           for (i = 0; i < retry; ++i) {
+           for (i = 0; i < retry || retry == 0; ++i) {
                if (i > 0)
                    sleep(2);
                rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK);
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list