site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZudL5o3iZVmzNfuqZzMavo8raSSOh8Sd/a01aYmPZ0uP7mGzwD6GRJEhqRG6Utb14dkqDByklC4LQi9YhESrFM4yXQcGUM20a+yOy2dENUC+allLQOuwUUAhjiBbUtg7WVeS0IvZqTk6k+dKt2b/6aNaFDyEIE8JqHC2uqhn5JE= Edited and inlined... Dear All, 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; } 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. I suspect that examing the panic log, generating your debugging symbols and looking at the backtrace in gdb will point to your problem. That or a 5 minute code review... I'd recommend the first option as a learning experience (it will also take about 5 minutes, maybe 15 the first time and you will use it often). Also , I have another query, In powerStateWillChangeTo function, can we get IOUSBDevice* using IOUSBDevice* pDevice = OSDynamicCast(IOUSBDevice, provider) [Yes, my provider is IOUSBDevice] and your equivalent question in user space would be: IOUSBDevice *pDevice = dynamic_cast<IOUSBDevice *>(provider). Will pDevice return a valid IOUSBDevice if <provider> is_a IOUSBDevice? <http://www.cplusplus.com/doc/tutorial/typecasting.html> hth, Cheers! -H. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On 30/05/06, rohit dhamija <rohit.dhamija@gmail.com> wrote: This email sent to site_archiver@lists.apple.com