LaunchDaemon to run when a USB Hub is attached
2
votes
1
answer
733
views
I'm trying to create a LaunchDaemon that runs a script when a USB-C or Thunderbolt dock is connected. I've found several solutions to run a script when a *specific* device is connected. But I need a solution that runs a script when *any* dock is connected.
As virtually all docks include a USB Hub, I tried to identify those and include them in a LauchDeamon: No luck. Then I looked into just triggering a script on any USB device like this:
LaunchEvents
com.apple.iokit.matching
com.apple.device-attach
IOProviderClass
IOUSBHostDevice
IOMatchLaunchStream
IOMatchStream
(Not the complete files)
Basically the same approach I've found for specific devices, but removing the device identifiers. Also no luck.
I've found *EventScript* . This application can run a script when a USB device is attached. But I prefer a solution that leverages macOS built-in tools/capabilities.
Asked by Volsk
(3150 rep)
Jul 25, 2022, 01:34 PM
Last activity: May 19, 2025, 02:05 AM
Last activity: May 19, 2025, 02:05 AM