hdt: Adding cpu voltage
authorErwan Velu <erwan.velu@free.fr>
Mon, 30 Nov 2009 12:26:39 +0000 (13:26 +0100)
committerErwan Velu <erwan.velu@free.fr>
Fri, 4 Dec 2009 09:11:16 +0000 (10:11 +0100)
Impact: Adding cpu voltage

Adding cpu voltage via DMI

com32/hdt/hdt-cli-cpu.c
com32/hdt/hdt-menu-processor.c

index 683a6b3..aa7ec8f 100644 (file)
@@ -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 {
index abb9a1a..f303eb6 100644 (file)
@@ -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) {