2017-02-17 84 views

回答

2

您可以使用udev这个(https://en.wikipedia.org/wiki/Udev

/etc/udev/rules.d udev规则为您的设备执行shell脚本你想

看到https://wiki.archlinux.org/index.php/udev的udev规则。您可以使用USB即VENDORID的productID标识设备为你写剧本

KERNEL=="sd*", ATTRS{idVendor}=="12ba", ATTRS{idProduct}=="58ea", ATTRS{model}=="XYZ42", ATTRS{serial}=="123465789", RUN+="/pathto/script"

https://unix.stackexchange.com/questions/28548/how-to-run-custom-scripts-upon-usb-device-plug-in