LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-04-2006, 04:45 AM   #1
Old_Fogie
Senior Member
 
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,515

Rep: Reputation: 62
how to swap mouse buttons in "xbindkeys" since slackware's xmodmap aint working 4 me?


hi all,

something is either wrong in my head or wrong with xmodmap in 11.0 I tend to believe it's me of course.

however, even in suse and ubuntu xmodmap didn't work to map the special extra buttons.

I suspect this could tho, be a frequent asked question, how to get special buttons, or like I said, i'm doing something wrong on my xmodmap line that i really just copied over, so why it don't work I dunno

so since I had already gone thru this excercise on those distro's, i have successfully created a udev rule for my usb logitech mx310 mouse.

i've got xbindkeys and xvkbd and lomoco (for high resolution) all working just right, however, i don't know how to make the mouse swap the two usual buttons, that is for a lefty to use the mouse.

anyone know what the code is for that in my .xbindkeysrc file?

anyone have the documentation laying around, there is none in the source that I built from and their web-site has a dead link.

thank you in advance.
 
Old 10-04-2006, 05:10 AM   #2
Old_Fogie
Senior Member
 
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,515

Original Poster
Rep: Reputation: 62
holy cow ! you have to put in 32 numbers now !

here's for lefty =)

Quote:
xmodmap -e "pointer = 3 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32"
 
Old 10-04-2006, 07:09 AM   #3
simcox1
Member
 
Registered: Mar 2005
Location: UK
Distribution: Slackware
Posts: 794
Blog Entries: 2

Rep: Reputation: 30
I had some problems with xmodmap as well. I used to do

pointer = 1 2 3 6 7 4 5

For a 7 button mouse, but now it seems to work with

pointer = 1 2 3 4 5 8 9 6 7 10 11

I guessed it right.
 
Old 10-04-2006, 03:59 PM   #4
Old_Fogie
Senior Member
 
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,515

Original Poster
Rep: Reputation: 62
hi sim,

so i get this straight , your not using any udev rules for your mouse, just the stock one that the xorg gives in slack 11 right.

i'm working now, but dont think i want to go thru installing these other apps on pc's that dont have multi button mice.

i suspect because I went udev on my mouse, i need 32 numbers, else 11?
 
Old 10-04-2006, 04:18 PM   #5
simcox1
Member
 
Registered: Mar 2005
Location: UK
Distribution: Slackware
Posts: 794
Blog Entries: 2

Rep: Reputation: 30
I'm not using udev, just the 2.4 kernel in 11.0. But I found the .Xmodmap wasn't being read as it used to be. They must have changed the rules for it. It complained that I had 11 buttons, so I tried changing the xmodmap file and it works now. I'm not sure if I still need "ZAxisMapping" in xorg.conf or not. Apparently xorg takes care of that automatically now. My mouse actually has 10 buttons, because it can do horizontal scrolling as well, but I've never got that working.
 
Old 10-04-2006, 04:51 PM   #6
Old_Fogie
Senior Member
 
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,515

Original Poster
Rep: Reputation: 62
ok ty simcox that's good to know/hear.

yeah I believe ? you would need udev for all the extra buttons.

i used this guide here, it's really correct for us on slackware except a few minor things.

so in a few days, pending no issues I'm gonna re-write it for slack.

http://www.ubuntuforums.org/showthre...logitech+mx500
 
Old 10-04-2006, 05:07 PM   #7
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,334

Rep: Reputation: Disabled
Quote:
Originally Posted by Old_Fogie
so in a few days, pending no issues I'm gonna re-write it for slack.

http://www.ubuntuforums.org/showthre...logitech+mx500
Yay! Good idea Old_Fogie!

Eric
 
Old 10-07-2006, 02:29 AM   #8
Old_Fogie
Senior Member
 
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,515

Original Poster
Rep: Reputation: 62
Well here is a rough draft, happy hacking.

---------------------------------------------------

HOWTO: Configuring Logitech mx310 mouse in Slackware

