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.

A week ago, I spilt the contents of my cup onto my laptop keyboard. Half of the keys no longer work, except one! The letter Q which is very active regularly.

This is very disturbing as I work.

Is there a way to disable the internal keyboard of a laptop?

Is it possible with xmodmap?

share|improve this question

migrated from stackoverflow.com Jul 7 '12 at 22:05

This question came from our site for professional and enthusiast programmers.

    
What brand and model laptop is it? –  Mitch Aug 21 '12 at 21:18
    
it's HP pavilion dv9000 –  atmon3r Aug 21 '12 at 21:31
4  
The most straightforward way would be to lift the keyboard and disconnect it from the motherboard. You can then place it right back down where it was, sans the connection. This way the keyboard will be disabled after reinstalls and you wont need to bother with software. See this link, about halfway down the page where it gets to the keyboard: insidemylaptop.com/… –  Mark Paskal Aug 21 '12 at 22:00
add comment

4 Answers 4

up vote 15 down vote accepted
+50

You can use xinput to float the input device under X.

  1. Execute the command xinput list to list your input devices.
  2. Locate AT Translated Set 2 keyboard and take note of its id number; this will be used to disable the keyboard. Also, take note of the number at the end, [slave keyboard (#)]; this is the id number of the master, which will be used to re-enable your keyboard.
  3. To disable the keyboard, execute the command xinput float <id#>, where <id#> is your keyboard's id number. For example, if the id was 10, then the command would be xinput float 10.
  4. To re-enable the keyboard, execute the command xinput reattach <id#> <master#>, where master is that second number we noted down. So if the number was 3, you would do xinput reattach 10 3.

Here's a demonstration:

$ 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)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=12   [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4004   id=13   [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)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
$ xinput float 10
$ 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)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=12   [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4004   id=13   [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)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
∼ AT Translated Set 2 keyboard              id=10   [floating slave]
$ xinput reattach 10 3
$ 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)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=12   [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4004   id=13   [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)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
share|improve this answer
    
I am interested by this solution! my xinput pastebin.com/puDxQaZ8 so I guess that would be it: xinput float 14 This query is reversible? how to enable keyboard after this? –  atmon3r Aug 21 '12 at 22:23
1  
You would use the reattach argument to reattach it. xinput reattach 14 3 –  Ignacio Vazquez-Abrams Aug 21 '12 at 22:25
    
Perfect! this is exactly what I needed, you get my bounty =) –  atmon3r Aug 22 '12 at 20:31
    
Perfect answer - was looking for this too. any of the keys on my laptop stopped working so now keep an external keyboard over it and it kept pressing the control key and what not. This fixed it up, thanks! –  asymptotically Dec 15 '12 at 22:08
add comment

I thought of 2 ways you can do this:

  1. By setting up a wrong model for your laptop keyboard in xorg.conf ?

  2. By installing Lock-keyboard-for-Baby

`Lock-keyboard-for-Baby or lk4b in short, is a small program which locks your keyboard but leaves your mouse free. I wrote it because my niece likes to bash away at my keyboard whenever she sees me sit down at it. Keys typed on a keyboard can have disastrous consequences and I didn't want to lock my screen all the time with a screensaver.

When started, lock-keyboard-for-baby opens a small window which grabs the keyboard and echos keys which are typed. By default, it tells you what to type to quit ("Quit Now").

Unlike a screensaver, your screen is not blocked and the mouse still partially works, so you can still see what is on your screen - keep watching tv / video and/or read a document using the mouse to scroll.`

Requirements:

· GTK >= 2.x · perl GTK2 bindings (perl-gtk2 or gtk2-perl depending on your system)

share|improve this answer
    
this is not exactly what I need, I need to use my usb keyboard, but your code is very useful! ;) –  atmon3r Aug 21 '12 at 22:28
    
Lock-keyboard-for-Baby will let you disable your internal keyboard while mainting the use of the external –  LnxSlck Aug 22 '12 at 0:49
add comment

One sure way to disable it is to unplug the signal cable. You need to pop up the keyboard for that. For information on how to do that, check out the Maintenance and Service Guide for the HP Pavilion dv9000 and dv9200 Notebook PC .

Now there is a way to disable the keyboard using xinput. T do that, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

To list the devices your X

xinput --list

To disable the keyboard:

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

To enable the keyboard again:

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

If you get a error about permissions, use the commands above with sudo.

If you're interested in buying a new keyboard for your laptop, you can get it at Hp-Laptop-keyboard.co.uk

share|improve this answer
add comment

Try running xmodmap -e 'keycode 24=' to disable just the Q key. If that works, you could add it it to your ~/.bashrc or global /etc/bash.bashrc file. I got this idea from here, which shows all the key-mappings.

share|improve this answer
    
Wouldn't this disable q in the external keyboard as well? –  Sparhawk Aug 30 '13 at 5:07
add comment

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.