GPM-1.20.1

GPM (the General Purpose Mouse daemon) is a mouse server for applications running in the console. It not only provides cut and paste support generally, but its library component is used by various software such as links to provide mouse support to the application generally. It is useful on desktops, especially if following (Beyond) Linux From Scratch instructions - it's often much easier (and less error prone) to cut and paste between two console windows than to type everything by hand!

Introduction to GPM

The GPM package contains a mouse server for the console and xterm. This is useful for cutting and pasting text in console mode, and also because many console-based programs need it to compile mouse support into themselves.

Package information

Installation of GPM

Install GPM by running the following commands:

patch -Np1 -i ../gpm-1.20.1-segfault.patch &&
patch -Np1 -i ../gpm-1.20.1-silent.patch &&
LDFLAGS="-lm" ./configure --prefix=/usr &&
make &&
make install &&
ldconfig -n -l /usr/lib/libgpm.so.1.19.0

Command explanations

export LDFLAGS="-lm": The math library must be linked with gpm, as ceil() is used in some cursor scrolling logic. LDFLAGS is only needed if you optimize gpm for size.

ldconfig -n -l : During installation, gpm outputs a message to run the above command to create the proper library links.

Configuring GPM

gpm init.d script

The gpm init.d script can be created using the following commands:

cat > /etc/rc.d/init.d/gpm << "EOF"
#!/bin/sh
# Begin $rc_base/init.d/gpm

# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans  - [email protected]
# GPM specific parts by Mark Hymers - [email protected]

source /etc/sysconfig/rc
source $rc_functions

if [ -f /etc/sysconfig/mouse ]
	then
        source /etc/sysconfig/mouse
fi

if [ -z "$MDEVICE" ] || [ -z "$PROTOCOL" ]
	then
	echo "Please create an /etc/sysconfig/mouse file containing"
	echo "MDEVICE and PROTOCOL values"
	exit 1;
fi

case "$1" in
        start)
                echo "Starting gpm..."
                loadproc gpm -m $MDEVICE -t $PROTOCOL
                ;;

        stop)
                echo "Stopping gpm..."
                killproc gpm
                ;;

        restart)
                $0 stop
                sleep 1
                $0 start
                ;;

        status)
                statusproc gpm
                ;;

        *)
                echo "Usage: $0 {start|stop|restart|status}"
                exit 1
                ;;
esac

# End $rc_base/init.d/gpm
EOF
chmod 755 /etc/rc.d/init.d/gpm

You then need to create symbolic links to this file in the relevant rc.d directories. For example:

cd /etc/rc.d/init.d &&
ln -sf ../init.d/gpm ../rc0.d/K10gpm &&
ln -sf ../init.d/gpm ../rc1.d/K10gpm &&
ln -sf ../init.d/gpm ../rc2.d/K10gpm &&
ln -sf ../init.d/gpm ../rc3.d/S70gpm &&
ln -sf ../init.d/gpm ../rc4.d/S70gpm &&
ln -sf ../init.d/gpm ../rc5.d/S70gpm &&
ln -sf ../init.d/gpm ../rc6.d/K10gpm

Config files

/etc/sysconfig/mouse This file contains the name of your mouse device and the protocol which it uses. To create this file, run the following:

cat > /etc/sysconfig/mouse << "EOF" 
# start /etc/sysconfig/mouse
MDEVICE=[yourdevice]
PROTOCOL=[yourprotocol]
# end /etc/sysconfig/mouse
EOF

Configuration Information

Examples of values to set MDEVICE and PROTOCOL to are

MDEVICE=/dev/psaux
PROTOCOL=imps2

A list of which protocol values are known can be found by running gpm -t -help. Your MDEVICE setting depends on which type of mouse you have. For example, /dev/ttyS0 for a serial mouse (on Windows this is COM1), /dev/input/mice is often used for USB mice and /dev/psaux for PS2 mice. It is normally thought not a good idea to link /dev/mouse to the relevant device, but instead to reference it directly.

Contents

The GPM package contains gpm, gpm-root, disable-paste and mev.

Description

gpm

gpm is a cut and paste utility and mouse server for virtual consoles.

gpm-root

gpm-root is a default handler for gpm. It is used to draw menus on the root window.

disable-paste

No description available.

mev

mev is a program to report mouse events.