With the new 10.4 DiskArb API, the explicit mount/unmount callbacks
were removed and instead you are supposed to use
DARegisterDiskDescriptionChangedCallback():
/*!
* @constant kDADiskDescriptionWatchVolumePath
* Predefined CFArray object containing a set of disk description
keys appropriate for
* watching volume mount changes using
DARegisterDiskDescriptionChangedCallback().
*/
However, there's seems to be a bug with this on 10.4.6 (PPC, haven't
tried Intel) in that the callback is never called for volume mounts,
only for volume unmounts.
Here's a test case. If you set a break point on
DiskArbCallback_ChangeNotification(), and then insert a disk (I tried
an AudioCD and a USB FAT flash drive), the breakpoint is not hit when
the volume mounts, but when you eject it, gdb stops.
I've opened a bug report: rdar://4582301, but I wanted to see if
perhaps I'm missing something or if there is an actual bug, is there
some kind of workaround to detect a mount?
Thanks.
// cc -g -O0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -framework
Foundation -framework DiskArbitration -o datest datest.m
#import <DiskArbitration/DiskArbitration.h>
#import <Foundation/Foundation.h>
if (NULL == (daSession = DASessionCreate(kCFAllocatorDefault)))
return (ENOMEM);
DASessionScheduleWithRunLoop(daSession, [[NSRunLoop
currentRunLoop] getCFRunLoop], kCFRunLoopDefaultMode);
// Since there is no explicit mount callback, the Change callback
is how we detect a mount.
DARegisterDiskDescriptionChangedCallback(daSession, NULL,
kDADiskDescriptionWatchVolumePath,
DiskArbCallback_ChangeNotification, NULL);
iD8DBQFEjaUIedHYW7bHtqIRAlOWAKCD6piZOd8pCmlL0Up3wV5gBd+FuACcDxa4
RnR8Zbu1Sea7TFxZcYHfEXg=
=CE3t
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden