• 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
getting CD volume Info via IOToolKit mechanisms
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting CD volume Info via IOToolKit mechanisms


  • Subject: getting CD volume Info via IOToolKit mechanisms
  • From: Ken Hawkins <email@hidden>
  • Date: Wed, 17 Mar 2004 07:51:40 -0800

I have plowed through a few of the examples and see how i can get
notified, etc. when a CD goes in and out, etc. however it seems easier
to distinguish the Volume contents and such via 'FSGetVolumeInfo'
however you need a volume number for this. is there a bridge between an
io_iterator_t and a given FS volume number?

alternately can i add the dictionary structure within the dictionary
that i am creating to pass to 'IOServiceAddMatchingNotification'?

if so has anyone done this before an maybe has an example? i have not
touched it and seen the MMC commands but am not sure how they would fit
in a dictionary...

below is how i am setting up the callback to know when devices come
online (for reference);

matchingDict = CFDictionaryCreateMutable ( kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks );

subDict = CFDictionaryCreateMutable ( kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks );

//
// Note: We are setting up a matching dictionary which looks like the
following:
//
// <dict>
// <key>IOPropertyMatch</key>
// <dict>
// <key>SCSITaskDeviceCategory</key>
// <string>SCSITaskAuthoringDevice</string>
// </dict>
// </dict>
//

// Create the port on which we will receive notifications. We'll wrap
it in a runLoopSource
// which we then feed into the runLoop for async event notifications.
deviceNotifyPort = IONotificationPortCreate ( kIOMasterPortDefault );
if ( deviceNotifyPort == NULL )
{
return;
}

// Get a runLoopSource for our mach port.
runLoopSource = IONotificationPortGetRunLoopSource ( deviceNotifyPort
);

// Create a dictionary with the "SCSITaskDeviceCategory" key =
"SCSITaskAuthoringDevice"
CFDictionarySetValue ( subDict,
CFSTR ( kIOPropertySCSITaskDeviceCategory ),
CFSTR ( kIOPropertySCSITaskAuthoringDevice ) );

// This shows you how to fine-tune the matching.

// Insert the "device-type" key = "DVD"
CFDictionarySetValue ( subDict,
CFSTR ( "device-type" ),
CFSTR ( "DVD" ) );


// Add the dictionary to the main dictionary with the key
"IOPropertyMatch" to
// narrow the search to the above dictionary.
CFDictionarySetValue ( matchingDict,
CFSTR ( kIOPropertyMatchKey ),
subDict );

// Retain a reference since we arm both the appearance and
disappearance notifications
// and the call to IOServiceAddMatchingNotification() consumes a
reference each time.
matchingDict = ( CFMutableDictionaryRef ) CFRetain ( matchingDict );

kernErr = IOServiceAddMatchingNotification ( deviceNotifyPort,
kIOFirstMatchNotification,
matchingDict,
AppearedNotificationHandler,
( void * ) self,
&deviceAppearedIterator );



thanks,
ken;
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Sound Input Values
  • Next by Date: input byte stream conversion into float
  • Previous by thread: Re: Sound Input Values
  • Next by thread: input byte stream conversion into float
  • Index(es):
    • Date
    • Thread