diff options
Diffstat (limited to 'arch/linux/common')
-rw-r--r-- | arch/linux/common/alsa.h | 7 | ||||
-rw-r--r-- | arch/linux/common/os.h | 9 | ||||
-rw-r--r-- | arch/linux/common/pci.h | 32 | ||||
-rw-r--r-- | arch/linux/common/sensors.h | 2 | ||||
-rw-r--r-- | arch/linux/common/storage.h | 8 |
5 files changed, 43 insertions, 15 deletions
diff --git a/arch/linux/common/alsa.h b/arch/linux/common/alsa.h index 0c0744ae..8f4cc2ac 100644 --- a/arch/linux/common/alsa.h +++ b/arch/linux/common/alsa.h @@ -20,16 +20,15 @@ gchar * computer_get_alsacards(Computer * computer) { GSList *p; - gchar *tmp = ""; + gchar *tmp = g_strdup(""); gint n = 0; if (computer->alsa) { for (p = computer->alsa->cards; p; p = p->next) { AlsaCard *ac = (AlsaCard *) p->data; - tmp = - g_strdup_printf("Audio Adapter#%d=%s\n%s", ++n, - ac->friendly_name, tmp); + tmp = h_strdup_cprintf("Audio Adapter#%d=%s\n", + tmp, ++n, ac->friendly_name); } } diff --git a/arch/linux/common/os.h b/arch/linux/common/os.h index 0fe06709..e4f35e95 100644 --- a/arch/linux/common/os.h +++ b/arch/linux/common/os.h @@ -185,6 +185,15 @@ computer_get_os(void) os->distro = g_strdup(buf); } } + + if (g_str_equal(distro_db[i].codename, "ppy")) { + gchar *tmp; + + tmp = g_strdup_printf("Puppy Linux %.2f", atof(os->distro) / 100.0); + g_free(os->distro); + os->distro = tmp; + } + os->distrocode = g_strdup(distro_db[i].codename); break; diff --git a/arch/linux/common/pci.h b/arch/linux/common/pci.h index 554c3dca..388ce9aa 100644 --- a/arch/linux/common/pci.h +++ b/arch/linux/common/pci.h @@ -21,16 +21,32 @@ __scan_pci(void) { FILE *lspci; gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL; - gchar *category = NULL, *name = NULL; - gint n = 0; - - if (!(lspci = popen(LSPCI, "r"))) { - goto pci_error; + gchar *category = NULL, *name = NULL, *icon; + gint n = 0, x = 0; + + buf = g_build_filename(g_get_home_dir(), ".hardinfo", "pci.ids", NULL); + if (!g_file_test(buf, G_FILE_TEST_EXISTS)) { + DEBUG("using system-provided PCI IDs"); + g_free(buf); + if (!(lspci = popen(LSPCI, "r"))) { + goto pci_error; + } + } else { + gchar *tmp; + + tmp = g_strdup_printf("%s -i '%s'", LSPCI, buf); + g_free(buf); + buf = tmp; + + DEBUG("using updated PCI IDs (from %s)", buf); + if (!(lspci = popen(tmp, "r"))) { + g_free(buf); + goto pci_error; + } else { + g_free(buf); + } } - gchar *icon; - - int x = 0; /* unique Memory, Capability and I/O port */ while (fgets(buffer, 256, lspci)) { buf = g_strstrip(buffer); diff --git a/arch/linux/common/sensors.h b/arch/linux/common/sensors.h index bc84014b..1c4fd69f 100644 --- a/arch/linux/common/sensors.h +++ b/arch/linux/common/sensors.h @@ -254,7 +254,7 @@ static void read_sensors_acpi(void) if ((tz = g_dir_open(path_tz, 0, NULL))) { const gchar *entry; - gchar *temp = ""; + gchar *temp = g_strdup(""); while ((entry = g_dir_read_name(tz))) { diff --git a/arch/linux/common/storage.h b/arch/linux/common/storage.h index 6700984b..71c206cd 100644 --- a/arch/linux/common/storage.h +++ b/arch/linux/common/storage.h @@ -79,9 +79,13 @@ __scan_scsi_devices(void) model = g_strdup_printf("%s %s", vendor, model + 7); } else if (!strncmp(buf, "Type: ", 8)) { - char *p = strstr(buf, "ANSI SCSI revi"); + char *p; gchar *type = NULL, *icon = NULL; + if (!(p = strstr(buf, "ANSI SCSI revision"))) { + p = strstr(buf, "ANSI SCSI revision"); + } + if (p != NULL) { while (*(--p) == ' '); *(++p) = 0; @@ -335,7 +339,7 @@ __scan_ide_devices(void) g_hash_table_insert(moreinfo, devid, strhash); g_free(model); - model = ""; + model = g_strdup(""); } else g_free(device); |