Mailing Lists: Apple Mailing Lists

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

Re: IOSerialDriverSync disconnect



You probably have leaked a few references to yourself.  Hot unplugging a driver can be a pain to get right. 

There is no good way of debugging these sorts of issues.  The best you can do is instrument your driver then do a divide and conquer to find the offending leak.

#if 0, almost all of your driver except the start routine and even in there comment out the code that does the creation and registration of the SerialStream.  Does your driver unload then?  Are you getting willTerminate()/didTerminate() calls?  When are you getting your stop() called exactly?

Once you can successfully unload you driver at start() time, start adding functionality a bit at a time until you can't unload it anymore.

Many people recommend overriding the taggedRetain()/taggedRelease() functions and logging every call or setting a brake point.  I have to say that I find this solution just too difficult, and I know how IOKit works.  I really do not recommend this solution as your leaked reference just gets lost in the noise.

Finally remember you are not allowed to teardown you driver until you have been closed from your client watch out for the 'releasePort()'call.

Godfrey

On 05/17/2005, at 22:06 , Jessie Dedecker wrote:

Hello,

I have an USB driver MyDriver that inherits from IOSerialDriverSync and that is used with pppd to communicate over IP with the device.  When I remove the device from the machine the connection does not terminate properly and the driver remains in the registry.  Moreover, when I plug in the cable again, the driver does not respond anymore until I reboot.  The output of ioreg after the usb cable has been unplugged (MyDriver is the class of the driver):

    | |   | +-o AppleUSBOHCI  <class AppleUSBOHCI, registered, matched, active, busy 1, retain count 11>
    | |   |   +-o OHCI Root Hub Simulation@18  <class IOUSBRootHubDevice, registered, matched, active, busy 0, retain count 12>
    | |   |   | +-o AppleUSBHub  <class AppleUSBHub, !registered, !matched, active, busy 0, retain count 4>
    | |   |   | +-o IOUSBInterface@0  <class IOUSBInterface, !registered, !matched, active, busy 0, retain count 5>
    | |   |   | +-o IOUSBUserClientInit  <class IOUSBUserClientInit, !registered, !matched, active, busy 0, retain count 4>
    | |   |   | +-o IOUSBDeviceUserClient  <class IOUSBDeviceUserClient, !registered, !matched, active, busy 0, retain count 5>
    | |   |   +-o IOUSBVendorSpecificDevice@18100000  <class IOUSBDevice, !registered, !matched, inactive, busy 4, retain count 9>
    | |   |     +-o MyDriver  <class MyDriver, !registered, !matched, inactive, busy 2, retain count 6>
    | |   |     | +-o IOSerialStreamSync  <class IOSerialStreamSync, !registered, !matched, inactive, busy 2, retain count 6>
    | |   |     |   +-o IOSerialBSDClient  <class IOSerialBSDClient, !registered, !matched, inactive, busy 1, retain count 5>

I have tried to call terminate() on the IOSerialStreamSync nub and on MyDriver when I get the kIOMessageServiceIsTerminated, but that does not have any effect.

Does anyone know what I am doing wrong?

Thanks,
Jessie
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden

References: 
 >IOSerialDriverSync disconnect (From: Jessie Dedecker <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.