kernel panic while unloading the driver, USB Bulk device driver KEXT.
kernel panic while unloading the driver, USB Bulk device driver KEXT.
- Subject: kernel panic while unloading the driver, USB Bulk device driver KEXT.
- From: "rohit dhamija" <email@hidden>
- Date: Tue, 30 May 2006 16:34:26 +0530
Dear All,
I am Developing USB bulk device driver , KEXT for my multiple bulk devices and require your expert suggestions getting me out of kernel panic.
I am successful in registering the sleep notification , get the notification as soon as my system sleeps. But the kernel panics as soon as I unload my kext. [I am sure about this, because if I remove sleep functionality, the unloading works fine too.] Below are the steps performed :
////////////////////
I have taken a global variable in myDriver.cpp file,
IOService * rootDomain;
1. I Register the driver as an interested object by calling the IOService method
bool myDriver::start(IOService *provider)
{
bool res = super::start(provider);
if(!res)
{
return false;
}
rootDomain = (IOService *)getPMRootDomain();
if (rootDomain)
{
rootDomain->registerInterestedDriver(this);
}
registerService();
return res;
}
2. Implement the powerStateWillChangeTo method.
IOReturn myDriver::powerStateWillChangeTo ( IOPMPowerFlags, unsigned long, IOService* provider){
if(rootDomain) {
// Do the necessary operations
}
return 0;
}
3. Implement the powerStateDidChangeTo method.
IOReturn myDriver::powerStateDidChangeTo ( IOPMPowerFlags, unsigned long, IOService* ){
return 0;
}
4. Deregister the interested object by calling the IOService method deRegisterInterestedDriver.
void myDriver::stop(IOService *provider)
{
if(rootDomain)
{
deRegisterInterestedDriver (rootDomain );
}
super::stop(provider);
}
/////////////////////////
when I unload the kext, sudo kextunload -v myDriver.kext, the kernel panics. Did anybody encountered the same situation before? What can be the reason behind the same ? Please advice.
Also , I have another query, In powerStateWillChangeTo function, can we get IOUSBDevice* using
IOUSBDevice* pDevice = OSDynamicCast(IOUSBDevice, provider) [Yes, my provider is IOUSBDevice]
Please send your useful suggestions,
Thanks ,
Rohit Dhamija
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden