Exemple #1
0
double SMCGetTemperature(const char *key)
{
  SMCVal_t val;
  kern_return_t result;
  SMCOpen();
  result = SMCReadKey(key, &val);
  SMCClose();
  if (result == kIOReturnSuccess) {
    // read succeeded - check returned value
    if (val.dataSize > 0) {
      if (strcmp(val.dataType, DATATYPE_SP78) == 0) {
        // convert fp78 value to temperature
        int intValue = (val.bytes[0] * 256 + val.bytes[1]) >> 2;
        return intValue / 64.0;
      }
    }
  }
Exemple #2
0
void IoAppleSensors_free(IoAppleSensors *self)
{
	SMCClose();
	LMUClose();
	//free(IoObject_dataPointer(self));
}