Compare commits

..

1 Commits
c8 ... c10-beta

Author SHA1 Message Date
9624e34f3a import RHEL 10 Beta lshw-B.02.20-4.el10 2024-11-20 13:43:47 +00:00
48 changed files with 496 additions and 3754 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/lshw-B.02.19.2.tar.gz lshw-B.02.20.tar.gz

View File

@ -1 +0,0 @@
f44f0fa34968fdc0cce42e83c44b17e43579e978 SOURCES/lshw-B.02.19.2.tar.gz

View File

@ -1,149 +0,0 @@
From 71cf63b7bb7bb212580cc7c8e6c75a4f645d79f1 Mon Sep 17 00:00:00 2001
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Date: Wed, 20 May 2020 06:27:05 -0500
Subject: [PATCH 01/18] Fix few memory leaks
Valgrind showed some leaks with scandir usage in sysfs.cc.
Patch audits all the scandir usage and fixes where required.
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
src/core/parisc.cc | 10 ++++++----
src/core/spd.cc | 4 ++++
src/core/sysfs.cc | 32 ++++++++++++++++++++++++++++----
3 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/src/core/parisc.cc b/src/core/parisc.cc
index 80344d28c6ba..1e531e32bbc2 100644
--- a/src/core/parisc.cc
+++ b/src/core/parisc.cc
@@ -561,11 +561,13 @@ static bool scan_device(hwNode & node, string name = "")
else
{
for (int i = 0; i < n; i++)
- if(matches(namelist[i]->d_name, "^[0-9]+(:[0-9]+)*$"))
{
- pushd(namelist[i]->d_name);
- scan_device(curnode?*curnode:node, namelist[i]->d_name);
- popd();
+ if(matches(namelist[i]->d_name, "^[0-9]+(:[0-9]+)*$"))
+ {
+ pushd(namelist[i]->d_name);
+ scan_device(curnode?*curnode:node, namelist[i]->d_name);
+ popd();
+ }
free(namelist[i]);
}
free(namelist);
diff --git a/src/core/spd.cc b/src/core/spd.cc
index 061d0fd3e186..a304d061a008 100644
--- a/src/core/spd.cc
+++ b/src/core/spd.cc
@@ -192,8 +192,12 @@ static bool scan_eeproms(hwNode & memory)
return false;
for (int i = 0; i < n; i++)
+ {
if (scan_eeprom(memory, namelist[i]->d_name))
current_bank++;
+ free(namelist[i]);
+ }
+ free(namelist);
return true;
}
diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc
index ee8b1da06c78..4e2df1c9cb09 100644
--- a/src/core/sysfs.cc
+++ b/src/core/sysfs.cc
@@ -83,7 +83,7 @@ static string sysfs_getbustype(const string & path)
{
struct dirent **namelist;
int i, n;
- string devname;
+ string bustype = "";
/*
to determine to which kind of bus a device is connected:
@@ -96,17 +96,28 @@ static string sysfs_getbustype(const string & path)
n = scandir(".", &namelist, selectdir, alphasort);
popd();
+ if (n <= 0)
+ return "";
+
for (i = 0; i < n; i++)
{
- devname =
+ string devname =
string(fs.path + "/bus/") + string(namelist[i]->d_name) +
"/devices/" + basename(path.c_str());
if (samefile(devname, path))
- return string(namelist[i]->d_name);
+ {
+ bustype = string(namelist[i]->d_name);
+ break;
+ }
+ free(namelist[i]);
}
- return "";
+ for (int j = i; j < n; j++)
+ free(namelist[j]);
+ free(namelist);
+
+ return bustype;
}
@@ -405,7 +416,11 @@ vector < entry > entry::devices() const
entry e = sysfs::entry(This->devpath + "/" + string(namelist[i]->d_name));
if(e.hassubdir("subsystem"))
result.push_back(e);
+ free(namelist[i]);
}
+ if (namelist)
+ free(namelist);
+
if(pushd("block"))
{
int count = scandir(".", &namelist, selectdir, alphasort);
@@ -414,7 +429,10 @@ vector < entry > entry::devices() const
entry e = sysfs::entry(This->devpath + "/block/" + string(namelist[i]->d_name));
if(e.hassubdir("subsystem"))
result.push_back(e);
+ free(namelist[i]);
}
+ if (namelist)
+ free(namelist);
popd();
}
popd();
@@ -435,8 +453,11 @@ vector < entry > sysfs::entries_by_bus(const string & busname)
{
entry e = sysfs::entry::byBus(busname, namelist[i]->d_name);
result.push_back(e);
+ free(namelist[i]);
}
popd();
+ if (namelist)
+ free(namelist);
return result;
}
@@ -454,8 +475,11 @@ vector < entry > sysfs::entries_by_class(const string & classname)
{
entry e = sysfs::entry::byClass(classname, namelist[i]->d_name);
result.push_back(e);
+ free(namelist[i]);
}
popd();
+ if (namelist)
+ free(namelist);
return result;
}
--
2.17.1

View File

@ -1,44 +0,0 @@
From 74e23540335254b8fca6a81cc891c52d96937d40 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Thu, 29 Apr 2021 16:40:37 +0200
Subject: [PATCH] Fix getting size of memory banks <32GiB
PR65 on Github (thanks to Z.Bitter)
Due to a regression introduced by 8ff1efb, no size was recorded for memory banks <32GiB in size on systems with an SMBIOS version of 2.7 or later. On these systems the Type 17 size field from SMBIOS was only recorded if the extended size field was used.
Modify the code to use the regular size field whenever it is valid (not 0xFFFF) and not set to 0x7FFF on versions >2.7 (indicating the extended size field is in use).
---
src/core/dmi.cc | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/core/dmi.cc b/src/core/dmi.cc
index fe6ad39..96b6506 100644
--- a/src/core/dmi.cc
+++ b/src/core/dmi.cc
@@ -1567,15 +1567,14 @@ int dmiversionrev)
// size
u = data[0x0D] << 8 | data[0x0C];
- if ((dmiversionmaj > 2)
- || ((dmiversionmaj == 2) && (dmiversionmin >= 7))) {
- if(u == 0x7FFF) {
- unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C];
- extendsize &= 0x7FFFFFFFUL;
- size = extendsize * 1024ULL * 1024ULL;
- }
+ if (((dmiversionmaj > 2)
+ || ((dmiversionmaj == 2) && (dmiversionmin >= 7)))
+ && u == 0x7FFF) {
+ unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C];
+ extendsize &= 0x7FFFFFFFUL;
+ size = extendsize * 1024ULL * 1024ULL;
}
- else
+ else
if (u != 0xFFFF)
size = (1024ULL * (u & 0x7FFF) * ((u & 0x8000) ? 1 : 1024ULL));
description += string(dmi_memory_device_form_factor(data[0x0E]));
--
2.29.2

View File

@ -1,36 +0,0 @@
From 5c4bfb1a4baae1bea11cc9f629bc48ee12e733a7 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Sun, 10 Jan 2021 00:38:10 +0100
Subject: [PATCH] Report correct memory size on SMBIOS < 2.7
Github PR#60
---
src/core/dmi.cc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/core/dmi.cc b/src/core/dmi.cc
index 30b3ab3b995c..d33d4879bdca 100644
--- a/src/core/dmi.cc
+++ b/src/core/dmi.cc
@@ -1567,10 +1567,13 @@ int dmiversionrev)
// size
u = data[0x0D] << 8 | data[0x0C];
- if(u == 0x7FFF) {
- unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C];
- extendsize &= 0x7FFFFFFFUL;
- size = extendsize * 1024ULL * 1024ULL;
+ if ((dmiversionmaj > 2)
+ || ((dmiversionmaj == 2) && (dmiversionmin >= 7))) {
+ if(u == 0x7FFF) {
+ unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C];
+ extendsize &= 0x7FFFFFFFUL;
+ size = extendsize * 1024ULL * 1024ULL;
+ }
}
else
if (u != 0xFFFF)
--
2.17.1

View File

@ -1,28 +0,0 @@
From 9c5c2f0706db330114ff4624e0931ac40c1d6fe2 Mon Sep 17 00:00:00 2001
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Date: Wed, 20 Jan 2021 11:28:47 +0530
Subject: [PATCH] devtree: Add UUID property
Add UUID property to PowerVM LPAR.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
src/core/device-tree.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
index d3188c6a8a27..7df6a4ee074c 100644
--- a/src/core/device-tree.cc
+++ b/src/core/device-tree.cc
@@ -1503,6 +1503,8 @@ bool scan_device_tree(hwNode & n)
scan_devtree_bootrom(*core);
if (exists(DEVICETREE "/ibm,lpar-capable")) {
n.setDescription("pSeries LPAR");
+ if (exists( DEVICETREE "/ibm,partition-uuid"))
+ n.setConfig("uuid", get_string(DEVICETREE "/ibm,partition-uuid"));
scan_devtree_cpu_power(*core);
}
else {
--
2.17.1

View File

@ -1,96 +0,0 @@
From f914f225975bb4a146792c2b0181b8d0e01ff3a6 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Sat, 28 Mar 2020 11:54:10 +0100
Subject: [PATCH 01/17] report CPU family/model/stepping
---
src/core/cpuinfo.cc | 21 +++++++++++++++++++--
src/core/hw.cc | 20 ++++++++++++++++++++
src/core/hw.h | 1 +
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
index 33085fda1159..eceb83aa4e3a 100644
--- a/src/core/cpuinfo.cc
+++ b/src/core/cpuinfo.cc
@@ -463,6 +463,14 @@ string value)
}
if (id == "model name")
cpu->setProduct(value);
+ if (id == "microcode")
+ cpu->setConfig(id, stoll(value, NULL, 0));
+ if (id == "cpu family")
+ cpu->addHint(id, stoll(value, NULL, 0));
+ if (id == "model")
+ cpu->addHint(id, stoll(value, NULL, 0));
+ if (id == "stepping")
+ cpu->addHint(id, stoll(value, NULL, 0));
//if ((id == "cpu MHz") && (cpu->getSize() == 0))
//{
//cpu->setSize((long long) (1000000L * atof(value.c_str())));
@@ -667,8 +675,17 @@ bool scan_cpuinfo(hwNode & n)
}
hwNode *cpu = getcpu(n, 0);
- if(cpu && (n.getWidth()==0))
- n.setWidth(cpu->getWidth());
+ if(cpu)
+ {
+ hw::value family, model, stepping;
+ family = cpu->getHint("cpu family");
+ model = cpu->getHint("model");
+ stepping = cpu->getHint("stepping");
+ if(family.defined() && model.defined() && stepping.defined())
+ cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger()));
+ if(n.getWidth()==0)
+ n.setWidth(cpu->getWidth());
+ }
return true;
}
diff --git a/src/core/hw.cc b/src/core/hw.cc
index 4522c1af0fc3..a59273008862 100644
--- a/src/core/hw.cc
+++ b/src/core/hw.cc
@@ -2432,6 +2432,26 @@ string value::asString() const
}
+long long value::asInteger() const
+{
+ if(!This) return 0;
+
+ switch(This->type)
+ {
+ case hw::text:
+ return stoll(This->s, NULL, 0);
+ case hw::integer:
+ return This->ll;
+ case hw::boolean:
+ return This->b?1:0;
+ case hw::nil:
+ return 0;
+ };
+
+ return 0;
+}
+
+
bool value::defined() const
{
if(!This) return false;
diff --git a/src/core/hw.h b/src/core/hw.h
index 3cb782b0e635..451e9b3cf26a 100644
--- a/src/core/hw.h
+++ b/src/core/hw.h
@@ -79,6 +79,7 @@ namespace hw
bool operator ==(const value &) const;
string asString() const;
+ long long asInteger() const;
bool defined() const;
private:
--
2.17.1

View File

@ -1,96 +0,0 @@
From ad4ecfd29c29f6895aaf02092e6574299a2b5aa9 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 03:12:51 +0200
Subject: [PATCH 02/18] Build against gtk3 instead of gtk2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since gtk2 is on life support, it makes sense to build the gui code with
gtk3 nowadays.
I went for 3.24 because thats the version I have available on my
system, but it is probable that previous versions would also work, I
dont know.
[lijiang added the following comment]
Note: Because rhel8 uses the cmake, update the CMakeLists instead of
Makefile.
In addition, currently, rhel8 only supports the gtk-3.22 instead of
gtk-3.24, so downgrade to gtk-3.22, otherwise the build will fail.
---
README.md | 2 +-
lshw.spec.in | 4 ++--
src/gui/CMakeLists.txt | 6 +++---
src/gui/gtk-lshw.ui | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 294888c71ff0..cf50e5151228 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Installation
- cmake, GNU make or Ninja
- an ANSI (or close enough to ANSI compliance) C++ compiler (tested with g++ 2.95.4 and 3.x)
- for the (optional) GTK+ graphical user interface, you will need a
- complete GTK+ development environment (gtk2-devel on RedHat/Fedora derivatives)
+ complete GTK+ development environment (gtk3-devel on RedHat/Fedora derivatives)
- for optional SQLite feature install SQLite
- for optional zlib feature install zlib and gzip
diff --git a/lshw.spec.in b/lshw.spec.in
index 3fe23c2ef360..78018211e1af 100644
--- a/lshw.spec.in
+++ b/lshw.spec.in
@@ -31,8 +31,8 @@ http://lshw.ezix.org/
Summary: HardWare LiSter (GUI version)
Group: Applications/System
Requires: %{name} >= %{version}
-Requires: gtk2 >= 2.4
-BuildRequires: gtk2-devel >= 2.4
+Requires: gtk3 >= 3.22
+BuildRequires: gtk3-devel >= 3.22
%description gui
lshw (Hardware Lister) is a small tool to provide detailed informaton on
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 34890535a070..34c9e4383c3e 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -4,17 +4,17 @@ if(NOT GUI OR STATIC)
endif()
find_package(PkgConfig)
-pkg_check_modules(GTK2 REQUIRED gtk+-2.0 gmodule-2.0)
+pkg_check_modules(GTK3 REQUIRED gtk+-3.0 gmodule-2.0)
file(GLOB GTK_SOURCES "*.c*")
include_directories("${PROJECT_BINARY_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/src/core")
-include_directories("${GTK2_INCLUDE_DIRS}")
+include_directories("${GTK3_INCLUDE_DIRS}")
add_executable(gtk-lshw ${GTK_SOURCES})
-target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK2_LIBRARIES} core resolv)
+target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK3_LIBRARIES} core resolv)
install(TARGETS gtk-lshw DESTINATION sbin)
if(POLICYKIT)
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index 73fc08a58d1e..25ab1ad03349 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.22"/>
+ <requires lib="gtk+" version="3.22"/>
<object class="GtkDialog" id="aboutlshw">
<property name="can_focus">False</property>
<property name="title" translatable="yes">About</property>
--
2.17.1

View File

@ -1,53 +0,0 @@
From 126bc4387648fabf0478d0b869fe6bc52676b447 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Sun, 29 Mar 2020 19:25:39 +0200
Subject: [PATCH 02/17] move PnP devices to the ISA/LPC bridge
---
src/core/pnp.cc | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/core/pnp.cc b/src/core/pnp.cc
index 8c92adf647a0..6a391856ec52 100644
--- a/src/core/pnp.cc
+++ b/src/core/pnp.cc
@@ -165,6 +165,11 @@ hw::hwClass pnp_class(const string & pnpid)
return hw::generic;
}
+static bool ISAbridge(const hwNode & n)
+{
+ return n.getClass()==hw::bridge && n.isCapable("isa");
+}
+
bool scan_pnp(hwNode & n)
{
vector < sysfs::entry > entries = sysfs::entries_by_bus("pnp");
@@ -172,11 +177,12 @@ bool scan_pnp(hwNode & n)
if (entries.empty())
return false;
- hwNode *core = n.getChild("core");
- if (!core)
+ hwNode *isapnpbridge = n.findChild(ISAbridge);
+ if (!isapnpbridge) isapnpbridge = n.getChild("core");
+ if (!isapnpbridge)
{
n.addChild(hwNode("core", hw::bus));
- core = n.getChild("core");
+ isapnpbridge = n.getChild("core");
}
for (vector < sysfs::entry >::iterator it = entries.begin();
@@ -208,7 +214,7 @@ bool scan_pnp(hwNode & n)
device.setProduct("PnP device " + pnpid);
device.claim();
- core->addChild(device);
+ isapnpbridge->addChild(device);
}
return true;
}
--
2.17.1

View File

@ -1,27 +0,0 @@
From b79101ccdbb609e3dccfe097952ab2d3d7b55951 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 03:39:46 +0200
Subject: [PATCH 03/18] Remove deprecated stock messages
---
src/gui/gtk-lshw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gui/gtk-lshw.c b/src/gui/gtk-lshw.c
index 50dfb8329a5c..9ac525c715d8 100644
--- a/src/gui/gtk-lshw.c
+++ b/src/gui/gtk-lshw.c
@@ -31,8 +31,8 @@ main (int argc, char *argv[])
GTK_BUTTONS_NONE,
"Executing this program as a normal user will give incomplete and maybe erroneous information.");
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
- GTK_STOCK_QUIT, GTK_RESPONSE_CANCEL,
- GTK_STOCK_EXECUTE, GTK_RESPONSE_ACCEPT,
+ "_Quit", GTK_RESPONSE_CANCEL,
+ "_Execute", GTK_RESPONSE_ACCEPT,
NULL);
proceed = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT);
--
2.17.1

View File

@ -1,34 +0,0 @@
From bb82dda52da2029a527577a796daffcbc97d8e83 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Mon, 30 Mar 2020 23:36:15 +0200
Subject: [PATCH 03/17] correctly format SMBIOS UUID
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
cf. https://en.wikipedia.org/wiki/Universally_unique_identifier (RFC 4122 Section 3 requires that the characters be generated in lower case, while being case-insensitive on input.)
cf. https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf §7.2.1
---
src/core/dmi.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/dmi.cc b/src/core/dmi.cc
index c4c01e02a392..30b3ab3b995c 100644
--- a/src/core/dmi.cc
+++ b/src/core/dmi.cc
@@ -195,8 +195,8 @@ static string dmi_uuid(const u8 * p)
return string(REMOVED);
snprintf(buffer, sizeof(buffer),
- "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10],
+ "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6], p[8], p[9], p[10],
p[11], p[12], p[13], p[14], p[15]);
return hw::strip(string(buffer));
--
2.17.1

View File

@ -1,44 +0,0 @@
From 8d696376c0f044507575e933b3e438e104f3ecd2 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 03:40:04 +0200
Subject: [PATCH 04/18] Remove hack which is apparently not useful anymore
---
src/gui/stock.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/gui/stock.c b/src/gui/stock.c
index 08675db8f037..46dfbe7173b5 100644
--- a/src/gui/stock.c
+++ b/src/gui/stock.c
@@ -89,7 +89,6 @@ lshw_gtk_stock_init(void)
static int stock_initted = 0;
GtkIconFactory *icon_factory;
int i;
- GtkWidget *win;
if (stock_initted)
return;
@@ -101,10 +100,6 @@ lshw_gtk_stock_init(void)
gtk_icon_factory_add_default(icon_factory);
-/* Er, yeah, a hack, but it works. :) */
- win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_realize(win);
-
for (i = 0; i < G_N_ELEMENTS(stock_icons); i++)
{
GdkPixbuf *pixbuf;
@@ -128,8 +123,6 @@ lshw_gtk_stock_init(void)
}
}
- gtk_widget_destroy(win);
-
/* register logo icon size */
gtk_icon_size_register(LSHW_ICON_SIZE_LOGO, LSHW_DEFAULT_ICON_SIZE, LSHW_DEFAULT_ICON_SIZE);
--
2.17.1

