USB mouse config, console & X, micro HOWTO
sd
groups at xscd.com
Thu Apr 8 14:37:45 PDT 2004
I thought I would post the end results of my own struggle to get my
USB trackball working as I prefer it to work, for the archives and
for the benefit of anyone else struggling with this issue,
although my particular configuration may be more, or less,
relevant to someone else's hardware and preferences.
Hardware
--------
USB trackball with left button, right button, and two small "scroll
buttons" (one for "up" and one for "down"). It is a Logitech
Marble Mouse USB (an optical trackball), and I really like the
feel of it.
What I wanted the mouse to do
-----------------------------
It has only two primary buttons (buttons 1 (left) and 3 (right) and
no middle button (button 2)), so I wanted to enable "middle-button
emulation" so that when I pressed the left and right buttons
simultaneously, it would be as though I had pressed a middle
button (to do a "paste" function, for example).
In addition, I wanted to use the mouse, somehow, to scroll the
contents of windows when I was in the X environment (I use KDE).
How I achieved my goals
-----------------------
Here are the relevant exerpts from my /etc/rc.conf and /usr/X11R6/
lib/X11/XF86Config files --
--- begin excerpt, /etc/rc.conf ---
moused_enable="YES"
moused_port="/dev/ums0"
moused_type="auto"
moused_flags="-p /dev/ums0 -3 -w4"
--- end excerpt, /etc/rc.conf ---
--- begin excerpt, /usr/X11R6/lib/X11/XF86Config ---
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
# Option "Emulate3Buttons"
# Option "Emulate3Timeout" "50"
# Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
EndSection
--- end excerpt, /usr/X11R6/lib/X11/XF86Config ---
Commentary
----------
In /etc/rc.conf I have the mouse port specified twice, using both
'moused_port="/dev/ums0"' and the '-p /dev/ums0' option of moused,
the mouse daemon. For some reason I don't understand, I had to
have both of those, in order for the mouse to work as I wanted it
to in the console as well as in X.
In a console, the left button of my trackball selects a starting
point (which can be extended by dragging), the right button when
clicked defines the end of a selection, and pressing both buttons
at once pastes the selection into the text entry area. The two
scroll buttons don't do anything in the console.
In X (in KDE, in my case), the left and right buttons each act as
they are configured to do, pressing both simultaneously pastes a
selection, and pressing the small left scroll button (which is
button 4 of 5, the 2nd button being the virtual middle button
accessed by pressing both buttons 1 and 3)--anyway, pressing the
small left scroll button and then moving the mouse (the trackball
in my case) up or down while the left-scroll button is kept
depressed, causes the contents of a window to scroll up or down.
This behavior is achieved by setting options to moused in /etc/
rc.conf. Notice that in the XF86Config file the options for
emulating 3 buttons are commented out--are not active. The
important options in XF86Config are the "Protocol" "auto",
"Device" "/dev/sysmouse", and "ZAxisMapping" "4 5"
The "ZAxisMapping" option was necessary in my XF86Config, even
though I specified in /etc/rc.conf that the moused was to report
Z-axis movement whenever it received Y-axis movement of the mouse
or trackball, by using the -w4 (wheel mode) option for moused in
/etc/rc.conf. The -w option with the "4" argument (specified either
as -w4 or -w 4) tells the mouse daemon to substitute Z-axis
movement for Y-axis movement whenever the 4th button is pressed
and held down while the mouse is moved. This has no effect in the
console (that I can see, other than appearing to "freeze" the
mouse cursor while the 4th button is depressed), but in X it
causes the contents of a window to scroll, IF the XF86Config file
is also edited to have the line:
Option "ZAxisMapping" "4 5"
as indicated above.
The -3 option for moused in /etc/rc.conf is what causes 3-button
emulation to occur, which means that the moused reports that (a
nonexistent) button 2 has been pressed whenever buttons 1 and 3
are pressed simultaneously. Because X gets this information from
moused, it does not need to do the 3-button emulation itself,
which is why those options are "commented out" in my XF86Config
file.
Best wishes,
Steve D, NM US
--
----------------------------------------------------------------
Any fool can make a rule, and any fool will mind it.
-Henry David Thoreau
----------------------------------------------------------------
More information about the freebsd-questions
mailing list