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: willTerminate() vs message (kIOMessageServiceIsTerminated)



Alec,

Do you have any outstanding I/O when you close the device in willTerminate()? I suspect that some code elsewhere which checks for fpDevice!=NULL is not getting called when you implement willTerminate().

If you have no outstanding I/O, then I suggest you ignore willTerminate() and instead try putting this code into didTerminate().

Rhoads

On Oct 18, 2005, at 4:32 PM, Alec Carlson wrote:

Rhoads,

I have an IOUSBDriver not an IOUSBInterface driver.

Here is the routine source:

bool SMSIWirelessUSB::willTerminate( IOService * provider, IOOptionBits options )
{
XTRACE(this, 0, 0, "willTerminate()");


   fTerminate = true;        // We're being terminated (unplugged)

    // Close the interface(s)
    commReleaseInterface( );

    // Close the device
    if (fpDevice)
    {
        fpDevice->close(this);
        fpDevice = NULL;
    }

    return super::willTerminate( provider, options );
}

The red lines are the same code I have in the in the kIOMessageServiceIsTerminated message.

Alec


on 10/18/05 4:49 PM, Rhoads Hollowell at email@hidden wrote:

Do you call willTerminate() in your superclass?

Rhoads Hollowell
USB Software Team
Apple Computer, Inc.

On Oct 18, 2005, at 3:17 PM, Alec Carlson wrote:

> Dan,
>
> Yes, the provider is closed. The same code gets run in both
> routines. If I have willTerminate() enabled, then I comment out the
> kIOMessageServiceIsTerminated message. If I have
> kIOMessageServiceIsTerminated enabled then I comment out the
> willTerminate() routine. In the kIOMessageServiceIsTerminated case,
> my stop() routine gets called by the ioKit. In the willTerminate()
> case, it doesn’t get called.
>
> Alec
>
 _______________________________________________
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

_______________________________________________ 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
References: 
 >Re: willTerminate() vs message (kIOMessageServiceIsTerminated) (From: Alec Carlson <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.