View File

@ -1,27 +0,0 @@
From aea375aeb4f58a35afd1ec2998a04060bc8fccfa Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Tue, 31 Mar 2020 23:27:36 +0200
Subject: [PATCH 04/17] cosmetic clean-up
---
src/core/mmc.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/mmc.cc b/src/core/mmc.cc
index 96c2c49e4597..1385e116c7ae 100644
--- a/src/core/mmc.cc
+++ b/src/core/mmc.cc
@@ -327,8 +327,8 @@ bool scan_mmc(hwNode & n)
device->setDescription("MMC Host");
device->setModalias(e.modalias());
- vector < sysfs::entry > namespaces = e.devices();
- for(vector < sysfs::entry >::iterator i = namespaces.begin(); i != namespaces.end(); ++i)
+ vector < sysfs::entry > devices = e.devices();
+ for(vector < sysfs::entry >::iterator i = devices.begin(); i != devices.end(); ++i)
{
const sysfs::entry & d = *i;
--
2.17.1

View File

@ -1,60 +0,0 @@
From 41c04d1c5ee84b1f42a9fabf7623a98ff02b9bf1 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 04:37:55 +0200
Subject: [PATCH 05/18] Use GtkFileChooserNative instead of
GtkFileChooserDialog
This class allows it to work even in containers.
---
src/gui/engine.cc | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/gui/engine.cc b/src/gui/engine.cc
index 2d2e58bb9a21..21e446e0359d 100644
--- a/src/gui/engine.cc
+++ b/src/gui/engine.cc
@@ -460,7 +460,7 @@ static void redirect_cout(std::ofstream &out, bool enable = true)
void save_as(GtkWidget *mainwindow)
{
struct utsname buf;
- GtkWidget *dialog = NULL;
+ GtkFileChooserNative *dialog = NULL;
GtkWidget *sanitize = NULL;
GtkFileFilter *filter = NULL;
bool proceed = true;
@@ -469,12 +469,11 @@ void save_as(GtkWidget *mainwindow)
if(!computer) // nothing to save
return;
- dialog = gtk_file_chooser_dialog_new ("Save hardware configuration",
+ dialog = gtk_file_chooser_native_new ("Save hardware configuration",
GTK_WINDOW(mainwindow),
GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
+ "_Save",
+ "_Cancel");
//gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
sanitize = gtk_check_button_new_with_label("Anonymize output");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sanitize), enabled("output:sanitize")?TRUE:FALSE);
@@ -511,7 +510,7 @@ void save_as(GtkWidget *mainwindow)
if(uname(&buf)==0)
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), buf.nodename);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ if (gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
char *filename;
@@ -603,5 +602,5 @@ void save_as(GtkWidget *mainwindow)
}
}
- gtk_widget_destroy (dialog);
+ g_object_unref (dialog);
}
--
2.17.1

View File

@ -1,223 +0,0 @@
From 691ed58e2838ca3e50e899f013e259ea84f6bfe9 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Wed, 1 Apr 2020 00:43:15 +0200
Subject: [PATCH 05/17] begin work on input devices
still missing:
* capabilities
* properties
* report at least as much information as /proc/bus/input/devices
---
src/core/hw.cc | 2 +-
src/core/input.cc | 146 ++++++++++++++++++++++++++++++++++++++++++++++
src/core/input.h | 8 +++
src/core/main.cc | 4 ++
4 files changed, 159 insertions(+), 1 deletions(-)
create mode 100644 src/core/input.cc
create mode 100644 src/core/input.h
diff --git a/src/core/hw.cc b/src/core/hw.cc
index a59273008862..f7da370816c5 100644
--- a/src/core/hw.cc
+++ b/src/core/hw.cc
@@ -1083,7 +1083,7 @@ void hwNode::setLogicalName(const string & name)
This->logicalnames.push_back("/dev/" + n);
}
else
- This->logicalnames.push_back(n);
+ This->logicalnames.push_back(basename(n.c_str()));
if(This->dev == "")
This->dev = get_devid(n);
diff --git a/src/core/input.cc b/src/core/input.cc
new file mode 100644
index 000000000000..1f14fa9d8b56
--- /dev/null
+++ b/src/core/input.cc
@@ -0,0 +1,146 @@
+#include "version.h"
+#include "hw.h"
+#include "sysfs.h"
+#include "osutils.h"
+#include "input.h"
+#include "disk.h"
+#include "heuristics.h"
+
+#include <vector>
+#include <iostream>
+
+__ID("@(#) $Id$");
+
+#define BUS_PCI 0x01
+#define BUS_ISAPNP 0x02
+#define BUS_USB 0x03
+#define BUS_HIL 0x04
+#define BUS_BLUETOOTH 0x05
+#define BUS_VIRTUAL 0x06
+
+#define BUS_ISA 0x10
+#define BUS_I8042 0x11
+#define BUS_XTKBD 0x12
+#define BUS_RS232 0x13
+#define BUS_GAMEPORT 0x14
+#define BUS_PARPORT 0x15
+#define BUS_AMIGA 0x16
+#define BUS_ADB 0x17
+#define BUS_I2C 0x18
+#define BUS_HOST 0x19
+#define BUS_GSC 0x1A
+#define BUS_ATARI 0x1B
+#define BUS_SPI 0x1C
+#define BUS_RMI 0x1D
+#define BUS_CEC 0x1E
+#define BUS_INTEL_ISHTP 0x1F
+
+using namespace std;
+
+bool scan_input(hwNode & n)
+{
+ vector < sysfs::entry > entries = sysfs::entries_by_class("input");
+
+ if (entries.empty())
+ return false;
+
+ for (vector < sysfs::entry >::iterator it = entries.begin();
+ it != entries.end(); ++it)
+ {
+ const sysfs::entry & e = *it;
+
+ if(!e.hassubdir("id")) continue;
+
+ hwNode *device = n.findChildByBusInfo(e.leaf().businfo());
+ if(!device)
+ device = n.addChild(hwNode("input", hw::input));
+ else
+ {
+ if(device->getClass() == hw::generic)
+ device->setClass(hw::input);
+ }
+ device->claim();
+ device->setLogicalName("input/"+e.name());
+ device->setProduct(e.string_attr("name"));
+ device->setModalias(e.modalias());
+ switch(e.hex_attr("id/bustype"))
+ {
+ case BUS_PCI:
+ device->addCapability("pci", "PCI");
+ break;
+ case BUS_ISAPNP:
+ device->addCapability("isa", "ISA");
+ device->addCapability("pnp", "PnP");
+ break;
+ case BUS_USB:
+ device->addCapability("usb", "USB");
+ break;
+ case BUS_HIL:
+ device->addCapability("hil", "HP-HIL");
+ break;
+ case BUS_BLUETOOTH:
+ device->addCapability("bt", "Bluetooth");
+ break;
+ case BUS_VIRTUAL:
+ device->addCapability("virtual");
+ break;
+ case BUS_ISA:
+ device->addCapability("isa", "ISA bus");
+ break;
+ case BUS_I8042:
+ device->addCapability("i8042", "i8042 PC AT keyboard controller");
+ break;
+ case BUS_XTKBD:
+ device->addCapability("xtkbd", "XT keyboard controller");
+ break;
+ case BUS_RS232:
+ device->addCapability("rs232", "RS-232 serial");
+ break;
+ case BUS_GAMEPORT:
+ device->addCapability("gameport", "game port");
+ break;
+ case BUS_PARPORT:
+ device->addCapability("parport", "parallel port");
+ break;
+ case BUS_AMIGA:
+ device->addCapability("amiga", "Amiga bus");
+ break;
+ case BUS_ADB:
+ device->addCapability("adb", "Apple Desktop Bus");
+ break;
+ case BUS_I2C:
+ device->addCapability("i2c", "I²C bus");
+ break;
+ case BUS_HOST:
+ device->addCapability("host");
+ break;
+ case BUS_GSC:
+ device->addCapability("gsc", "GSC bus");
+ break;
+ case BUS_ATARI:
+ device->addCapability("atari", "Atari bus");
+ break;
+ case BUS_SPI:
+ device->addCapability("spi", "SPI");
+ break;
+ case BUS_RMI:
+ device->addCapability("rmi", "RMI");
+ break;
+ case BUS_CEC:
+ device->addCapability("cec", "CEC");
+ break;
+ case BUS_INTEL_ISHTP:
+ device->addCapability("intelishtp", "Intel Integrated Sensor Hub");
+ break;
+ }
+
+ vector < sysfs::entry > events = e.devices();
+ for(vector < sysfs::entry >::iterator i = events.begin(); i != events.end(); ++i)
+ {
+ const sysfs::entry & d = *i;
+ device->setLogicalName("input/"+d.name());
+ }
+ }
+
+ return true;
+}
diff --git a/src/core/input.h b/src/core/input.h
new file mode 100644
index 000000000000..1bf2383bc53b
--- /dev/null
+++ b/src/core/input.h
@@ -0,0 +1,8 @@
+#ifndef _INPUT_H_
+#define _INPUT_H_
+
+#include "hw.h"
+
+bool scan_input(hwNode &);
+
+#endif
diff --git a/src/core/main.cc b/src/core/main.cc
index d0d7f1057c29..ad0e586ef549 100644
--- a/src/core/main.cc
+++ b/src/core/main.cc
@@ -45,6 +45,7 @@
#include "vio.h"
#include "nvme.h"
#include "mmc.h"
+#include "input.h"
#include "smp.h"
#include "abi.h"
#include "s390.h"
@@ -140,6 +141,9 @@ bool scan_system(hwNode & system)
status("MMC");
if (enabled("mmc"))
scan_mmc(computer);
+ status("input");
+ if (enabled("input"))
+ scan_input(computer);
status("S/390 devices");
if (enabled("s390"))
scan_s390_devices(computer);
--
2.17.1

View File

