home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / HOWTO / BUSMOUSE < prev    next >
Encoding:
Text File  |  1995-04-20  |  18.0 KB  |  567 lines

  1.   The Linux Busmouse Howto
  2.   Mike Battersby, mike@starbug.apana.org.au
  3.   1.2, 1994/08/02
  4.  
  5.   1.  Introduction.
  6.  
  7.   This document is a guide to getting your busmouse working with Linux.
  8.   I've written this in the hope that the ten people a week who post
  9.   ``how do I get my busmouse to work'' questions in the comp.os.linux.*
  10.   newsgroups will read it first, though I won't be holding my breath.
  11.  
  12.  
  13.   Busmouse support has been in the kernel for as long as I can remember,
  14.   and hasn't changed in a long time, so this document should be relevant
  15.   to any version of Linux you're likely to have.
  16.  
  17.  
  18.   1.1.  Disclaimer.
  19.  
  20.   The information in this document is correct to the best of my
  21.   knowledge, but there's a always a chance I've made some mistakes, so
  22.   don't follow everything too blindly, especially if it seems wrong.
  23.   Nothing here should have a detrimental effect on your computer, but
  24.   just in case I take no responsibility for any damages incurred from
  25.   the use of the information contained herein.
  26.  
  27.   Microsoft(R) is a Trademark of Microsoft Corporation.
  28.  
  29.   [ trademark notices for other mice, anyone? --- Mike ]
  30.  
  31.  
  32.   1.2.  Feedback.
  33.  
  34.   If you find any mistakes in this document, have any comments about its
  35.   contents or an update or addition, send them to me at the address
  36.   listed at the top of this howto.
  37.  
  38.  
  39.   1.3.  Acknowledgements.
  40.  
  41.   This howto has been, in the spirit of Linux, a community effort.  Many
  42.   thanks go to Johan Myreen for the sections on the PS/2 mice, Robert T.
  43.   Harris for help on the ATI-XL sections and Reuben Sumner for
  44.   miscellaneous info and constructive criticism.
  45.  
  46.  
  47.   Thanks also to the multitudes of people who have sent me mouse
  48.   information, fixes or words of encouragement.
  49.  
  50.  
  51.   2.  Determining your mouse type.
  52.  
  53.   There are two separate but important characteristics you will need to
  54.   know about your mouse before you go on: what interface it uses and
  55.   what protocol it uses.  The interface is the hardware aspect of the
  56.   mouse, taking into account things like which i/o ports it uses and how
  57.   to check if it is installed.  This is the part which the kernel is
  58.   concerned with, so that it knows how to read data from the mouse.  The
  59.   protocol is the software aspect of the mouse.  Applications need to
  60.   know the protocol to interpret the raw mouse data they receive from
  61.   the kernel.
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   2.1.  Mouse interfaces.
  68.  
  69.   The Linux kernel currently supports four different kinds of bus mouse
  70.   interface : Inport (Microsoft), Logitech, PS/2 and ATI-XL.  The
  71.   majority of bus mice have Inport interfaces, although lately PS/2
  72.   interfaces are becoming more popular.  There is no surefire way of
  73.   determining your mouse interface --- mouse developers generally do
  74.   their own thing when it comes to standards.  The following sections
  75.   may help, otherwise you'll just have to make it up.
  76.  
  77.  
  78.   2.2.  Inport mice.
  79.  
  80.   This includes most of the old style Microsoft mice which are shaped
  81.   like a bar of dove soap.  U.S. users who have purchased Gateway
  82.   computers should note that the mice that come with them are not Inport
  83.   mice but PS/2 mice (see below).  Inport mice generally connect to an
  84.   interface card which plugs into the bus on your motherboard.  If the
  85.   plug which connects your mouse cord to the interface card is round,
  86.   has 9 pins, and a notch in one side you likely have an Inport mouse.
  87.  
  88.  
  89.   As far as I can tell, apart from the ATI-XL, all ATI mice (such as
  90.   those on the Graphics Ultra cards) are plain Inport mice.
  91.  
  92.  
  93.   2.3.  Logitech mice.
  94.  
  95.   Logitech mice in general appear almost exactly the same as Inport
  96.   mice.  They too connect to an interface card via a 9 pin mini-din
  97.   connector.  Hopefully, it will have come in a Logitech box or have
  98.   ``Logitech'' printed on the connector card so that you can tell it
  99.   actually is a Logitech mouse.
  100.  
  101.  
  102.   There are also some truly ancient Microsoft mice (ones with ball
  103.   bearings on the bottom as well as the mouse ball and a DB9 connector)
  104.   which also use the Logitech protocol.
  105.  
  106.  
  107.   2.4.  PS/2 mice.
  108.  
  109.   PS/2 mice aren't really bus mice at all.  The PS/2 mouse interface is
  110.   not on an expansion card, the mouse is connected to the PS/2 Auxiliary
  111.   Device port on the keyboard controller.  A PS/2 mouse port uses a
  112.   6-pin mini DIN connector, similar to the keyboard connector.  Many
  113.   laptops also use this kind of interface to their trackballs --- except
  114.   for the connector, of course.
  115.  
  116.  
  117.   2.5.  ATI-XL mice.
  118.  
  119.   ATI-XL mice are a variant of Inport mice, with some slight
  120.   differences.  They come on the ATI-XL combined video adaptor/mouse
  121.   card.  Unless you know you have an ATI-XL card (and thus an ATI-XL
  122.   mouse), you probably don't have one of these. It is possible for ATI-
  123.   XL mice to use either the ATI-XL or Inport kernel drivers, although
  124.   the ATI-XL driver should give better results.
  125.  
  126.  
  127.   2.6.  Mouse protocols.
  128.  
  129.   The PC world is full of different and conflicting mouse protocols.
  130.   Fortunately, the choice for bus mice is considerable smaller than that
  131.   for serial mice.  Most Inport, Logitech and ATI-XL mice use the
  132.   ``BusMouse'' protocol, although there are some ancient Logitech mice
  133.   which use the ``MouseSystems'' protocol, and some even older Microsoft
  134.   mice which use the Logitech protocol.  PS/2 mice use the ``PS/2''
  135.   protocol.
  136.  
  137.  
  138.   3.  Getting your mouse working.
  139.  
  140.   Once you have figured out your mouse interface and protocol types,
  141.   you're ready to proceed.
  142.  
  143.  
  144.   3.1.  Setting the mouse interrupt.
  145.  
  146.   Now, you'll need to know which interrupt number your mouse is using,
  147.   and make sure it doesn't conflict with any other peripherals you have
  148.   installed.
  149.  
  150.  
  151.   You should make sure that your mouse is not trying to use the same
  152.   interrupt as any of your other devices --- it is not possible for the
  153.   mouse to share an interrupt under Linux, even though it may work fine
  154.   under other operating systems.  Check the documentation for all your
  155.   peripherals to see which interrupt they use.  In most cases IRQ4 is
  156.   used for the first serial port (/dev/ttyS0), IRQ3 for the second
  157.   (/dev/ttyS1) (these are assuming you actually have such devices --- if
  158.   you don't you can happily use their IRQ's), and IRQ5 for some SCSI
  159.   adaptors.
  160.  
  161.  
  162.   Note that for ATI-XL, Inport and Logitech mice the kernel default is
  163.   to use IRQ5, so if you are stuck with a pre-compiled kernel (eg, CD-
  164.   ROM users) you will have to use that.
  165.  
  166.  
  167.   3.2.  Inport and Logitech mice.
  168.  
  169.   If you open up your computer's case and look at the card which your
  170.   mouse plugs into, you should notice a block of jumpers on the card
  171.   (hopefully labeled ``INTERRUPT'') with positions for interrupt
  172.   (otherwise known as IRQ) numbers 2,3,4 and 5.  To change the interrupt
  173.   simply move the jumper from its current position onto the correct pair
  174.   of pins.
  175.  
  176.  
  177.  
  178.        ***************************************************
  179.        ***     MAKE SURE YOUR COMPUTER IS TURNED OFF   ***
  180.        ***     BEFORE CHANGING THE JUMPERS AROUND.     ***
  181.        ***************************************************
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.   3.3.  ATI-XL mice.
  189.  
  190.   ATI-XL busmice have a software selectable IRQ - you should have
  191.   received with your mouse a MS-DOS program (VSETUP.EXE) to set the IRQ.
  192.   In order to do so you must (temporarily) boot MS-DOS and run this
  193.   program.  Note that the VSETUP program takes an optional parameter
  194.   ``/70'' to increase the vertical refresh rate (which results in less
  195.   flicker).  The VSETUP program also allows you to select either the
  196.   primary or secondary mouse address - you should set this to the
  197.   primary address or the kernel will not be able to detect your mouse.
  198.  
  199.   Once VSETUP has been run you must perform a hard reset for the new
  200.   configuration to take effect.
  201.  
  202.  
  203.  
  204.   3.4.  PS/2 mice.
  205.  
  206.   The PS/2 mouse always uses IRQ12 -- there is no way of changing this
  207.   (except with a soldering gun.)  In the rare case that some other
  208.   device is using IRQ12, you'll have to rejumper that peripheral to use
  209.   another IRQ number.
  210.  
  211.  
  212.   3.5.  Compiling the kernel.
  213.  
  214.   In order for your busmouse to operate correctly you will need to
  215.   recompile your kernel with the busmouse support compiled in.
  216.  
  217.  
  218.   Change to your kernel directory (here assumed to be (/usr/src/linux)
  219.   and do a
  220.  
  221.  
  222.        make config
  223.  
  224.  
  225.  
  226.  
  227.  
  228.   If you are unsure as to your mouse type, the first time you recompile
  229.   the kernel you may wish to enable all of the busmouse options in the
  230.   hope that the kernel will autodetect your mouse properly.  People have
  231.   mixed sucess with this: it doesn't always work, but on the other hand
  232.   it might save you any further compiles.
  233.  
  234.  
  235.   3.5.1.  Inport, Logitech and ATI-XL mice.
  236.  
  237.   Answer ``y'' to the question pertaining to your type of busmouse
  238.   interface and ``n'' to all the other busmouse questions.  For example,
  239.   if you have an Inport mouse you should answer ``y'' to
  240.  
  241.        Microsoft busmouse support
  242.  
  243.  
  244.   and ``n'' to all other busmouse questions.  Answer the non-mouse
  245.   related questions as you usually would.
  246.  
  247.  
  248.   If you have a Logitech or Inport mouse, edit the file
  249.   /usr/src/linux/include/linux/busmouse.h and change the line which says
  250.  
  251.        #define MOUSE_IRQ               5
  252.  
  253.  
  254.   to reflect the interrupt number for your mouse (see section ``setting
  255.   the mouse interrupt'' for details on finding your interrupt number).
  256.  
  257.  
  258.   If you have an ATI-XL mouse, edit the file
  259.   /usr/src/linux/drivers/char/atixlmouse.c and change the line which
  260.   says
  261.  
  262.        #define ATIXL_MOUSE_IRQ         5
  263.  
  264.  
  265.   to reflect your mouse's interrupt number.
  266.  
  267.  
  268.   Due to the vagaries of the PC architecture, if you have set your mouse
  269.   to use interrupt 2, you must set the #define to use interrupt 9.
  270.  
  271.  
  272.   Examples
  273.  
  274.  
  275.   For a mouse on interrupt 3, you should change the line to read
  276.  
  277.        #define MOUSE_IRQ               3
  278.  
  279.  
  280.  
  281.   For a mouse on interrupt 2, you should change the line to read
  282.  
  283.        #define MOUSE_IRQ               9
  284.  
  285.  
  286.  
  287.   Next, compile your kernel as per the instructions which come with it,
  288.   and boot from the new kernel.  You should now have the busmouse
  289.   support correctly compiled in.
  290.  
  291.  
  292.   3.5.2.  PS/2 mice.
  293.  
  294.   To compile the kernel with PS/2 mouse support answer ``y'' to the
  295.   question.
  296.  
  297.        PS/2 mouse (aka "auxiliary device") support
  298.  
  299.  
  300.  
  301.   The PS/2 mouse driver actually supports two kinds of devices: the
  302.   standard PS/2 Auxiliary Device controller and a special PS/2 mouse
  303.   interface chip from Chips & Technologies which is used in the Texas
  304.   Instruments Travelmate and Gateway Nomad laptops.  To compile in
  305.   support for the trackballs on these computers, answer ``y'' to the
  306.  
  307.        C&T 82C710 mouse port support (as on TI Travelmate)
  308.  
  309.  
  310.   question.  Note that you will still have to answer ``y'' to the ques-
  311.   tion about the standard PS/2 driver to even get a chance to answer
  312.   this question, since the 82C710 driver is actually an add-on to the
  313.   standard PS/2 mouse driver.
  314.  
  315.  
  316.   When configured both for a standard PS/2 mouse device and the 82C710
  317.   device, the driver first tries to locate a 82C710 chip at boot time.
  318.   Failing this, the standard driver is used instead, so using a kernel
  319.   configured for both types of interface on a machine with a standard
  320.   PS/2 mouse port should work too.  However, there has been one report
  321.   of a falsely detected 82C710 chip, so to be on the safe side do not
  322.   configure in support for the 82C710 if you don't need it.
  323.  
  324.  
  325.   Compile your new kernel and boot from it as you normally would.
  326.  
  327.  
  328.  
  329.  
  330.  
  331.   3.5.3.  Selection.
  332.  
  333.   Regardless of your mouse type you should answer ``y'' to the
  334.  
  335.        Selection (cut and paste for virtual consoles)
  336.  
  337.  
  338.   question if you wish to run the selection program (see section
  339.   ``selection'' for more details).
  340.  
  341.  
  342.  
  343.   3.6.  The mouse devices.
  344.  
  345.   Mice under Linux are accessed via the devices in the /dev directory.
  346.   The following table gives a list of interface types and which device
  347.   you should use.
  348.  
  349.  
  350.  
  351.        INTERFACE        DEVICE        MAJOR    MINOR
  352.        ---------------------------------------------
  353.        Logitech        /dev/logibm      10       0
  354.        PS/2            /dev/psaux       10       1
  355.        Inport          /dev/inportbm    10       2
  356.        ATI-XL          /dev/atibm       10       3
  357.  
  358.            Table 1.  Mouse devices.
  359.  
  360.  
  361.  
  362.  
  363.  
  364.      Note:
  365.         If you are using your ATI-XL mouse with the Inport driver, you
  366.         should use the /dev/inportbm device, not the /dev/atibm device.
  367.  
  368.  
  369.   The major and minor entries are the device numbers for that particular
  370.   device.
  371.  
  372.  
  373.   If you find that you do not have these devices, you should create them
  374.   first.  To do so, execute the following as root.
  375.  
  376.  
  377.        mknod /dev/logibm   c 10 0
  378.        mknod /dev/psaux    c 10 1
  379.        mknod /dev/inportbm c 10 2
  380.        mknod /dev/atibm    c 10 3
  381.  
  382.  
  383.  
  384.  
  385.  
  386.      Note:
  387.         Some time in the (progressively less) recent history of Linux
  388.         the names for the busmouse devices have changed.  The following
  389.         device names have been superceded by those above and should be
  390.         removed: bmousems, bmouseps2, bmouseatixl, bmouselogitech.
  391.  
  392.  
  393.   Many people like to create a symbolic link from their mouse device to
  394.   /dev/mouse so that they don't have to remember which device they need
  395.   to be using.  If you have one of the current Linux distributions you
  396.   will almost certainly find that you have such a link.  If you have
  397.   such a link, or create one, you should make sure that it is pointing
  398.   to the correct device for your mouse.
  399.  
  400.  
  401.  
  402.   3.7.  Testing your mouse.
  403.  
  404.   Get the file selection-1.6.tar.gz from your local Linux ftp site and
  405.   compile the program ``test-mouse'' within it, according to the
  406.   instructions (all you should need to do is type ``make test-mouse'').
  407.   Run the program like this
  408.  
  409.        test-mouse -t <mouse arg> -m <mouse dev>
  410.  
  411.  
  412.   where <mouse arg> is ``bm'' (without the quotes) if you use the Bus-
  413.   Mouse protocol, or ``ps2'' if you use the PS/2 protocol, and <mouse
  414.   dev> is your mouse device name from table 1.
  415.  
  416.  
  417.   If your mouse is working correctly, you should be able to paint on the
  418.   screen by holding down the right or left mouse button and dragging the
  419.   mouse.  Push the left and right mouse buttons simultaneously to exit
  420.   the program.
  421.  
  422.  
  423.   4.  Using your mouse.
  424.  
  425.   4.1.  Selection.
  426.  
  427.   Selection is a program which allows you to do mouse based 'cut- and-
  428.   paste' between virtual consoles under Linux.  Selection can be found
  429.   as the file selection-1.6.tar.gz at your friendly Linux FTP site (such
  430.   as sunsite.unc.edu), and contains instructions for getting it
  431.   compiled.  Some Linux distributions, such as Slackware, come with a
  432.   precompiled selection binary.
  433.  
  434.  
  435.   When invoking selection, use the -t switch to selection to indicate
  436.   which protocol your mouse is using and the -m option to indicate which
  437.   mouse device you are using.  The default is to use the /dev/mouse
  438.   device, so you can omit the -m option if you have the appropriate
  439.   symbolic link. For example, if you use the BusMouse protocol,
  440.   selection should be run like this:
  441.  
  442.        selection -t bm
  443.  
  444.  
  445.   or if you use the PS/2 protocol:
  446.  
  447.        selection -t ps2
  448.  
  449.  
  450.  
  451.   You should then be able to cut and paste text between virtual consoles
  452.   using the mouse buttons.  Read the documentation with selection, or do
  453.   a ``man selection'' for more information on how to operate it.
  454.  
  455.  
  456.   There have been a couple of reports of selection not working correctly
  457.   with certain laptop trackballs (under the PS/2 interface).  Replacing
  458.   the line
  459.  
  460.  
  461.        { 0xcc,   0x00,   0x00,   0x00,   3       }   /* PS/2 */
  462.  
  463.   in selection's mouse.c file with the line
  464.  
  465.  
  466.        { 0xcc,   0x08,   0x00,   0x00,   3       }   /* PS/2 */
  467.  
  468.  
  469.  
  470.  
  471.   may help if you are having problems and can't track it down to any-
  472.   thing else.
  473.  
  474.  
  475.   4.2.  XFree86.
  476.  
  477.   To use your busmouse under XFree86, you will need to set your mouse
  478.   protocol type in your Xconfig file. If you have a BusMouse protocol
  479.   mouse, your Xconfig should contain (including the quotes)
  480.  
  481.  
  482.        Busmouse        "/dev/mouse"
  483.  
  484.  
  485.  
  486.  
  487.  
  488.   For PS/2 mice it should have
  489.  
  490.  
  491.        ps/2        "/dev/mouse"
  492.  
  493.  
  494.  
  495.  
  496.  
  497.   If you have a two button mouse, it should also contain the line
  498.  
  499.  
  500.        Emulate3Buttons
  501.  
  502.  
  503.  
  504.  
  505.   which will allow you to emulate the use of the middle mouse button by
  506.   pressing both mouse buttons simultaneously.  All other mouse related
  507.   lines, such as ``BaudRate'' and ``SampleRate'' should be commented
  508.   out, as these have no effect on bus mice.
  509.  
  510.  
  511.   4.3.  XFree86 and selection.
  512.  
  513.   Unlike serial mice, you cannot share busmice between processes.  This
  514.   means you will have to kill any copies of ``selection'' (see section
  515.   ``selection'') you have running before you start up Xfree86.  If you
  516.   try to run X with selection running, you will get errors like the
  517.   following
  518.  
  519.  
  520.        Fatal server error:
  521.        Cannot open mouse (Device or resource busy)
  522.  
  523.  
  524.  
  525.  
  526.  
  527.   Version 1.6 of selection allows you to terminate running copies of
  528.   selection by executing
  529.        selection -k
  530.  
  531.  
  532.   This should be done before starting up X11.  You may wish to add a
  533.   line containing the above command to the top of your startx script so
  534.   that the mouse is shut down automatically.  If you have an older ver-
  535.   sion of selection which does not support the -k switch you will have
  536.   to kill selection by hand.
  537.  
  538.  
  539.   5.  Still can't get your mouse going?
  540.  
  541.   So you've read through this howto a dozen times, done everything
  542.   exactly as you think you should have, and your mouse still doesn't
  543.   work?  The best advice I can give you is this: experiment.  Sure, it's
  544.   a pain in the posterior, but in the end the only way to find out what
  545.   is going to work with your mouse is to try all of the alternatives
  546.   until you have success.
  547.  
  548.  
  549.   As always, if there is something you don't understand, try reading the
  550.   manual page first and see if that helps.  If you have a specific
  551.   question, or a problem you think I might be able to help with, feel
  552.   free to contact me at the address listed at the top of this howto, and
  553.   I'll see if I can help you out or point you to someone who can.
  554.  
  555.  
  556.   The comp.os.linux.help newsgroup is the appropriate forum for
  557.   discussion and/or questions regarding mice --- please don't post
  558.   questions to other groups, and especially don't crosspost questions to
  559.   two or more of the Linux groups, they are more than cluttered enough
  560.   as it is!  When posting, you will get a much better response (and much
  561.   fewer flames) if you use appropriate Subject: and Keywords: lines.
  562.   For example:
  563.  
  564.  
  565.        Subject: BUSMICE - Gateway 2000 mouse wont work.
  566.        Keywords: mouse busmouse gateway
  567.