On Jun 3, 2009, at 12:45 AM, Kiran B wrote:
Hello,
From the recent posts in "launchd-dev" lists, it is evident that launchd does not yet support launching of processes based on USB device getting connected.
I have a requirement to launch a daemon whenever a device with specific VendorID is connected.
I am OK even if the daemon gets launched for any device getting connected via USB. In that case, the daemon shall ensure that it is the right device on which it is interested in. In other case it may terminate.
For now, you should have a monitor daemon that keeps track of what's happening with IOKit. When the device you want appears, it asserts demand for your other daemon by sending a message to a Mach port or connecting to a socket. Then your other daemon gets launched on demand.
I am also curious to know whether a daemon can be launched whenever the connected device writes any data on the USB port. (Eg: User interaction with the device would make the device write on USB).
No. If we do implement hardware event-based notifications, it wouldn't be quite this granular. -- Damien Sorresso BSD Engineering Apple Inc.