@ -1,203 +0,0 @@
From e342333d936293e82ff889aa6745b93a8c975543 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 05:04:19 +0200
Subject: [PATCH 06/18] Replace deprecated GtkIconFactory with GHashTable
This removes most warnings. A possible further improvement would be to
use GtkIconTheme instead, but it will require reorganising the SVG files
around.
---
src/gui/engine.cc | 3 ++-
src/gui/print-gui.cc | 19 ++++++++-----------
src/gui/print-gui.h | 2 +-
src/gui/stock.c | 26 ++++++--------------------
src/gui/stock.h | 1 -
5 files changed, 17 insertions(+), 34 deletions(-)
diff --git a/src/gui/engine.cc b/src/gui/engine.cc
index 21e446e0359d..c66279e5f498 100644
--- a/src/gui/engine.cc
+++ b/src/gui/engine.cc
@@ -40,6 +40,7 @@ extern GtkWidget *description;
extern GtkWidget *go_up_button;
extern GtkWidget *save_button;
extern GtkWidget *statusbar;
+extern GHashTable *pixbufs;
enum
{
@@ -224,7 +225,7 @@ static void display(GtkWidget * mainwindow)
create_tags(buffer);
string hwpath = gethwpath(*displayed, container);
- printmarkup(*displayed, GTK_TEXT_VIEW(description), hwpath);
+ printmarkup(*displayed, GTK_TEXT_VIEW(description), hwpath, pixbufs);
}
}
diff --git a/src/gui/print-gui.cc b/src/gui/print-gui.cc
index 861ec4c695da..4138424d172e 100644
--- a/src/gui/print-gui.cc
+++ b/src/gui/print-gui.cc
@@ -66,15 +66,12 @@ static void printsize(long long value, const hwNode & node, const string & name,
}
-static void inserticon(const string & icon, const string & comment, GtkTextBuffer *buffer, GtkTextIter &iter, GtkTextView * textview)
+static void inserticon(const string & icon, const string & comment, GtkTextBuffer *buffer, GtkTextIter &iter, GHashTable *pixbufs)
{
GdkPixbuf *pixbuf;
GtkTextTag *tag;
- pixbuf = gtk_widget_render_icon(GTK_WIDGET(textview),
- icon.c_str(),
- gtk_icon_size_from_name(LSHW_ICON_SIZE_LOGO), /* size */
- NULL);
+ pixbuf = GDK_PIXBUF(g_hash_table_lookup(pixbufs, icon.c_str()));
if(!GDK_IS_PIXBUF(pixbuf))
return;
@@ -87,7 +84,7 @@ static void inserticon(const string & icon, const string & comment, GtkTextBuff
}
-void printmarkup(const hwNode & node, GtkTextView *textview, const string & hwpath)
+void printmarkup(const hwNode & node, GtkTextView *textview, const string & hwpath, GHashTable *pixbufs)
{
vector < string > config;
vector < string > resources;
@@ -125,13 +122,13 @@ void printmarkup(const hwNode & node, GtkTextView *textview, const string & hwpa
gtk_text_buffer_insert (buffer, &iter, "\n", -1);
if(node.getHint("icon").defined())
- inserticon(string("lshw-") + node.getHint("icon").asString(), "", buffer, iter, textview);
+ inserticon(string("lshw-") + node.getHint("icon").asString(), "", buffer, iter, pixbufs);
if(node.getHint("bus.icon").defined())
- inserticon(string("lshw-") + node.getHint("bus.icon").asString(), "", buffer, iter, textview);
+ inserticon(string("lshw-") + node.getHint("bus.icon").asString(), "", buffer, iter, pixbufs);
if(node.getHint("logo").defined())
- inserticon(string("lshw-") + node.getHint("logo").asString(), "", buffer, iter, textview);
+ inserticon(string("lshw-") + node.getHint("logo").asString(), "", buffer, iter, pixbufs);
gtk_text_buffer_insert (buffer, &iter, "\n\n", -1);
@@ -218,10 +215,10 @@ void printmarkup(const hwNode & node, GtkTextView *textview, const string & hwpa
gtk_text_buffer_insert (buffer, &iter, "\n", -1);
if(!node.claimed())
- inserticon(LSHW_STOCK_DISABLED, _("this device hasn't been claimed\n"), buffer, iter, textview);
+ inserticon(LSHW_STOCK_DISABLED, _("this device hasn't been claimed\n"), buffer, iter, pixbufs);
if(!node.enabled())
- inserticon(LSHW_STOCK_DISABLED, _("this device has been disabled\n"), buffer, iter, textview);
+ inserticon(LSHW_STOCK_DISABLED, _("this device has been disabled\n"), buffer, iter, pixbufs);
(void) &id; // avoid "id defined but not used" warning
}
diff --git a/src/gui/print-gui.h b/src/gui/print-gui.h
index 055f7cdf3087..d41946161f02 100644
--- a/src/gui/print-gui.h
+++ b/src/gui/print-gui.h
@@ -4,7 +4,7 @@
#include "hw.h"
#include <gtk/gtk.h>
-void printmarkup(const hwNode & node, GtkTextView *textview, const string & hwpath);
+void printmarkup(const hwNode & node, GtkTextView *textview, const string & hwpath, GHashTable *pixbufs);
string gethwpath(hwNode & node, hwNode & base);
#endif
diff --git a/src/gui/stock.c b/src/gui/stock.c
index 46dfbe7173b5..9e7c3664427a 100644
--- a/src/gui/stock.c
+++ b/src/gui/stock.c
@@ -16,6 +16,7 @@ GtkWidget *description = NULL;
GtkWidget *go_up_button = NULL;
GtkWidget *save_button = NULL;
GtkWidget *statusbar = NULL;
+GHashTable *pixbufs = NULL;
static struct StockIcon
{
@@ -87,7 +88,6 @@ void
lshw_gtk_stock_init(void)
{
static int stock_initted = 0;
- GtkIconFactory *icon_factory;
int i;
if (stock_initted)
@@ -95,15 +95,12 @@ lshw_gtk_stock_init(void)
stock_initted = 1;
-/* Setup the icon factory. */
- icon_factory = gtk_icon_factory_new();
-
- gtk_icon_factory_add_default(icon_factory);
+/* Setup the icons hash table. */
+ pixbufs = g_hash_table_new(g_str_hash, g_str_equal);
for (i = 0; i < G_N_ELEMENTS(stock_icons); i++)
{
GdkPixbuf *pixbuf;
- GtkIconSet *iconset;
gchar *filename;
filename = find_file(stock_icons[i].filename, "artwork");
@@ -111,23 +108,15 @@ lshw_gtk_stock_init(void)
if (filename == NULL)
continue;
- pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+ pixbuf = gdk_pixbuf_new_from_file_at_size(filename, LSHW_DEFAULT_ICON_SIZE, LSHW_DEFAULT_ICON_SIZE, NULL);
g_free(filename);
if(pixbuf) /* we managed to load something */
{
- iconset = gtk_icon_set_new_from_pixbuf(pixbuf);
- g_object_unref(G_OBJECT(pixbuf));
- gtk_icon_factory_add(icon_factory, stock_icons[i].name, iconset);
- gtk_icon_set_unref(iconset);
+ g_hash_table_insert(pixbufs, (char*)stock_icons[i].name, pixbuf);
}
}
-/* register logo icon size */
- gtk_icon_size_register(LSHW_ICON_SIZE_LOGO, LSHW_DEFAULT_ICON_SIZE, LSHW_DEFAULT_ICON_SIZE);
-
- g_object_unref(G_OBJECT(icon_factory));
-
(void) &id; /* avoid "id defined but not used" warning */
}
@@ -168,10 +157,7 @@ void lshw_ui_init(void)
gtk_builder_connect_signals( builder, mainwindow );
g_object_unref( G_OBJECT( builder ) );
- icon = gtk_widget_render_icon(GTK_WIDGET(mainwindow),
- "lshw-logo",
- GTK_ICON_SIZE_DIALOG,
- NULL);
+ icon = g_hash_table_lookup(pixbufs, LSHW_STOCK_LOGO);
if(GDK_IS_PIXBUF(icon))
{
gtk_window_set_icon(GTK_WINDOW(mainwindow), icon);
diff --git a/src/gui/stock.h b/src/gui/stock.h
index a0fef5b882b2..58f788e5b573 100644
--- a/src/gui/stock.h
+++ b/src/gui/stock.h
@@ -43,7 +43,6 @@
/**
* For getting the icon size for the logo
*/
-#define LSHW_ICON_SIZE_LOGO "lshw-icon-size-logo"
#define LSHW_DEFAULT_ICON_SIZE 40
void lshw_gtk_stock_init(void);
--
2.17.1

View File

@ -1,34 +0,0 @@
From 7edaa09faa5755e44f2c6226f3447536658300af Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Thu, 2 Apr 2020 13:21:58 +0200
Subject: [PATCH 06/17] cosmetic fixes
---
src/core/input.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/input.cc b/src/core/input.cc
index 1f14fa9d8b56..a8d8eaf45cb3 100644
--- a/src/core/input.cc
+++ b/src/core/input.cc
@@ -79,7 +79,7 @@ bool scan_input(hwNode & n)
device->addCapability("hil", "HP-HIL");
break;
case BUS_BLUETOOTH:
- device->addCapability("bt", "Bluetooth");
+ device->addCapability("bluetooth", "Bluetooth");
break;
case BUS_VIRTUAL:
device->addCapability("virtual");
@@ -112,7 +112,7 @@ bool scan_input(hwNode & n)
device->addCapability("i2c", "I²C bus");
break;
case BUS_HOST:
- device->addCapability("host");
+ device->addCapability("platform");
break;
case BUS_GSC:
device->addCapability("gsc", "GSC bus");
--
2.17.1

View File

@ -1,29 +0,0 @@
From 8ff4b056e8fd371dca868f8967b36c6e9a4590ab Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 05:06:38 +0200
Subject: [PATCH 07/18] Replace the last GtkStock in overwrite dialog
Also add a mnemonic for better keyboard access to the overwrite button.
---
src/gui/engine.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gui/engine.cc b/src/gui/engine.cc
index c66279e5f498..ff0607490673 100644
--- a/src/gui/engine.cc
+++ b/src/gui/engine.cc
@@ -556,8 +556,8 @@ void save_as(GtkWidget *mainwindow)
"A file named <i><tt>%s</tt></i> already exists in folder <tt>%s</tt>.\n\nDo you want to overwrite it?",
basename(buffer1), dirname(buffer2));
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- "Overwrite", GTK_RESPONSE_ACCEPT,
+ "_Cancel", GTK_RESPONSE_CANCEL,
+ "_Overwrite", GTK_RESPONSE_ACCEPT,
NULL);
proceed = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT);
gtk_widget_destroy (dialog);
--
2.17.1

View File

@ -1,141 +0,0 @@
From 1cc52cac74ea735faae92dc963d10292608d7a4d Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Thu, 2 Apr 2020 13:39:42 +0200
Subject: [PATCH 07/17] detect sound devices
---
src/core/main.cc | 4 ++++
src/core/sound.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++++
src/core/sound.h | 8 +++++++
src/core/sysfs.cc | 5 +++++
src/core/sysfs.h | 1 +
5 files changed, 71 insertions(+)
create mode 100644 src/core/sound.cc
create mode 100644 src/core/sound.h
diff --git a/src/core/main.cc b/src/core/main.cc
index ad0e586ef549..e35258c56141 100644
--- a/src/core/main.cc
+++ b/src/core/main.cc
@@ -46,6 +46,7 @@
#include "nvme.h"
#include "mmc.h"
#include "input.h"
+#include "sound.h"
#include "smp.h"
#include "abi.h"
#include "s390.h"
@@ -141,6 +142,9 @@ bool scan_system(hwNode & system)
status("MMC");
if (enabled("mmc"))
scan_mmc(computer);
+ status("sound");
+ if (enabled("sound"))
+ scan_sound(computer);
status("input");
if (enabled("input"))
scan_input(computer);
diff --git a/src/core/sound.cc b/src/core/sound.cc
new file mode 100644
index 000000000000..05edf2352267
--- /dev/null
+++ b/src/core/sound.cc
@@ -0,0 +1,53 @@
+#include "version.h"
+#include "hw.h"
+#include "sysfs.h"
+#include "osutils.h"
+#include "sound.h"
+#include "heuristics.h"
+
+#include <vector>
+#include <iostream>
+
+__ID("@(#) $Id$");
+
+using namespace std;
+
+bool scan_sound(hwNode & n)
+{
+ vector < sysfs::entry > entries = sysfs::entries_by_class("sound");
+
+ if (entries.empty())
+ return false;
+
+ for (vector < sysfs::entry >::iterator it = entries.begin();
+ it != entries.end(); ++it)
+ {
+ const sysfs::entry & e = *it;
+ string id = e.string_attr("id");
+ if(id!="")
+ {
+ hwNode *device = n.findChildByBusInfo(e.leaf().businfo());
+ if(!device)
+ device = n.addChild(hwNode("sound", hw::multimedia));
+ device->claim();
+ if(device->getDescription() == "") device->setDescription(id);
+ //device->setPhysId(e.hex_attr("number"));
+ //device->setBusInfo("sound@"+e.string_attr("number"));
+ device->setLogicalName("snd/"+e.name());
+ if(device->getProduct() == "") device->setProduct(e.string_attr("name"));
+ device->setModalias(e.modalias());
+
+ vector < sysfs::entry > events = e.devices();
+ for(vector < sysfs::entry >::iterator i = events.begin(); i != events.end(); ++i)
+ {
+ const sysfs::entry & d = *i;
+ if(d.subsystem() == "sound")
+ {
+ device->setLogicalName("snd/"+d.name());
+ }
+ }
+ }
+ }
+
+ return true;
+}
diff --git a/src/core/sound.h b/src/core/sound.h
new file mode 100644
index 000000000000..c2caf04687bf
--- /dev/null
+++ b/src/core/sound.h
@@ -0,0 +1,8 @@
+#ifndef _SOUND_H_
+#define _SOUND_H_
+
+#include "hw.h"
+
+bool scan_sound(hwNode &);
+
+#endif
diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc
index 32d65642f157..ee8b1da06c78 100644
--- a/src/core/sysfs.cc
+++ b/src/core/sysfs.cc
@@ -343,6 +343,11 @@ string entry::classname() const
return basename(dirname(This->devpath).c_str());
}
+string entry::subsystem() const
+{
+ return basename(realpath(This->devpath+"/subsystem").c_str());
+}
+
bool entry::isvirtual() const
{
return string(basename(dirname(dirname(This->devpath)).c_str())) == "virtual";
diff --git a/src/core/sysfs.h b/src/core/sysfs.h
index 9cc1b2b0a500..c25430b834df 100644
--- a/src/core/sysfs.h
+++ b/src/core/sysfs.h
@@ -26,6 +26,7 @@ namespace sysfs
bool hassubdir(const string &) const;
string name() const;
string classname() const;
+ string subsystem() const;
bool isvirtual() const;
string businfo() const;
string driver() const;
--
2.17.1

View File

@ -1,48 +0,0 @@
From 0a290c29faa083767698d77b3454ca08fe2a71eb Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 05:18:25 +0200
Subject: [PATCH 08/18] Remove deprecated widgets
---
src/gui/gtk-lshw.ui | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index 25ab1ad03349..5f21da08e8e1 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -114,9 +114,10 @@
<signal name="delete-event" handler="gtk_main_quit" swapped="no"/>
<signal name="map" handler="on_lshw_map" after="yes" swapped="no"/>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkBox" id="main-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
<child>
<object class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
@@ -292,15 +293,17 @@
</packing>
</child>
<child>
- <object class="GtkHPaned" id="hpaned1">
+ <object class="GtkPaned" id="paned">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<child>
- <object class="GtkHBox" id="hbox3">
+ <object class="GtkBox" id="tree-box">
<property name="width_request">350</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
+ <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
--
2.17.1

View File

@ -1,102 +0,0 @@
From 755371fc1590e752380822ffdb320484e3b6851f Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Thu, 2 Apr 2020 14:54:03 +0200
Subject: [PATCH 08/17] detect framebuffers
---
src/core/graphics.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/core/graphics.h | 8 ++++++++
src/core/main.cc | 4 ++++
3 files changed, 56 insertions(+)
create mode 100644 src/core/graphics.cc
create mode 100644 src/core/graphics.h
diff --git a/src/core/graphics.cc b/src/core/graphics.cc
new file mode 100644
index 000000000000..a8d490cd1d61
--- /dev/null
+++ b/src/core/graphics.cc
@@ -0,0 +1,44 @@
+#include "version.h"
+#include "hw.h"
+#include "sysfs.h"
+#include "osutils.h"
+#include "graphics.h"
+#include "heuristics.h"
+
+#include <vector>
+#include <iostream>
+
+__ID("@(#) $Id$");
+
+using namespace std;
+
+bool scan_graphics(hwNode & n)
+{
+ vector < sysfs::entry > entries = sysfs::entries_by_class("graphics");
+
+ if (entries.empty())
+ return false;
+
+ for (vector < sysfs::entry >::iterator it = entries.begin();
+ it != entries.end(); ++it)
+ {
+ const sysfs::entry & e = *it;
+ string dev = e.string_attr("dev");
+ if(dev!="")
+ {
+ hwNode *device = n.findChildByBusInfo(e.leaf().businfo());
+ if(!device)
+ device = n.addChild(hwNode("graphics", hw::display));
+ device->claim();
+ device->setLogicalName(e.name());
+ device->addCapability("fb", "framebuffer");
+ if(device->getProduct() == "") device->setProduct(e.string_attr("name"));
+ string resolution = e.string_attr("virtual_size");
+ string depth = e.string_attr("bits_per_pixel");
+ if(resolution != "") device->setConfig("resolution", resolution);
+ if(depth != "") device->setConfig("depth", depth);
+ }
+ }
+
+ return true;
+}
diff --git a/src/core/graphics.h b/src/core/graphics.h
new file mode 100644
index 000000000000..c30f0bf8112b
--- /dev/null
+++ b/src/core/graphics.h
@@ -0,0 +1,8 @@
+#ifndef _GRAPHICS_H_
+#define _GRAPHICS_H_
+
+#include "hw.h"
+
+bool scan_graphics(hwNode &);
+
+#endif
diff --git a/src/core/main.cc b/src/core/main.cc
index e35258c56141..ac2fba0146f0 100644
--- a/src/core/main.cc
+++ b/src/core/main.cc
@@ -47,6 +47,7 @@
#include "mmc.h"
#include "input.h"
#include "sound.h"
+#include "graphics.h"
#include "smp.h"
#include "abi.h"
#include "s390.h"
@@ -145,6 +146,9 @@ bool scan_system(hwNode & system)
status("sound");
if (enabled("sound"))
scan_sound(computer);
+ status("graphics");
+ if (enabled("graphics"))
+ scan_graphics(computer);
status("input");
if (enabled("input"))
scan_input(computer);
--
2.17.1

View File

@ -1,128 +0,0 @@
From 6cf78e942827dd01b91607704c7bfad9a1a1541d Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 06:45:43 +0200
Subject: [PATCH 09/18] Remove deprecated use_action_appearance property
---
src/gui/gtk-lshw.ui | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index 5f21da08e8e1..1656f80ddd53 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -27,7 +27,6 @@
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_aboutclose_activate" swapped="no"/>
<signal name="clicked" handler="on_aboutclose_activate" swapped="no"/>
@@ -73,7 +72,6 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
- <property name="use_action_appearance">False</property>
<property name="relief">none</property>
<property name="uri">http://www.ezix.org/</property>
</object>
@@ -126,7 +124,6 @@
<object class="GtkMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_File</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -138,7 +135,6 @@
<property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_save_activate" swapped="no"/>
@@ -148,7 +144,6 @@
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
</object>
</child>
<child>
@@ -156,7 +151,6 @@
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="gtk_main_quit" swapped="no"/>
@@ -170,7 +164,6 @@
<object class="GtkMenuItem" id="menuitem3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -182,7 +175,6 @@
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="refresh_display" swapped="no"/>
@@ -196,7 +188,6 @@
<object class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child type="submenu">
@@ -208,7 +199,6 @@
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_about1_activate" swapped="no"/>
@@ -235,7 +225,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="stock_id">gtk-go-up</property>
<signal name="clicked" handler="go_up" swapped="no"/>
</object>
@@ -249,7 +238,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Rescan the hardware</property>
- <property name="use_action_appearance">False</property>
<property name="stock_id">gtk-refresh</property>
<signal name="clicked" handler="refresh_display" swapped="no"/>
</object>
@@ -263,7 +251,6 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="stock_id">gtk-save</property>
<signal name="clicked" handler="on_savebutton_clicked" swapped="no"/>
</object>
@@ -276,7 +263,6 @@
<object class="GtkToolButton" id="quitbutton">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
<property name="stock_id">gtk-quit</property>
<signal name="clicked" handler="gtk_main_quit" swapped="no"/>
</object>
--
2.17.1

View File

@ -1,29 +0,0 @@
From f6138333811f7f2bf01551c70f5726f7c556dd36 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Fri, 3 Apr 2020 22:42:21 +0200
Subject: [PATCH 09/17] try to connect input devices to the right parent
---
src/core/input.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/core/input.cc b/src/core/input.cc
index a8d8eaf45cb3..ab37d37c3863 100644
--- a/src/core/input.cc
+++ b/src/core/input.cc
@@ -52,6 +52,12 @@ bool scan_input(hwNode & n)
if(!e.hassubdir("id")) continue;
hwNode *device = n.findChildByBusInfo(e.leaf().businfo());
+ if(!device)
+ {
+ device = n.findChildByBusInfo(e.leaf().parent().businfo());
+ if(device)
+ device = device->addChild(hwNode("input", hw::input));
+ }
if(!device)
device = n.addChild(hwNode("input", hw::input));
else
--
2.17.1

View File

@ -1,99 +0,0 @@
From 5fd82e398ba94766f0981f97988c8f14ab4297c5 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 05:53:57 +0200
Subject: [PATCH 10/18] Move to GtkApplication
This will eventually let us use GActions to build our menus and buttons.
---
src/gui/gtk-lshw.c | 36 ++++++++++++++++++++++--------------
src/gui/gtk-lshw.ui | 3 +--
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/src/gui/gtk-lshw.c b/src/gui/gtk-lshw.c
index 9ac525c715d8..6c0f0bbdf77f 100644
--- a/src/gui/gtk-lshw.c
+++ b/src/gui/gtk-lshw.c
@@ -11,17 +11,10 @@ static char *id = "@(#) $Id$";
extern GtkWidget *mainwindow;
-int
-main (int argc, char *argv[])
+static void
+activate (GApplication *app,
+ gpointer user_data)
{
-#ifndef NONLS
- bindtextdomain (PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (PACKAGE, "UTF-8");
- textdomain (PACKAGE);
-#endif
-
- gtk_init (&argc, &argv);
-
if(geteuid() != 0)
{
bool proceed = false;
@@ -39,19 +32,34 @@ main (int argc, char *argv[])
gtk_widget_destroy (dialog);
if(!proceed)
- return -1;
+ return;
}
lshw_gtk_stock_init();
lshw_ui_init();
if(!mainwindow)
- return(1);
+ return;
gtk_widget_show(mainwindow);
- gtk_main ();
+ gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(mainwindow));
+}
+
+int
+main (int argc, char *argv[])
+{
+#ifndef NONLS
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
+ textdomain (PACKAGE);
+#endif
+
+ GtkApplication *app = gtk_application_new ("org.ezix.gtk-lshw", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+ int status = g_application_run (G_APPLICATION (app), argc, argv);
+ g_object_unref (app);
(void) &id; // avoid warning "id defined but not used"
- return 0;
+ return status;
}
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index 1656f80ddd53..7504c76d1a1b 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -102,14 +102,13 @@
<action-widget response="-7">closebutton1</action-widget>
</action-widgets>
</object>
- <object class="GtkWindow" id="mainwindow">
+ <object class="GtkApplicationWindow" id="mainwindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">lshw</property>
<property name="default_width">700</property>
<property name="default_height">480</property>
<property name="startup_id">org.ezix.gtk-lshw</property>
- <signal name="delete-event" handler="gtk_main_quit" swapped="no"/>
<signal name="map" handler="on_lshw_map" after="yes" swapped="no"/>
<child>
<object class="GtkBox" id="main-box">
--
2.17.1

View File

@ -1,39 +0,0 @@
From 4c19563dae05d3a730bb67917f1810eb33a54613 Mon Sep 17 00:00:00 2001
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Date: Fri, 6 Mar 2020 04:41:33 -0600
Subject: [PATCH 10/17] devtree: Add chip-id from the dimm module
Add chip-id from dimm module into the configuration if available. DIMM's are
behind the CHIP on Power systems. By adding chip-id it helps to map what dimm
is sitting behind which chip.
Sample output:
*-bank:0
description: 16GB CDIMM
product: 41T9571 FRU# 41T9571
physical id: 0
.....
configuration: chip-id=0
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
src/core/device-tree.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
index 490e1976e619..f43d34f072b6 100644
--- a/src/core/device-tree.cc
+++ b/src/core/device-tree.cc
@@ -1031,6 +1031,8 @@ static void add_memory_bank(string name, string path, hwNode & core)
if(exists("description"))
description = hw::strip(get_string("description"));
bank.setDescription(description);
+ if (exists("ibm,chip-id"))
+ bank.setConfig("chip-id", get_u32("ibm,chip-id"));
if(exists("ibm,loc-code"))
bank.setSlot(hw::strip(get_string("ibm,loc-code")));
--
2.17.1

View File

@ -1,279 +0,0 @@
From d1690196a9007568bfce3847841ea2b509eb3150 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Fri, 10 Jul 2020 06:28:06 +0200
Subject: [PATCH 11/18] Replace signals with GSimpleActions
This unifies actions pertaining to the application.
---
src/gui/callbacks.c | 62 ++++++++++++++++++++++-----------------------
src/gui/callbacks.h | 35 ++++++++++++++++---------
src/gui/gtk-lshw.c | 14 ++++++++++
src/gui/gtk-lshw.ui | 16 ++++++------
4 files changed, 76 insertions(+), 51 deletions(-)
diff --git a/src/gui/callbacks.c b/src/gui/callbacks.c
index f8aa0cb0f968..eec3e5571741 100644
--- a/src/gui/callbacks.c
+++ b/src/gui/callbacks.c
@@ -17,17 +17,36 @@ static char *id = "@(#) $Id$";
G_MODULE_EXPORT
void
-refresh_display (GtkMenuItem *menuitem,
-gpointer user_data)
+on_go_up_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app)
+{
+ go_back(mainwindow);
+}
+
+G_MODULE_EXPORT
+void
+on_refresh_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app)
{
refresh(mainwindow);
}
+G_MODULE_EXPORT
+void
+on_save_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app)
+{
+ save_as(mainwindow);
+}
G_MODULE_EXPORT
void
-on_about1_activate (GtkMenuItem *menuitem,
-gpointer user_data)
+on_about_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app)
{
if(GTK_IS_WIDGET(about))
{
@@ -35,6 +54,14 @@ gpointer user_data)
}
}
+G_MODULE_EXPORT
+void
+on_quit_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app)
+{
+ g_application_quit(G_APPLICATION(app));
+}
G_MODULE_EXPORT
void
@@ -147,15 +174,6 @@ gpointer user_data)
}
-G_MODULE_EXPORT
-void
-go_up (GtkToolButton *toolbutton,
-gpointer user_data)
-{
- go_back(mainwindow);
-}
-
-
G_MODULE_EXPORT
void
on_lshw_map (GtkWidget *widget,
@@ -163,21 +181,3 @@ gpointer user_data)
{
refresh(mainwindow);
}
-
-G_MODULE_EXPORT
-void
-on_save_activate (GtkMenuItem *menuitem,
- gpointer user_data)
-{
- save_as(mainwindow);
-}
-
-
-G_MODULE_EXPORT
-void
-on_savebutton_clicked (GtkToolButton *toolbutton,
- gpointer user_data)
-{
- on_save_activate(NULL, NULL);
-}
-
diff --git a/src/gui/callbacks.h b/src/gui/callbacks.h
index cc856e45ddb4..b9b9141c0eb7 100644
--- a/src/gui/callbacks.h
+++ b/src/gui/callbacks.h
@@ -1,8 +1,29 @@
#include <gtk/gtk.h>
-void refresh_display (GtkMenuItem * menuitem, gpointer user_data);
+void
+on_go_up_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app);
+
+void
+on_refresh_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app);
-void on_about1_activate (GtkMenuItem * menuitem, gpointer user_data);
+void
+on_save_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app);
+
+void
+on_about_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app);
+
+void
+on_quit_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app);
void on_aboutclose_activate (GtkButton * button, gpointer user_data);
@@ -35,14 +56,4 @@ void on_treeview2_cursor_changed (GtkTreeView * treeview, gpointer user_data);
void on_treeview3_cursor_changed (GtkTreeView * treeview, gpointer user_data);
-void go_up (GtkToolButton * toolbutton, gpointer user_data);
-
void on_lshw_map (GtkWidget * widget, gpointer user_data);
-
-void
-on_save_activate (GtkMenuItem *menuitem,
- gpointer user_data);
-
-void
-on_savebutton_clicked (GtkToolButton *toolbutton,
- gpointer user_data);
diff --git a/src/gui/gtk-lshw.c b/src/gui/gtk-lshw.c
index 6c0f0bbdf77f..0dc3aff6d322 100644
--- a/src/gui/gtk-lshw.c
+++ b/src/gui/gtk-lshw.c
@@ -6,11 +6,21 @@
#include "config.h"
#include "stock.h"
#include "engine.h"
+#include "callbacks.h"
static char *id = "@(#) $Id$";
extern GtkWidget *mainwindow;
+static GActionEntry app_entries[] =
+{
+ { "go_up", on_go_up_activated, NULL, NULL, NULL },
+ { "refresh", on_refresh_activated, NULL, NULL, NULL },
+ { "save", on_save_activated, NULL, NULL, NULL },
+ { "about", on_about_activated, NULL, NULL, NULL },
+ { "quit", on_quit_activated, NULL, NULL, NULL }
+};
+
static void
activate (GApplication *app,
gpointer user_data)
@@ -35,6 +45,10 @@ activate (GApplication *app,
return;
}
+ g_action_map_add_action_entries (G_ACTION_MAP (app),
+ app_entries, G_N_ELEMENTS (app_entries),
+ app);
+
lshw_gtk_stock_init();
lshw_ui_init();
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index 7504c76d1a1b..d24e05c3aa20 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -136,7 +136,7 @@
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
- <signal name="activate" handler="on_save_activate" swapped="no"/>
+ <property name="action_name">app.save</property>
</object>
</child>
<child>
@@ -152,7 +152,7 @@
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
- <signal name="activate" handler="gtk_main_quit" swapped="no"/>
+ <property name="action_name">app.quit</property>
</object>
</child>
</object>
@@ -176,7 +176,7 @@
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
- <signal name="activate" handler="refresh_display" swapped="no"/>
+ <property name="action_name">app.refresh</property>
</object>
</child>
</object>
@@ -200,7 +200,7 @@
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
- <signal name="activate" handler="on_about1_activate" swapped="no"/>
+ <property name="action_name">app.about</property>
</object>
</child>
</object>
@@ -225,7 +225,7 @@
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="stock_id">gtk-go-up</property>
- <signal name="clicked" handler="go_up" swapped="no"/>
+ <property name="action_name">app.go_up</property>
</object>
<packing>
<property name="expand">False</property>
@@ -238,7 +238,7 @@
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Rescan the hardware</property>
<property name="stock_id">gtk-refresh</property>
- <signal name="clicked" handler="refresh_display" swapped="no"/>
+ <property name="action_name">app.refresh</property>
</object>
<packing>
<property name="expand">False</property>
@@ -251,7 +251,7 @@
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="stock_id">gtk-save</property>
- <signal name="clicked" handler="on_savebutton_clicked" swapped="no"/>
+ <property name="action_name">app.save</property>
</object>
<packing>
<property name="expand">False</property>
@@ -263,7 +263,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock_id">gtk-quit</property>
- <signal name="clicked" handler="gtk_main_quit" swapped="no"/>
+ <property name="action_name">app.quit</property>
</object>
<packing>
<property name="expand">False</property>
--
2.17.1

