diff --git a/README.md b/README.md index 6659f9ca..0c610f54 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Installation - a PA-RISC-, Alpha-, IA-64- (Itanium-), PowerPC-, ARM- or x86- based machine - 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 (gtk3-devel on RedHat/Fedora derivatives) + complete GTK+ development environment (gtk3-devel on RedHat/Fedora derivatives) 2. To compile it, just use: @@ -42,7 +42,7 @@ Getting help 1. the lshw home page is http://lshw.ezix.org/ 2. bug reports and feature requests: http://ezix.org/project/newticket?component=lshw - + Please make sure you include enough information in your bug report: XML output from lshw is preferred over text or HTML, indicate the affected version of lshw, your platform (i386, x86-64, PA-RISC, PowerPC, etc.) and your distribution. NOTE TO DISTRIBUTIONS diff --git a/docs/Changelog b/docs/Changelog index 6ea288c6..0f648f51 100644 --- a/docs/Changelog +++ b/docs/Changelog @@ -3,17 +3,17 @@ detection of SD/MMC and SDIO devices bug fixes code cleanup - updated data files + updated data files * lshw B.02.18 migrated to git bug fixes code cleanup - updated data files + updated data files * lshw B.02.17 bug fixes code cleanup improved support for FAT-formatted disks - updated data files + updated data files * lshw B.02.16 bug fixes code cleanup @@ -27,7 +27,7 @@ updated data files * lshw B.02.14 bug fixes - support for EXT4 partitions + support for EXT4 partitions * lshw B.02.13 fix bug #402: properly detect 64 bit systems (even when compiled for i386) fix bug #401: SMP-related crash on IA-64 @@ -70,7 +70,7 @@ * lshw B.02.09 minor bugfixes (#26, #27) added support for PCI domains (#28) - use of /sys (sysfs) when possible for PCI devices + use of /sys (sysfs) when possible for PCI devices * B.02.08.01 bugfix release for non-x86 platforms (#24) * B.02.08 @@ -99,7 +99,7 @@ the GUI now uses a GtkTextView instead of a GtkLabel SVG icons are now displayed for USB, Firewire, SCSI, etc. added support for reporting VMX (Vanderpool) capabilities (untested) - fixed a compilation problem with GCC 4 + fixed a compilation problem with GCC 4 * B.02.03 added support for PA-RISC devices (IODC-controlled) on 2.6 kernels the GUI can now be launched by invoking lshw with the '-X' option diff --git a/docs/TODO b/docs/TODO index 0b337826..2d4d3af9 100644 --- a/docs/TODO +++ b/docs/TODO @@ -9,4 +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 +better handle containers diff --git a/lshw.spec.in b/lshw.spec.in index f6884abc..b3b636f7 100644 --- a/lshw.spec.in +++ b/lshw.spec.in @@ -35,7 +35,7 @@ Requires: gtk3 >= 3.24 BuildRequires: gtk3-devel >= 3.24 %description gui -lshw (Hardware Lister) is a small tool to provide detailed informaton on +lshw (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86s diff --git a/src/Makefile b/src/Makefile index 7532dadd..8258c541 100644 --- a/src/Makefile +++ b/src/Makefile @@ -131,7 +131,7 @@ install-gui: gui $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui $(INSTALL) -m 0644 gui/*.ui $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui $(INSTALL) -m 0644 gui/artwork/*.svg $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork - + clean: rm -f $(PACKAGENAME).o $(PACKAGENAME) $(PACKAGENAME)-static $(PACKAGENAME)-compressed rm -f $(addsuffix .gz,$(DATAFILES)) diff --git a/src/core/Makefile b/src/core/Makefile index cdb3ee73..a8ed0cff 100644 --- a/src/core/Makefile +++ b/src/core/Makefile @@ -23,7 +23,7 @@ lib$(PACKAGENAME).a: $(OBJS) $(AR) rs $@ $^ install: all - + clean: rm -f $(OBJS) lib$(PACKAGENAME).a diff --git a/src/core/cdrom.cc b/src/core/cdrom.cc index 11b9a842..58fa7b00 100644 --- a/src/core/cdrom.cc +++ b/src/core/cdrom.cc @@ -25,6 +25,7 @@ #include #include #include +#include __ID("@(#) $Id$"); diff --git a/src/core/cpuid.cc b/src/core/cpuid.cc index c40dc98f..3cb60ac5 100644 --- a/src/core/cpuid.cc +++ b/src/core/cpuid.cc @@ -7,6 +7,7 @@ #include #include #include +#include __ID("@(#) $Id$"); diff --git a/src/core/dmi.cc b/src/core/dmi.cc index df5db6b8..6d76c53a 100644 --- a/src/core/dmi.cc +++ b/src/core/dmi.cc @@ -1648,9 +1648,9 @@ int dmiversionrev) uint64_t(data[0x1C]) << 40 | uint64_t(data[0x1B]) << 32 | uint64_t(data[0x1A]) << 24 | uint64_t(data[0x19]) << 16 | uint64_t(data[0x18]) << 8 | uint64_t(data[0x17]); - if (end - start < 512) // memory range is smaller thant 512KB + if (end - start < 512) // memory range is smaller than 512KB { -// consider that values were expressed in megagytes +// consider that values were expressed in megabytes start *= 1024; end *= 1024; } @@ -1688,7 +1688,7 @@ int dmiversionrev) uint64_t(data[0x18]) << 8 | uint64_t(data[0x17]); if (end - start < 512) // memory range is smaller than 512KB { -// consider that values were expressed in megagytes +// consider that values were expressed in megabytes start *= 1024; end *= 1024; } diff --git a/src/core/fb.cc b/src/core/fb.cc index 5456204a..d1989821 100644 --- a/src/core/fb.cc +++ b/src/core/fb.cc @@ -14,6 +14,7 @@ #include #include #include +#include __ID("@(#) $Id$"); diff --git a/src/core/ideraid.cc b/src/core/ideraid.cc index 5cff28f0..5e84ab02 100644 --- a/src/core/ideraid.cc +++ b/src/core/ideraid.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/src/core/mounts.cc b/src/core/mounts.cc index 495a3c21..79b682e8 100644 --- a/src/core/mounts.cc +++ b/src/core/mounts.cc @@ -14,7 +14,7 @@ #include #include #include - +#include __ID("@(#) $Id$"); diff --git a/src/core/network.cc b/src/core/network.cc index 5aab06d8..d66c9784 100644 --- a/src/core/network.cc +++ b/src/core/network.cc @@ -53,6 +53,7 @@ typedef unsigned long long u64; typedef uint32_t u32; typedef uint16_t u16; typedef uint8_t u8; +typedef int8_t s8; struct ethtool_cmd { @@ -70,6 +71,28 @@ struct ethtool_cmd u32 reserved[4]; }; +#define MAX_LINK_MODE_MASK_SIZE 64 +struct ethtool_link_settings +{ + u32 cmd; + u32 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ + u8 duplex; /* Duplex, half or full */ + u8 port; /* Which connector port */ + u8 phy_address; + u8 autoneg; /* Enable or disable autonegotiation */ + u8 mdio_support; + u8 eth_tp_mdix; + u8 eth_tp_mdix_ctrl; + s8 link_mode_masks_nwords; + u8 transceiver; /* Which tranceiver to use */ + u8 master_slave_cfg; + u8 master_slave_state; + u8 reserved1[1]; + u32 reserved[7]; + u32 link_mode_masks[3 * MAX_LINK_MODE_MASK_SIZE]; /* Link mode mask fields for modes: + supported, advertised, peer advertised. */ +}; + #ifndef IFNAMSIZ #define IFNAMSIZ 32 #endif @@ -108,6 +131,7 @@ struct ethtool_value #define ETHTOOL_GSET 0x00000001 /* Get settings. */ #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ #define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ +#define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get link mode settings. */ /* Indicates what features are supported by the interface. */ #define SUPPORTED_10baseT_Half (1 << 0) @@ -124,10 +148,17 @@ struct ethtool_value #define SUPPORTED_BNC (1 << 11) #define SUPPORTED_10000baseT_Full (1 << 12) -/* The forced speed, 10Mb, 100Mb, gigabit, 10GbE. */ +/* Indicates what features are supported by the interface, + * in the second word of the extended bitmap. */ +#define SUPPORTED2_2500baseT_Full (1 << 15) +#define SUPPORTED2_5000baseT_Full (1 << 16) + +/* The forced speed, 10Mb, 100Mb, gigabit, 2.5GbE, 5GbE, 10GbE. */ #define SPEED_10 10 #define SPEED_100 100 #define SPEED_1000 1000 +#define SPEED_2500 2500 +#define SPEED_5000 5000 #define SPEED_10000 10000 /* Duplex, half or full. */ @@ -308,6 +339,168 @@ static bool isVirtual(const string & MAC) } +static void updateCapabilities(hwNode & interface, u32 supported, u32 supported2, u32 speed, u8 duplex, u8 port, u8 autoneg) +{ + if(supported & SUPPORTED_TP) + interface.addCapability("tp", _("twisted pair")); + if(supported & SUPPORTED_AUI) + interface.addCapability("aui", _("AUI")); + if(supported & SUPPORTED_BNC) + interface.addCapability("bnc", _("BNC")); + if(supported & SUPPORTED_MII) + interface.addCapability("mii", _("Media Independent Interface")); + if(supported & SUPPORTED_FIBRE) + interface.addCapability("fibre",_( "optical fibre")); + if(supported & SUPPORTED_10baseT_Half) + { + interface.addCapability("10bt", _("10Mbit/s")); + interface.setCapacity(10000000ULL); + } + if(supported & SUPPORTED_10baseT_Full) + { + interface.addCapability("10bt-fd", _("10Mbit/s (full duplex)")); + interface.setCapacity(10000000ULL); + } + if(supported & SUPPORTED_100baseT_Half) + { + interface.addCapability("100bt", _("100Mbit/s")); + interface.setCapacity(100000000ULL); + } + if(supported & SUPPORTED_100baseT_Full) + { + interface.addCapability("100bt-fd", _("100Mbit/s (full duplex)")); + interface.setCapacity(100000000ULL); + } + if(supported & SUPPORTED_1000baseT_Half) + { + interface.addCapability("1000bt", "1Gbit/s"); + interface.setCapacity(1000000000ULL); + } + if(supported & SUPPORTED_1000baseT_Full) + { + interface.addCapability("1000bt-fd", _("1Gbit/s (full duplex)")); + interface.setCapacity(1000000000ULL); + } + if(supported2 & SUPPORTED2_2500baseT_Full) + { + interface.addCapability("2500bt-fd", _("2.5Gbit/s (full duplex)")); + interface.setCapacity(2500000000ULL); + } + if(supported2 & SUPPORTED2_5000baseT_Full) + { + interface.addCapability("5000bt-fd", _("5Gbit/s (full duplex)")); + interface.setCapacity(5000000000ULL); + } + if(supported & SUPPORTED_10000baseT_Full) + { + interface.addCapability("10000bt-fd", _("10Gbit/s (full duplex)")); + interface.setCapacity(10000000000ULL); + } + if(supported & SUPPORTED_Autoneg) + interface.addCapability("autonegotiation", _("Auto-negotiation")); + + switch(speed) + { + case SPEED_10: + interface.setConfig("speed", "10Mbit/s"); + interface.setSize(10000000ULL); + break; + case SPEED_100: + interface.setConfig("speed", "100Mbit/s"); + interface.setSize(100000000ULL); + break; + case SPEED_1000: + interface.setConfig("speed", "1Gbit/s"); + interface.setSize(1000000000ULL); + break; + case SPEED_2500: + interface.setConfig("speed", "2.5Gbit/s"); + interface.setSize(2500000000ULL); + break; + case SPEED_5000: + interface.setConfig("speed", "5Gbit/s"); + interface.setSize(5000000000ULL); + break; + case SPEED_10000: + interface.setConfig("speed", "10Gbit/s"); + interface.setSize(10000000000ULL); + break; + } + switch(duplex) + { + case DUPLEX_HALF: + interface.setConfig("duplex", "half"); + break; + case DUPLEX_FULL: + interface.setConfig("duplex", "full"); + break; + } + switch(port) + { + case PORT_TP: + interface.setConfig("port", "twisted pair"); + break; + case PORT_AUI: + interface.setConfig("port", "AUI"); + break; + case PORT_BNC: + interface.setConfig("port", "BNC"); + break; + case PORT_MII: + interface.setConfig("port", "MII"); + break; + case PORT_FIBRE: + interface.setConfig("port", "fibre"); + break; + } + interface.setConfig("autonegotiation", (autoneg == AUTONEG_DISABLE) ? "off" : "on"); +} + + +static void scan_modes(hwNode & interface, int fd) +{ + struct ifreq ifr; + struct ethtool_cmd ecmd; + struct ethtool_link_settings elink; + s8 mask_size; + + elink.cmd = ETHTOOL_GLINKSETTINGS; + elink.link_mode_masks_nwords = 0; + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, interface.getLogicalName().c_str()); + ifr.ifr_data = (caddr_t) &elink; + // Probe link mode mask count. + if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) + { + mask_size = -elink.link_mode_masks_nwords; + if (mask_size > 1 && mask_size <= MAX_LINK_MODE_MASK_SIZE) + { + elink.cmd = ETHTOOL_GLINKSETTINGS; + elink.link_mode_masks_nwords = mask_size; + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, interface.getLogicalName().c_str()); + ifr.ifr_data = (caddr_t) &elink; + // Read link mode settings. + if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) + { + updateCapabilities(interface, elink.link_mode_masks[0], elink.link_mode_masks[1], + elink.speed, elink.duplex, elink.port, elink.autoneg); + return; + } + } + } + + ecmd.cmd = ETHTOOL_GSET; + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, interface.getLogicalName().c_str()); + ifr.ifr_data = (caddr_t) &ecmd; + if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) + { + updateCapabilities(interface, ecmd.supported, 0, ecmd.speed, ecmd.duplex, ecmd.port, ecmd.autoneg); + } +} + + bool scan_network(hwNode & n) { vector < string > interfaces; @@ -322,7 +515,6 @@ bool scan_network(hwNode & n) { struct ifreq ifr; struct ethtool_drvinfo drvinfo; - struct ethtool_cmd ecmd; struct ethtool_value edata; for (unsigned int i = 0; i < interfaces.size(); i++) @@ -417,108 +609,7 @@ bool scan_network(hwNode & n) interface.setConfig("link", edata.data ? "yes":"no"); } - ecmd.cmd = ETHTOOL_GSET; - memset(&ifr, 0, sizeof(ifr)); - strcpy(ifr.ifr_name, interfaces[i].c_str()); - ifr.ifr_data = (caddr_t) &ecmd; - if (ioctl(fd, SIOCETHTOOL, &ifr) == 0) - { - if(ecmd.supported & SUPPORTED_TP) - interface.addCapability("tp", _("twisted pair")); - if(ecmd.supported & SUPPORTED_AUI) - interface.addCapability("aui", _("AUI")); - if(ecmd.supported & SUPPORTED_BNC) - interface.addCapability("bnc", _("BNC")); - if(ecmd.supported & SUPPORTED_MII) - interface.addCapability("mii", _("Media Independant Interface")); - if(ecmd.supported & SUPPORTED_FIBRE) - interface.addCapability("fibre",_( "optical fibre")); - if(ecmd.supported & SUPPORTED_10baseT_Half) - { - interface.addCapability("10bt", _("10Mbit/s")); - interface.setCapacity(10000000ULL); - } - if(ecmd.supported & SUPPORTED_10baseT_Full) - { - interface.addCapability("10bt-fd", _("10Mbit/s (full duplex)")); - interface.setCapacity(10000000ULL); - } - if(ecmd.supported & SUPPORTED_100baseT_Half) - { - interface.addCapability("100bt", _("100Mbit/s")); - interface.setCapacity(100000000ULL); - } - if(ecmd.supported & SUPPORTED_100baseT_Full) - { - interface.addCapability("100bt-fd", _("100Mbit/s (full duplex)")); - interface.setCapacity(100000000ULL); - } - if(ecmd.supported & SUPPORTED_1000baseT_Half) - { - interface.addCapability("1000bt", "1Gbit/s"); - interface.setCapacity(1000000000ULL); - } - if(ecmd.supported & SUPPORTED_1000baseT_Full) - { - interface.addCapability("1000bt-fd", _("1Gbit/s (full duplex)")); - interface.setCapacity(1000000000ULL); - } - if(ecmd.supported & SUPPORTED_10000baseT_Full) - { - interface.addCapability("10000bt-fd", _("10Gbit/s (full duplex)")); - interface.setCapacity(10000000000ULL); - } - if(ecmd.supported & SUPPORTED_Autoneg) - interface.addCapability("autonegotiation", _("Auto-negotiation")); - - switch(ecmd.speed) - { - case SPEED_10: - interface.setConfig("speed", "10Mbit/s"); - interface.setSize(10000000ULL); - break; - case SPEED_100: - interface.setConfig("speed", "100Mbit/s"); - interface.setSize(100000000ULL); - break; - case SPEED_1000: - interface.setConfig("speed", "1Gbit/s"); - interface.setSize(1000000000ULL); - break; - case SPEED_10000: - interface.setConfig("speed", "10Gbit/s"); - interface.setSize(10000000000ULL); - break; - } - switch(ecmd.duplex) - { - case DUPLEX_HALF: - interface.setConfig("duplex", "half"); - break; - case DUPLEX_FULL: - interface.setConfig("duplex", "full"); - break; - } - switch(ecmd.port) - { - case PORT_TP: - interface.setConfig("port", "twisted pair"); - break; - case PORT_AUI: - interface.setConfig("port", "AUI"); - break; - case PORT_BNC: - interface.setConfig("port", "BNC"); - break; - case PORT_MII: - interface.setConfig("port", "MII"); - break; - case PORT_FIBRE: - interface.setConfig("port", "fibre"); - break; - } - interface.setConfig("autonegotiation", (ecmd.autoneg == AUTONEG_DISABLE) ? "off" : "on"); - } + scan_modes(interface, fd); drvinfo.cmd = ETHTOOL_GDRVINFO; memset(&ifr, 0, sizeof(ifr)); diff --git a/src/core/osutils.cc b/src/core/osutils.cc index 8cce54ce..cfa09ca2 100644 --- a/src/core/osutils.cc +++ b/src/core/osutils.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include diff --git a/src/core/partitions.cc b/src/core/partitions.cc index 42689038..69fdc2c9 100644 --- a/src/core/partitions.cc +++ b/src/core/partitions.cc @@ -21,6 +21,8 @@ #include "volumes.h" #include "osutils.h" #include +#include +#include #include #include #include @@ -520,7 +522,6 @@ hwNode & partition) * - Now pass seed as an arg * - changed unsigned long to uint32_t, added #include * - changed len to be an unsigned long - * - changed crc32val to be a register * - License remains unchanged! It's still GPL-compatable! */ @@ -626,7 +627,7 @@ uint32_t __efi_crc32(const void *buf, unsigned long len, uint32_t seed) { unsigned long i; - register uint32_t crc32val; + uint32_t crc32val; const unsigned char *s = (const unsigned char *)buf; crc32val = seed; diff --git a/src/core/pci.cc b/src/core/pci.cc index a1dd5c74..5040d75e 100644 --- a/src/core/pci.cc +++ b/src/core/pci.cc @@ -14,6 +14,7 @@ #include #include #include +#include __ID("@(#) $Id$"); diff --git a/src/core/pcmcia-legacy.cc b/src/core/pcmcia-legacy.cc index bf68911b..8983ccb8 100644 --- a/src/core/pcmcia-legacy.cc +++ b/src/core/pcmcia-legacy.cc @@ -9,6 +9,7 @@ #include #include #include +#include __ID("@(#) $Id$"); diff --git a/src/core/pcmcia.cc b/src/core/pcmcia.cc index 1db47b20..4d939475 100644 --- a/src/core/pcmcia.cc +++ b/src/core/pcmcia.cc @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/src/core/smp.cc b/src/core/smp.cc index 9bd36314..df1c88b3 100644 --- a/src/core/smp.cc +++ b/src/core/smp.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include "osutils.h" diff --git a/src/core/spd.cc b/src/core/spd.cc index a304d061..babdf1bd 100644 --- a/src/core/spd.cc +++ b/src/core/spd.cc @@ -9,6 +9,7 @@ #include #include #include +#include __ID("@(#) $Id$"); diff --git a/src/core/usb.cc b/src/core/usb.cc index 7074d878..6e3203be 100644 --- a/src/core/usb.cc +++ b/src/core/usb.cc @@ -14,6 +14,7 @@ #include "heuristics.h" #include "options.h" #include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #define PROCBUSUSBDEVICES "/proc/bus/usb/devices" #define SYSKERNELDEBUGUSBDEVICES "/sys/kernel/debug/usb/devices" diff --git a/src/core/volumes.cc b/src/core/volumes.cc index 6fce2ee3..53096ba8 100644 --- a/src/core/volumes.cc +++ b/src/core/volumes.cc @@ -22,6 +22,7 @@ #include #include #include +#include __ID("@(#) $Id$"); diff --git a/src/gui/Makefile b/src/gui/Makefile index 1f85545e..cc2d168c 100644 --- a/src/gui/Makefile +++ b/src/gui/Makefile @@ -47,7 +47,7 @@ gtk-$(PACKAGENAME): $(OBJS) ../core/liblshw.a install: all $(STRIP) gtk-$(PACKAGENAME) - + clean: rm -f $(OBJS) gtk-$(PACKAGENAME) gtk-lshw.glade.bak gtk-lshw.gladep.bak callbacks.c.bak callbacks.h.bak Makefile.bak diff --git a/src/gui/engine.cc b/src/gui/engine.cc index 2962ec80..ea442cc1 100644 --- a/src/gui/engine.cc +++ b/src/gui/engine.cc @@ -6,6 +6,8 @@ #include "osutils.h" #include "options.h" +#include +#include #include #include #include diff --git a/src/gui/print-gui.cc b/src/gui/print-gui.cc index 4138424d..916f25d3 100644 --- a/src/gui/print-gui.cc +++ b/src/gui/print-gui.cc @@ -10,6 +10,7 @@ #include "version.h" #include "osutils.h" #include "stock.h" +#include #include #include #include diff --git a/src/po/Makefile b/src/po/Makefile index 36fbdb70..758c53da 100644 --- a/src/po/Makefile +++ b/src/po/Makefile @@ -18,6 +18,6 @@ $(PACKAGENAME).pot: POTFILES install: $(CATALOGS) $(foreach i, $(LANGUAGES), install -D $(i).mo $(DESTDIR)/$(DATADIR)/locale/$(i)/LC_MESSAGES/$(PACKAGENAME).mo ;) - + clean: rm -f $(CATALOGS) $(PACKAGENAME).pot