[Needs SRU] unable to use mouse buttons to trigger events in mangler

Bug #575465 reported by Randy on 2010-05-04
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
X.Org X server
Fix Released
Medium
xorg-server (Ubuntu)
Medium
Ezra Reeves
Maverick
Medium
Unassigned
Natty
Medium
Ezra Reeves

Bug Description

[Impact]
Hardware-specific issue which results in certain mouse models to get detected as keyboard, which can cause problems in various applications, depending on how they interact with the mouse.

[Development Solution]
Patch is already present in the xserver in natty as fixed by upstream.

[Release Solution]
Patch linked in comment #11 applies to maverick and was tested to solve the issue.

[Test Case]
With affected hardware, run mangler and set the "Enable Mouse Button Push to Talk" option. If the problem is resolved, the affected mouse's hardware description will be available in the drop down list.

[Regression Potential]
Mild. The patch was taken into the stable release branch, and we've been carrying this change in Natty without any complaints as far as I know. The patch itself just tweaks the ordering of device detection a smidge; there's essentially no chance of crashes or other serious problems. Worst case would be behavioral change in oddball input devices.

[Original Report]
inside mangler

I have the "Enable Mouse Button Push to Talk" checked

Select Mouse is set to "Virtual core XTEST pointer

I then clicked the "Set" button and pressed my middle mouser (Wheel) button

When I try to use my middle mouse button it does not transmit.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: xinput 1.5.0-2ubuntu1
ProcVersionSignature: Ubuntu 2.6.32-21.32-generic 2.6.32.11+drm33.2
Uname: Linux 2.6.32-21-generic i686
NonfreeKernelModules: nvidia
Architecture: i386
Date: Tue May 4 19:18:23 2010
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: xinput

Randy (rigidknife) wrote :
Locke (locke-db) wrote :

I have the same issue. Attached is the output of "xinput list --long". The issue persists regardless of what mouse I choose.

Randy (rigidknife) wrote :
ekilfoil (ekilfoil) wrote :

The way Mangler detects mouse button presses is by polling the state of the mouse. With most mouses, polling the master pointer will return the state of the slave device. This problem seems to be limited to Logitech wireless mice.

Basically we're doing this:

    dev = XOpenDevice(GDK_WINDOW_XDISPLAY(rootwin), xdev[ctr].id);
    xds = (XDeviceState *)XQueryDeviceState(GDK_WINDOW_XDISPLAY(rootwin), dev);
    xbs = (XButtonState*) xds->data;
    state = state << bit;
    if ((xbs->buttons[byte] & state) >> bit) { // byte and bit are the mouse button flags
        // button is pressed
    }

I have tried other wireless mouse devices at my disposal and they seem to work fine. It is ONLY the logitech wireless mice (at least... that have been reported)

ekilfoil (ekilfoil) wrote :

I was incorrect. It seems that querying the master pointer does not give the button state of the slave pointer even for normal mice.

I did some more digging on this today, and I found that an HP branded wireless USB mouse has the same issue. With this mouse (as well as the logitech wireless mouse), the return from:

    xdev = XListInputDevices(GDK_WINDOW_XDISPLAY(rootwin), &ndevices_return);

lists the USB device twice, but both have xdev[num].use == 3 (IsXExtensionKeyboard as defined in X11/XI.h).

I think the problem is that one of those devices should have the use member set to 4. The attached xinput list provided by Locke above shows this correctly with one device as a pointer and one as a keyboard, but I'm assuming the xinput program is using the XI2 API.

With a simple little program to list the devices and print the use member:

13 devices found
Virtual core pointer: use is 0
Virtual core keyboard: use is 1
Virtual core XTEST pointer: is a pointer
Virtual core XTEST keyboard: use is 3
Power Button: use is 3
Power Button: use is 3
G15 Gaming Keyboard: use is 3
G15 Gaming Keyboard: use is 3
Logitech USB-PS/2 Optical Mouse: is a pointer
Macintosh mouse button emulation: is a pointer
G15 Extra Keys: use is 3
BTC USB Multimedia Cordless Kit: use is 3
BTC USB Multimedia Cordless Kit: use is 3

While xinput prints:

      BTC USB Multimedia Cordless Kit id=14 [slave pointer (2)]
      BTC USB Multimedia Cordless Kit id=13 [slave keyboard (3)]

ekilfoil (ekilfoil) wrote :

I'm almost positive this is a problem in xorg-server. I'm working on a patch for this.

affects: xinput (Ubuntu) → xorg-server (Ubuntu)
Changed in xorg-server (Ubuntu):
assignee: nobody → ekilfoil (ekilfoil)
status: New → In Progress
ekilfoil (ekilfoil) wrote :

Swapping the order of the test in Xi/listdev.c that determines whether a device is a pointer or a keyboard properly detects my devices (OEM USB wireless mouse/kb combo) -- one as a keyboard and one as a pointer.

I have confirmed that querying the device shows the button state for the pointer device and the X server responds with b->down as expected for various button states. libXi receives the button state information properly as well -- however it doesn't seem to be passed through to the end application's call to XQueryDeviceState.

I have not finished investigating the cause of that problem, but I have confirmed that this is either a problem in my code or within libXi. This simple patch, fixes the detection device type problem and that is all I could find wrong in Xorg.

ekilfoil (ekilfoil) wrote :

I think that's as far as I can go with this.

Changed in xorg-server (Ubuntu):
assignee: ekilfoil (ekilfoil) → nobody
status: In Progress → Confirmed
ekilfoil (ekilfoil) wrote :

I've put this bugfix in a PPA in case anyone wants to test it and confirm:

https://launchpad.net/~ekilfoil/+archive/xserver-xorg

Reed Lipman (rmlipman) wrote :

Confirmed ekilfoil's PPA works with mangler trunk (r803)

Ekilfoil accidentally submitted a reverse patch. Here is a forward patch made against xorg-server's git repo.

Created an attachment (id=36994)
patch that was attached to Ubuntu bug

As discussed in the Ubuntu bug report found here:
https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/575465

I did some more digging on this today, and I found that an HP branded wireless USB mouse has the same issue. With this mouse (as well as the logitech wireless mouse), the return from:

    xdev = XListInputDevices(GDK_WINDOW_XDISPLAY(rootwin), &ndevices_return);

lists the USB device twice, but both have xdev[num].use == 3 (IsXExtensionKeyboard as defined in X11/XI.h).

I think the problem is that one of those devices should have the use member set to 4. The attached xinput list provided by Locke above shows this correctly with one device as a pointer and one as a keyboard, but I'm assuming the xinput program is using the XI2 API.

With a simple little program to list the devices and print the use member:

13 devices found
Virtual core pointer: use is 0
Virtual core keyboard: use is 1
Virtual core XTEST pointer: is a pointer
Virtual core XTEST keyboard: use is 3
Power Button: use is 3
Power Button: use is 3
G15 Gaming Keyboard: use is 3
G15 Gaming Keyboard: use is 3
Logitech USB-PS/2 Optical Mouse: is a pointer
Macintosh mouse button emulation: is a pointer
G15 Extra Keys: use is 3
BTC USB Multimedia Cordless Kit: use is 3
BTC USB Multimedia Cordless Kit: use is 3

While xinput prints:

      BTC USB Multimedia Cordless Kit id=14 [slave pointer (2)]
      BTC USB Multimedia Cordless Kit id=13 [slave keyboard (3)]

Swapping the order of the test in Xi/listdev.c that determines whether a device is a pointer or a keyboard properly detects my devices (OEM USB wireless mouse/kb combo) -- one as a keyboard and one as a pointer.

Ezra Reeves (ezrareeves) on 2010-07-13
Changed in xorg-server (Ubuntu):
assignee: nobody → Ezra Reeves (ezrareeves)
tags: added: patch-forwarded-upstream
Dave K (mewse) wrote :

