[launchd-dev] OnDemand USB Software

Smith Kennedy smith.kennedy at hp.com
Fri Jul 11 14:06:37 PDT 2008


Greetings,

We did something like this but without launchd being involved: a  
lightweight USB monitor daemon that merely registers for IOKit attach  
notifications, and that launches the "real" processes on device  
connect.  We have been doing this since Mac OS 10.1, and the usb  
monitor daemon consumes nearly zero resources.

But some (including myself) don't like seeing daemons running for no  
good reason.  We had hoped to eliminate that daemon with the  
appearance of launchd in Mac OS 10.4.  Unfortunately, launchd has  
never supported IOKit events in general or USB connection events  
specifically.  I filed Radar # 4297231 back in October 2005, after  
attending WWDC 2005.  In the launchd session's Q&A, I asked about USB  
connection event support, but was told that it didn't support it.  I  
had hoped that my Radar would get it added before Tiger shipped, but  
no such luck.  I asked about it again at WWDC 2006 but was told that  
it remained an open issue, and remains open to this day, unfortunately.

Interestingly, Radar # 4297231 is not flagged as a duplicate of the  
defect list below, but instead is still listed as "Open".  It is  
possible that there are others out there as well (Radar limits my view  
as I am not an Apple employee).

I would love for this to be resolved, if for no other reason than to  
close the book on this particular issue.  I know that launchd is one  
of the projects hosted on macosforge.org.  I have considered working  
on this as a third-party contribution, but cannot tell whether it  
would be accepted by the launchd macosforge project, or by Apple for  
inclusion in Mac OS X.

And time rolls on...

Smith



On Mar 18, 2008, at 4:09 AM, Quinn wrote:

> At 23:23 +0100 17/3/08, Mike Fischer wrote:
>> So far, looking at tn2083 and the man pages, I don't see any way to
>> have a depency on USB or IOKit in general. Am I missing something
>> here?
>
> No, you're not missing something.  This is a much-requested feature
> that we're tracking as <rdar://problem/4551362>.
>
>> If there is no direct support would it make sense to have a very
>> small, lightweight daemon always running that registers for IOKit
>> IOServiceAddMatchingNotification notifications and creates a
>> semaphore file that can be used to trigger the launch of the real
>> daemon for example?
>
> That's a fine way to do it.  I probably wouldn't use a semaphore
> file, because it persists in the file system.  However, there are
> numerous other options available to you.  If I was doing this, I'd
> probably have your main daemon register a UNIX domain socket and have
> your lightweight daemon connect to that socket to trigger a launch.
>
>> BTW: This would be mainly for Leopard, although Tiger would be
>> interesting too.
>
> This approach would work just fine on 10.4.x (x >= 6 if you use UNIX
> domain sockets).
>
> S+E
> --
> Quinn "The Eskimo!"                    <http://www.apple.com/developer/ 
> >
> Apple Developer Relations, Developer Technical Support, Core OS/ 
> Hardware
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev




More information about the launchd-dev mailing list