Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,14 @@ int main(int argc, char* argv[])
if (!specifiedCores) {
coreCount = getPhysicalCoreCount();
coreList = realloc(coreList, coreCount * sizeof(unsigned long));
int coreOffset = 0;
if (SMCGetTemperature("TC0C") == 0 && SMCGetTemperature("TC0c") == 0) {
// https://logi.wiki/index.php/SMC_Sensor_Codes
// macbookpro first core temperature = TC1C code(key)
coreOffset = 1;
}
for (int i = 0; i < coreCount; ++i)
coreList[i] = i;
coreList[i] = i + coreOffset;
}

char templateKey[7];
Expand Down Expand Up @@ -376,8 +382,15 @@ int main(int argc, char* argv[])
}
break;
}
case package:
printTemperature(convertToCorrectScale(scale, SMCGetTemperature(SMC_CPU_DIE_TEMP)), rounding);
case package: {
// https://logi.wiki/index.php/SMC_Sensor_Codes
// try again with macbookpro cpu proximity temperature = TC0P code(key)
double cpuTemperature = SMCGetTemperature(SMC_CPU_DIE_TEMP);
if (cpuTemperature == 0) {
cpuTemperature = SMCGetTemperature(SMC_CPU_PROXIMITY_TEMP);
}
printTemperature(convertToCorrectScale(scale, cpuTemperature), rounding);
}
break;
}

Expand Down
1 change: 1 addition & 0 deletions smc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define SMC_CPU_CORE_TEMP_SUFFIX_OLD 'C'
#define SMC_CPU_CORE_TEMP_SUFFIX_NEW 'c'
#define SMC_CPU_DIE_TEMP "TC0D"
#define SMC_CPU_PROXIMITY_TEMP "TC0P"

typedef struct {
char major;
Expand Down