aboutsummaryrefslogtreecommitdiff
path: root/modules/computer.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/computer.c')
-rw-r--r--modules/computer.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/modules/computer.c b/modules/computer.c
index 513d94f5..ea6762a7 100644
--- a/modules/computer.c
+++ b/modules/computer.c
@@ -32,6 +32,10 @@
#include <vendor.h>
#include "computer.h"
+
+#include "dmi_util.h" /* for dmi_get_str() */
+#include "dt_util.h" /* for dtr_get_string() */
+
#include "info.h"
/* Callbacks */
@@ -215,7 +219,7 @@ void scan_dev(gboolean reload)
{ N_("C (GCC)"), "gcc -v", "\\d+\\.\\d+\\.\\d+", FALSE },
{ N_("C (Clang)"), "clang -v", "\\d+\\.\\d+", FALSE },
{ N_("D (dmd)"), "dmd --help", "\\d+\\.\\d+", TRUE },
- { N_("Gambas3 (gbc3)"), "gbc3 --version", "\\d+\\.\\d+\\.\\d+", FALSE },
+ { N_("Gambas3 (gbc3)"), "gbc3 --version", "\\d+\\.\\d+\\.\\d+", TRUE },
{ N_("Java"), "javac -version", "\\d+\\.\\d+\\.\\d+", FALSE },
{ N_("CSharp (Mono, old)"), "mcs --version", "\\d+\\.\\d+\\.\\d+\\.\\d+", TRUE },
{ N_("CSharp (Mono)"), "gmcs --version", "\\d+\\.\\d+\\.\\d+\\.\\d+", TRUE },
@@ -230,7 +234,7 @@ void scan_dev(gboolean reload)
{ N_("valgrind"), "valgrind --version", "\\d+\\.\\d+\\.\\S+", TRUE },
{ N_("QMake"), "qmake --version", "\\d+\\.\\S+", TRUE},
{ N_("CMake"), "cmake --version", "\\d+\\.\\d+\\.?\\d*", TRUE},
- { N_("Gambas3 IDE"), "gambas3 --version", "\\d+\\.\\d+\\.\\d+", FALSE },
+ { N_("Gambas3 IDE"), "gambas3 --version", "\\d+\\.\\d+\\.\\d+", TRUE },
};
g_free(dev_list);
@@ -303,38 +307,19 @@ static gchar *detect_machine_type(void)
GDir *dir;
gchar *chassis;
- if (g_file_get_contents("/sys/devices/virtual/dmi/id/chassis_type", &chassis, NULL, NULL)) {
- static const char *types[] = {
- N_("Invalid chassis type (0)"),
- N_("Unknown chassis type"), /* 1 is "Other", but not helpful in HardInfo */
- N_("Unknown chassis type"),
- N_("Desktop"),
- N_("Low-profile Desktop"),
- N_("Pizza Box"),
- N_("Mini Tower"),
- N_("Tower"),
- N_("Portable"),
- N_("Laptop"),
- N_("Notebook"),
- N_("Handheld"),
- N_("Docking Station"),
- N_("All-in-one"),
- N_("Subnotebook"),
- N_("Space-saving"),
- N_("Lunch Box"),
- N_("Main Server Chassis"),
- N_("Expansion Chassis"),
- N_("Sub Chassis"),
- N_("Bus Expansion Chassis"),
- N_("Peripheral Chassis"),
- N_("RAID Chassis"),
- N_("Rack Mount Chassis"),
- N_("Sealed-case PC"),
- };
- int chassis_type = atoi(idle_free(chassis));
-
- if (chassis_type >= 0 && chassis_type < G_N_ELEMENTS(types))
- return g_strdup(_(types[chassis_type]));
+ chassis = dmi_chassis_type_str(-1, 0);
+ if (chassis)
+ return chassis;
+
+ chassis = dtr_get_string("/model", 0);
+ if (chassis) {
+ if (strstr(chassis, "Raspberry Pi") != NULL
+ || strstr(chassis, "ODROID") != NULL
+ /* FIXME: consider making a table when adding more models */ ) {
+ g_free(chassis);
+ return g_strdup(_("Single-board computer"));
+ }
+ g_free(chassis);
}
if (g_file_test("/proc/pmu/info", G_FILE_TEST_EXISTS))
@@ -381,8 +366,6 @@ static gchar *detect_machine_type(void)
/* FIXME: check if batteries are found using /proc/apm */
- /* FIXME: use dmidecode if available to get chassis type */
-
return g_strdup(_("Unknown physical machine type"));
}
@@ -403,35 +386,43 @@ gchar *computer_get_virtualization(void)
gchar *vmtype;
} vm_types[] = {
/* VMware */
- { "VMware", "Virtual (VMware)" },
- { ": VMware Virtual IDE CDROM Drive", "Virtual (VMware)" },
+ { "VMware", N_("Virtual (VMware)") },
+ { ": VMware Virtual IDE CDROM Drive", N_("Virtual (VMware)") },
/* QEMU */
- { "QEMU", "Virtual (QEMU)" },
- { "QEMU Virtual CPU", "Virtual (QEMU)" },
- { ": QEMU HARDDISK", "Virtual (QEMU)" },
- { ": QEMU CD-ROM", "Virtual (QEMU)" },
+ { "QEMU", N_("Virtual (QEMU)") },
+ { "QEMU Virtual CPU", N_("Virtual (QEMU)") },
+ { ": QEMU HARDDISK", N_("Virtual (QEMU)") },
+ { ": QEMU CD-ROM", N_("Virtual (QEMU)") },
/* Generic Virtual Machine */
- { ": Virtual HD,", "Virtual (Unknown)" },
- { ": Virtual CD,", "Virtual (Unknown)" },
+ { ": Virtual HD,", N_("Virtual (Unknown)") },
+ { ": Virtual CD,", N_("Virtual (Unknown)") },
/* Virtual Box */
- { "VBOX", "Virtual (VirtualBox)" },
- { ": VBOX HARDDISK", "Virtual (VirtualBox)" },
- { ": VBOX CD-ROM", "Virtual (VirtualBox)" },
+ { "VBOX", N_("Virtual (VirtualBox)") },
+ { ": VBOX HARDDISK", N_("Virtual (VirtualBox)") },
+ { ": VBOX CD-ROM", N_("Virtual (VirtualBox)") },
/* Xen */
- { "Xen virtual console", "Virtual (Xen)" },
- { "Xen reported: ", "Virtual (Xen)" },
- { "xen-vbd: registered block device", "Virtual (Xen)" },
+ { "Xen virtual console", N_("Virtual (Xen)") },
+ { "Xen reported: ", N_("Virtual (Xen)") },
+ { "xen-vbd: registered block device", N_("Virtual (Xen)") },
/* Generic */
- { " hypervisor", "Virtual (hypervisor present)"} ,
+ { " hypervisor", N_("Virtual (hypervisor present)") } ,
{ NULL }
};
+ gchar *tmp;
DEBUG("Detecting virtual machine");
if (g_file_test("/proc/xen", G_FILE_TEST_EXISTS)) {
DEBUG("/proc/xen found; assuming Xen");
- return g_strdup("Xen");
+ return g_strdup(_("Virtual (Xen)"));
+ }
+
+ tmp = module_call_method("devices::getMotherboard");
+ if (strstr(tmp, "VirtualBox") != NULL) {
+ g_free(tmp);
+ return g_strdup(_("Virtual (VirtualBox)"));
}
+ g_free(tmp);
for (i = 0; files[i+1]; i++) {
gchar buffer[512];
@@ -452,7 +443,7 @@ gchar *computer_get_virtualization(void)
if (found) {
DEBUG("%s found (by reading file %s)",
vm_types[j].vmtype, files[i]);
- return g_strdup(vm_types[j].vmtype);
+ return g_strdup(_(vm_types[j].vmtype));
}
}
@@ -489,9 +480,9 @@ gchar *callback_summary(void)
idle_free(computer_get_alsacards(computer)));
info_add_computed_group(info, _("Input Devices"),
idle_free(module_call_method("devices::getInputDevices")));
- info_add_computed_group(info, _("Printers"),
+ info_add_computed_group(info, NULL, /* getPrinters provides group headers */
idle_free(module_call_method("devices::getPrinters")));
- info_add_computed_group(info, _("Storage"),
+ info_add_computed_group(info, NULL, /* getStorageDevices provides group headers */
idle_free(module_call_method("devices::getStorageDevices")));
return info_flatten(info);
@@ -591,6 +582,7 @@ gchar *callback_display(void)
computer->display->width, computer->display->height),
info_field(_("Vendor"), computer->display->vendor),
info_field(_("Version"), computer->display->version),
+ info_field(_("Current Display Name"), computer->display->display_name),
info_field_last());
info_add_computed_group(info, _("Monitors"), computer->display->monitors);
@@ -645,6 +637,13 @@ gchar *get_os(void)
return g_strdup(computer->os->distro);
}
+gchar *get_ogl_renderer(void)
+{
+ scan_display(FALSE);
+
+ return g_strdup(computer->display->ogl_renderer);
+}
+
gchar *get_display_summary(void)
{
scan_display(FALSE);
@@ -689,6 +688,7 @@ ShellModuleMethod *hi_exported_methods(void)
{"getOSKernel", get_os_kernel},
{"getOS", get_os},
{"getDisplaySummary", get_display_summary},
+ {"getOGLRenderer", get_ogl_renderer},
{"getAudioCards", get_audio_cards},
{"getKernelModuleDescription", get_kernel_module_description},
{NULL}