thinkpad trackpoint detected as mouse

Bug #799968 reported by scnaifeh
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Touchpad-indicator
Fix Committed
Undecided
Unassigned

Bug Description

When "Disable touchpad when mouse plugged" option is selected on a Lenovo/IBM thinkpad with dual trackpoint/trackpad pointing devices, touchpad-indicator appears to detect the trackpoint as a plugged mouse, and disables the touchpad.

Revision history for this message
scnaifeh (scnaifeh) wrote :

I'm using version 0.8.0.6.

Revision history for this message
Lorenzo Carbonell (lorenzo-carbonell) wrote :

Please,

could you run "xinput list" in the Terminal and send the output?

Thanks

Revision history for this message
scnaifeh (scnaifeh) wrote :

xinput list produces

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=11 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
    ↳ Power Button id=6 [slave keyboard (3)]
    ↳ Video Bus id=7 [slave keyboard (3)]
    ↳ Sleep Button id=8 [slave keyboard (3)]
    ↳ Integrated Camera id=9 [slave keyboard (3)]
    ↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
    ↳ ThinkPad Extra Buttons id=13 [slave keyboard (3)]

Revision history for this message
Prabhjot (prabhjotsbhatia) wrote :

Hi,
I'm a newbie to python programming, I tried debugging the application.
I added the following lines after line 42 in watchdog.py:

logfile=open("/home/prabhjot/Touchpad-Indicator.log", "a")
    for item in mice:
 logfile.write("Mouse Detected: %s\n" % item)

Indeed, the output showed it detected not one, but 4 devices:

Mouse Detected: Device(u'/sys/devices/pci0000:00/0000:00:1d.2/usb7/7-2/7-2.3/7-2.3:1.0/input/input7/event7')
Mouse Detected: Device(u'/sys/devices/pci0000:00/0000:00:1d.2/usb7/7-2/7-2.3/7-2.3:1.0/input/input7/mouse0')
Mouse Detected: Device(u'/sys/devices/platform/i8042/serio2/input/input8/event8')
Mouse Detected: Device(u'/sys/devices/platform/i8042/serio2/input/input8/mouse1')

Also, ln 49, ln 100 is_mouse(device) didn't detect these devices as mice. I think you should reconsider replacing this code for monitor.filter_by()

BTW, "xinput list" output on my Dell Inspiron 1525 is :

~$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Broadcom Corp id=11 [slave pointer (2)]
⎜ ↳ PS/2 Mouse id=13 [slave pointer (2)]
⎜ ↳ AlpsPS/2 ALPS GlidePoint id=14 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
    ↳ Video Bus id=6 [slave keyboard (3)]
    ↳ Power Button id=7 [slave keyboard (3)]
    ↳ Sleep Button id=8 [slave keyboard (3)]
    ↳ Laptop Integrated Webcam id=9 [slave keyboard (3)]
    ↳ Broadcom Corp id=10 [slave keyboard (3)]
    ↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
    ↳ Dell WMI hotkeys id=15 [slave keyboard (3)]

Keep up the good work!! :)

Prabhjot

Revision history for this message
Prabhjot (prabhjotsbhatia) wrote :

I wrote a workaround, specific to my system:

watchdog.py:
{Replace full function is_mouse_plugged()}

def is_mouse_plugged():
    """Return True if there is any mouse connected"""
    global udev_context
    allowed_mice=("Device(u'/sys/devices/pci0000:00/0000:00:1d.2/usb7/7-2/7-2.3/7-2.3:1.0/input/input7/event7')", "Device(u'/sys/devices/pci0000:00/0000:00:1d.2/usb7/7-2/7-2.3/7-2.3:1.0/input/input7/mouse0')", "Device(u'/sys/devices/platform/i8042/serio2/input/input8/event8')", "Device(u'/sys/devices/platform/i8042/serio2/input/input8/mouse1')")

    mice = udev_context.list_devices(subsystem="input", ID_INPUT_MOUSE=True)
    mice_list=["0","2"] # to initialize a list: inelegant, but works
    for item in mice:
 mice_list.append(str(item))
    for item in allowed_mice:
 mice_list.remove(item)
    mice_list.remove("0") # remove dummy elements
    mice_list.remove("2")
    if len(list(mice_list)) == 0:
        return False
    else:
 return True