View File

@ -1,40 +0,0 @@
From 872b0996df37aae586575ca8021c2509c05067b0 Mon Sep 17 00:00:00 2001
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Date: Fri, 6 Mar 2020 04:41:33 -0600
Subject: [PATCH 11/17] devtree: Add chip-id from CPU node
Add chip-id from CPU node into the configuration if available. CPU's are
behind the CHIP on Power systems. By adding chip-id it helps to map what cpus
are sitting behind which chip.
Sample output:
*-cpu:10
description: POWER8E (raw), altivec supported
product: 00FX746 FRU# 00FX522
physical id: 176
bus info: cpu@10
version: 2.1 (pvr 004b 0201)
...
configuration: chip-id=1 threads=8
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
src/core/device-tree.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
index f43d34f072b6..af665a4d8e1a 100644
--- a/src/core/device-tree.cc
+++ b/src/core/device-tree.cc
@@ -492,6 +492,8 @@ static void fill_core_vpd(hwNode & cpu, string & basepath,
return;
chip_id = get_u32(basepath + "/ibm,chip-id");
+ cpu.setConfig("chip-id", chip_id);
+
data = chip_vpd[chip_id];
xscom_path = xscoms[chip_id];
--
2.17.1

View File

@ -1,154 +0,0 @@
From a116b319adf51d4eafcb264de027647244340708 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Wed, 15 Jul 2020 17:32:45 +0200
Subject: [PATCH 12/18] Enable/Disable GSimpleAction instead of button
sensitivity
This also fixes the Save menu item not having been disabled properly.
---
src/gui/engine.cc | 24 +++++++-----------------
src/gui/gtk-lshw.c | 7 +++++++
src/gui/gtk-lshw.ui | 2 --
src/gui/stock.c | 4 ----
4 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/src/gui/engine.cc b/src/gui/engine.cc
index ff0607490673..2962ec80d81a 100644
--- a/src/gui/engine.cc
+++ b/src/gui/engine.cc
@@ -37,10 +37,10 @@ static hwNode *selected3 = NULL;
extern GtkWidget *mainwindow;
extern GtkWidget *list1, *list2, *list3;
extern GtkWidget *description;
-extern GtkWidget *go_up_button;
-extern GtkWidget *save_button;
extern GtkWidget *statusbar;
extern GHashTable *pixbufs;
+extern GSimpleAction *go_up_action;
+extern GSimpleAction *save_action;
enum
{
@@ -251,14 +251,11 @@ void refresh(GtkWidget *mainwindow)
{
hwNode computer("computer", hw::system);
static bool lock = false;
- //GtkWidget * menu = lookup_widget(mainwindow, "menu");
- //GtkWidget * save_menuitem = lookup_widget(menu, "save");
if(lock) return;
lock = true;
- gtk_widget_set_sensitive(save_button, FALSE);
- //gtk_widget_set_sensitive(save_menuitem, FALSE);
+ g_simple_action_set_enabled(save_action, FALSE);
populate_sublist(list1, NULL);
populate_sublist(list2, NULL);
@@ -273,9 +270,8 @@ void refresh(GtkWidget *mainwindow)
status(NULL);
displayed = container.addChild(computer);
- gtk_widget_set_sensitive(go_up_button, FALSE);
- gtk_widget_set_sensitive(save_button, TRUE);
- //gtk_widget_set_sensitive(save_menuitem, TRUE);
+ g_simple_action_set_enabled(go_up_action, FALSE);
+ g_simple_action_set_enabled(save_action, TRUE);
selected1 = NULL;
selected2 = NULL;
@@ -379,10 +375,7 @@ void browse(unsigned list, GtkTreeView *treeview)
break;
}
- if(selected1 && (find_parent(selected1, &container)!= &container))
- gtk_widget_set_sensitive(go_up_button, 1);
- else
- gtk_widget_set_sensitive(go_up_button, 0);
+ g_simple_action_set_enabled(go_up_action, selected1 && (find_parent(selected1, &container)!= &container));
(void) &::id; // avoid warning "id defined but not used"
}
@@ -404,10 +397,7 @@ void go_back(GtkWidget *mainwindow)
displayed = find_parent(displayed, &container);
}
- if(selected1 && (find_parent(selected1, &container)!= &container))
- gtk_widget_set_sensitive(go_up_button, 1);
- else
- gtk_widget_set_sensitive(go_up_button, 0);
+ g_simple_action_set_enabled(go_up_action, selected1 && (find_parent(selected1, &container)!= &container));
display(mainwindow);
}
diff --git a/src/gui/gtk-lshw.c b/src/gui/gtk-lshw.c
index 0dc3aff6d322..7b91ec5e4f01 100644
--- a/src/gui/gtk-lshw.c
+++ b/src/gui/gtk-lshw.c
@@ -11,6 +11,8 @@
static char *id = "@(#) $Id$";
extern GtkWidget *mainwindow;
+GSimpleAction *go_up_action;
+GSimpleAction *save_action;
static GActionEntry app_entries[] =
{
@@ -48,6 +50,11 @@ activate (GApplication *app,
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),
app);
+ go_up_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (app), "go_up"));
+ save_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (app), "save"));
+
+ g_simple_action_set_enabled(go_up_action, FALSE);
+ g_simple_action_set_enabled(save_action, FALSE);
lshw_gtk_stock_init();
lshw_ui_init();
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index d24e05c3aa20..76fcd19379f2 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -222,7 +222,6 @@
<child>
<object class="GtkToolButton" id="upbutton">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="stock_id">gtk-go-up</property>
<property name="action_name">app.go_up</property>
@@ -248,7 +247,6 @@
<child>
<object class="GtkToolButton" id="savebutton">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="stock_id">gtk-save</property>
<property name="action_name">app.save</property>
diff --git a/src/gui/stock.c b/src/gui/stock.c
index 9e7c3664427a..fa18f9ed7f85 100644
--- a/src/gui/stock.c
+++ b/src/gui/stock.c
@@ -13,8 +13,6 @@ GtkWidget *list1 = NULL;
GtkWidget *list2 = NULL;
GtkWidget *list3 = NULL;
GtkWidget *description = NULL;
-GtkWidget *go_up_button = NULL;
-GtkWidget *save_button = NULL;
GtkWidget *statusbar = NULL;
GHashTable *pixbufs = NULL;
@@ -151,8 +149,6 @@ void lshw_ui_init(void)
list2 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview2"));
list3 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview3"));
description = GTK_WIDGET(gtk_builder_get_object( builder, "description"));
- go_up_button = GTK_WIDGET(gtk_builder_get_object( builder, "upbutton"));
- save_button = GTK_WIDGET(gtk_builder_get_object( builder, "savebutton"));
statusbar = GTK_WIDGET(gtk_builder_get_object( builder, "statusbar"));
gtk_builder_connect_signals( builder, mainwindow );
g_object_unref( G_OBJECT( builder ) );
--
2.17.1

View File

