I have a script at /tmp/udev_test.py which gets executed with every USB device attached or detached, using this rule:

SUBSYSTEM=="usb", RUN+="/tmp/udev_test.py"

The script runs, and saves its environment into some file, and everything's OK.

Is there a way to control what USB devices recognized by system using this script?

I tried exit(100) at the end of script, but that didn't prevent attaching.

I googled, but found nothing useful.

Thanks in advance



Seems no one knows, or is not willing to share.

Here is what I did.

Your program gets an environmental variable $DEVPATH and you should deauthorize the device with this path.

Here is an example of deauthorizing a device:

echo 0 > /sys$DEVPATH/authorized

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.