Basically I excluded the existing input devices on my system from the list. Something of this sort can be used until a fix is developed.

I think most distributions would categorize the touchpad as a mouse/pointing device.

One method to fix this could be to develop a config UI to make configurations on the program's first run. The UI could ask the user to detach all external devices and then populate the list, as above. Touchpads are mostly used in portable computers, so we can safely assume that there would be few changes in the intrinsic hardware.

Prabhjot

Revision history for this message
Miguel Ángel Santamaría Rogado (gabiel) wrote :

Helo Prabhjot;

just a pair of details:

First, there aren't four "real" devices detected; just two. If you look carefully you can see that the devices are input7 and input8; and then there are two "logical" devices for each of them (input7 gets event7 and mouse0; input8 gets event8 and mouse1). This is because the way udev and the kernel itself works. As we only want to know if there is "any mouse" we don't need to care about how many devices are considered a mouse or not, we only need to know if at least there is one (logical or real); so the original code works.

Second, for is_mouse() to work, you must be sure that you pass it a pyudev.Device object. In any other case it will not work (and doesn't have to).

Third. We relay in udev (pyudev) for all the dirty work in the watchdog. So, if it incorrectly believes that a device is a mouse (or not) touchpad-indicator will not work. I'm still studing pyudev documentation, so maybe there is a better way for inquiring the system about devices. Also, I fear that some devices just identifies itself in a wrong way.

If you want to look at the pyudev documentation you can get it here: http://packages.python.org/pyudev/index.html

Regards, Miguel Angel.

PD: There is a problem with your workaround; the device path is "dynamic". If you unplug and plug a device it can get a different path each time.

Revision history for this message
Prabhjot (prabhjotsbhatia) wrote :

Dear Miguel,
The 4 devices as detected are intrinsic to the laptop , when no external device is attached.
It is very rare that these devices will be, as you say "unplugged" and plugged in again. since they comprise of basically the touchpad and virtual mouse pointers. (no external connections)

If you see my my workaround carefully, it *ignores* these devices when computing whether a new device has been plugged in. I've tested this code between numerous system restarts, and so far haven't found a glitch.
Removing even one integrated device from the list will disable the touchpad even when no external mouse is connected.
You can verify this for your convenience.

Regards,
Prabhjot Bhatia

Revision history for this message
Miguel Ángel Santamaría Rogado (gabiel) wrote :

Hello Prabhjot,

I don't doubt that your solution works in your case. But you must keep in mind that it doesn't have to work always. For example, I own a laptop (compaq r4000) that incorporates a handy button to turn off and on the touchpad; if I use it, the touchpad device path change.

In this case, and with your solution, I will need to quit touchpad-indicator; find a way to execute it for the "first time"; follow on-screen instructions to detach all devices; and then, I could use the touchpad again. Also, I can reboot the computer and hope that the touchpad gets the same device path. In both cases, it's not an elegant solution.

I don't say that your idea is bad; just that it's a bad idea to use something that is dynamic to identify a precise device. For example, we could use the device name, or the vendor and device id. With that we could even make a list of devices that incorrectly identify themselfs, and use it across diferent systems; without force the user to remove anything.

Regards, Miguel Angel.

Revision history for this message
Miguel Ángel Santamaría Rogado (gabiel) wrote :

Hello,

I'm changing the mouse detection in touchpad-indicator. If you can, run the attached script and copy the output.

Put the script in /usr/share/touchpad-indicator; the output can be very long, so better direct it to a file and attach it.

Regards, Miguel Angel.

Changed in touchpad-indicator:
status: New → In Progress
Revision history for this message
scnaifeh (scnaifeh) wrote :

Here is the output from the python script.

Revision history for this message
Miguel Ángel Santamaría Rogado (gabiel) wrote :

Hello scnaifeh,

test the modified watchdog. It must ignore the trackpoint.

Just replace /usr/share/touchpad-indicator/watchdog.py with the attached watchdog.py.

Regards, Miguel angel.

Changed in touchpad-indicator:
status: In Progress → Fix Committed
Revision history for this message
scnaifeh (scnaifeh) wrote :

This fixed it for me.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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