@ -1,31 +0,0 @@
From 82df4fa7d3705f2f61282ed5b22074d4e0a6efc4 Mon Sep 17 00:00:00 2001
From: Harry Mallon <hjmallon@gmail.com>
Date: Thu, 23 Apr 2020 21:18:47 +0100
Subject: [PATCH 12/17] volumes: fix segfault in apfs volume code
---
src/core/volumes.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/volumes.cc b/src/core/volumes.cc
index e70352377f84..6fce2ee3de1c 100644
--- a/src/core/volumes.cc
+++ b/src/core/volumes.cc
@@ -784,12 +784,13 @@ struct apfs_super_block {
static bool detect_apfs(hwNode & n, source & s)
{
- static char buffer[sizeof(apfs_super_block)];
+ static char buffer[APFS_STANDARD_BLOCK_SIZE];
source apfsvolume;
apfs_super_block *sb = (apfs_super_block*)buffer;
unsigned long block_size;
apfsvolume = s;
+ apfsvolume.blocksize = APFS_STANDARD_BLOCK_SIZE;
if(readlogicalblocks(apfsvolume, buffer, 0, 1)!=1)
return false;
--
2.17.1

View File

@ -1,240 +0,0 @@
From bc5046d9917fe9cf84dd899f90aef5b90b7d4b04 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Wed, 15 Jul 2020 16:54:27 +0200
Subject: [PATCH 13/18] Move from GtkMenuBar to GMenu
This moves forward with gtk4 support, while also allowing a global menu
for environments which use one, such as GNOME.
I also added shortcuts so that users can press ^Q, ^R and ^S to quit,
refresh and save.
---
src/gui/gtk-lshw.c | 2 +-
src/gui/gtk-lshw.ui | 138 ++++++++++++--------------------------------
src/gui/stock.c | 6 +-
src/gui/stock.h | 4 +-
4 files changed, 47 insertions(+), 103 deletions(-)
diff --git a/src/gui/gtk-lshw.c b/src/gui/gtk-lshw.c
index 7b91ec5e4f01..d3e531c4ceb3 100644
--- a/src/gui/gtk-lshw.c
+++ b/src/gui/gtk-lshw.c
@@ -57,7 +57,7 @@ activate (GApplication *app,
g_simple_action_set_enabled(save_action, FALSE);
lshw_gtk_stock_init();
- lshw_ui_init();
+ lshw_ui_init(GTK_APPLICATION(app));
if(!mainwindow)
return;
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index 76fcd19379f2..cf9d678f00d9 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -103,7 +103,6 @@
</action-widgets>
</object>
<object class="GtkApplicationWindow" id="mainwindow">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">lshw</property>
<property name="default_width">700</property>
@@ -115,105 +114,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
- <child>
- <object class="GtkMenuBar" id="menubar1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="menuitem1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_File</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkImageMenuItem" id="savemenu">
- <property name="label">gtk-save</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <property name="action_name">app.save</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem5">
- <property name="label">gtk-quit</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <property name="action_name">app.quit</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="menuitem3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_View</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkImageMenuItem" id="refresh1">
- <property name="label">gtk-refresh</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <property name="action_name">app.refresh</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="menuitem4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Help</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem10">
- <property name="label">gtk-about</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <property name="action_name">app.about</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
@@ -423,4 +323,42 @@
</object>
</child>
</object>
+ <menu id="menubar">
+ <submenu>
+ <attribute name="label" translatable="yes">_File</attribute>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Save</attribute>
+ <attribute name="action">app.save</attribute>
+ <attribute name="accel">&lt;Control&gt;s</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="action">app.quit</attribute>
+ <attribute name="accel">&lt;Control&gt;q</attribute>
+ </item>
+ </section>
+ </submenu>
+ <submenu>
+ <attribute name="label" translatable="yes">_View</attribute>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Refresh</attribute>
+ <attribute name="action">app.refresh</attribute>
+ <attribute name="accel">&lt;Control&gt;r</attribute>
+ </item>
+ </section>
+ </submenu>
+ <submenu>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ </section>
+ </submenu>
+ </menu>
</interface>
diff --git a/src/gui/stock.c b/src/gui/stock.c
index fa18f9ed7f85..ce0b42abea58 100644
--- a/src/gui/stock.c
+++ b/src/gui/stock.c
@@ -14,6 +14,7 @@ GtkWidget *list2 = NULL;
GtkWidget *list3 = NULL;
GtkWidget *description = NULL;
GtkWidget *statusbar = NULL;
+GMenuModel *menubar = NULL;
GHashTable *pixbufs = NULL;
static struct StockIcon
@@ -118,7 +119,7 @@ lshw_gtk_stock_init(void)
(void) &id; /* avoid "id defined but not used" warning */
}
-void lshw_ui_init(void)
+void lshw_ui_init(GtkApplication *app)
{
GError *error = NULL;
GtkBuilder *builder = NULL;
@@ -151,6 +152,9 @@ void lshw_ui_init(void)
description = GTK_WIDGET(gtk_builder_get_object( builder, "description"));
statusbar = GTK_WIDGET(gtk_builder_get_object( builder, "statusbar"));
gtk_builder_connect_signals( builder, mainwindow );
+ menubar = G_MENU_MODEL( gtk_builder_get_object( builder, "menubar"));
+ gtk_window_set_application( GTK_WINDOW( mainwindow ), app );
+ gtk_application_set_menubar( app, menubar );
g_object_unref( G_OBJECT( builder ) );
icon = g_hash_table_lookup(pixbufs, LSHW_STOCK_LOGO);
diff --git a/src/gui/stock.h b/src/gui/stock.h
index 58f788e5b573..1c732dfb541e 100644
--- a/src/gui/stock.h
+++ b/src/gui/stock.h
@@ -45,6 +45,8 @@
*/
#define LSHW_DEFAULT_ICON_SIZE 40
+typedef struct _GtkApplication GtkApplication;
+
void lshw_gtk_stock_init(void);
-void lshw_ui_init(void);
+void lshw_ui_init(GtkApplication *);
#endif /* _STOCK_H_ */
--
2.17.1

View File

@ -1,58 +0,0 @@
From 89759485f86a48526b4f508a10f7478c76a3f71e Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Fri, 15 May 2020 16:00:08 +0200
Subject: [PATCH 13/17] merge Github PR #53
---
src/core/cpuinfo.cc | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
index eceb83aa4e3a..49f3052d8da1 100644
--- a/src/core/cpuinfo.cc
+++ b/src/core/cpuinfo.cc
@@ -446,6 +446,7 @@ string value)
if (cpu)
{
+ hw::value family, model, stepping;
// x86 CPUs are assumed to be 32 bits per default
if(cpu->getWidth()==0) cpu->setWidth(32);
@@ -471,6 +472,13 @@ string value)
cpu->addHint(id, stoll(value, NULL, 0));
if (id == "stepping")
cpu->addHint(id, stoll(value, NULL, 0));
+
+ family = cpu->getHint("cpu family");
+ model = cpu->getHint("model");
+ stepping = cpu->getHint("stepping");
+ if(family.defined() && model.defined() && stepping.defined())
+ cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger()));
+
//if ((id == "cpu MHz") && (cpu->getSize() == 0))
//{
//cpu->setSize((long long) (1000000L * atof(value.c_str())));
@@ -675,17 +683,8 @@ bool scan_cpuinfo(hwNode & n)
}
hwNode *cpu = getcpu(n, 0);
- if(cpu)
- {
- hw::value family, model, stepping;
- family = cpu->getHint("cpu family");
- model = cpu->getHint("model");
- stepping = cpu->getHint("stepping");
- if(family.defined() && model.defined() && stepping.defined())
- cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger()));
- if(n.getWidth()==0)
- n.setWidth(cpu->getWidth());
- }
+ if(cpu && (n.getWidth()==0))
+ n.setWidth(cpu->getWidth());
return true;
}
--
2.17.1

View File

@ -1,252 +0,0 @@
From e96f82ce459a6d503f70d6c7b0f762bf0d133edf Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Sat, 1 Aug 2020 15:03:23 +0200
Subject: [PATCH 14/18] Replace the about GtkDialog with a GtkAboutDialog
This reduces the amount of code needed for this feature, and integrates
better with the rest of the system.
---
src/gui/callbacks.c | 46 ++++++--------------
src/gui/callbacks.h | 4 --
src/gui/gtk-lshw.ui | 101 --------------------------------------------
src/gui/stock.c | 2 -
4 files changed, 12 insertions(+), 141 deletions(-)
diff --git a/src/gui/callbacks.c b/src/gui/callbacks.c
index eec3e5571741..b108777fe11f 100644
--- a/src/gui/callbacks.c
+++ b/src/gui/callbacks.c
@@ -10,7 +10,6 @@
#include "engine.h"
#include <string.h>
-extern GtkWidget *about;
extern GtkWidget *mainwindow;
static char *id = "@(#) $Id$";
@@ -42,18 +41,6 @@ on_save_activated (GSimpleAction *action,
save_as(mainwindow);
}
-G_MODULE_EXPORT
-void
-on_about_activated (GSimpleAction *action,
- GVariant *parameter,
- gpointer app)
-{
- if(GTK_IS_WIDGET(about))
- {
- gtk_widget_show(about);
- }
-}
-
G_MODULE_EXPORT
void
on_quit_activated (GSimpleAction *action,
@@ -65,25 +52,20 @@ on_quit_activated (GSimpleAction *action,
G_MODULE_EXPORT
void
-on_aboutclose_activate (GtkButton *button,
-gpointer user_data)
+on_about_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app)
{
- if(GTK_IS_WIDGET(about))
- {
- gtk_widget_hide(about);
- }
-}
-
+ gtk_show_about_dialog(GTK_WINDOW(mainwindow),
+ "program-name", "GTK+ frontend for lshw",
+ "website", "https://www.ezix.org/",
+ "copyright", "© 2004-2011 Lyonel Vincent\n© 2020 Emmanuel Gil Peyrot",
+ "version", getpackageversion(),
+ "license-type", GTK_LICENSE_GPL_2_0,
+ NULL);
-G_MODULE_EXPORT
-void
-on_version_realize (GtkWidget *widget,
-gpointer user_data)
-{
const char *latest = checkupdates();
- gtk_label_set_text(GTK_LABEL(widget), getpackageversion());
-
if(latest)
{
if(strcmp(latest, getpackageversion()) != 0)
@@ -100,18 +82,14 @@ gpointer user_data)
latest);
gtk_window_set_title(GTK_WINDOW(dialog), "Update available");
- /* Destroy the dialog when the user responds to it (e.g. clicks a button) */
- g_signal_connect_swapped (dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
}
- gtk_widget_show(dialog);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
}
}
}
-
G_MODULE_EXPORT
void
on_treeview1_row_activated (GtkTreeView *treeview,
diff --git a/src/gui/callbacks.h b/src/gui/callbacks.h
index b9b9141c0eb7..e7636efdcae5 100644
--- a/src/gui/callbacks.h
+++ b/src/gui/callbacks.h
@@ -25,10 +25,6 @@ on_quit_activated (GSimpleAction *action,
GVariant *parameter,
gpointer app);
-void on_aboutclose_activate (GtkButton * button, gpointer user_data);
-
-void on_version_realize (GtkWidget * widget, gpointer user_data);
-
void
on_treeview1_row_activated (GtkTreeView * treeview,
GtkTreePath * path,
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
index b61bedf501ee..57817fd58b39 100644
--- a/src/gui/gtk-lshw.ui
+++ b/src/gui/gtk-lshw.ui
@@ -1,107 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.22"/>
- <object class="GtkDialog" id="aboutlshw">
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">About</property>
- <property name="resizable">False</property>
- <property name="window_position">center-on-parent</property>
- <property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
- <property name="skip_taskbar_hint">True</property>
- <property name="skip_pager_hint">True</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="closebutton1">
- <property name="label">gtk-close</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- <signal name="activate" handler="on_aboutclose_activate" swapped="no"/>
- <signal name="clicked" handler="on_aboutclose_activate" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="aboutext">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xpad">20</property>
- <property name="ypad">20</property>
- <property name="label" translatable="yes">&lt;big&gt;&lt;b&gt;GTK+ front-end for &lt;tt&gt;lshw&lt;/tt&gt;&lt;/b&gt;&lt;/big&gt;
-
-© 2004-2011 Lyonel Vincent
-&lt;tt&gt;lyonel@ezix.org&lt;/tt&gt;</property>
- <property name="use_markup">True</property>
- <property name="justify">center</property>
- <property name="mnemonic_widget">closebutton1</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLinkButton" id="linkbutton1">
- <property name="label" translatable="yes">http://www.ezix.org/</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="has_tooltip">True</property>
- <property name="relief">none</property>
- <property name="uri">http://www.ezix.org/</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="version">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">VERSION</property>
- <property name="justify">center</property>
- <property name="mnemonic_widget">closebutton1</property>
- <signal name="realize" handler="on_version_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-7">closebutton1</action-widget>
- </action-widgets>
- </object>
<object class="GtkApplicationWindow" id="mainwindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">lshw</property>
diff --git a/src/gui/stock.c b/src/gui/stock.c
index 7b98c642d43f..db2e98189662 100644
--- a/src/gui/stock.c
+++ b/src/gui/stock.c
@@ -9,7 +9,6 @@ static char *id = "@(#) $Id$";
#define UIFILE "gtk-lshw.ui"
GtkWidget *mainwindow = NULL;
-GtkWidget *about = NULL;
GtkWidget *list1 = NULL;
GtkWidget *list2 = NULL;
GtkWidget *list3 = NULL;
@@ -146,7 +145,6 @@ void lshw_ui_init(GtkApplication *app)
g_free(uiname);
mainwindow = GTK_WIDGET( gtk_builder_get_object( builder, "mainwindow" ) );
- about = GTK_WIDGET( gtk_builder_get_object( builder, "aboutlshw" ) );
list1 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview1"));
list2 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview2"));
list3 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview3"));
--
2.17.1

View File

@ -1,96 +0,0 @@
From 29f69ac618fd5ace9ed9aae7839b5cfdc1fb5130 Mon Sep 17 00:00:00 2001
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Date: Wed, 1 Apr 2020 09:25:52 -0500
Subject: [PATCH 14/17] devtree: Add capabilites to the OPAL Firmware
On OpenPower systems, the presence of the "/ibm,opal" entry in the device tree
signifies machines are running under OPAL firmware (i.e skiboot). Under this
node OPAL exports certain available interfaces. And also this node have a
compatible property listing "ibm,opal-v<X> which denotes the OPAL compatability.
This change adds a function to parse information about those OPAL firmware
capabilities and add it to skiboot firmware node. With a current OpenPower
machine, we get something like this:
*-firmware:0
description: skiboot
product: OPAL firmware
physical id: 2
version: 5.4.3-35bf9d9
capabilities: opal-v2 opal-v3 prd ipmi
Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
src/core/device-tree.cc | 42 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
index af665a4d8e1a..e7227e1f74b7 100644
--- a/src/core/device-tree.cc
+++ b/src/core/device-tree.cc
@@ -219,11 +219,48 @@ static void scan_devtree_bootrom(hwNode & core)
}
}
+static hwNode *add_base_opal_node(hwNode & core)
+{
+ vector < string >:: iterator it;
+ vector < string > compat;
+ string basepath = DEVICETREE "/ibm,opal";
+ hwNode opal("firmware");
+
+ if (!exists(basepath))
+ return NULL;
+
+ pushd(basepath);
+
+ opal.setProduct("OPAL firmware");
+ opal.setDescription("skiboot");
+
+ compat = get_strings(basepath + "/compatible");
+ for (it = compat.begin(); it != compat.end(); ++it) {
+ if (matches(*it, "^ibm,opal-v"))
+ opal.addCapability((*it).erase(0,4));
+ }
+
+ if (exists(basepath + "/ipmi/compatible") &&
+ matches(get_string(basepath + "/ipmi/compatible"), "^ibm,opal-ipmi"))
+ opal.addCapability("ipmi");
+
+ if (exists(basepath + "/diagnostics/compatible") &&
+ matches(get_string(basepath + "/diagnostics/compatible"), "^ibm,opal-prd"))
+ opal.addCapability("prd");
+
+ popd();
+
+ opal.claim();
+ return core.addChild(opal);
+}
+
static void scan_devtree_firmware_powernv(hwNode & core)
{
int n;
struct dirent **namelist;
+ hwNode *opal = add_base_opal_node(core);
+
if (!exists(DEVICETREE "/ibm,firmware-versions"))
return;
@@ -245,6 +282,11 @@ static void scan_devtree_firmware_powernv(hwNode & core)
fwnode.setDescription(sname);
fwnode.setVersion(hw::strip(get_string(fullpath)));
fwnode.claim();
+ if (opal && sname == "skiboot") {
+ opal->merge(fwnode);
+ free(namelist[i]);
+ continue;
+ }
core.addChild(fwnode);
}
free(namelist[i]);
--
2.17.1

View File

@ -1,22 +0,0 @@
From 60c906d385b933fb6f5f0f2b14bfc9ea6de43a99 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Fri, 21 Aug 2020 11:38:20 +0200
Subject: [PATCH 15/18] Update 'docs/TODO'
---
docs/TODO | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/TODO b/docs/TODO
index 1e74710cb37b..ff0f288e2333 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -7,3 +7,5 @@
* use businfo to find CPUs instead of hardcoding cpu:n form
* use sysfs for PCMCIA access
* use MPTABLE for reporting of CPUs
+
+report SSD/rotational devices: /sys/block/DEV/queue/rotational
--
2.17.1

View File

@ -1,29 +0,0 @@
From 4348e283f8a0bdd40b97c5d0b6e12354576b3113 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Mon, 25 May 2020 09:31:05 +0200
Subject: [PATCH 15/17] =?UTF-8?q?fix=20issue=20with=20logical=20names=20be?=
=?UTF-8?q?ing=20truncated=20(`/dev/sda`=20=E2=86=92=20`sda`)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/core/hw.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/hw.cc b/src/core/hw.cc
index f7da370816c5..aca424c3f221 100644
--- a/src/core/hw.cc
+++ b/src/core/hw.cc
@@ -1083,7 +1083,7 @@ void hwNode::setLogicalName(const string & name)
This->logicalnames.push_back("/dev/" + n);
}
else
- This->logicalnames.push_back(basename(n.c_str()));
+ This->logicalnames.push_back((n[0]=='/')?n:basename(n.c_str()));
if(This->dev == "")
This->dev = get_devid(n);
--
2.17.1

View File

@ -1,22 +0,0 @@
From 358e65f92dec01f13b632d1d13fb8c76e1d50ca4 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Wed, 26 Aug 2020 23:36:59 +0200
Subject: [PATCH 16/18] Update 'docs/TODO'
---
docs/TODO | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/TODO b/docs/TODO
index ff0f288e2333..0b337826dc86 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -9,3 +9,4 @@
* use MPTABLE for reporting of CPUs
report SSD/rotational devices: /sys/block/DEV/queue/rotational
+better handle containers
\ No newline at end of file
--
2.17.1

View File

