How to disable Alps touchpad while typing or when using an external mouse in Linux

To reach a desired effect on a notebook from the DELL new series is not easy. To start with, there's no specification…. A patch exists, but it's for scrolling and tapping only and you have to recompile kernel. Full control by synaptics driver is not acessible.
Trackpoint and Touchpad behave as one device. It's a bad news, you have to use both or none.

Ghrrr...... There's what I want:

My solution for disabling touchpad when using an external mouse or while typing on notebook keyboard

Don't worry, several steps are included for a testing purpose only :)
It has been tested on DELL 6410 in Debian Squeeze.
  1. Download touchpad_disable-v2.tar.bz2 and extract it into /usr/local/bin directory. (Yes, it has to be that directory)
    An older version download touchpad_disable.tar.bz2
  2. Plug in an external mouse/mice.
  3. Use 'xinput list' command to list your devices:
    • identify your touchpad (probably 'PS/2 Mouse' or 'AlpsPS/2 ALPS GlidePoint'),
    • identify your external mouse/mice (for example 'Logitech USB-PS/2 Optical Mouse'),
    • identify your keyboard (maybe somethink like 'AT Translated Set 2 keyboard')..
  4. Edit /usr/local/bin/touchpad_disable/disable_xinput and:
    • if your touchpad is not in toDisable array (on the 6th row), append it,
    • if your external mouse/mice is/are not in toDetect array (on the 7th row), append it,
    • enter your keyboard name in KeyboardName variable (on the 14th row).
  5. Unplug your external mouse/mice.
    • execute command /usr/local/bin/touchpad_disable/disable_xinput state off in terminal - the touchpad should stop working (if not, your device is not correctly identified)
    • execute command /usr/local/bin/touchpad_disable/disable_xinput state on in terminal - the touchpad should start working (if not, your device is not correctly identified)
  6. Plug in an external mouse.
    • execute command /usr/local/bin/touchpad_disable/disable_xinput auto in terminal - the touchpad should stop working (if not, your device is not correctly identified)
  7. Unplug the external mouse.
    • execute command /usr/local/bin/touchpad_disable/disable_xinput auto in terminal - the touchpad should start working (if not, your device is not correctly identified)
  8. Copy udev rules as root cp /usr/local/bin/touchpad_disable/90-disable_touchpad-ALPS.rules /etc/udev/rules.d
  9. Reload udev rules as root udevadm control --reload-rules
  10. Start „user-space deamon“ as user /usr/local/bin/touchpad_disable/start_disable_xinput_listen
  11. Test it
  12. A touchpad should be disabled now when a mouse is connected. If that's all you want, skip to the penultimate step (»Append start "user-space deamon" to your startup/session aplication.«)
  13. Execute visudo command and insert these rules:
         Cmnd_Alias KBDDETECTOR_ALIAS = /usr/local/bin/touchpad_disable/touchpad_disable_on_type.py *,/usr/bin/killall --older-than 1s -e touchpad_disable_on_type.py
         ALL ALL=(ALL) NOPASSWD:KBDDETECTOR_ALIAS
       
  14. Execute /usr/local/bin/touchpad_disable/touchpad_disable_on_type.py '<mouse name>' '<keyboard name>' '0.3' 0 test,
    for example:
    /usr/local/bin/touchpad_disable/touchpad_disable_on_type.py 'PS/2 Generic Mouse' 'AT Translated Set 2 keyboard' '0.3' 0 test
    you should get
    .... some lines
    ----------------
    Test devices search
    Mouse found
    Keyboard found
    ----------------
    
    (if not, your device is not correctly identified)
  15. Edit /usr/local/bin/touchpad_disable/disable_xinput again
    • Change USE_touchpad_disable_on_type=0 to USE_touchpad_disable_on_type=1 (on the 12th row)
  16. Start „user-space deamon“ /usr/local/bin/touchpad_disable/start_disable_xinput_listen again, (if there's a runnig instance, it will be killed automatically)
  17. Plug in an external mouse and try touchpad. The touchpad should stop working (if not, something is wrong).
  18. Unplug the external mouse and try typing on keyboard (in deamon terminal you can see information on/off). The touchpad shouldn't work during typing (if not, something is wrong).
  19. Append start "user-space deamon" to your startup/session aplication.
  20. Logout/login and try again

If you don't want to disable touchpad when using an external mouse

Good luck (imega at imega dot cz)