New version, new tarball.

This version is very peaceful, no big changes, just a few fixes and small new
features added.

This version corrects a few small glitches reported by users, and adds basic support
for disk speed report. Note that this is not as accurate as I'd like, it tries, but
there is not a lot of data to be had. Limits of disk speed seems to be, roughly:
1. most speed is reported as max board can do, not max drive can support
2. usually when speed is reported as lower than max board speed, it's correct, but,
as usual, exceptions to this were found during testing.
3. usually if drive is faster than board speed, it reports board speed, but, again,
exceptions to this rule were found during testing.

However, with this said, it's usually more or less right, at least right in terms
of the fastest speed you can expect to get with your board. NVMe was also supported,
that's much more complicated because NVMe has >= 1 lane, and each lane has up and
down data. The reported speed is max in one direction, and is a function of the
PCIe 1,2 20% overhead, and PCIe 3,4,5 ~1.5% overhead. inxi shows the actual usable
data rate, not the GT/s rate, which is the total transfers per second the unit
supports.

So due to the unreliable nature of the data, this is only a -xx option. There is
also in general no data for USB, and none for mmcblk (sd cards usually).

This feature may be enhanced with a C Perl XS library in the future, we'll see how
that goes.

FIXES:
1. corrected an issue where a networking card of type Bridge failed to be detected.
This is now handled. This was a PCI type I'd never seen before, but it exists, and
a user had it, so now it will work as expected for this type.
2. changed the default units in weather to be m (metric) imperial (i). While this is
not very intuitive for me, it's easier to explain I think. The previous c / f
syntax is supported internally, and inxi will just translate c to m and f to i, so
it doesn't matter which is or was used on a config file or with the --weather-unit
option.
3. BSD uptime had a parsing glitch, there was a spelling variant I'd never seen in
GNU/Linux that broke the regex. This is corrected now.
4. Fixed a few small man page glitches, some ordering stuff, nothing major.
5. Fixed BSD hostname issues. There was a case where a setup could have no hostname,
inxi did not handle that correctly. This fix would have applied to gnu/linux as
well.
6. Fixed a few bsd, openbsd mostly, dm detections, there is a secondary path in
OpenBSD that was not checked. This also went along with refactoring the dm logic
to be much more efficient and optimized.
7. Fine tuned dmidecode error message.
8. Fixed PCI ID issue, it was failing to catch a certain bridged network type.
9. A more global fix for unhandled tmpfs types, in this case, shm, but added a
global test that will handle all tmpfs from now on, and exclude that data from
-p reports.

NEW FEATURES:
1. First attempt to add basic disk speed (Gb/s). Supported types: ATA, NVMe. No
speed data so far handled or found: mmcblk; USB. Also possibly older /dev/hda
type devices (IDE bus) may not get handled in all cases. This may get more work
in the future, but that's a long ways off. This case oddly was one where BSDs had
support for basic disk speed reports before GNU/Linux, but that was really just
because it was part of a single data line that inxi parsed for disk data anyway
with BSDs.
2. Man items added for -Dxx disk speed options.
This commit is contained in:
Harald Hope 2018-05-21 14:45:09 -07:00
parent 933d5b7f7c
commit 0739e956b9
3 changed files with 262 additions and 67 deletions

231
inxi
View file

