LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-27-2004, 09:34 PM   #1
bleargh
Member
 
Registered: Jul 2004
Location: New York, NY
Distribution: Ubuntu
Posts: 67

Rep: Reputation: 16
xmodmap for multiple mice? external and laptop mice scrolling back/forward, etc.


Alright. I just bought a Logitech Mediaplay wireless USB optical mouse, which has like 432687543 buttons. (I love buttons.) But I only love them when they do something, so I'm figuring out how to make them all work. It has 7 regular mouse "buttons" as far as X is concerned, normal left and right, scroll press, scroll up and down, and thumb back and forward (used in browsers, etc.) It also has a tilt wheel, though, which would mean 9 buttons? I don't know. Then it also has multimedia buttons so you can use it like a remote control, listed below. These ones show up as keycodes (I think). I am on a Dell Inspiron 8600c laptop, and am using the touchpad/trackpoint and external mouse at the same time. ("And you expect to get all the buttons to work?! In Linux?? You're out of your mind!!") :-)

I have figured out to put some things in my XF86config file:

Code:
# Logitech Mediaplay wireless optical USB mouse:

Section "InputDevice"
   Identifier  "USB Mice"
   Driver      "mouse"
# Option      "Protocol"   "IMPS/2"
   Option  "Protocol"      "ExplorerPS/2"
   Option      "Device"     "/dev/input/mice"
   Option      "ZAxisMapping"   "6 7"
   Option       "ButtonNumber" "7"
   Option       "Buttons" "7"
EndSection
and

Code:
Section "ServerLayout"
 Identifier "Default Layout"
 Screen  "Default Screen"
 InputDevice "Default Keyboard"
 InputDevice "Default Mouse" "CorePointer"
 InputDevice "USB Mice" "SendCoreEvents"
EndSection
As you can see, I tried the IMPS/2 first, but it doesn't seem to recognize all 7 buttons.

X recognizes scroll wheel movement as z-axis movement (normal pointer movement is x and y) and this line configures it to remap z-axis as buttons 6 and 7. Most apps recognize 4 and 5 as scrolling, but if we say remap to 4 and 5, we will not be able to use the back and forward buttons. So we map them to 6 and 7 first, and then switch 4/5 and 6/7 using xmodmap:

Code:
xmodmap -e "pointer = 1 2 3 6 7 4 5"
(I am getting this from here: http://www.glaurung.demon.co.uk/info...500.howto.html)

Now when I scroll, applications get buttons 4 and 5, and when I click forward and back, the applications get 6 and 7 (which Firefox recognizes as forward and back! hooray!) Here's where my major question comes in:

The first time I did this, it seemed to work. I didn't realize the 6 and 7 functioned as forward and back yet, so I don't know for certain that they worked, but I assume so. The second time I did this (after changing some options and restarting X), it didn't work, but then I noticed that my scrolling (right hand strip) and back/forward (bottom strip) on my touchpad were reversed! Sure enough, changing the xmodmap back changed them back. So xmodmap was only affecting the touchpad now and not the external mouse. I imagine it was only affecting the external mouse the first time I did it, though I don't know that for certain.

Major question: How do I use xmodmap to affect only one of the pointers?

It seems that xmodmap only affects the CorePointer, and I cannot get the USB mouse to work configured as CorePointer; only as SendCoreEvents. Is there a way to use another program like imwheel to remap the buttons on only one of the pointers?

After I figure this out, I will try to configure the multimedia buttons for my mouse and for my laptop keyboard. I have already figured out the keycodes for the Dell Inspiron 8600c laptop through xev (I am sure other people will be looking for these):

volume down: 174
volume up: 176
volume mute: 160
play/pause: 162
stop: 164
previous: 144
next: 153

and the keycodes for the multimedia buttons on the mouse, which don't show up in xev for some reason, but do show up during boot, when i press them all and it gets annoyed and prints the message "keyboard.c: can't emulate rawmode for keycode xxx".

Media: 277
+ (vol up): 280
- (vol dn): 281
>> (next): 282
<< (prev): 283
play/pause: 284

Secondary question (that I can probably figure out on my own but I might as well ask): Is there an easy way to map these to common functions in different apps? Like does imwheel have a generic "play" mapping that I can just supply the right keycode number to, or do I have to configure each app myself?

Last edited by bleargh; 11-28-2004 at 12:22 PM.
 
Old 12-23-2004, 01:43 PM   #2
vanRijn
LQ Newbie
 
Registered: Dec 2004
Posts: 1

Rep: Reputation: 0
Woohoo!! I'm thrilled to see your post. = I just bought a Logitech MediaPlay wireless USB optical mouse myself and though I've only had it since last night, I'm already itching to get all of the buttons working on it. = I've followed your advice in your post and I have the scroll wheel working, left/right/middle click works, and the two thumb back/forward buttons at least register as buttons 6 and 7. But now I want to get the rest of them working, along with the side-to-side scrolling that the mouse can do.

Have you found anything else out on getting all this working nicely with Linux? =

Thanks!!
 
Old 12-23-2004, 02:02 PM   #3
bleargh
Member
 
Registered: Jul 2004
Location: New York, NY
Distribution: Ubuntu
Posts: 67

Original Poster
Rep: Reputation: 16
i still haven't bothered to map back and forward to alt-left and alt-right, although that would be better because it would work in firefox and also konqueror file browser and other such things. i don't know how exactly to do it. let me know if you find out.

the side scrolling appears to be unsupported at this time. oh well. it barely even works in windows at this point, anyway...

here are two other related posts:

http://forum.libranet.com/viewtopic....5e48e2ceb5f095

http://forum.libranet.com/viewtopic....asc&highlight=

it's a nice mouse, right? i figured they must make high quality stuff, but then i bought this "dual action" gamepad for my brother for christmas, and then looked online and saw about 70 reviews saying it fails after a week of use and all this stuff, so i guess logitech is hit and miss. we'll probably return it and get something else. but i like the mouse! mmm buttons.
 
Old 12-31-2004, 08:48 AM   #4
Nethog
LQ Newbie
 
Registered: Dec 2004
Posts: 1

Rep: Reputation: 0
Hi bleargh,

I had the same problem and made an ugly but functional fix for it. I created two xorg.conf files: one called xorg.conf and one called xorg.conf.nousb. Since I don't always have my usb mouse with me when I use the laptop I want it to be fully functional in all cases. I am running gentoo linux 2.6.9 on a toshiba satellite 5200-801 with a synaptics cpad touchpad. I have a wireless Intellimouse explorer which needs to have the button order flipped (4<->6, 5<->7).
I wrote a short script that figures out if the usb mouse is attached:

>>>
#!/bin/bash
USBMOUSE=`grep -c usbhid /proc/bus/usb/devices`
if [ $USBMOUSE -eq 1 ]; then
export XORGCONFIG="xorg.conf"
else
export XORGCONFIG="xorg.conf.nousb"
fi
export USBMOUSE
>>>

I edit my startx script by adding the line:

source /path/to//the/above/script

in the beginning so that it is always executed. Then I edited my .xinitrc so that it flips the button order if it is appropriate:

>>>
if [ $USBMOUSE -eq 1 ];then
xmodmap -e 'pointer = 1 2 3 6 7 4 5' &
fi
xscreensaver -no-splash &
fnfx > /dev/null &
exec fluxbox
>>>

In this way I have a fully functional usb mouse (with 7 button functionality working) as well as the touchpad with scrolling and such. When I don't have the usb mouse connected at X startup it still works with the scroll wheel if I attach it while running X (but the back and forward buttons don't work...small sacrifices).

I paste my two xorg.conf files below:

xorg.conf:
>>>
# **********************************************************************
# Module section -- this section is used to specify
# which dynamically loadable modules to load.
# **********************************************************************
#
Section "Module"
Load "dbe" # Double buffer extension
Load "synaptics"
SubSection "extmod"
Option "omit xfree86-dga" # don't initialise the DGA extension
EndSubSection
Load "type1"
Load "freetype"
Load "glx"
EndSection

# **********************************************************************
# Files section. This allows default font and rgb paths to be set
# **********************************************************************

Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "/usr/share/fonts/misc/"
FontPath "/usr/share/fonts/TTF/"
FontPath "/usr/share/fonts/Type1/"
FontPath "/usr/share/fonts/75dpi/"
FontPath "/usr/share/fonts/100dpi/"
FontPath "/usr/share/fonts/local/"
EndSection

# **********************************************************************
# Input devices
# **********************************************************************

Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "AutoRepeat" "500 30"
Option "XkbRules" "xorg"
Option "XkbModel" "toshiba_s3000"
Option "XkbLayout" "se"
EndSection

Section "InputDevice"
Identifier "Mouse1"
Driver "synaptics"
Option "Protocol" "Auto-dev"
Option "Device" "/dev/input/mice"
Option "ShmConfig" "on"
EndSection

Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "/dev/input/mice"
Option "Buttons" "7"
Option "ZAxisMapping" "6 7"
EndSection

