Re: Waiting for a USB device to connect
Re: Waiting for a USB device to connect
- Subject: Re: Waiting for a USB device to connect
- From: Ilan Volow <email@hidden>
- Date: Fri, 7 Sep 2007 09:32:49 -0400
I'd suggest taking a look at the USB notification examples on your
hard drive in /Developer/Examples/IOKit/usb. There's an example that
precisely deals with detecting plugging/unplugging USB devices.
If you wanted to get away with writing little or no code at all, you
could "borrow" Apple's example code, use the USB Prober application
to find out the vendor specific info for your device, copy paste that
information into the example code, and set up some kind of delegate
method in your app that gets called on plugging/unplugging.
-- Ilan
On Sep 6, 2007, at 10:09 AM, Finlay Dobbie wrote:
IOKit is almost certainly the way forward. At that point, this stops
being a Cocoa specific question, and you might want to try one of the
other lists (I believe there is one specifically for USB).
There is a wealth of information and sample code on the ADC site.
-- Finlay
On 06/09/07, Patrick Quinn-Graham <email@hidden> wrote:
Howdy all,
I have a little app that shows information from an attached Huawei
E220 HSDPA modem, does this by reading from /dev/tty.HUAWEIMobile-
Pcui. In general, not too difficult.
The only problem I have is with detecting it being plugged in. It's
easy to check (can we open the /dev/tty?), so a quick check on
startup is fine for that. But, if one isn't plugged in (or it's
unplugged while the app is running), then polling in the app to check
if it is there seems like totally the wrong way to do it - to me at
least.
Can I get a suggestion on the right way to do this? Is their a
notification I could subscribe to for USB devices being plugged in?
Or is there a "won't cause my head to explode too badly" way to watch
(without polling myself) to see if the /dev/tty comes into existence?
cheers,
Patrick Quinn-Graham - +44 78 7217 2213 - http://
about.patrick.geek.nz
There's a 20% chance of tomorrow.
-- /usr/games/fortune
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Ilan Volow
"Implicit code is inherently evil, and here's the reason why:"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden