[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problem with left-handed mouse on X - is GPM to blame or is it X?



On Mon, May 10, 2004 at 07:28:57PM -0400, Zephaniah E. Hull wrote:
> Please see the last message, where I covered just this.
> 
> Raw mode repeats byte for byte, it does not attempt to do ANYTHING to
> them.
> 
> In addition, he is repeating a PS2 protocol, with all the problems
> involved in that.
> 
> I will say it once more, this is a case of user error.
> 
> The proper configuration for this is having gpm not repeat, and both X
> and gpm reading from /dev/input/mice, with X doing some button
> remapping in whatever manner is now suggested.

Okay.  I checked the manpage for this information and did not find it.

I also found that the gpm(8) manpage is ugly.

So I did something about it.  Please see two attached files; one
is a diff which patches the manpage to simply document these two minor
points.  The other one overhauls the manpage completely.  I looked into
the source package, but the method used to generate both Texinfo and
Roff document source from a single file is truly grody.

> If 'xmodmap -e "pointer = 3 2 1"' is no longer the suggested means, what
> is?

That's a good question, and I don't have the answer at present.

-- 
G. Branden Robinson                |     You are not angry with people when
Debian GNU/Linux                   |     you laugh at them.  Humor teaches
branden@debian.org                 |     them tolerance.
http://people.debian.org/~branden/ |     -- W. Somerset Maugham
--- gpm.8~	2004-05-20 15:05:38.000000000 -0500
+++ gpm.8	2004-05-20 15:09:34.000000000 -0500
@@ -145,6 +145,10 @@
 normal sequence, `321' can be used by left-handed people,
 and `132' can be useful with two-button mice (especially within
 Emacs). All the button permutations are allowable.
