0

I am trying to disable a device at boot.

I have put my commands in the /etc/rc.local file (before the exit 0) but it doesn't seem to work.

Here is how my file looks like :

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo "OK 1" >> /tmp/rclocal_test

xinput disable "N-trig DuoSense"

xinput disable "N-trig DuoSense Pen"

echo "OK 2" >> /tmp/rclocal_test

exit 0

In my rclocal_test file, I only get OK 1.

When I execute rc.local from shell once the system is started, it works fine.

I also tried to put the commands in the gnome-session-properties thing but nothing happens either.

I am suspecting it is a problem of timing (maybe I cannot execute xinput disable at that time ?). Do you have any idea ?

0

From man xinput, we see:

NAME
   xinput - utility to configure and test X input devices

xinput will only work after the user has started the X Window System.

The environment seen by /etc/rc.local does not include the X Window System. The reason that your script does not complete can be seen by running xinput --list in a CTRL-ALT-F1 login:

walt@spong:~(0)$ xinput --list
Unable to connect to X server
walt@spong:~(1)$
0

This answer is for users who use latter versions of Ubuntu.

Temporarily for currently session you can just

xinput disable "DEVICE NAME"

If you put this anywhere inside a startup script file for example in directory /etc/init.d, you need to find out where is the correct point or your command will be executed before xinput started which does nothing of course.

So the easiest way for permanent effect is

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.