@ -31,8 +31,8 @@ use POSIX qw(uname strftime ttyname);
## INXI INFO ##
my $self_name='inxi';
my $self_version='3.0.09';
my $self_date='2018-05-11';
my $self_version='3.0.10';
my $self_date='2018-05-21';
my $self_patch='00';
## END INXI INFO ##
@ -79,7 +79,7 @@ my ($bsd_type,$language,$os) = ('','','');
my ($bits_sys);
my ($cpu_sleep,$dl_timeout,$limit,$ps_count,$usb_level) = (0.35,4,10,5,0);
my $sensors_cpu_nu = 0;
my $weather_unit='cf';
my $weather_unit='mi';
## Tools
my ($display,$ftp_alt,$tty_session);
@ -176,17 +176,32 @@ sub check_tools {
if ( $b_dmi ){
$action = 'use';
if ($program = check_program('dmidecode')) {
my $result = system("$program -t chassis >/dev/null 2>&1");
if (!$result){
@data = grabber("$program -t chassis -t baseboard -t processor 2>&1");
if (scalar @data < 15){
if ($b_root) {
@data = grabber("$program --type chassis");
if ( grep { $_ =~ /No SMBIOS/i } @data ){
$action = 'smbios';
foreach (@data){
if ($_ =~ /No SMBIOS/i){
$action = 'smbios';
last;
}
elsif ($_ =~ /^\/dev\/mem: Operation/i){
$action = 'no-data';
last;
}
else {
$action = 'unknown-error';
last;
}
}
}
else {
if (grep { $_ =~ /^\/dev\/mem: Permission/i } @data){
$action = 'permissions';
}
else {
$action = 'unknown-error';
}
}
}
elsif ($result){
$action = 'permissions';
}
}
else {
@ -198,6 +213,8 @@ sub check_tools {
'missing' => 'Required program dmidecode not available',
'permissions' => 'Unable to run dmidecode. Are you root?',
'smbios' => 'No SMBIOS data for dmidecode to process',
'no-data' => 'dmidecode is not allowed to read /dev/mem',
'unknown-error' => 'dmidecode was unable to generate data',
},
);
%alerts = (%alerts, %hash);
@ -1024,7 +1041,14 @@ sub get_config_item {
elsif ($key eq 'PS_COUNT') {$ps_count = int($val) }
elsif ($key eq 'SENSORS_CPU_NO') {$sensors_cpu_nu = int($val)}
elsif ($key eq 'SHOW_HOST' || $key eq 'B_SHOW_HOST') { $show{'host'} = int($val)}
elsif ($key eq 'WEATHER_UNIT') { $weather_unit = lc($val) if $val =~ /^(c|f|cf|fc)$/i}
elsif ($key eq 'WEATHER_UNIT') {
$val = lc($val) if $val;
if ($val && $val =~ /^(c|f|cf|fc|i|m|im|mi)$/){
my %units = ('c'=>'m','f'=>'i','cf'=>'mi','fc'=>'im');
$val = $units{$val} if defined $units{$val};
$weather_unit = $val;
}
}
# layout
elsif ($key eq 'CONSOLE_COLOR_SCHEME') {$colors{'console'} = int($val)}
elsif ($key eq 'GLOBAL_COLOR_SCHEME') {$colors{'global'} = int($val)}
@ -1267,11 +1291,10 @@ sub run_debugger {
sub create_debug_directory {
my $host = main::get_hostname();
$host =~ s/ /-/g;
$host ||= 'no-host';
$host = 'no-host' if !$host || $host eq 'N/A';
my ($arm_string,$bsd_string,$root_string) = ('','','');
# note: Time::Piece was introduced in perl 5.9.5
my ($sec,$min,$hour,$mday,$mon,$year) = localtime;
my $version = substr($self_version,0,3);
$year = $year+1900;
$mon += 1;
if (length($sec) == 1) {$sec = "0$sec";}
@ -1287,7 +1310,7 @@ sub create_debug_directory {
}
$bsd_string = "-BSD-$bsd_type" if $bsd_type;
$arm_string = '-ARM' if $b_arm;
$debug_dir = "$self_name$arm_string$bsd_string-$host-$today$root_string-$version";
$debug_dir = "$self_name$arm_string$bsd_string-$host-$today$root_string-$self_version";
$debug_gz = "$debug_dir.tar.gz";
$data_dir = "$user_data_dir/$debug_dir";
if ( -d $data_dir ){
@ -3652,8 +3675,11 @@ sub get_options{
my ($opt,$arg) = @_;
$arg ||= '';
$arg =~ s/\s//g;
if ($arg && $arg =~ /^(cf|fc|f|c)$/i){
$weather_unit = lc($arg);
$arg = lc($arg) if $arg;
if ($arg && $arg =~ /^(c|f|cf|fc|i|m|im|mi)$/){
my %units = ('c'=>'m','f'=>'i','cf'=>'mi','fc'=>'im');
$arg = $units{$arg} if defined $units{$arg};
$weather_unit = $arg;
}
else {
error_handler('bad-arg',$opt,$arg);
@ -4064,8 +4090,8 @@ sub show_options {
Only use if you want the weather somewhere other than the machine running
$self_name. Use only ASCII characters, replace spaces in city/state/country names with '+'.
Example:^$self_name^-W^new+york,ny"],
['1', '', '--weather-unit', "Set weather units to metric (m), imperial (f),
metric/imperial (cf), or imperial/metric (fc)."],
['1', '', '--weather-unit', "Set weather units to metric (m), imperial (i),
metric/imperial (mi), or imperial/metric (im)."],
);
push @data, @rows;
}
@ -4077,9 +4103,9 @@ sub show_options {
revision (if found)." ],
['2', '-d', '', "Extra optical drive features data; adds rev version to
optical drive." ],
['2', '-D', '', "HDD temp with disk data if you have hddtemp installed, if
you are root, or if you have added to /etc/sudoers (sudo v. 1.7 or newer).
Example:^<username>^ALL^=^NOPASSWD:^/usr/sbin/hddtemp" ],
['2', '-D', '', "HDD temp with disk data if you have hddtemp installed,
if you are root, or if you have added to /etc/sudoers (sudo v. 1.7 or newer).
Example:^<username>^ALL^=^NOPASSWD:^/usr/sbin/hddtemp" ],
['2', '-G', '', "Direct rendering status (in X); Screen number GPU is
running on (Nvidia only)." ],
['2', '-i', '', "For IPv6, show additional scope addresses: Global, Site,
@ -4112,7 +4138,7 @@ sub show_options {
['2', '-A', '', "Chip vendor:product ID for each audio device." ],
['2', '-B', '', "Serial number, voltage now/minimum (if available)." ],
['2', '-C', '', "Minimum CPU speed, if available." ],
['2', '-D', '', "Disk serial number." ],
['2', '-D', '', "Disk transfer speed; NVMe lanes; Disk serial number." ],
['2', '-G', '', "Chip vendor:product ID for each video card; OpenGL
compatibility version, if free drivers and available; compositor (experimental)." ],
['2', '-I', '', "Other detected installed gcc versions (if present). System
@ -4700,6 +4726,7 @@ sub cleaner {
sub disk_cleaner {
my ($item) = @_;
return $item if !$item;
# <?unknown>?|
$item =~ s/vendor.*|product.*|O\.?E\.?M\.?//gi;
$item =~ s/\s\s+/ /g;
$item =~ s/^\s+|\s+$//g;
@ -5873,7 +5900,6 @@ sub battery_data_dmi {
elsif ($value[0] eq 'Design Capacity') {
$value[1] =~ s/\s*mwh$//i;
$battery{$id}{'energy_full_design'} = sprintf( "%.1f", $value[1]/1000);
}
elsif ($value[0] eq 'Design Voltage') {
$value[1] =~ s/\s*mv$//i;
@ -7226,8 +7252,9 @@ sub create_output {
}
$rows[$j]{main::key($num++,'model')} = $model;
$rows[$j]{main::key($num++,'size')} = $size;
if ($extra > 0 && $row{'speed'}){
if ($extra > 1 && $row{'speed'}){
$rows[$j]{main::key($num++,'speed')} = $row{'speed'};
$rows[$j]{main::key($num++,'lanes')} = $row{'lanes'} if $row{'lanes'};
}
if ($extra > 1){
my $serial = main::apply_filter($row{'serial'});
@ -7465,6 +7492,9 @@ sub proc_data_advanced {
if ($extra > 0){
$drives[$i]{'temp'} = hdd_temp("/dev/$drives[$i]{'id'}");
if ($extra > 1){
my @speed_data = device_speed($drives[$i]{'id'});
$drives[$i]{'speed'} = $speed_data[0] if $speed_data[0];
$drives[$i]{'lanes'} = $speed_data[1] if $speed_data[1];
if (@disk_data && $disk_data[2]){
$drives[$i]{'serial'} = $disk_data[2];
}
@ -7889,6 +7919,69 @@ sub hdd_temp {
eval $end if $b_log;
return $hdd_temp;
}
sub device_speed {
eval $start if $b_log;
my ($device) = @_;
my ($b_nvme,$lanes,$speed,@data);
my $working = Cwd::abs_path("/sys/class/block/$device");
#print "$working\n";
if ($working){
my ($id);
# slice out the ata id:
# /sys/devices/pci0000:00:11.0/ata1/host0/target0:
if ($working =~ /^.*\/ata([0-9]+)\/.*/){
$id = $1;
}
# /sys/devices/pci0000:00/0000:00:05.0/virtio1/block/vda
elsif ($working =~ /^.*\/virtio([0-9]+)\/.*/){
$id = $1;
}
# /sys/devices/pci0000:10/0000:10:01.2/0000:13:00.0/nvme/nvme0/nvme0n1
elsif ($working =~ /^.*\/(nvme[0-9]+)\/.*/){
$id = $1;
$b_nvme = 1;
}
# do host last because the strings above might have host as well as their search item
# 0000:00:1f.2/host3/target3: increment by 1 sine ata starts at 1, but host at 0
elsif ($working =~ /^.*\/host([0-9]+)\/.*/){
$id = $1 + 1 if defined $1;
}
# print "$working $id\n";
if (defined $id){
if ($b_nvme){
$working = "/sys/class/nvme/$id/device/max_link_speed";
$speed = (main::reader($working))[0] if -f $working;
if ($speed =~ /([0-9\.]+)\sGT\/s/){
$speed = $1;
# pcie1: 2.5 GT/s; pcie2: 5.0 GT/s; pci3: 8 GT/s
# NOTE: PCIe 3 stopped using the 8b/10b encoding but a sample pcie3 nvme has
# rated speed of GT/s * .8 anyway. GT/s * (128b/130b)
$speed = ($speed <= 5 ) ? $speed * .8 : $speed * 128/130;
$speed = sprintf("%.1f",$speed) if $speed;
$working = "/sys/class/nvme/$id/device/max_link_width";
$lanes = (main::reader($working))[0] if -f $working;
$lanes = 1 if !$lanes;
# https://www.edn.com/electronics-news/4380071/What-does-GT-s-mean-anyway-
# https://www.anandtech.com/show/2412/2
# http://www.tested.com/tech/457440-theoretical-vs-actual-bandwidth-pci-express-and-thunderbolt/
# PCIe 1,2 use “8b/10b” encoding: eight bits are encoded into a 10-bit symbol
# PCIe 3,4,5 use "128b/130b" encoding: 128 bits are encoded into a 130 bit symbol
$speed = ($speed * $lanes) . " Gb/s";
}
}
else {
$working = "/sys/class/ata_link/link$id/sata_spd";
$speed = (main::reader($working))[0] if -f $working;
$speed = main::disk_cleaner($speed) if $speed;
$speed =~ s/Gbps/Gb\/s/ if $speed;
}
}
}
@data = ($speed,$lanes);
#print "$working $speed\n";
eval $end if $b_log;
return @data;
}
# gptid/c5e940f1-5ce2-11e6-9eeb-d05099ac4dc2 N/A ada0p1
sub match_glabel {
eval $start if $b_log;
@ -8035,7 +8128,7 @@ sub display_data(){
# $id = $ENV{'XDG_SESSION_ID'}; # returns tty session in console
my @data = main::grabber("$program --no-pager --no-legend 2>/dev/null",'','strip');
foreach (@data){
next if /tty[0-6]$/;
next if /tty[v]?[0-6]$/; # freebsd: ttyv3
$id = (split /\s+/, $_)[0];
last; # multiuser? too bad, we'll go for the first one
}
@ -9165,8 +9258,10 @@ sub card_data {
foreach (@pci){
$num = 1;
my @row = @$_;
#print "$row[0] $row[3]\n";
if ($row[0] eq 'network' || $row[0] eq 'ethernet' ){
#print "$row[0] $row[3]\n";
# NOTE: class 06 subclass 80
# https://www-s.acm.illinois.edu/sigops/2007/roll_your_own/7.c.1.html
if ($row[0] eq 'network' || $row[0] eq 'ethernet' || $row[1] eq '0680' ){
#print "$row[0] $row[3]\n";
$j = scalar @rows;
my $driver = $row[9];
@ -9184,12 +9279,10 @@ sub card_data {
$card = ($card) ? main::pci_cleaner($card,'output') : 'N/A';
#$card ||= 'N/A';
$driver ||= 'N/A';
@data = (
{
@data = ({
main::key($num++,'Card') => $card,
main::key($num++,'driver') => $driver,
},
);
},);
@rows = (@rows,@data);
if ($extra > 0){
if ($row[9] && !$bsd_type){
@ -10123,14 +10216,14 @@ sub partition_data {
}
}
@partitions_working = grep {!/^rootfs/} @partitions_working if $roots > 1;
my $filters = '^(aufs|cgroup.*|cgmfs|configfs|debugfs|\/dev|dev|\/dev/loop[0-9]*|devfs|devtmpfs|';
$filters .= 'fdescfs|iso9660|linprocfs|none|procfs|\/run(\/.*)?|run|squashfs|sys|\/sys\/.*|sysfs|';
$filters .= 'tmpfs|type|udev|unionfs|vartmp)$';
my $filters = '^(aufs|cgroup.*|cgmfs|configfs|debugfs|\/dev|dev|\/dev/loop[0-9]*|';
$filters .= 'devfs|devtmpfs|fdescfs|iso9660|linprocfs|none|procfs|\/run(\/.*)?|';
$filters .= 'run|shm|squashfs|sys|\/sys\/.*|sysfs|tmpfs|type|udev|unionfs|vartmp)$';
foreach (@partitions_working){
# stupid apple bullshit
$_ =~ s/^map\s+([\S]+)/map:\/$1/ if $b_fake_map;
my @row = split /\s+/, $_;
if ($row[0] =~ /$filters/ || $row[0] =~ /^ROOT/i){
if ($row[0] =~ /$filters/ || $row[0] =~ /^ROOT/i || ($b_fs && $row[1] eq 'tmpfs')){
next;
}
$dev_base = '';
@ -13846,16 +13939,16 @@ sub elevation_output {
$feet = sprintf("%.0f", 3.28 * $meters) if defined $meters && !$feet;
$meters = sprintf("%.1f", $feet / 3.28 ) if defined $feet && !$meters;
$meters = sprintf("%.0f", $meters) if $meters;
if ( defined $meters && $weather_unit eq 'cf' ){
if ( defined $meters && $weather_unit eq 'mi' ){
$result = "$meters $m_unit ($feet $i_unit)";
}
elsif (defined $meters && $weather_unit eq 'fc' ){
elsif (defined $meters && $weather_unit eq 'im' ){
$result = "$feet $i_unit ($meters $m_unit)";
}
elsif (defined $meters && $weather_unit eq 'c' ){
elsif (defined $meters && $weather_unit eq 'm' ){
$result = "$meters $m_unit";
}
elsif (defined $feet && $weather_unit eq 'f' ){
elsif (defined $feet && $weather_unit eq 'i' ){
$result = "$feet $i_unit";
}
else {
@ -13868,16 +13961,16 @@ sub unit_output {
eval $start if $b_log;
my ($primary,$metric,$m_unit,$imperial,$i_unit) = @_;
my $result = '';
if ($metric && $imperial && $weather_unit eq 'cf' ){
if ($metric && $imperial && $weather_unit eq 'mi' ){
$result = "$metric $m_unit ($imperial $i_unit)";
}
elsif ($metric && $imperial && $weather_unit eq 'fc' ){
elsif ($metric && $imperial && $weather_unit eq 'im' ){
$result = "$imperial $i_unit ($metric $m_unit)";
}
elsif ($metric && $weather_unit eq 'c' ){
elsif ($metric && $weather_unit eq 'm' ){
$result = "$metric $m_unit";
}
elsif ($imperial && $weather_unit eq 'f' ){
elsif ($imperial && $weather_unit eq 'i' ){
$result = "$imperial $i_unit";
}
elsif ($primary){
@ -13897,10 +13990,10 @@ sub wind_output {
$gust_mph = undef if $gust_mph && $mph && $mph eq $gust_mph;
$gust_ms = undef if $gust_ms && $ms && $ms eq $gust_ms;
# calculate and round, order matters so that rounding only happens after math done
$ms = sprintf("%.1f", $ms ) if $ms; # very low mph speeds yield 0, which is wrong
$ms = 0.44704 * $mph if $mph && !$ms;
$mph = $ms * 2.23694 if $ms && !$mph;
$kmh = sprintf("%.0f", 18 * $ms / 5) if $ms;
$ms = sprintf("%.0f", $ms ) if $ms;
$ms = sprintf("%.1f", $ms ) if $ms; # very low mph speeds yield 0, which is wrong
$mph = sprintf("%.0f", $mph) if $mph;
$gust_ms = 0.44704 * $gust_mph if $gust_mph && !$gust_ms;
$gust_kmh = 18 * $gust_ms / 5 if $gust_ms;
@ -13912,29 +14005,29 @@ sub wind_output {
$result = $primary;
}
elsif ($mph && $direction ){
if ( $weather_unit eq 'cf' ){
if ( $weather_unit eq 'mi' ){
$result = "from $direction at $ms $m_unit ($kmh $km_unit, $mph $i_unit)";
}
elsif ( $weather_unit eq 'fc' ){
elsif ( $weather_unit eq 'im' ){
$result = "from $direction at $mph $i_unit ($ms $m_unit, $kmh $km_unit)";
}
elsif ( $weather_unit eq 'c' ){
elsif ( $weather_unit eq 'm' ){
$result = "from $direction at $ms $m_unit ($kmh $km_unit)";
}
elsif ( $weather_unit eq 'f' ){
elsif ( $weather_unit eq 'i' ){
$result = "from $direction at $mph $i_unit";
}
if ($gust_mph){
if ( $weather_unit eq 'cf' ){
if ( $weather_unit eq 'mi' ){
$result .= ". Gusting to $ms $m_unit ($kmh $km_unit, $mph $i_unit)";
}
elsif ( $weather_unit eq 'fc' ){
elsif ( $weather_unit eq 'im' ){
$result .= ". Gusting to $mph $i_unit ($ms $m_unit, $kmh $km_unit)";
}
elsif ( $weather_unit eq 'c' ){
elsif ( $weather_unit eq 'm' ){
$result .= ". Gusting to $ms $m_unit ($kmh $km_unit)";
}
elsif ( $weather_unit eq 'f' ){
elsif ( $weather_unit eq 'i' ){
$result .= ". Gusting to $mph $i_unit";
}
}
@ -14809,28 +14902,38 @@ sub set_xprop {
sub get_display_manager {
eval $start if $b_log;
my (@data,@found,$temp,$working);
my (@data,@found,$temp,$working,$b_run,$b_vrun,$b_vrunrc);
# ldm - LTSP display manager. Note that sddm does not appear to have a .pid
# extension in Arch note: to avoid positives with directories, test for -f
# explicitly, not -e
my @dms = qw(entranced.pid gdm.pid gdm3.pid kdm.pid ldm.pid
lightdm.pid lxdm.pid mdm.pid nodm.pid sddm.pid sddm slim.lock
tint2.pid wdm.pid xdm.pid xenodm.pid);
lightdm.pid lxdm.pid mdm.pid nodm.pid pcdm.pid
sddm.pid slim.lock tint2.pid wdm.pid xdm.pid xenodm.pid);
# this is the only one I know of so far that has --version
# lightdm outputs to stderr, so it has to be redirected
my @dms_version = qw(lightdm);
$b_run = 1 if -d "/run";
# in most linux, /var/run is a sym link to /run, so no need to check it twice
if ( -d "/var/run" ){
my $rdlink = readlink('/var/run');
$b_vrun = 1 if $rdlink && $rdlink ne '/run';
$b_vrunrc = 1 if -d "/var/run/rc.d";
}
foreach my $id (@dms){
# note: ${dm_id%.*}/$dm_id will create a dir name out of the dm id, then
# note: $working will create a dir name out of the dm $id, then
# test if pid is in that note: sddm, in an effort to be unique and special,
# do not use a pid/lock file, but rather a random string inside a directory
# called /run/sddm/ so assuming the existence of the pid inside a directory named
# from the dm. Hopefully this change will not have negative results.
$working = $id;
$working =~ s/\.\S+$//;
# note: there's always been an issue with duplicated dm's in inxi, this should now correct it
if ( ( -f "/run/$id" || -d "/run/$working" || -f "/var/run/$id" ) && ! grep {/$working/} @found ){
if ($extra > 2 && awk( \@dms_version, $working) ){
@data = main::grabber("$working --version 2>&1");
# note: there were issues with duplicated dm's in inxi, checking @found corrects it
if ( ( ( $b_run && ( -f "/run/$id" || -d "/run/$working" ) ) ||
( $b_vrun && ( -f "/var/run/$id" || -d "/var/run/$working" ) ) ||
( $b_vrunrc && ( -f "/var/run/rc.d/$working" || -d "/var/run/rc.d/$id" ) ) ) &&
! grep {/$working/} @found ){
if ($extra > 2 && awk( \@dms_version, $working) && (my $path = main::check_program($working)) ){
@data = main::grabber("$path --version 2>&1");
$temp = awk(\@data,'\S',2,'\s+');
$working .= ' ' . $temp if $temp;
}
@ -15706,7 +15809,7 @@ sub get_uptime {
$uptime = trimmer($uptime);
#$uptime = '05:36:47 up 3 min, 4 users, load average: 1,88, 0,98, 0,62';
if ($uptime &&
$uptime =~ /[\S]+\s+up\s+(([0-9]+)\s+day[s]?,\s+)?(([0-9]{1,2}):([0-9]{1,2})|([0-9]+)\smin),\s+[0-9]+\s+user/){
$uptime =~ /[\S]+\s+up\s+(([0-9]+)\s+day[s]?,\s+)?(([0-9]{1,2}):([0-9]{1,2})|([0-9]+)\smin[s]?),\s+[0-9]+\s+user/){
$days = $2 . 'd' if $2;
$days .= ' ' if ($days && ($4 || $6));
if ($4 && $5){
@ -16136,6 +16239,8 @@ sub set_lspci_data {
my $path = check_program('lspci');
$content = qx($path -nnv 2>/dev/null) if $path;
@pcis = split /\n/, $content if $content;
#my $file = "$ENV{HOME}/bin/scripts/inxi/data/lspci/racermach-1-knnv.txt";
#@pcis = reader($file);
#print scalar @pcis;
@pcis = map {$_ =~ s/^\s+//; $_} @pcis if @pcis;
foreach (@pcis){

26
inxi.1
View file

@ -1,4 +1,4 @@
.TH INXI 1 "2018\-05\-11" inxi "inxi manual"
.TH INXI 1 "2018\-05\-21" inxi "inxi manual"
.SH NAME
inxi \- Command line system information script for console and IRC
.SH SYNOPSIS
@ -10,6 +10,7 @@ inxi \- Command line system information script for console and IRC
[\fBNUMBER\fR]] [\fB\-v NUMBER\fR] [\fB\-W LOCATION\fR]
[\fB\-\-weather\-unit\fR {\fBc\fR|\fBf\fR|\fBcf\fR|\fBfc\fR}] [\fB\-y WIDTH\fR]
\fBinxi\fR [\fB\-\-recommends\fR] \fR[\fB\-\-slots\fR] \fR[\fB\-\-usb\fR]
\fBinxi\fB \-x\fR|\fB\-xx\fR|\fB\-xxx\fR \fB\-OPTION(s) \fR
@ -429,8 +430,8 @@ Examples: \fB\-W 95623\fR OR \fB\-W Boston,MA\fR OR \fB\-W45.5234,\-122.6762\fR
OR \fB\-W new+york,ny\fR OR \fB\-W bodo,norway\fR.
.TP
.B \-\-weather\-unit <unit>\fR
[\fBc\fR|\fBf\fR|\fBcf\fR|\fBfc\fR] Sets weather units to metric (\fBc\fR), imperial (\fBf\fR),
metric (imperial) (\fBcf\fR), imperial (metric) (\fBfc\fR). If metric or imperial not found,
[\fBc\fR|\fBf\fR|\fBcf\fR|\fBfc\fR] Sets weather units to metric (\fBm\fR), imperial (\fBi\fR),
metric (imperial) (\fBmi\fR), imperial (metric) (\fBim\fR). If metric or imperial not found,
sets to default values, or \fBN/A\fR.
.TP
.B \-y\fR,\fB \-\-width <integer>\fR
@ -496,7 +497,6 @@ dds rev version to optical drive.
or if you have added to \fB/etc/sudoers\fR (sudo v. 1.7 or newer):
.B <username> ALL = NOPASSWD: /usr/sbin/hddtemp (sample)
.TP
.B \-x \-G\fR
\- Adds direct rendering status.
@ -596,6 +596,24 @@ data (if available) as the voltage now / minimum design voltage.
.B \-xx \-D\fR
\- Adds disk serial number.
.TP
.B \-xx \-D\fR
\- Adds disk speed (if available). This is the theoretical top speed of the
device as reported. This speed may be restricted by system board limits, eg.
a SATA 3 drive on a SATA 2 board may report SATA 2 speeds, but this is not
completely consistent, sometimes a SATA 3 device on a SATA 2 board reports
its design speed.
NVMe drives: adds lanes, and (per direction) speed is calculated with
lane speed * lanes * PCIe overhead. PCIe 1 and 2 have data rates of
GT/s * .8 = Gb/s (10 bits required to transfer 8 bits of data).
PCIe 3 and greater transfer data at a rate of GT/s * 128/130 * lanes = Gb/s
(130 bits required to transfer 128 bits of data).
For a PCIe 3 NVMe drive, with speed of \fB8 GT/s\fR and \fB4\fR lanes
(\fB8GT/s * 128/130 * 4 = 31.6 Gb/s\fR):
\fBspeed: 31.6 Gb/s lanes: 4\fR
.TP
.B \-xx \-G\fR
\- Adds vendor:product ID of each Graphics card.
.TP

View file

@ -1,3 +1,75 @@
=====================================================================================
Version: 3.0.10
Patch Version: 00
Script Date: 2018-05-21
-----------------------------------
Changes:
-----------------------------------
New version, new tarball.
This version is very peaceful, no big changes, just a few fixes and small new
features added.
This version corrects a few small glitches reported by users, and adds basic support
for disk speed report. Note that this is not as accurate as I'd like, it tries, but
there is not a lot of data to be had. Limits of disk speed seems to be, roughly:
1. most speed is reported as max board can do, not max drive can support
2. usually when speed is reported as lower than max board speed, it's correct, but,
as usual, exceptions to this were found during testing.
3. usually if drive is faster than board speed, it reports board speed, but, again,
exceptions to this rule were found during testing.
However, with this said, it's usually more or less right, at least right in terms
of the fastest speed you can expect to get with your board. NVMe was also supported,
that's much more complicated because NVMe has >= 1 lane, and each lane has up and
down data. The reported speed is max in one direction, and is a function of the
PCIe 1,2 20% overhead, and PCIe 3,4,5 ~1.5% overhead. inxi shows the actual usable
data rate, not the GT/s rate, which is the total transfers per second the unit
supports.
So due to the unreliable nature of the data, this is only a -xx option. There is
also in general no data for USB, and none for mmcblk (sd cards usually).
This feature may be enhanced with a C Perl XS library in the future, we'll see how
that goes.
FIXES:
1. corrected an issue where a networking card of type Bridge failed to be detected.
This is now handled. This was a PCI type I'd never seen before, but it exists, and
a user had it, so now it will work as expected for this type.
2. changed the default units in weather to be m (metric) imperial (i). While this is
not very intuitive for me, it's easier to explain I think. The previous c / f
syntax is supported internally, and inxi will just translate c to m and f to i, so
it doesn't matter which is or was used on a config file or with the --weather-unit
option.
3. BSD uptime had a parsing glitch, there was a spelling variant I'd never seen in
GNU/Linux that broke the regex. This is corrected now.
4. Fixed a few small man page glitches, some ordering stuff, nothing major.
5. Fixed BSD hostname issues. There was a case where a setup could have no hostname,
inxi did not handle that correctly. This fix would have applied to gnu/linux as
well.
6. Fixed a few bsd, openbsd mostly, dm detections, there is a secondary path in
OpenBSD that was not checked. This also went along with refactoring the dm logic
to be much more efficient and optimized.
7. Fine tuned dmidecode error message.
8. Fixed PCI ID issue, it was failing to catch a certain bridged network type.
9. A more global fix for unhandled tmpfs types, in this case, shm, but added a
global test that will handle all tmpfs from now on, and exclude that data from
-p reports.
NEW FEATURES:
1. First attempt to add basic disk speed (Gb/s). Supported types: ATA, NVMe. No
speed data so far handled or found: mmcblk; USB. Also possibly older /dev/hda
type devices (IDE bus) may not get handled in all cases. This may get more work
in the future, but that's a long ways off. This case oddly was one where BSDs had
support for basic disk speed reports before GNU/Linux, but that was really just
because it was part of a single data line that inxi parsed for disk data anyway
with BSDs.
2. Man items added for -Dxx disk speed options.
-----------------------------------
-- Harald Hope - Mon, 21 May 2018 14:25:53 -0700
=====================================================================================
Version: 3.0.09
Patch Version: 00