@ -1,51 +0,0 @@
From 37c3f3934b9d03be2d0ec70caf3779e03c003c5a Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Mon, 25 May 2020 15:24:38 +0200
Subject: [PATCH 16/17] code clean-up for read(3)
use ssize_t instead of size_t
cf. Github PR #52
---
src/core/cpuinfo.cc | 2 +-
src/core/osutils.cc | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
index 49f3052d8da1..9e41a42184a6 100644
--- a/src/core/cpuinfo.cc
+++ b/src/core/cpuinfo.cc
@@ -597,7 +597,7 @@ bool scan_cpuinfo(hwNode & n)
if (core)
{
char buffer[1024];
- size_t count;
+ ssize_t count;
string cpuinfo_str = "";
string description = "", version = "";
string plat = platform();
diff --git a/src/core/osutils.cc b/src/core/osutils.cc
index f023a465921b..a53ed89e9d7b 100644
--- a/src/core/osutils.cc
+++ b/src/core/osutils.cc
@@ -148,7 +148,7 @@ vector < string > &list)
{
char buffer[1024];
string buffer_str = "";
- size_t count = 0;
+ ssize_t count = 0;
data_file fd = file_open(file);
if (file_open_error(fd))
@@ -174,7 +174,7 @@ const string & def)
if (fd >= 0)
{
char buffer[1024];
- size_t count = 0;
+ ssize_t count = 0;
memset(buffer, 0, sizeof(buffer));
result = "";
--
2.17.1

View File

@ -1,27 +0,0 @@
From 3775782808e8b9b8aa72ed2ce23e145433e193cf Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Wed, 27 May 2020 01:16:20 +0200
Subject: [PATCH 17/17] report product model on Power systems
Github PR #54
---
src/core/device-tree.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
index e7227e1f74b7..027ad16fc557 100644
--- a/src/core/device-tree.cc
+++ b/src/core/device-tree.cc
@@ -1396,7 +1396,7 @@ static void get_ibm_model(hwNode & n)
{
if (ibm_model_defs[i].model == machinetype || ibm_model_defs[i].model == model)
{
- n.setProduct(ibm_model_defs[i].modelname);
+ n.setProduct(n.getProduct() + " (" + ibm_model_defs[i].modelname + ")");
n.addHint("icon", string(ibm_model_defs[i].icon));
n.setConfig("chassis", ibm_model_defs[i].chassis);
return;
--
2.17.1

View File

@ -1,77 +0,0 @@
From 2c235e6bf21e30b8e2da4d20f358df1e540a5b69 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Thu, 15 Oct 2020 14:11:58 +0200
Subject: [PATCH 17/18] update man page
add `-notime` option
---
src/lshw.1 | 9 ++++++---
src/lshw.sgml | 5 +++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/lshw.1 b/src/lshw.1
index 79c36197c32d..ae6fa34cea50 100644
--- a/src/lshw.1
+++ b/src/lshw.1
@@ -1,5 +1,5 @@
.\" auto-generated by docbook2man-spec from docbook-utils package
-.TH "LSHW" "1" "28 January 2018" "$Rev$" ""
+.TH "LSHW" "1" "15 October 2020" "$Rev$" ""
.SH NAME
lshw \- list hardware
.SH SYNOPSIS
@@ -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-quiet\fR ] [ \fB-notime\fR ]
.SH "DESCRIPTION"
.PP
@@ -53,7 +53,7 @@ Outputs the device tree showing hardware paths, very much like the output of HP-
Outputs the device list showing bus information, detailing SCSI, USB, IDE and PCI addresses.
.TP
\fB-dump \fIfilename\fB\fR
-Display output and dump collected information into a file (SQLite database).
+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\&.
@@ -74,6 +74,9 @@ Remove potentially sensitive information from output (IP addresses, serial numbe
.TP
\fB-numeric\fR
Also display numeric IDs (for PCI and USB devices).
+.TP
+\fB-notime\fR
+Exclude volatile attributes (timestamps) from output.
.SH "BUGS"
.PP
\fBlshw\fR currently does not detect
diff --git a/src/lshw.sgml b/src/lshw.sgml
index 8c1c49e0898b..5e92cbfd4665 100644
--- a/src/lshw.sgml
+++ b/src/lshw.sgml
@@ -43,6 +43,7 @@ list hardware
<arg choice="opt"><option>-sanitize</option></arg>
<arg choice="opt"><option>-numeric</option></arg>
<arg choice="opt"><option>-quiet</option></arg>
+ <arg choice="opt"><option>-notime</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -126,6 +127,10 @@ Remove potentially sensitive information from output (IP addresses, serial numbe
<listitem><para>
Also display numeric IDs (for PCI and USB devices).
</para></listitem></varlistentry>
+<varlistentry><term>-notime</term>
+<listitem><para>
+Exclude volatile attributes (timestamps) from output.
+</para></listitem></varlistentry>
</variablelist>
</para>
--
2.17.1

View File

@ -1,41 +0,0 @@
From 56f1de9d1e4d6ff92d98530c0d3d91b353a311b9 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Thu, 15 Oct 2020 14:22:05 +0200
Subject: [PATCH 18/18] fix man page after previous update
SGML source was not in sync with man page
---
src/lshw.1 | 2 +-
src/lshw.sgml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lshw.1 b/src/lshw.1
index ae6fa34cea50..74b0e42afcad 100644
--- a/src/lshw.1
+++ b/src/lshw.1
@@ -53,7 +53,7 @@ Outputs the device tree showing hardware paths, very much like the output of HP-
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\&.
diff --git a/src/lshw.sgml b/src/lshw.sgml
index 5e92cbfd4665..d190279e96d5 100644
--- a/src/lshw.sgml
+++ b/src/lshw.sgml
@@ -101,7 +101,7 @@ Outputs the device list showing bus information, detailing <productname>SCSI</pr
</para></listitem></varlistentry>
<varlistentry><term>-dump <replaceable class="parameter">filename</replaceable></term>
<listitem><para>
-Dump collected information into a file (SQLite database).
+Display output and dump collected information into a file (SQLite database).
</para></listitem></varlistentry>
<varlistentry><term>-class <replaceable class="parameter">class</replaceable></term>
<listitem><para>
--
2.17.1

View File

@ -1,66 +0,0 @@
commit 135a853c60582b14c5b67e5cd988a8062d9896f4
Author: Lyonel Vincent <lyonel@ezix.org>
Date: Fri Apr 28 16:54:42 2017 +0200
Fix JSON output format
cf. https://github.com/lyonel/lshw/pull/28
diff --git a/src/core/hw.cc b/src/core/hw.cc
index 68e5912..9defd26 100644
--- a/src/core/hw.cc
+++ b/src/core/hw.cc
@@ -1368,9 +1368,14 @@ string hwNode::asJSON(unsigned level)
config = getConfigKeys();
resources = getResources("\" value=\"");
+ if (level == 0)
+ {
+ out << "[" << endl;
+ }
+
if(visible(getClassName()))
{
- out << "{" << endl;
+ out << spaces(2*level) << "{" << endl;
out << spaces(2*level+2) << "\"id\" : \"" << getId() << "\"," << endl;
out << spaces(2*level+2) << "\"class\" : \"" << getClassName() << "\"";
@@ -1613,20 +1618,13 @@ string hwNode::asJSON(unsigned level)
resources.clear();
}
-
- if(countChildren()>0)
+ for (unsigned int i = 0; i < countChildren(); i++)
{
- if(visible(getClassName()))
- out << "," << endl << spaces(2*level+2) << "\"children\" : [" << endl;
-
- for (unsigned int i = 0; i < countChildren(); i++)
+ out << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
+ if (visible(getChild(i)->getClassName()))
{
- out << spaces(2*level+4) << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
- if(visible(getChild(i)->getClassName()) && (i < countChildren()-1)) out << "," << endl;
+ out << "," << endl;
}
-
- if(visible(getClassName()))
- out << endl << spaces(2*level+2) << "]";
}
if(visible(getClassName()))
@@ -1635,6 +1633,12 @@ string hwNode::asJSON(unsigned level)
out << "}";
}
+ if (level == 0)
+ {
+ out.seekp(-2, std::ios_base::end);
+ out << endl << "]" << endl;
+ }
+
return out.str();
}

View File

@ -1,28 +0,0 @@
From 5c3b96616ecec2345c6b785352192c033738f2e1 Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Thu, 25 Apr 2019 12:37:38 +0800
Subject: [PATCH] Add the "FindPkgConfig" to CMakeLists.txt.
Include the "FindPkgConfig" in order to fix "Unknown CMake command
pkg_check_modules"
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c69c37336c8..688863130291 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.0)
+include(FindPkgConfig)
+
project(lshw)
set(VERSION "B.02.19.2")
--
2.17.1

View File

@ -1,263 +0,0 @@
From 9093e083aa78aee6b85345e8fd15424549d01cac Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Thu, 3 Dec 2020 10:58:33 +0800
Subject: [PATCH] cleanup: remove unused support.c/support.h generated by Glade
The support.c and support.h are automatically generated by Glade, and these
files are not used any more, so let's remove the redundant files and make a
cleanup, which can also make ninja-build happy.
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
src/gui/callbacks.c | 1 -
src/gui/engine.cc | 5 --
src/gui/gtk-lshw.c | 1 -
src/gui/support.c | 144 --------------------------------------------
src/gui/support.h | 44 --------------
5 files changed, 195 deletions(-)
delete mode 100644 src/gui/support.c
delete mode 100644 src/gui/support.h
diff --git a/src/gui/callbacks.c b/src/gui/callbacks.c
index b108777fe11f..6b88c82e6098 100644
--- a/src/gui/callbacks.c
+++ b/src/gui/callbacks.c
@@ -5,7 +5,6 @@
#include <gtk/gtk.h>
#include "callbacks.h"
-#include "support.h"
#include "version.h"
#include "engine.h"
#include <string.h>
diff --git a/src/gui/engine.cc b/src/gui/engine.cc
index 2962ec80d81a..b537ef11db23 100644
--- a/src/gui/engine.cc
+++ b/src/gui/engine.cc
@@ -15,11 +15,6 @@
static const char *id = "@(#) $Id$";
-extern "C"
-{
-#include "support.h"
-};
-
#define AUTOMATIC "automatic file format"
#define LSHW_XML "lshw XML format (.lshw, .xml)"
#define PLAIN_TEXT "plain text document (.text, .txt)"
diff --git a/src/gui/gtk-lshw.c b/src/gui/gtk-lshw.c
index d3e531c4ceb3..090484317c6e 100644
--- a/src/gui/gtk-lshw.c
+++ b/src/gui/gtk-lshw.c
@@ -2,7 +2,6 @@
#include <unistd.h>
#include <gtk/gtk.h>
-#include "support.h"
#include "config.h"
#include "stock.h"
#include "engine.h"
diff --git a/src/gui/support.c b/src/gui/support.c
deleted file mode 100644
index 7dc3c78cb605..000000000000
--- a/src/gui/support.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * DO NOT EDIT THIS FILE - it is generated by Glade.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <gtk/gtk.h>
-
-#include "support.h"
-
-GtkWidget*
-lookup_widget (GtkWidget *widget,
- const gchar *widget_name)
-{
- GtkWidget *parent, *found_widget;
-
- for (;;)
- {
- if (GTK_IS_MENU (widget))
- parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
- else
- parent = widget->parent;
- if (!parent)
- parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
- if (parent == NULL)
- break;
- widget = parent;
- }
-
- found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
- widget_name);
- if (!found_widget)
- g_warning ("Widget not found: %s", widget_name);
- return found_widget;
-}
-
-static GList *pixmaps_directories = NULL;
-
-/* Use this function to set the directory containing installed pixmaps. */
-void
-add_pixmap_directory (const gchar *directory)
-{
- pixmaps_directories = g_list_prepend (pixmaps_directories,
- g_strdup (directory));
-}
-
-/* This is an internally used function to find pixmap files. */
-static gchar*
-find_pixmap_file (const gchar *filename)
-{
- GList *elem;
-
- /* We step through each of the pixmaps directory to find it. */
- elem = pixmaps_directories;
- while (elem)
- {
- gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
- G_DIR_SEPARATOR_S, filename);
- if (g_file_test (pathname, G_FILE_TEST_EXISTS))
- return pathname;
- g_free (pathname);
- elem = elem->next;
- }
- return NULL;
-}
-
-/* This is an internally used function to create pixmaps. */
-GtkWidget*
-create_pixmap (GtkWidget *widget,
- const gchar *filename)
-{
- gchar *pathname = NULL;
- GtkWidget *pixmap;
-
- if (!filename || !filename[0])
- return gtk_image_new ();
-
- pathname = find_pixmap_file (filename);
-
- if (!pathname)
- {
- g_warning ("Couldn't find pixmap file: %s", filename);
- return gtk_image_new ();
- }
-
- pixmap = gtk_image_new_from_file (pathname);
- g_free (pathname);
- return pixmap;
-}
-
-/* This is an internally used function to create pixmaps. */
-GdkPixbuf*
-create_pixbuf (const gchar *filename)
-{
- gchar *pathname = NULL;
- GdkPixbuf *pixbuf;
- GError *error = NULL;
-
- if (!filename || !filename[0])
- return NULL;
-
- pathname = find_pixmap_file (filename);
-
- if (!pathname)
- {
- g_warning ("Couldn't find pixmap file: %s", filename);
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
- if (!pixbuf)
- {
- fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
- pathname, error->message);
- g_error_free (error);
- }
- g_free (pathname);
- return pixbuf;
-}
-
-/* This is used to set ATK action descriptions. */
-void
-glade_set_atk_action_description (AtkAction *action,
- const gchar *action_name,
- const gchar *description)
-{
- gint n_actions, i;
-
- n_actions = atk_action_get_n_actions (action);
- for (i = 0; i < n_actions; i++)
- {
- if (!strcmp (atk_action_get_name (action, i), action_name))
- atk_action_set_description (action, i, description);
- }
-}
-
diff --git a/src/gui/support.h b/src/gui/support.h
deleted file mode 100644
index 2dea079c2a42..000000000000
--- a/src/gui/support.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * DO NOT EDIT THIS FILE - it is generated by Glade.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-/*
- * Public Functions.
- */
-
-/*
- * This function returns a widget in a component created by Glade.
- * Call it with the toplevel widget in the component (i.e. a window/dialog),
- * or alternatively any widget in the component, and the name of the widget
- * you want returned.
- */
-GtkWidget* lookup_widget (GtkWidget *widget,
- const gchar *widget_name);
-
-
-/* Use this function to set the directory containing installed pixmaps. */
-void add_pixmap_directory (const gchar *directory);
-
-
-/*
- * Private Functions.
- */
-
-/* This is used to create the pixmaps used in the interface. */
-GtkWidget* create_pixmap (GtkWidget *widget,
- const gchar *filename);
-
-/* This is used to create the pixbufs used in the interface. */
-GdkPixbuf* create_pixbuf (const gchar *filename);
-
-/* This is used to set ATK action descriptions. */
-void glade_set_atk_action_description (AtkAction *action,
- const gchar *action_name,
- const gchar *description);
-
--
2.17.1

View File

