LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-19-2012, 11:45 PM   #1
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Map Back Button on Mouse


I have been running Slack current on my machine for a while now after installing 13.37 from a complete wipe (finally decided to switch my main desktop over to Linux since it was basically acting as a fileserver and I never play games on it anymore). Everything has been working great and I love the built-in support for Radeon cards (which was a huge step up from 13.0 when it took me a few weeks to get hardware acceleration working).

Anyway, things have been working great except for one extremely annoying problem. My back button on the mouse doesn't work. I did a lot of research online, and while I know I can map it using xmodmap or something similar, I thought there had to be an easier way by now. I have been using Slack since 10.2, so I am used to modifying xorg.conf files and all sorts of other things, but things have progressed so far in plug and play support that I feel there HAS to be an easier way to do this that I am just somehow overlooking.

I am running a Microsoft Comfort Optical Mouse 3000. My left, right, and center clicks all work along with my scrolling. The mouse also supports clicking the mousewheel to the right and left, but I always found them awkward and I never used either. So with all those buttons, it makes my back (thumb/side) button number 9 (according to xev).

What is the suggested/proper way to configure the mouse for these more modern distributions?
 
Old 04-20-2012, 11:12 AM   #2
polyph
LQ Newbie
 
Registered: Apr 2012
Posts: 10

Rep: Reputation: 3
Hi,
I have Microsoft Comfort Optical Mouse 4500 and I'm using it with 3.2.13 kernel from current. I configured 2,6,7,8 and 9 buttons with xte (from xautomation) and xbindkey.
I think with kernel 2.6.37.6 you will need to apply some patch to hid-microsoft.c module to make 8-9 buttons works but I don't know where you could find it.
I hope it help...
 
Old 04-20-2012, 11:28 AM   #3
hpfeil
Member
 
Registered: Nov 2010
Location: Tucson, Arizona US
Distribution: Slackware Current
Posts: 357
Blog Entries: 1

Rep: Reputation: Disabled
You no longer need xorg.conf. If something goes wacky, you can add a custom segment in xorg.conf.d.
For example, in my box with the nvidia.com driver I've added one file for the video driver and another for my monitor (xorg doesn't like its EDID).

#20-nv.conf
Section "Device"
Identifier "Device0"
Driver "nvidia"
EndSection

#30-monitor.conf
Section "Monitor"
Identifier "Monitor0"
VendorName "HP"
ModelName "w2338h"
DisplaySize 508 286
HorizSync 24-83
VertRefresh 48-76
EndSection

The default evdev driver finds my mouse and keyboard.
/usr/share/X11/xorg.conf.d/10-evdev.conf

Like you, I have to use xinput to make the side buttons work the way I like (Intellimouse Explorer 2). This file in my ~/bin directory (xinput is easier than xmodmap):

#! /bin/bash
## Called from ~/.config/autostart/mouse_buttons.desktop
export Mouse_Id="$(xinput list --short | grep Optical | awk '{ print $9 }' | awk -F"=" '{ print $2 }')"
/usr/bin/xinput set-button-map $Mouse_Id 1 2 3 4 5 6 7 2 1 10 11 12 13
 
1 members found this post helpful.
Old 04-20-2012, 04:15 PM   #4
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Original Poster
Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by polyph View Post
Hi,
I have Microsoft Comfort Optical Mouse 4500 and I'm using it with 3.2.13 kernel from current. I configured 2,6,7,8 and 9 buttons with xte (from xautomation) and xbindkey.
I think with kernel 2.6.37.6 you will need to apply some patch to hid-microsoft.c module to make 8-9 buttons works but I don't know where you could find it.
I hope it help...
I guess I wasn't as clear as I thought I was with my post. I am running Slackware64-current up-to-date as of the 19th, so I am running KDE 4.8 with the latest Slack kernel (not at home, and I am too lazy to find out what the standard kernel version is with Slack current).

And @hpfeil, I already looked through my xorg log and it did autoload the evdev module, so I know I don't need to worry about an xorg.conf.d. But I will check out the xinput option and possibly borrow your little file. Still, it seems that there would be an easier way to configure it. I was actually really surprised to not see any option in the KDE input devices section to go more in depth with your mouse configuration.
 
Old 04-20-2012, 11:22 PM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Original Poster
Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
So, once I got home from work I dug into things again and checked with xinput. My mouse was being recognized, and all my buttons registered as being pressed. What I ended up finding out is that my back button was mapped as button 9, and apparently, by default, button 8 is what acts as the back button. So I changed my xinput for the mouse to

Code:
xinput set-button-map 8 1 2 3 4 5 6 7 9 8
(I swapped the last 8 and 9)

For those who aren't familiar with xinput, the first number (in mine, 8) is the device id, which can be found by running xinput list. The rest is the buttons and how they are registered. If you use xinput test you can find out what buttons on the mouse equal what buttons that xinput reads. If something doesn't match up, you just change it.

