个人工具

UbuntuHelp:Logitech Marblemouse USB

来自Ubuntu中文

Wikibot讨论 | 贡献2009年11月17日 (二) 19:46的版本

跳转至: 导航, 搜索

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). 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

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

Postscript

In the Alpha 4 pre-release version of Karmic Koala this configuration via hal no longer seems to work.

Latest Ubuntu Marble Working

Latest Ubuntu release does not actually respond to hal's file policies. Using xinput makes 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.