Topic: Mouse Wheel Emulation - need help - <Solved> (sort of)

Ok, I have Crunchbang installed on my old computer and since I don't have a middle mouse button, I used xinput to emulate a mouse wheel when I click and hold the middle mouse button.  It worked great and when I got a new computer, I did a minimal install of Ubuntu 9.10 and ran the Crunchbang Install script.

Just about everything works well, except for the mouse wheel emulation.  I'm using the exact same make and model of trackball, but I am unable to scroll horizontally (whereas I can on my old computer).  I've done some trouble shooting and I've discovered the problem, but I have no idea how to fix it.  On my old computer xinput sees my mouse as having 32 buttons.  It doesn't, but that allows me to set the mouse buttons as 1 2 and 3, then the up and down set to buttons 4 and 5 (in other words the scroll wheel up is button 4 and scroll wheel down is button 5).  Then I was able to set buttons 6 and 7 to scroll left and right.  All of that was accomplished when I'd hold the middle mouse button and enable mouse wheel emulation (kind of like autoscroll in firefox, but it works in every application).

Anyway, the problem I'm having is that for some reason my new computer running Ubuntu 9.10 with crunchbang install script sees my mouse as only having 5 buttons.  Because of that, I'm unable to assign horizontal scrolling to buttons 6 and 7 because xinput doesn't see those buttons.

How do I change the number of buttons so that xinput sees at least a 7 button mouse instead of only 5?

Last edited by ledomira (2010-03-17 10:52:37)

Re: Mouse Wheel Emulation - need help - <Solved> (sort of)

OK, I've been searching on some sites and one suggested adding option  "Buttons"  "10" to the xorg.conf file.  That didn't work (even after reboot).  Someone else suggested replacing the Driver "mouse" in xorg.conf with Driver "evdev".  I did that, but that didn't work either.  I keep looking.

Oh, if you're running regular old crunchbang, the way you use the middle mouse button for wheel emulation is to type this into a terminal:

# This refers to the axes, 8 is the bits, 6 and 7 are left and right, 4 and 5 are up and down.  Changing their order (as in putting 4 5 6 7) will cause the up and down to scroll left and right and left and right to scroll up and down:

xinput set-int-prop "PS/2 Logitech Trackman" "Evdev Wheel Emulation Axes" 8 6 7 4 5

#This tells xinput which mouse button to use for wheel emulation (again the 8 is for 8 bit and won't work without it.)  The 2 is the 2nd (or middle) mouse button.

xinput set-int-prop "PS/2 Logitech TrackMan" "Evdev Wheel Emulation Button" 8 2

#This enables Wheel Emulation (the 1 enables it.  changing it to a 0 would disable it.)
xinput set-int-prop "PS/2 Logitech TrackMan" "Evdev Wheel Emulation" 8 1

# the 16 is 16 bit, and the 5 is the Inertia.  Think of it like friction.  The higher the number, the more resistance to movement.  Don't set it to zero though, because we can't divide by zero.

xinput set-int-prop "PS/2 Logitech TrackMan" "Evdev Wheel Emulation Inertia" 16 5

I'll keep looking for a solution to my problem, but putting those commands in your console or autostart.sh should let you use wheel emulation if you're running the 32 bit Jaunty version of Crunchbang.

Re: Mouse Wheel Emulation - need help - <Solved> (sort of)

Ok, I tried everything I could think of and xinput just wouldn't recognize more than five buttons on that trackball.  So, I convinced it it wasn't what it thought it was by using a ps2 to usb converter.  Then xinput configured it as a generic usb input device.  However, the adapter is a keyboard & mouse usb adapter, so the name for both the keyboard and mouse were the same (some kind of blah blah adapter yadda yadda).  So, I couldn't configure it by name.  However, since it will often be reordered on boot and not always be the same number, I couldn't start it by number either.

Well, I thought if I can't configure just one input device with xinput, then I'll configure all of them exactly the same.  If it's a keyboard, or something else, it will completely ignore the xinput mouse settings anyway.

Lo and behold, it worked.  I had to put this into my autostart.sh and reboot:


xinput set-int-prop 0 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 0 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 0 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 0 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 1 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 1 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 1 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 1 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 2 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 2 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 2 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 2 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 3 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 3 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 3 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 3 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 4 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 4 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 4 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 4 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 5 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 5 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 5 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 5 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 6 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 6 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 6 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 6 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 7 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 7 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 7 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 7 "Evdev Wheel Emulation Inertia" 16 5 &

xinput set-int-prop 8 "Evdev Wheel Emulation Axes" 8 6 7 4 5 &
xinput set-int-prop 8 "Evdev Wheel Emulation Button" 8 2 &
xinput set-int-prop 8 "Evdev Wheel Emulation" 8 1 &
xinput set-int-prop 8 "Evdev Wheel Emulation Inertia" 16 5 &


I don't know why I had to configure 8 devices, but that's how many xinput says I have.  I think xinput is messed up.

Anyway, this doesn't actually solve the problem of xinput not recognizing more buttons on my trackball, but it's a way around it.  Hopefully it's helpful to someone besides me.  If not, at least I can scroll vertically and horizontally now.

Re: Mouse Wheel Emulation - need help - <Solved> (sort of)

Thanks for the tip!

I had a different problem to yours - an uncommon trackball (CH Products DT225) with 4 buttons, in which I wanted a scroll function. My original plan was to make the top- left button a "Windows middle click," which would enable the "auto scroll" function. I had tried to configure xorg.conf but that just couldn't work. By using your xinput entries as a sample, I managed to get the trackball to scroll by pressing down the top-right button (by choice). All the other buttons work as intended when clicked.

"Auto scroll" remains a problem. It happens by default with the same trackball in XP. I eventually found out why... in the X Windows system, "middle click" (which was what I was trying to emulate) gives the "Paste" function by default, and not the "Auto scroll" found in Gates' Windows.

Using xinput, I could try several settings on the fly in the terminal.

But I decided to enter my final settings in /usr/share/X11/xorg.conf.d/10-evdev.conf instead of putting them in autostart.sh.

The other thing I did differently from you was to use "xinput list" to find out the ID of my trackball (CH PRODUCTS CH USB TRACKBALL) :

andy@t61-crunchbang:~$ xinput list
⎡ Virtual core pointer                            id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ CH PRODUCTS CH USB TRACKBALL                id=9    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                  id=11   [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                       id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                           id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Video Bus                                   id=7    [slave  keyboard (3)]
    ↳ Sleep Button                                id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard                id=10   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                      id=12   [slave  keyboard (3)]

I then entered "CH PRODUCTS CH USB TRACKBALL" in the xinput command (instead of the numbers 0 - 8).

Thanks again. Your post really helped me to start enjoying using this trackball.

Last edited by bootstrap (2011-10-29 09:04:14)