Version: 1.0

Issue Intent: Draft Copy, For Peer Review, Discussion & Correction Purposes Only.

Date: 10/07/2006

Foreword:
This how to is based upon the following well written Ubuntu how-to guide located at: http://www.ubuntuforums.org/showthre...logitech+mx500
Please understand that his how-to was so accurate it worked like a charm in Ubuntu for me, and only needed the slightest of tweaks for Slackware and hence, there is not much for me to change to be my own words.

Security Warning:
Please note, software used in this how-to will monitor and alter the keyboard send/event and mouse send/event of your computer's hardware. The author's of these files do not offer a GPG key signing and/or md5 checksum for your download files that are used in this how-to. If you cannot live with the possible security implication's that these files pose, then this guide is NOT for you. I accept no responsibility of any kind for your experiences as a result of using this guide and/or the associated files required to follow this guide. You have been warned. I have written the author's and requested this information, and I humbly request that you do the same. However, to date I have had no response. One thought that comes to my mind, is that an alternate solution to this issue could be to use sources from debian in apt, as those files are "supposedly" highly scrutinized, though I cannot validate that comment either. I can say that the Ubuntu tutorial has met my expectations.

My Setup (hardware & software)
-OS: Slackware 11.0 (installed with full nooby install)
-Mouse: Logitech MX310
A link to what my mouse looks like:
http://www.amazon.co.uk/Logitech-930.../dp/B0000AZJWK

Shameless Banter Section:
Logitech please start making this mouse again, there is nothing else to use that is satisfactory for left handed gamer's, video artists or CAD designer's, etc. please continue the manufacturing of this mouse I recommend any one who uses this mouse to quickly go out and purchase extra's really soon, supplies are limited.

Files That You Will Need To Download:
"xvkbd" from http://homepage3.nifty.com/tsato/
"xbindkeys" from http://hocwp.free.fr/xbindkeys/xbindkeys.html
"checkinstall" from slackware extra cd.
"lomoco"from http://www.linux-gamers.net/modules/...p?storyid=1158

Assumptions:
-Skill level of user : Not for beginner's or weak of stomach, but you don't have to have a last name beginning with a "V" either
-This guide is not for use with "production machines"
-KDE is installed.
-You are using the huge26 kernel or at least a kernel that evdev and udev compiled accordingly to the kernel and they are working and running (verify with "lsmod" in console if need be).
-You understand that it's probably a good idea to read this how-to, the original how-to and will print out a copy before you begin. There is a damage control section listed at the end to give some pointers in the event that something goes wrong.

Estimated Time To Set Aside:
Realistically, probably an hour because you really should read the how-to's, download files, print this out and reboot a couple of times.

Let's Begin:

Optional, tell Slackware to use run level 3 just in case we mess up our udev rule or xorg file.


Quote:
su-
pico /etc/inittab

now change the line "id:4:initdefault:"

to

id:3:initdefault:

control key & o #letter o this saves the file
control key & x #this exits the pico editor.

Reboot into run level three with your mx310 mouse plugged in.

Let's find out how slack see's the mouse:

Quote:
cat /proc/bus/input/devices

output:
I: Bus=0003 Vendor=046d Product=c01b Version=1800
N: Name="Logitech USB-PS/2 Optical Mouse"
P: Phys=usb-0000:00:02.2-4.1/input0
S: Sysfs=/class/input/input3
H: Handlers=mouse0 event3
B: EV=7
B: KEY=3f0000 0 0 0 0 0 0 0 0
B: REL=103
This line "N: Name="Logitech USB-PS/2 Optical Mouse"" in the resultant output is what is of concern to us. I was lucky, my mouse was seen the same way as the original writer's how-to. Your's may vary for your mouse so pay attention to this.

Now we are going to add a udev rule so Slackware will always recognize your mouse.

open up a text editor and paste the following (as normal user not root):
Quote:
KERNEL=="event[0-9]*", SYSFS{../name}=="Logitech USB-PS/2 Optical Mouse", NAME="input/event9"

