Subject: "Truemouse" mice - Solution to 3rd button woes
From: [email-masked] (Barry Kitson)
Date: 9 Jan 1994 15:19:44 +0200
Newsgroups: comp.windows.x.i386unix,comp.os.linux.announce

As there seems to be heaps of interest in the Linux and XFree86
world, here's a solution to the Truemouse middle button question.  This
seems to work for my Truemouse 300, but I don't give any guarantees that
it will or won't work for your rodent.  All this does is provide a software
switch to convince the mouse to act in "PC"/"MouseSystems"-like mode.
(Hint: set your Xconfig file to use MouseSystems, and get rid of the 
	3-button emulation switch. )

	The source code is pretty short.  Under a Slackware Linux 
distribution, the following can be compiled:

#include <stdio.h>
#include <asm/io.h>
#include <unistd.h>

main()
{
  if( ioperm( 0x3fc, 1, 1 ) )
  {
      fprintf( stderr, "Can't get I/O permissions.\n");
      fprintf( stderr, "Must run as root.\n");
      exit(-1);
  }
  __asm__ __volatile__ ("mov %w0,%%edx; outb %b1, %%dx"
		       :
		       : "i" (0x3fc), "a" (0x0a)
		       );
}

	The executable produced MUST be run after X is started.  The easiest
way to do this is to call it from the .Xinitrc script in your users' home
directories.  This is ugly, but is the way I do it.  Please let me know
if you have an elegant solution.

	The executable must also be setuid root.  Just use chmod (and put
the command in eg the X386/bin directory, or whatever it's called).

	I can send the binary if anyone wants it.  If I hear reports about
it being useful, I'll do something about the FAQ and uploading the binary,
particularly if someone suggests a good way of shifting this thing out of
the .xinitrc file.

	But this might take a while, 'cause my harddisk just took a dive
and I'll be pretty busy recovering when the replacement arrives :^( :^( :^(

	I also have work to do :^)

		Barry.

 _____________________________________________________________________
| Barry KITSON              | Telecom Research Laboratories  ||  \_() |
| Voice: +61 3 253 6129     | Telstra                       //____#_\ |
| Fax:   +61 3 253 6144     | P.O. Box 249                  \\` __\   |
| email: [email-masked] | Clayton VIC 3168, AUSTRALIA    \\ `     |
|_My opinions are MY OPINIONS, difficult though that may be to grasp._|

--
Mail submissions for comp.os.linux.announce to: [email-masked]
PLEASE remember Keywords: and a short description of the software.