// this method will override the Platform specific implementation of joinPMtree // it will cause any IOUSBDevice and IOUSBInterface clients to join the IOPower tree as // children of the IOUSHubPolicyMaker for the hub to which they are attached void IOUSBNub::joinPMtree ( IOService * driver ) { IOUSBHubPolicyMaker *hubPolicyMaker = NULL; IOUSBDevice *device = OSDynamicCast(IOUSBDevice, this); IOUSBInterface *interface = NULL; // we should be either an IOUSBDevice or an IOUSBInterface if (device) hubPolicyMaker = device->GetHubParent(); else { interface = OSDynamicCast(IOUSBInterface, this); if (interface && interface->GetDevice()) hubPolicyMaker = interface->GetDevice()->GetHubParent(); } if (hubPolicyMaker) { hubPolicyMaker->joinPMtree(driver); } else { USBLog(1, "%s[%p]::joinPMtree - no hub policy maker - calling through to super::joinPMtree", getName(), this); super::joinPMtree(driver); } }
bool HoRNDISUSBInterface::start(IOService *provider) { IOUSBInterface *intf; intf = OSDynamicCast(IOUSBInterface, provider); if (!intf) { LOG(V_ERROR, "cast to IOUSBInterface failed?"); return false; } fpDevice = intf->GetDevice(); return HoRNDIS::start(provider); }