Openbox: disable entire keyboard

1.1k views Asked by At

I'm running Ubuntu Server (16.04.3 LTS) with X, Openbox and Chromium in kioskmode on a touchscreen device. It is starting up as a (non-root) user straight into the kiosk.

There is no need for a mouse or keyboard, so I'm starting X with

startx -- -nocursor

what effectively disables the mouse. But the user still can plug in a keyboard and do all sorts of unwanted things with Chromium. So I'm looking for ways to disable the entire keyboard.

To catch and disable every single key and key combination in Openbox rc.xml seems an impossible task to me. So is there some switch with startx or Openbox to disable the keyboard? (I've tried -nokeyboard but it gives an error. Also -keyboard null doesn't work.)

Or, as a last resort, is there a way to disable keyboard (and mouse) at user login?

1

There are 1 answers

0
mviereck On

xinput is your tool.

Find id of your keyboard with xinput --list. Possible output:

⎡ 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 Webcam                                 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)]

Get id of AT Translated ... keyboard. In this case it is 10. Disable keyboard input with:

xinput --disable 10

As one-liner:

xinput --disable $(xinput list | grep "AT Translated"  | cut -f2 | cut -d= -f2)

(You can do the same with mouse or touchpad, just use matching id).

P.S.: I am not sure if the keyboard entry is visible as long as no keyboard is plugged in, or if an additional one appears after plugging one in. I have no hardware to check that right now. Maybe you have to create an udev rule that watches for new keyboards and runs xinput --disable [...].