The Xserver version in Elikfoil's PPA fixed the problem for me on Lucid with Mangler 1.2.0. I'm running a Logitech wireless combo as described, and after using the PPA there is an entry for "Logitech USB Receiver" under Settings > General > Select Mouse in Mangler.

Thanks, Elikfoil, hope this bug is fixed upstream soon.

Changed in xorg-server:
importance: Unknown → Medium
status: Unknown → Confirmed
ekilfoil (ekilfoil) wrote :

I spoke with the Xorg devs on IRC and this patch has been set for pull request in upstream's master git. However, Ubuntu needs to backport this to 10.10 and update. I do not plan on maintaining a PPA for this fix now that upstream has corrected the problem. This bugfix consists of moving two lines of code. The patch attached above is identical for the current version of Xorg.

Bryce Harrington (bryce) on 2010-12-14
tags: added: maverick
Bryce Harrington (bryce) wrote :

+1 This looks fine to me to SRU for maverick.

For natty, it looks like we'll get the fix when we merge the newer xserver.

Changed in xorg-server (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Medium
summary: - unable to use mouse buttons to trigger events in mangler
+ [Needs SRU] unable to use mouse buttons to trigger events in mangler
Changed in xorg-server (Ubuntu Maverick):
status: New → Triaged
importance: Undecided → Medium
Bryce Harrington (bryce) wrote :

For the natty task, we merely need to verify the patch is already included in the xserver.

Daniel Holbach (dholbach) wrote :

It is.

daniel@devel:~/xorg-server-1.9.0.902$ patch -p1 -R < /home/daniel/xorg-xi-usb-wireless-mouse-kb.patch
patching file Xi/listdev.c
daniel@devel:~/xorg-server-1.9.0.902$ patch -p1 < /home/daniel/xorg-xi-usb-wireless-mouse-kb.patch
patching file Xi/listdev.c
daniel@devel:~/xorg-server-1.9.0.902$

Changed in xorg-server (Ubuntu Natty):
status: Triaged → Fix Released
Daniel Holbach (dholbach) wrote :

Can somebody prepare a patch for maverick (follow https://wiki.ubuntu.com/SRU) and test it there?

Bryce Harrington (bryce) wrote :

Uploaded to -proposed

Changed in xorg-server (Ubuntu Maverick):
status: Triaged → Fix Committed
Bryce Harrington (bryce) on 2011-01-07
description: updated
ekilfoil (ekilfoil) on 2011-01-07
description: updated
Martin Pitt (pitti) wrote :

There are now two xorg-server uploads in the proposed queue, for bug 575465 and bug 670016. Please either reupload 7.3 with an appropriate -v to include the two proposed versions, or better yet, just upload a 2:1.9.0-0ubuntu7.2 which has both changes? Also, there's still 7.1 in proposed which causes the regression in bug 680811. If we stack two more uploads on top of that, it'll quickly get unmanageable.

Accepted xorg-server into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server - 2:1.9.0-0ubuntu7.3

---------------
xorg-server (2:1.9.0-0ubuntu7.3) maverick-proposed; urgency=low

  * debian/patches/209_xorg-xi-usb-wireless-mouse-kb.patch:
    - Backport of upstream patch which swaps order of detection of a
      device as pointer or keyboard. Fixes certain mouse models that
      get detected as keyboards.
      (LP: #575465)

xorg-server (2:1.9.0-0ubuntu7.2) maverick-proposed; urgency=low

  * Move gesture event handling to server in non-signal context
    (LP: #670016)
    - Add debian/patches/208_gestures_through_event_queue.patch
 -- Bryce Harrington <email address hidden> Thu, 06 Jan 2011 15:07:12 -0800

Changed in xorg-server (Ubuntu Maverick):
status: Fix Committed → Fix Released
Changed in xorg-server:
importance: Medium → Unknown
Changed in xorg-server:
importance: Unknown → Medium
Changed in xorg-server:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.