Mouse wizard 3-button emulation problems

Please post any bugs you have found
Post Reply
Message
Author
User avatar
rerwin
Posts: 2017
Joined: Wed 24 Aug 2005, 22:50
Location: Maine, USA

Mouse wizard 3-button emulation problems

#1 Post by rerwin »

(Running v2.01 "poor man" installation.)
1. The mouse wizard does not retain the "emulation" selection across reboots. This appears to be because the following test always fails:

Code: Select all

  if [ ! "`cat /etc/xextraoptions | grep "\\-2button"`" = "" ];then
If I change the double backslash to a single backslash, in input-wizard, the selection shows accurately.

2. When using xvesa (instead of xorg), selecting "emulation" and rebooting, the emulation works (tested with copy-and-paste) but the right mouse button no longer works. I can restore the right button by changing the following statement:

Code: Select all

    echo -n "2" > /etc/mousebuttons
to set a "3" instead of "2". Since Xkdrive handles the emulation, it appears that xvesa then needs to see 3 buttons. However, if only 2 buttons are indicated, xvesa might be working with the wrong second button, ignoring the right button (#2). But if we never set a "2", that point is moot. Changing the mousebuttons value does not appear to impact xorg.

3. An esthetic coding suggesion: Consider setting xextraoptions to either "-shadow -2button" or "-shadow -3button" instead of relying on a default, to match the actual mouse type -- "-3button" merely means "no emulation" to Xkdrive. My changes to implement this are:

Code: Select all

#   MBUTOUT="`cat /etc/xextraoptions | sed -e 's/ \-2button//g'`"
[b]   MBUTOUT="`cat /etc/xextraoptions | sed -e 's/ \-[23]button//g'`"[/b]
     . . .
#    echo -n "$MBUTOUT" > /etc/xextraoptions
[b]    echo -n "$MBUTOUT -3button" > /etc/xextraoptions[/b]
4. Human factors suggestion: In the "Mouse features" section of the dialog box, considering that the underlying presumption is that the mouse has at least 3 buttons, the "emulation" option text could be rephrased to reflect that assumption. Perhaps "Mouse has only 2 buttons (so emulate middle button)" or "Mouse has only 2 buttons (press both as middle button)".

Hope this helps.
Richard
Last edited by rerwin on Tue 10 Oct 2006, 02:42, edited 1 time in total.
Enthusiastic Puppy fan
- Toshiba Equium 7100S, 400MHz, 256MB, 4GB, Puppy+Vector-std
- IBM Aptiva, 400MHz, 160MB, 4GB, Puppy (test lab)
- Toshiba Satellite 2535CDS, 300MHz, 64MB, 4GB, Puppy
- 1.8 GHz, 512MB, 40GB+100GB+320GB, WinXP+Puppy (DVD)

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

Thanks for the info, I'll check it out.

User avatar
rerwin
Posts: 2017
Joined: Wed 24 Aug 2005, 22:50
Location: Maine, USA

"Mouse features"option improvement

#3 Post by rerwin »

Upon reflection/obsession regarding the user experience with the "mouse features" selection decision, I conclude that the selection would be more intuitive if there were three radio buttons. The added button would be "Mouse has 3 buttons (and no scroll wheel)".

This way, only one can be selected, which is appropriate since the options are mutually exclusive. It avoids the appearance of selecting both a wheel mouse and a 2-button mouse, which is not physically possible.

Considering that this change is easier said than done, I would like to implement it and send you my changed block of code, or even a replacement script. I need the experience with writing scripts.

Richard
Enthusiastic Puppy fan
- Toshiba Equium 7100S, 400MHz, 256MB, 4GB, Puppy+Vector-std
- IBM Aptiva, 400MHz, 160MB, 4GB, Puppy (test lab)
- Toshiba Satellite 2535CDS, 300MHz, 64MB, 4GB, Puppy
- 1.8 GHz, 512MB, 40GB+100GB+320GB, WinXP+Puppy (DVD)

User avatar
rerwin
Posts: 2017
Joined: Wed 24 Aug 2005, 22:50
Location: Maine, USA

Candidate for updated input (mouse) wizard

#4 Post by rerwin »

I have indeed made an updated version of the input-wizard, implementing all of the ideas mentioned above. Despite Barry's blog entry about the mousebuttons file, I have retained my change to set it to 3 for an emuilated mouse. In searching the xwin file for "/dev/mouse,2", as the blog implies is there, I found only instances where the mousebuttons value is used; so I had to retain my change to make the function work.

I would like to attach my new version, as the code changes are not all together within the script. However, my request is refused with the message: "The Extension array is not allowed". So here is the portion of the script that I modifed:

Code: Select all

  MOUSEBUTTONS="`cat /etc/mousebuttons`"
  
#v2.0? - begin main part of conversion of features checkboxes into set of radio buttons.
  #RADIOBUTTONS2="$RADIO2$RADIO1$RADIO3" #3 buttons 
  DEF1="false"
  DEF2="true"  # initially assume linux-standard 3-button mouse
  DEF3="false"
  if [ "$MOUSEBUTTONS" = "5" ];then
   #RADIOBUTTONS2="$RADIO3$RADIO2$RADIO1"  #scroll wheel
   DEF1="true" 
   DEF2="false"
   DEF3="false"
  fi
  if [ ! "`cat /etc/xextraoptions | grep "\-2button"`" = "" ];then
   #RADIOBUTTONS2="$RADIO1$RADIO2$RADIO3"  #2 buttons
   DEF1="false"
   DEF2="false"
   DEF3="true"
  fi

  RADIO1="     <radiobutton>
      <label>Mouse has a scroll wheel</label>
      <variable>RADIO004</variable>
      <default>$DEF1</default>
     </radiobutton>
"
  RADIO2="     <radiobutton>
      <label>Mouse has 3 buttons and no wheel</label>
      <variable>RADIO005</variable>
      <default>$DEF2</default>
     </radiobutton>
"
  RADIO3="     <radiobutton>
      <label>Mouse has only 2 buttions (press both for middle button)</label>
      <variable>RADIO006</variable>
      <default>$DEF3</default>
     </radiobutton>
"
  RADIOBUTTONS2="$RADIO1$RADIO2$RADIO3"

  #v2.01
  CHECKH="false"
  IDLETIME="0"
  if [ -f /etc/mousehide ];then
   IDLETIME="`cat /etc/mousehide | cut -f 1 -d ','`"
   [ ! "$IDLETIME" = "0" ] && CHECKH="true"
  fi

  #v1.0.7 modified for gtkdialog2...
  export MouseWizard="
 <wtitle>Mouse Wizard</wtitle>
 <vbox>
  <frame Mouse interface>
   <hbox>
    <vbox>
     $RADIOBUTTONS
    </vbox>
    <vbox>
       <text><label>Serial port:</label></text>
       <combobox>
         <item>ttyS0</item>
         <item>ttyS1</item>
         <item>ttyS2</item>
         <item>ttyS3</item>
         <variable>COMPORT</variable>
         <visible>disabled</visible>
       </combobox>
    </vbox>
   </hbox>
  </frame>
  <frame Mouse features>
   <vbox>
    $RADIOBUTTONS2
   </vbox>
  </frame>
  <frame Cursor option>
   <vbox>    
    <checkbox>
     <label>Auto-hide mouse cursor when not moving</label>
     <variable>CHECKBOX011</variable>
     <default>$CHECKH</default>
    </checkbox>
   </vbox>
  </frame>
  <hbox>
   <button cancel></button>
   <button ok></button>
  </hbox>
 </vbox>
"
#v2.0? - end main part of mouse features conversion to radio buttons

  RETPARAMS=`gtkdialog2 --program=MouseWizard`
  echo "$RETPARAMS"
  if [ ! "`echo "$RETPARAMS" | grep "EXIT" | grep "OK"`" = "" ];then
   if [ -e /lib/modules/2.6 ];then #v1.0.2 k2.6...
    modprobe -r psmouse 2> /dev/null #v1.0.2 k2.6
    modprobe -r sermouse 2> /dev/null #v1.0.2 k2.6
   else
    #modprobe -r usbmouse 2> /dev/null #v1.0.2
    modprobe -r mousedev #v2.0.0
   fi
   if [ ! "`echo "$RETPARAMS" | grep "RADIO001" | grep "true"`" = "" ];then
    MOUSEDEV="psaux" #ps/2 mouse.
    ln -sf /dev/psaux /dev/mouse
    #k2.4 has ps/2 mouse support inbuilt.
    if [ -e /lib/modules/2.6 ];then #v1.0.2 k2.6...
     modprobe psmouse 2> /dev/null #v1.0.2 k2.6
    fi
   fi
   if [ ! "`echo "$RETPARAMS" | grep "RADIO002" | grep "true"`" = "" ];then
    eval `echo "$RETPARAMS" | grep "COMPORT"`
    MOUSEDEV="$COMPORT" #ttyS0,1,2,3
    ln -sf /dev/$COMPORT /dev/mouse
    #2.4 kernel has serial mouse support inbuilt.
    if [ -e /lib/modules/2.6 ];then #v1.0.2 k2.6...
     modprobe 8250_pci 
     modprobe sermouse 
    fi
   fi
   if [ ! "`echo "$RETPARAMS" | grep "RADIO003" | grep "true"`" = "" ];then
    MOUSEDEV="input/mice" #usb mouse
    if [ -e /lib/modules/2.6 ];then #v1.0.2 k2.6...
     modprobe usbhid 2> /dev/null
    else
     #modprobe usbmouse
     modprobe hid #v2.0.0
     modprobe mousedev #v2.0.0
    fi
    ln -sf /dev/input/mice /dev/mouse
   fi
   echo -n "$MOUSEDEV" > /etc/mousedevice

   if [ ! "`echo "$RETPARAMS" | grep "CHECKBOX011" | grep "true"`" = "" ];then #v2.01
    [ "$IDLETIME" = "0" ] && IDLETIME="3"
    echo -n "${IDLETIME},"   > /etc/mousehide  #v2.0?
    [ "`pidof unclutter`" = "" ] && unclutter -idle $IDLETIME &
   else
    echo -n '0,' > /etc/mousehide
    [ ! "`pidof unclutter`" = "" ] && killall unclutter
   fi

   #v1.0.7 emulate middle button
   MBUTOUT="`cat /etc/xextraoptions | sed -e 's/ \-[23]button//g'`"  #v2.0?
   if [ ! "`echo "$RETPARAMS" | grep "RADIO006" | grep "true"`" = "" ];then  #v2.02
    echo -n "$MBUTOUT -2button" > /etc/xextraoptions
    echo -n "3" > /etc/mousebuttons  #v2.0?
    if [ -f /etc/X11/xorg.conf ];then
     #\W\+ means one or more whitespace chars...
     cat /etc/X11/xorg.conf | tr -s '#' | sed -e 's/#Option\W\+"Emulate3Buttons"/Option      "Emulate3Buttons"/g' > /tmp/xorg.conf.tmp2
     sync
     cat /tmp/xorg.conf.tmp2 | tr -s '#' | sed -e 's/#Option\W\+"Emulate3Timeout"/Option      "Emulate3Timeout"/g' > /tmp/xorg.conf.tmp
    fi
   else
    echo -n "$MBUTOUT -3button" > /etc/xextraoptions  #v2.0?
    echo -n "3" > /etc/mousebuttons
    if [ -f /etc/X11/xorg.conf ];then
     cat /etc/X11/xorg.conf | sed -e 's/Option\W\+"Emulate3Buttons"/#Option      "Emulate3Buttons"/g' | tr -s '#' > /tmp/xorg.conf.tmp2
     sync
     cat /tmp/xorg.conf.tmp2 | sed -e 's/Option\W\+"Emulate3Timeout"/#Option      "Emulate3Timeout"/g' | tr -s '#' > /tmp/xorg.conf.tmp
    fi
   fi
   sync
   if [ -f /tmp/xorg.conf.tmp ];then
    cp -f /tmp/xorg.conf.tmp /etc/X11/xorg.conf
   fi

   if [ ! "`echo "$RETPARAMS" | grep "RADIO004" | grep "true"`" = "" ];then  #v2.0?
    echo -n "5" > /etc/mousebuttons #enable scrollwheel.
    if [ -f /etc/X11/xorg.conf ];then
     cat /etc/X11/xorg.conf | tr -s '#' | sed -e 's/#Option\W\+"ZAxisMapping"\W\+"4 5"/Option      "ZAxisMapping" "4 5"/g' > /tmp/xorg.conf.tmp
    fi
   else
   # echo -n "3" > /etc/mousebuttons ...v1.0.7 moved up.
    if [ -f /etc/X11/xorg.conf ];then
     cat /etc/X11/xorg.conf | sed -e 's/Option\W\+"ZAxisMapping"\W\+"4 5"/#Option      "ZAxisMapping" "4 5"/g' | tr -s '#' > /tmp/xorg.conf.tmp
    fi
   fi
   if [ -f /etc/X11/xorg.conf ];then
    cp -f /tmp/xorg.conf.tmp /etc/X11/xorg.conf
   fi
   sync

   #v1.0.7 fix mouse protocol for Xorg...
Just replace all lines between "MOUSEBUTTONS="`cat /etc/mousebuttons`" " and "#v1.0.7 fix mouse protocol for Xorg...". Great exercise!
(Edit) I also corrected a typo in "echo -n "${IDLETIME}," && > /etc/mousehide", to restore the functionality of the cursor-hide option.
If you cannot copy the script segment with its indentation levels, please allow me to attach the script -- or tell me some other way to upload it.(/edit)
Richard
Last edited by rerwin on Tue 10 Oct 2006, 02:51, edited 2 times in total.
Enthusiastic Puppy fan
- Toshiba Equium 7100S, 400MHz, 256MB, 4GB, Puppy+Vector-std
- IBM Aptiva, 400MHz, 160MB, 4GB, Puppy (test lab)
- Toshiba Satellite 2535CDS, 300MHz, 64MB, 4GB, Puppy
- 1.8 GHz, 512MB, 40GB+100GB+320GB, WinXP+Puppy (DVD)

User avatar
rerwin
Posts: 2017
Joined: Wed 24 Aug 2005, 22:50
Location: Maine, USA

Do we even need the mouse-type options?

#5 Post by rerwin »

Barry,
After making my above changes, it occurred to me that since the default of setting both the wheel and emulation active does not seem to cause any problems, maybe the user interface should be simplified by just removng those options from the wizard. Is there any reason to restrict the user to any particlar mouse type?

Richard

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#6 Post by BarryK »

rerwin,
as I recall, there were one or two reports of mouse malfunction if scrollwheel was turned on and the mouse didn't have it. There were some threads about this awhile back.

Post Reply