bool OWCDumpIORegistry::start (IOService *provider) { if (!super::start (provider)) return false; kprintf ("OWCDumpIORegistry will dump IORegistry in %d seconds\n", DUMP_DELAY_SECONDS); IOCreateThread (&dumpIORegistry, NULL); return true; }
inline kern_return_t myCreateThread( THREAD_FUNCTION continuation, void* parameter, THREAD_T* new_thread ) { *new_thread = IOCreateThread((IOThreadFunc)continuation, parameter); if(!*new_thread) { return KERN_FAILURE; } return KERN_SUCCESS; }
bool com_milvich_driver_Thrustmaster::handleStart( IOService * provider ) { IOLog("%s: handleStart\n", NAME); // let the super do its thing if(!super::handleStart(provider)) { IOLog("%s: super failed to start\n", NAME); return false; } // get the interface fIface = OSDynamicCast(IOUSBInterface, provider); if(!fIface) { IOLog("%s: The provider is not an IOUSBInterface..\n", NAME); return false; } // open the interface if(!fIface->open(this)) { IOLog("%s: Failed to open the provider\n", NAME); fIface = NULL; return false; } // find the pipe to talk to the iMate over IOUSBFindEndpointRequest request; request.type = kUSBInterrupt; request.direction = kUSBIn; request.maxPacketSize = 0; request.interval = 0; fPipe = fIface->FindNextPipe(NULL, &request); if(fPipe) { //IOLog("%s: Found a pipe! type = %d, direction = %d, maxPacketSize = %04x, interval = %d\n", NAME, request.type, request.direction, request.maxPacketSize, request.interval); } else { IOLog("%s: Couldn't find a pipe\n", NAME); fIface->close(this); return false; } // lets retain things fIface->retain(); fPipe->retain(); // we want to setup a command gate to sync some actions fGate = IOCommandGate::commandGate(this); if(getWorkLoop()->addEventSource(fGate) != kIOReturnSuccess) { IOLog("%s: Failed to add the gate to the work loop\n", NAME); fIface->close(this); return false; } // kick off the read chain if(startReadLoop() != kIOReturnSuccess) { fIface->close(this); return false; } // kick off the init sequence IOCreateThread(initThread, this); return true; }
bool com_ximeta_driver_NDASDiskArrayController::start(IOService *provider) { bool res = super::start(provider); DbgIOLog(DEBUG_MASK_PNP_TRACE, ("Starting\n")); fProvider = OSDynamicCast ( com_ximeta_driver_NDASDevice, provider ); if(!fProvider) { goto exit; } // // Add a retain here so we can keep LanScsiDevice from doing garbage // collection on us when we are in the middle of our finalize method. // fProvider->retain ( ); bool openSucceeded; openSucceeded = fProvider->open (this); if(openSucceeded == false) { goto exit; } fProvider->setController(this); // Create command Gate. fCommandGate = IOCommandGate::commandGate(this, receiveMsgWrapper); if(!fCommandGate) { DbgIOLog(DEBUG_MASK_PNP_ERROR, ("can't create commandGate\n")); return false; } fWorkLoop = (IOWorkLoop *)getWorkLoop(); if (fWorkLoop->addEventSource(fCommandGate) != kIOReturnSuccess) { DbgIOLog(DEBUG_MASK_PNP_ERROR, ("can't add commandGate\n")); return false; } // Create worker Thread. fThreadTerminate = false; if(KERN_SUCCESS != semaphore_create(kernel_task, &fCommandSema, SYNC_POLICY_FIFO, 0)) { DbgIOLog(DEBUG_MASK_PNP_ERROR, ("start::semaphore_create(), failed to Create Command Sema\n")); return false; } if(KERN_SUCCESS != semaphore_create(kernel_task, &fExitSema, SYNC_POLICY_FIFO, 0)) { DbgIOLog(DEBUG_MASK_PNP_ERROR, ("start::semaphore_create(), failed to Create Exit Sema\n")); semaphore_destroy(kernel_task, fCommandSema); return false; } fWorkerThread = IOCreateThread(workerThreadWrapper, this); if(!fWorkerThread) { DbgIOLog(DEBUG_MASK_PNP_ERROR, ("start::IOCreateThread(), failed to Create Thread\n")); semaphore_destroy(kernel_task, fExitSema); semaphore_destroy(kernel_task, fCommandSema); return false; } return res; exit: return false; }