substitute in the above line including the quotations the name of your mouse as given to you from the "cat /proc/bus/input/devices" code's output. (e.g."Logitech....")

save file to your desktop as "19-local.rules" don't close text editor yet

we need to see which udev event numbers are used in your system:
Quote:
ls /dev/input/
resultant output:
Quote:
event0 event1 event2 event3 mice mouse0 ts0
We see in the above output that event 4 through 9 is not used, so like the ubuntu guide, I used event 9 for my "19-local.rules" file.

Now that we have made the udev rule file let's move it to the correct place on our system.

Close out your text editor.

Quote:
su
chown root:root ~/Desktop/19-local.rules
cp ~/Desktop/19-local.rules etc/udev/rules.d/19-local.rules
Okay, now let's stay as root as we need to edit the xorg.conf file.
So we back it up first.

Quote:
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.mygoodbackup.bak
Now let's actually edit the file:
Quote:
pico /etc/X11/xorg.conf
scroll down to Section "InputDevice"
place a comment in front of what you have there or just delete the lines, it's up to you. just be sure to leave the Section "InputDevice" line and the "EndSection" lines there in the file.

now add the following:
Quote:
Identifier "Mouse 1"
Driver "evdev"
Option "CorePointer"
#the following line should match etc/udev/rules.d/19-local.rules file made
Option "Device" "/dev/input/event9"
now before we save this xorg.conf file, please confirm that the Identifier line that you just typed matches the Identifier used in the Section "ServerLayout". Here is a copy of mine just in case you need it:

Quote:
Section "ServerLayout"
Identifier "Simple Layout"
Screen 0 "aticonfig-Screen[0]" 0 0
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
now let's save our newly modified xorg file with 'control key & letter o' key
now let's exit pico with 'control key & letter x' key.

Now we need to reboot to let udev see our newly created udev rule.

So reboot...and I'll wait

Ok once you get back up into Slackware at log in prompt just type 'startx' to get into KDE.

Ok hopefully we have a working mouse. Now we haven't done anything yet for our "fancy" side buttons. Let's work on that part now.

I will assume from this point you downloaded the respective files. Let's compile them and install them now.

Untar the 'xvkbd' download file to a folder as a normal user to your usual scratchpad area in your path that you do your builds in.

go into the xvkbd source extract folder
Quote:
f4 key #brings up konqueror
./configure --prefix=/usr
make
su
checkinstall
installpkg ~/scratchpad/newly-created-xvkbd.tgz
#or you could just type 'pkgtool' and use that too.
exit
now close konsole.

Untar the 'xbindkeys' download file to your scratchpad area, again in your path. This program gave me a ton of error's it wanted 'libguile'. Using ./configure --help showed that I could disable this gnome requirement.

Quote:
f4 key#brings up konqueror
./configure --prefix=/usr --disable-guile
make
su
checkinstall
installpkg ~/scratchpad/newly-created-xbindkeys.tgz
#or you could just type 'pkgtool' and use that too.
exit
Now keep console open, but be sure you typed exit so your not root, use 'whoami' to make sure.

Now here is where the original writer lost me, he wants us to edit the ~/.xbindkeysrc file, but I didn't have one at this point and neither will you. Turns out I had to run "xbindkeys " in console as a normal user, the xbindkeys server will see that I do not have this file, and it will auto-create this hidden file in my home directory for me.

So startup xbindkeys server. Then we need to kill it, or close it, so that we can edit the newly created default .xbindkeysrc file in our 'user' home directory.

In console 'killall xbindkeys'

Now by default the xbindkeys team binds the keyboard event of 'control key & f4 key' to open up xterm, which is nice and all, but I use that key sequence a lot to find things in my text files, web-browser, log's, etc.

So (optionally) you might want to comment out these line's with a # sign.

This section here is default

