• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Notifications when iPods are mounted...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notifications when iPods are mounted...


  • Subject: Re: Notifications when iPods are mounted...
  • From: Steve Checkoway <email@hidden>
  • Date: Sat, 14 Jan 2006 03:43:22 -0800


On Jan 14, 2006, at 2:58 AM, Pascal Pochet wrote:

I would do it this way:

iterate thru kIOBlockStorageDeviceClass
for each get the kIOPropertyProtocolCharacteristicsKey (with IOIterateNext)
in this record get the kIOPropertyPhysicalInterconnectTypeKey
if == kIOPropertyPhysicalInterconnectTypeUSB
get the kIOPropertyDeviceCharacteristicsKey
the product name will be in kIOPropertyProductNameKey
you get more info (the child device) by IORegistryEntryGetChildEntry (with the device you got from IOIterateNext at the beginning of the iteration)
get the entry info of the child device
iterate thru it
when the name of the entry is IOFDiskPartitionScheme
get the child entry of the child entry with IORegistryEntryGetChildEntry
get the name IORegistryEntryGetName of this grand child entry
get the kIOBSDNameKey property out of it
you know have a device path
with getmntinfo you can iterate to find the user visible mounted point of this device path
(the f_mntfromname field == the device path, the f_mntonname is the mount point path visible in the Finder)

I tried that. The problem with it is that if you are using the IOKit to notify you when a kIOBlockStorageDeviceClass object or even a "IOUSBMassStorageClass" object is first matched, the finder will not have mounted the device. If you use the Carbon event or the NSWorkspace notification, you are guaranteed that the device has been mounted.


Also, I find it easier to go from child to parent since, despite the fact that you can get an iterator for the parents, I've only seen one parent per object while looking at this and often more than one child. That said, it's easier to go from the IOMedia object that has the kIOBSDNameKey you want up to any other information than it is to go down.

- 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

References: 
 >Notifications when iPods are mounted... (From: <email@hidden>)
 >Re: Notifications when iPods are mounted... (From: Eamon Ford <email@hidden>)
 >Re: Notifications when iPods are mounted... (From: Uli Kusterer <email@hidden>)
 >Re: Notifications when iPods are mounted... (From: Pascal Pochet <email@hidden>)

  • Prev by Date: Re: Trying to change nsoutline disclosure triangle
  • Next by Date: NSTextView keydown alternative?
  • Previous by thread: Re: Notifications when iPods are mounted...
  • Next by thread: NSFileManager copy system plist file
  • Index(es):
    • Date
    • Thread