New Upstream Release - hwinfo

Ready changes

Summary

Merged new upstream version: 22.1 (was: 21.82).

Resulting package

Built on 2022-12-31T21:09 (took 12m54s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases hwinfo-dbgsymapt install -t fresh-releases hwinfoapt install -t fresh-releases libhd-devapt install -t fresh-releases libhd-docapt install -t fresh-releases libhd21-dbgsymapt install -t fresh-releases libhd21

Diff

diff --git a/debian/changelog b/debian/changelog
index ad79a88..200337c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+hwinfo (22.1-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Sat, 31 Dec 2022 20:57:31 -0000
+
 hwinfo (21.82-1) unstable; urgency=medium
 
   * New upstream version 21.82
diff --git a/debian/patches/0001-This-patch-adds-a-basic-support-for-m68k-and-ppc64-a.patch b/debian/patches/0001-This-patch-adds-a-basic-support-for-m68k-and-ppc64-a.patch
index e243435..7bb5583 100644
--- a/debian/patches/0001-This-patch-adds-a-basic-support-for-m68k-and-ppc64-a.patch
+++ b/debian/patches/0001-This-patch-adds-a-basic-support-for-m68k-and-ppc64-a.patch
@@ -6,11 +6,11 @@ Subject: This patch adds a basic support for m68k and ppc64 architectures.
  src/hd/hd.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
 
-diff --git a/src/hd/hd.c b/src/hd/hd.c
-index 70a73d9..f17e69f 100644
---- a/src/hd/hd.c
-+++ b/src/hd/hd.c
-@@ -160,6 +160,18 @@
+Index: hwinfo.git/src/hd/hd.c
+===================================================================
+--- hwinfo.git.orig/src/hd/hd.c
++++ hwinfo.git/src/hd/hd.c
+@@ -162,6 +162,18 @@
  #define HD_ARCH "loongarch"
  #endif
  
diff --git a/debian/patches/0002-TIOCGDEV-is-not-supported-by-the-kernel-therefore-we.patch b/debian/patches/0002-TIOCGDEV-is-not-supported-by-the-kernel-therefore-we.patch
index 4cd7aa6..6b283bb 100644
--- a/debian/patches/0002-TIOCGDEV-is-not-supported-by-the-kernel-therefore-we.patch
+++ b/debian/patches/0002-TIOCGDEV-is-not-supported-by-the-kernel-therefore-we.patch
@@ -6,11 +6,11 @@ Subject: TIOCGDEV is not supported by the kernel therefore we comment it out.
  src/hd/kbd.c | 2 ++
  1 file changed, 2 insertions(+)
 
-diff --git a/src/hd/kbd.c b/src/hd/kbd.c
-index fa08817..38a75ee 100644
---- a/src/hd/kbd.c
-+++ b/src/hd/kbd.c
-@@ -134,6 +134,7 @@ void add_serial_console(hd_data_t *hd_data)
+Index: hwinfo.git/src/hd/kbd.c
+===================================================================
+--- hwinfo.git.orig/src/hd/kbd.c
++++ hwinfo.git/src/hd/kbd.c
+@@ -134,6 +134,7 @@ void add_serial_console(hd_data_t *hd_da
    }
  
    if(!dev && (fd = open(DEV_CONSOLE, O_RDWR | O_NONBLOCK | O_NOCTTY)) >= 0) {
@@ -18,7 +18,7 @@ index fa08817..38a75ee 100644
      if(ioctl(fd, TIOCGDEV, &u) != -1) {
        tty_major = (u >> 8) & 0xfff;
        tty_minor = (u & 0xff) | ((u >> 12) & 0xfff00);
-@@ -152,6 +153,7 @@ void add_serial_console(hd_data_t *hd_data)
+@@ -152,6 +153,7 @@ void add_serial_console(hd_data_t *hd_da
        free_mem(dev_link);
        free_mem(dev_name);
      }
diff --git a/debian/patches/0003-Read-BogoMIPS-from-proc-cpuinfo-as-well.patch b/debian/patches/0003-Read-BogoMIPS-from-proc-cpuinfo-as-well.patch
index 49a57ce..4d2b52e 100644
--- a/debian/patches/0003-Read-BogoMIPS-from-proc-cpuinfo-as-well.patch
+++ b/debian/patches/0003-Read-BogoMIPS-from-proc-cpuinfo-as-well.patch
@@ -6,10 +6,10 @@ Subject: Read BogoMIPS from /proc/cpuinfo as well
  src/hd/cpu.c | 3 +++
  1 file changed, 3 insertions(+)
 
-diff --git a/src/hd/cpu.c b/src/hd/cpu.c
-index 958993c..4b5d27d 100644
---- a/src/hd/cpu.c
-+++ b/src/hd/cpu.c
+Index: hwinfo.git/src/hd/cpu.c
+===================================================================
+--- hwinfo.git.orig/src/hd/cpu.c
++++ hwinfo.git/src/hd/cpu.c
 @@ -104,6 +104,7 @@ void read_cpuinfo(hd_data_t *hd_data)
  #ifdef __alpha__
    char model_id[80], system_id[80], serial_number[80], platform[80];
diff --git a/debian/patches/0006-Use-bin-udevadm-which-is-the-Debian-location.patch b/debian/patches/0006-Use-bin-udevadm-which-is-the-Debian-location.patch
index a96ea15..db554e6 100644
--- a/debian/patches/0006-Use-bin-udevadm-which-is-the-Debian-location.patch
+++ b/debian/patches/0006-Use-bin-udevadm-which-is-the-Debian-location.patch
@@ -6,10 +6,10 @@ Subject: Use /bin/udevadm which is the Debian location.
  src/hd/hd_int.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/src/hd/hd_int.h b/src/hd/hd_int.h
-index 28eacc7..7907464 100644
---- a/src/hd/hd_int.h
-+++ b/src/hd/hd_int.h
+Index: hwinfo.git/src/hd/hd_int.h
+===================================================================
+--- hwinfo.git.orig/src/hd/hd_int.h
++++ hwinfo.git/src/hd/hd_int.h
 @@ -42,7 +42,7 @@
  #define PROG_MODPROBE		"/sbin/modprobe"
  #define PROG_RMMOD		"/sbin/rmmod"
diff --git a/hwinfo.c b/hwinfo.c
index 2d691ee..fb1d93f 100644
--- a/hwinfo.c
+++ b/hwinfo.c
@@ -144,6 +144,7 @@ struct option options[] = {
   { "pci", 0, NULL, 1000 + hw_pci },
   { "isapnp", 0, NULL, 1000 + hw_isapnp },
   { "scsi", 0, NULL, 1000 + hw_scsi },
+  { "nvme", 0, NULL, 1000 + hw_nvme },
   { "ide", 0, NULL, 1000 + hw_ide },
   { "bridge", 0, NULL, 1000 + hw_bridge },
   { "hub", 0, NULL, 1000 + hw_hub },
@@ -815,8 +816,8 @@ void help()
     "        all, arch, bios, block, bluetooth, braille, bridge, camera,\n"
     "        cdrom, chipcard, cpu, disk, dsl, dvb, fingerprint, floppy,\n"
     "        framebuffer, gfxcard, hub, ide, isapnp, isdn, joystick, keyboard,\n"
-    "        memory, mmc-ctrl, modem, monitor, mouse, netcard, network, partition,\n"
-    "        pci, pcmcia, pcmcia-ctrl, pppoe, printer, redasd,\n"
+    "        memory, mmc-ctrl, modem, monitor, mouse, netcard, network, nvme,\n"
+    "        partition, pci, pcmcia, pcmcia-ctrl, pppoe, printer, redasd,\n"
     "        reallyall, scanner, scsi, smp, sound, storage-ctrl, sys, tape,\n"
     "        tv, uml, usb, usb-ctrl, vbe, wlan, xen, zip\n"
     "    --short\n"
diff --git a/src/hd/block.c b/src/hd/block.c
index 84d31eb..c727d7d 100644
--- a/src/hd/block.c
+++ b/src/hd/block.c
@@ -284,11 +284,35 @@ void get_block_devs(hd_data_t *hd_data)
         if(!strcmp(bus_name, "ide")) hd->bus.id = bus_ide;
         else if(!strcmp(bus_name, "scsi")) hd->bus.id = bus_scsi;
         else if(!strcmp(bus_name, "pci")) hd->bus.id = bus_pci;
-        else if(!strcmp(bus_name, "nvme")) hd->bus.id = bus_pci;
-        else if(!strcmp(bus_name, "nvme-subsystem")) hd->bus.id = bus_pci;
+        else if(!strcmp(bus_name, "nvme")) hd->bus.id = bus_nvme;
+        else if(!strcmp(bus_name, "nvme-subsystem")) hd->bus.id = bus_nvme;
       }
       hd->sysfs_bus_id = new_str(bus_id);
 
+      // add model name, if available
+      if((s = get_sysfs_attr_by_path(sf_dev, "model"))) {
+        char *cs = canon_str(s, strlen(s));
+        ADD2LOG("    model = %s\n", cs);
+        if(*cs) {
+          hd->device.name = cs;
+        }
+        else {
+          free_mem(cs);
+        }
+      }
+
+      // add serial, if available
+      if((s = get_sysfs_attr_by_path(sf_dev, "serial"))) {
+        char *cs = canon_str(s, strlen(s));
+        ADD2LOG("    serial = %s\n", cs);
+        if(*cs) {
+          hd->serial = cs;
+        }
+        else {
+          free_mem(cs);
+        }
+      }
+
       if((s = hd_sysfs_id(sf_dev))) {
 
         /* parent has longest matching sysfs id */
@@ -343,7 +367,7 @@ void get_block_devs(hd_data_t *hd_data)
       if(hd->bus.id == bus_ide) {
         add_ide_sysfs_info(hd_data, hd);
       }
-      else if(hd->bus.id == bus_scsi || hd->bus.id == bus_pci) {
+      else if(hd->bus.id == bus_scsi || hd->bus.id == bus_pci || hd->bus.id == bus_nvme) {
         /*
          * In case there's no data in the 'device' subdir but in
          * 'device/device', try one level deeper (for some capricious
@@ -758,7 +782,12 @@ void add_scsi_sysfs_info(hd_data_t *hd_data, hd_t *hd, char *sf_dev)
     hd->func = u3;
   }
 
-  if(hd->bus.id == bus_pci) {
+  if(hd->sysfs_bus_id && sscanf(hd->sysfs_bus_id, "nvme%u", &u0) == 1) {
+    hd->slot = u0;
+  }
+
+  // Looks like PCI device?
+  if(get_sysfs_attr_by_path(sf_dev, "subsystem_vendor")) {
     if(hd_attr_uint(get_sysfs_attr_by_path(sf_dev, "vendor"), &ul0, 0)) {
       ADD2LOG("    vendor = 0x%x\n", (unsigned) ul0);
       hd->vendor.id = MAKE_ID(TAG_PCI, ul0 & 0xffff);
diff --git a/src/hd/hd.c b/src/hd/hd.c
index 70a73d9..b1566a6 100644
--- a/src/hd/hd.c
+++ b/src/hd/hd.c
@@ -23,7 +23,9 @@
 #include <linux/hdreg.h>
 #define _LINUX_AUDIT_H_
 #define _LINUX_PRIO_TREE_H
+#ifndef FSCONFIG_SET_FLAG
 #include <linux/fs.h>
+#endif
 
 /**
  * @defgroup libhdBUSint Bus scanning code
@@ -910,6 +912,7 @@ void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item)
       break;
 
     case hw_scsi:
+    case hw_nvme:
     case hw_tape:
       hd_set_probe_feature(hd_data, pr_pci);
       hd_set_probe_feature(hd_data, pr_block);
@@ -4739,6 +4742,7 @@ void assign_hw_class(hd_data_t *hd_data, hd_t *hd)
         case hw_pci:
         case hw_isapnp:
         case hw_scsi:
+        case hw_nvme:
         case hw_ide:
 
         case hw_pcmcia:		/* special */
@@ -4805,6 +4809,9 @@ void assign_hw_class(hd_data_t *hd_data, hd_t *hd)
   else if(hd->bus.id == bus_scsi) {
     hd_set_hw_class(hd, hw_scsi);
   }
+  else if(hd->bus.id == bus_nvme) {
+    hd_set_hw_class(hd, hw_nvme);
+  }
   else if(hd->bus.id == bus_ide) {
     hd_set_hw_class(hd, hw_ide);
   }
diff --git a/src/hd/hd.h b/src/hd/hd.h
index ad17edf..a44f3b1 100644
--- a/src/hd/hd.h
+++ b/src/hd/hd.h
@@ -145,7 +145,7 @@ typedef enum hw_item {
   hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb,
   hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug,
   hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block,
-  hw_tape, hw_vbe, hw_bluetooth, hw_fingerprint, hw_mmc_ctrl,
+  hw_tape, hw_vbe, hw_bluetooth, hw_fingerprint, hw_mmc_ctrl, hw_nvme,
   /** append new entries here */
   hw_unknown, hw_all				/**< hw_all must be last */
 } hd_hw_item_t;
@@ -300,7 +300,8 @@ typedef enum bus_types {
   /** outside the range of the PCI values */
   bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb,
   bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv, bus_ps3_system_bus,
-  bus_virtio, bus_ibmebus, bus_gameport, bus_uisvirtpci, bus_mmc, bus_sdio, bus_nd
+  bus_virtio, bus_ibmebus, bus_gameport, bus_uisvirtpci, bus_mmc, bus_sdio, bus_nd,
+  bus_nvme,
 } hd_bus_types_t;
 
 /** @} */
diff --git a/src/hd/hwclass_names.h b/src/hd/hwclass_names.h
index 7fd44ae..b2caf7d 100644
--- a/src/hd/hwclass_names.h
+++ b/src/hd/hwclass_names.h
@@ -59,6 +59,7 @@ static hash_t hw_items[] = {
   { hw_tape,          "tape"                },
   { hw_vbe,           "vesa bios"           },
   { hw_bluetooth,     "bluetooth"           },
+  { hw_nvme,          "nvme"                },
   { hw_unknown,       "unknown"             },
   { 0,                NULL                  }
 };
diff --git a/src/hd/int.c b/src/hd/int.c
index 6097213..7b2dd3b 100644
--- a/src/hd/int.c
+++ b/src/hd/int.c
@@ -1230,8 +1230,6 @@ void int_legacy_geo(hd_data_t *hd_data)
   char *s;
   edd_info_t *ei;
 
-  if(!hd_data->edd) return;
-
   for(hd = hd_data->hd; hd; hd = hd->next) {
     if(
       hd->base_class.id == bc_storage_device &&
diff --git a/src/hd/net.c b/src/hd/net.c
index 05b187c..2579c89 100644
--- a/src/hd/net.c
+++ b/src/hd/net.c
@@ -619,7 +619,7 @@ hd_res_t *get_phwaddr(hd_data_t *hd_data, hd_t *hd)
       addr[3 * i - 1] = 0;
     }
 
-    ADD2LOG("  %s: ethtool permanent hw address[%d]: %s\n", hd->unix_dev_name, phwaddr->size, addr);
+    ADD2LOG("  %s: ethtool permanent hw address[%d]: %s\n", hd->unix_dev_name, phwaddr->size, addr ?: "");
 
     if(addr && strspn(addr, "0:") != strlen(addr)) {
       res = new_mem(sizeof *res);
diff --git a/src/hd/pci.c b/src/hd/pci.c
index 88c5e60..33c0d9a 100644
--- a/src/hd/pci.c
+++ b/src/hd/pci.c
@@ -1612,7 +1612,7 @@ void hd_read_vm(hd_data_t *hd_data)
       if(drv_name) drv_name++;
     }
 
-    ADD2LOG("    driver = \"%s\"\n", drv_name);
+    ADD2LOG("    driver = \"%s\"\n", drv_name ?: "");
 
     if(
       drv_name &&
diff --git a/src/ids/check_hd.c b/src/ids/check_hd.c
index 6d92a51..3b8d6f2 100644
--- a/src/ids/check_hd.c
+++ b/src/ids/check_hd.c
@@ -19,7 +19,7 @@ typedef enum hw_item {
   hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb,
   hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug,
   hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block,
-  hw_tape, hw_vbe, hw_bluetooth,
+  hw_tape, hw_vbe, hw_bluetooth, hw_nvme,
   /* append new entries here */
   hw_unknown, hw_all                                    /* hw_all must be last */
 } hd_hw_item_t;
diff --git a/src/ids/src/bus b/src/ids/src/bus
index f70549f..9ecc717 100644
--- a/src/ids/src/bus
+++ b/src/ids/src/bus
@@ -100,3 +100,5 @@
  bus.id			0x95
 +bus.name		ND
 
+ bus.id			0x96
++bus.name		NVME

More details

Full run details