hwinfo/hwinfo_pci_scan_label.patch
Tomáš Chvátal abf2393281 Accepting request 215318 from home:trenn:branches:system:install:head
- Show Consistant Device Name (CDN) as Device Name.
  The Device name of a PCI or PCI Express device under OS may be exported
  by BIOS via label sysfs attribute. Read it and show it to the user as
  "Device Name:"
  fate#316031, fate#315201
  Add: hwinfo_pci_scan_label.patch

OBS-URL: https://build.opensuse.org/request/show/215318
OBS-URL: https://build.opensuse.org/package/show/system:install:head/hwinfo?expand=0&rev=56
2014-03-19 10:05:19 +00:00

62 lines
2.1 KiB
Diff

Index: hwinfo-21.0/src/hd/hd.h
===================================================================
--- hwinfo-21.0.orig/src/hd/hd.h
+++ hwinfo-21.0/src/hd/hd.h
@@ -1047,6 +1047,7 @@ typedef struct s_pci_t {
char *sysfs_id; /**< sysfs path */
char *sysfs_bus_id; /**< sysfs bus id */
char *modalias; /**< module alias */
+ char *label; /**< Consistant Device Name (CDN), pci firmware spec 3.1, chapter 4.6.7 */
unsigned edid_len[4]; /**< edid record length */
unsigned char edid_data[4][0x80]; /**< edid record */
} pci_t;
@@ -2583,6 +2584,7 @@ typedef struct s_hd_t {
hal_prop_t *persistent_prop; /**< persistent property list */
char *modalias; /**< module alias */
+ char *label; /**< Consistent Device Name (CDN), pci firmware spec 3.1, chapter 4.6.7 */
/*
* These are used internally for memory management.
Index: hwinfo-21.0/src/hd/pci.c
===================================================================
--- hwinfo-21.0.orig/src/hd/pci.c
+++ hwinfo-21.0/src/hd/pci.c
@@ -192,6 +192,11 @@ void hd_pci_read_data(hd_data_t *hd_data
pci->irq = ul0;
}
+ if((s = get_sysfs_attr_by_path(sf_dev, "label"))) {
+ pci->label = canon_str(s, strlen(s));
+ ADD2LOG(" label = \"%s\"\n", pci->label);
+ }
+
sl = hd_attr_list(get_sysfs_attr_by_path(sf_dev, "resource"));
for(u = 0; sl; sl = sl->next, u++) {
if(
@@ -432,6 +437,11 @@ void hd_pci_complete_data(hd_t *hd)
pci->modalias = NULL;
}
+ if(pci->label && *pci->label) {
+ hd->label = pci->label;
+ pci->label = NULL;
+ }
+
hd->slot = pci->slot + (pci->bus << 8);
hd->func = pci->func;
hd->base_class.id = pci->base_class;
Index: hwinfo-21.0/src/hd/hdp.c
===================================================================
--- hwinfo-21.0.orig/src/hd/hdp.c
+++ hwinfo-21.0/src/hd/hdp.c
@@ -357,6 +357,8 @@ void dump_normal(hd_data_t *hd_data, hd_
hd_detail_monitor_t *mdetail;
static char *geo_type_str[] = { "Physical", "Logical", "BIOS EDD", "BIOS Legacy" };
+ if(h->label) dump_line("Device Name: \"%s\"\n", h->label);
+
if(h->model) dump_line("Model: \"%s\"\n", h->model);
s = NULL;