Nano,
Thanks for the pointer. I looked at the 2004 WWDC DVD and sure enough there
was a discussion during the USB in Mac OSX Session on exactly this problem.
However, I had had limited success getting your Poison Pill working. Here is
the source for my IOUSBInterface kext (whitespace & comments deleted for
brevity):
IOService* PoisonPill::probe( IOService *provider, SInt32 *score )
{
IOService *res;
res = super::probe(provider, score);
return res;
}
bool PoisonPill::start(IOService *provider)
{
UInt8 configValue = 0;
if( !super::start( provider ) )
return false;
if( (fInterface = OSDynamicCast(IOUSBInterface, provider)) == NULL )
{
stop( provider );
return false;
}
fpDevice = fInterface->GetDevice( );
configValue = fInterface->GetConfigValue( );
if( !fpDevice->open(this) )
{
stop( provider );
return false;
}
fpDevice->ReEnumerateDevice( 0 );
fpDevice->SetConfiguration( this, configValue, false );
stop( provider );
return false;
}
void PoisonPill::stop(IOService *provider)
{
fpDevice->close(this);
super::stop( provider );
}
IOReturn PoisonPill::message(UInt32 type, IOService *provider, void *arg)
{
return kIOReturnSuccess;
}
Here is my IOKitPersonalities record:
<key>PoisonPillKext</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.test.driver.PoisonPill</string>
<key>IOClass</key>
<string>PoisonPill</string>
<key>IOProviderClass</key>
<string>IOUSBInterface</string>
<key>bConfigurationValue</key>
<integer>1</integer>
<key>bcdDevice</key>
<integer>0</integer>
<key>bInterfaceNumber</key>
<integer>0</integer>
<key>idProduct</key>
<integer>5123</integer>
<key>idVendor</key>
<integer>2131</integer>
</dict>
My PoisonPill kext does get matched and does run (I deleted the ioLog()¹s
from the source above). However, one of two things happens:
1. If I try to open() the device, the open fails. My stop() routine closes
the device (which it shouldn¹t I know) but when it does that, my real driver
gets matched and loaded just like I want. The AppleUSBComposite driver
gets out of the way. Howsever, this is only working accidently and probably
has a number of nasty side affects.
2. If I don¹t try to open the device (and don¹t close it), then the restart
hangs about 3/4 of the way into the process with the last message displayed
³Waiting for local disks². It will wait forever...
I couldn¹t find any example code for this and the WWDC presentation was a
little vague on where the SetConfiguration() was supposed to go (I assumed
in the start() routine). I may have overly simplified the driver so I may be
missing some important logic which makes this work. Any ideas ?
Thanx -
Alec
on 7/25/05 4:57 PM, Fernando Urbina at email@hidden wrote:
> Search the archives, but this is a starting point:
>
> http://lists.apple.com/archives/usb/2005/May/msg00051.html
>
> --
> Fernando Urbina
> USB Technology Team
> Apple Computer, Inc.
>
> On Jul 25, 2005, at 3:51 PM, Alec Carlson wrote:
>
>> Any advice is welcome I¹d like to get my driver loading on restarts...
>
-----------------------------------------------------------------------
Time is Short, and the Water Rises
-----------------------------------------------------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden
This email sent to email@hidden