Thread-topic: How to eject a device as soon as it appears
User-agent: Microsoft-Entourage/11.3.6.070618
Now that I've solved matching my particular USB based device in my kext
that's derived from the IOCDBlockStorageDriver class, I need to solve the
actual problem I made the kext for:
The USB device, when plugged in, appears as a CDROM Mass Storage device. But
it needs to be ejected (as in "diskutil eject ..." or, more precisely, with
the appropriate ATAPI command to eject a medium) right away again, because
only then the USB device will re-appear as a network (NDIS/CDC) device which
I need to get online in the end. The intermediate appearance as a CDROM
device is only needed for Windows / Linux users, but not on OS X).
So, the question is: When do I best issue the eject command?
By trial and error, I've found that the following works:
My IOCDBlockStorageDriver subclass overwrites the method
virtual IOReturn recordMediaParameters()
from which it then issues these statements:
getProvider()->doEjectMedia ();
return kIOReturnNoMedia;
This works, i.e. it ejects the USB "medium" as soon as it appears, but I
wonder if this is a safe solution. I've seen that issuing the eject call
from other overwritten methods could freeze the driver, sometimes even only
in certain versions of the super classes' implementation while not in others
(i.e. it would work under the PPC driver of OS 10.4.10 but not on the Intel
release, which has a different version of the USB drivers).
So, I'm still a bit concerned that my now-working solution might get broken
in the future because I'm not following some rules I'm not aware of.
Any suggestions?
Oh, BTW, using Disk Arbitration will NOT work, because, due to other bugs in
the USB CDROM device, the disk can't be mounted as it causes errors
beforehand, which would also cause an error dialog shown to the user - all
of which I try to suppress by going in very early with the kext.
Thomas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Ata-scsi-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden