1

I have a broken keyboard, some of the keys get stuck down. It can not be easily repaired, or removed.

I have used xinput to disable the built in keyboard of my laptop, because it sometimes sends a shift pressed, when it is not pressed.

For some reason, the keyboard randomly becomes re-enabled.

I wrote this script to disable the keyboard, and then to monitor (and re-dis-able it). When I run it, it shows the keyboard re-enabling. I have not yet discovered why this happens.

Does anyone have any idea, how to permanently disable it?
I am using Debian Jessie Gnu/Linux.

#!/bin/bash

function yoga-keyboard-disable () {
    KeyboardToRemove="AT Translated Set 2 keyboard"

    xinput list |
        grep "$KeyboardToRemove" |
        sed -r -e 's/.*id=([0-9]+).*/\1/' |
        xargs xinput float
}

while true
do
    date | tr -d '\n'
    while (xinput | sed -nr -e 's/.*AT Translated Set 2 keyboard[[:blank:]]+id=[0-9]+[[:blank:]]\[floating slave]/ — OK/p') | grep "OK$"
    do
        sleep 5m
        date | tr -d '\n'
    done
    echo
    xinput
    yoga-keyboard-disable
done

Example output of the script:

Mon 24 Sep 13:25:54 BST 2018 — OK
Mon 24 Sep 13:30:54 BST 2018 — OK
Mon 24 Sep 13:35:54 BST 2018 — OK
Mon 24 Sep 13:40:54 BST 2018 — OK
Mon 24 Sep 13:45:54 BST 2018
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Elan Touchpad                             id=15   [slave  pointer  (2)]
⎜   ↳ ELAN Touchscreen                          id=12   [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)]
    ↳ Ideapad extra buttons                     id=14   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=16   [slave  keyboard (3)]
    ↳ Lenovo EasyCamera                         id=13   [slave  keyboard (3)]
Mon 24 Sep 13:45:54 BST 2018 — OK
Mon 24 Sep 13:50:54 BST 2018 — OK

Most of the output is the lines ending in — OK. The keyboard re-attaching is rare (less than once per day).

  • First thing to do is to check the logs (dmesg, /var/log/syslog, /var/log/Xorg.0.log) to see if there is anything in there connected to the re-enabling of the keyboard. – dirkt Sep 25 '18 at 6:26
  • @dirkt I have looked in /var/log/syslog there appears to be a correlation between me detecting the problem, and the log-file showing a flurry of “New USB device found,”. It appears like the USB sub-system is re-booting (they seem to be at times that I return to computer after some time away). There is no other problems, that I notice, caused by this. – ctrl-alt-delor Mar 23 at 10:48
  • Then I would suspect electrical or mechanical problems on the motherboard between and including the USB host controller and the USB sockets. And/or trouble with voltage on the USB provided power dropping to low. You can test the latter with a powered USB hub. – dirkt Mar 23 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.