Date: Mon, 30 Sep 1996 12:44:23 -0700 (PDT) From: nsayer@quack.kfu.com To: FreeBSD-gnats-submit@freebsd.org Subject: bin/1695: moused fails with PS/2 mice Message-ID: <199609301944.MAA00535@jail.3do.com> Resent-Message-ID: <199609301950.MAA28263@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 1695
>Category: bin
>Synopsis: moused fails with PS/2 mouse
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Sep 30 12:50:01 PDT 1996
>Last-Modified:
>Originator: Nick Sayer
>Organization:
Just me
>Release: FreeBSD 2.2-960801-SNAP i386
>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 */
{
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609301944.MAA00535>
