X and Fluxbox :: Laptop mouse and external mouse



Hello,

I have looked on the forums and some on the wiki, but I was unable to find an answer to this question.  I am familiar with Xfree86, but not Xvesa.

I am running DSL on an old pentium laptop, and have DSL installed to the hard drive.  It is ruuning quite nicely w/Xvesa, but I would like to be able to switch between the built in mouse (/dev/psaux) and an external USB mouse (/dev/input/mouse).

I can think of several approaches, but don't know how to implement them:
1) add case statements to xinitrc or xservrrc that identify if the USB mouse is plugged in and alter the Xvesa line

2)Add a script that asks the user what mouse to use before the X session.  I want to avoid having to go thru the entire xsetup.sh script each time.  I tried putting this in xservrrc, but the X session began without waiting for the input response.

3)Putt both mice in Xvesa line (syntax?), or cat one device into the other so both run at once.  Not sure if this would work.

What the heck is starting X anyway? I don't see the rcX.d method working here, nor is there a .login that I can see.

Please let me know if any of you have thoughts or suggestions.

Thanks in advance,
Douglas

Here's how I worked around this problem.  I couldn't figure a way to autodetect, so I wrote a small script that asks the user if they have an external USB mouse.  First I used the xsetup.sh script to configure for the onboard trackball (/dev/psaux) and copied the .xserverrc to .xserverrc-ps2-mouse.  Then I used  xsetup.sh to configure for the USB mouse and copied that to .xserverrc-usb-mouse.

Then I copied .bash_profile to .bash_profile_backup and edited .bash_profile as follows:
From :
--------------------------------------------------
#!/bin/bash
export IRCNICK=DSL
SSH=`env | grep SSH_CONNECTION`
if [ -z "$SSH" ]; then startx; fi
---------------------------------------------------
To:
----------------------------------------------------
#!/bin/bash
export IRCNICK=DSL
SSH=`env | grep SSH_CONNECTION`
if [ -z "$SSH" ]; then ~/.which_mouse.sh; fi
---------------------------------------------------

Then I created the following file .which_mouse.sh file:
--------------------------------------------------------
#!/bin/bash
echo -e  "\n"
echo -e  "Are you using a USB mouse [y/n]? \c"
read
echo -e  "\n"

case $REPLY  in
y)  
 cp ~/.xserverrc-usb-mouse ~/.xserverrc
 ;;
n)  
 cp ~/.xserverrc-ps2-mouse ~/.xserverrc
 ;;
*)  
 cp ~/.xserverrc-ps2-mouse ~/.xserverrc
 ;;
esac


exec startx
--------------------------------------------------------------

That's it.  Now when you sign in you get asked which kind of mouse you want.  Not automagic, but not as many buttoon pushes as running xsetup.sh everytime.  Modular coponents as well, so orginal intent of system designer is altered as little as possible.

Please feel free to comment if you see an error, hole, or area for improvement.
Douglas


original here.