Re: USB device prevented from mounting
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com See: ...Remember: Google is your friend -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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? <http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingH...
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
This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert