个人工具

“UbuntuHelp:Logitech Marblemouse USB”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
(未显示同一用户的1个中间版本)
第2行: 第2行:
 
{{Languages|UbuntuHelp:Logitech_Marblemouse_USB}}
 
{{Languages|UbuntuHelp:Logitech_Marblemouse_USB}}
 
== Introduction ==
 
== Introduction ==
Input devices are now configured using Hal, which means most settings in '''xorg.conf''' will be ignored when X starts. Hal's configuration files are stored in '''/etc/hal/fdi/policy''' with a file name extension of '''.fdi'''. After making configuration changes, restart X (or reboot the computer).
+
This document describes how to configure the Logitech Marble Mouse (USB), shown in the following figure:
The remainder of this document describes how to configure the Logitech Marble Mouse (USB), shown in the following figure:
+
 
https://help.ubuntu.com/community/Logitech_Marblemouse_USB?action=AttachFile&do=get&target=logitech-marble-mouse.png%7CLogitech+Marble+Mouse+USB%7Cposition%3D%22left%22  
 
https://help.ubuntu.com/community/Logitech_Marblemouse_USB?action=AttachFile&do=get&target=logitech-marble-mouse.png%7CLogitech+Marble+Mouse+USB%7Cposition%3D%22left%22  
== Horizontal and Vertical Scrolling Example ==
+
== Ubuntu 10.04 ==
 +
To get your Marble Mouse working in Ubuntu 10.04, edit your plain old '''/etc/X11/xorg.conf''' file to configure your device.
 +
A configuration similar to the following should make your Logitech Marble Mouse work. It seems safer to add this code to '''/etc/X11/xorg.conf''' instead of using snippets as it seems they will be relocated in Ubuntu 10.10. Snippets also seem to not work for some people, as seen [https://bugs.launchpad.net/ubuntu/+source/udev/+bug/567068/comments/7 here].
 +
This configuration gives the buttons (see diagram above) these functions:
 +
<ol><li>Normal left mouse button
 +
</li><li>Middle mouse button - paste from selection, open link in new tab in Firefox, etc
 +
</li><li>Hold to scroll freely with the trackball, both horizontally and vertically
 +
</li><li>Normal right mouse button</li></ol>
 +
 
 +
Add this to '''/etc/X11/xorg.conf''':
 +
<pre><nowiki>
 +
Section "InputClass"
 +
        Identifier  "Marble Mouse"
 +
        MatchProduct "ImExPS/2 Logitech Explorer Mouse"
 +
        MatchIsPointer "on"
 +
        MatchDevicePath "/dev/input/event*"
 +
        Driver "evdev"
 +
        Option "ButtonMapping" "1 8 3 4 5 6 7 2 9"
 +
        Option "EmulateWheel" "true"
 +
        Option "EmulateWheelButton" "9"
 +
        Option "ZAxisMapping" "4 5"
 +
        Option  "XAxisMapping" "6 7"
 +
        Option  "Emulate3Buttons" "false"
 +
EndSection
 +
</nowiki></pre>
 +
Please note the name in <code><nowiki>MatchProduct</nowiki></code> is "ImExPS/2 Logitech Explorer Mouse". This is for a Marble Mouse that is quite old so it could be possible that yours has a different name. Take a look at the output of the following command to check the name of your device and change that line if necessary:
 +
<pre><nowiki>
 +
dmesg | grep Logitech
 +
</nowiki></pre>
 +
Edit the <code><nowiki>MatchProduct</nowiki></code> line in the above configuration to contain your device name.
 +
Another example is
 +
<pre><nowiki>
 +
MatchProduct "Logitech USB Trackball"
 +
</nowiki></pre>
 +
== Ubuntu 9.10 and older ==
 +
=== Introduction ===
 +
Input devices are now configured using Hal, which means most settings in '''xorg.conf''' will be ignored when X starts. Hal's configuration files are stored in '''/etc/hal/fdi/policy''' with a file name extension of '''.fdi'''. After making configuration changes, restart X (or reboot the computer).
 +
=== Ubuntu 9.10 - 24-Mar-2010 ===
 +
Avoid using Hal for this release as it has known issues. Try the following:
 +
<ol><li>Edit '''''$HOME/bin/trackball.sh''''': <pre><nowiki>
 +
dev="Logitech USB Trackball"
 +
we="Evdev Wheel Emulation"
 +
xinput set-int-prop "$dev" "$we Button" 8 8
 +
xinput set-int-prop "$dev" "$we" 8 1
 +
 
 +
# xinput set-int-prop "$dev" "$we" 8 1
 +
# xinput set-int-prop "$dev" "$we Button" 8 9
 +
# xinput set-int-prop "$dev" "$we X Axis" 8 6 7
 +
# xinput set-int-prop "$dev" "$we Y Axis" 8 4 5
 +
# xinput set-int-prop "$dev" "Drag Lock Buttons" 8 8 </nowiki></pre>
 +
</li><li>Make sure '''''trackball.sh''''' begins with '''#!/bin/bash'''.
 +
