Using your mouse.

# 4. Using your mouse.

Contents of this section

## 4.1 Testing your mouse.Selection.

Selection is a program which allows you to do mouse based 'cut- and-paste' between virtual consoles under Linux. Selection can be found as the file `selection-1.6.tar.gz` at your friendly Linux FTP site (such as `sunsite.unc.edu`), and contains instructions for getting it compiled. Some Linux distributions, such as Slackware, come with a precompiled selection binary.

When invoking selection, use the -t switch to selection to indicate which protocol your mouse is using and the -m option to indicate which mouse device you are using. The default is to use the `/dev/mouse` device, so you can omit the -m option if you have the appropriate symbolic link. For example, if you use the BusMouse protocol, selection should be run like this:

> `selection -t bm`

or if you use the PS/2 protocol:

> `selection -t ps2`

You should then be able to cut and paste text between virtual consoles using the mouse buttons. Read the documentation with selection, or do a ``man selection'' for more information on how to operate it.

There have been a couple of reports of selection not working correctly with certain laptop trackballs (under the PS/2 interface). Replacing the line

> `

>     { 0xcc,   0x00,   0x00,   0x00,   3       }   /* PS/2 */

> `

in selection's mouse.c file with the line

> `

>     { 0xcc,   0x08,   0x00,   0x00,   3       }   /* PS/2 */

> `

may help if you are having problems and can't track it down to anything else.

## 4.2 XFree86.

To use your busmouse under XFree86, you will need to set your mouse protocol type in your Xconfig file. If you have a BusMouse protocol mouse, your Xconfig should contain (including the quotes)

> `

>     Busmouse        "/dev/mouse"

> `

For PS/2 mice it should have

> `

>     ps/2        "/dev/mouse"

> `

If you have a two button mouse, it should also contain the line

> `

>     Emulate3Buttons

> `

which will allow you to emulate the use of the middle mouse button by pressing both mouse buttons simultaneously. All other mouse related lines, such as ``BaudRate'' and ``SampleRate'' should be commented out, as these have no effect on bus mice.

## 4.3 XFree86 and selection.

Unlike serial mice, you cannot share busmice between processes. This means you will have to kill any copies of ``selection'' (see section selection ) you have running before you start up Xfree86. If you try to run X with selection running, you will get errors like the following

> `

>     Fatal server error:
>     Cannot open mouse (Device or resource busy)

> `

Version 1.6 of selection allows you to terminate running copies of selection by executing

> `selection -k`

This should be done before starting up X11. You may wish to add a line containing the above command to the top of your `startx` script so that the mouse is shut down automatically. If you have an older version of selection which does not support the `-k` switch you will have to kill selection by hand.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter