Re: USB device prevented from mounting
Re: USB device prevented from mounting
- Subject: Re: USB device prevented from mounting
- From: Terry Lambert <email@hidden>
- Date: Wed, 20 Feb 2008 14:34:56 -0800
On Feb 20, 2008, at 6:45 AM, Nick Rogers wrote:
Hi,
In my app I'm using:
kernResult = IOServiceAddMatchingNotification(
notificationObject,
kIOFirstMatchNotification,
IOServiceMatching(kIOUSBDeviceClassName),
callback,
handler,
&mediaIteratorAdded );
while (IOIteratorNext(mediaIteratorAdded));
CFRunLoopAddSource(CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(notificationObject),
kCFRunLoopDefaultMode);
CFRunLoopRun();
and running it in a separated POSIX thread.
Whenever I insert a USB pen drive, my callback() is called, but
somehow this prevents the USB drive from mounting as /dev/rdisk2 etc.
I not only need the notification, which I'm getting but also need
the device to be mounted.
Subsequently even if I quit the program and then reinsert, it
doesn't get mounted.
I then have to restart the computer (with device inserted) to get
it mounted.
If I restart the computer and then insert the device, it doesn't get
mounted.
I'm using Leopard.
What gets wrong with the device?
See:
<http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_IOKitLib_API/chapter_5_section_3.html
>
I believe the problem may be that you are not running on the RunLoop
thread trying to get a RunLoop notification dispatch. I think you wil
need to use an alternate Mach Port, and call
IODispatchCalloutFromMessage(), if you are going to do it this way.
Here is an example:
<http://www.cocoabuilder.com/archive/message/cocoa/2006/11/24/174961
>
Alternately you could stay on the min thread, and the following source
may be useful:
<http://pcsclite.alioth.debian.org/api/hotplug__macosx_8c-source.html
>
...Remember: Google is your friend
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden