- Update to version B.02.18+git.20191228:

* fix #755: handle invalid FAT
  * code clean-up
  * volumes: Add support for detecting Apple APFS fstype
  * partitions: Add Apple APFS GUID
  * specfile: Fix version issue
  * Do not show modified time with -notime option
  * Update help message and man page
- Drop upstreamed patches:
  * lshw-help-man.patch
  * lshw-modified-time.patch
- Add lshw-nvme.patch to support nvme devices bsc#1161323

OBS-URL: https://build.opensuse.org/package/show/hardware/lshw?expand=0&rev=38
This commit is contained in:
Martin Pluskal 2020-03-16 12:20:03 +00:00 committed by Git OBS Bridge
parent 4736c42966
commit c49810b6b3
10 changed files with 360 additions and 100 deletions

View File

@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/lyonel/lshw.git</param>
<param name="changesrevision">9567d10e4eb1c561030444dd3b7fe50ebb755f3e</param></service></servicedata>
<param name="changesrevision">89b3b6b9ed03f22ca98954712db5a90acf2c6755</param></service></servicedata>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:21711d339382ab834e242622bee7c040a75c499811d3159575acc8bfa9a876c9
size 1695448

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9caaed85389fd0f5bdc32fb20d976015e886a016234c3636d27d74991ffeb82d
size 1696040

View File

@ -13,20 +13,20 @@ Signed-off-by: Brahadambal Srinivasan <latha@linux.vnet.ibm.com>
src/lshw.1 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lshw.1 b/src/lshw.1
index 79c3619..31ff77f 100644
--- a/src/lshw.1
+++ b/src/lshw.1
Index: lshw-B.02.18+git.20191228/src/lshw.1
===================================================================
--- lshw-B.02.18+git.20191228.orig/src/lshw.1
+++ lshw-B.02.18+git.20191228/src/lshw.1
@@ -10,7 +10,7 @@ lshw \- list hardware
.sp
\fBlshw\fR [ \fB-X\fR ]
.sp
-\fBlshw\fR [ \fB [ -html ] [ -short ] [ -xml ] [ -json ] [ -businfo ] \fR ] [ \fB-dump \fIfilename\fB\fR ] [ \fB-class \fIclass\fB\fR\fI...\fR ] [ \fB-disable \fItest\fB\fR\fI...\fR ] [ \fB-enable \fItest\fB\fR\fI...\fR ] [ \fB-sanitize\fR ] [ \fB-numeric\fR ] [ \fB-quiet\fR ]
+\fBlshw\fR [ \fB [ -html ] [ -short ] [ -xml ] [ -json ] [ -businfo ] \fR ] [ \fB-dump \fIfilename\fB\fR ] [ \fB-class \fIclass\fB\fR\fI...\fR ] [ \fB-disable \fItest\fB\fR\fI...\fR ] [ \fB-enable \fItest\fB\fR\fI...\fR ] [ \fB-sanitize\fR ] [ \fB-numeric\fR ] [ \fB-notime\fR ] [ \fB-quiet\fR ]
+\fBlshw\fR [ \fB [ -html ] [ -short ] [ -xml ] [ -json ] [ -businfo ] \fR ] [ \fB-dump \fIfilename\fB\fR ] [ \fB-class \fIclass\fB\fR\fI...\fR ] [ \fB-disable \fItest\fB\fR\fI...\fR ] [ \fB-enable \fItest\fB\fR\fI...\fR ] [ \fB-sanitize\fR ] [ \fB-numeric\fR ] [ \fB-notime\fR ] [ \fB-quiet\fR ]
.SH "DESCRIPTION"
.PP
@@ -74,6 +74,8 @@ Remove potentially sensitive information from output (IP addresses, serial numbe
@@ -74,6 +74,8 @@ Remove potentially sensitive information
.TP
\fB-numeric\fR
Also display numeric IDs (for PCI and USB devices).
@ -35,5 +35,3 @@ index 79c3619..31ff77f 100644
.SH "BUGS"
.PP
\fBlshw\fR currently does not detect
--
2.18.1

View File

@ -14,10 +14,10 @@ Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
src/lshw.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: lshw-B.02.18+git.20190613/src/lshw.cc
Index: lshw-B.02.18+git.20191228/src/lshw.cc
===================================================================
--- lshw-B.02.18+git.20190613.orig/src/lshw.cc
+++ lshw-B.02.18+git.20190613/src/lshw.cc
--- lshw-B.02.18+git.20191228.orig/src/lshw.cc
+++ lshw-B.02.18+git.20191228/src/lshw.cc
@@ -121,7 +121,7 @@ char **argv)
printf("%s\n", getpackageversion());
if(latest)

View File

@ -1,43 +0,0 @@
From 33951733bb800321780444a178b969c212c65875 Mon Sep 17 00:00:00 2001
From: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Date: Wed, 12 Jul 2017 11:00:43 +0530
Subject: [PATCH] Update help message and man page
lshw -dump option displays output on stdout as well as stores SQLite
format data into a file. Lets update man page and help message to
reflect this.
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
[Updated description - Vasant]
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
src/lshw.1 | 2 +-
src/lshw.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: lshw-B.02.18+git.20190613/src/lshw.1
===================================================================
--- lshw-B.02.18+git.20190613.orig/src/lshw.1
+++ lshw-B.02.18+git.20190613/src/lshw.1
@@ -53,7 +53,7 @@ Outputs the device tree showing hardware
Outputs the device list showing bus information, detailing SCSI, USB, IDE and PCI addresses.
.TP
\fB-dump \fIfilename\fB\fR
-Dump collected information into a file (SQLite database).
+Display output and dump collected information into a file (SQLite database).
.TP
\fB-class \fIclass\fB\fR
Only show the given class of hardware. \fIclass\fR can be found using \fBlshw -short\fR or \fBlshw -businfo\fR\&.
Index: lshw-B.02.18+git.20190613/src/lshw.cc
===================================================================
--- lshw-B.02.18+git.20190613.orig/src/lshw.cc
+++ lshw-B.02.18+git.20190613/src/lshw.cc
@@ -35,7 +35,7 @@ void usage(const char *progname)
fprintf(stderr, _("\t-X use graphical interface\n"));
fprintf(stderr, _("\noptions can be\n"));
#ifdef SQLITE
- fprintf(stderr, _("\t-dump OUTFILE save hardware tree to a file\n"));
+ fprintf(stderr, _("\t-dump filename displays output and dump collected information into a file (SQLite database)\n"));
#endif
fprintf(stderr, _("\t-class CLASS only show a certain class of hardware\n"));
fprintf(stderr, _("\t-C CLASS same as '-class CLASS'\n"));

View File

