Esempio n. 1
0
IOReturn GPUSensors::probeEvent()
{
    HWSensorsDebugLog("Probe event...");

    if (acceleratorLoadedCheck()) {
        releaseTimerEventSource;
        onAcceleratorFound(pciDevice);
    }
    else if (probeCounter++ == (1000.0f / (float)kGPUSensorsAcceleratorWaitCycle) * 45) {
        releaseTimerEventSource;
        onTimeoutExceeded(pciDevice);
    }
    else {
        if (probeCounter > 0 && !(probeCounter % ((int)(1000.0f / (float)kGPUSensorsAcceleratorWaitCycle) * 15)))
            HWSensorsInfoLog("still waiting for accelerator to start...");
        
        timerEventSource->setTimeoutMS(kGPUSensorsAcceleratorWaitCycle);
    }
    
    return kIOReturnSuccess;
}
Esempio n. 2
0
IOReturn GPUSensors::probeEvent()
{
    HWSensorsDebugLog("Probe event...");
    
    bool acceleratorFound = false;
    
    if (OSDictionary *matching = serviceMatching("IOAccelerator")) {
        if (OSIterator *iterator = getMatchingServices(matching)) {
            while (IOService *service = (IOService*)iterator->getNextObject()) {
                if (pciDevice == service->getParentEntry(gIOServicePlane)) {
                    acceleratorFound = true;
                    break;
                }
            }
            
            OSSafeRelease(iterator);
        }
        
        OSSafeRelease(matching);
    }
    
    if (acceleratorFound) {
        releaseTimerEventSource;
        onAcceleratorFound(pciDevice);
    }
    else if (probeCounter++ == 45) {
        releaseTimerEventSource;
        onTimeoutExceeded(pciDevice);
    }
    else {
        if (probeCounter > 0 && !(probeCounter % 15))
            HWSensorsInfoLog("still waiting for IOAccelerator to start...");
        
        timerEventSource->setTimeoutMS(1000);
    }
    
    return kIOReturnSuccess;
}
Esempio n. 3
0
IOReturn GPUSensors::probeEvent()
{
    HWSensorsDebugLog("Probe event...");

    if (probIsAcceleratorAlreadyLoaded()) {
        releaseTimerEventSource(timerEventSource);

        if (!(timerEventSource = IOTimerEventSource::timerEventSource( this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &GPUSensors::delayedStartEvent)))) {
            HWSensorsFatalLog("failed to initialize delayed startup timer event source");
            return false;
        }

        if (kIOReturnSuccess != workloop->addEventSource(timerEventSource))
        {
            HWSensorsFatalLog("failed to add delayed startup timer event source into workloop");
            timerEventSource->release();
            return false;
        }

        // Wait a little before start
        timerEventSource->setTimeoutMS(kGPUSensorsAcceleratorDelayTime);
    }
    else if (probeCounter++ == (1000.0f / (kGPUSensorsAcceleratorWaitCycle * 45.0f))) {
        releaseTimerEventSource(timerEventSource);
        HWSensorsInfoLog("still waiting for IOAccelerator to start...");
        onTimeoutExceeded(pciDevice);
    }
    else {
//        if (probeCounter > 0 && !(probeCounter % ((int)(1000.0f / (float)kGPUSensorsAcceleratorWaitCycle) * 15)))
//            HWSensorsInfoLog("still waiting for accelerator to start...");

        timerEventSource->setTimeoutMS(kGPUSensorsAcceleratorWaitCycle);
    }
    
    return kIOReturnSuccess;
}