5 kx #!/bin/sh
5 kx #
5 kx # Configure the console mouse support (GPM).
5 kx #
5 kx T_PX=$1
5 kx TMP=/var/lib/radix/setup/tmp
5 kx GPM=/usr/sbin/gpm
5 kx # If the mouse is USB, we can autodetect it:
5 kx if [ -r /proc/bus/input/devices ]; then
5 kx if grep -B3 Handlers=mouse /proc/bus/input/devices | grep Phys=usb 1>/dev/null 2>/dev/null; then
5 kx MOUSE_TYPE=usb
5 kx MTYPE="imps2"
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf input/mice mouse )
5 kx fi
5 kx fi
5 kx
5 kx if [ "$MOUSE_TYPE" = "" ]; then
5 kx dialog --title "MOUSE CONFIGURATION" --default-item "imps2" --menu \
5 kx "This part of the configuration \
5 kx process will create a /dev/mouse link pointing to your default mouse device. \
5 kx You can change the /dev/mouse link later if the mouse doesn't work, or if \
5 kx you switch to a different type of pointing device. We will also use the \
5 kx information about the mouse to set the correct protocol for gpm, the Linux \
5 kx mouse server. Please select a mouse type \
5 kx from the list below:" 20 76 8 \
5 kx "ps2" "PS/2 port mouse (most desktops and laptops)" \
5 kx "usb" "USB connected mouse" \
5 kx "imps2" "Microsoft PS/2 Intellimouse" \
5 kx "exps2" "Intellimouse Explorer PS/2" \
5 kx "bare" "2 button Microsoft compatible serial mouse" \
5 kx "ms" "3 button Microsoft compatible serial mouse" \
5 kx "mman" "Logitech serial MouseMan and similar devices" \
5 kx "msc" "MouseSystems serial (most 3 button serial mice)" \
5 kx "pnp" "Plug and Play (serial mice that do not work with ms)" \
5 kx "ms3" "Microsoft serial Intellimouse" \
5 kx "netmouse" "Genius Netmouse on PS/2 port" \
5 kx "logi" "Some serial Logitech devices" \
5 kx "logim" "Make serial Logitech behave like msc" \
5 kx "atibm" "ATI XL busmouse (mouse card)" \
5 kx "inportbm" "Microsoft busmouse (mouse card)" \
5 kx "logibm" "Logitech busmouse (mouse card)" \
5 kx "ncr" "A pointing pen (NCR3125) on some laptops" \
5 kx "twid" "Twiddler keyboard, by HandyKey Corp" \
5 kx "genitizer" "Genitizer tablet (relative mode)" \
5 kx "js" "Use a joystick as a mouse" \
5 kx "wacom" "Wacom serial graphics tablet" \
5 kx 2> $TMP/mtype
5 kx if [ ! $? = 0 ]; then
5 kx rm -f $TMP/mtype
5 kx exit
5 kx fi
5 kx if [ -f $TMP/mtype ]; then
5 kx MOUSE_TYPE="`cat $TMP/mtype`"
5 kx else
5 kx unset MOUSE_TYPE
5 kx fi
5 kx rm -f $TMP/mtype
5 kx if [ "$MOUSE_TYPE" = "bare" -o "$MOUSE_TYPE" = "ms" \
5 kx -o "$MOUSE_TYPE" = "mman" -o "$MOUSE_TYPE" = "msc" \
5 kx -o "$MOUSE_TYPE" = "genitizer" \
5 kx -o "$MOUSE_TYPE" = "pnp" -o "$MOUSE_TYPE" = "ms3" \
5 kx -o "$MOUSE_TYPE" = "logi" -o "$MOUSE_TYPE" = "logim" \
5 kx -o "$MOUSE_TYPE" = "wacom" -o "$MOUSE_TYPE" = "twid" ]; then
5 kx dialog --title "SELECT SERIAL PORT" --menu "Your mouse requires a \
5 kx serial port. Which one would you like to use?" 12 50 4 \
5 kx "/dev/ttyS0" "(COM1: under DOS)" \
5 kx "/dev/ttyS1" "(COM2: under DOS)" \
5 kx "/dev/ttyS2" "(COM3: under DOS)" \
5 kx "/dev/ttyS3" "(COM4: under DOS)" 2> $TMP/mport
5 kx if [ ! $? = 0 ]; then
5 kx rm -f $TMP/mport
5 kx exit
5 kx fi
5 kx MDEVICE="`cat $TMP/mport`"
5 kx SHORT_MDEVICE=`basename $MDEVICE`
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf $SHORT_MDEVICE mouse )
5 kx # For the serial mice, the protocol is the same as the mouse type:
5 kx MTYPE=$MOUSE_TYPE
5 kx rm -f $TMP/mport
5 kx elif [ "$MOUSE_TYPE" = "ps2" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf psaux mouse )
5 kx MTYPE="ps2"
5 kx elif [ "$MOUSE_TYPE" = "ncr" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf psaux mouse )
5 kx MTYPE="ncr"
5 kx elif [ "$MOUSE_TYPE" = "exps2" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf psaux mouse )
5 kx MTYPE="exps2"
5 kx elif [ "$MOUSE_TYPE" = "imps2" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf psaux mouse )
5 kx MTYPE="imps2"
5 kx elif [ "$MOUSE_TYPE" = "logibm" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf logibm mouse )
5 kx MTYPE="ps2"
5 kx elif [ "$MOUSE_TYPE" = "atibm" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf atibm mouse )
5 kx MTYPE="ps2"
5 kx elif [ "$MOUSE_TYPE" = "inportbm" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf inportbm mouse )
5 kx MTYPE="bm"
5 kx elif [ "$MOUSE_TYPE" = "js" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf js0 mouse )
5 kx MTYPE="js"
5 kx elif [ "$MOUSE_TYPE" = "usb" ]; then
5 kx ( cd $T_PX/dev ; rm -f mouse ; ln -sf input/mice mouse )
5 kx MTYPE="imps2"
5 kx fi
5 kx fi
5 kx
5 kx # OK, we know enough now to create a sample rc.gpm:
5 kx cat << EOF > $T_PX/etc/rc.d/rc.gpm-sample
5 kx #!/bin/sh
5 kx #
5 kx # Start/stop/restart the GPM mouse server:
5 kx #
5 kx
5 kx if [ "\$1" = "stop" ]; then
5 kx echo "Stopping gpm..."
5 kx $GPM -k
5 kx elif [ "\$1" = "restart" ]; then
5 kx echo "Restarting gpm..."
5 kx $GPM -k
5 kx sleep 1
5 kx $GPM -m /dev/mouse -t $MTYPE
5 kx else # assume \$1 = start:
5 kx echo "Starting gpm: $GPM -m /dev/mouse -t $MTYPE"
5 kx $GPM -m /dev/mouse -t $MTYPE
5 kx fi
5 kx
5 kx # There is another way to run GPM, where it acts as a repeater outputting a
5 kx # virtual MouseSystems mouse on /dev/gpmdata. This is useful for feeding
5 kx # gpm's data to X, especially if you've got a busmouse (in that situation X
5 kx # and gpm may not coexist without using a repeater). To try running a GPM
5 kx # repeater for X, change the gpm command line to look like this:
5 kx # $GPM -R msc -m /dev/mouse -t $MTYPE
5 kx # Then, make sure that the mouse configuration in your XF86Config file refers
5 kx # to the repeater device (/dev/gpmdata) and a MouseSystems mouse type. If you
5 kx # edit the file directly, you'll want the lines to look like this (minus the
5 kx # comment marks '#' shown here, of course):
5 kx #Section "Pointer"
5 kx # Protocol "MouseSystems"
5 kx # Device "/dev/gpmdata"
5 kx EOF
5 kx chmod 755 $T_PX/etc/rc.d/rc.gpm-sample
5 kx # Now ask if this should be the new rc.gpm:
5 kx dialog --title "GPM CONFIGURATION" --yesno \
5 kx "The gpm program allows you to cut and paste text on\n\
5 kx the virtual consoles using a mouse. If you choose to\n\
5 kx run it at boot time, this line will be added to your\n\
5 kx /etc/rc.d/rc.gpm:\n\
5 kx \n\
5 kx $GPM -m /dev/mouse -t $MTYPE \n\
5 kx \n\
5 kx Shall we load the gpm program at boot time?" 12 58
5 kx if [ $? = 0 ]; then
5 kx mv $T_PX/etc/rc.d/rc.gpm-sample $T_PX/etc/rc.d/rc.gpm
5 kx fi