<div dir="ltr"><div dir="ltr">On Wed, Jun 24, 2020 at 11:48 AM Andrew Kohlsmith (mailing lists account) <<a href="mailto:aklists@mixdown.ca">aklists@mixdown.ca</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I wonder if it could be done automatically when the USB device is “connected” rather than through cron.</blockquote><div><br></div><div>In my case, the small dongle for the mouse remains in the laptop all the time, so not an issue.</div><div><br></div><div>But what you want can definitely be done. <br></div><div>For that, you use udev with a vendor id and product id, and the same script as an action.</div><div><br></div><div>Something like the following saved to /etc/udev/rules.d/99-mouse.rules<br></div><div><pre><code>ACTION=="add", ATTRS{vendor}=="abcd", ATTRS{model}=="1234", "SUBSYSTEM=="usb", RUN+="/usr/local/bin/something.sh"</code></pre></div></div></div>