Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Usage of Terminate and finalize methods in IOUserClient ?



Hi,
I have developed a KEXT for Mac OS X 10.4.7 Intel/PPC for my USB bulk devices.
 
Can anybody please tell what are the advantage of using "finalize" and "terminate" method while developing user client part for the kext.
And what is the use of calling their parent methods? (i.e. super::finalize and super::terminate)
//** Code snippet**
OSDefineMetaClassAndStructors(SentinelUserClient, IOUserClient);
#define super IOUserClient
bool SentinelUserClient::finalize(IOOptionBits options)
{
 bool ret;
 ret = super::finalize(options);
 return ret;
}

bool MyKEXTUserClient::terminate(IOOptionBits options)
{
 bool ret;
 ret = super::terminate(options);
 return ret;
}

//

Below is the exact issue I am facing and want expert advice from your side:

I take two applications, app1 communicating to myUSBDevice1 and app2 communicating to myUSBDevice2 repectively. Now if I plug-out the the usbdevice1, app1 as well as the app2 communication also closes automatically(Ideally only app1 should stop communicating since we plug-out the USB1device). On further digging, I found in system.log following entries called twice

MyKEXTUserClient::finalize

MyKEXTUserClient::finalize

MyKEXTUserClient::terminate

MyKEXTUserClient::terminate

So I commented out the super methods of finalize and terminate and directly returned true in both functions. The made everything work fine!! Now if I plug-out the device1 , the app2 still communicates welll with the usbdevice2 & and only communication with app1 closes. So, Can anybody please tell the importance of finalize and terminate methods ??

All suggestions ,useful pointers are most welcome.

Thanks and Reagrds,

Rohit Dhamija

--
Rohit Dhamija(M) 9818446545

 _______________________________________________
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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.