• 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: USB device prevented from mounting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >USB device prevented from mounting (From: Nick Rogers <email@hidden>)

  • Prev by Date: Re: Darwin-dev Digest, Vol 5, Issue 53
  • Next by Date: Re: problem with sysctlbyname on 10.4 or ppc
  • Previous by thread: USB device prevented from mounting
  • Next by thread: problem with sysctlbyname on 10.4 or ppc
  • Index(es):
    • Date
    • Thread