I'm trying to set xinput properties for a USB input device whenever it is connected. I have seen solutions that require a script to run in the background and poll USB devices, but I would like to find a triggered approach rather than one involving user-space polling.

I have tried creating a udev rule that runs a script on device connection, but it appears that the connected device is not yet visible to xinput when the udev add rule is triggered. This appears to be a constant order of events rather than a race condition as adding a sleep command to the script also delays the device being listed in xinput list.

Is there any reliable method of setting xinput properties for devices when they are connected?


The normal method is to write an xorg.conf file, use the InputClass matching methods, and set properties directly in xorg.conf. No script, no race condition, no explicit meddling with udev; it just works, though it doesn't use xinput directly...

See man xorg.conf for details.

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.