[launchd-dev] Launch daemon 0n-Demand on USB Connection/Write

Damien Sorresso dsorresso at apple.com
Thu Jun 4 17:00:11 PDT 2009


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2425 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20090604/b5916d53/attachment.bin>


More information about the launchd-dev mailing list