@ -1,39 +0,0 @@
From d76f5c6bcb68ef1c5fabd84df9f6025ea1053b90 Mon Sep 17 00:00:00 2001
From: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Date: Thu, 13 Jul 2017 14:18:08 +0530
Subject: [PATCH] Do not show modified time with -notime option
Exclude volatile attributes (timestamps) from lshw -notime output.
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
[Updated description and fixed detect_hfsx() - Vasant]
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
src/core/volumes.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: lshw-B.02.18+git.20190613/src/core/volumes.cc
===================================================================
--- lshw-B.02.18+git.20190613.orig/src/core/volumes.cc
+++ lshw-B.02.18+git.20190613/src/core/volumes.cc
@@ -651,8 +651,10 @@ static bool detect_hfsx(hwNode & n, sour
wtime = (time_t)(be_long(&vol->modifyDate) - HFSTIMEOFFSET);
n.setConfig("created", datetime(mkfstime, false)); // creation time uses local time
if (enabled("output:time"))
+ {
n.setConfig("checked", datetime(fscktime));
- n.setConfig("modified", datetime(wtime));
+ n.setConfig("modified", datetime(wtime));
+ }
return true;
}
@@ -742,7 +744,7 @@ static bool detect_hfs(hwNode & n, sourc
n.setConfig("created", datetime(mkfstime - HFSTIMEOFFSET, false)); // all dates use local time
if(dumptime)
n.setConfig("backup", datetime(dumptime - HFSTIMEOFFSET, false));
- if(wtime)
+ if(wtime && enabled("output:time"))
n.setConfig("modified", datetime(wtime - HFSTIMEOFFSET, false));
return true;

329
lshw-nvme.patch Normal file
View File

@ -0,0 +1,329 @@
From 7b1863bd61c1751a67b020820f4243a4df4b379a Mon Sep 17 00:00:00 2001
From: Harry Mallon <harry.mallon@codex.online>
Date: Mon, 25 Mar 2019 19:44:14 +0000
Subject: [PATCH] add support for /dev/nvmeX NVMe controllers
* Added nvme scanning for controllers /dev/nvme[0-9]+
* Added nvme scanning for namespaces /dev/nvme[0-9]+n[0-9]+
* Fill in namespaces as disks
* Teach partition scanning about nvme partitions /dev/nvme[0-9]+n[0-9]+p[0-9]+
---
src/core/Makefile | 5 +-
src/core/main.cc | 4 ++
src/core/nvme.cc | 156 +++++++++++++++++++++++++++++++++++++++++
src/core/nvme.h | 7 ++
src/core/partitions.cc | 17 +++--
src/core/sysfs.cc | 15 ++++
src/core/sysfs.h | 3 +
7 files changed, 199 insertions(+), 8 deletions(-)
create mode 100644 src/core/nvme.cc
create mode 100644 src/core/nvme.h
Index: lshw-B.02.18+git.20191228/src/core/Makefile
===================================================================
--- lshw-B.02.18+git.20191228.orig/src/core/Makefile
+++ lshw-B.02.18+git.20191228/src/core/Makefile
@@ -8,7 +8,7 @@ LDFLAGS=
LDSTATIC=
LIBS=
-OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o s390.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o vio.o
+OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o nvme.o s390.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o vio.o
ifeq ($(SQLITE), 1)
OBJS+= db.o
endif
@@ -23,7 +23,7 @@ lib$(PACKAGENAME).a: $(OBJS)
$(AR) rs $@ $^
install: all
-
+
clean:
rm -f $(OBJS) lib$(PACKAGENAME).a
@@ -51,6 +51,7 @@ ide.o: version.h cpuinfo.h hw.h osutils.
cdrom.o: version.h cdrom.h hw.h partitions.h
pcmcia-legacy.o: version.h pcmcia-legacy.h hw.h osutils.h
scsi.o: version.h mem.h hw.h cdrom.h disk.h osutils.h heuristics.h sysfs.h
+nvme.o: version.h hw.h disk.h osutils.h sysfs.h
disk.o: version.h disk.h hw.h osutils.h heuristics.h partitions.h
spd.o: version.h spd.h hw.h osutils.h
network.o: version.h config.h network.h hw.h osutils.h sysfs.h options.h
Index: lshw-B.02.18+git.20191228/src/core/main.cc
===================================================================
--- lshw-B.02.18+git.20191228.orig/src/core/main.cc
+++ lshw-B.02.18+git.20191228/src/core/main.cc
@@ -29,6 +29,7 @@
#include "pcmcia-legacy.h"
#include "ide.h"
#include "scsi.h"
+#include "nvme.h"
#include "spd.h"
#include "network.h"
#include "isapnp.h"
@@ -132,6 +133,9 @@ bool scan_system(hwNode & system)
status("SCSI");
if (enabled("scsi"))
scan_scsi(computer);
+ status("NVMe");
+ if (enabled("nvme"))
+ scan_nvme(computer);
status("S/390 devices");
if (enabled("s390"))
scan_s390_devices(computer);
Index: lshw-B.02.18+git.20191228/src/core/nvme.cc
===================================================================
--- /dev/null
+++ lshw-B.02.18+git.20191228/src/core/nvme.cc
@@ -0,0 +1,156 @@
+#include "version.h"
+#include "disk.h"
+#include "osutils.h"
+#include "sysfs.h"
+#include "hw.h"
+#include <glob.h>
+#include <libgen.h>
+
+#include <string>
+
+__ID("@(#) $Id$");
+
+#define CLASS_NVME "nvme"
+#define NVMEX "/dev/nvme[0-9]*"
+#define NVMEXNX "/dev/nvme[0-9]*n[0-9]*"
+
+static void scan_controllers(hwNode & n)
+{
+ glob_t entries;
+ size_t j;
+
+ if(glob(NVMEX, 0, NULL, &entries) == 0)
+ {
+ for(j=0; j < entries.gl_pathc; j++)
+ {
+ if(matches(entries.gl_pathv[j], "^/dev/nvme[[:digit:]]+$"))
+ {
+ string businfo = "";
+ string logicalname = "";
+ hwNode *device = NULL;
+
+ logicalname = basename(entries.gl_pathv[j]);
+ if (logicalname.empty())
+ continue;
+
+ businfo = sysfs::entry::byClass(CLASS_NVME, logicalname).businfo();
+
+ if (!businfo.empty())
+ device = n.findChildByBusInfo(businfo);
+
+ if (!device)
+ device = n.findChildByLogicalName(logicalname);
+
+ if (!device)
+ {
+ hwNode *core = n.getChild("core");
+
+ if (core)
+ device = n.getChild("nvme");
+
+ if (core && !device)
+ device = core->addChild(hwNode("nvme", hw::storage));
+ }
+
+ if (!device)
+ device = n.addChild(hwNode("nvme", hw::storage));
+
+ if (device)
+ {
+ if(device->getBusInfo().empty())
+ device->setBusInfo(businfo);
+ device->setLogicalName(logicalname);
+ device->claim();
+ }
+ }
+ }
+
+ globfree(&entries);
+ }
+}
+
+static void scan_namespaces(hwNode & n)
+{
+ glob_t entries;
+ size_t j;
+
+ if(glob(NVMEXNX, 0, NULL, &entries) == 0)
+ {
+ for(j=0; j < entries.gl_pathc; j++)
+ {
+ if(matches(entries.gl_pathv[j], "^/dev/nvme[[:digit:]]+n[[:digit:]]+$"))
+ {
+ // We get this information from sysfs rather than doing an NVMe Identify command
+ // so they may not all be available from all kernels.
+ string path = entries.gl_pathv[j];
+ string logicalname = "";
+ string parentlogicalname = "";
+ string model;
+ string serial;
+ string firmware_rev;
+ hwNode *parent = NULL;
+ hwNode device = hwNode("disk", hw::disk);
+
+ logicalname = basename(entries.gl_pathv[j]);
+ if (logicalname.empty())
+ continue;
+
+ parentlogicalname = path.substr(0, path.find_last_of("n"));
+
+ sysfs::entry e = sysfs::entry::byClass("block", logicalname);
+
+ model = e.model();
+ serial = e.serial();
+ firmware_rev = e.firmware_rev();
+
+ device.setDescription("NVMe disk");
+ device.setLogicalName(logicalname);
+ device.claim();
+
+ if (!model.empty())
+ device.setProduct(model);
+ if (!serial.empty())
+ device.setSerial(serial);
+ if (!firmware_rev.empty())
+ device.setVersion(firmware_rev);
+
+ scan_disk(device);
+
+ if (!parentlogicalname.empty())
+ parent = n.findChildByLogicalName(parentlogicalname);
+
+ if (!parent)
+ {
+ hwNode *core = n.getChild("core");
+
+ if (core)
+ parent = n.getChild("nvme");
+
+ if (core && !parent)
+ parent = core->addChild(hwNode("nvme", hw::storage));
+ }
+
+ if (!parent)
+ parent = n.addChild(hwNode("nvme", hw::storage));
+
+ if (parent)
+ {
+ parent->addChild(device);
+ parent->claim();
+ }
+ }
+ }
+
+ globfree(&entries);
+ }
+
+}
+
+bool scan_nvme(hwNode & n)
+{
+ scan_controllers(n);
+
+ scan_namespaces(n);
+
+ return false;
+}
Index: lshw-B.02.18+git.20191228/src/core/nvme.h
===================================================================
--- /dev/null
+++ lshw-B.02.18+git.20191228/src/core/nvme.h
@@ -0,0 +1,7 @@
+#ifndef _NVME_H_
+#define _NVME_H_
+
+#include "hw.h"
+
+bool scan_nvme(hwNode & n);
+#endif
Index: lshw-B.02.18+git.20191228/src/core/partitions.cc
===================================================================
--- lshw-B.02.18+git.20191228.orig/src/core/partitions.cc
+++ lshw-B.02.18+git.20191228/src/core/partitions.cc
@@ -295,6 +295,7 @@ static bool guess_logicalname(source & s
struct stat buf;
char name[10];
int dev = 0;
+ string devname;
snprintf(name, sizeof(name), "%d", n);
if(disk.getBusInfo()!="")
@@ -304,9 +305,16 @@ static bool guess_logicalname(source & s
if(!S_ISBLK(buf.st_mode)) return false;
if(s.diskname!="")
- dev = open_dev(buf.st_rdev + n, S_IFBLK, s.diskname+string(name));
+ devname = s.diskname;
else
- dev = open_dev(buf.st_rdev + n, S_IFBLK, disk.getLogicalName()+string(name));
+ devname = disk.getLogicalName();
+
+ // NVMe partitions are like /dev/nvme0n1p2
+ if(matches(devname, "^/dev/nvme[[:digit:]]+n[[:digit:]]+$"))
+ devname += "p";
+ devname += string(name);
+
+ dev = open_dev(buf.st_rdev + n, S_IFBLK, devname);
if(dev>=0)
{
@@ -330,10 +338,7 @@ static bool guess_logicalname(source & s
if(memcmp(buffer1, buffer2, BLOCKSIZE)==0)
{
partition.claim();
- if(s.diskname!="")
- partition.setLogicalName(s.diskname+string(name));
- else
- partition.setLogicalName(disk.getLogicalName()+string(name));
+ partition.setLogicalName(devname);
return true;
}
}
Index: lshw-B.02.18+git.20191228/src/core/sysfs.cc
===================================================================
--- lshw-B.02.18+git.20191228.orig/src/core/sysfs.cc
+++ lshw-B.02.18+git.20191228/src/core/sysfs.cc
@@ -368,6 +368,21 @@ string entry::vendor() const
return get_string(This->devpath+"/vendor");
}
+string entry::model() const
+{
+ return get_string(This->devpath+"/model");
+}
+
+string entry::serial() const
+{
+ return get_string(This->devpath+"/serial");
+}
+
+string entry::firmware_rev() const
+{
+ return get_string(This->devpath+"/firmware_rev");
+}
+
vector < entry > sysfs::entries_by_bus(const string & busname)
{
vector < entry > result;
Index: lshw-B.02.18+git.20191228/src/core/sysfs.h
===================================================================
--- lshw-B.02.18+git.20191228.orig/src/core/sysfs.h
+++ lshw-B.02.18+git.20191228/src/core/sysfs.h
@@ -28,6 +28,9 @@ namespace sysfs
string modalias() const;
string device() const;
string vendor() const;
+ string model() const;
+ string serial() const;
+ string firmware_rev() const;
entry parent() const;
string name_in_class(const string &) const;
string string_attr(const string & name, const string & def = "") const;

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Mar 16 12:14:54 UTC 2020 - Martin Pluskal <mpluskal@suse.com>
- Update to version B.02.18+git.20191228:
* fix #755: handle invalid FAT
* code clean-up
* volumes: Add support for detecting Apple APFS fstype
* partitions: Add Apple APFS GUID
* specfile: Fix version issue
* Do not show modified time with -notime option
* Update help message and man page
- Drop upstreamed patches:
* lshw-help-man.patch
* lshw-modified-time.patch
- Add lshw-nvme.patch to support nvme devices bsc#1161323
-------------------------------------------------------------------
Thu Feb 20 08:15:44 UTC 2020 - Martin Pluskal <mpluskal@suse.com>

View File

@ -18,7 +18,7 @@
Name: lshw
Version: B.02.18+git.20190613
Version: B.02.18+git.20191228
Release: 0
Summary: HardWare LiSter
License: GPL-2.0-only
@ -29,9 +29,8 @@ Source1: lshw.desktop.in
Source2: lshw.png
# PATCH-FIX-UPSTREAM lshw-display-latest-version.patch lshw-help-man.patch lshw-modified-time.patch bsc##1130818
Patch1: lshw-display-latest-version.patch
Patch2: lshw-help-man.patch
Patch3: lshw-modified-time.patch
Patch4: lshw-add-notime-option-to-manpage.patch
Patch5: lshw-nvme.patch
BuildRequires: gcc-c++
BuildRequires: hicolor-icon-theme
BuildRequires: libpng-devel