aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-11-04 22:58:09 -0800
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-11-04 22:58:09 -0800
commita0d6887d5f04118069705e3d18bc55b04027ffc4 (patch)
tree4b2342dc3d13af60adcf91a1bf34ef33c3428107
parent2b733a8ab4386ec7374dc45dc9b11a54f4200b02 (diff)
downloadhdt-pierre-hdt-0.3.5.tar.gz
hdt-pierre-hdt-0.3.5.tar.xz
hdt-pierre-hdt-0.3.5.zip
hdt: add debug optionhdt-0.3.5
Pass 'debug' on the kernel command line for the output to be more verbose. Making hdt quiet is really helpful in auto mode, when a lot of information is flowing. This fixes #21. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
-rw-r--r--com32/hdt/hdt-cli.c13
-rw-r--r--com32/hdt/hdt-common.c19
-rw-r--r--com32/hdt/hdt-common.h2
-rw-r--r--com32/hdt/hdt-menu.c28
4 files changed, 43 insertions, 19 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index f395260f..518f0751 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -755,7 +755,8 @@ void start_auto_mode(struct s_hardware *hardware)
int nb_commands=0;
char *commands[MAX_NB_AUTO_COMMANDS];
- more_printf("Entering Auto mode\n");
+ if (debug)
+ more_printf("\nEntering Auto mode\n");
/* Protecting the auto_label from the strtok modifications */
char *temp=strdup(hardware->auto_label);
@@ -776,14 +777,18 @@ void start_auto_mode(struct s_hardware *hardware)
/* Executing found commands */
for (int i=1;i<=nb_commands;i++) {
if (commands[i]) {
- more_printf("\n");
- more_printf("> Auto mode: Executing %d/%d : '%s'\n",i,nb_commands, commands[i]);
+ more_printf("\n");
+ if (debug)
+ more_printf("> Auto mode: Executing %d/%d : '%s'\n", i, nb_commands, commands[i]);
exec_command(commands[i], hardware);
free(commands[i]);
}
}
- more_printf("Exiting Auto mode\n");
+ if (debug)
+ more_printf("\nExiting Auto mode\n");
+
+ more_printf("\n");
}
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 509aac70..c5433e2f 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -55,8 +55,13 @@ void convert_isolinux_filename(char *filename, struct s_hardware *hardware) {
void detect_parameters(const int argc, const char *argv[],
struct s_hardware *hardware)
{
+ /* Debug mode - make the output more verbose */
+ debug = false;
+
for (int i = 1; i < argc; i++) {
- if (!strncmp(argv[i], "modules_pcimap=", 15)) {
+ if (!strncmp(argv[i], "debug", 5)) {
+ debug = true;
+ } else if (!strncmp(argv[i], "modules_pcimap=", 15)) {
strncpy(hardware->modules_pcimap_path, argv[i] + 15,
sizeof(hardware->modules_pcimap_path));
convert_isolinux_filename(hardware->modules_pcimap_path,hardware);
@@ -478,19 +483,23 @@ void detect_pci(struct s_hardware *hardware)
hardware->nb_pci_devices++;
}
- printf("PCI: %d devices detected\n", hardware->nb_pci_devices);
- printf("PCI: Resolving names\n");
+ if (debug) {
+ more_printf("PCI: %d devices detected\n", hardware->nb_pci_devices);
+ more_printf("PCI: Resolving names\n");
+ }
/* Assigning product & vendor name for each device */
hardware->pci_ids_return_code =
get_name_from_pci_ids(hardware->pci_domain, hardware->pciids_path);
- printf("PCI: Resolving class names\n");
+ if (debug)
+ more_printf("PCI: Resolving class names\n");
/* Assigning class name for each device */
hardware->pci_ids_return_code =
get_class_name_from_pci_ids(hardware->pci_domain,
hardware->pciids_path);
- printf("PCI: Resolving module names\n");
+ if (debug)
+ more_printf("PCI: Resolving module names\n");
/* Detecting which kernel module should match each device using modules.pcimap*/
hardware->modules_pcimap_return_code =
get_module_name_from_pcimap(hardware->pci_domain,
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index f37a4fea..7ed3e489 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -66,6 +66,8 @@
/* The char that surround the list of commands */
#define AUTO_DELIMITER "'"
+bool debug;
+
extern int display_line_nb;
extern bool disable_more_printf;
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index c7dfee54..abdf0a2c 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -51,7 +51,8 @@ int start_menu_mode(struct s_hardware *hardware, char *version_string)
t_menuitem *curr;
char cmd[160];
- printf("Starting Menu (%d menus)\n", hdt_menu.total_menu_count);
+ if (debug)
+ more_printf("Starting Menu (%d menus)\n", hdt_menu.total_menu_count);
curr = showmenus(hdt_menu.main_menu.menu);
/* When we exit the menu, do we have something to do? */
if (curr) {
@@ -301,30 +302,37 @@ void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
void detect_hardware(struct s_hardware *hardware)
{
- printf("CPU: Detecting\n");
+ if (debug)
+ more_printf("CPU: Detecting\n");
cpu_detect(hardware);
- printf("DISKS: Detecting\n");
+ if (debug)
+ more_printf("DISKS: Detecting\n");
detect_disks(hardware);
- printf("DMI: Detecting Table\n");
+ if (debug)
+ more_printf("DMI: Detecting Table\n");
if (detect_dmi(hardware) == -ENODMITABLE) {
printf("DMI: ERROR ! Table not found ! \n");
printf
("DMI: Many hardware components will not be detected ! \n");
} else {
- printf("DMI: Table found ! (version %u.%u)\n",
- hardware->dmi.dmitable.major_version,
- hardware->dmi.dmitable.minor_version);
+ if (debug)
+ more_printf("DMI: Table found ! (version %u.%u)\n",
+ hardware->dmi.dmitable.major_version,
+ hardware->dmi.dmitable.minor_version);
}
- printf("VPD: Detecting\n");
+ if (debug)
+ more_printf("VPD: Detecting\n");
detect_vpd(hardware);
#ifdef WITH_PCI
detect_pci(hardware);
- printf("PCI: %d Devices Found\n", hardware->nb_pci_devices);
+ if (debug)
+ more_printf("PCI: %d Devices Found\n", hardware->nb_pci_devices);
#endif
- printf("VESA: Detecting\n");
+ if (debug)
+ more_printf("VESA: Detecting\n");
detect_vesa(hardware);
}