Modified moused to use select rather than read. This fixes using

the PS/2 mouse (psm device).
Submitted by:	Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
This commit is contained in:
Søren Schmidt 1997-01-20 08:09:20 +00:00
parent dc31ce3ddb
commit 20a2630b11
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=21885

View File

@ -53,6 +53,9 @@
#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)
@ -150,6 +153,7 @@ main(int argc, char *argv[])
struct termios t;
struct mouse_info mouse;
int saved_buttons = 0;
fd_set fds;
progname = argv[0];
@ -243,6 +247,9 @@ main(int argc, char *argv[])
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 */
{