bool LPCSensors::addTachometerSensors(OSDictionary *configuration) { HWSensorsDebugLog("adding tachometer sensors..."); char key[7]; UInt16 value = 0; // FAN manual control key addSensorForKey(KEY_FAN_MANUAL, TYPE_UI16, TYPE_UI16_SIZE, kLPCSensorsFanManualSwitch, 0); int location = LEFT_LOWER_FRONT; for (int i = 0; i < tachometerSensorsLimit(); i++) { SInt8 fanIndex; snprintf(key, 7, "FANIN%X", i); if (OSString* name = OSDynamicCast(OSString, configuration->getObject(key))){ if (addTachometer(i, name->getLength() > 0 ? name->getCStringNoCopy() : 0, FAN_RPM, 0, (FanLocationType)location++, &fanIndex)){ if (isTachometerControlable(i) && fanIndex > -1) { tachometerControls[i].number = fanIndex; tachometerControls[i].target = -1; tachometerControls[i].minimum = -1; // Minimum RPM and fan control sensor snprintf(key, 5, KEY_FORMAT_FAN_MIN, fanIndex); addSensorForKey(key, TYPE_FPE2, TYPE_FPXX_SIZE, kLPCSensorsFanMinController, i); // Maximum RPM snprintf(key, 5, KEY_FORMAT_FAN_MAX, fanIndex); fakeSMCPluginEncodeFloatValue(kLPCSensorsMaxRPM, TYPE_FPE2, TYPE_FPXX_SIZE, &value); setKeyValue(key, TYPE_FPE2, TYPE_FPXX_SIZE, &value); // Target RPM and fan control sensor snprintf(key, 5, KEY_FORMAT_FAN_TARGET, fanIndex); addSensorForKey(key, TYPE_FPE2, TYPE_FPXX_SIZE, kLPCSensorsFanTargetController, i); } } else HWSensorsWarningLog("failed to add tachometer sensor %d", i); } } return true; }
void FakeSMCSensor::encodeNumericValue(float value, void *outBuffer) { if (!fakeSMCPluginEncodeFloatValue(value, type, size, outBuffer)) { fakeSMCPluginEncodeIntValue(value, type, size, outBuffer); } }