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