@ -1,29 +1,30 @@
From 5da5b63bd38634834bb3e631a24e31a10ab60f27 Mon Sep 17 00:00:00 2001 From ea934d3d3bd86b366b2ad4fea16600c0e0476c74 Mon Sep 17 00:00:00 2001
From: Terje Rosten <terje.rosten@ntnu.no> From: Terje Rosten <terje.rosten@ntnu.no>
Date: Wed, 25 Mar 2020 21:57:53 +0100 Date: Sun, 7 Jan 2024 15:23:24 +0100
Subject: [PATCH] cmakeify Subject: [PATCH] cmakeify
--- ---
CMakeLists.txt | 43 ++++++ CMakeLists.txt | 43 +++++
Makefile | 20 --- Makefile | 20 ---
README.md | 51 ++++--- README.md | 53 +++---
lshw.spec.in | 66 +++----- lshw.spec.in | 64 ++------
src/CMakeLists.txt | 102 +++++++++++++ src/CMakeLists.txt | 104 ++++++++++++
src/Makefile | 144 ------------------ src/Makefile | 152 ------------------
src/core/Makefile | 80 ---------- src/core/Makefile | 83 ----------
src/core/{config.h => config.h.in} | 28 +--- src/core/{config.h => config.h.in} | 28 +---
src/core/db.cc | 8 + src/core/db.cc | 8 +
src/core/dump.cc | 2 +- src/core/dump.cc | 2 +-
src/core/version.h | 2 + src/core/version.h | 2 +
src/gui/CMakeLists.txt | 67 ++++++++ src/gui/CMakeLists.txt | 74 +++++++++
src/gui/Makefile | 61 -------- src/gui/Makefile | 62 -------
.../{gtk-lshw.desktop => gtk-lshw.desktop.in} | 7 +- .../{gtk-lshw.desktop => gtk-lshw.desktop.in} | 7 +-
src/gui/integration/lshw-gui.in | 5 + src/gui/integration/lshw-gui.in | 5 +
.../integration/org.ezix.lshw.gui.policy.in | 20 +++ .../integration/org.ezix.lshw.gui.policy.in | 20 +++
src/gui/stock.c | 1 + src/gui/stock.c | 1 +
src/gui/support.c | 144 -----------------
src/po/CMakeLists.txt | 16 ++ src/po/CMakeLists.txt | 16 ++
src/po/Makefile | 23 --- src/po/Makefile | 23 ---
19 files changed, 327 insertions(+), 419 deletions(-) 20 files changed, 337 insertions(+), 574 deletions(-)
create mode 100644 CMakeLists.txt create mode 100644 CMakeLists.txt
delete mode 100644 Makefile delete mode 100644 Makefile
create mode 100644 src/CMakeLists.txt create mode 100644 src/CMakeLists.txt
@ -35,19 +36,20 @@ Subject: [PATCH] cmakeify
rename src/gui/integration/{gtk-lshw.desktop => gtk-lshw.desktop.in} (51%) rename src/gui/integration/{gtk-lshw.desktop => gtk-lshw.desktop.in} (51%)
create mode 100644 src/gui/integration/lshw-gui.in create mode 100644 src/gui/integration/lshw-gui.in
create mode 100644 src/gui/integration/org.ezix.lshw.gui.policy.in create mode 100644 src/gui/integration/org.ezix.lshw.gui.policy.in
delete mode 100644 src/gui/support.c
create mode 100644 src/po/CMakeLists.txt create mode 100644 src/po/CMakeLists.txt
delete mode 100644 src/po/Makefile delete mode 100644 src/po/Makefile
diff --git a/CMakeLists.txt b/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 new file mode 100644
index 0000000..3b1d4d6 index 0000000..d076f2b
--- /dev/null --- /dev/null
+++ b/CMakeLists.txt +++ b/CMakeLists.txt
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
+cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.0)
+ +
+project(lshw) +project(lshw)
+set(VERSION "B.02.19.2") +set(VERSION "B.02.20")
+ +
+find_package(Git) +find_package(Git)
+ +
@ -89,7 +91,7 @@ index 0000000..3b1d4d6
+add_subdirectory(src/gui) +add_subdirectory(src/gui)
diff --git a/Makefile b/Makefile diff --git a/Makefile b/Makefile
deleted file mode 100644 deleted file mode 100644
index 8fe665e..0000000 index b1be8b3..0000000
--- a/Makefile --- a/Makefile
+++ /dev/null +++ /dev/null
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
@ -97,7 +99,7 @@ index 8fe665e..0000000
-VERSION?= $(shell git describe --tags | cut -d - -f 1,2 | tr - .) -VERSION?= $(shell git describe --tags | cut -d - -f 1,2 | tr - .)
-export PACKAGENAME -export PACKAGENAME
- -
-all clean install snapshot gui install-gui: -all clean install snapshot gui install-gui static:
- +$(MAKE) -C src $@ - +$(MAKE) -C src $@
- -
-version.cpe: .version -version.cpe: .version
@ -114,7 +116,7 @@ index 8fe665e..0000000
- tar --transform s!^!$(PACKAGENAME)-$(VERSION)/! -rf $(PACKAGENAME)-$(VERSION).tar $^ - tar --transform s!^!$(PACKAGENAME)-$(VERSION)/! -rf $(PACKAGENAME)-$(VERSION).tar $^
- gzip -f $(PACKAGENAME)-$(VERSION).tar - gzip -f $(PACKAGENAME)-$(VERSION).tar
diff --git a/README.md b/README.md diff --git a/README.md b/README.md
index 30feaf1..294888c 100644 index 0c610f5..8ef71f6 100644
--- a/README.md --- a/README.md
+++ b/README.md +++ b/README.md
@@ -15,27 +15,29 @@ Installation @@ -15,27 +15,29 @@ Installation
@ -124,7 +126,7 @@ index 30feaf1..294888c 100644
+ - cmake, GNU make or Ninja + - cmake, GNU make or Ninja
- an ANSI (or close enough to ANSI compliance) C++ compiler (tested with g++ 2.95.4 and 3.x) - an ANSI (or close enough to ANSI compliance) C++ compiler (tested with g++ 2.95.4 and 3.x)
- for the (optional) GTK+ graphical user interface, you will need a - for the (optional) GTK+ graphical user interface, you will need a
complete GTK+ development environment (gtk2-devel on RedHat/Fedora derivatives) complete GTK+ development environment (gtk3-devel on RedHat/Fedora derivatives)
+ - for optional SQLite feature install SQLite + - for optional SQLite feature install SQLite
+ - for optional zlib feature install zlib and gzip + - for optional zlib feature install zlib and gzip
@ -169,18 +171,19 @@ index 30feaf1..294888c 100644
+ $ cmake .. -DSTATIC=ON + $ cmake .. -DSTATIC=ON
+ $ ninja + $ ninja
or or
-
- $ make compressed
-
-in the `src/` directory
+ $ mkdir build && cd build + $ mkdir build && cd build
+ $ cmake .. -GNinja + $ cmake .. -GNinja
+ $ ninja compressed + $ ninja compressed
- $ make compressed Building compressed binaries requires `upx` (cf. https://upx.github.io/).
+Building compressed binaries requires `upx` (cf. https://upx.github.io/). +
-in the `src/` directory
+Release management and data files maintenance +Release management and data files maintenance
+--------------------------------------------- +---------------------------------------------
+
-Building compressed binaries requires `upx` (cf. https://upx.github.io/).
+Create release tarball, +Create release tarball,
+ +
+ 1. Edit CMakeLists.txt to set version + 1. Edit CMakeLists.txt to set version
@ -193,10 +196,10 @@ index 30feaf1..294888c 100644
+ +
+ $ make refresh_hwdata + $ make refresh_hwdata
diff --git a/lshw.spec.in b/lshw.spec.in diff --git a/lshw.spec.in b/lshw.spec.in
index e837fd4..3fe23c2 100644 index b3b636f..3a6f9eb 100644
--- a/lshw.spec.in --- a/lshw.spec.in
+++ b/lshw.spec.in +++ b/lshw.spec.in
@@ -7,11 +7,11 @@ Version: @VERSION@ @@ -7,9 +7,11 @@ Version: @VERSION@
Release: 2 Release: 2
Source: http://www.ezix.org/software/files/%{name}-%{version}.tar.gz Source: http://www.ezix.org/software/files/%{name}-%{version}.tar.gz
URL: http://lshw.ezix.org/ URL: http://lshw.ezix.org/
@ -204,15 +207,13 @@ index e837fd4..3fe23c2 100644
+License: GPLv2 +License: GPLv2
Group: Applications/System Group: Applications/System
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-%global debug_package %{nil}
+BuildRequires: gcc +BuildRequires: gcc
+BuildRequires: gcc-c++ +BuildRequires: gcc-c++
+BuildRequires: cmake +BuildRequires: cmake
%description %global debug_package %{nil}
lshw (Hardware Lister) is a small tool to provide detailed information on
@@ -39,7 +39,7 @@ lshw (Hardware Lister) is a small tool to provide detailed informaton on @@ -39,7 +41,7 @@ lshw (Hardware Lister) is a small tool to provide detailed information on
the hardware configuration of the machine. It can report exact memory the hardware configuration of the machine. It can report exact memory
configuration, firmware version, mainboard configuration, CPU version configuration, firmware version, mainboard configuration, CPU version
and speed, cache configuration, bus speed, etc. on DMI-capable x86s and speed, cache configuration, bus speed, etc. on DMI-capable x86s
@ -221,7 +222,7 @@ index e837fd4..3fe23c2 100644
This package provides a graphical user interface to display hardware This package provides a graphical user interface to display hardware
information. information.
@@ -54,61 +54,29 @@ http://lshw.ezix.org/ @@ -54,61 +56,29 @@ http://lshw.ezix.org/
%setup -q %setup -q
%build %build
@ -297,15 +298,17 @@ index e837fd4..3fe23c2 100644
%changelog %changelog
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 new file mode 100644
index 0000000..8b97a16 index 0000000..09e2774
--- /dev/null --- /dev/null
+++ b/src/CMakeLists.txt +++ b/src/CMakeLists.txt
@@ -0,0 +1,102 @@ @@ -0,0 +1,104 @@
+if(STATIC) +if(STATIC)
+ set(ZLIB OFF) + set(ZLIB OFF)
+ set(SQLITE OFF) + set(SQLITE OFF)
+endif() +endif()
+ +
+find_package(PkgConfig)
+
+# SQLite support +# SQLite support
+if(SQLITE) +if(SQLITE)
+ pkg_check_modules(SQLITE3 sqlite3) + pkg_check_modules(SQLITE3 sqlite3)
@ -405,10 +408,10 @@ index 0000000..8b97a16
+install(TARGETS lshw DESTINATION sbin) +install(TARGETS lshw DESTINATION sbin)
diff --git a/src/Makefile b/src/Makefile diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644 deleted file mode 100644
index 7ae8218..0000000 index ac726d0..0000000
--- a/src/Makefile --- a/src/Makefile
+++ /dev/null +++ /dev/null
@@ -1,144 +0,0 @@ @@ -1,152 +0,0 @@
-PACKAGENAME:=lshw -PACKAGENAME:=lshw
-export PACKAGENAME -export PACKAGENAME
-VERSION?= $(shell git describe --tags --long | cut -d - -f 1,2 | tr - .) -VERSION?= $(shell git describe --tags --long | cut -d - -f 1,2 | tr - .)
@ -423,6 +426,7 @@ index 7ae8218..0000000
-DATADIR=$(PREFIX)/share -DATADIR=$(PREFIX)/share
-INSTALL?=install -p -INSTALL?=install -p
-STRIP?=strip -STRIP?=strip
-GZIP?=gzip -9
-export DESTDIR -export DESTDIR
-export PREFIX -export PREFIX
-export SBINDIR -export SBINDIR
@ -432,26 +436,33 @@ index 7ae8218..0000000
-export ZLIB -export ZLIB
- -
-CXX?=$(CROSS_COMPILE)c++ -CXX?=$(CROSS_COMPILE)c++
-PKG_CONFIG ?= pkg-config
-INCLUDES=-I./core/ -INCLUDES=-I./core/
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DVERSION=\"$(VERSION)\" -ifneq ($(NO_VERSION_CHECK), 1)
-REMOTE_VERSION_CHECK?=-DREMOTE_VERSION_CHECK
-endif
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DVERSION=\"$(VERSION)\" $(REMOTE_VERSION_CHECK)
-CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) -CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
-ifeq ($(SQLITE), 1) -ifeq ($(SQLITE), 1)
- CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3) - CXXFLAGS+= -DSQLITE $(shell $(PKG_CONFIG) --cflags sqlite3)
-endif -endif
-ifeq ($(ZLIB), 1) -ifeq ($(ZLIB), 1)
- CXXFLAGS+= -DZLIB $(shell pkg-config --cflags zlib) - CXXFLAGS+= -DZLIB $(shell $(PKG_CONFIG) --cflags zlib)
-endif -endif
-LDFLAGS+=-L./core/ -g -LDFLAGS+=-L./core/ -g
-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) -ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
- LDFLAGS+= -Wl,--as-needed - LDFLAGS+= -Wl,--as-needed
-endif -endif
-LDSTATIC=-static -LDSTATIC=-static
-LIBS+=-llshw -lresolv -LIBS+=-llshw
-ifneq ($(NO_VERSION_CHECK), 1)
-LIBS+=-lresolv
-endif
-ifeq ($(SQLITE), 1) -ifeq ($(SQLITE), 1)
- LIBS+= $(shell pkg-config --libs sqlite3) - LIBS+= $(shell $(PKG_CONFIG) --libs sqlite3)
-endif -endif
-ifeq ($(ZLIB), 1) -ifeq ($(ZLIB), 1)
- LIBS+= $(shell pkg-config --libs zlib) - LIBS+= $(shell $(PKG_CONFIG) --libs zlib)
-endif -endif
- -
-export CXXFLAGS -export CXXFLAGS
@ -470,7 +481,7 @@ index 7ae8218..0000000
- $(CXX) $(CXXFLAGS) -c $< -o $@ - $(CXX) $(CXXFLAGS) -c $< -o $@
- -
-%.gz: % -%.gz: %
- gzip -c $< > $@ - $(GZIP) -c $< > $@
- -
-.PHONY: core -.PHONY: core
-core: -core:
@ -555,21 +566,24 @@ index 7ae8218..0000000
-# DO NOT DELETE -# DO NOT DELETE
diff --git a/src/core/Makefile b/src/core/Makefile diff --git a/src/core/Makefile b/src/core/Makefile
deleted file mode 100644 deleted file mode 100644
index b429380..0000000 index 5035062..0000000
--- a/src/core/Makefile --- a/src/core/Makefile
+++ /dev/null +++ /dev/null
@@ -1,80 +0,0 @@ @@ -1,83 +0,0 @@
-PACKAGENAME?=lshw -PACKAGENAME?=lshw
- -
-CXX?=$(CROSS_COMPILE)c++ -CXX?=$(CROSS_COMPILE)c++
-INCLUDES= -INCLUDES=
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -ifneq ($(NO_VERSION_CHECK), 1)
-REMOTE_VERSION_CHECK?=-DREMOTE_VERSION_CHECK
-endif
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" $(REMOTE_VERSION_CHECK)
-CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) -CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
-LDFLAGS= -LDFLAGS=
-LDSTATIC= -LDSTATIC=
-LIBS= -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 nvme.o mmc.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 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 nvme.o mmc.o input.o sound.o graphics.o
-ifeq ($(SQLITE), 1) -ifeq ($(SQLITE), 1)
- OBJS+= db.o - OBJS+= db.o
-endif -endif
@ -731,27 +745,34 @@ index 91e039a..5cecdda 100644
#else #else
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
new file mode 100644 new file mode 100644
index 0000000..3489053 index 0000000..ddc4aab
--- /dev/null --- /dev/null
+++ b/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt
@@ -0,0 +1,67 @@ @@ -0,0 +1,74 @@
+if(NOT GUI OR STATIC) +if(NOT GUI OR STATIC)
+ message("-- gtk-${PROJECT_NAME} disabled") + message("-- gtk-${PROJECT_NAME} disabled")
+ return() + return()
+endif() +endif()
+ +
+find_package(PkgConfig) +find_package(PkgConfig)
+pkg_check_modules(GTK2 REQUIRED gtk+-2.0 gmodule-2.0) +pkg_check_modules(GTK3 REQUIRED gtk+-3.0 gmodule-2.0)
+ +
+file(GLOB GTK_SOURCES "*.c*") +set(GTK_SOURCES
+ callbacks.c
+ gtk-lshw.c
+ stock.c
+ engine.cc
+ print-gui.cc
+)
+ +
+include_directories("${PROJECT_BINARY_DIR}") +include_directories("${PROJECT_BINARY_DIR}")
+include_directories("${PROJECT_SOURCE_DIR}/src/core") +include_directories("${PROJECT_SOURCE_DIR}/src/core")
+ +
+include_directories("${GTK2_INCLUDE_DIRS}") +include_directories("${GTK3_INCLUDE_DIRS}")
+link_directories("${GTK3_LIBRARY_DIRS}")
+ +
+add_executable(gtk-lshw ${GTK_SOURCES}) +add_executable(gtk-lshw ${GTK_SOURCES})
+target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK2_LIBRARIES} core resolv) +target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK3_LIBRARIES} core resolv)
+install(TARGETS gtk-lshw DESTINATION sbin) +install(TARGETS gtk-lshw DESTINATION sbin)
+ +
+if(POLICYKIT) +if(POLICYKIT)
@ -804,29 +825,30 @@ index 0000000..3489053
+endif() +endif()
diff --git a/src/gui/Makefile b/src/gui/Makefile diff --git a/src/gui/Makefile b/src/gui/Makefile
deleted file mode 100644 deleted file mode 100644
index f003cfb..0000000 index cc2d168..0000000
--- a/src/gui/Makefile --- a/src/gui/Makefile
+++ /dev/null +++ /dev/null
@@ -1,61 +0,0 @@ @@ -1,62 +0,0 @@
-PACKAGENAME?=lshw -PACKAGENAME?=lshw
- -
-CXX?=$(CROSS_COMPILE)c++ -CXX?=$(CROSS_COMPILE)c++
-PKG_CONFIG ?= pkg-config
-CC?=$(CROSS_COMPILE)cc -CC?=$(CROSS_COMPILE)cc
-STRIP?=strip -STRIP?=strip
-OBJCOPY?=objcopy -OBJCOPY?=objcopy
- -
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
-GTKINCLUDES=$(shell pkg-config gtk+-2.0 --cflags) -GTKINCLUDES=$(shell $(PKG_CONFIG) gtk+-3.0 --cflags)
-INCLUDES=-I../core $(GTKINCLUDES) -INCLUDES=-I../core $(GTKINCLUDES)
-CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) -CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
-ifeq ($(SQLITE), 1) -ifeq ($(SQLITE), 1)
- CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3) - CXXFLAGS+= -DSQLITE $(shell $(PKG_CONFIG) --cflags sqlite3)
-endif -endif
-CFLAGS=$(CXXFLAGS) -g $(DEFINES) -CFLAGS=$(CXXFLAGS) -g $(DEFINES)
-GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs) -GTKLIBS=$(shell $(PKG_CONFIG) gtk+-3.0 gmodule-2.0 --libs)
-LIBS+=-L../core -llshw -lresolv $(GTKLIBS) -LIBS+=-L../core -llshw -lresolv $(GTKLIBS)
-ifeq ($(SQLITE), 1) -ifeq ($(SQLITE), 1)
- LIBS+= $(shell pkg-config --libs sqlite3) - LIBS+= $(shell $(PKG_CONFIG) --libs sqlite3)
-endif -endif
-LDFLAGS= -LDFLAGS=
-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) -ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
@ -928,7 +950,7 @@ index 0000000..cba4189
+ </action> + </action>
+</policyconfig> +</policyconfig>
diff --git a/src/gui/stock.c b/src/gui/stock.c diff --git a/src/gui/stock.c b/src/gui/stock.c
index 08675db..2f92332 100644 index c3159b8..db2e981 100644
--- a/src/gui/stock.c --- a/src/gui/stock.c
+++ b/src/gui/stock.c +++ b/src/gui/stock.c
@@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
@ -936,6 +958,156 @@ index 08675db..2f92332 100644
#include "stock.h" #include "stock.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
diff --git a/src/gui/support.c b/src/gui/support.c
deleted file mode 100644
index 7dc3c78..0000000
--- a/src/gui/support.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * DO NOT EDIT THIS FILE - it is generated by Glade.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <gtk/gtk.h>
-
-#include "support.h"
-
-GtkWidget*
-lookup_widget (GtkWidget *widget,
- const gchar *widget_name)
-{
- GtkWidget *parent, *found_widget;
-
- for (;;)
- {
- if (GTK_IS_MENU (widget))
- parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
- else
- parent = widget->parent;
- if (!parent)
- parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
- if (parent == NULL)
- break;
- widget = parent;
- }
-
- found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
- widget_name);
- if (!found_widget)
- g_warning ("Widget not found: %s", widget_name);
- return found_widget;
-}
-
-static GList *pixmaps_directories = NULL;
-
-/* Use this function to set the directory containing installed pixmaps. */
-void
-add_pixmap_directory (const gchar *directory)
-{
- pixmaps_directories = g_list_prepend (pixmaps_directories,
- g_strdup (directory));
-}
-
-/* This is an internally used function to find pixmap files. */
-static gchar*
-find_pixmap_file (const gchar *filename)
-{
- GList *elem;
-
- /* We step through each of the pixmaps directory to find it. */
- elem = pixmaps_directories;
- while (elem)
- {
- gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
- G_DIR_SEPARATOR_S, filename);
- if (g_file_test (pathname, G_FILE_TEST_EXISTS))
- return pathname;
- g_free (pathname);
- elem = elem->next;
- }
- return NULL;
-}
-
-/* This is an internally used function to create pixmaps. */
-GtkWidget*
-create_pixmap (GtkWidget *widget,
- const gchar *filename)
-{
- gchar *pathname = NULL;
- GtkWidget *pixmap;
-
- if (!filename || !filename[0])
- return gtk_image_new ();
-
- pathname = find_pixmap_file (filename);
-
- if (!pathname)
- {
- g_warning ("Couldn't find pixmap file: %s", filename);
- return gtk_image_new ();
- }
-
- pixmap = gtk_image_new_from_file (pathname);
- g_free (pathname);
- return pixmap;
-}
-
-/* This is an internally used function to create pixmaps. */
-GdkPixbuf*
-create_pixbuf (const gchar *filename)
-{
- gchar *pathname = NULL;
- GdkPixbuf *pixbuf;
- GError *error = NULL;
-
- if (!filename || !filename[0])
- return NULL;
-
- pathname = find_pixmap_file (filename);
-
- if (!pathname)
- {
- g_warning ("Couldn't find pixmap file: %s", filename);
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
- if (!pixbuf)
- {
- fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
- pathname, error->message);
- g_error_free (error);
- }
- g_free (pathname);
- return pixbuf;
-}
-
-/* This is used to set ATK action descriptions. */
-void
-glade_set_atk_action_description (AtkAction *action,
- const gchar *action_name,
- const gchar *description)
-{
- gint n_actions, i;
-
- n_actions = atk_action_get_n_actions (action);
- for (i = 0; i < n_actions; i++)
- {
- if (!strcmp (atk_action_get_name (action, i), action_name))
- atk_action_set_description (action, i, description);
- }
-}
-
diff --git a/src/po/CMakeLists.txt b/src/po/CMakeLists.txt diff --git a/src/po/CMakeLists.txt b/src/po/CMakeLists.txt
new file mode 100644 new file mode 100644
index 0000000..de2f5c8 index 0000000..de2f5c8
@ -960,13 +1132,13 @@ index 0000000..de2f5c8
+endif() +endif()
diff --git a/src/po/Makefile b/src/po/Makefile diff --git a/src/po/Makefile b/src/po/Makefile
deleted file mode 100644 deleted file mode 100644
index 36fbdb7..0000000 index 1d5b138..0000000
--- a/src/po/Makefile --- a/src/po/Makefile
+++ /dev/null +++ /dev/null
@@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
-PACKAGENAME?=lshw -PACKAGENAME?=lshw
- -
-LANGUAGES = fr -LANGUAGES = ca es fr
-SRCS = $(LANGUAGES:=.po) -SRCS = $(LANGUAGES:=.po)
-CATALOGS = $(LANGUAGES:=.mo) -CATALOGS = $(LANGUAGES:=.mo)
- -
@ -988,5 +1160,5 @@ index 36fbdb7..0000000
-clean: -clean:
- rm -f $(CATALOGS) $(PACKAGENAME).pot - rm -f $(CATALOGS) $(PACKAGENAME).pot
-- --
2.25.1 2.40.1

