From 5e22b9c7fc046100f26974536333149eecd60164 Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 30 Nov 2009 13:26:39 +0100 Subject: [PATCH] hdt: Adding cpu voltage Impact: Adding cpu voltage Adding cpu voltage via DMI --- com32/hdt/hdt-cli-cpu.c | 16 ++++++++++++---- com32/hdt/hdt-menu-processor.c | 17 +++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c index 683a6b3..aa7ec8f 100644 --- a/com32/hdt/hdt-cli-cpu.c +++ b/com32/hdt/hdt-cli-cpu.c @@ -92,10 +92,18 @@ static void show_cpu(int argc __unused, char **argv __unused, more_printf("Family ID : %d\n", hardware->cpu.family); more_printf("Model ID : %d\n", hardware->cpu.model_id); more_printf("Stepping : %d\n", hardware->cpu.stepping); - more_printf("FSB : %d MHz\n", hardware->dmi.processor.external_clock); - more_printf("Cur. Speed: %d MHz\n", hardware->dmi.processor.current_speed); - more_printf("Max Speed : %d MHz\n", hardware->dmi.processor.max_speed); - more_printf("Upgrade : %s\n", hardware->dmi.processor.upgrade); + if (hardware->is_dmi_valid) { + more_printf("FSB : %d MHz\n", + hardware->dmi.processor.external_clock); + more_printf("Cur. Speed: %d MHz\n", + hardware->dmi.processor.current_speed); + more_printf("Max Speed : %d MHz\n", hardware->dmi.processor.max_speed); + more_printf("Upgrade : %s\n", hardware->dmi.processor.upgrade); + more_printf("Voltage : %d.%02d\n", + hardware->dmi.processor.voltage_mv / 1000, + hardware->dmi.processor.voltage_mv - + ((hardware->dmi.processor.voltage_mv / 1000) * 1000)); + } if (hardware->cpu.flags.smp) { more_printf("SMP : yes\n"); } else { diff --git a/com32/hdt/hdt-menu-processor.c b/com32/hdt/hdt-menu-processor.c index abb9a1a..f303eb6 100644 --- a/com32/hdt/hdt-menu-processor.c +++ b/com32/hdt/hdt-menu-processor.c @@ -63,10 +63,8 @@ void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware) add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; - snprintf(buffer, sizeof buffer, "Model : %s", - hardware->cpu.model); - snprintf(statbuffer, sizeof statbuffer, "Model: %s", - hardware->cpu.model); + snprintf(buffer, sizeof buffer, "Model : %s", hardware->cpu.model); + snprintf(statbuffer, sizeof statbuffer, "Model: %s", hardware->cpu.model); add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; @@ -141,6 +139,17 @@ void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware) hardware->dmi.processor.upgrade); add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; + + snprintf(buffer, sizeof buffer, "Voltage : %d.%02d", + hardware->dmi.processor.voltage_mv / 1000, + hardware->dmi.processor.voltage_mv - + ((hardware->dmi.processor.voltage_mv / 1000) * 1000)); + snprintf(statbuffer, sizeof statbuffer, "Voltage (V) : %d.%02d", + hardware->dmi.processor.voltage_mv / 1000, + hardware->dmi.processor.voltage_mv - + ((hardware->dmi.processor.voltage_mv / 1000) * 1000)); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; } if (hardware->cpu.flags.smp) { -- 2.7.4