Launch daemon 0n-Demand on USB Connection/Write
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. 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). However I am satisfied that there is no direct means to achieve any of these. Correct me if I am wrong. In that case, I would like to know what would be the best approach to achieve this. I would like to know any work around if it exists. The requirement is for 10.4 and above. However, I may be able to persuade the concerned to make that 10.5 in case this can only be achieved in 10.5. I did look for the same in Net. I could find that it was mentioned that it is not possible, I could not get any suggestion on the best approach to be followed with the available infrastructure. Thanks in advance. Regards, Kiran ----------------------------------------------- Robosoft Technologies - Come home to Technology Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
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.
participants (2)
-
Damien Sorresso
-
Kiran B