aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2/arch/linux/common/pci.h
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2008-06-30 17:35:58 -0300
committerLeandro A. F. Pereira <leandro@hardinfo.org>2008-06-30 17:35:58 -0300
commit47c10af317faae9184d5d9e1f1f37c2913a16ef7 (patch)
tree51caf0f6eeacc1745092a744f0f27df3686972c1 /hardinfo2/arch/linux/common/pci.h
parent60a29a76b55ec3a075cc585f7bd707bc170afaf4 (diff)
Make "Resources" information a little more meaningful.
If the resource is claimed by a kernel module, use its description. If the resource is reserved by a PCI device, use its name.
Diffstat (limited to 'hardinfo2/arch/linux/common/pci.h')
-rw-r--r--hardinfo2/arch/linux/common/pci.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/hardinfo2/arch/linux/common/pci.h b/hardinfo2/arch/linux/common/pci.h
index a89c8841..4ea03356 100644
--- a/hardinfo2/arch/linux/common/pci.h
+++ b/hardinfo2/arch/linux/common/pci.h
@@ -16,6 +16,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/*
+ * TODO: This thing must be rewritten. We really should have a struct with all the
+ * PCI stuff we'll present to the user, and hash them by the PCI ID
+ * (domain:bus:device.function).
+ * This way we'll have ways to better organize the output, instead of relying
+ * on the order the information appears on lspci's output.
+ * Also, the "Resources" thing might be better implemented (and we won't need
+ * copies of information scattered everywhere like we do today).
+ */
+
+GHashTable *_pci_devices = NULL;
+
void
__scan_pci(void)
{
@@ -23,6 +35,10 @@ __scan_pci(void)
gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL;
gchar *category = NULL, *name = NULL, *icon;
gint n = 0, x = 0;
+
+ if (!_pci_devices) {
+ _pci_devices = g_hash_table_new(g_str_hash, g_str_equal);
+ }
buf = g_build_filename(g_get_home_dir(), ".hardinfo", "pci.ids", NULL);
if (!g_file_test(buf, G_FILE_TEST_EXISTS)) {
@@ -169,6 +185,9 @@ __scan_pci(void)
else icon = "pci";
name = g_strdup(buf);
+ g_hash_table_insert(_pci_devices,
+ g_strdup_printf("0000:%02x:%02x.%x", bus, device, function),
+ name);
strhash = g_strdup_printf("PCI%d", n);
strdevice = g_strdup_printf("[Device Information]\n"
@@ -187,6 +206,9 @@ __scan_pci(void)
url);
}
+ g_hash_table_insert(_pci_devices,
+ g_strdup_printf("0000:%02x:%02x.%x", bus, device, function),
+ g_strdup(name));
pci_list = h_strdup_cprintf("$PCI%d$%s=%s\n", pci_list, n, category, name);