</li><li>Make the script executable: <pre><nowiki>
 +
chmod +x $HOME/bin/trackball.sh
 +
</nowiki></pre>
 +
</li><li>Add the following lines to '''''$HOME/.bashrc''''': <pre><nowiki>
 +
xmodmap $HOME/.Xmodmap > /dev/null 2>&1
 +
$HOME/bin/trackball.sh
 +
</nowiki></pre>
 +
</li><li>Edit '''''$HOME/.Xmodmap''''': <pre><nowiki>
 +
pointer = 1 8 3 4 5 6 7 9 2
 +
</nowiki></pre></li></ol>
 +
 
 +
Logout and log back in. This setup provides:
 +
* '''Button 1''' - Left click
 +
* '''Button 2''' - Hold to scroll; click for '''back'''
 +
* '''Button 3''' - Paste highlighted text (simulates middle-click)
 +
* '''Button 4''' - Right click
 +
=== Horizontal and Vertical Scrolling Example ===
 
To enable vertical and horizontal scrolling while holding down the small, left mouse button (button #2 in the image) change '''/etc/hal/fdi/policy/mouse-wheel.fdi''' to:
 
To enable vertical and horizontal scrolling while holding down the small, left mouse button (button #2 in the image) change '''/etc/hal/fdi/policy/mouse-wheel.fdi''' to:
 
<pre><nowiki>
 
<pre><nowiki>
第22行: 第88行:
 
</deviceinfo>
 
</deviceinfo>
 
</nowiki></pre>
 
</nowiki></pre>
== Vertical Scrolling Example ==
+
=== Vertical Scrolling Example ===
 
To enable vertical scrolling while holding down the small, left mouse button (button #2 in the image), change '''/etc/hal/fdi/policy/mouse-wheel.fdi''' to:
 
To enable vertical scrolling while holding down the small, left mouse button (button #2 in the image), change '''/etc/hal/fdi/policy/mouse-wheel.fdi''' to:
 
<pre><nowiki>
 
<pre><nowiki>
第38行: 第104行:
 
</deviceinfo>
 
</deviceinfo>
 
</nowiki></pre>
 
</nowiki></pre>
=== Firefox ===
+
Here's the /etc/hal/fdi/policy/mouse-wheel.fdi for '''left-handed operation''' (with right-handed in comments):
 +
<pre><nowiki>
 +
<?xml version="1.0" encoding="ISO-8859-1"?>
 +
<deviceinfo version="0.2">
 +
  <device>
 +
    <match key="info.product" string="Logitech USB Trackball">
 +
      <merge key="input.x11_options.Buttons" type="string">9</merge>
 +
      <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
 +
      <merge key="input.x11_options.EmulateWheelTimeout" type="string">300</merge>
 +
      <!-- Left hand -->
 +
      <merge key="input.x11_options.ButtonMapping" type="string">3 9 1 4 5 6 7 8 2</merge>
 +
      <merge key="input.x11_options.EmulateWheelButton" type="string">9</merge>
 +
      <!-- Right hand -->
 +
      <!-- <merge key="input.x11_options.ButtonMapping" type="string">1 8 3 4 5 6 7 2 9</merge> -->
 +
      <!-- <merge key="input.x11_options.EmulateWheelButton" type="string">8</merge> -->
 +
      <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
 +
      <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
 +
      <merge key="input.x11_options.ZAxisMapping" type="string">4 5</merge>
 +
      <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
 +
    </match>
 +
  </device>
 +
</deviceinfo>
 +
</nowiki></pre>
 +
==== Firefox ====
 
If vertical scrolling does not work in Firefox, ensure the following '''about:config''' values are set (using Firefox):
 
If vertical scrolling does not work in Firefox, ensure the following '''about:config''' values are set (using Firefox):
 
<pre><nowiki>
 
<pre><nowiki>
 
mousewheel.horizscroll.withnokey.action user set integer 0
 
mousewheel.horizscroll.withnokey.action user set integer 0
mousewheel.horizscroll.withnokey.sysnumlines user set boelean true
+
mousewheel.horizscroll.withnokey.sysnumlines user set boolean true
 
</nowiki></pre>
 
</nowiki></pre>
== Middle Click ==
+
=== Middle Click ===
Currently the button mapping described above is being ignored by Hal. (As of 9.04 it appears that the button mapping is now applied correctly. Only use one method or the other).  This is particularly problematic if you want one of the small buttons to serve as middle click.  A simple workaround is to remap what you need via xmodmap.  As an example, let's map the small left button as middle click.  Save this in your .Xmodmap file:
+
Currently the button mapping described above is being ignored by Hal. (As of 9.04 it appears that the button mapping is now applied correctly. Only use one method or the other.) This is particularly problematic if you want one of the small buttons to serve as middle click.  A simple workaround is to remap what you need via xmodmap.  As an example, let's map the small left button as middle click.  Save this in your .Xmodmap file:
 
<pre><nowiki>
 
<pre><nowiki>
 
pointer = 1 8 3 4 5 6 7 2 9
 
pointer = 1 8 3 4 5 6 7 2 9
第65行: 第154行:
 
$ xinput list
 
$ xinput list
 
</nowiki></pre>
 
</nowiki></pre>
== External Links ==
+
=== Setting options via HAL may not work in Ubuntu 9.10 by default ===
 +
Ubuntu 9.10 (Karmic Koala) contains gnome-settings-daemon 2.28.1 which does not honour settings made in /etc/hal/fdi/policy/. This is filed as http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=552279. A workaround by disabling the mouse plugin of gnome-settings-daemon is described at http://bbs.archlinux.org/viewtopic.php?pid=644304. In my case  ([[UbuntuHelp:MacBook|MacBook]] Pro 5,4 using the bcm5974 touchpad module) I had to reboot once after applying the workaround to make it stick. After this, I could change the settings as expected by editing the HAL fdi file and restarting HAL (some settings may need a module reload, too). Note that you can use
 +
<pre><nowiki>
 +
$ lshal | less
 +
</nowiki></pre>
 +
or similar to check whether the fdi settings were correctly merged into the configuration.
 +
=== Alternative: apply settings via xinput ===
 +
If you do not want to use HAL (or apply the workaround from the above section in Ubuntu 9.10), using xinput provides an alternative way to make the Logitech Marble work.
 +
Horizontal & vertical scrolling with small left key & drag lock with small right key example:
 +
<pre><nowiki>
 +
xinput set-button-map "Logitech USB Trackball" 1 2 3 4 5 6 7 8 9
 +
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 8
 +
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1
 +
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Axes" 8 6 7 4 5
 +
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation X Axis" 8 6
 +
xinput set-int-prop "Logitech USB Trackball" "Evdev Drag Lock Buttons" 8 9
 +
</nowiki></pre>
 +
You can add the lines above in a bash script (say marbleScroll.sh):
 +
Now run the script
 +
<pre><nowiki>
 +
$ sh marbleScroll.sh
 +
</nowiki></pre>
 +
You can check what you have made via:
 +
<pre><nowiki>
 +
$ xinput list-props "Logitech USB Trackball"
 +
</nowiki></pre>
 +
=== External Links ===
 
* [http://mvogt.wordpress.com/2008/08/15/xorg-evdev-and-emulatewheel/] - Explanation of how to find your input device using xinput.
 
* [http://mvogt.wordpress.com/2008/08/15/xorg-evdev-and-emulatewheel/] - Explanation of how to find your input device using xinput.
 
* [https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+bug/261400] - Link to launchpad with further explanation of how the new hal policy works.
 
* [https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+bug/261400] - Link to launchpad with further explanation of how the new hal policy works.
 
* [http://ubuntuforums.org/showthread.php?t=938487] - Link to original thread in intrepid testing forums for the Logitech Marble Mouse USB.
 
* [http://ubuntuforums.org/showthread.php?t=938487] - Link to original thread in intrepid testing forums for the Logitech Marble Mouse USB.
 +
* [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=552279] - Link to Debian bug report about gnome-settings-daemon 2.28.x
 +
* [http://bbs.archlinux.org/viewtopic.php?pid=644304] - Link to a workaround for said issue in gnome-settings-daemon.
 
----
 
----
 
[[category:CategoryHardware]] [[category:CategoryX]]
 
[[category:CategoryHardware]] [[category:CategoryX]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月19日 (三) 23:10的最新版本

Introduction

This document describes how to configure the Logitech Marble Mouse (USB), shown in the following figure: https://help.ubuntu.com/community/Logitech_Marblemouse_USB?action=AttachFile&do=get&target=logitech-marble-mouse.png%7CLogitech+Marble+Mouse+USB%7Cposition%3D%22left%22

Ubuntu 10.04

To get your Marble Mouse working in Ubuntu 10.04, edit your plain old /etc/X11/xorg.conf file to configure your device. A configuration similar to the following should make your Logitech Marble Mouse work. It seems safer to add this code to /etc/X11/xorg.conf instead of using snippets as it seems they will be relocated in Ubuntu 10.10. Snippets also seem to not work for some people, as seen here. This configuration gives the buttons (see diagram above) these functions:

  1. Normal left mouse button
  2. Middle mouse button - paste from selection, open link in new tab in Firefox, etc
  3. Hold to scroll freely with the trackball, both horizontally and vertically
  4. Normal right mouse button

Add this to /etc/X11/xorg.conf:

Section "InputClass"
        Identifier  "Marble Mouse"
        MatchProduct "ImExPS/2 Logitech Explorer Mouse"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "ButtonMapping" "1 8 3 4 5 6 7 2 9"
        Option "EmulateWheel" "true"
        Option "EmulateWheelButton" "9"
        Option "ZAxisMapping" "4 5"
        Option  "XAxisMapping" "6 7"
        Option  "Emulate3Buttons" "false"
EndSection

Please note the name in MatchProduct is "ImExPS/2 Logitech Explorer Mouse". This is for a Marble Mouse that is quite old so it could be possible that yours has a different name. Take a look at the output of the following command to check the name of your device and change that line if necessary:

dmesg | grep Logitech

Edit the MatchProduct line in the above configuration to contain your device name. Another example is

MatchProduct "Logitech USB Trackball"

Ubuntu 9.10 and older

Introduction

Input devices are now configured using Hal, which means most settings in xorg.conf will be ignored when X starts. Hal's configuration files are stored in /etc/hal/fdi/policy with a file name extension of .fdi. After making configuration changes, restart X (or reboot the computer).

Ubuntu 9.10 - 24-Mar-2010

Avoid using Hal for this release as it has known issues. Try the following:

  1. Edit $HOME/bin/trackball.sh:
    dev="Logitech USB Trackball"
    we="Evdev Wheel Emulation"
    xinput set-int-prop "$dev" "$we Button" 8 8
    xinput set-int-prop "$dev" "$we" 8 1
    
    # xinput set-int-prop "$dev" "$we" 8 1
    # xinput set-int-prop "$dev" "$we Button" 8 9
    # xinput set-int-prop "$dev" "$we X Axis" 8 6 7
    # xinput set-int-prop "$dev" "$we Y Axis" 8 4 5
    # xinput set-int-prop "$dev" "Drag Lock Buttons" 8 8 
  2. Make sure trackball.sh begins with #!/bin/bash.
  3. Make the script executable:
    chmod +x $HOME/bin/trackball.sh
    
  4. Add the following lines to $HOME/.bashrc:
    xmodmap $HOME/.Xmodmap > /dev/null 2>&1
    $HOME/bin/trackball.sh
    
  5. Edit $HOME/.Xmodmap:
    pointer = 1 8 3 4 5 6 7 9 2
    

Logout and log back in. This setup provides:

  • Button 1 - Left click
  • Button 2 - Hold to scroll; click for back
  • Button 3 - Paste highlighted text (simulates middle-click)
  • Button 4 - Right click

Horizontal and Vertical Scrolling Example

To enable vertical and horizontal scrolling while holding down the small, left mouse button (button #2 in the image) change /etc/hal/fdi/policy/mouse-wheel.fdi to:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.product" string="Logitech USB Trackball">
      <merge key="input.x11_options.ButtonMapping" type="string">1 2 3 4 5 6 7 8 9</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.ZAxisMapping" type="string">4 5</merge>
      <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
      <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
    </match>
  </device>
</deviceinfo>

Vertical Scrolling Example

To enable vertical scrolling while holding down the small, left mouse button (button #2 in the image), change /etc/hal/fdi/policy/mouse-wheel.fdi to:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.product" string="Logitech USB Trackball">
      <merge key="input.x11_options.ButtonMapping" type="string">1 8 3 9 2</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.ZAxisMapping" type="string">4 5</merge>
      <merge key="input.x11_options.Emulate3Buttons" type="string">false</merge>
    </match>
  </device>
</deviceinfo>

Here's the /etc/hal/fdi/policy/mouse-wheel.fdi for left-handed operation (with right-handed in comments):

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.product" string="Logitech USB Trackball">
      <merge key="input.x11_options.Buttons" type="string">9</merge>
      <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
      <merge key="input.x11_options.EmulateWheelTimeout" type="string">300</merge>
      <!-- Left hand -->
      <merge key="input.x11_options.ButtonMapping" type="string">3 9 1 4 5 6 7 8 2</merge>
      <merge key="input.x11_options.EmulateWheelButton" type="string">9</merge>
      <!-- Right hand -->
      <!-- <merge key="input.x11_options.ButtonMapping" type="string">1 8 3 4 5 6 7 2 9</merge> -->
      <!-- <merge key="input.x11_options.EmulateWheelButton" type="string">8</merge> -->
      <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
      <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
      <merge key="input.x11_options.ZAxisMapping" type="string">4 5</merge>
      <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
    </match>
  </device>
</deviceinfo>

Firefox

If vertical scrolling does not work in Firefox, ensure the following about:config values are set (using Firefox):

mousewheel.horizscroll.withnokey.action		user set	integer	0
mousewheel.horizscroll.withnokey.sysnumlines	user set	boolean	true

Middle Click

Currently the button mapping described above is being ignored by Hal. (As of 9.04 it appears that the button mapping is now applied correctly. Only use one method or the other.) This is particularly problematic if you want one of the small buttons to serve as middle click. A simple workaround is to remap what you need via xmodmap. As an example, let's map the small left button as middle click. Save this in your .Xmodmap file:

pointer = 1 8 3 4 5 6 7 2 9

Note that all we did was to swap the numbers 2 and 8. If you'd like to use the small right button as middle click, swap 2 and 9 instead. The .Xmodmap file will be loaded next time you log in. To run it manually, run:

$ xmodmap .Xmodmap

Using xmodmap affects all mice you have plugged in, an alternative is to use xinput to remap the buttons just for the device you specify.

$ xinput set-button-map "Logitech USB Trackball" 1 8 3 4 5 6 7 2 9

xinput may report the trackball as having 32 buttons and some window managers such as fluxbox require you to map all buttons reported for the device even though the buttons do not exist when using xinput. For fluxbox and similar window mangers the command below would map the trackball for left handed use. The large button on the right would be left click, the large button on the left would be right click, the small button on the right would function as a middle button, and the small button on the left would function as the scroll.

$ xinput set-button-map "Logitech USB Trackball" 3 9 1 4 5 6 7 8 2 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

If you have a different device and don't know its identifier, you can find it via:

$ xinput list

Setting options via HAL may not work in Ubuntu 9.10 by default

Ubuntu 9.10 (Karmic Koala) contains gnome-settings-daemon 2.28.1 which does not honour settings made in /etc/hal/fdi/policy/. This is filed as http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=552279. A workaround by disabling the mouse plugin of gnome-settings-daemon is described at http://bbs.archlinux.org/viewtopic.php?pid=644304. In my case (MacBook Pro 5,4 using the bcm5974 touchpad module) I had to reboot once after applying the workaround to make it stick. After this, I could change the settings as expected by editing the HAL fdi file and restarting HAL (some settings may need a module reload, too). Note that you can use

$ lshal | less

or similar to check whether the fdi settings were correctly merged into the configuration.

Alternative: apply settings via xinput

If you do not want to use HAL (or apply the workaround from the above section in Ubuntu 9.10), using xinput provides an alternative way to make the Logitech Marble work. Horizontal & vertical scrolling with small left key & drag lock with small right key example:

xinput set-button-map "Logitech USB Trackball" 1 2 3 4 5 6 7 8 9
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 8
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Axes" 8 6 7 4 5
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation X Axis" 8 6
xinput set-int-prop "Logitech USB Trackball" "Evdev Drag Lock Buttons" 8 9

You can add the lines above in a bash script (say marbleScroll.sh): Now run the script

$ sh marbleScroll.sh

You can check what you have made via:

$ xinput list-props "Logitech USB Trackball"

External Links

  • [1] - Explanation of how to find your input device using xinput.
  • [2] - Link to launchpad with further explanation of how the new hal policy works.
  • [3] - Link to original thread in intrepid testing forums for the Logitech Marble Mouse USB.
  • [4] - Link to Debian bug report about gnome-settings-daemon 2.28.x
  • [5] - Link to a workaround for said issue in gnome-settings-daemon.