Automatic configuration of stylus

in order for the stylus to work properly I have to execute a command.
Since the stylus is not in the list of input devices after boot from the beginning, but only after it has been used for the first time, a script at start of x11 will probably not work since the stylus is not available yet.
Is there a possibility to have the command executed at initialization of the stylus, eg. is there a script that is executed automaticly when an input device is added?