From: Robert Nation (nation@rocket.sanders.com)
Date: 12/14/92


Date: Mon, 14 Dec 1992 10:30:47 EST
From: nation@rocket.sanders.com (Robert Nation)
Message-Id: <9212141530.AA18078@rocket.sanders.com>
Subject: # button mouse with Linux/X

Maybe this will help you:

Here's how I got my three button microsoft-compatible mouse working
in 3 button mode:

1. Change the mouse type to mousesystems in xconfig

Mousesystems "/dev/ttys1"
  BaudRate 1200
# SampleRate 150
# Emulate3Buttons

2. Compile this program, and call it /usr/bin/mouse3:

#include <assert.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/termios.h>

void main(int argc, char **argv)
{
  int fd;
  int val;
  if(argc!=2)
    {
      printf("Usage: mouse3 device\n");
      exit(1);
    }

  
  assert(fd=open(argv[1],O_RDWR|O_NDELAY));
  val=0;
  ioctl(fd,TIOCMSET,&val);

}

3. Add this lines to /usr/lib/X11/xinit/xinitrc:

xterm -geometry 80x34+0+0 -C -T Console -e /bin/bash&
/usr/bin/mouse3 /dev/ttys1 <----this is the addtition
exec twm

----> (Additional note: call it early, as the first program)

4. Startx.

I really don't know quite why it works, but why complain? It seems that
the microsoft 3 button mouse looks like a mousesystems mouse when its in
3 button mode. Also to switch it to three button mode, you need to do
whatever the mouse3 program does, but you have to do it after X gets
started, since it seems that X's startup code undoes the effect required
to get into 3 button mode.

----> (Additional note: At the beginning of the first movement, the mouse
       get crazy, but it's normal).

                        Regards,
                        Rob Nation
                        Lockheed-Sanders