Pages

Your Ad Here

This Blog is not to read or go through

because, I have never been such a mess


Search the blog instead

Thursday, June 23, 2011

Disabling / Enabling Keyboard and Mouse in Linux (Xinput)

http://wpkg.org/Disable_/_enable_keyboard_and_mouse_in_Linux


Here is how to do it:
  • First, list the devices your X sees:
$ xinput --list
"Virtual core pointer"  id=0    [XPointer]
"Virtual core keyboard" id=1    [XKeyboard]
"Keyboard2"     id=2    [XExtensionKeyboard]
"Mouse2"        id=3    [XExtensionKeyboard]

  • Now, list details for the mouse (id=3):
$ xinput --list-props 3
Device 'Mouse2':
        Device Enabled (119):   1
        Evdev Reopen Attempts (254):    10
        Evdev Axis Inversion (257):     0, 0
        Evdev Axis Calibration (258):   
        Evdev Axes Swap (259):  0
        Evdev Middle Button Emulation (260):    2
        Evdev Middle Button Timeout (261):      50
        Evdev Wheel Emulation (262):    0
        Evdev Wheel Emulation Axes (263):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (264):    10
        Evdev Wheel Emulation Timeout (265):    200
        Evdev Wheel Emulation Button (266):     4
        Evdev Drag Lock Buttons (267):  0

  • Disable the mouse:
$ export DISPLAY=:0
$ xinput set-int-prop 3 "Device Enabled" 8 0

  • Enable the mouse again:
$ xinput set-int-prop 3 "Device Enabled" 8 1

  • Disable the keyboard:
$ xinput set-int-prop 2 "Device Enabled" 8 0

  • Enable the keyboard again:
$ xinput set-int-prop 2 "Device Enabled" 8 1

  • You may find more details in "man xinput".

No comments:

Your Ad Here