As to the proper way to do this, I believe it would be done by using hal. So I created a file called msoptical-x11-input.fdi in /etc/hal/fdi/policy that read

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<match key="info.product" string="Microsoft Microsoft Optical Mouse with Tilt Wheel">
<merge key="input.x11_driver" type="string">evdev</merge>
<merge key="input.x11_options.ButtonMapping" type="string">1 2 3 4 5 6 7 9 8</merge>
<merge key="input.x11_options.EmulateWheel" type="string">true</merge>
<merge key="input.x11_options.EmulateWheelButton" type="string">8</merge>
<merge key="input.x11_options.Emulate3Buttons" type="string">false</merge>
</match>
</device>
</deviceinfo>
I am not going to mark this topic solved for a little while to see if anyone pops in with the "recommended" way to handle this. If no one chimes in within a few days, I will mark as solved.
 
Old 09-30-2012, 04:34 PM   #6
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 73
bassmadrigal, did you follow -current up to Slackware 14.0? There is no hal in Slackware anymore, so you will probably have to put your mouse configuration under a .conf file under /etc/X11/xorg.conf.d/

Something similar to this might be what you want:
Code:
Section "InputDevice"
    Identifier     "Mouse1"
    Driver         "mouse"
    Option         "Protocol" "Auto"
    Option         "Device" "/dev/mouse"
    Option         "Name" "Microsoft Microsoft Optical Mouse with Tilt Wheel"
    Option         "ButtonMapping" "1 2 3 4 5 6 7 9 8"
EndSection
Logical 8 is for the browser back button and Logical 9 is for the browser forward button. It would seem there is no physical button 8 since the red side button is 9.

I'm actually having a little trouble having buttons 6 and 7 (scroll left/right) detected in Slackware 14.0. xev does not show the buttons when I tilt the wheel side to side like it does with Slackware 13.37. Is this the same for you or anyone else?

I'm not sure what is the cause of this right now (new kernel driver, no hal, other configuration difference, etc)...
 
Old 10-02-2012, 10:08 AM   #7
hpfeil
Member
 
Registered: Nov 2010
Location: Tucson, Arizona US
Distribution: Slackware Current
Posts: 357
Blog Entries: 1

Rep: Reputation: Disabled
You really don't need anything in /etc/X11/xorg.conf.d/, at least I don't. Meeses and keyboards are now running under evdev.
Just about all the documentation you'll need is in
http://docs.slackware.com/start

There's lots of new stuff to get smart on with 14:

http://mirrors.slackware.com/slackwa..._AND_HINTS.TXT

http://mirrors.slackware.com/slackwa....0/UPGRADE.TXT
and, of course,
http://mirrors.slackware.com/slackwa.../ANNOUNCE.14_0
as well as the readme files in the top level.

This still works for me
=-=-=--=-snip=-=-==-
#!/bin/bash
## Called from ~/.config/autostart/mouse_buttons.desktop

export Mouse_Id="$(xinput list --short | grep Optical | awk '{ print $9 }' | awk -F"=" '{ print $2 }')"

/usr/bin/xinput set-button-map $Mouse_Id 1 2 3 4 5 6 7 2 1 10 11 12 13
=-=-=-=-snip=-=-=-=-=-

The canonical way, of course, is to add a udev rule under /etc/udev/rules.d that overrides the mouse-button rule in /lib/udev/rules.d/. Suffering from frequent bouts of congenital indolence (born lazy), as I oftentimes do, if it works, put the job to figure out the elegant solution back into the IN box, where it may languish for quite some time. ;->
 
Old 10-04-2012, 09:30 AM   #8
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Code:
export Mouse_Id="$(xinput list --short | grep Optical | awk '{ print $9 }' | awk -F"=" '{ print $2 }')"
If I could make a recommendation, a simple sed expression would be more efficient here:

Code:
export Mouse_Id="$( xinput list --short | sed -rn '/Optical/ s/.*id=([0-9]+).*/\1/p' )
And just for fun, it's also possible to do it entirely in bash (outside of xinput, of course).

Code:
Mouse_Id=$( xinput list -- short )
re='Optical[^=]+=([0-9]+)'
[[ $Mouse_Id =~ $re ]] && export Mouse_Id=${BASH_REMATCH[1]}
And please use ***[code][/code] tags*** around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
App to map middle mouse button? LAPIII Linux - Software 7 02-23-2011 11:22 AM
howto map mouse button to keyboard key lopette Linux - Software 2 09-16-2004 03:18 PM
Map Mouse Button to Key Parksy Linux - Hardware 0 01-07-2004 08:00 PM
Map Windows key to middle mouse button? elconde Linux - Hardware 1 12-28-2002 01:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration