diff options
| -rw-r--r-- | hardinfo/pci_util.c | 5 | ||||
| -rw-r--r-- | includes/pci_util.h | 1 | ||||
| -rw-r--r-- | modules/devices/pci.c | 1 | 
3 files changed, 7 insertions, 0 deletions
| diff --git a/hardinfo/pci_util.c b/hardinfo/pci_util.c index 9502b23b..69150732 100644 --- a/hardinfo/pci_util.c +++ b/hardinfo/pci_util.c @@ -151,6 +151,11 @@ static gboolean pci_lookup_ids(pcid *d) {      return ret;  } +gint pcid_cmp_by_addy(const pcid* a, const pcid* b) { +    if (!a || !b) return (!!a - !!b); +    return g_strcmp0(a->slot_str, b->slot_str); +} +  void pcid_free(pcid *s) {      if (s) {          g_free(s->slot_str); diff --git a/includes/pci_util.h b/includes/pci_util.h index 6178be21..88a8b236 100644 --- a/includes/pci_util.h +++ b/includes/pci_util.h @@ -58,6 +58,7 @@ typedef struct pcid {  pcid *pci_get_device(uint32_t dom, uint32_t bus, uint32_t dev, uint32_t func);  pcid *pci_get_device_str(const char *addy);  #define pcid_new() g_new0(pcid, 1) +gint pcid_cmp_by_addy(const pcid* a, const pcid* b);  void pcid_free(pcid *);  typedef GSList* pcid_list; diff --git a/modules/devices/pci.c b/modules/devices/pci.c index 04a8a0cf..9ca1b847 100644 --- a/modules/devices/pci.c +++ b/modules/devices/pci.c @@ -177,6 +177,7 @@ void scan_pci_do(void) {      gchar *pci_icons = g_strdup("");      pcid_list list = pci_get_device_list(0,0); +    list = g_slist_sort(list, pcid_cmp_by_addy);      GSList *l = list;      int c = 0; | 
