Changeset View
Changeset View
Standalone View
Standalone View
ksysguardd/Linux/acpi.c
Show First 20 Lines • Show All 416 Lines • ▼ Show 20 Line(s) | 415 | void printCoolingDeviceState(const char *cmd) { | |||
---|---|---|---|---|---|
417 | if (sscanf(cmd, "acpi/Cooling_Device/%d", &fan) <= 0) { | 417 | if (sscanf(cmd, "acpi/Cooling_Device/%d", &fan) <= 0) { | ||
418 | output( "-1\n"); | 418 | output( "-1\n"); | ||
419 | return; | 419 | return; | ||
420 | } | 420 | } | ||
421 | int current = getSysFileValue("cooling_device", fan, "cur_state"); | 421 | int current = getSysFileValue("cooling_device", fan, "cur_state"); | ||
422 | int maximum = getSysFileValue("cooling_device", fan, "max_state"); | 422 | int maximum = getSysFileValue("cooling_device", fan, "max_state"); | ||
423 | int state = 0; | 423 | int state = 0; | ||
424 | if (current > 0 && maximum > 0) { | 424 | if (current > 0 && maximum > 0) { | ||
425 | state = current / maximum; | 425 | state = (current * 100) / maximum; /* state is a percentage */ | ||
426 | } | 426 | } | ||
427 | output( "%d\n", state); | 427 | output( "%d\n", state); | ||
428 | } | 428 | } | ||
429 | 429 | | |||
430 | static int getCurrentTemperature(const char *cmd) | 430 | static int getCurrentTemperature(const char *cmd) | ||
431 | { | 431 | { | ||
432 | char th_file[ ACPIFILENAMELENGTHMAX ]; | 432 | char th_file[ ACPIFILENAMELENGTHMAX ]; | ||
433 | char input_buf[ OLD_TEMPERATURE_FILE_MAXLEN ]; | 433 | char input_buf[ OLD_TEMPERATURE_FILE_MAXLEN ]; | ||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |