home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / 3_BUTTON next >
Encoding:
Text File  |  1996-07-14  |  15.5 KB  |  367 lines

  1.  
  2.                      THE 3 BUTTON SERIAL MOUSE MINI-HOWTO
  3.                                        
  4.   Geoff Short (grs100@york.ac.uk)
  5.   
  6.    v1.06 2nd July 1996
  7.      _________________________________________________________________
  8.    
  9.    0. Disclaimer 
  10.    1. Introduction 
  11.    2. Serial ports 
  12.    3. Switched Mice 
  13.    4. Normal Mice 
  14.    5. Switching a Mouse to 3-Button Mode 
  15.    6. Using gpm to Change Mouse Modes 
  16.    7. XF86Config and Xconfig file examples 
  17.    8. Miscellaneous Problems and Setup 
  18.    9. Models Tested 
  19.   10. Mouse Tail 
  20.      _________________________________________________________________
  21.    
  22.   0. Disclaimer 
  23.   
  24.    The following document is offered in good faith as comprising only
  25.    safe programming and procedures. No responsibility is accepted by the
  26.    author for any loss or damage caused in any way to any person or
  27.    equipment, as a direct or indirect consequence of following these
  28.    instructions.
  29.    
  30.   1. Introduction 
  31.   
  32.    The most recent version of this document can always be found at
  33.    http://kipper.york.ac.uk/mouse.html
  34.    
  35.    Most X applications are written with the assumption that the user will
  36.    be working with a 3 button mouse. Serial mice are commonly used on
  37.    computers and are cheap to buy. Many of these mice have 3 buttons and
  38.    claim to use the Microsoft protocol, which in theory means they are
  39.    ideal for the X windows setup.
  40.    
  41.    Most dual-protocol mice will work in two modes:
  42.  
  43.      * 2-button Microsoft mode.
  44.      * 3-button MouseSystems mode.
  45.        
  46.    This document leads you through the different steps needed to
  47.    configure your mouse in these two different modes, especially the
  48.    steps needed to use the more useful 3-button mode.
  49.    
  50.   2. Serial ports 
  51.   
  52.    The first thing to do is to make sure the software can find the mouse.
  53.    Work out which serial port your mouse is connected to - usually this
  54.    will be /dev/ttyS0 (COM1 under DOS) or /dev/ttyS1 (COM2). (ttyS0 is
  55.    usually the 9 pin socket, ttyS1 the 25 pin socket, but of course there
  56.    is no hard and fast rule about these things.) You can also use the cua
  57.    devices instead of ttyS, but it makes no difference as far as mice are
  58.    concerned. For convience make a new link /dev/mouse pointing at this
  59.    port. For instance, for ttyS0:
  60.  
  61.      * ln -s /dev/ttyS0 /dev/mouse
  62.        
  63.   3. Switched Mice 
  64.   
  65.    Some mice, not usually the cheapest ones, have a switch on the bottom
  66.    marked `2/3'. Sometimes this may be `PC/MS'. In this case the `2'
  67.    setting is for 2 button Microsoft mode, and the `3' for 3 button
  68.    MouseSystems mode. The `PC/MS' switch is a bit more complicated. You
  69.    will probably find the `MS' setting is for Microsoft, and the `PC' is
  70.    for MouseSystems. You may find the `PC' setting described as ps/2
  71.    mode, but it should do MouseSystems as well. If you have such a mouse,
  72.    you can switch the switch to `3' or `PC', put the MouseSystems
  73.    settings in your XConfigs (see below) and the mouse should work
  74.    perfectly in 3-button mode.
  75.    
  76.   4. Normal Mice 
  77.   
  78.    If you don't have any switches, and no instructions, then a little bit
  79.    of experimentation is needed. The first thing to try is to assume the
  80.    mouse maker is telling the truth, and the mouse is full Microsoft. Set
  81.    up your Xconfigs to expect a Microsoft mouse (see the Xconfig section)
  82.    and give it try.
  83.    
  84.    If the mouse didn't work at all, then you don't have a Microsoft
  85.    mouse, or there is some other problem. Try the other protocols in the
  86.    configs, the man page for the config file is the best place to start
  87.    looking. Also look in the Miscellaneous Problems section below.
  88.    
  89.    What you will probably find is that when you run X, the mouse works
  90.    fine but only the outer two buttons do anything. You can of course
  91.    accept this, and emulate the third button (press both buttons at once
  92.    to click the middle one) like you do with a two button mouse. To do
  93.    this, change your Xconfig file as shown in the Xconfig example section
  94.    below. This may mean you have bought a 3 button mouse for no good
  95.    reason, and you are certainly no further forward. So, now you need to
  96.    look at your hardware.
  97.    
  98.   5. Switching a Mouse to 3-Button Mode 
  99.   
  100.    Even cheap mice can also work under the Mouse Systems protocol, with
  101.    all three buttons working. The trick is to get the mouse to think it's
  102.    a Mouse Systems one, something you rarely see in your instructions.
  103.  
  104.      * Before you power up your computer, hold down the left mouse button
  105.        (and keep it held down until it has booted to be on the safe
  106.        side.)
  107.        
  108.    When the mouse first gets power, if the left button is held down it
  109.    switches into Mouse Systems mode. A simple fact, but not always
  110.    publicised. Note that a soft reboot of your computer may not cut the
  111.    mouse power and therefore may not work. There are a number of other
  112.    ways of switching the mode, which may or may not work with your
  113.    particular mouse. Some of these are less drastic than rebooting your
  114.    computer, one is more so!
  115.  
  116.      * If your computer is get-at-able you can unplug the mouse and plug
  117.        it back in with the button held down, although I of course cannot
  118.        recommend this as you are not supposed to plug things in when the
  119.        power is on.
  120.      * You may be able to reset the mouse by typing echo "*n" >
  121.        /dev/mouse, which should have the same effect as unplugging it.
  122.        Hold the left button down for Mouse Systems mode, not for
  123.        Microsoft. You could put this in whatever script you use to start
  124.        X up.
  125.      * Bob Nichols (rnichols@interaccess.com) has written a small c
  126.        program to do the same thing, which may work if echo "*n" does not
  127.        (and vice versa). You can find a copy of his source code at
  128.        http://kipper.york.ac.uk/src/fix-mouse.c
  129.      * Someone has reported that the `ClearDTR' line in the Xconfig is
  130.        enough to switch their mouse into Mouse Systems mode.
  131.      * If you are brave enough, open the mouse up (remember that this
  132.        will invalidate your warranty) and have a look inside. In some
  133.        cases, the mouse may have a switch inside, for some strange reason
  134.        known only to the manufacturer. More likely on the cheap mice is a
  135.        jumper which you can move. The switch or jumper may have the same
  136.        effect as a `MS/PC' switch described in the Switched Mice section
  137.        above. You may find that the circuit board is designed for a
  138.        switch between 2 &  buttons, but it hasn't been fitted. It will
  139.        look something like:
  140.  
  141.          -----------
  142.         | o | o | o |  SW1
  143.          -----------
  144.           1   2   3
  145.        Try linking pins 1-2 or 2-3, and see if it changes the behaviour
  146.        of the mouse. If it does, you can either fit a small switch, or
  147.        solder across the contacts for a quick and permenant solution.
  148.        
  149.    It is also possible that you need to hold down the left button when
  150.    booting X windows. Some systems may send some sort of signal or spike
  151.    to the mouse when X starts, so bear this in mind as well.
  152.    
  153.    So there you have it, the choice is yours. Stick with the default
  154.    Microsoft two buttons, or work out how to switch the mode and set X up
  155.    to take advantage of this.
  156.    
  157.   6. Using gpm to Switch Mouse Modes 
  158.   
  159.    gpm is the program that lets you use the mouse in console mode. It is
  160.    usually included in linux distributions, and can be started from the
  161.    command line or in the startup script /etc/rc.d/rc.local. gpm is the
  162.    cause of much problem to people using bus mice, since it locks the
  163.    mouse and stops X from using it - those of us using serial mice don't
  164.    have this problem.
  165.    
  166.    The two main modes for serial mice under gpm are:
  167.  
  168.      * gpm -t ms for Microsoft mode;
  169.      * gpm -t msc for MouseSystems mode.
  170.        
  171.    You may also be able to use gpm to probe the mouse for you and tell
  172.    you what protocol the mouse is currently using:
  173.  
  174.      * gpm -t help
  175.        
  176.    However, gpm is often able to recognise all three buttons of the mouse
  177.    even in Microsoft mode. And newer versions (Version 1.0 and later (?))
  178.    can then make this information available to other programs. For this
  179.    to work, you need to run gpm with the -R tag, like this:
  180.  
  181.      * gpm -R -t ms
  182.        
  183.    This will make gpm re-export the mouse data to a new device, called
  184.    /dev/gpmdata, which looks like a mouse to any other program. Note that
  185.    this device ALWAYS uses the MouseSystems protocol. You can then set
  186.    your Xconfig to use this instead of /dev/mouse as shown below, but of
  187.    course you must ensure gpm is always running when you use X. Some
  188.    people have reported that some middle-button events are not correctly
  189.    interpreted by X using this technique, this may be down to an
  190.    individual mouse setup.
  191.    
  192.   7. XF86Config and Xconfig file examples 
  193.   
  194.    The location of your configuration file for X depends on the
  195.    particular release and distribution you have. It will probably be
  196.    either /etc/Xconfig /etc/XF86Config or /usr/X11/lib/X11/XF86Config.
  197.    You should see which one it is when you start X - it will be echoed to
  198.    the screen before all the options are displayed. The syntax is
  199.    slightly different between the XF86Config and Xconfig files, so both
  200.    are given.
  201.    
  202.     Microsoft Serial Mouse
  203.  
  204.      * XF86config:
  205.         Section "Pointer"
  206.             Protocol "microsoft"
  207.             Device "/dev/mouse"
  208.         EndSection
  209.  
  210.      * Xconfig:
  211.         #
  212.         # Mouse definition and related parameters
  213.         #
  214.         Microsoft      "/dev/mouse"
  215.  
  216.     Microsoft Serial Mouse with Three Button Emulation
  217.  
  218.      * XF86config:
  219.         Section "Pointer"
  220.             Protocol "microsoft"
  221.             Device "/dev/mouse"
  222.             Emulate3Buttons
  223.         EndSection
  224.  
  225.      * Xconfig:
  226.         #
  227.         # Mouse definition and related parameters
  228.         #
  229.         Microsoft      "/dev/mouse"
  230.         Emulate3Buttons
  231.  
  232.     MouseSystems Three Button Serial Mouse
  233.  
  234.      * XF86config:
  235.         Section "Pointer"
  236.             Protocol "mousesystems"
  237.             Device "/dev/mouse"
  238.             ClearDTR           #  These two lines probably won't be needed,
  239.             ClearRTS           #  try without first and then just the DTR
  240.         EndSection
  241.  
  242.      * Xconfig:
  243.         #
  244.         # Mouse definition and related parameters
  245.         #
  246.         MouseSystems    "/dev/mouse"
  247.         ClearDTR               #  These two lines probably won't be needed,
  248.         ClearRTS               #  try without first and then just the DTR
  249.  
  250.     Microsoft Serial Mouse with gpm -R
  251.  
  252.      * XF86config:
  253.         Section "Pointer"
  254.             Protocol "MouseSystems"
  255.             Device "/dev/gpmdata"
  256.         EndSection
  257.  
  258.      * Xconfig:
  259.         #
  260.         # Mouse definition and related parameters
  261.         #
  262.         MouseSystems      "/dev/gpmdata"
  263.  
  264.   8. Miscellaneous Problems and Setups 
  265.  
  266.      * If you have trouble with your mouse in X or console mode, check
  267.        you are not running a getty on the serial line, or anything else
  268.        such as a modem for that matter. Also check for IRQ conflicts.
  269.      * Problems with serial devices may be due to the serial port not
  270.        being initialised correctly at boot. This is done by the setseral
  271.        command, run from the start-up script /etc/rc.d/rc.serial. Check
  272.        the man page for setserial and the Serial-HOWTO for more details.
  273.        It may be worth a little experimentation with types, for instance
  274.        try setserial /dev/mouse uart 16550 or 16550a regardless of what
  275.        port you actually have.
  276.      * Logitech mice may require the line ChordMiddle to enable the
  277.        middle of the three buttons to work. This line replaces
  278.        Emulate3Buttons or goes after the /dev/mouse line in the config
  279.        file. You may well need the ClearDTR and ClearRTS lines in your
  280.        Xconfig.
  281.      * Swapping buttons: use the xmodmap command to change which physical
  282.        button registers as each mouse click. eg: xmodmap -e "pointer = 3
  283.        2 1" will turn round the buttons for use in the left hand. If you
  284.        only have a two-button mouse then it's just numbers 1 & .
  285.      * Acceleration: use the xset m command to change the mouse settings.
  286.        eg xset m 2 will set the acceleration to 2. Look at the manpage
  287.        for full details.
  288.      * Pointer offset: If the click action appears to be coming from the
  289.        left or right of where the cursor is, it may be that your screen
  290.        is not aligned. This is a problem with the S3 driver, which you
  291.        may be able to fix using xvidtune. Try Invert_VCLK/InvertVCLK, or
  292.        EarlySC. This info from Bill Lavender (lavender@MCS.COM) and Simon
  293.        Hargrave. In the XF86Config, it might look like this:
  294.        
  295.           + XF86Config:
  296.             Subsection "Display"
  297.                 Modes       "1024x768" "800x600" "640x480" "1280x1024"
  298.                 Invert_VCLK "*" 1
  299.  
  300.   9. Models tested 
  301.   
  302.    There are a lot of different mice out there, and I cannot honestly say
  303.    that you should go out and buy one rather than the other. What I can
  304.    do is give a list of what I think these mice do, based on experience
  305.    and heresay. Even with this information you should be a little
  306.    cautious - we have two identical mice in our office on two computers,
  307.    some things work on one and not t'other! Any additions to this list
  308.    would be welcome.
  309.    
  310.         WiN mouse, as sold by Office World for eight quid.
  311.                Standard dual-mode Microsoft/MouseSystems.
  312.         Agiler,
  313.                Standard dual-mode Microsoft/MouseSystems. Not solderable.
  314.         Sicos,
  315.                Works ok, needs ClearDTR & lear RTS in config.
  316.         Index sell a mouse for 10 quid,
  317.                Doesn't work in 3 button mode, but does have nice
  318.                instructions :-)
  319.         Artec,
  320.                Usual dual-protocol mouse, needs `ClearDTR' set in config,
  321.                NOT `ClearRTS'
  322.         DynaPoint 3 button serial mouse.
  323.                Usual dual-protocol mouse, needs `ClearDTR' AND `ClearRTS'
  324.                in Xconfig.
  325.         Genius 3 button mouse
  326.                Steven Aizic is working on this one for me.
  327.         Truemouse, made in Taiwan
  328.                Works OK, needs `ClearDTR' in config. (From Tim
  329.                MacEachern)
  330.         Champ brand mouse
  331.                Needs to have switch in PC mode, which enables
  332.                MouseSystems protocol also. (From
  333.                tnugent@gucis.cit.gu.edu.au)
  334.         MicroSpeed mouse
  335.                Usual dual-protocol mouse.
  336.         Venus brand ($7)
  337.                Has a jumper inside to switch between 2 and 3 button mode.
  338.                (From mhoward@mth.com )
  339.         Saturn mouse
  340.                Switched mouse, works OK as MouseSystems in 3-button
  341.                position. (From grant@oj.rsmas.miami.edu .)
  342.         Manhattan mouse.
  343.                Switch for `MS AM' / `PC AT' modes, MS mode works fine
  344.                with the gpm -R method. (From komanec@umel.fee.vutbr.cz).
  345.         Inland mouse.
  346.                Switch for `PC/MS' modes, works fine. (From
  347.                http://ptsg.eecs.berkeley.edu/~venkates).
  348.                
  349.   10. Mouse Tail 
  350.   
  351.    Fuller details of the Xconfig and XF86Config files are found on the
  352.    relevant man pages, and in the documentation about installing X
  353.    windows such as the Xfree86 HOWTO. Much of the information for this
  354.    document has been trawled from the various linux newsgroups. I am
  355.    sorry I did not keep a record of everyone who has indirectly
  356.    contributed by this route, thank you all very much.
  357.    
  358.    So, to sum up:
  359.  
  360.      * Even cheap 3 button Microsoft mice can be made to work.
  361.      * Configure your copy of X to expect a Mouse Systems mouse.
  362.      * Hold down the left button at power-on to switch the mouse to
  363.        MouseSystems mode.
  364.      * You might need to hold the left button down when starting X.
  365.      * Mice are more intelligent than you think.
  366.    
  367.