I'm hoping to setup a script to run automatically when a USB device is connected, however I'm not certain how to trigger it.
Unfortunately the USB device isn't a volume, so I can't use the
onmount trigger for it, and while I have a script command to interact with it, it doesn't include an API to trigger actions automatically; i.e- I can verify that it's connected, but I'd have to poll continuously until it is. I don't expect to be able to get the developers to add such functionality any time soon either (if at all).
So, is there a generic way that I can configure a
launchd task that will trigger when a USB device is detected, and thus avoid the need to poll for it? If this isn't possible then are there any other alternatives capable of triggering a shell script when I connect the device?