[sorry, I think I hit the wrong key before]
George,
How are you going to be "called"?
How are you going to "return the result"?
A Unix program only gets one command line when it is run, you cannot give it
another command line without starting again. It also only returns a single
integer value when it quits. Therefore, you will need an additional mechanism
besides the command line and standard return code to handle calls from other
programs unless you run the tool once per call.
Why do you need to have this program stay running in an idle state?
Have you tried just building the USB hardware list as soon as the tool is run,
execute the command line, and then quit? Until you know that this has
performance problems, I suggest starting with a simple design. What you
describe is certainly possible, but creating a daemon - along with an
inter-application protocol for "call" and "result" - will be more difficult to
develop for a beginner.
The easiest way for another application to call a Unix command line program is
to run it once per operation.
Brian Willoughby
Sound Consulting
Begin forwarded message:
I need to write an objective-C foundation tool which does not terminated
except when instructed to. Additionally it needs to continue to respond to
additional input as it is called from another application and monitor for
changes on the USB bus.
What I want it to do is:
When First launched:
-> create a list of objective-C objects based on attached custom USB hardware
-> perform a function based on the command line argument
-> return result
-> wait for next call & idle
When idling:
-> monitor the USB bus in order to add / delete objects from our list based on
insertion / deletion of our custom USB hardware
-> terminate if none of our custom USB hardware exists
-> otherwise wait for next call & idle
On Subsequent call
-> perform a function based on the command line argument
-> return result
-> wait for next call & idle
Currently I have all this running in a Cocoa app, however they now want to be
able to call it from the UNIX command line.
Can anyone direct me to an example program which maintains a run loop (extra
points if it monitors for USB insertions / deletions)?
-----
George Lawrence Storm
Macintosh Applications Development
Edmonds (Seattle), Washington
E-mail: <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden
This email sent to email@hidden