Skip to content
Permalink
Browse files

Allow DMI on non-x86

There's nothing preventing this from running on non-x86.
If it is not available it will just say so, like PCI.

Signed-off-by: Burt P <pburt0@gmail.com>
  • Loading branch information...
bp0 authored and lpereira committed Oct 13, 2018
1 parent f5cee38 commit ad57a3f7fe910cf509485e8b394007ce397df0ad
Showing with 7 additions and 18 deletions.
  1. +0 −4 includes/devices.h
  2. +1 −11 modules/devices.c
  3. +6 −3 modules/devices/dmi.c
@@ -69,10 +69,8 @@ void scan_sensors_do(void);
void sensors_init(void);
void sensors_shutdown(void);

#if defined(ARCH_x86) || defined(ARCH_x86_64)
/* SPD */
void scan_spd_do(void);
#endif /* ARCH_x86 */

extern gchar *battery_list;
extern gchar *input_icons;
@@ -93,10 +91,8 @@ extern GHashTable *sensor_compute;
extern GHashTable *sensor_labels;
extern GModule *cups;

#if defined(ARCH_x86) || defined(ARCH_x86_64)
extern gchar *spd_info;
extern gchar *dmi_info;
#endif

extern gchar *dtree_info;
extern gchar *gpu_list;
@@ -50,10 +50,8 @@ gchar *callback_printers();
gchar *callback_storage();
gchar *callback_input();
gchar *callback_usb();
#if defined(ARCH_x86) || defined(ARCH_x86_64)
gchar *callback_dmi();
gchar *callback_spd();
#endif
gchar *callback_dtree();
gchar *callback_device_resources();

@@ -67,10 +65,8 @@ void scan_printers(gboolean reload);
void scan_storage(gboolean reload);
void scan_input(gboolean reload);
void scan_usb(gboolean reload);
#if defined(ARCH_x86) || defined(ARCH_x86_64)
void scan_dmi(gboolean reload);
void scan_spd(gboolean reload);
#endif
void scan_dtree(gboolean reload);
void scan_device_resources(gboolean reload);

@@ -107,13 +103,11 @@ static ModuleEntry entries[] = {
[ENTRY_SENSORS] = {N_("Sensors"), "therm.png", callback_sensors, scan_sensors, MODULE_FLAG_NONE},
[ENTRY_INPUT] = {N_("Input Devices"), "inputdevices.png", callback_input, scan_input, MODULE_FLAG_NONE},
[ENTRY_STORAGE] = {N_("Storage"), "hdd.png", callback_storage, scan_storage, MODULE_FLAG_NONE},
#if defined(ARCH_x86) || defined(ARCH_x86_64)
[ENTRY_DMI] = {N_("DMI"), "computer.png", callback_dmi, scan_dmi, MODULE_FLAG_NONE},
[ENTRY_SPD] = {N_("Memory SPD"), "memory.png", callback_spd, scan_spd, MODULE_FLAG_NONE},
#if defined(ARCH_x86) || defined(ARCH_x86_64)
[ENTRY_DTREE] = {"#"},
#else
[ENTRY_DMI] = {"#"},
[ENTRY_SPD] = {"#"},
[ENTRY_DTREE] = {N_("Device Tree"), "devices.png", callback_dtree, scan_dtree, MODULE_FLAG_NONE},
#endif /* x86 or x86_64 */
[ENTRY_RESOURCES] = {N_("Resources"), "resources.png", callback_device_resources, scan_device_resources, MODULE_FLAG_NONE},
@@ -539,7 +533,6 @@ gchar *hi_get_field(gchar * field)
return g_strdup(field);
}

#if defined(ARCH_x86) || defined(ARCH_x86_64)
void scan_dmi(gboolean reload)
{
SCAN_START();
@@ -553,7 +546,6 @@ void scan_spd(gboolean reload)
scan_spd_do();
SCAN_END();
}
#endif

void scan_dtree(gboolean reload)
{
@@ -644,7 +636,6 @@ gchar *callback_processors()
return processor_get_info(processors);
}

#if defined(ARCH_x86) || defined(ARCH_x86_64)
gchar *callback_dmi()
{
return g_strdup(dmi_info);
@@ -654,7 +645,6 @@ gchar *callback_spd()
{
return g_strdup(spd_info);
}
#endif

gchar *callback_dtree()
{
@@ -153,8 +153,11 @@ void __scan_dmi()
dmi_ok = dmi_get_info();

if (!dmi_ok) {
dmi_info = g_strdup("[No DMI information]\n"
"There was an error retrieving the information.=\n"
"Please try running HardInfo as root.=\n");
dmi_info = g_strdup_printf("[%s]\n%s=\n",
_("DMI Unavailable"),
(getuid() == 0)
? _("DMI is not avaliable. Perhaps this platform does not provide DMI.")
: _("DMI is not available; Perhaps try running HardInfo as root.") );

}
}

0 comments on commit ad57a3f

Please sign in to comment.
You can’t perform that action at this time.