+.IP
+.B Note:
+This option is ignored if the \(oq\-R\(cq option is used with the parameter
+\(oqraw\(cq.
 .TP
 -d \fIdelta\fP
 Set the delta value. When a single motion event
@@ -231,6 +235,9 @@
 an easy way to manage those stupid dual-mode mice which force you
 to keep the middle button down while changing video mode. The option
 is forced on by the `-M' option.
+.IP
+.B Note: The only repeat type reliably supported by version 4.3 or later of
+.B the XFree86 X server is \(oqms3\(cq.
 .TP
 -s \fInumber\fP
 Set the sample rate for the mouse device.
.TH gpm 8 "20 May 2004" "GPM" "General Purpose Mouse 1.19.6"
.SH NAME
gpm \- cut\-and\-paste utility and mouse server for virtual consoles
.SH SYNOPSIS
.B gpm
[
.I options
]
.br
.SH DESCRIPTION
GPM (General Purpose Mouse) tries to be a useful mouse server for
applications running on the Linux console.  The information below is
extracted from the Texinfo documentation, which is the preferred source of
information.
.PP
GPM makes it easy to select and copy regions of text on the virtual
console, much as is done in graphical programs such as word processors.
Text regions are highlighted with the mouse in an area called the
\(oqselection buffer\(cq, or just \(oqselection\(cq.  The term
\(oqcut\-and\-paste\(cq can be a little misleading, because GPM never
deletes text from the console.  GPM is actually more of a
.RI \(oq copy \-and\-paste\(cq
utility.
.PP
The
.B gpm
executable is meant to act like a daemon (thus, \(oqgpmd\(cq would be a
better name for it).
.SS Operation
To select text press and hold the left mouse button and drag the mouse.
.PP
On three\-button mice, click the middle button to paste text in the same or
another console.  The right button is used to extend the selection, like in
.BR xterm (1x).
.PP
Two\-button mice use the right button to paste text.
.PP
Double\- and triple\-clicks of the left button select whole words and
whole lines.  Use of the
.B \-p
option is recommended for best visual feedback.  Which characters
constitute part of a \(oqword\(cq can be changed with the
.B \-l
option.
.PP
If a trailing space after the visible content of a line is highlighted, and
if there is no other text on the remainder of the line, the rest of the
line will be selected automatically.  If a number of lines are selected,
highlighted trailing spaces on each line will be removed from the selection
buffer.
.PP
Any output on the virtual console holding the selection will clear the
highlighted selection from the screen, to maintain integrity of the
display, although the contents of the selection buffer will be unaffected.
.PP
The selection mechanism is disabled if the controlling virtual console is
placed in graphics mode (for example when running an X server), and is
re\-enabled when text mode is resumed \(em but see the \(oqBUGS\(cq section
below.
.SS "Special Commands"
GPM has the ability to execute special commands via mouse actions under
certain circumstances.  The special commands default to rebooting and
halting the system, but the user can specify his or her personal choice.
The ability to invoke commands using only the mouse can be a handy one,
because it allows you to shut the system down cleanly when the keyboard is
locked and no network is available to restore the system to a sane state.
.PP
Special commands are executed by entering a special mode which overrides
the normal button functions.  This special command mode is entered by
triple\-clicking the left and right buttons at the same time \(em an
unlikely event during normal mouse usage.  The easiest way to achieve this
is by pressing and holding one of the buttons while triple\-clicking the
other one.  When special command mode is active, a message appears on the
console and the speaker beeps twice (if one is present).  If the user then
releases all the buttons and presses one of them again within three
seconds, then the special command corresponding to the button is executed,
and special commands are disabled again.  If no button is pressed within
three seconds, special command mode is exited.
.PP
The default special commands are:
.TP
left button
reboot the system by killing
.BR init (8)
.TP
middle button
execute
.B /sbin/shutdown \-h now
.TP
right button
execute
.B /sbin/shutdown \-r now
.PP
The
.B \-S
command\-line option enables special command processing and allows you to
change the three special commands.  To accept the default commands use
.B \-S ""
(i.e., specify an empty argument).  To specify your own commands, use a
colon\-separated list to specify commands associated to the left, middle
and right button.  If any of the commands is empty, it is interpreted as
\(oqsend a TERM signal to the init process\(cq.  This particular operation
is supported, in addition to executing external commands, because sometimes
serious problems prevent the system from being able to fork any new
processes (such as
.BR shutdown );
in these rare cases, the user should be able to shut the system down at
least somewhat cleanly anyway, and killing
.B init
from an already\-running process, like
.BR gpm ,
is the only way to do it.
.PP
As an example,
.B \-S ":telinit 1:/sbin/halt"
associates killing
.B init
with the left button, going single user with the middle one, and halting
the system with the right button.
.PP
System administrators should obviously be careful about special commands,
as
.B gpm
runs with superuser prvileges.  Special commands are best suited for
computers whose mouse can be physically accessed only by trusted people.
.PP
Special commands are not enabled by default; to use them, the
.B \-S
option must be specified when
.B gpm
is started.
.SH OPTIONS
Available command\-line options are the following:
.TP
.BI \-a\  accel
Set the acceleration value used when a single motion event is larger than
.I delta
(see
.BR \-d ).
This is an integer multiplier applied to the amount of motion detected, and
must be at least 2.  This option is ignored for absolute\-motion devices.
.TP
.BI \-A\  \fR[\fPlimit\fR]
Disable selection pasting.
.IP
This is intended as a security measure; a plausible attack on a system
seems to be to stuff a nasty shell command into the selection buffer
(e.g.,
.BR rm\ \-rf\ / )
including the terminating line break; then all the victim has to do is
click the middle mouse button, and havoc ensues.
.IP
Optionally, the selection can be enabled, but \(oqaged\(cq, that is, the
selection will be automatically cleared after a period of inactivity,
rendering a paste operation harmless (because there is nothing to paste.)
To enable this mode, specify this option with the
.I limit
parameter, which is interpreted as the time in seconds for which a
selection is considered valid and pastable.
.\" XXX: The "disable-paste" program no longer appears to be shipped.
.\" .PP
.\" As of version 1.15.7, a trivial program called
.\" .B disable\-paste
.\" is provided.  The following makes a good addition to
.\" .I /etc/profile
.\" if you allow multiple users to work on your console.
.\" .PP
.\" .nf
.\" case $( /usr/bin/tty ) in
.\"     /dev/tty[0\-9]*) /usr/bin/disable\-paste ;;
.\" esac
.\" .fi
.TP
.BI \-b\  baud
Set the baud rate.
.TP
.BI \-B\  sequence
Set the button sequence.
.B 123
is the normal sequence,
.B 321
can be used by left\-handed people, and
.B 132
can be useful with two\-button mice (especially within Emacs).  All the
button permutations are allowable.
.IP
.B Note:
This option is ignored if the \(oq\-R\(cq option is used with the parameter
\(oqraw\(cq.
.TP
.BI \-d\  delta
Set the delta value.  When a single motion event
is longer than
.IR delta ,
.I accel
is used as a multiplying factor.  The
.I delta
value must be 2 or greater.  This option is ignored for absolute\-motion
devices.
.TP
.B \-D
Do not automatically enter background operation when started,
and log messages to the standard error stream, not the syslog
mechanism.  This is useful for debugging.
.TP
.BI \-g\  number
With \(oqglidepoint\(cq or \(oqtrackpad\(cq\-style devices, emulate the
specified button with tapping.
.I number
must be
.BR 1 ,
.BR 2 ,
or
.BR 3 ,
and refers to the button number before
.B \-B
button remapping is performed (if applicable).  This option applies to the
.B mman
and
.B ps2
mouse types (see the \(oqMouse Types\(cq section of the GPM Texinfo
documentaion).  No button is emulated by default because the PS/2 protocol
for tapping is incompatible with some normal PS/2 mice.
.TP
.B \-h
Print a summary of command line options.
.TP
.BI \-i\  interval
Set
.I interval
(in milliseconds) to be used as an upper time limit for multiple clicks.
If the interval between button\-up and button\-down events is less than
.IR limit ,
the press is considered a double or triple click.
.TP
.B \-k
Kill a running
.BR gpm .
This can be used by bus mouse users to kill gpm before running X (unless
they use
.B \-R
or the single\-open limitation is removed from the kernel).
.TP
.BI \-l\  charset
Specify the set of characters that constitute a \(oqword\(cq.
\(oq\-\(cq is used to specify a range and \(oq\\\(cq is used to escape the
next character or to provide octal codes.  Only visible characters can
appear in
.I charset
because control characters can't appear in text\-mode video memory, whence
selection is cut.  The default value is
"\-a\-zA\-Z0\-9_./\(rs300\-\(rs326\(rs330\-\(rs366\(rs370\-\(rs377", which
means that the hyphen\-minus, the upper\- and lowercase letters A\-Z, the
digits 0\-9, the low line (underscore), and full stop (period) are all word
characters, as are the specified octal ranges, which correspond (in the
ISO\-8859\-1 and UTF\-8 character sets) to the letter characters from the
Latin\-1 supplemental character set (e.g., \(oq\(^a\(cq and \(oq\(/o\(cq
are word characters, but \(oq\(di\(cq and \(oq\(Cs\(cq are not).
.TP
.BI \-m\  filename
Open
.I filename
as the mouse device.  The default is
.IR /dev/mouse .
.TP
.B \-M
Enable \(oqmultiple\(cq mode.  The daemon will read two different mouse
devices.  Any subsequent option will refer to the second device, while any
preceding option will be used for the first device.  This option imples
repeating
.RB ( \-R ).
.TP
.BI \-o\  flags
Set protocol\-specific flags.
This option works similarly to the
.B \-o
option of
.BR mount (8);
it is
used to specify a list of parameters that are specific
to each mouse type.  The list is comma\-separated.  The options
.BR dtr ,
.BR rts ,
or
.B both
are used by GPM's traditional serial port initialization routines to toggle
the corresponding modem lines.
.IP
.B Note:
Using serial\-port flags with non\-serial mice (USB stands for Universal
Serial Bus, but it is something entirely different) may generate an error.
.TP
.B \-p
Force the pointer to be visible while selecting.  This is the
behaviour of \(oqselection\-1.7\(cq, but some people find it confusing.
The default is not to show the pointer, which confuses other people.
.TP
.BI \-r\  responsiveness
Set the mouse's responsiveness, a positive integer.  The higher the
responsiveness, the faster the mouse cursor will move.  Acceptable values
range from 1 to 100; the default is 100 (maximum responsiveness).  This
option is ignored for absolute\-motion devices.
.TP
.BI \-R\  \fR[\fPprotocol\fR]
Act as a repeater; any mouse data received while the virtual console is
in graphics mode will be emitted to the FIFO
.IR /dev/gpmdata .
.IP
Using GPM in repeater mode, you can configure the X server to use this FIFO
as a mouse device.  This option is useful for bus\-mouse owners to override
the single\-open limitation.  It is also an easy way to manage stupid
dual\-mode mice which force you to keep the middle button down while
changing video mode.  This option is implied by the
.B \-M
option.
.IP
The protocol to be used by the FIFO's output can be set with the optional
.I protocol
parameter.  In principle, you can use the same names as for the
.B \-t
option (see below), although repeating into some protocols may not be
implemented for a while.  In addition, you can specify
.B raw
as the
.IR protocol
to repeat the mouse data byte by byte, without any protocol translation
(but see the
.B \-B
option above).  If
.I protocol
is omitted, it defaults to
.BR msc .
.IP
.B Note:
The only repeat type reliably supported by version 4.3 or later of the
XFree86 X server is \(oqms3\(cq.
.TP
.BI \-s\  rate
Set the sampling
.I rate
for the mouse device, in samples per second.  Reasonable values range from
10 to 200; the default is 100.
.TP
.BI \-S\  \fR[\fPcommands\fR]
Enable special\-command processing, and optionally specify custom
commands as a colon\-separated list.  See the \(oqSpecial Commands\(cq
section of \(oqDESCRIPTION\(cq, above, for a detailed description of
special commands.
.TP
.BI \-t\  \fItype\fP
Set the mouse
.IR type .
Use
.B gpm \-t help
to get a list of allowable types and exit.  The protocols available as
repeaters (see
.B \-R
above), by marking them with an asterisk (\(oq*\(cq).
.TP
.B \-v
Print version information and exit.
.TP
.BI \-V\  \fR[\fPverbosity_increment\fR]
Raise or decrease the maximum priority level of messages that will be
logged.  Thus, a positive argument has the effect of making the program
more verbose.  One can also give a negative argument to hush the program;
however, note that due to
.BR getopt 3
rules a negative argument must follow the option with no space betwixt
(that is,
.B \-V\-1
but not
.BR \-V\ \-1 ).
The argument is optional and its default value is 1.  The default verbosity
level is 5 (\(oqLOG_NOTICE\(cq; see
.BR syslog (3)).
.TP
.B \-2
Force two\-button operation.  The middle button, if any, will be
interpreted as if it were the right button.
.TP
.B \-3
Force three\-button operation.  By default, the mouse is considered to be a
2\-button device until the middle button is pressed.
.IP
.B Note:
If you use the
.B \-3
option with a 2\-button mouse, you won't be able to paste the selection.
.SH BUGS
The
.B gpm
server may have problems interacting with a local X server; if your
mouse is a single\-open device (i.e., a bus mouse), you should kill
.B gpm
before starting X, or use the
.B \-R
option (see above).  To kill
.BR gpm ,
just invoke
.BR gpm\ \-k .
This problem doesn't apply to serial mice.
.PP
Two instances of
.B gpm
can't run on the same system. If you have two mice, use the
.B \-M
option (see above).
.PP
Unless
.B gpm
is invoked with the
.B \-R
option, the mouse server sleeps until the current console returns to text
mode, or a text mode console becomes the current one.  Thus, it won't reply
to clients.  In any event, it is unlikely that mouse\-eager clients will
spur out in hidden consoles.
.\" XXX: What does "spur out" mean?
.SH HISTORY
.B gpm
is based on the
.B selection
package, and some of its code comes from
.B selection
itself.
.B gpm
is intended as a replacement for
.B selection
as a cut\-and\-paste mechanism; it also provides additional facilities.
The
.B selection
package offered the first cut\-and\-paste implementation for Linux using
two mouse buttons, and the cut buffer is still called \(oqselection
buffer\(cq or just \(oqselection\(cq throughout this document.
.PP
Due to restrictions in the
.IR ioctl( TIOCLINUX )
system call,
.B gpm
must be run by the superuser.  The restrictions were added in the late
versions of the Linux 1.1 kernel to fix a security hole related to
selection and screen dumping.
.PP
The server can be configured to match the user's taste, and any application
using the mouse will inherit the server's attitude.  From release 1.02 up
to 1.19.2 is was possible for any user logged on the system console to
change the mouse feeling using the
.B \-q
option.  This is no longer possible for security reasons.
.PP
As of 0.97 the server program puts itself in the background.  To kill
.B gpm
you can just reinvoke it with the
.B \-k
option, although
.B killall gpm
can be a better choice.
.PP
Special commands were added in version 1.10.
.PP
The selection aging mechanism was added in version 1.17.2.
.PP
Early releases of GPM did not support the
.B \-D
option, and instead supported a compile\-time option.
.PP
In version 1.18.1, the list produced by
.B gpm \-t help
began to mark which protocols are available as repeaters.
.SH AUTHORS
.nf
Andrew Haylett <ajh@gec\-mrc.co.uk> (the original selection code)
Alessandro Rubini <rubini@linux.it> (old maintainer (still helps a lot))
Ian Zimmerman <itz@speakeasy.org> (old maintainer)
Nico Schottelius <nico@schottelius.org> (maintainer)
Many, many contributors, to both \fBselection\fP and \fBgpm\fP.
.fi
.SH MAINTAINERS
The current maintainer is Nico Schottelius.  But without the help of
Alessandro Rubini and the mailing list it would be impossible for him to
maintain
.BR gpm .
The development mailing list can be reached at
.BR <gpm@lists.linux.it> .
More information on the list is in the
.B README
file in the source distribution of GPM.
.SH FILES
.nf
\fI/var/run/gpm.pid\fP   PID of running \fBgpm\fP
\fI/dev/gpmctl\fP        control socket for clients
\fI/dev/gpmdata\fP       FIFO written to by a \(oqrepeater\(cq \fBgpm\fP
.fi
.SH SEE ALSO
.nf
\fBmev\fP(1)        sample client for the gpm daemon
\fBgpm\-root\fP(1)   handler for Control\-Mouse events
.fi
.PP
The Texinfo documentation on GPM gives more complete information and
explains how to write a GPM client.

Attachment: signature.asc
Description: Digital signature


Reply to: