From nsayer@3do.com  Mon Sep 30 12:45:07 1996
Received: from outland (outland.3do.com [208.192.70.2])
          by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id MAA23819
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Sep 1996 12:45:02 -0700 (PDT)
Received: from badger.3do.com (badger.3do.com [198.211.30.7]) by outland (SMI-8.6/8.6.12) with SMTP id MAA14818 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Sep 1996 12:44:21 -0700
Received: from jail.3do.com by badger.3do.com (4.1/SMI-4.1)
	id AA05084; Mon, 30 Sep 96 12:44:24 PDT
Received: by jail.3do.com 
        (8.7.5//ident-1.0) id MAA00535; Mon, 30 Sep 1996 12:44:23 -0700 (PDT) 
Message-Id: <199609301944.MAA00535@jail.3do.com>
Date: Mon, 30 Sep 1996 12:44:23 -0700 (PDT)
From: nsayer@quack.kfu.com
Reply-To: nsayer@3do.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: moused fails with PS/2 mice
X-Send-Pr-Version: 3.2

>Number:         1695
>Category:       bin
>Synopsis:       moused fails with PS/2 mouse
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    sos
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 30 12:50:01 PDT 1996
>Closed-Date:    Mon Jan 27 10:27:55 PST 1997
>Last-Modified:  Mon Jan 27 10:30:40 PST 1997
>Originator:     Nick Sayer
>Release:        FreeBSD 2.2-960801-SNAP i386
>Organization:
Just me
>Environment:

moused -p /dev/psm0 -t ps/2

>Description:

moused terminates immediately, since the read from the mouse port
returns with a 'resouce temporarily unavailable' error when there's
nothing to get.

>How-To-Repeat:

Run the mouse daemon with a ps/2 mouse and leave the mouse still.
moused -f -d will indicate that read is returning -1 with errno
set to EAGAIN.

>Fix:

Either open the PS/2 port with blocking mode instead of non-blocking
mode or better yet, put a select() in to make sure there's something
to read:
	
*** moused.c.orig	Mon Sep 30 12:37:29 1996
--- moused.c	Mon Sep 30 12:35:05 1996
***************
*** 53,58 ****
--- 53,61 ----
  #include <fcntl.h>
  #include <termios.h>
  #include <machine/console.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <unistd.h>
  
  #define debug(fmt,args...) \
  	if (debug&&nodaemon) fprintf(stderr,"%s: " fmt "\n", progname, ##args)
***************
*** 142,147 ****
--- 145,151 ----
      struct termios	t;
      struct mouse_info 	mouse;
      int			saved_buttons = 0;
+     fd_set		fds;
  
      progname = argv[0];
  
***************
*** 236,241 ****
--- 240,248 ----
  
      for(;;)
      {
+ 	FD_ZERO(&fds);
+ 	FD_SET(rodent.mfd,&fds);
+ 	select(FD_SETSIZE,&fds,NULL,&fds,NULL);
  	i = read(rodent.mfd,&b,1);	/* get a byte */
  	if (i != 1)			/* read returned or error; goodbye */
  	{

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: scrappy 
Responsible-Changed-When: Tue Oct 22 23:34:21 PDT 1996 
Responsible-Changed-Why:  
Soren is responsible for the only PR for moused that is assigned to someone... 
so figured it was a safe bet...? 

There is a patch included... 

State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Mon Jan 27 10:27:55 PST 1997 
State-Changed-Why:  

Moused changed to use select. 
>Unformatted:
