HostOnNet Blog

Disable Laptop Keyboard in Ubuntu

Looking for Linux Server Admin or WordPress Expert? We can help.

HP Laptop had issue with Keyboard key getting press by itself. It started taking screen shot every now and then. Once screenshot short cut key disabled in Ubuntu keyboard setting, it started playing with scroll lock key.

To disable laptop built in keyboard in Ubuntu, first you need to identify the device id for keyboard.

If you are connecting from a remote system via SSH, you need to run

export DISPLAY=:0

Now run xinput –list command to get list of all input devices

hostonnet@pc4:~$ xinput --list
⎡ 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)]
⎣ 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)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ HP Truevision HD                          id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
    ↳ HP WMI hotkeys                            id=12   [slave  keyboard (3)]
    ↳ HP Wireless hotkeys                       id=13   [slave  keyboard (3)]
hostonnet@pc4:~$ 

xinput command should be run as user that run the GUI (Ubuntu logged in user).

The one above list what we need is

    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]

The ID is 10.

To disable the keyboard, run

xinput set-int-prop 10 "Device Enabled" 8 0

To enable it, run

xinput set-int-prop 10 "Device Enabled" 8 1

Method 2: Disabling on Boot

Edit file /etc/default/grub

vi /etc/default/grub

Find

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Replace it with

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.nokbd"

Regenerate grub.cfg with

update-grub2

Reboot Laptop, Built in keyboard will be disabled by default. No need to run xinput command and manually disable each time.

Posted in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.