本文整理汇总了C++中HWSensorsDebugLog函数的典型用法代码示例。如果您正苦于以下问题:C++ HWSensorsDebugLog函数的具体用法?C++ HWSensorsDebugLog怎么用?C++ HWSensorsDebugLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HWSensorsDebugLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ite_family_enter
bool SuperIODevice::detectITEFamilyChip()
{
// IT87XX can enter only on port 0x2E
port = 0x2E;
ite_family_enter(port);
id = superio_listen_port_word(port, kSuperIOChipIDRegister);
HWSensorsDebugLog("probing device on 0x%x, id=0x%x", port, id);
ldn = 0;
vendor = "";
switch (id) {
case IT8512F:
case IT8712F:
case IT8716F:
case IT8718F:
case IT8720F:
case IT8721F:
case IT8726F:
case IT8620E:
case IT8728F:
case IT8752F:
case IT8771E:
case IT8772E:
model = id;
ldn = kFintekITEHardwareMonitorLDN;
vendor = "ITE";
break;
}
if (model != 0 && ldn != 0) {
HWSensorsDebugLog("detected %s %s, starting address sanity checks", vendor, superio_get_model_name(model));
superio_select_logical_device(port, ldn);
IOSleep(10);
address = superio_listen_port_word(port, kSuperIOBaseAddressRegister);
IOSleep(10);
UInt16 verify = superio_listen_port_word(port, kSuperIOBaseAddressRegister);
IOSleep(10);
ite_family_exit(port);
if (address != verify || address < 0x100 || (address & 0xF007) != 0)
return false;
return true;
}
else ite_family_exit(port);
return false;
}
示例2: HWSensorsDebugLog
/**
* For internal use, do not override
*
*/
void FakeSMCPlugin::stop(IOService* provider)
{
HWSensorsDebugLog("removing handler");
if (OSCollectionIterator *iterator = OSCollectionIterator::withCollection(keyStore->getKeys())) {
while (FakeSMCKey *key = OSDynamicCast(FakeSMCKey, iterator->getNextObject())) {
if (key->getHandler() == this) {
if (FakeSMCSensor *sensor = getSensor(key->getKey())) {
if (sensor->getGroup() == kFakeSMCTachometerSensor) {
UInt8 index = index_of_hex_char(sensor->getKey()[1]);
HWSensorsDebugLog("releasing Fan%X", index);
keyStore->releaseFanIndex(index);
}
}
key->setHandler(NULL);
}
}
OSSafeRelease(iterator);
}
HWSensorsDebugLog("releasing sensors collection");
sensors->flushCollection();
super::stop(provider);
}
示例3: HWSensorsDebugLog
void FakeSMCPlugin::stop(IOService* provider)
{
HWSensorsDebugLog("[stop] removing handler");
if (kIOReturnSuccess != storageProvider->callPlatformFunction(kFakeSMCRemoveKeyHandler, true, this, NULL, NULL, NULL))
HWSensorsFatalLog("failed to remove handler from storage provider");
HWSensorsDebugLog("[stop] releasing tachometers");
// Release all tachometers
if (OSCollectionIterator *iterator = OSCollectionIterator::withCollection(sensors)) {
while (OSString *key = OSDynamicCast(OSString, iterator->getNextObject())) {
if (FakeSMCSensor *sensor = getSensor(key->getCStringNoCopy())) {
if (sensor->getGroup() == kFakeSMCTachometerSensor) {
UInt8 index = index_of_hex_char(sensor->getKey()[1]);
HWSensorsInfoLog("releasing Fan%X", index);
if (!releaseFanIndex(index))
HWSensorsErrorLog("failed to release Fan index: %d", index);
}
}
}
OSSafeRelease(iterator);
}
HWSensorsDebugLog("[stop] releasing sensors collection");
sensors->flushCollection();
super::stop(provider);
}
示例4: HWSensorsDebugLog
bool SuperIOPlugin::addTemperatureSensors(OSDictionary *configuration)
{
HWSensorsDebugLog("adding temperature sensors...");
for (int i = 0; i < temperatureSensorsLimit(); i++)
{
char key[8];
snprintf(key, 8, "TEMPIN%X", i);
if (OSObject* node = configuration->getObject(key)) {
for (int j = 0; j < FakeSMCTemperatureCount; j++) {
if (addSensorFromConfigurationNode(node, FakeSMCTemperature[j].name, FakeSMCTemperature[j].key, FakeSMCTemperature[j].type, FakeSMCTemperature[j].size, kFakeSMCTemperatureSensor, i))
break;
}
if (gpuIndex < 0)
gpuIndex = takeVacantGPUIndex();
if (gpuIndex >= 0) {
snprintf(key, 5, KEY_FORMAT_GPU_HEATSINK_TEMPERATURE, gpuIndex);
if (!addSensorFromConfigurationNode(node, "GPU", key, TYPE_SP78, TYPE_SPXX_SIZE, kFakeSMCTemperatureSensor, i)) {
releaseGPUIndex(gpuIndex);
gpuIndex = -1;
}
}
}
}
return true;
}
示例5: HWSensorsErrorLog
FakeSMCKey *FakeSMCKeyStore::addKeyWithHandler(const char *name, const char *type, unsigned char size, FakeSMCKeyHandler *handler)
{
if (FakeSMCKey *key = getKey(name)) {
FakeSMCKeyHandler *existedHandler = key->getHandler();
if (handler->getProbeScore() < existedHandler->getProbeScore()) {
HWSensorsErrorLog("key %s already handled with prioritized handler %s", name, existedHandler ? existedHandler->getName() : "*Unreferenced*");
return 0;
}
else {
HWSensorsInfoLog("key %s handler %s has been replaced with new prioritized handler %s", name, existedHandler ? existedHandler->getName() : "*Unreferenced*", handler ? handler->getName() : "*Unreferenced*");
}
key->setType(type);
key->setSize(size);
key->setHandler(handler);
return key;
}
HWSensorsDebugLog("adding key %s with handler, type: %s, size: %d", name, type, size);
if (FakeSMCKey *key = FakeSMCKey::withHandler(name, type, size, handler)) {
//KEYSLOCK;
keys->setObject(key);
//KEYSUNLOCK;
updateKeyCounterKey();
return key;
}
HWSensorsErrorLog("failed to create key %s", name);
return 0;
}
示例6: copySymbol
FakeSMCKey *FakeSMCKeyStore::getKey(const char *name)
{
KEYSLOCK;
FakeSMCKey* key = 0;
if (OSCollectionIterator *iterator = OSCollectionIterator::withCollection(keys)) {
// Made the key name valid (4 char long): add trailing spaces if needed
char validKeyNameBuffer[5];
copySymbol(name, validKeyNameBuffer);
while ((key = OSDynamicCast(FakeSMCKey, iterator->getNextObject()))) {
UInt32 key1 = HWSensorsKeyToInt(&validKeyNameBuffer);
UInt32 key2 = HWSensorsKeyToInt(key->getKey());
if (key1 == key2) {
break;
}
}
OSSafeRelease(iterator);
}
KEYSUNLOCK;
if (!key)
HWSensorsDebugLog("key %s not found", name);
return key;
}
示例7: copySymbol
FakeSMCKey *FakeSMCKeyStore::getKey(const char *name)
{
//KEYSLOCK;
OSCollection *snapshotKeys = keys->copyCollection();
//KEYSUNLOCK;
if (OSCollectionIterator *iterator = OSCollectionIterator::withCollection(snapshotKeys)) {
char validKeyNameBuffer[5];
copySymbol(name, validKeyNameBuffer);
while (FakeSMCKey *key = OSDynamicCast(FakeSMCKey, iterator->getNextObject())) {
UInt32 key1 = HWSensorsKeyToInt(&validKeyNameBuffer);
UInt32 key2 = HWSensorsKeyToInt(key->getKey());
if (key1 == key2) {
OSSafeRelease(iterator);
OSSafeRelease(snapshotKeys);
return key;
}
}
OSSafeRelease(iterator);
}
OSSafeRelease(snapshotKeys);
HWSensorsDebugLog("key %s not found", name);
return 0;
}
示例8: HWSensorsDebugLog
bool GPUSensors::start(IOService *provider)
{
HWSensorsDebugLog("Starting...");
if (!provider || !super::start(provider))
return false;
if (!(pciDevice = OSDynamicCast(IOPCIDevice, provider))) {
HWSensorsFatalLog("no PCI device");
return false;
}
if (!(workloop = getWorkLoop())) {
HWSensorsFatalLog("failed to obtain workloop");
return false;
}
if (!(timerEventSource = IOTimerEventSource::timerEventSource( this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &GPUSensors::probeEvent)))) {
HWSensorsFatalLog("failed to initialize timer event source");
return false;
}
if (kIOReturnSuccess != workloop->addEventSource(timerEventSource))
{
HWSensorsFatalLog("failed to add timer event source into workloop");
timerEventSource->release();
return false;
}
timerEventSource->setTimeoutMS(500);
return true;
}
示例9: snprintf
void PTIDSensors::parseTemperatureName(OSString *name, UInt32 index)
{
if (name && readTemperature(index)) {
char key[5];
char str[64];
key[0] = '\0';
if (name->isEqualTo("CPU Core Package DTS") || name->isEqualTo("CPU Package Temperature"))
snprintf(key, 5, KEY_CPU_PACKAGE_TEMPERATURE);
else if (name->isEqualTo("CPU Temperature"))
snprintf(key, 5, KEY_CPU_PROXIMITY_TEMPERATURE);
else if (name->isEqualTo("PCH Temperature") || name->isEqualTo("PCH DTS Temperature from PCH"))
snprintf(key, 5, KEY_PCH_DIE_TEMPERATURE);
else if (name->isEqualTo("MCH DTS Temperature from PCH"))
snprintf(key, 5, KEY_MCH_DIODE_TEMPERATURE);
else if (name->isEqualTo("Ambient Temperature"))
snprintf(key, 5, KEY_AMBIENT_TEMPERATURE);
else {
for (UInt8 i = 0; i < 4; i++) {
snprintf(str, 64, "TS-on-DIMM%X Temperature", i);
if (name->isEqualTo(str)) {
snprintf(key, 5, KEY_FORMAT_DIMM_TEMPERATURE, i);
break;
}
snprintf(str, 64, "Channel %X DIMM Temperature", i);
if (name->isEqualTo(str)) {
snprintf(key, 5, KEY_FORMAT_DIMM_TEMPERATURE, i);
break;
}
}
if (key[0] == '\0') {
for (UInt8 i = 0; i < 8; i++) {
snprintf(str, 64, "TZ0%X _TMP", i);
if (name->isEqualTo(str)) {
snprintf(key, 5, KEY_FORMAT_THERMALZONE_TEMPERATURE, i + 1);
break;
}
snprintf(str, 64, "CPU Core %X DTS", i);
if (name->isEqualTo(str)) {
snprintf(key, 5, KEY_FORMAT_CPU_DIODE_TEMPERATURE, i);
break;
}
}
}
}
if (key[0] != '\0') {
HWSensorsDebugLog("adding %s sensor", name->getCStringNoCopy());
addSensor(key, TYPE_SP78, TYPE_SPXX_SIZE, kFakeSMCTemperatureSensor, index);
}
}
}
示例10: HWSensorsInfoLog
UInt32 FakeSMCDevice::loadKeysFromNVRAM()
{
UInt32 count = 0;
// Find driver and load keys from NVRAM
if (OSDictionary *matching = serviceMatching("IODTNVRAM")) {
if (IODTNVRAM *nvram = OSDynamicCast(IODTNVRAM, waitForMatchingService(matching, 1000000000ULL * 15))) {
useNVRAM = true;
if ((genericNVRAM = (0 == strncmp(nvram->getName(), "AppleNVRAM", sizeof("AppleNVRAM")))))
HWSensorsInfoLog("fallback to generic NVRAM methods");
OSSerialize *s = OSSerialize::withCapacity(0); // Workaround for IODTNVRAM->getPropertyTable returns IOKitPersonalities instead of NVRAM properties dictionary
if (nvram->serializeProperties(s)) {
if (OSDictionary *props = OSDynamicCast(OSDictionary, OSUnserializeXML(s->text()))) {
if (OSCollectionIterator *iterator = OSCollectionIterator::withCollection(props)) {
size_t prefix_length = strlen(kFakeSMCKeyPropertyPrefix);
char name[5]; name[4] = 0;
char type[5]; type[4] = 0;
while (OSString *property = OSDynamicCast(OSString, iterator->getNextObject())) {
const char *buffer = static_cast<const char *>(property->getCStringNoCopy());
if (property->getLength() >= prefix_length + 1 + 4 + 1 + 0 && 0 == strncmp(buffer, kFakeSMCKeyPropertyPrefix, prefix_length)) {
if (OSData *data = OSDynamicCast(OSData, props->getObject(property))) {
strncpy(name, buffer + prefix_length + 1, 4); // fakesmc-key-???? ->
strncpy(type, buffer + prefix_length + 1 + 4 + 1, 4); // fakesmc-key-xxxx-???? ->
if (addKeyWithValue(name, type, data->getLength(), data->getBytesNoCopy())) {
HWSensorsDebugLog("key %s of type %s loaded from NVRAM", name, type);
count++;
}
}
}
}
OSSafeRelease(iterator);
}
OSSafeRelease(props);
}
}
OSSafeRelease(s);
OSSafeRelease(nvram);
}
else {
HWSensorsWarningLog("NVRAM is unavailable");
}
OSSafeRelease(matching);
}
return count;
}
示例11: HWSensorsDebugLog
IOReturn GPUSensors::delayedStartEvent()
{
HWSensorsDebugLog("delayed start...");
onAcceleratorFound(pciDevice);
releaseTimerEventSource(timerEventSource);
return kIOReturnSuccess;
}
示例12: OSDynamicCast
FakeSMCKey *FakeSMCKeyStore::getKey(unsigned int index)
{
//KEYSLOCK;
FakeSMCKey *key = OSDynamicCast(FakeSMCKey, keys->getObject(index));
//KEYSUNLOCK;
if (!key) HWSensorsDebugLog("key with index %d not found", index);
return key;
}
示例13: HWSensorsDebugLog
bool GmaSensors::managedStart(IOService *provider)
{
IOPhysicalAddress bar = (IOPhysicalAddress)((pciDevice->configRead32(kMCHBAR)) & ~0xf);
HWSensorsDebugLog("Fx3100: register space=%08lx", (long unsigned int)bar);
if(IOMemoryDescriptor * theDescriptor = IOMemoryDescriptor::withPhysicalAddress (bar, 0x2000, kIODirectionOutIn)) {
if ((mmio = theDescriptor->map())) {
mmio_base = (volatile UInt8 *)mmio->getVirtualAddress();
/*HWSensorsDebugLog("MCHBAR mapped");
for (int i = 0; i < 0x2f; i += 16) {
HWSensorsDebugLog("%04lx: ", (long unsigned int)i+0x1000);
for (int j=0; j<16; j += 1) {
HWSensorsDebugLog("%02lx ", (long unsigned int)INVID8(i+j+0x1000));
}
HWSensorsDebugLog("");
}*/
}
else {
HWSensorsInfoLog("MCHBAR failed to map");
return false;
}
}
enableExclusiveAccessMode();
//Find card number
gpuIndex = takeVacantGPUIndex();
if (gpuIndex < 0) {
HWSensorsFatalLog("failed to obtain vacant GPU index");
return false;
}
char key[5];
snprintf(key, 5, KEY_FORMAT_GPU_PROXIMITY_TEMPERATURE, gpuIndex);
if (!addSensor(key, TYPE_SP78, 2, kFakeSMCTemperatureSensor, 0)) {
HWSensorsFatalLog("failed to register temperature sensor");
releaseGPUIndex(gpuIndex);
gpuIndex = -1;
return false;
}
disableExclusiveAccessMode();
registerService();
return true;
}
示例14: HWSensorsDebugLog
OSDictionary *FakeSMCPlugin::getConfigurationNode(OSDictionary *root, OSString *name)
{
OSDictionary *configuration = NULL;
if (root && name) {
HWSensorsDebugLog("looking up for configuration node: %s", name->getCStringNoCopy());
if (!(configuration = OSDynamicCast(OSDictionary, root->getObject(name))))
if (OSString *link = OSDynamicCast(OSString, root->getObject(name)))
configuration = getConfigurationNode(root, link);
}
return configuration;
}
示例15: HWSensorsDebugLog
OSDictionary *SuperIOMonitor::lookupConfiguration(OSDictionary *root, OSString *name)
{
OSDictionary *configuration = NULL;
if (root && name) {
HWSensorsDebugLog("looking up for configuration node: %s", name->getCStringNoCopy());
if (!(configuration = OSDynamicCast(OSDictionary, root->getObject(name))))
if (OSString *link = OSDynamicCast(OSString, root->getObject(name)))
configuration = lookupConfiguration(root, link);
}
return configuration;
}