Quote:
# specify a mouse button
"xterm"
control + b:2
Change it to looks like this:
Quote:
# specify a mouse button
#"xterm"
#control + b:2
Now, if you are not using an 'mx310' mouse the following is what will definitely be different for you.

I had to go down and change/add these lines:
Quote:
#the following line make button 8 of my mouse issue the Alt Key & Left Arrow key
"/usr/bin/X11/xvkbd -xsendevent -text "\[Alt]\[Left]""
m:0x0 + b:8
#the following line make button 8 of my mouse issue the Alt Key & Right Arrow key
"/usr/bin/X11/xvkbd -xsendevent -text "\[Alt]\[Right]""
m:0x0 + b:9
Note: A right handed person might want to swap the b:8 and b:9 up there not sure. need to work on that to be sure.

The importance of the newly created above lines is as follows:

'b:8' for example stands for button 8. for me, that is one of the fancy long black side buttons on my mouse. How did I know that b:8 was this particular button you say? I used 'xev' in console. It is part of xorg so it's already installed for us by Mr. Pat V. If we just type in console 'xev' as a normal user, our console will echo really whipping fast all of the xevents that it is seeing, from here, you will see the button number for the key you pressed. You will most certainly have to play with this if you do not have an mx310 mouse and figure out what's exactly going on, just look for a "b:" followed by a number as a guide. (hmm...fix me man page for this ?)

The ubuntu guide has more example's and mice specific "b:" number options.

Now save the file. Let's test it first and make sure the mouse does what you want. In the example above, the Alt\left Alt\Right events are mapped to the black side buttons of my mouse. So for example when I press the left side long black button on my mouse it sends the Alternate key & Left Arrow key event to my Slackware. Where can I use that? Firefox Opera use this as the 'back' command when I web browse. Conversely the right long side button of my mouse now sends the Alternate key & Right Arrow key event to my Slackware. This let's me go forward a web-page in Slackware.

So let's start up xbindkeys's daemon/server by "xbindkeys" in console.

Open firefox and test it out by browsing some pages and going back/forward with your fancy buttons there. Hopefully this worked. It is possible that if you have a mouse other than an mx310 you may not work here. I'll touch on this in a moment.

Just to finish up on browser tweaks. I also use konqueror for links for KMail, akregator too. So open up konqueror web browser, then 'settings' then 'configure shortcuts' scroll down to "Konqueror" section then "back" and modify the key there by clicking custom, and multi-bind key, place the cursor in the box to the right, and then I click my long left side button and I see on the screen it says "Alt+Left" so now Konqueror works too

So where are we at this point:
1. we have a udev rule.
2. if we are lefty...like old_fogie ...this stinks, it's like having a right handed mouse on my left side of keyboard. Its' a well known fact that left handed people think in the "right side" of the brain LOL I luv that one. Really no joke, 'it's in the books'.
3. mx310 has all fancy buttons recognized except for the tiny mouse button on middle top of mouse.
4. xbindkeys server runs but does not start up with KDE.
5. our fancy 800 dpi mouse is only running at 400 dpi because xorg & KDE don't consider but only flame people on feature request lists Why has the toggle 400/800 dpi toggle been removed KDE? tired of the requests?
7. need to tweak mouse speed's so we have some de-acceleration to edit our photo's real nicely in the gimp, and really control our mouse when we use the lightning gun to headshot noobs in Unreal Tournament because xorg & KDE don't consider but only flame people on feature request lists

Okay, let's get the right and left click keys of the mouse to be left handed.

Open up control center in KDE, then peripherals, then mouse and change it to right handed...yes we change that to right handed tho we are going to be using our mouse lefty. Don't worry there are notes here for those 'righty's' here too.

Now close out control center.