# **********************************************************************
# Monitor section
# **********************************************************************

Section "Monitor"
Identifier "My Monitor"
HorizSync 31.5 - 82.0
VertRefresh 40-150
EndSection

# **********************************************************************
# Graphics device section
# **********************************************************************

Section "Device"
Identifier "Standard VGA"
VendorName "Unknown"
BoardName "Unknown"
Driver "vga"

Section "Device"
Identifier "NVIDIA"
Driver "nv"
EndSection

# **********************************************************************
# Screen sections
# **********************************************************************

Section "Screen"
Identifier "Screen 1"
Device "NVIDIA"
Monitor "My Monitor"
DefaultDepth 24

Subsection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480"
ViewPort 0 0
EndSubsection
Subsection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480"
ViewPort 0 0
EndSubsection
Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600" "640x480"
ViewPort 0 0
EndSubsection
EndSection

# **********************************************************************
# ServerLayout sections.
# **********************************************************************

Section "ServerLayout"
Identifier "Simple Layout"
Screen "Screen 1"
InputDevice "Mouse2" "CorePointer" # Note the reversed order of core and alwayscore
InputDevice "Keyboard1" "CoreKeyboard"
Inputdevice "Mouse1" "AlwaysCore"
Option "AllowMouseOpenFail" "on"
EndSection
>>>

xorg.conf.nousb:
>>>
# **********************************************************************
# Module section -- this section is used to specify
# which dynamically loadable modules to load.
# **********************************************************************

Section "Module"
Load "dbe" # Double buffer extension
Load "synaptics"
SubSection "extmod"
Option "omit xfree86-dga" # don't initialise the DGA extension
EndSubSection
Load "type1"
Load "freetype"
Load "glx"
EndSection

# **********************************************************************
# Files section. This allows default font and rgb paths to be set
# **********************************************************************

Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "/usr/share/fonts/misc/"
FontPath "/usr/share/fonts/TTF/"
FontPath "/usr/share/fonts/Type1/"
FontPath "/usr/share/fonts/75dpi/"
FontPath "/usr/share/fonts/100dpi/"
FontPath "/usr/share/fonts/local/"
EndSection

# **********************************************************************
# Input devices
# **********************************************************************

Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "AutoRepeat" "500 30"
Option "XkbRules" "xorg"
Option "XkbModel" "toshiba_s3000"
Option "XkbLayout" "se"
EndSection

Section "InputDevice"
Identifier "Mouse1"
Driver "synaptics"
Option "Protocol" "Auto-dev"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "6 7"
Option "Buttons" "7"
Option "ShmConfig" "on"
EndSection

Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "/dev/input/mice"
Option "Buttons" "7"
Option "ZAxisMapping" "4 5"
EndSection

# **********************************************************************
# Monitor section
# **********************************************************************

Section "Monitor"
Identifier "My Monitor"
HorizSync 31.5 - 82.0
VertRefresh 40-150
EndSection

# **********************************************************************
# Graphics device section
# **********************************************************************

Section "Device"
Identifier "Standard VGA"
VendorName "Unknown"
BoardName "Unknown"
Driver "vga"
EndSection

Section "Device"
Identifier "NVIDIA"
Driver "nv"
EndSection

# **********************************************************************
# Screen sections
# **********************************************************************

Section "Screen"
Identifier "Screen 1"
Device "NVIDIA"
Monitor "My Monitor"
DefaultDepth 24

Subsection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480"
ViewPort 0 0
EndSubsection
Subsection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480"
ViewPort 0 0
EndSubsection
Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600" "640x480"
ViewPort 0 0
EndSubsection
EndSection

# **********************************************************************
# ServerLayout sections.
# **********************************************************************

Section "ServerLayout"
Identifier "Simple Layout"
Screen "Screen 1"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
Inputdevice "Mouse2" "AlwaysCore"
Option "AllowMouseOpenFail" "on"
EndSection
>>>

Hope this helps someone!

Cheers,
Nethog
 
  


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
Multiple monitors and keyboards and mice, OH MY! dlublink Linux - Hardware 2 02-08-2005 02:16 PM
Multiple mice evslin Linux - Hardware 1 11-29-2004 01:53 PM
X and multiple mice m0rl0ck Linux - Software 6 10-29-2003 04:36 PM
Laptop with 2 mice pielud Linux - Hardware 15 07-05-2003 06:35 AM
Multiple Mice in Red Hat? justiceisblind Linux - Hardware 5 01-24-2003 11:16 PM


All times are GMT -5. The time now is 05:58 PM.

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