Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Thinkpads (e.g. X230 that I'm using) have both a trackpoint and a touchpad. The touchpad is disabled when typing.

However, when I'm using the trackpoint, I often touch the touchpad as well, and generate mouse clicks I'd like to avoid. Does anyone have an idea how disable mouse-clicks on touchpad when trackpoint is in use?

EDIT: also, can someone explain how the option of disabling touchpad when typing works? What is being done behind the scenes? Is it an xinput configuration command, and if yes, which one?

EDIT2: clarification; manually disabling Touchpad (even with a shortcut) is not the issue here. This should work just like the option "disable touchpad when typing", since I use Touchpad and Trackpoint interchangeably (most frequently, I use Touchpad for scrolling and Trackpoint for moving the cursor).

share|improve this question
    
This would be interesting. The way the keyboard is laid out contributes to stray gestures interfering with proper operation. I do not think this is possible with current options, but maybe in the future? I find I have to use two hands to type & point, arching my (right) hand tall, to avoid brushing/nudging the trackpad. –  fleamour Aug 29 '12 at 8:57
    
At the moment, I have disabled mouse clicks with the touchpad - I find that in most cases, I use the buttons on the top of the touch pad anyways. –  January Aug 29 '12 at 9:15

2 Answers 2

Disabling touchpad when keyboard is in use

This function is performed by the syndaemon utility, from the xserver-xorg-input-synaptics package. You can set options such as the idle time, the polling frequency, etc (see runtime help):

Usage: syndaemon [-i idle-time] [-m poll-delay] [-d] [-t] [-k]
  -i How many seconds to wait after the last key press before
     enabling the touchpad. (default is 2.0s)
  -m How many milli-seconds to wait until next poll.
     (default is 200ms)
  ...
  -t Only disable tapping and scrolling, not mouse movements.

Here's the source code for syndaemon.c.

  • The important functions are keyboard_activity(...) and main_loop(...)
  • keyboard_activity uses the XQueryKeyMap API call to get the current state of the keyboard (1 bit per key), and then compares is to the last (old) state; if they are different, it returns 1
  • main_loop polls keyboard_activity every m milliseconds, and based on the "last activity time" and whether keyboard_activity returns true or false, it decides whether to disable or enable the touchpad.
  • The dp_get_device function illustrates how X input devices are enumerated; you should be able to modify this and the keyboard_activity function to also check for any trackpoint activity.

  • The xinput tool lists devices and IDs, for example"

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

  • You can get this (the ID) via the XListInputDevices function

  • After that, you must get a device handle from the ID using the XOpenDevice
  • Then, you use the XQueryDeviceState function to obtain the coordinates of the TrackPoint pointer; similar to the existing loop, you poll this every so often and check if the coordinates have changed (i.e. the TrackPoint is in use), and use that to toggle the touchpad on or off
  • You can use the xinput utility with the query-state switch and device ID to check if your programming is correct, for example:

    $ xinput query-state 12
    2 classes :
    ButtonClass
    button[1]=up
    button[2]=up
    button[3]=up
    button[4]=up
    button[5]=up
    button[6]=up
    button[7]=up
    ValuatorClass Mode=Relative Proximity=In
    valuator[0]=854
    valuator[1]=867
    
  • You are interested in the valuator values, which are X and Y coordinates of the TrackPoint
  • See the xinput source for more tips
  • To modify and rebuild this package:

    1. Get the source with apt-get source...
    2. Make your modifications to tools/syndaemon.c
    3. Disable the existing syndaemon patches by commenting out the 118... and 124... lines in debian/patches/series
    4. Build your modified package with dpkg-buildpackage -us -uc and the deb files will be in the parent directory.
share|improve this answer
1  
Since the bounty will expire in three days, I'd have a deal with you (unless a better answer appears): I'll assign the bounty to you if you will point me to the API for querying a device by the xinput identifier and give a link to a page describing how to create a deb package from modified sources. Then I would be able to apply this approach. Would that be OK? –  January Sep 4 '12 at 14:03
    
Sorry, I have been away. That sounds fine, I'll try to find the information and edit the answer in a few hours. –  izx Sep 7 '12 at 9:31
    
no worries! that's fine –  January Sep 7 '12 at 9:34
1  
As promised, you sir get the bounty. I do not accept the answer, however, because I need to code the solution first. –  January Sep 8 '12 at 9:18
1  
@January, not sure if you did manage to code your solution yet? I've patched syndaemon to support monitoring the trackpoint. github.com/eyko/xf86-input-synaptics (commit here github.com/eyko/xf86-input-synaptics/commit/…) In order to monitor the TrackPoint, you need to pass the -T option flag when running syndaemon. –  Sorenly Jul 7 '13 at 3:20

First thing to be done is to know your touch pad id.So to do that follow these steps

First open terminal and Run this command

~$ xinput --list

Here we get this Touchpad id = <id Number>

After that open keyboard shortcuts then add this below two command with your keyboard shortcuts.

# Disable Touchpad:
xinput set-prop <id number> 'Device Enabled' 0

# Enable Touchpad:
xinput set-prop <id number> 'Device Enabled' 1

enter image description here enter image description here

share|improve this answer
    
Thanks, but disabling Touchpad manually is not the issue here (even with a shortcut), and I know how to do it. The idea is to disable Touchpad automatically while Trackpoint is being used, in a similar way the Touchpad is disabled automatically when keyboard is used (see the setting "disable touchpad while typing" in "Mouse and Touchpad" settings). –  January Aug 31 '12 at 10:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.