160
lshw-gtk.1 Normal file
View File

@ -0,0 +1,160 @@
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "LSHW-GTK 1"
.TH LSHW-GTK 1 "2007-12-05" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
lshw\-gtk \- list hardware (GTK version)
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
lshw is a small tool to extract detailed information on the hardware
configuration of the machine. It can report exact memory
configuration, firmware version, mainboard configuration,
\&\s-1CPU\s0 version
and speed, cache configuration, bus speed, etc. on
DMI-capable x86 or \s-1IA\-64\s0
systems and on some PowerPC
machines (PowerMac G4 is known to work).
.PP
It currently supports \s-1DMI\s0 (x86 and \s-1IA\-64\s0 only), OpenFirmware device tree (PowerPC only),
\&\s-1PCI/AGP\s0, \s-1CPUID\s0 (x86), \s-1IDE/ATA/ATAPI\s0, \s-1PCMCIA\s0 (only tested on x86), \s-1SCSI\s0 and \s-1USB\s0.
.SH "NOTES"
.IX Header "NOTES"
lshw-gtk must be run as super user or it will only report
.SH "COPYING"
.IX Header "COPYING"
lshw is distributed under the \s-1GNU\s0 \s-1GENERAL\s0 \s-1PUBLIC\s0 \s-1LICENSE\s0 (\s-1GPL\s0) version 2.
.SH "AUTOR"
.IX Header "AUTOR"
lshw is maintained by Lyonel Vincent
<lyonel@ezix.org>.
.SH "OTHER INFO"
.IX Header "OTHER INFO"
The webpage for lshw is at http://ezix.org/software/lshw.html

View File

@ -1,65 +1,28 @@
%undefine __cmake_in_source_build
%bcond_without gui
Summary: Hardware lister Summary: Hardware lister
Name: lshw Name: lshw
Version: B.02.19.2 Version: B.02.20
Release: 6%{?dist} Release: 4%{?dist}
License: GPLv2 License: GPL-2.0-only
Group: Applications/System
URL: http://ezix.org/project/wiki/HardwareLiSter URL: http://ezix.org/project/wiki/HardwareLiSter
Source0: http://www.ezix.org/software/files/lshw-%{version}.tar.gz Source0: http://www.ezix.org/software/files/lshw-%{version}.tar.gz
Source1: https://salsa.debian.org/openstack-team/third-party/lshw/raw/debian/stein/debian/patches/lshw-gtk.1
Patch1: lshw-B.02.18-scandir.patch Patch1: lshw-B.02.18-scandir.patch
Patch2: lshw-B.02.18-revert-json.patch Patch2: lshw-B.02.20-cmake.patch
Patch3: lshw-B.02.19.2-cmake.patch
Patch4: lshw-B.02.19.2-Add-the-FindPkgConfig-to-CMakeLists.patch
Patch5: 0001-report-CPU-family-model-stepping.patch
Patch6: 0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch
Patch7: 0003-correctly-format-SMBIOS-UUID.patch
Patch8: 0004-cosmetic-clean-up.patch
Patch9: 0005-begin-work-on-input-devices.patch
Patch10: 0006-cosmetic-fixes.patch
Patch11: 0007-detect-sound-devices.patch
Patch12: 0008-detect-framebuffers.patch
Patch13: 0009-try-to-connect-input-devices-to-the-right-parent.patch
Patch14: 0010-devtree-Add-chip-id-from-the-dimm-module.patch
Patch15: 0011-devtree-Add-chip-id-from-CPU-node.patch
Patch16: 0012-volumes-fix-segfault-in-apfs-volume-code.patch
Patch17: 0013-merge-Github-PR-53.patch
Patch18: 0014-devtree-Add-capabilites-to-the-OPAL-Firmware.patch
Patch19: 0015-fix-issue-with-logical-names-being-truncated-dev-sda.patch
Patch20: 0016-code-clean-up-for-read-3.patch
Patch21: 0017-report-product-model-on-Power-systems.patch
Patch22: 0001-Fix-few-memory-leaks.patch
Patch23: 0002-Build-against-gtk3-instead-of-gtk2.patch
Patch24: 0003-Remove-deprecated-stock-messages.patch
Patch25: 0004-Remove-hack-which-is-apparently-not-useful-anymore.patch
Patch26: 0005-Use-GtkFileChooserNative-instead-of-GtkFileChooserDi.patch
Patch27: 0006-Replace-deprecated-GtkIconFactory-with-GHashTable.patch
Patch28: 0007-Replace-the-last-GtkStock-in-overwrite-dialog.patch
Patch29: 0008-Remove-deprecated-widgets.patch
Patch30: 0009-Remove-deprecated-use_action_appearance-property.patch
Patch31: 0010-Move-to-GtkApplication.patch
Patch32: 0011-Replace-signals-with-GSimpleActions.patch
Patch33: 0012-Enable-Disable-GSimpleAction-instead-of-button-sensi.patch
Patch34: 0013-Move-from-GtkMenuBar-to-GMenu.patch
Patch35: 0014-Replace-the-about-GtkDialog-with-a-GtkAboutDialog.patch
Patch36: 0015-Update-docs-TODO.patch
Patch37: 0016-Update-docs-TODO.patch
Patch38: 0017-update-man-page.patch
Patch39: 0018-fix-man-page-after-previous-update.patch
Patch40: rhelonly-cleanup-remove-unused-support.c-support.h-generated-.patch
Patch41: 0001-Report-correct-memory-size-on-SMBIOS-2.7.patch
Patch42: 0001-devtree-Add-UUID-property.patch
Patch43: 0001-Fix-getting-size-of-memory-banks-32GiB.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: gettext BuildRequires: gettext
BuildRequires: gtk3-devel >= 3.22 %if %{with gui}
BuildRequires: gtk3-devel >= 3.24
BuildRequires: libappstream-glib BuildRequires: libappstream-glib
%endif
BuildRequires: ninja-build BuildRequires: ninja-build
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: sqlite
BuildRequires: sqlite-devel BuildRequires: sqlite-devel
Requires: hwdata Requires: hwdata
%description %description
@ -71,83 +34,47 @@ systems and on some PowerPC machines (PowerMac G4 is known to work).
Information can be output in plain text, XML or HTML. Information can be output in plain text, XML or HTML.
%if %{with gui}
%package gui %package gui
Summary: Graphical hardware lister Summary: Graphical hardware lister
Group: Applications/System
Requires: polkit Requires: polkit
Requires: gtk3 >= 3.22
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%description gui %description gui
Graphical frontend for the hardware lister (lshw) tool. If desired, Graphical frontend for the hardware lister (lshw) tool. If desired,
hardware information can be saved to file in plain, XML or HTML hardware information can be saved to file in plain, XML or HTML
format. format.
%endif
%prep %prep
%setup -q %autosetup -p1
%patch01 -p1
%patch02 -R -p1
%patch03 -p1
%patch04 -p1
%patch05 -p1
%patch06 -p1
%patch07 -p1
%patch08 -p1
%patch09 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%build %build
mkdir build && pushd build %if %{with gui}
%cmake .. -DNOLOGO=ON -DHWDATA=OFF -DPOLICYKIT=ON -DBUILD_SHARED_LIBS=OFF -DSQLITE=ON -GNinja %global gui_config -DGUI=ON
%ninja_build %else
%global gui_config -DGUI=OFF
%endif
%cmake -DNOLOGO=ON -DHWDATA=OFF -DPOLICYKIT=ON -DSQLITE=ON -DBUILD_SHARED_LIBS=OFF %{gui_config} -GNinja
%cmake_build
%install %install
pushd build %cmake_install
%ninja_install %if %{with gui}
install -m0644 -D %{SOURCE1} %{buildroot}%{_mandir}/man1/lshw-gui.1
ln -s gtk-lshw %{buildroot}%{_sbindir}/lshw-gui ln -s gtk-lshw %{buildroot}%{_sbindir}/lshw-gui
%endif
# translations seems borken, remove for now # translations seems borken, remove for now
#find_lang %{name} #find_lang %{name}
rm -rf %{buildroot}%{_datadir}/locale/fr/ rm -rf %{buildroot}%{_datadir}/locale/*/
%check %check
%if %{with gui}
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml
%endif
# check json output is valid # check json output is valid
pushd build %{_vpath_builddir}/src/lshw -json \
src/lshw -json \
-disable usb -disable pcmcia -disable isapnp \ -disable usb -disable pcmcia -disable isapnp \
-disable ide -disable scsi -disable dmi -disable memory \ -disable ide -disable scsi -disable dmi -disable memory \
-disable cpuinfo 2>/dev/null | %{__python3} -m json.tool -disable cpuinfo 2>/dev/null | %{__python3} -m json.tool
@ -159,11 +86,13 @@ src/lshw -json \
%{_mandir}/man1/lshw.1* %{_mandir}/man1/lshw.1*
%{_sbindir}/lshw %{_sbindir}/lshw
%if %{with gui}
%files gui %files gui
%license COPYING %license COPYING
%{_bindir}/lshw-gui %{_bindir}/lshw-gui
%{_sbindir}/gtk-lshw %{_sbindir}/gtk-lshw
%{_sbindir}/lshw-gui %{_sbindir}/lshw-gui
%{_mandir}/man1/lshw-gui.1*
%dir %{_datadir}/lshw %dir %{_datadir}/lshw
%{_datadir}/lshw/artwork %{_datadir}/lshw/artwork
%dir %{_datadir}/lshw/ui %dir %{_datadir}/lshw/ui
@ -172,58 +101,84 @@ src/lshw -json \
%{_datadir}/applications/gtk-lshw.desktop %{_datadir}/applications/gtk-lshw.desktop
%{_datadir}/appdata/gtk-lshw.appdata.xml %{_datadir}/appdata/gtk-lshw.appdata.xml
%{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy %{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy
%endif
%changelog %changelog
* Tue Jun 08 2021 Tao Liu <ltao@redhat.com> - B.02.19.2-6 * Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - B.02.20-4
- Fix getting size of memory banks <32GiB - Bump release for June 2024 mass rebuild
* Tue Feb 02 2021 Lianbo Jiang <lijiang@redhat.com> - B.02.19.2-5 * Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - B.02.20-3
- Fix the wrong memory information in azure m or mv2 series - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
- Add UUID property to PowerVM LPAR
* Wed Dec 16 2020 Lianbo Jiang <lijiang@redhat.com> - B.02.19.2-4 * Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - B.02.20-2
- Fix the gtk3 dependency for lshw-gui instead of lshw - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
- Resolves: rhbz#1905816
* Thu Dec 03 2020 Lianbo Jiang <lijiang@redhat.com> - B.02.19.2-3 * Sat Jan 06 2024 Terje Rosten <terje.rosten@ntnu.no> - B.02.20-1
- Update to upstream master 56f1de9d1e4d - B.02.20
- Resolves: rhbz#1844426 - Remove all upstream patches
* Wed May 27 2020 Lianbo Jiang <lijiang@redhat.com> - B.02.19.2-2 * Tue Aug 08 2023 Terje Rosten <terje.rosten@ntnu.no> - B.02.19.2-13
- Update to upstream master 3775782808e8 - Use SPDX licence
* Tue May 26 2020 Lianbo Jiang <lijiang@redhat.com> - B.02.19.2-1 * Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - B.02.19.2-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Apr 05 2023 Terje Rosten <terje.rosten@ntnu.no> - B.02.19.2-11
- Use modern macros
* Tue Apr 04 2023 Yaakov Selkowitz <yselkowi@redhat.com> - B.02.19.2-10
- Update to upstream commit 76afbaaf40e
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - B.02.19.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - B.02.19.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sun Jun 19 2022 Stewart Smith <trawets@amazon.com> - B.02.19.2-7
- Make GUI an optional bcond
- Disable remote DNS lookup on 'lshw -version'
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - B.02.19.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - B.02.19.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - B.02.19.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - B.02.19.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Apr 24 2020 Terje Rosten <terje.rosten@ntnu.no> - B.02.19.2-2
- Add patch from openSUSE to fix rhbz#1822455
* Tue Mar 24 2020 Terje Rosten <terje.rosten@ntnu.no> - B.02.19.2-1
- B.02.19.2 - B.02.19.2
* Mon Feb 10 2020 Lianbo Jiang <lijiang@redhat.com> - B.02.18-23 * Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - B.02.18-23
- Do not show modified time with -notime option - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
- Resolves: rhbz#1733126
* Thu Nov 21 2019 Lianbo Jiang <lijiang@redhat.com> - B.02.18-22 * Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - B.02.18-22
- Display proper logical name of network device - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
- Resolves: rhbz#1724087
- Add DIMM running speed and Print dimm rank information
- Resolves: rhbz#1725199
* Mon May 13 2019 Lianbo Jiang <lijiang@redhat.com> - B.02.18-21 * Tue May 28 2019 Terje Rosten <terje.rosten@ntnu.no> - B.02.18-21
- Update to upstream master 6cc0581bc805. - Update to commit 6cc0581
- Resolves: rhbz#1664092 - Rebase cmake patch on top 6cc0581
- Add NVME patch from PR#45
* Thu Apr 25 2019 Lianbo Jiang <lijiang@redhat.com> - B.02.18-20 * Sat May 25 2019 Terje Rosten <terje.rosten@ntnu.no> - B.02.18-20
- Change python to python3 in selftest/Makefile for the CI gating test. - Add lshw-gui man page (from Debian, thanks!)
- Resolves: rhbz#1680623
* Thu Apr 25 2019 Lianbo Jiang <lijiang@redhat.com> - B.02.18-19 * Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - B.02.18-19
- Enable SQLite and fix the CI gating test. - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
- Resolves: rhbz#1680623
* Tue Apr 23 2019 Lianbo Jiang <lijiang@redhat.com> - B.02.18-18 * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - B.02.18-18
- Fix:59a8e99ab22d ("Porting the code from /CoreOS/lshw/sanity/check-output for the CI gating") - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
- Resolves: rhbz#1680623
* Fri Apr 19 2019 Lianbo Jiang <lijiang@redhat.com> - B.02.18-17 * Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - B.02.18-17
- Add the CI gating test - Rebuilt for Python 3.7
- Resolves: rhbz#1680623
* Mon Apr 02 2018 Terje Rosten <terje.rosten@ntnu.no> - B.02.18-16 * Mon Apr 02 2018 Terje Rosten <terje.rosten@ntnu.no> - B.02.18-16
- Update to commit 20cda77 - Update to commit 20cda77

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (lshw-B.02.20.tar.gz) = afc5d57f4b7c49d8e1934a3df623657882cc1325268c8c024dc0fa25495edd3ce7fdadb9c83ac6e5d3e723bc08d6175162d4d879ced09f76ad145ff42b38d3f0