disable input device like a touchpad under linux

You get a list of all input devices with the command “xinput list“. You will need the id of the device you want do disable or enable. Here is an example output of this command:

~$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
...
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=12	[slave  pointer  (2)]
...

To disable (0) or enable (1) the touchpad with id=12 you can use these commands:

xinput set-prop 12 "Device Enabled" 1
xinput set-prop 12 "Device Enabled" 0