Re: Notifications when iPods are mounted...
Re: Notifications when iPods are mounted...
- Subject: Re: Notifications when iPods are mounted...
- From: Steve Checkoway <email@hidden>
- Date: Fri, 13 Jan 2006 21:58:02 -0800
On Jan 13, 2006, at 7:35 AM, Uli Kusterer wrote:
I've had a similar problem, so I was wondering: Did anyone ever
find out how to get from that info to the actual driver or device
name (i.e. when you plug in a camera, the name that System Profiler
shows for a device in its list)? Checking for that directory may
work for an iPod and yield few false positives, but is there a way
to detect the actual device info the system seems to know? Based on
the BSD pathname maybe?
I'm not quite sure which info you're looking for here, but see below.
I tried a couple of things a year or so ago, but never really
managed to make the connection between the info I got from Cocoa
and IOKit. Since I'll soon have to get back to the project I used
that on, I'd be really interested in any clues you may have.
About the easiest way to do this is to get the notification from
NSWorkspace (or the Carbon event), get the mounted path to the device
and call statfs(2) on that path. Then, if you look at the
f_mntfromname member of the statfs struct, it should start with /dev/
(or _PATH_DEV as defined in <paths.h>). Remove that bit and you
should have disk[#[s#]]. To get the io_object_t that you would use
with the IOKit, you set up a matching dictionary using
IOBSDNameMatching() followed a call to IOServiceGetMatchingServices()
to get an io_iterator_t to iterate over the devices.
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden