Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Distro and X.org Version Information

I am using Ubuntu 12.10 with xserver-xorg/quantal 1:7.7+1ubuntu4.

Disabling Built-In Keyboard in X11

I have a laptop with a built-in keyboard that no longer recognizes certain letters. I am currently disabling the built-in keyboard by opening a terminal and running the following shell function:

disable_keyboard () {
  xinput --set-int-prop $(
    xinput --list |
    ruby -ane 'if /AT.*keyboard/ then puts $_.match(/(?<==)\d+/) end'
  ) "Device Enabled" 8 0

This works (albeit manually) by disabling the built-in AT Translated Set 2 keyboard while allowing my external Chicony USB Keyboard to continue working. However, I'd really like this to happen automatically during X11 sessions.

I tried modifying my X.org configuration as follows:

# /etc/X11/xorg.conf.d/disable_keyboard
Section "InputClass"
    Identifier      "disable built-in keyboard"
    MatchIsKeyboard "on"
    MatchProduct    "AT Translated Set 2 keyboard"
    Option          "Ignore"    "on"

However, either this is not being sourced when X11 starts, or it is not the correct incantation. How can I correctly configure X11 to use only the USB keyboard?

share|improve this question
Maybe you just write an udev rule that will run your script on connect of USB keyboard? – Eddy_Em Feb 1 '13 at 20:42
@Eddy_Em that probably won't work, since the USB keyboard is probably connected all the time - the rule would fire way before the X would start. Plus it might need to take care of possible multiple X servers. – peterph Feb 3 '13 at 22:13
up vote 3 down vote accepted

Disable Built-In Keyboard and Trackpad with InputClass

One can disable the built-in devices by setting the Ignore option in an input class to true or on. The necessary information to match the devices can usually be gathered from /var/log/Xorg.0.log.

I chose to place my disabling sections in the evdev configuration file that was already present, since on my system both devices use the evdev driver. The sections could just as easily go somewhere else, but I'm unsure about the precedence of the matching rules and decided to play it safe by placing the rules in the same file above other devices that contain a Driver "evdev" line.

# /etc/X11/xorg.conf.d/10-evdev.conf

Section "InputClass"
        Identifier      "Built-In Touchpad"
        MatchIsTouchpad "on"
        MatchProduct    "SynPS/2 Synaptics TouchPad"
        Option          "Ignore" "true"

Section "InputClass"
    Identifier          "Built-In Keyboard"
    MatchIsKeyboard     "on"
    MatchProduct        "AT Translated Set 2 keyboard"
    Option              "Ignore" "true"
share|improve this answer

Your Answer


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.