mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-27 12:30:43 +00:00
Move temperature sensor type translation to library
This commit is contained in:
1 parent
fcf478016d
commit
0d9ea7f031
2 files changed
+20
-7
No files matched your search
@@ -276,6 +276,25 @@ typedef struct sensors_quantity {
|
||||
|
||||
const sensors_quantity *sensors_get_quantity(sensors_subfeature_type) __attribute__ ((const));
|
||||
|
||||
static inline const char *sensors_temp_type_name(int sens)
|
||||
{
|
||||
/* older kernels / drivers sometimes report a beta value for
|
||||
thermistors */
|
||||
if (sens > 1000)
|
||||
sens = 4;
|
||||
|
||||
switch (sens) {
|
||||
case 0: return "disabled";
|
||||
case 1: return "CPU diode";
|
||||
case 2: return "transistor";
|
||||
case 3: return "thermal diode";
|
||||
case 4: return "thermistor";
|
||||
case 5: return "AMD AMDSI";
|
||||
case 6: return "Intel PECI";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/* Data about a single chip feature (or category leader) */
|
||||
struct sensors_feature {
|
||||
char *name;
|
||||
|
||||
@@ -409,13 +409,7 @@ static void print_chip_temp(const sensors_chip_name *name,
|
||||
if (sens > 1000)
|
||||
sens = 4;
|
||||
|
||||
printf(" sensor = %s", sens == 0 ? "disabled" :
|
||||
sens == 1 ? "CPU diode" :
|
||||
sens == 2 ? "transistor" :
|
||||
sens == 3 ? "thermal diode" :
|
||||
sens == 4 ? "thermistor" :
|
||||
sens == 5 ? "AMD AMDSI" :
|
||||
sens == 6 ? "Intel PECI" : "unknown");
|
||||
printf(" sensor = %s", sensors_temp_type_name(sens));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user