bool HoRNDIS::start(IOService *provider) { LOG(V_DEBUG, "starting up"); if(!super::start(provider)) return false; if (!fpDevice) { stop(provider); return false; } if (!openInterfaces()) goto bailout; if (!rndisInit()) goto bailout; /* Looks like everything's good... publish the interface! */ if (!createNetworkInterface()) goto bailout; LOG(V_DEBUG, "successful"); return true; bailout: fpDevice->close(this); fpDevice = NULL; stop(provider); return false; }
bool HoRNDIS::start(IOService *provider) { int cfg; int rc; LOG(V_DEBUG, "starting up"); if(!super::start(provider)) return false; fpDevice = OSDynamicCast(IOUSBDevice, provider); if(!fpDevice) { stop(provider); return false; } /* Take control of the device before configuring. */ if (!fpDevice->open(this)) { stop(provider); return false; } /* Initialize and set the appropriate device configuration. */ cfg = probeConfigurations(); if (cfg < 0) goto bailout; rc = fpDevice->SetConfiguration(this, cfg); if (rc != kIOReturnSuccess) { LOG(V_ERROR, "SetConfiguration on RNDIS config failed?"); return false;; } /* Now do the rest of the work to actually bring it up... */ if (!openInterfaces()) goto bailout; if (!rndisInit()) goto bailout; /* Looks like everything's good... publish the interface! */ if (!createNetworkInterface()) goto bailout; LOG(V_DEBUG, "successful"); return true; bailout: fpDevice->close(this); fpDevice = NULL; stop(provider); return false; }