Open up your text editor and paste this:
Quote:
#! /bin/sh
# for slackware 11.0 swap 3 and 1 below for right handed users only leave as is for
# left handed mouse operations.
/usr/X11R6/bin/xmodmap -e "pointer = 3 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32"
#internal note fogie used to use "pointer = 3 2 1 6 7 4 5" in slackware 10.2 more
#numbers are now needed in slackware 11.0
#this line starts up the xbindkeys server with KDE
/usr/bin/xbindkeys
now save your file as something like
Quote:
"my-tweaked-leetzor-mouse-settings.sh"

now right click on it then properties and make it executable.

I suppose they probably could go into our xorg.conf file in same way shape or form for us, but I don't know how to do that. Or if we use a different window manager how we might tackle this either.

Ok before we just exit KDE, let's test that xmodmap -e ...line in our ...mouse-settings.sh file.

As a normal user just paste the entire line in konsole, and test your mouse buttons out. If they work correctly for you as a lefty (remember mine is lefty) or you changed it for right handed, and you feel comfortable with it. We do one final step to play it safe.

With konsole up 'killall xbindkeys' then
Quote:
sh ~/.kde/Autostart/my-tweaked-leetzor-mouse-settings.sh
Now test your mouse...is it working correctly. Browse some pages, etc. If all is well, now exit KDE, then go back in and test again.

If the results are not what you expected you can just changed the numbers in the xmodmap line in our mouse.sh file with a text editor and then run "control key & letter e" key in konqueror over and over as you go until you get it the way you expect.

OKAY, two last things to do..get some de-acceleration & get 800 dpi mouse.

Open up our ~/.kde/Autostart/my-tweaked-leetzor-mouse-settings.sh with our text editor and add:
Quote:
#the below line gives me a de-acelerated mouse cuz xorg & KDE team don't consider
#user's requests for things like CAD/CAM, 3dpipe design, photo editing or games.
/usr/X11R6/bin/xset m 7/10 2
Now save your file.

Okay. let's get our high resolution working.

untar your lomoco download file into the scratchpad package building area in your path.

Quote:
./autogen.sh
./configure --prefix=/usr
make
su
checkinstall
installpkg ./my-newly-created-lomoco.tgz
pico /etc/rc.d/rc.local
just add these lines:

Quote:
/usr/bin/lomoco -8
control key & letter O key to save
control key & letter x key to exit pico editor
exit #so we become a normal user account.
the line that we added /usr/bin/lomoco -8 tells lomoco to use the 800 dpi settings.

Let's just test it before we start up the pc.

type in console

Quote:
lomoco -8
Did the mouse seem faster? It's working

That's it, let's reboot the computer and make sure all is well.

I would say that after you reboot, and you startx, and go into KDE and see it's all working then edit you iniittab again as root and turn it back to run level "4" again. It's best that you use run level 3 IMO when doing stuff like this.

Damage Control:

Okay what if you totally mess up, how to get back to where you were before you started this howto from the command line interface at run-leve 3 command prompt:

Quote:
rm /etc/X11/xorg.conf
cp /etc/X11/xorg.conf.mygoodbackup.bak /etc/X11/xorg.conf
rm ~/.kde/Autostart/my-tweaked-leetzor-mouse-settings.sh
rm /etc/udev/rules.d/19-local.rules
optional:
as root run 'pkgtool' and remove the installed packages from your system.

Reboot the pc and you should now be back to your original settings, except for the download files and the packages you made are sitting in your scratchpad.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Disabling hardware detection of "reboot" and "power" buttons Sabinou Linux - General 3 08-21-2006 08:03 PM
Suggestion: for "subscribed threads" & "top of page" buttons Old_Fogie LQ Suggestions & Feedback 7 07-10-2006 06:10 PM
RedHat 9 & Intellimouse buttons... xmodmap not working? gcwonnery Linux - Hardware 0 04-13-2006 05:52 PM
Xorg, mouse side-buttons and xmodmap. At the end of my wits. Nordmann Slackware 3 08-23-2004 03:18 PM
mouse: Buttons "5" ??? Rex_chaos Linux - General 15 08-20-2003 06:47 AM


All times are GMT -5. The time now is 08:39 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration