From 7d4117137fb8f1e59738497c9eb620b429087ced Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Mon, 15 Jun 2020 19:30:12 -0400 Subject: New upstream version 3.1.03-1. --- inxi | 1311 +++++++++++++++++++++++++++++--------------------------- inxi.1 | 16 +- inxi.changelog | 321 ++++++++++++++ 3 files changed, 999 insertions(+), 649 deletions(-) diff --git a/inxi b/inxi index c55f13f..d6be770 100755 --- a/inxi +++ b/inxi @@ -32,8 +32,8 @@ use POSIX qw(uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='3.1.01'; -my $self_date='2020-05-31'; +my $self_version='3.1.03'; +my $self_date='2020-06-12'; my $self_patch='00'; ## END INXI INFO ## @@ -332,11 +332,11 @@ sub check_tools { # sudo will just error out which is the safest course here for now, # otherwise that interactive sudo password thing is too annoying # important: -n makes it non interactive, no prompt for password - if (!$b_root && $b_sudo && (my $path = main::check_program('sudo') )) { + if (!$b_root && $b_sudo && !$b_no_sudo && (my $path = main::check_program('sudo') )) { my @data = program_values('sudo'); my $version = program_version($path,$data[0],$data[1],$data[2],$data[5]); $version =~ s/^([0-9]+\.[0-9]+).*/$1/; - $sudo = "$path -n " if !$b_no_sudo && is_numeric($version) && $version >= 1.7; + $sudo = "$path -n " if is_numeric($version) && $version >= 1.7; } set_fake_tools() if $b_fake_bsd; } @@ -4212,7 +4212,7 @@ sub get_options{ elsif (!$arg){ $arg = 80; } - if ( $arg =~ /\d/ && $arg >= 80 ){ + if ( $arg =~ /\d/ && ($arg == 1 || $arg >= 80) ){ set_display_width($arg); } else { @@ -4789,7 +4789,6 @@ sub show_options { CPU voltage, external clock speed (if root and dmidecode installed)." ], ['2', '-D', '', "Firmware rev. if available; partition scheme, in some cases; disk rotation speed (if detected)." ], - ['2', '-G', '', "Xorg Compositor version (if detectable)." ], ['2', '-I', '', "For 'Shell:' adds ([su|sudo|login]) to shell name if present; for 'running in:' adds (SSH) if SSH session." ], ['2', '-J', '', "For Device: serial number (if present), interface count; USB speed." ], @@ -4812,7 +4811,8 @@ sub show_options { } @rows = ( ['1', '-y', '--width', "Output line width max (integer >= 80). Overrides IRC/Terminal - settings or actual widths. If no integer give, defaults to 80. Example:^inxi^-y^130" ], + settings or actual widths. If no integer give, defaults to 80. -1 removes line lengths. + 1 switches output to 1 key/value pair per line. Example:^inxi^-y^130" ], ['1', '-z', '--filter', "Adds security filters for IP/MAC addresses, serial numbers, location (-w), user home directory name, host item. Default on for IRC clients." ], ['1', '', '--filter-label', "Filters out ${partition_string} labels in -j, @@ -4940,6 +4940,7 @@ sub show_options { print_basic(@data); exit 0; # shell true } + sub show_version { require Cwd; import Cwd; @@ -4952,6 +4953,7 @@ sub show_version { elsif ( $working_path !~ /^\// ){ $working_path = getcwd() . "/$working_path"; } + $working_path =~ s%/$%%; # handle if it's a symbolic link, rare, but can happen with directories # in irc clients which would only matter if user starts inxi with -! 30 override # in irc client @@ -4962,33 +4964,31 @@ sub show_version { } # strange output /./ ending, but just trim it off, I don't know how it happens $working_path =~ s%/\./%/%; - @row = ([ 0, '', '', "$self_name $self_version-$self_patch ($self_date)"],); + @row = ( + [ 0, '', '', "$self_name $self_version-$self_patch ($self_date)"], + ); push @data, @row; if ( ! $b_irc ){ - @row = ([ 0, '', '', ""],); + @row = ([ 0, '', '', ''],); push @data, @row; my $year = (split/-/, $self_date)[0]; - @row = [ 0, '', '', "Program Location: $working_path" ]; + @row = ( + [ 0, '', '', "Copyright^(C)^2008-$year^Harald^Hope^aka^h2"], + [ 0, '', '', "Forked from Infobash 3.02: Copyright^(C)^2005-2007^Michiel^de^Boer^aka^locsmif." ], + [ 0, '', '', "Using Perl version: $]"], + [ 0, '', '', "Program Location: $working_path" ], + ); push @data, @row; if ( $link ){ @row = [ 0, '', '', "Started via symbolic link: $link" ]; push @data, @row; } @rows = ( + [ 0, '', '', '' ], [ 0, '', '', "Website:^https://github.com/smxi/inxi^or^https://smxi.org/" ], [ 0, '', '', "IRC:^irc.oftc.net channel:^#smxi" ], [ 0, '', '', "Forums:^https://techpatterns.com/forums/forum-33.html" ], - [ 0, '', '', " " ], - [ 0, '', '', "$self_name - the universal, portable, system information tool - for console and irc." ], - [ 0, '', '', "Using Perl version: $]"], - [ 0, '', '', " " ], - [ 0, '', '', "This program started life as a fork of Infobash 3.02: - Copyright^(C)^2005-2007^Michiel^de^Boer^aka^locsmif." ], - [ 0, '', '', "Subsequent changes and modifications (after Infobash 3.02): - Copyright^(C)^2008-$year^Harald^Hope^aka^h2. - CPU/Konversation^fixes:^Scott^Rogers^aka^trash80. - USB^audio^fixes:^Steven^Barrett^aka^damentz." ], + [ 0, '', '', '' ], [ 0, '', '', "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -5615,7 +5615,7 @@ sub row_defaults { 'root-suggested' => "try sudo/root", 'sensors-data-ipmi' => "No ipmi sensors data was found.", 'sensors-data-linux' => "No sensors data was found. Is sensors configured?", - 'sensors-ipmi-root' => "Unable to run ipmi sensors. Root privileges required.", + 'sensors-ipmi-root' => "Unable to run ipmi sensors. Root privileges required.", 'smartctl-command-failed' => "A mandatory SMART command failed. Various possible causes.", 'smartctl-root' => "Unable to run smartctl. Root privileges required.", 'smartctl-udma-crc' => "Bad cable/connection?", @@ -5766,7 +5766,7 @@ sub generate_xml { } sub key { - return sprintf("%03d#%s", $_[0],$_[1]); + return sprintf("%03d#%s#%s#%s", $_[0],$_[1],$_[2],$_[3]); } sub print_basic { @@ -5857,31 +5857,41 @@ sub print_basic { # hash key to force sorts. sub print_data { my (%data) = @_; - my $array = 0; - my $array_holder = 1; - my $counter=0; - my $split_count = 0; - my $hash = 0; - my $holder = ''; - my $id_holder = 0; - my $screen_holder = 0; - my $start = ''; - my $start2 = ''; - my $length = 0; + my ($array,$counter,$hash,$length,$split_count) = (0,0,0,0,0); + my ($hash_id,$holder,$start,$start2,$start_holder) = ('','','','',''); my $indent = $size{'indent'}; - my (@temp,@working,@values,%ids,$holder2,%row); - my ($key,$line,$val2,$val3); + my (@temp,@working,@values,%row); + my ($holder2,$key,$key_raw,$line,$val2,$val3); + # these 2 sets are single logic items + my $b_single = ($size{'max'} == 1) ? 1: 0; + my ($b_container,$indent_use,$indentx) = (0,0,0); # $size{'max'} = 88; # NOTE: indent < 11 would break the output badly in some cases if ($size{'max'} < $size{'indent-min'} || $size{'indent'} < 11 ){ $indent = 2; } + # Line starters that will be -x incremented always + my %ids = ( + 'Array' => 1, # RAM or RAID + 'Battery' => 1, + 'Card' => 1, + 'Device' => 1, + 'Floppy' => 1, + 'Hardware' => 1, # hardware raid report + 'ID' => 1, + 'IF-ID' => 1, + 'Monitor' => 1, + 'Optical' => 1, + 'Screen' => 1, + 'variant' => 1, # arm > 1 cpu type + ); #foreach my $key1 (sort { (split/#/, $a)[0] <=> (split/#/, $b)[0] } keys %data) { foreach my $key1 (sort { substr($a,0,3) <=> substr($b,0,3) } keys %data) { #foreach my $key1 (sort { $a cmp $b } keys %data) { - $key = (split/#/, $key1)[1]; + $key = (split/#/, $key1)[3]; if ($key ne 'SHORT' ) { $start = sprintf("$colors{'c1'}%-${indent}s$colors{'cn'}","$key$sep{'s1'}"); + $start_holder = $key; if ($indent < 10){ $line = "$start\n"; print_line($line); @@ -5894,47 +5904,29 @@ sub print_data { } if (ref($data{$key1}) eq 'ARRAY'){ # @working = @{$data{$key1}}; - %ids = ( - 'Array' => 1, - 'array' => 1, - 'Battery' => 1, - 'Card' => 1, - 'Device' => 1, - 'Floppy' => 1, - 'Hardware' => 1, # hardware raid report - 'ID' => 1, - 'IF-ID' => 1, - 'Monitor' => 1, - 'Optical' => 1, - 'Screen' => 1, - 'variant' => 1, # arm > 1 cpu type - ); - $array_holder = 1; + for (keys %ids){$ids{$_} = 1} foreach my $val1 (@{$data{$key1}}){ - $length = $indent; + $indent_use = $length = $indent; if (ref($val1) eq 'HASH'){ #%row = %$val1; - $counter=0; - $split_count = 0; + ($counter,$split_count) = (0,0); $hash = scalar %$val1; #foreach my $key2 (sort { (split/#/, $a)[0] <=> (split/#/, $b)[0] } keys %$val1){ foreach my $key2 (sort { substr($a,0,3) <=> substr($b,0,3) } keys %$val1){ #foreach my $key2 (sort { $a cmp $b } keys %$val1){ - $key = (split/#/, $key2)[1]; - # for ram with > 1 system array, we want to reset device count to 1 for each - # new array - if ($key eq 'Array' && $array_holder != $ids{$key} ){ - $array_holder = $ids{$key}; - $ids{'Device'} = 1 if ($ids{'Device'} > 1); + ($hash_id,$b_container,$indentx,$key) = (split/#/, $key2); + $key_raw = $key; + if ($start_holder eq 'Graphics' && $key_raw eq 'Screen'){ + $ids{'Monitor'} = 1; } - if ($key eq 'Device' && $ids{'array'} > 1 && $id_holder != $ids{$key} ){ - $id_holder = $ids{$key}; - $ids{'array'} = 1 if ($ids{'array'} > 1); + elsif ($start_holder eq 'Memory' && $key_raw eq 'Array'){ + $ids{'Device'} = 1; } - # new Screen - if ($key eq 'Screen' && $screen_holder != $ids{$key} ){ - $screen_holder = $ids{$key}; - $ids{'Monitor'} = 1 if ($ids{'Monitor'} > 1); + elsif ($start_holder eq 'RAID' && $key_raw eq 'Device'){ + $ids{'Array'} = 1; + } + elsif ($start_holder eq 'USB' && $key_raw eq 'Hub'){ + $ids{'Device'} = 1; } if ($counter == 0 && defined $ids{$key}){ $key .= '-' . $ids{$key}++; @@ -5948,16 +5940,17 @@ sub print_data { # in Perl 5.08 oddly enough. @temp = split/\s+/, $val2; $split_count = scalar @temp; - if ( ( length( "$key$sep{'s2'} $val2" ) + $length ) < $size{'max'} ) { + if ( !$b_single && ( length( "$key$sep{'s2'} $val2" ) + $length ) < $size{'max'} ) { + #print "one\n"; $length += length("$key$sep{'s2'} $val2"); $holder .= "$colors{'c1'}$key$sep{'s2'}$colors{'c2'} $val2"; - #print "one\n"; } # handle case where the opening key/value pair is > max, and where # there are a lot of terms, like cpu flags, raid types supported. Raid # can have the last row have a lot of devices, or many raid types - elsif ( ( length( "$key$sep{'s2'} $val2" ) + $indent ) > $size{'max'} && + elsif ( !$b_single && ( length( "$key$sep{'s2'} $val2" ) + $indent ) > $size{'max'} && !defined $ids{$key} && $split_count > 2 ) { + #print "two\n"; @values = split/\s+/, $val2; $val3 = shift @values; # $length += length("$key$sep{'s2'} $val3 ") + $indent; @@ -5969,6 +5962,7 @@ sub print_data { # my $l = (length("$_ ") + $length); #print "$l\n"; if ( (length("$_ ") + $length) < $size{'max'} ){ + #print "three.1\n"; #print "a\n"; if ($start2){ $holder2 .= "$start2$_ "; @@ -5982,7 +5976,7 @@ sub print_data { $length += length("$_ "); } else { - #print "three\n"; + #print "three.2\n"; if ($start2){ $holder2 = "$start2$holder2"; } @@ -6015,29 +6009,29 @@ sub print_data { #$length2 = 0; } } + # NOTE: only these and the last fallback are used for b_single output else { - #print "H: $counter $hash\n"; + #print "H: $counter $hash $indent3 $indent2\n"; if ($holder){ #print "five\n"; - $line = sprintf("%-${indent}s%s$colors{'cn'}\n",$start,"$holder"); - $holder = "$colors{'c1'}$key$sep{'s2'}$colors{'c2'} $val2"; - $length = length("$key$sep{'s2'} $val2") + $indent; + $line = sprintf("%-${indent_use}s%s$colors{'cn'}\n",$start,"$holder"); + $length = length("$key$sep{'s2'} $val2") + $indent_use; print_line($line); $start = ''; } else { #print "six\n"; - $holder = "$colors{'c1'}$key$sep{'s2'}$colors{'c2'} $val2"; - #$line = sprintf("%-${indent}s%s$colors{'cn'}\n",$start,"$holder"); - $length = $indent; + $length = $indent_use; #$holder = ''; } + $holder = "$colors{'c1'}$key$sep{'s2'}$colors{'c2'} $val2"; } $counter++; + $indent_use = ($indent * $indentx) if $b_single; } if ($holder !~ /^\s*$/){ #print "seven\n"; - $line = sprintf("%-${indent}s%s$colors{'cn'}\n",$start,"$start2$holder"); + $line = sprintf("%-${indent_use}s%s$colors{'cn'}\n",$start,"$start2$holder"); print_line($line); $holder = ''; $length = 0; @@ -6050,15 +6044,15 @@ sub print_data { $array=0; foreach my $item (@$val1){ $array++; + $indent_use = ($b_single) ? $indent + 2: $indent; $line = "$colors{'c1'}$array$sep{'s2'} $colors{'c2'}$item$colors{'cn'}"; - $line = sprintf("%-${indent}s%s\n","","$line"); + $line = sprintf("%-${indent_use}s%s\n","","$line"); print_line($line); } } - else { - - } } + # we want a space between data blocks for single + print_line("\n") if $b_single; } } } @@ -6106,7 +6100,7 @@ sub get { my $type = ($b_arm) ? 'arm' : 'mips'; my $key = 'Message'; @data = ({ - main::key($num++,$key) => main::row_defaults($type . '-pci',''), + main::key($num++,0,1,$key) => main::row_defaults($type . '-pci',''), },); @rows = (@rows,@data); } @@ -6128,7 +6122,7 @@ sub get { $type = 'pci-card-data-root'; } @data = ({ - main::key($num++,$key) => main::row_defaults($type,''), + main::key($num++,0,1,$key) => main::row_defaults($type,''), },); @rows = (@rows,@data); } @@ -6155,22 +6149,22 @@ sub card_data { $card = main::pci_long_filter($card); } @data = ({ - main::key($num++,'Device') => $card, + main::key($num++,1,1,'Device') => $card, },); @rows = (@rows,@data); if ($extra > 0 && $b_pci_tool && $row[12]){ my $item = main::get_pci_vendor($row[4],$row[12]); - $rows[$j]{main::key($num++,'vendor')} = $item if $item; + $rows[$j]{main::key($num++,0,2,'vendor')} = $item if $item; } - $rows[$j]{main::key($num++,'driver')} = $driver; + $rows[$j]{main::key($num++,1,2,'driver')} = $driver; if ($extra > 0 && !$bsd_type){ if ($row[9] ){ my $version = main::get_module_version($row[9]); - $rows[$j]{main::key($num++,'v')} = $version if $version; + $rows[$j]{main::key($num++,0,3,'v')} = $version if $version; } } if ($extra > 0){ - $rows[$j]{main::key($num++,'bus ID')} = (!$row[2] && !$row[3]) ? 'N/A' : "$row[2].$row[3]"; + $rows[$j]{main::key($num++,0,2,'bus ID')} = (!$row[2] && !$row[3]) ? 'N/A' : "$row[2].$row[3]"; } if ($extra > 1){ my $chip_id = 'N/A'; @@ -6180,7 +6174,7 @@ sub card_data { elsif ($row[6]){ $chip_id = $row[6]; } - $rows[$j]{main::key($num++,'chip ID')} = $chip_id; + $rows[$j]{main::key($num++,0,2,'chip ID')} = $chip_id; } #print "$row[0]\n"; } @@ -6212,14 +6206,14 @@ sub asound_data { $j = scalar @rows; $driver ||= 'N/A'; @data = ({ - main::key($num++,'Device') => $card, - main::key($num++,'driver') => $driver, + main::key($num++,1,1,'Device') => $card, + main::key($num++,1,2,'driver') => $driver, },); @rows = (@rows,@data); if ($extra > 0){ my $version = main::get_module_version($driver); - $rows[$j]{main::key($num++,'v')} = $version if $version; - $rows[$j]{main::key($num++,'message')} = main::row_defaults('pci-advanced-data',''); + $rows[$j]{main::key($num++,0,3,'v')} = $version if $version; + $rows[$j]{main::key($num++,0,2,'message')} = main::row_defaults('pci-advanced-data',''); } } } @@ -6263,20 +6257,20 @@ sub usb_data { $product ||= 'N/A'; $driver ||= 'snd-usb-audio'; @data = ({ - main::key($num++,'Device') => $product, - main::key($num++,'type') => 'USB', - main::key($num++,'driver') => $driver, + main::key($num++,1,1,'Device') => $product, + main::key($num++,0,2,'type') => 'USB', + main::key($num++,0,2,'driver') => $driver, },); @rows = (@rows,@data); if ($extra > 0){ - $rows[$j]{main::key($num++,'bus ID')} = "$path_id:$row[1]"; + $rows[$j]{main::key($num++,0,2,'bus ID')} = "$path_id:$row[1]"; } if ($extra > 1){ $row[7] ||= 'N/A'; - $rows[$j]{main::key($num++,'chip ID')} = $row[7]; + $rows[$j]{main::key($num++,0,2,'chip ID')} = $row[7]; } if ($extra > 2 && $row[16]){ - $rows[$j]{main::key($num++,'serial')} = main::apply_filter($row[16]); + $rows[$j]{main::key($num++,0,2,'serial')} = main::apply_filter($row[16]); } } } @@ -6310,8 +6304,8 @@ sub sound_server_data { } if ($server){ @data = ({ - main::key($num++,'Sound Server') => $server, - main::key($num++,'v') => $version, + main::key($num++,1,1,'Sound Server') => $server, + main::key($num++,0,2,'v') => $version, },); } eval $end if $b_log; @@ -6333,7 +6327,7 @@ sub get { $key1 = $$ref{'action'}; $val1 = $$ref{$key1}; $key1 = ucfirst($key1); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } else { %battery = battery_data_dmi(); @@ -6341,7 +6335,7 @@ sub get { if ($show{'battery-forced'}){ $key1 = 'Message'; $val1 = main::row_defaults('battery-data',''); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } } else { @@ -6355,7 +6349,7 @@ sub get { if ($show{'battery-forced'}){ $key1 = 'Message'; $val1 = main::row_defaults('battery-data',''); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } } else { @@ -6366,7 +6360,7 @@ sub get { if ($show{'battery-forced'}){ $key1 = 'Message'; $val1 = main::row_defaults('battery-data-sys',''); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } } (@upower_items,$b_upower,$upower) = undef; @@ -6429,9 +6423,9 @@ sub create_output { $condition ||= 'N/A'; $j = scalar @rows; @data = ({ - main::key($num++,'ID') => $key, - main::key($num++,'charge') => $charge, - main::key($num++,'condition') => $condition, + main::key($num++,1,1,'ID') => $key, + main::key($num++,0,2,'charge') => $charge, + main::key($num++,0,2,'condition') => $condition, },); @rows = (@rows,@data); if ($extra > 0){ @@ -6442,7 +6436,7 @@ sub create_output { $volts = "$battery{$key}{'voltage_now'}/$battery{$key}{'voltage_min_design'}"; } $volts ||= 'N/A'; - $rows[$j]{main::key($num++,'volts')} = $volts; + $rows[$j]{main::key($num++,0,2,'volts')} = $volts; } if ($battery{$key}{'manufacturer'} || $battery{$key}{'model_name'}) { if ($battery{$key}{'manufacturer'} && $battery{$key}{'model_name'}){ @@ -6458,23 +6452,23 @@ sub create_output { else { $model = 'N/A'; } - $rows[$j]{main::key($num++,'model')} = $model; + $rows[$j]{main::key($num++,0,2,'model')} = $model; if ($extra > 2){ $chemistry = ( $battery{$key}{'technology'} ) ? $battery{$key}{'technology'}: 'N/A'; - $rows[$j]{main::key($num++,'type')} = $chemistry; + $rows[$j]{main::key($num++,0,2,'type')} = $chemistry; } if ($extra > 1){ $serial = main::apply_filter($battery{$key}{'serial_number'}); - $rows[$j]{main::key($num++,'serial')} = $serial; + $rows[$j]{main::key($num++,0,2,'serial')} = $serial; } $status = ($battery{$key}{'status'}) ? $battery{$key}{'status'}: 'N/A'; - $rows[$j]{main::key($num++,'status')} = $status; + $rows[$j]{main::key($num++,0,2,'status')} = $status; if ($extra > 2){ if ($battery{$key}{'cycle_count'}){ - $rows[$j]{main::key($num++,'cycles')} = $battery{$key}{'cycle_count'}; + $rows[$j]{main::key($num++,0,2,'cycles')} = $battery{$key}{'cycle_count'}; } if ($battery{$key}{'location'}){ - $rows[$j]{main::key($num++,'location')} = $battery{$key}{'location'}; + $rows[$j]{main::key($num++,0,2,'location')} = $battery{$key}{'location'}; } } } @@ -6515,19 +6509,19 @@ sub create_output { $model = 'N/A'; } @data = ({ - main::key($num++,'Device') => $key, - main::key($num++,'model') => $model, + main::key($num++,1,1,'Device') => $key, + main::key($num++,0,2,'model') => $model, },); @rows = (@rows,@data); if ($extra > 1){ $serial = main::apply_filter($battery{$key}{'serial_number'}); - $rows[$j]{main::key($num++,'serial')} = $serial; + $rows[$j]{main::key($num++,0,2,'serial')} = $serial; } - $rows[$j]{main::key($num++,'charge')} = $charge; + $rows[$j]{main::key($num++,0,2,'charge')} = $charge; if ($extra > 2 && $upower_data{'rechargeable'}){ - $rows[$j]{main::key($num++,'rechargeable')} = $upower_data{'rechargeable'}; + $rows[$j]{main::key($num++,0,2,'rechargeable')} = $upower_data{'rechargeable'}; } - $rows[$j]{main::key($num++,'status')} = $status; + $rows[$j]{main::key($num++,0,2,'status')} = $status; } } eval $end if $b_log; @@ -6783,7 +6777,7 @@ sub create_output_full { else { $key1 = ucfirst($alerts{'sysctl'}{'action'}); $val1 = $alerts{'sysctl'}{$alerts{'sysctl'}{'action'}}; - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); return @data; } } @@ -6796,8 +6790,8 @@ sub create_output_full { my $j = scalar @rows; $cpu{'model_name'} ||= 'N/A'; @data = ({ - main::key($num++,'Topology') => $properties{'cpu-layout'}, - main::key($num++,'model') => $cpu{'model_name'}, + main::key($num++,1,1,'Topology') => $properties{'cpu-layout'}, + main::key($num++,0,2,'model') => $cpu{'model_name'}, },); @rows = (@rows,@data); if ($cpu{'system-cpus'}){ @@ -6807,46 +6801,46 @@ sub create_output_full { my $counter = ( %system_cpus && scalar keys %system_cpus > 1 ) ? '-' : ''; foreach my $key (keys %system_cpus){ $counter = '-' . $i++ if $counter; - $rows[$j]{main::key($num++,'variant'.$counter)} = $key; + $rows[$j]{main::key($num++,0,2,'variant'.$counter)} = $key; } } if ($b_admin && $properties{'socket'}){ if ($properties{'upgrade'}){ - $rows[$j]{main::key($num++,'socket')} = $properties{'socket'} . ' (' . $properties{'upgrade'} . ')'; - $rows[$j]{main::key($num++,'note')} = 'check'; + $rows[$j]{main::key($num++,1,2,'socket')} = $properties{'socket'} . ' (' . $properties{'upgrade'} . ')'; + $rows[$j]{main::key($num++,0,3,'note')} = 'check'; } else { - $rows[$j]{main::key($num++,'socket')} = $properties{'socket'}; + $rows[$j]{main::key($num++,0,2,'socket')} = $properties{'socket'}; } } $properties{'bits-sys'} ||= 'N/A'; - $rows[$j]{main::key($num++,'bits')} = $properties{'bits-sys'}; + $rows[$j]{main::key($num++,0,2,'bits')} = $properties{'bits-sys'}; if ($type){ - $rows[$j]{main::key($num++,'type')} = $type; + $rows[$j]{main::key($num++,0,2,'type')} = $type; } if ($extra > 0){ $cpu{'arch'} ||= 'N/A'; - $rows[$j]{main::key($num++,'arch')} = $cpu{'arch'}; + $rows[$j]{main::key($num++,0,2,'arch')} = $cpu{'arch'}; if ( !$b_admin && $cpu{'arch'} ne 'N/A' && $cpu{'rev'} ){ - $rows[$j]{main::key($num++,'rev')} = $cpu{'rev'}; + $rows[$j]{main::key($num++,0,2,'rev')} = $cpu{'rev'}; } } if ($b_admin){ - $rows[$j]{main::key($num++,'family')} = hex_and_decimal($cpu{'family'}); - $rows[$j]{main::key($num++,'model-id')} = hex_and_decimal($cpu{'model_id'}); - $rows[$j]{main::key($num++,'stepping')} = hex_and_decimal($cpu{'rev'}); + $rows[$j]{main::key($num++,0,2,'family')} = hex_and_decimal($cpu{'family'}); + $rows[$j]{main::key($num++,0,2,'model-id')} = hex_and_decimal($cpu{'model_id'}); + $rows[$j]{main::key($num++,0,2,'stepping')} = hex_and_decimal($cpu{'rev'}); $cpu{'microcode'} ||= 'N/A'; - $rows[$j]{main::key($num++,'microcode')} = $cpu{'microcode'}; + $rows[$j]{main::key($num++,0,2,'microcode')} = $cpu{'microcode'}; } if ($extra > 1 && $properties{'l1-cache'}){ - $rows[$j]{main::key($num++,'L1 cache')} = $properties{'l1-cache'}; + $rows[$j]{main::key($num++,0,2,'L1 cache')} = $properties{'l1-cache'}; } $properties{'l2-cache'} ||= 'N/A'; if (!$b_arm || ($b_arm && $properties{'l2-cache'} ne 'N/A')){ - $rows[$j]{main::key($num++,'L2 cache')} = $properties{'l2-cache'}; + $rows[$j]{main::key($num++,0,2,'L2 cache')} = $properties{'l2-cache'}; } if ($extra > 1 && $properties{'l3-cache'}){ - $rows[$j]{main::key($num++,'L3 cache')} = $properties{'l3-cache'}; + $rows[$j]{main::key($num++,0,2,'L3 cache')} = $properties{'l3-cache'}; } if ($extra > 0 && !$show{'cpu-flag'}){ @@ -6865,14 +6859,14 @@ sub create_output_full { $flag = main::row_defaults('arm-cpu-f'); } @data = ({ - main::key($num++,$flag_key) => $flag, + main::key($num++,0,2,$flag_key) => $flag, },); @rows = (@rows,@data); $b_flags = 1; } if ($extra > 0 && !$bsd_type){ my $bogomips = (main::is_numeric($cpu{'bogomips'})) ? int($cpu{'bogomips'}) : 'N/A'; - $rows[$j]{main::key($num++,'bogomips')} = $bogomips; + $rows[$j]{main::key($num++,0,2,'bogomips')} = $bogomips; } $j = scalar @rows; my $core_key = (scalar @speeds > 1) ? 'Core speeds (MHz)' : 'Core speed (MHz)'; @@ -6895,29 +6889,29 @@ sub create_output_full { } $j = scalar @rows; @data = ({ - main::key($num++,$speed_key) => $speed, - main::key($num++,$min_max_key) => $min_max, + main::key($num++,1,1,$speed_key) => $speed, + main::key($num++,0,2,$min_max_key) => $min_max, }); @rows = (@rows,@data); if ($b_admin && $properties{'dmi-speed'} && $properties{'dmi-max-speed'}){ - $rows[$j]{main::key($num++,'base/boost')} = $properties{'dmi-speed'} . '/' . $properties{'dmi-max-speed'}; + $rows[$j]{main::key($num++,0,2,'base/boost')} = $properties{'dmi-speed'} . '/' . $properties{'dmi-max-speed'}; } if ($extra > 2){ my $boost = get_boost_status(); - $rows[$j]{main::key($num++,'boost')} = $boost if $boost; + $rows[$j]{main::key($num++,0,2,'boost')} = $boost if $boost; if ($properties{'volts'}){ - $rows[$j]{main::key($num++,'volts')} = $properties{'volts'} . ' V'; + $rows[$j]{main::key($num++,0,2,'volts')} = $properties{'volts'} . ' V'; } if ($properties{'ext-clock'}){ - $rows[$j]{main::key($num++,'ext-clock')} = $properties{'ext-clock'}; + $rows[$j]{main::key($num++,0,2,'ext-clock')} = $properties{'ext-clock'}; } } - $rows[$j]{main::key($num++,$core_key)} = $core_speeds_value; + $rows[$j]{main::key($num++,1,2,$core_key)} = $core_speeds_value; my $i = 1; # if say 96 0 speed cores, no need to print all those 0s if ($b_speeds){ foreach (@speeds){ - $rows[$j]{main::key($num++,$i++)} = $_; + $rows[$j]{main::key($num++,0,3,$i++)} = $_; } } if ($show{'cpu-flag'} && !$b_flags){ @@ -6929,7 +6923,7 @@ sub create_output_full { $flag = join ' ', @flags if @flags; } @data = ({ - main::key($num++,$flag_key) => $flag, + main::key($num++,0,1,$flag_key) => $flag, },); @rows = (@rows,@data); } @@ -6947,15 +6941,15 @@ sub create_output_full { } } @data = ({ - main::key($num++,'Vulnerabilities') => $value, + main::key($num++,1,1,'Vulnerabilities') => $value, },); @rows = (@rows,@data); if (@bugs){ $j = $#rows; foreach my $ref (@bugs){ my @bug = @$ref; - $rows[$j]{main::key($num++,'Type')} = $bug[0]; - $rows[$j]{main::key($num++,$bug[1])} = $bug[2]; + $rows[$j]{main::key($num++,1,2,'Type')} = $bug[0]; + $rows[$j]{main::key($num++,0,3,$bug[1])} = $bug[2]; $j++; } } @@ -6971,15 +6965,15 @@ sub create_output_short { $cpu[1] ||= main::row_defaults('cpu-model-null'); $cpu[2] ||= 'N/A'; @data = ({ - main::key($num++,$cpu[0]) => $cpu[1], - main::key($num++,'type') => $cpu[2], + main::key($num++,1,1,$cpu[0]) => $cpu[1], + main::key($num++,0,2,'type') => $cpu[2], },); if ($extra > 0){ - $data[0]{main::key($num++,'arch')} = $cpu[7]; + $data[0]{main::key($num++,0,2,'arch')} = $cpu[7]; } - $data[0]{main::key($num++,$cpu[3])} = $cpu[4]; + $data[0]{main::key($num++,0,2,$cpu[3])} = $cpu[4]; if ($cpu[6]){ - $data[0]{main::key($num++,$cpu[5])} = $cpu[6]; + $data[0]{main::key($num++,0,2,$cpu[5])} = $cpu[6]; } eval $end if $b_log; return @data; @@ -7013,7 +7007,7 @@ sub data_short { else { $key1 = ucfirst($alerts{'sysctl'}{'action'}); $val1 = $alerts{'sysctl'}{$alerts{'sysctl'}{'action'}}; - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); return @data; } } @@ -8445,7 +8439,7 @@ sub get { else { $val1 = main::row_defaults('disk-data-bsd'); } - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); @rows = (@rows,@data); } } @@ -8457,12 +8451,12 @@ sub get { else { $key1 = 'Message'; $val1 = main::row_defaults('disk-data'); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } if (!@rows){ $key1 = 'Message'; $val1 = main::row_defaults('disk-data'); - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); } #@rows = (@rows,@data); @data = (); @@ -8479,10 +8473,10 @@ sub create_output { eval $start if $b_log; my (@disks) = @_; #print Data::Dumper::Dumper \@disks; - my ($b_oldage,$b_prefail,$b_smart_permissions,@data,@rows); + my ($b_oldage,$b_prefail,$b_smart,$b_smart_permissions,@data,@rows); my ($num,$j) = (0,0); my ($id,$model,$size,$used,$percent,$size_holder, - $used_holder) = ('','','','','','','','',''); + $used_holder) = ('','','','','','',''); my @smart_basic =( ['smart','SMART'], ['smart-error','SMART Message'], @@ -8581,20 +8575,20 @@ sub create_output { } $used ||= 'N/A'; @data = ({ - main::key($num++,'Local Storage') => '', - main::key($num++,'total') => $size, - main::key($num++,'used') => $used, + main::key($num++,1,1,'Local Storage') => '', + main::key($num++,0,2,'total') => $size, + main::key($num++,0,2,'used') => $used, }); @rows = (@rows,@data); shift @disks; if ($smartctl_missing){ $j = scalar @rows; - $rows[$j]{main::key($num++,'SMART Message')} = $smartctl_missing; + $rows[$j]{main::key($num++,0,1,'SMART Message')} = $smartctl_missing; } if ( $show{'disk'} && @disks){ @disks = sort { $a->{'id'} cmp $b->{'id'} } @disks; foreach my $ref (@disks){ - ($b_oldage,$b_prefail,$id,$model,$size) = (0,0,'','',''); + ($b_oldage,$b_prefail,$b_smart,$id,$model,$size) = (0,0,0,'','',''); my %row = %$ref; $num = 1; $model = ($row{'model'}) ? $row{'model'}: 'N/A'; @@ -8616,91 +8610,97 @@ sub create_output { $j = scalar @rows; if (!$b_smart_permissions && $row{'smart-permissions'}){ $b_smart_permissions = 1; - $rows[$j]{main::key($num++,'SMART Message')} = $row{'smart-permissions'}; + $rows[$j]{main::key($num++,0,1,'SMART Message')} = $row{'smart-permissions'}; $j = scalar @rows; } @data = ({ - main::key($num++,'ID') => $id, + main::key($num++,1,1,'ID') => $id, }); @rows = (@rows,@data); if ($row{'type'}){ - $rows[$j]{main::key($num++,'type')} = $row{'type'}; + $rows[$j]{main::key($num++,0,2,'type')} = $row{'type'}; } if ($row{'vendor'}){ - $rows[$j]{main::key($num++,'vendor')} = $row{'vendor'}; + $rows[$j]{main::key($num++,0,2,'vendor')} = $row{'vendor'}; } - $rows[$j]{main::key($num++,'model')} = $model; + $rows[$j]{main::key($num++,0,2,'model')} = $model; if ($row{'drive-vendor'}){ - $rows[$j]{main::key($num++,'drive vendor')} = $row{'drive-vendor'}; + $rows[$j]{main::key($num++,0,2,'drive vendor')} = $row{'drive-vendor'}; } if ($row{'drive-model'}){ - $rows[$j]{main::key($num++,'drive model')} = $row{'drive-model'}; + $rows[$j]{main::key($num++,0,2,'drive model')} = $row{'drive-model'}; } if ($row{'family'}){ - $rows[$j]{main::key($num++,'family')} = $row{'family'}; + $rows[$j]{main::key($num++,0,2,'family')} = $row{'family'}; } - $rows[$j]{main::key($num++,'size')} = $size; + $rows[$j]{main::key($num++,0,2,'size')} = $size; if ($b_admin && $row{'block-physical'}){ - $rows[$j]{main::key($num++,'block size')} = ''; - $rows[$j]{main::key($num++,'physical')} = $row{'block-physical'} . ' B'; - $rows[$j]{main::key($num++,'logical')} = ($row{'block-logical'}) ? $row{'block-logical'} . ' B' : 'N/A'; + $rows[$j]{main::key($num++,0,2,'block size')} = ''; + $rows[$j]{main::key($num++,0,2,'physical')} = $row{'block-physical'} . ' B'; + $rows[$j]{main::key($num++,0,2,'logical')} = ($row{'block-logical'}) ? $row{'block-logical'} . ' B' : 'N/A'; } if ($extra > 1 && $row{'speed'}){ if ($row{'sata'}){ - $rows[$j]{main::key($num++,'sata')} = $row{'sata'}; + $rows[$j]{main::key($num++,0,2,'sata')} = $row{'sata'}; } - $rows[$j]{main::key($num++,'speed')} = $row{'speed'}; - $rows[$j]{main::key($num++,'lanes')} = $row{'lanes'} if $row{'lanes'}; + $rows[$j]{main::key($num++,0,2,'speed')} = $row{'speed'}; + $rows[$j]{main::key($num++,0,2,'lanes')} = $row{'lanes'} if $row{'lanes'}; } if ($extra > 2 && $row{'rotation'}){ - $rows[$j]{main::key($num++,'rotation')} = $row{'rotation'}; + $rows[$j]{main::key($num++,0,2,'rotation')} = $row{'rotation'}; } if ($extra > 1){ my $serial = main::apply_filter($row{'serial'}); - $rows[$j]{main::key($num++,'serial')} = $serial; + $rows[$j]{main::key($num++,0,2,'serial')} = $serial; if ($row{'drive-serial'}){ - $rows[$j]{main::key($num++,'drive serial')} = main::apply_filter($row{'drive-serial'}); + $rows[$j]{main::key($num++,0,2,'drive serial')} = main::apply_filter($row{'drive-serial'}); } if ($row{'firmware'}){ - $rows[$j]{main::key($num++,'rev')} = $row{'firmware'}; + $rows[$j]{main::key($num++,0,2,'rev')} = $row{'firmware'}; } if ($row{'drive-firmware'}){ - $rows[$j]{main::key($num++,'drive rev')} = $row{'drive-firmware'}; + $rows[$j]{main::key($num++,0,2,'drive rev')} = $row{'drive-firmware'}; } } if ($extra > 0 && $row{'temp'}){ - $rows[$j]{main::key($num++,'temp')} = $row{'temp'} . ' C'; + $rows[$j]{main::key($num++,0,2,'temp')} = $row{'temp'} . ' C'; } # extra level tests already done if (defined $row{'partition-table'}){ - $rows[$j]{main::key($num++,'scheme')} = $row{'partition-table'}; + $rows[$j]{main::key($num++,0,2,'scheme')} = $row{'partition-table'}; } if ($row{'smart'} || $row{'smart-error'}){ $j = scalar @rows; ## Basic SMART and drive info ## for (my $i = 0; $i < scalar @smart_basic;$i++){ if ($row{$smart_basic[$i][0]}){ - $rows[$j]{main::key($num++,$smart_basic[$i][1])} = $row{$smart_basic[$i][0]}; + if (!$b_smart){ + my $support = ($row{'smart'}) ? $row{'smart'}: $row{'smart-error'}; + $rows[$j]{main::key($num++,1,2,$smart_basic[$i][1])} = $support; + $b_smart = 1; + next; + } + $rows[$j]{main::key($num++,0,3,$smart_basic[$i][1])} = $row{$smart_basic[$i][0]}; } } ## Old-Age errors ## for (my $i = 0; $i < scalar @smart_age;$i++){ if ($row{$smart_age[$i][0]}){ if (!$b_oldage){ - $rows[$j]{main::key($num++,'Old-Age')} = ''; + $rows[$j]{main::key($num++,1,3,'Old-Age')} = ''; $b_oldage = 1; } - $rows[$j]{main::key($num++,$smart_age[$i][1])} = $row{$smart_age[$i][0]}; + $rows[$j]{main::key($num++,0,4,$smart_age[$i][1])} = $row{$smart_age[$i][0]}; } } ## Pre-Fail errors ## for (my $i = 0; $i < scalar @smart_fail;$i++){ if ($row{$smart_fail[$i][0]}){ if (!$b_prefail){ - $rows[$j]{main::key($num++,'Pre-Fail')} = ''; + $rows[$j]{main::key($num++,1,3,'Pre-Fail')} = ''; $b_prefail = 1; } - $rows[$j]{main::key($num++,$smart_fail[$i][1])} = $row{$smart_fail[$i][0]}; + $rows[$j]{main::key($num++,0,4,$smart_fail[$i][1])} = $row{$smart_fail[$i][0]}; } } } @@ -9182,7 +9182,6 @@ sub smartctl_data { } } } - ## SMART STATUS/HEALTH ## elsif ($split[$a] eq 'SMART support is'){ if ($split[$r] =~ /^(Available|Unavailable) /){ @@ -9235,7 +9234,6 @@ sub smartctl_data { $data[$i]{'temp'} = $split[$r]; } } - ## DEVICE USE: Reads/Writes ## elsif ($split[$a] eq 'Data Units Read'){ $data[$i]{'smart-units-read'} = $split[$r]; @@ -9619,7 +9617,7 @@ sub device_vendor { ['(^MKN|Mushkin)','Mushkin','Mushkin',''], # MKNS # MU = Multiple_Flash_Reader too risky: |M[UZ][^L] HD103SI HD start risky # HM320II HM320II - ['(SAMSUNG|^MCG[0-9]+GC|^MCC|^MCBOE|^[GS]2 Portable|^[DG]3 Station|^DUO\b|^P3|^BGN|^(HM|SP)[0-9]{2}|^MZMPC|^HD[0-9]{3}[A-Z]{2}$)','SAMSUNG','Samsung',''], # maybe ^SM, ^HM + ['(SAMSUNG|^MCG[0-9]+GC|^MCC|^MCBOE|^[GS]2 Portable|^[DG]3 Station|^DUO\b|^P3|^BGN|^BJ[NT]|^BWB|^(HM|SP)[0-9]{2}|^MZMPC|^HD[0-9]{3}[A-Z]{2}$)','SAMSUNG','Samsung',''], # maybe ^SM, ^HM # Android UMS Composite? ['(SanDisk|^SDS[S]?[DQ]|^SL([0-9]+)G|^AFGCE|^U3\b|ULTRA\sFIT|Clip Sport|Cruzer|^Extreme)','SanDisk','SanDisk',''], ['^STEC\b','^STEC\b','STEC',''], # ssd drive, must come before seagate ST test @@ -9637,10 +9635,10 @@ sub device_vendor { ['^(FUJITSU|MJA|MH[TVWYZ][0-9]|MP|MAP[0-9])','^FUJITSU','Fujitsu',''], # note: 2012: wdc bought hgst ['^(HGST|Touro|54[15]0|7250)','^HGST','HGST (Hitachi)',''], # HGST HUA - ['^(Hitachi|HCS|HD[PST]|DK[0-9]|IC|HT|HU)','^Hitachi','Hitachi',''], + ['^(Hitachi|HCS|HD[PST]|DK[0-9]|IC|HT|HU|HMS)','^Hitachi','Hitachi',''], # vb: VB0250EAVER but clashes with vbox; HP_SSD_S700_120G ;GB0500EAFYL GB starter too generic? # DX110064A5xnNMRI ids as HP and Sandisc, same ID, made by sandisc for hp? not sure - ['^(HP\b|[MV]B[0-6]|G[BJ][01]|DF[012]|v[0-9]{3}[bgorw]$|x[0-9]{3}[w]$)','^HP','HP',''], + ['^(HP\b|[MV]B[0-6]|G[BJ][01]|DF[FK|012]|v[0-9]{3}[bgorw]$|x[0-9]{3}[w]$)','^HP','HP',''], ['^(LSD|Lexar|JumpDrive|JD\s?Firefly|WorkFlow)','^Lexar','Lexar',''], # mmc-LEXAR_0xb016546c; JD Firefly; # OCZSSD2-2VTXE120G is OCZ-VERTEX2_3.5 ['^(OCZ|APOC|D2|DEN|DEN|DRSAK|EC188|FTNC|GFGC|MANG|MMOC|NIMC|NIMR|PSIR|RALLY2|TALOS2|TMSC|TRSAK)','^OCZ[\s-]','OCZ',''], @@ -9692,8 +9690,10 @@ sub device_vendor { ['^CnMemory|Spaceloop','^CnMemory','CnMemory',''], ['^CSD','^CSD','CSD',''], ['^(Dane-?Elec|Z Mate)','^Dane-?Elec','DaneElec',''], + ['^DATABAR','^DATABAR','DataBar',''], # Daplink vfs is an ARM software thing ['^Dataram','^Dataram','Dataram',''], + # DataStation can be Trekstore or I/O gear ['^Dell\b','^Dell','Dell',''], ['^DeLOCK','^Delock(\s?products)?','Delock',''], ['^Derler','^Derler','Derler',''], @@ -9729,7 +9729,7 @@ sub device_vendor { ['^Goldendisk','^Goldendisk','Goldendisk',''], ['^Goldenfir','^Goldenfir','Goldenfir',''], # Wilk Elektronik SA, poland - ['^(Wilk\s*)?(GOODRAM|GOODDRIVE|IR SSD)','^GOODRAM','GOODRAM',''], + ['^(Wilk\s*)?(GOODRAM|GOODDRIVE|IR SSD|IRP|SSDPR)','^GOODRAM','GOODRAM',''], # supertalent also has FM: |FM ['^(G[\.]?SKILL)','^G[\.]?SKILL','G.SKILL',''], ['^G[\s-]*Tech','^G[\s-]*Technology','G-Technology',''], @@ -9744,11 +9744,13 @@ sub device_vendor { ['^IEI Tech','^IEI Tech(\.|nology)?( Corp(\.|oration)?)?','IEI Technology',''], ['^(Imation|Nano\s?Pro|HQT)','^Imation(\sImation)?','Imation',''], # Imation_ImationFlashDrive; TF20 is imation/tdk ['^(Inca\b|Npenterprise)','^Inca','Inca',''], + ['^INDMEM','^INDMEM','INDMEM',''], ['^Inland','^Inland','Inland',''], ['^(InnoDisk|Innolite)','^InnoDisk( Corp.)?','InnoDisk',''], ['^Innostor','^Innostor','Innostor',''], ['^Innovation','^Innovation','Innovation',''], ['^Innovera','^Innovera','Innovera',''], + ['^Intaiel','^Intaiel','Intaiel',''], ['^(INM|Integral|V\s?Series)','^Integral(\s?Memory)?','Integral Memory',''], ['^(Intenso|(Alu|Basic|Business|Micro|Mobile|Rainbow|Speed|Twister) Line|Rainbow)','^Intenso','Intenso',''], ['^(Iomega|ZIP\b)','^Iomega','Iomega',''], @@ -9793,7 +9795,8 @@ sub device_vendor { ['^Mengmi','^Mengmi','Mengmi',''], ['^MINIX','^MINIX','MINIX',''], ['^Miracle','^Miracle','Miracle',''], - ['^Monster\s?Digital','^Monster\s?Digital','Monster Digital',''], + # Monster MONSTER DIGITAL + ['^(Monster\s)+Digital','^(Monster\s)+Digital','Monster Digital',''], ['^Morebeck','^Morebeck','Morebeck',''], ['^Motorola','^Motorola','Motorola',''], ['^Moweek','^Moweek','Moweek',''], @@ -9861,10 +9864,11 @@ sub device_vendor { ['^Teleplan','^Teleplan','Teleplan',''], ['^TEUTONS','^TEUTONS','TEUTONS',''], ['^Tigo','^Tigo','Tigo',''], + ['^Timetec','^Timetec','Timetec',''], ['^TKD','^TKD','TKD',''], ['^TopSunligt','^TopSunligt','TopSunligt',''], # is this a typo? hard to know ['^TopSunlight','^TopSunlight','TopSunlight',''], - ['^([F]?TS|Transcend|JetDrive|JetFlash)','^Transcend','Transcend',''], + ['^([F]?TS|Transcend|JetDrive|JetFlash|USDU)','^Transcend','Transcend',''], ['^(TrekStor|DS maxi)','^TrekStor','TrekStor',''], ['^UDinfo','^UDinfo','UDinfo',''], ['^USBTech','^USBTech','USBTech',''], @@ -10086,7 +10090,7 @@ sub get { my $type = ($b_arm) ? 'arm' : 'mips'; my $key = 'Message'; @data = ({ - main::key($num++,$key) => main::row_defaults($type . '-pci',''), + main::key($num++,0,1,$key) => main::row_defaults($type . '-pci',''), },); @rows = (@rows,@data); } @@ -10100,7 +10104,7 @@ sub get { $type = 'pci-card-data-root'; } @data = ({ - main::key($num++,$key) => main::row_defaults($type,''), + main::key($num++,0,1,$key) => main::row_defaults($type,''), },); @rows = (@rows,@data); } @@ -10141,24 +10145,24 @@ sub card_data { $card = main::pci_long_filter($card); } @data = ({ - main::key($num++,'Device') => $card, + main::key($num++,1,1,'Device') => $card, },); @rows = (@rows,@data); if ($extra > 0 && $b_pci_tool && $row[12]){ my $item = main::get_pci_vendor($row[4],$row[12]); - $rows[$j]{main::key($num++,'vendor')} = $item if $item; + $rows[$j]{main::key($num++,0,2,'vendor')} = $item if $item; } - $rows[$j]{main::key($num++,'driver')} = $driver; + $rows[$j]{main::key($num++,1,2,'driver')} = $driver; if ($row[9] && !$bsd_type){ my $version = main::get_module_version($row[9]); $version ||= 'N/A'; - $rows[$j]{main::key($num++,'v')} = $version; + $rows[$j]{main::key($num++,0,3,'v')} = $version; } if ($extra > 0){ - $rows[$j]{main::key($num++,'bus ID')} = (!$row[2] && !$row[3]) ? 'N/A' : "$row[2].$row[3]"; + $rows[$j]{main::key($num++,0,2,'bus ID')} = (!$row[2] && !$row[3]) ? 'N/A' : "$row[2].$row[3]"; } if ($extra > 1){ - $rows[$j]{main::key($num++,'chip ID')} = ($row[5]) ? "$row[5]:$row[6]" : $row[6]; + $rows[$j]{main::key($num++,0,2,'chip ID')} = ($row[5]) ? "$row[5]:$row[6]" : $row[6]; } #print "$row[0]\n"; } @@ -10194,20 +10198,20 @@ sub usb_data { } } @data = ({ - main::key($num++,'Device') => $product, - main::key($num++,'type') => 'USB', - main::key($num++,'driver') => $driver, + main::key($num++,1,1,'Device') => $product, + main::key($num++,0,2,'type') => 'USB', + main::key($num++,0,2,'driver') => $driver, },); @rows = (@rows,@data); if ($extra > 0){ - $rows[$j]{main::key($num++,'bus ID')} = "$path_id:$row[1]"; + $rows[$j]{main::key($num++,0,2,'bus ID')} = "$path_id:$row[1]"; } if ($extra > 1){ $row[7] ||= 'N/A'; - $rows[$j]{main::key($num++,'chip ID')} = $row[7]; + $rows[$j]{main::key($num++,0,2,'chip ID')} = $row[7]; } if ($extra > 2 && $row[16]){ - $rows[$j]{main::key($num++,'serial')} = main::apply_filter($row[16]); + $rows[$j]{main::key($num++,0,2,'serial')} = main::apply_filter($row[16]); } } } @@ -10263,20 +10267,20 @@ sub display_data(){ if (!$protocol && !$server_string && !$graphics{'x-vendor'} && !@drivers){ $server_string = main::row_defaults('display-server'); @row = ({ - main::key($num++,'Display') => '', - main::key($num++,'server') => $server_string, + main::key($num++,1,1,'Display') => '', + main::key($num++,0,2,'server') => $server_string, }); } else { $server_string ||= 'N/A'; @row = ({ - main::key($num++,'Display') => $protocol, - main::key($num++,'server') => $server_string, + main::key($num++,1,1,'Display') => $protocol, + main::key($num++,0,2,'server') => $server_string, }); if ($graphics{'compositor'}){ - $row[0]{main::key($num++,'compositor')} = $graphics{'compositor'}; + $row[0]{main::key($num++,0,2,'compositor')} = $graphics{'compositor'}; if ($graphics{'compositor-version'}){ - $row[0]{main::key($num++,'v')} = $graphics{'compositor-version'}; + $row[0]{main::key($num++,0,3,'v')} = $graphics{'compositor-version'}; } } # note: if no xorg log, and if wayland, there will be no xorg drivers, @@ -10303,33 +10307,33 @@ sub display_data(){ $driver = $drivers[0]; } $driver ||= 'N/A'; - $row[0]{main::key($num++,'driver')} = $driver; + $row[0]{main::key($num++,0,2,'driver')} = $driver; if ($driver_missing){ - $row[0]{main::key($num++,'note')} = $driver_missing; + $row[0]{main::key($num++,0,3,'note')} = $driver_missing; } if ($drivers[2]){ - $row[0]{main::key($num++,'FAILED')} = $drivers[2]; + $row[0]{main::key($num++,0,3,'FAILED')} = $drivers[2]; } if ($drivers[1]){ - $row[0]{main::key($num++,'unloaded')} = $drivers[1]; + $row[0]{main::key($num++,0,3,'unloaded')} = $drivers[1]; } if ($extra > 1 && $drivers[3]){ - $row[0]{main::key($num++,'alternate')} = $drivers[3]; + $row[0]{main::key($num++,0,3,'alternate')} = $drivers[3]; } } if ($b_admin ){ if ($graphics{'x-display-id'}){ - $row[0]{main::key($num++,'display ID')} = $graphics{'x-display-id'}; + $row[0]{main::key($num++,0,2,'display ID')} = $graphics{'x-display-id'}; } if (defined $graphics{'x-screens'}){ - $row[0]{main::key($num++,'screens')} = $graphics{'x-screens'}; + $row[0]{main::key($num++,0,2,'screens')} = $graphics{'x-screens'}; } if (defined $graphics{'x-default-screen'} && $graphics{'x-screens'} && $graphics{'x-screens'} > 1){ - $row[0]{main::key($num++,'default screen')} = $graphics{'x-default-screen'}; + $row[0]{main::key($num++,0,2,'default screen')} = $graphics{'x-default-screen'}; } } if ($graphics{'no-xdpyinfo'}){ - $row[0]{main::key($num++,'resolution')} = $graphics{'no-xdpyinfo'}; + $row[0]{main::key($num++,0,2,'resolution')} = $graphics{'no-xdpyinfo'}; } elsif ($graphics{'screens'}){ my ($diag,$dpi,$hz,$size); @@ -10343,21 +10347,21 @@ sub display_data(){ $row_key++ if !$show{'graphic-basic'}; if ( !$show{'graphic-basic'} || $m_count == 0 ){ if ( !$show{'graphic-basic'} && defined $main{'screen'} ){ - $row[$row_key]{main::key($num++,'Screen')} = $main{'screen'}; + $row[$row_key]{main::key($num++,1,2,'Screen')} = $main{'screen'}; } $resolution = $main{'res-x'} . 'x' . $main{'res-y'} if $main{'res-x'} && $main{'res-y'}; $resolution .= '~' . $main{'hz'} . 'Hz' if $show{'graphic-basic'} && $main{'hz'} && $resolution; $resolution ||= 'N/A'; if ($s_count == 1 || !$show{'graphic-basic'}){ - $row[$row_key]{main::key($num++,'s-res')} = $resolution; + $row[$row_key]{main::key($num++,0,3,'s-res')} = $resolution; } elsif ($show{'graphic-basic'}) { - $row[$row_key]{main::key($num++,'s-res')} = '' if $screen_count == 1; - $row[$row_key]{main::key($num++,$screen_count)} = $resolution; + $row[$row_key]{main::key($num++,0,3,'s-res')} = '' if $screen_count == 1; + $row[$row_key]{main::key($num++,0,3,$screen_count)} = $resolution; } $resolution = ''; if ($main{'s-dpi'} && (!$show{'graphic-basic'} || $extra > 1)){ - $row[$row_key]{main::key($num++,'s-dpi')} = $main{'s-dpi'}; + $row[$row_key]{main::key($num++,0,3,'s-dpi')} = $main{'s-dpi'}; } if ( !$show{'graphic-basic'} ){ if ($main{'size-x'} && $main{'size-y'}){ @@ -10365,12 +10369,12 @@ sub display_data(){ 'mm ('. $main{'size-x-i'} . 'x' . $main{'size-y-i'} . '")'; } $size ||= ''; - $row[$row_key]{main::key($num++,'s-size')} = $size if $size; + $row[$row_key]{main::key($num++,0,3,'s-size')} = $size if $size; if ($main{'diagonal'}){ $diag = $main{'diagonal-m'} . 'mm ('. $main{'diagonal'} . '")'; } $diag ||= ''; - $row[$row_key]{main::key($num++,'s-diag')} = $diag if $diag; + $row[$row_key]{main::key($num++,0,3,'s-diag')} = $diag if $diag; } } if ($main{'monitors'}){ @@ -10388,47 +10392,47 @@ sub display_data(){ $resolution .= '~' . $monitor{'hz'} . 'Hz' if $monitor{'hz'} && $resolution; $resolution ||= 'N/A'; if ($basic_count == 1 && $m_count == 1){ - $row[$row_key]{main::key($num++,'resolution')} = $resolution; + $row[$row_key]{main::key($num++,0,2,'resolution')} = $resolution; } else { - $row[$row_key]{main::key($num++,'resolution')} = '' if $basic_count == 1; - $row[$row_key]{main::key($num++,$basic_count)} = $resolution; + $row[$row_key]{main::key($num++,1,2,'resolution')} = '' if $basic_count == 1; + $row[$row_key]{main::key($num++,0,3,$basic_count)} = $resolution; } if ($m_count == $basic_count){ - $row[$row_key]{main::key($num++,'s-dpi')} = $dpi if $dpi; + $row[$row_key]{main::key($num++,0,2,'s-dpi')} = $dpi if $dpi; } next; } $row_key++; - $row[$row_key]{main::key($num++,'Monitor')} = $monitor{'monitor'}; + $row[$row_key]{main::key($num++,0,3,'Monitor')} = $monitor{'monitor'}; if ($monitor{'res-x'} && $monitor{'res-y'}){ $resolution = $monitor{'res-x'} . 'x' . $monitor{'res-y'}; } $resolution ||= 'N/A'; - $row[$row_key]{main::key($num++,'res')} = $resolution; + $row[$row_key]{main::key($num++,0,4,'res')} = $resolution; $hz = ($monitor{'hz'}) ? $monitor{'hz'} : ''; - $row[$row_key]{main::key($num++,'hz')} = $hz if $hz; + $row[$row_key]{main::key($num++,0,4,'hz')} = $hz if $hz; $dpi = ($monitor{'dpi'}) ? $monitor{'dpi'} : ''; - $row[$row_key]{main::key($num++,'dpi')} = $dpi if $dpi; + $row[$row_key]{main::key($num++,0,4,'dpi')} = $dpi if $dpi; #print "$dpi :: $main{'s-dpi'}\n"; if ($monitor{'size-x'} && $monitor{'size-y'}){ $size = $monitor{'size-x'} . 'x' . $monitor{'size-y'} . 'mm ('. $monitor{'size-x-i'} . 'x' . $monitor{'size-y-i'} . '")'; } $size ||= ''; - $row[$row_key]{main::key($num++,'size')} = $size if $size; + $row[$row_key]{main::key($num++,0,4,'size')} = $size if $size; if ($monitor{'diagonal'}){ $diag = $monitor{'diagonal-m'} . 'mm ('. $monitor{'diagonal'} . '")'; } $diag ||= ''; - $row[$row_key]{main::key($num++,'diag')} = $diag if $diag; + $row[$row_key]{main::key($num++,0,4,'diag')} = $diag if $diag; } } } } else { $graphics{'tty'} ||= 'N/A'; - $row[0]{main::key($num++,'tty')} = $graphics{'tty'}; + $row[0]{main::key($num++,0,2,'tty')} = $graphics{'tty'}; } } eval $end if $b_log; @@ -10680,7 +10684,7 @@ sub gl_data(){ $type = 'display-null'; } @row = ({ - main::key($num++,'Message') => main::row_defaults($type), + main::key($num++,0,1,'Message') => main::row_defaults($type), }); return @row; } @@ -10763,20 +10767,20 @@ sub gl_data(){ $version = join ', ', @opengl_version if @opengl_version; $renderer = join ', ', @renderer if @renderer; @row = ({ - main::key($num++,'OpenGL') => '', - main::key($num++,'renderer') => ($renderer) ? $renderer : 'N/A', - main::key($num++,'v') => ($version) ? $version : 'N/A', + main::key($num++,1,1,'OpenGL') => '', + main::key($num++,1,2,'renderer') => ($renderer) ? $renderer : 'N/A', + main::key($num++,0,2,'v') => ($version) ? $version : 'N/A', }); if ($b_compat && $extra > 1 && $compat_version){ - $row[0]{main::key($num++,'compat-v')} = $compat_version; + $row[0]{main::key($num++,0,2,'compat-v')} = $compat_version; } if ($extra > 0){ - $row[0]{main::key($num++,'direct render')} = $direct_render; + $row[0]{main::key($num++,0,2,'direct render')} = $direct_render; } } else { @row = ({ - main::key($num++,'Message') => main::row_defaults('glxinfo-missing'), + main::key($num++,0,1,'Message') => main::row_defaults('glxinfo-missing'), }); } } @@ -10794,7 +10798,7 @@ sub gl_data(){ } } @row = ({ - main::key($num++,'Message') => main::row_defaults($type), + main::key($num++,0,1,'Message') => main::row_defaults($type), }); } eval $end if $b_log; @@ -11075,7 +11079,7 @@ sub get { } # if error case, null data, whatever if ($key1) { - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); } eval $end if $b_log; return @data; @@ -11123,7 +11127,7 @@ sub create_output { $data{'device'} ||= 'N/A'; $j = scalar @rows; @row = ({ - main::key($num++,'Type') => ucfirst($data{'device'}), + main::key($num++,0,1,'Type') => ucfirst($data{'device'}), },); @rows = (@rows,@row); if (!$b_skip_system){ @@ -11132,10 +11136,10 @@ sub create_output { $product_name = ($data{'product_name'}) ? $data{'product_name'}:'N/A'; $product_version = ($data{'product_version'}) ? $data{'product_version'}:'N/A'; $product_serial = main::apply_filter($data{'product_serial'}); - $rows[$j]{main::key($num++,'System')} = $system_vendor; - $rows[$j]{main::key($num++,'product')} = $product_name; - $rows[$j]{main::key($num++,'v')} = $product_version; - $rows[$j]{main::key($num++,'serial')} = $product_serial; + $rows[$j]{main::key($num++,1,1,'System')} = $system_vendor; + $rows[$j]{main::key($num++,0,2,'product')} = $product_name; + $rows[$j]{main::key($num++,0,2,'v')} = $product_version; + $rows[$j]{main::key($num++,0,2,'serial')} = $product_serial; # no point in showing chassis if system isn't there, it's very unlikely that # would be correct if ($extra > 1){ @@ -11157,14 +11161,14 @@ sub create_output { $chassis_serial = main::apply_filter($data{'chassis_serial'}); $chassis_vendor ||= ''; $chassis_type ||= ''; - $rows[$j]{main::key($num++,'Chassis')} = $chassis_vendor; + $rows[$j]{main::key($num++,1,1,'Chassis')} = $chassis_vendor; if ($chassis_type){ - $rows[$j]{main::key($num++,'type')} = $chassis_type; + $rows[$j]{main::key($num++,0,2,'type')} = $chassis_type; } if ($chassis_version){ - $rows[$j]{main::key($num++,'v')} = $chassis_version; + $rows[$j]{main::key($num++,0,2,'v')} = $chassis_version; } - $rows[$j]{main::key($num++,'serial')} = $chassis_serial; + $rows[$j]{main::key($num++,0,2,'serial')} = $chassis_serial; } } $j++; # start new row @@ -11192,23 +11196,23 @@ sub create_output { if ($extra > 1 && $data{'bios_romsize'}){ $bios_romsize = $data{'bios_romsize'}; } - $rows[$j]{main::key($num++,'Mobo')} = $mobo_vendor; - $rows[$j]{main::key($num++,'model')} = $mobo_model; + $rows[$j]{main::key($num++,1,1,'Mobo')} = $mobo_vendor; + $rows[$j]{main::key($num++,0,2,'model')} = $mobo_model; if ($mobo_version){ - $rows[$j]{main::key($num++,'v')} = $mobo_version; + $rows[$j]{main::key($num++,0,2,'v')} = $mobo_version; } - $rows[$j]{main::key($num++,'serial')} = $mobo_serial; + $rows[$j]{main::key($num++,0,2,'serial')} = $mobo_serial; if ($extra > 2 && $data{'board_uuid'}){ - $rows[$j]{main::key($num++,'uuid')} = $data{'board_uuid'}; + $rows[$j]{main::key($num++,0,2,'uuid')} = $data{'board_uuid'}; } - $rows[$j]{main::key($num++,$firmware)} = $bios_vendor; - $rows[$j]{main::key($num++,'v')} = $bios_version; + $rows[$j]{main::key($num++,1,1,$firmware)} = $bios_vendor; + $rows[$j]{main::key($num++,0,2,'v')} = $bios_version; if ($bios_rev){ - $rows[$j]{main::key($num++,'rev')} = $bios_rev; + $rows[$j]{main::key($num++,0,2,'rev')} = $bios_rev; } - $rows[$j]{main::key($num++,'date')} = $bios_date; + $rows[$j]{main::key($num++,0,2,'date')} = $bios_date; if ($bios_romsize){ - $rows[$j]{main::key($num++,'rom size')} = $bios_romsize; + $rows[$j]{main::key($num++,0,2,'rom size')} = $bios_romsize; } eval $end if $b_log; return @rows; @@ -11216,8 +11220,7 @@ sub create_output { sub create_output_soc { my (%soc_machine) = @_; my ($key,%data,@row,@rows); - my $num = 0; - my $j = 0; + my ($cont_sys,$ind_sys,$j,$num) = (1,1,0,0); #print Data::Dumper::Dumper \%soc_machine; # this is sketchy, /proc/device-tree/model may be similar to Hardware value from /proc/cpuinfo # raspi: Hardware : BCM2835 model: Raspberry Pi Model B Rev 2 @@ -11225,27 +11228,28 @@ sub create_output_soc { if ($b_arm){$key = 'ARM Device'} elsif ($b_mips){$key = 'MIPS Device'} elsif ($b_ppc){$key = 'PowerPC Device'} - $rows[$j]{main::key($num++,'Type')} = $key; + $rows[$j]{main::key($num++,0,1,'Type')} = $key; my $system = 'System'; if (defined $soc_machine{'model'}){ - $rows[$j]{main::key($num++,'System')} = $soc_machine{'model'}; + $rows[$j]{main::key($num++,1,1,'System')} = $soc_machine{'model'}; $system = 'details'; + ($cont_sys,$ind_sys) = (0,2); } $soc_machine{'device'} ||= 'N/A'; - $rows[$j]{main::key($num++,$system)} = $soc_machine{'device'}; + $rows[$j]{main::key($num++,$cont_sys,$ind_sys,$system)} = $soc_machine{'device'}; } # we're going to print N/A for 0000 values sine the item was there. if ($soc_machine{'firmware'}){ # most samples I've seen are like: 0000 $soc_machine{'firmware'} =~ s/^[0]+$//; $soc_machine{'firmware'} ||= 'N/A'; - $rows[$j]{main::key($num++,'rev')} = $soc_machine{'firmware'}; + $rows[$j]{main::key($num++,0,2,'rev')} = $soc_machine{'firmware'}; } # sometimes has value like: 0000 if (defined $soc_machine{'serial'}){ # most samples I've seen are like: 0000 $soc_machine{'serial'} =~ s/^[0]+$//; - $rows[$j]{main::key($num++,'serial')} = main::apply_filter($soc_machine{'serial'}); + $rows[$j]{main::key($num++,0,2,'serial')} = main::apply_filter($soc_machine{'serial'}); } eval $end if $b_log; return @rows; @@ -11687,7 +11691,7 @@ sub get { my $type = ($b_arm) ? 'arm' : 'mips'; my $key = 'Message'; @data = ({ - main::key($num++,$key) => main::row_defaults($type . '-pci',''), + main::key($num++,0,1,$key) => main::row_defaults($type . '-pci',''), },); @rows = (@rows,@data); } @@ -11738,17 +11742,17 @@ sub card_data { #$card ||= 'N/A'; $driver ||= 'N/A'; @data = ({ - main::key($num++,'Device') => $card, + main::key($num++,1,1,'Device') => $card, },); @rows = (@rows,@data); if ($extra > 0 && $b_pci_tool && $row[12]){ my $item = main::get_pci_vendor($row[4],$row[12]); - $rows[$j]{main::key($num++,'vendor')} = $item if $item; + $rows[$j]{main::key($num++,0,2,'vendor')} = $item if $item; } if ($row[1] eq '0680'){ - $rows[$j]{main::key($num++,'type')} = 'network bridge'; + $rows[$j]{main::key($num++,0,2,'type')} = 'network bridge'; } - $rows[$j]{main::key($num++,'driver')} = $driver; + $rows[$j]{main::key($num++,1,2,'driver')} = $driver; my $bus_id = 'N/A'; # note: for arm/mips we want to see the single item bus id, why not? # note: we can have bus id: 0002 / 0 which is valid, but 0 / 0 is invalid @@ -11759,15 +11763,15 @@ sub card_data { if ($row[9] && !$bsd_type){ my $version = main::get_module_version($row[9]); $version ||= 'N/A'; - $rows[$j]{main::key($num++,'v')} = $version; + $rows[$j]{main::key($num++,0,3,'v')} = $version; } $row[8] ||= 'N/A'; # as far as I know, wifi has no port, but in case it does in future, use it - $rows[$j]{main::key($num++,'port')} = $row[8] if (!$b_wifi || ( $b_wifi && $row[8] ne 'N/A') ); - $rows[$j]{main::key($num++,'bus ID')} = $bus_id; + $rows[$j]{main::key($num++,0,2,'port')} = $row[8] if (!$b_wifi || ( $b_wifi && $row[8] ne 'N/A') ); + $rows[$j]{main::key($num++,0,2,'bus ID')} = $bus_id; } if ($extra > 1){ - $rows[$j]{main::key($num++,'chip ID')} = $chip_id; + $rows[$j]{main::key($num++,0,2,'chip ID')} = $chip_id; } if ($show{'network-advanced'}){ @data = (); @@ -11790,7 +11794,7 @@ sub card_data { $type = 'pci-card-data-root'; } @data = ({ - main::key($num++,$key) => main::row_defaults($type,''), + main::key($num++,0,1,$key) => main::row_defaults($type,''), },); @rows = (@rows,@data); @@ -11822,20 +11826,20 @@ sub usb_data { if ($product && network_device($test)){ $driver ||= 'usb-network'; @data = ({ - main::key($num++,'Device') => $product, - main::key($num++,'type') => 'USB', - main::key($num++,'driver') => $driver, + main::key($num++,1,1,'Device') => $product, + main::key($num++,0,2,'type') => 'USB', + main::key($num++,0,2,'driver') => $driver, },); $b_wifi = check_wifi($product); @rows = (@rows,@data); if ($extra > 0){ - $rows[$j]{main::key($num++,'bus ID')} = "$path_id:$row[1]"; + $rows[$j]{main::key($num++,0,2,'bus ID')} = "$path_id:$row[1]"; } if ($extra > 1){ - $rows[$j]{main::key($num++,'chip ID')} = $row[7]; + $rows[$j]{main::key($num++,0,2,'chip ID')} = $row[7]; } if ($extra > 2 && $row[16]){ - $rows[$j]{main::key($num++,'serial')} = main::apply_filter($row[16]); + $rows[$j]{main::key($num++,0,2,'serial')} = main::apply_filter($row[16]); } if ($show{'network-advanced'}){ @data = (); @@ -11864,7 +11868,7 @@ sub advanced_data_sys { eval $start if $b_log; return if ! -d '/sys/class/net'; my ($vendor,$chip,$count,$b_wifi,$path_usb,$bus_id) = @_; - my $num = 0; + my ($cont_if,$ind_if,$num) = (2,3,0); my $key = 'IF'; my ($b_check,$b_usb,$if,$path,@paths,@row,@rows); # ntoe: we've already gotten the base path, now we @@ -11884,6 +11888,7 @@ sub advanced_data_sys { if ($vendor eq 'check'){ $b_check = 1; $key = 'IF-ID'; + ($cont_if,$ind_if) = (1,2); } #print join '; ', @paths, $count, "\n"; foreach (@paths){ @@ -11931,8 +11936,8 @@ sub advanced_data_sys { $state ||= 'N/A'; #print "$speed \n"; @row = ({ - main::key($num++,$key) => $if, - main::key($num++,'state') => $state, + main::key($num++,1,$cont_if,$key) => $if, + main::key($num++,0,$ind_if,'state') => $state, },); #my $j = scalar @row - 1; push (@ifs_found, $if) if (!$b_check && (! grep {/$if/} @ifs_found)); @@ -11945,10 +11950,10 @@ sub advanced_data_sys { if (!$b_wifi && $state ne 'down' && $state ne 'no'){ # make sure the value is strictly numeric before appending Mbps $speed = ( main::is_int($speed) ) ? "$speed Mbps" : $speed; - $row[0]{main::key($num++,'speed')} = $speed; - $row[0]{main::key($num++,'duplex')} = $duplex; + $row[0]{main::key($num++,0,$ind_if,'speed')} = $speed; + $row[0]{main::key($num++,0,$ind_if,'duplex')} = $duplex; } - $row[0]{main::key($num++,'mac')} = $mac; + $row[0]{main::key($num++,0,$ind_if,'mac')} = $mac; if ($b_check){ @rows = (@rows,@row); } @@ -11956,7 +11961,7 @@ sub advanced_data_sys { @rows = @row; } if ($show{'ip'}){ - @row = if_ip($if); + @row = if_ip($key,$if); @rows = (@rows,@row); } last if !$b_check; @@ -11972,12 +11977,13 @@ sub advanced_data_bsd { my ($if,$b_wifi) = @_; my (@data,@row,@rows,$working_if); my ($b_check,$state,$speed,$duplex,$mac); - my $num = 0; + my ($cont_if,$ind_if,$num) = (2,3,0); my $key = 'IF'; my $j = 0; if ($if eq 'check'){ $b_check = 1; $key = 'IF-ID'; + ($cont_if,$ind_if) = (1,2); } foreach my $ref (@ifs_bsd){ if (ref $ref ne 'ARRAY'){ @@ -12003,8 +12009,8 @@ sub advanced_data_bsd { $state ||= 'N/A'; #print "$speed \n"; @row = ({ - main::key($num++,$key) => $if, - main::key($num++,'state') => $state, + main::key($num++,1,$cont_if,$key) => $if, + main::key($num++,0,$ind_if,'state') => $state, },); push (@ifs_found, $if) if (!$b_check && (! grep {/$if/} @ifs_found )); # print "push: if: $if ifs: @ifs_found\n"; @@ -12014,14 +12020,14 @@ sub advanced_data_bsd { if (!$b_wifi && $state ne 'down' && $state ne 'no'){ # make sure the value is strictly numeric before appending Mbps $speed = ( main::is_int($speed) ) ? "$speed Mbps" : $speed; - $row[0]{main::key($num++,'speed')} = $speed; - $row[0]{main::key($num++,'duplex')} = $duplex; + $row[0]{main::key($num++,0,$ind_if,'speed')} = $speed; + $row[0]{main::key($num++,0,$ind_if,'duplex')} = $duplex; } - $row[0]{main::key($num++,'mac')} = $mac; + $row[0]{main::key($num++,0,$ind_if,'mac')} = $mac; } @rows = (@rows,@row); if ($show{'ip'}){ - @row = if_ip($if) if $if; + @row = if_ip($key,$if) if $if; @rows = (@rows,@row) if @row; } } @@ -12037,11 +12043,15 @@ sub advanced_data_bsd { # 4 - scope if, if different from if sub if_ip { eval $start if $b_log; - my ($if) = @_; + my ($type,$if) = @_; my (@data,@row,@rows,$working_if); + my ($cont_ip,$ind_ip) = (3,4); my $num = 0; my $j = 0; $b_ip_run = 1; + if ($type eq 'IF-ID'){ + ($cont_ip,$ind_ip) = (2,3); + } OUTER: foreach my $ref (@ifs){ if (ref $ref ne 'ARRAY'){ @@ -12059,7 +12069,7 @@ sub if_ip { $num = 1; if ($limit > 0 && $j >= $limit){ @row = ({ - main::key($num++,'Message') => main::row_defaults('output-limit',scalar @data), + main::key($num++,0,$cont_ip,'Message') => main::row_defaults('output-limit',scalar @data), },); @rows = (@rows,@row); last OUTER; @@ -12070,6 +12080,7 @@ sub if_ip { $ipv = ($data2[0])? $data2[0]: 'N/A'; $ip = main::apply_filter($data2[1]); $scope = ($data2[3])? $data2[3]: 'N/A'; + # note: where is this ever set to 'all'? Old test condition? if ($if ne 'all'){ if (defined $data2[4] && $working_if ne $data2[4]){ # scope global temporary deprecated dynamic @@ -12085,29 +12096,29 @@ sub if_ip { $data2[4] =~ s/\s$if$// if $data2[4] =~ /[^\s]+\s$if$/; my $key = ($data2[4] =~ /deprecated|dynamic|temporary|noprefixroute/ ) ? 'type':'virtual' ; @row = ({ - main::key($num++,"IP v$ipv") => $ip, - main::key($num++,$key) => $data2[4], - main::key($num++,'scope') => $scope, + main::key($num++,1,$cont_ip,"IP v$ipv") => $ip, + main::key($num++,0,$ind_ip,$key) => $data2[4], + main::key($num++,0,$ind_ip,'scope') => $scope, },); } else { @row = ({ - main::key($num++,"IP v$ipv") => $ip, - main::key($num++,'scope') => $scope, + main::key($num++,1,$cont_ip,"IP v$ipv") => $ip, + main::key($num++,0,$ind_ip,'scope') => $scope, },); } } else { @row = ({ - main::key($num++,'IF') => $if, - main::key($num++,"IP v$ipv") => $ip, - main::key($num++,'scope') => $scope, + main::key($num++,1,($cont_ip - 1 ),'IF') => $if, + main::key($num++,1,$cont_ip,"IP v$ipv") => $ip, + main::key($num++,0,$ind_ip,'scope') => $scope, },); } @rows = (@rows,@row); if ($extra > 1 && $data2[2]){ $broadcast = main::apply_filter($data2[2]); - $rows[$j]{main::key($num++,'broadcast')} = $broadcast; + $rows[$j]{main::key($num++,0,$ind_ip,'broadcast')} = $broadcast; } } } @@ -12158,7 +12169,7 @@ sub wan_ip { $ip = ($b_dig) ? main::row_defaults('IP-dig', 'WAN IP') : main::row_defaults('IP', 'WAN IP'); } @data = ({ - main::key($num++,'WAN IP') => $ip, + main::key($num++,0,1,'WAN IP') => $ip, },); eval $end if $b_log; return @data; @@ -12237,7 +12248,7 @@ sub get { #@data = optical_data_bsd(); $key1 = 'Optical Report'; $val1 = main::row_defaults('optical-data-bsd'); - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); if ( @dm_boot_optical){ @data = optical_data_bsd(); } @@ -12253,7 +12264,7 @@ sub get { $val1 = main::row_defaults('optical-data-bsd'); } $key1 = 'Optical Report'; - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); } } else { @@ -12262,7 +12273,7 @@ sub get { if (!@data){ $key1 = 'Message'; $val1 = main::row_defaults('optical-data'); - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); } @rows = (@rows,@data); eval $end if $b_log; @@ -12277,7 +12288,7 @@ sub create_output { # build floppy if any foreach my $key (sort keys %devices){ if ($devices{$key}{'type'} eq 'floppy'){ - @data = ({ main::key($num++,ucfirst($devices{$key}{'type'})) => "/dev/$key"}); + @data = ({ main::key($num++,0,1,ucfirst($devices{$key}{'type'})) => "/dev/$key"}); @rows = (@rows,@data); delete $devices{$key}; } @@ -12290,22 +12301,22 @@ sub create_output { my $model = $devices{$key}{'model'}; $model ||= 'N/A'; @data = ({ - main::key($num++,ucfirst($devices{$key}{'type'})) => "/dev/$key", - main::key($num++,'vendor') => $vendor, - main::key($num++,'model') => $model, + main::key($num++,1,1,ucfirst($devices{$key}{'type'})) => "/dev/$key", + main::key($num++,0,2,'vendor') => $vendor, + main::key($num++,0,2,'model') => $model, }); @rows = (@rows,@data); if ($extra > 0){ my $rev = $devices{$key}{'rev'}; $rev ||= 'N/A'; - $rows[$j]{ main::key($num++,'rev')} = $rev; + $rows[$j]{ main::key($num++,0,2,'rev')} = $rev; } if ($extra > 1 && $devices{$key}{'serial'}){ - $rows[$j]{ main::key($num++,'serial')} = main::apply_filter($devices{$key}{'serial'}); + $rows[$j]{ main::key($num++,0,2,'serial')} = main::apply_filter($devices{$key}{'serial'}); } my $ref = $devices{$key}{'links'}; my $links = (@$ref) ? join ',', sort @$ref: 'N/A' ; - $rows[$j]{ main::key($num++,'dev-links')} = $links; + $rows[$j]{ main::key($num++,0,2,'dev-links')} = $links; if ($show{'optical'}){ $j = scalar @rows; my $speed = $devices{$key}{'speed'}; @@ -12338,19 +12349,18 @@ sub create_output { } $rws = (@rw) ? join ',', @rw: 'none' ; @data = ({ - main::key($num++,'Features') => '', - main::key($num++,'speed') => $speed, - main::key($num++,'multisession') => $multisession, - main::key($num++,'audio') => $audio, - main::key($num++,'dvd') => $dvd, - main::key($num++,'rw') => $rws, + main::key($num++,1,2,'Features') => '', + main::key($num++,0,3,'speed') => $speed, + main::key($num++,0,3,'multisession') => $multisession, + main::key($num++,0,3,'audio') => $audio, + main::key($num++,0,3,'dvd') => $dvd, + main::key($num++,0,3,'rw') => $rws, }); @rows = (@rows,@data); - if ($extra > 0 ){ my $state = $devices{$key}{'state'}; $state ||= 'N/A'; - $rows[$j]{ main::key($num++,'state')} = $state; + $rows[$j]{ main::key($num++,0,3,'state')} = $state; } } } @@ -12575,7 +12585,7 @@ sub get { #$val1 = ($bsd_type && $bsd_type eq 'darwin') ? # main::row_defaults('darwin-feature') : main::row_defaults('partition-data'); $val1 = main::row_defaults('partition-data'); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } else { @rows = create_output(); @@ -12620,7 +12630,7 @@ sub create_output { $row{'id'} =~ s|/home/[^/]+/(.*)|/home/$filter_string/$1| if $use{'filter'}; $j = scalar @rows; @data = ({ - main::key($num++,'ID') => $row{'id'}, + main::key($num++,1,1,'ID') => $row{'id'}, }); @rows = (@rows,@data); if (($b_admin || $row{'hidden'}) && $row{'raw-size'} ){ @@ -12632,36 +12642,36 @@ sub create_output { @data2 = main::get_size($row{'raw-size'}); $raw_size = (@data2) ? $data2[0] . ' ' . $data2[1]: 'N/A'; } - $rows[$j]{main::key($num++,'raw size')} = $raw_size; + $rows[$j]{main::key($num++,0,2,'raw size')} = $raw_size; } if ($b_admin && $row{'raw-available'} && $size ne 'N/A'){ $size .= ' (' . $row{'raw-available'} . '%)'; } - $rows[$j]{main::key($num++,'size')} = $size; - $rows[$j]{main::key($num++,'used')} = $used . $percent; - $rows[$j]{main::key($num++,'fs')} = $fs; + $rows[$j]{main::key($num++,0,2,'size')} = $size; + $rows[$j]{main::key($num++,0,2,'used')} = $used . $percent; + $rows[$j]{main::key($num++,0,2,'fs')} = $fs; if ($b_admin && $fs eq 'swap' && defined $row{'swappiness'}){ - $rows[$j]{main::key($num++,'swappiness')} = $row{'swappiness'}; + $rows[$j]{main::key($num++,0,2,'swappiness')} = $row{'swappiness'}; } if ($b_admin && $fs eq 'swap' && defined $row{'cache-pressure'}){ - $rows[$j]{main::key($num++,'cache pressure')} = $row{'cache-pressure'}; + $rows[$j]{main::key($num++,0,2,'cache pressure')} = $row{'cache-pressure'}; } if ($extra > 1 && $fs eq 'swap' && defined $row{'priority'}){ - $rows[$j]{main::key($num++,'priority')} = $row{'priority'}; + $rows[$j]{main::key($num++,0,2,'priority')} = $row{'priority'}; } if ($b_admin && $row{'block-size'}){ - $rows[$j]{main::key($num++,'block size')} = $row{'block-size'} . ' B';; - #$rows[$j]{main::key($num++,'physical')} = $row{'block-size'} . ' B'; - #$rows[$j]{main::key($num++,'logical')} = $row{'block-logical'} . ' B'; + $rows[$j]{main::key($num++,0,2,'block size')} = $row{'block-size'} . ' B';; + #$rows[$j]{main::key($num++,0,2,'physical')} = $row{'block-size'} . ' B'; + #$rows[$j]{main::key($num++,0,2,'logical')} = $row{'block-logical'} . ' B'; } - $rows[$j]{main::key($num++,$dev_type)} = $dev; + $rows[$j]{main::key($num++,0,2,$dev_type)} = $dev; if ($show{'label'}){ $row{'label'} = main::apply_partition_filter('part', $row{'label'}, '') if $use{'filter-label'}; - $rows[$j]{main::key($num++,'label')} = ($row{'label'}) ? $row{'label'}: 'N/A'; + $rows[$j]{main::key($num++,0,2,'label')} = ($row{'label'}) ? $row{'label'}: 'N/A'; } if ($show{'uuid'}){ $row{'uuid'} = main::apply_partition_filter('part', $row{'uuid'}, '') if $use{'filter-uuid'}; - $rows[$j]{main::key($num++,'uuid')} = ($row{'uuid'}) ? $row{'uuid'}: 'N/A'; + $rows[$j]{main::key($num++,0,2,'uuid')} = ($row{'uuid'}) ? $row{'uuid'}: 'N/A'; } } eval $end if $b_log; @@ -13291,6 +13301,7 @@ package ProcessData; sub get { eval $start if $b_log; + my $num = 0; my (@processes,@rows); if (@ps_aux){ if ($show{'ps-cpu'}){ @@ -13305,7 +13316,7 @@ sub get { else { my $key = 'Message'; @rows = ({ - main::key(1,$key) => main::row_defaults('ps-data-null',''), + main::key($num++,0,1,$key) => main::row_defaults('ps-data-null',''), },); @processes = (@processes,@rows); } @@ -13337,7 +13348,7 @@ sub cpu_processes { #my $header = "CPU % used - Command - pid$cpu_mem - top"; #my $header = "Top $count by CPU"; my @data = ({ - main::key($num++,'CPU top') => "$count$throttled", + main::key($num++,1,1,'CPU top') => "$count$throttled" . ' of ' . scalar @ps_aux, },); @processes = (@processes,@data); my $i = 1; @@ -13348,21 +13359,21 @@ sub cpu_processes { my @command = process_starter(scalar @row, $row[$ps_cols],$row[$ps_cols + 1]); $cpu = ($ps_cols >= 10 ) ? $row[2] . '%': 'N/A'; @data = ({ - main::key($num++,$i++) => '', - main::key($num++,'cpu') => $cpu, - main::key($num++,'command') => $command[0], + main::key($num++,1,2,$i++) => '', + main::key($num++,0,3,'cpu') => $cpu, + main::key($num++,1,3,'command') => $command[0], },); @processes = (@processes,@data); if ($command[1]) { - $processes[$j]{main::key($num++,'started by')} = $command[1]; + $processes[$j]{main::key($num++,0,4,'started by')} = $command[1]; } $pid = (defined $pid_col)? $row[$pid_col] : 'N/A'; - $processes[$j]{main::key($num++,'pid')} = $pid; + $processes[$j]{main::key($num++,0,3,'pid')} = $pid; if ($extra > 0 && $ps_cols >= 10){ my $decimals = ($row[5]/1024 > 10 ) ? 1 : 2; $mem = (defined $row[5]) ? sprintf( "%.${decimals}f", $row[5]/1024 ) . ' MiB' : 'N/A'; $mem .= ' (' . $row[3] . '%)'; - $processes[$j]{main::key($num++,'mem')} = $mem; + $processes[$j]{main::key($num++,0,3,'mem')} = $mem; } #print Data::Dumper::Dumper \@processes, "i: $i; j: $j "; } @@ -13395,7 +13406,7 @@ sub mem_processes { #my $header = "Memory MiB/% used - Command - pid$cpu_mem - top"; #my $header = "Top $count by Memory"; @data = ({ - main::key($num++,'Memory top') => "$count$throttled", + main::key($num++,1,1,'Memory top') => "$count$throttled" . ' of ' . scalar @ps_aux, },); @processes = (@processes,@data); my $i = 1; @@ -13413,19 +13424,19 @@ sub mem_processes { } my @command = process_starter(scalar @row, $row[$ps_cols],$row[$ps_cols + 1]); @data = ({ - main::key($num++,$i++) => '', - main::key($num++,'mem') => $mem, - main::key($num++,'command') => $command[0], + main::key($num++,1,2,$i++) => '', + main::key($num++,0,3,'mem') => $mem, + main::key($num++,1,3,'command') => $command[0], },); @processes = (@processes,@data); if ($command[1]) { - $processes[$j]{main::key($num++,'started by')} = $command[1]; + $processes[$j]{main::key($num++,0,4,'started by')} = $command[1]; } $pid = (defined $pid_col)? $row[$pid_col] : 'N/A'; - $processes[$j]{main::key($num++,'pid')} = $pid; + $processes[$j]{main::key($num++,0,3,'pid')} = $pid; if ($extra > 0 && $ps_cols >= 10){ $cpu = $row[2] . '%'; - $processes[$j]{main::key($num++,'cpu')} = $cpu; + $processes[$j]{main::key($num++,0,3,'cpu')} = $cpu; } #print Data::Dumper::Dumper \@processes, "i: $i; j: $j "; } @@ -13453,7 +13464,7 @@ sub throttled { my ($ps_count,$count,$j) = @_; my $throttled = ''; if ($count > $j){ - $throttled = " ( $j processes)"; + $throttled = " ( $j processes)"; # space to avoid emoji in irc } elsif ($count < $ps_count){ $throttled = " (throttled from $ps_count)"; @@ -13485,7 +13496,7 @@ sub get { @rows = create_output(); } if (!@rows && $key1){ - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } eval $end if $b_log; ($b_md,$b_zfs,@hardware_raid) = undef; @@ -13498,7 +13509,7 @@ sub create_output { my ($allocated,$available,$blocks_avail,$chunk_raid,$component_string,$raid, $ref2,$ref3,$report_size,$size,$status); my ($b_row_1_sizes); - my ($i,$j,$num,$status_id) = (0,0,0,0); + my ($cont_arr,$i,$ind_arr,$j,$num,$status_id) = (2,0,3,0,0,0); #print Data::Dumper::Dumper \@raid; if (@hardware_raid){ foreach my $ref (@hardware_raid){ @@ -13507,35 +13518,35 @@ sub create_output { my $device = ($row{'device'}) ? $row{'device'}: 'N/A'; my $driver = ($row{'driver'}) ? $row{'driver'}: 'N/A'; @data = ({ - main::key($num++,'Hardware') => $device, + main::key($num++,1,1,'Hardware') => $device, }); @rows = (@rows,@data); $j = scalar @rows - 1; - $rows[$j]{main::key($num++,'vendor')} = $row{'vendor'} if $row{'vendor'}; - $rows[$j]{main::key($num++,'driver')} = $driver; + $rows[$j]{main::key($num++,0,2,'vendor')} = $row{'vendor'} if $row{'vendor'}; + $rows[$j]{main::key($num++,1,2,'driver')} = $driver; if ($extra > 0){ my $driver_version = ($row{'driver-version'}) ? $row{'driver-version'}: 'N/A' ; - $rows[$j]{main::key($num++,'v')} = $driver_version; + $rows[$j]{main::key($num++,0,3,'v')} = $driver_version; if ($extra > 2){ my $port= ($row{'port'}) ? $row{'port'}: 'N/A' ; - $rows[$j]{main::key($num++,'port')} = $port; + $rows[$j]{main::key($num++,0,2,'port')} = $port; } my $bus_id = (defined $row{'bus-id'} && defined $row{'sub-id'}) ? "$row{'bus-id'}.$row{'sub-id'}": 'N/A' ; - $rows[$j]{main::key($num++,'bus ID')} = $bus_id; + $rows[$j]{main::key($num++,0,2,'bus ID')} = $bus_id; } if ($extra > 1){ my $chip_id = (defined $row{'vendor-id'} && defined $row{'chip-id'}) ? "$row{'vendor-id'}.$row{'chip-id'}": 'N/A' ; - $rows[$j]{main::key($num++,'chip ID')} = $chip_id; + $rows[$j]{main::key($num++,0,2,'chip ID')} = $chip_id; } if ($extra > 2){ my $rev= (defined $row{'rev'} && $row{'rev'}) ? $row{'rev'}: 'N/A' ; - $rows[$j]{main::key($num++,'rev')} = $rev; + $rows[$j]{main::key($num++,0,2,'rev')} = $rev; } } } if ($extra > 2 && $raid[0]{'system-supported'}){ @data = ({ - main::key($num++,'Supported md-raid types') => $raid[0]{'system-supported'}, + main::key($num++,0,1,'Supported md-raid types') => $raid[0]{'system-supported'}, }); @rows = (@rows,@data); } @@ -13546,9 +13557,9 @@ sub create_output { next if !%row; $num = 1; @data = ({ - main::key($num++,'Device') => $row{'id'}, - main::key($num++,'type') => $row{'type'}, - main::key($num++,'status') => $row{'status'}, + main::key($num++,1,1,'Device') => $row{'id'}, + main::key($num++,0,2,'type') => $row{'type'}, + main::key($num++,0,2,'status') => $row{'status'}, }); @rows = (@rows,@data); if ($row{'type'} eq 'mdraid'){ @@ -13583,28 +13594,30 @@ sub create_output { @arrays_holder = @arrays; if (($row{'type'} eq 'mdraid' && $extra == 0 ) || !defined $arrays[0]{'raid'} ){ $raid = (defined $arrays[0]{'raid'}) ? $arrays[0]{'raid'}: 'no-raid'; - $rows[$j]{main::key($num++,'raid')} = $raid; + $rows[$j]{main::key($num++,0,2,'raid')} = $raid; } if ( ( $row{'type'} eq 'zfs' || ($row{'type'} eq 'mdraid' && $extra == 0 ) ) && $size){ #print "here 0\n"; - $rows[$j]{main::key($num++,$report_size)} = $size; + $rows[$j]{main::key($num++,0,2,$report_size)} = $size; $size = ''; $b_row_1_sizes = 1; } if ( $row{'type'} eq 'zfs' && $available){ - $rows[$j]{main::key($num++,$blocks_avail)} = $available; + $rows[$j]{main::key($num++,0,2,$blocks_avail)} = $available; $available = ''; $b_row_1_sizes = 1; } if ( $row{'type'} eq 'zfs' && $allocated){ - $rows[$j]{main::key($num++,$chunk_raid)} = $allocated; + $rows[$j]{main::key($num++,0,2,$chunk_raid)} = $allocated; $allocated = ''; } $i = 0; my $count = scalar @arrays; foreach $ref3 (@arrays){ my %row2 = %$ref3; + ($cont_arr,$ind_arr) = (2,3); if ($count > 1){ + ($cont_arr,$ind_arr) = (3,4); $j = scalar @rows; $num = 1; @sizes = ($row2{'size'}) ? main::get_size($row2{'size'}) : (); @@ -13614,10 +13627,10 @@ sub create_output { $raid = (defined $row2{'raid'}) ? $row2{'raid'}: 'no-raid'; $status = ($row2{'status'}) ? $row2{'status'}: 'N/A'; @data = ({ - main::key($num++,'array') => $raid, - main::key($num++,'status') => $status, - main::key($num++,'size') => $size, - main::key($num++,'free') => $available, + main::key($num++,1,2,'Array') => $raid, + main::key($num++,0,3,'status') => $status, + main::key($num++,0,3,'size') => $size, + main::key($num++,0,3,'free') => $available, }); @rows = (@rows,@data); } @@ -13628,13 +13641,13 @@ sub create_output { $size = (@sizes) ? "$sizes[0] $sizes[1]" : ''; @sizes = ($row2{'free'}) ? main::get_size($row2{'free'}) : (); $available = (@sizes) ? "$sizes[0] $sizes[1]" : ''; - $rows[$j]{main::key($num++,'size')} = $size; - $rows[$j]{main::key($num++,'free')} = $available; + $rows[$j]{main::key($num++,0,2,'size')} = $size; + $rows[$j]{main::key($num++,0,2,'free')} = $available; if ($extra > 2){ @sizes = ($row{'allocated'}) ? main::get_size($row2{'allocated'}) : (); $allocated = (@sizes) ? "$sizes[0] $sizes[1]" : ''; if ($allocated){ - $rows[$j]{main::key($num++,$chunk_raid)} = $allocated; + $rows[$j]{main::key($num++,0,2,$chunk_raid)} = $allocated; } } } @@ -13660,36 +13673,36 @@ sub create_output { } } $component_string = (@components_good) ? join ' ', @components_good : 'N/A'; - $rows[$j]{main::key($num++,'Components')} = ''; - $rows[$j]{main::key($num++,'online')} = $component_string; + $rows[$j]{main::key($num++,1,$cont_arr,'Components')} = ''; + $rows[$j]{main::key($num++,0,$ind_arr,'online')} = $component_string; if (@failed){ - $rows[$j]{main::key($num++,'FAILED')} = join ' ', @failed; + $rows[$j]{main::key($num++,0,$ind_arr,'FAILED')} = join ' ', @failed; } if (@spare){ - $rows[$j]{main::key($num++,'spare')} = join ' ', @spare; + $rows[$j]{main::key($num++,0,$ind_arr,'spare')} = join ' ', @spare; } if ($row{'type'} eq 'mdraid' && $extra > 0 ){ $j = scalar @rows; $num = 1; #print Data::Dumper::Dumper \@arrays_holder; - $rows[$j]{main::key($num++,'Info')} = ''; + $rows[$j]{main::key($num++,1,$cont_arr,'Info')} = ''; $raid = (defined $arrays_holder[0]{'raid'}) ? $arrays_holder[0]{'raid'}: 'no-raid'; - $rows[$j]{main::key($num++,'raid')} = $raid; - $rows[$j]{main::key($num++,$blocks_avail)} = $available; + $rows[$j]{main::key($num++,0,$ind_arr,'raid')} = $raid; + $rows[$j]{main::key($num++,0,$ind_arr,$blocks_avail)} = $available; if ($size){ - $rows[$j]{main::key($num++,$report_size)} = $size; + $rows[$j]{main::key($num++,0,$ind_arr,$report_size)} = $size; } my $chunk = ($row{'chunk-size'}) ? $row{'chunk-size'}: 'N/A'; - $rows[$j]{main::key($num++,$chunk_raid)} = $chunk; + $rows[$j]{main::key($num++,0,$ind_arr,$chunk_raid)} = $chunk; if ($extra > 1){ if ($row{'bitmap'}){ - $rows[$j]{main::key($num++,'bitmap')} = $row{'bitmap'}; + $rows[$j]{main::key($num++,0,$ind_arr,'bitmap')} = $row{'bitmap'}; } if ($row{'super-block'}){ - $rows[$j]{main::key($num++,'super blocks')} = $row{'super-block'}; + $rows[$j]{main::key($num++,0,$ind_arr,'super blocks')} = $row{'super-block'}; } if ($row{'algorithm'}){ - $rows[$j]{main::key($num++,'algorithm')} = $row{'algorithm'}; + $rows[$j]{main::key($num++,0,$ind_arr,'algorithm')} = $row{'algorithm'}; } } } @@ -13702,16 +13715,16 @@ sub create_output { if ($extra > 1 && $row{'progress-bar'}){ $percent .= " $row{'progress-bar'}" } - $rows[$j]{main::key($num++,'Recovering')} = $percent; + $rows[$j]{main::key($num++,1,$cont_arr,'Recovering')} = $percent; my $finish = ($row{'recovery-finish'})?$row{'recovery-finish'} : 'N/A'; - $rows[$j]{main::key($num++,'time remaining')} = $finish; + $rows[$j]{main::key($num++,0,$ind_arr,'time remaining')} = $finish; if ($extra > 0){ if ($row{'sectors-recovered'}){ - $rows[$j]{main::key($num++,'sectors')} = $row{'sectors-recovered'}; + $rows[$j]{main::key($num++,0,$ind_arr,'sectors')} = $row{'sectors-recovered'}; } } if ($extra > 1 && $row{'recovery-speed'}){ - $rows[$j]{main::key($num++,'speed')} = $row{'recovery-speed'}; + $rows[$j]{main::key($num++,0,$ind_arr,'speed')} = $row{'recovery-speed'}; } } } @@ -13786,7 +13799,7 @@ sub mdraid_data { #$mdstat = "$ENV{'HOME'}/bin/scripts/inxi/data/raid/md-rebuild-1.txt"; #$mdstat = "$ENV{'HOME'}/bin/scripts/inxi/data/raid/md-2-mirror-fserver2-1.txt"; #$mdstat = "$ENV{'HOME'}/bin/scripts/inxi/data/raid/md-2-raid10-abucodonosor.txt"; - # $mdstat = "$ENV{'HOME'}/bin/scripts/inxi/data/raid/md-2-raid10-ant.txt"; + #$mdstat = "$ENV{'HOME'}/bin/scripts/inxi/data/raid/md-2-raid10-ant.txt"; my @working = main::reader($mdstat,'strip'); #print Data::Dumper::Dumper \@working; my (@data,@mdraid,@temp,$b_found,$system,$unused); @@ -14080,8 +14093,8 @@ sub get { $key1 = $$ref{'action'}; $val1 = $$ref{$key1}; @data = ({ - main::key($num++,'RAM Report') => '', - main::key($num++,$key1) => $val1, + main::key($num++,1,1,'RAM Report') => '', + main::key($num++,0,2,$key1) => $val1, }); @rows = (@rows,@data); } @@ -14094,8 +14107,8 @@ sub get { $key1 = 'message'; $val1 = main::row_defaults('ram-data'); @data = ({ - main::key($num++,'RAM Report') => '', - main::key($num++,$key1) => $val1, + main::key($num++,1,1,'RAM Report') => '', + main::key($num++,0,2,$key1) => $val1, }); } @rows = (@rows,@data); @@ -14119,22 +14132,22 @@ sub create_output { $b_non_system = ($ref{'use'} && lc($ref{'use'}) ne 'system memory') ? 1:0 ; $num = 1; @data = ({ - main::key($num++,'Array') => '', - main::key($num++,'capacity') => process_size($ref{'capacity'}), + main::key($num++,1,1,'Array') => '', + main::key($num++,1,2,'capacity') => process_size($ref{'capacity'}), }); @rows = (@rows,@data); if ($ref{'cap-qualifier'}){ - $rows[$j]{main::key($num++,'note')} = $ref{'cap-qualifier'}; + $rows[$j]{main::key($num++,0,3,'note')} = $ref{'cap-qualifier'}; } - $rows[$j]{main::key($num++,'use')} = $ref{'use'} if $b_non_system; - $rows[$j]{main::key($num++,'slots')} = $ref{'slots'}; + $rows[$j]{main::key($num++,0,2,'use')} = $ref{'use'} if $b_non_system; + $rows[$j]{main::key($num++,0,2,'slots')} = $ref{'slots'}; $ref{'eec'} ||= 'N/A'; - $rows[$j]{main::key($num++,'EC')} = $ref{'eec'}; + $rows[$j]{main::key($num++,0,2,'EC')} = $ref{'eec'}; if ($extra > 0 && (!$b_non_system || ( main::is_numeric($ref{'max-module-size'}) && $ref{'max-module-size'} > 10 ) ) ){ - $rows[$j]{main::key($num++,'max module size')} = process_size($ref{'max-module-size'}); + $rows[$j]{main::key($num++,1,2,'max module size')} = process_size($ref{'max-module-size'}); if ($ref{'mod-qualifier'}){ - $rows[$j]{main::key($num++,'note')} = $ref{'mod-qualifier'}; + $rows[$j]{main::key($num++,0,3,'note')} = $ref{'mod-qualifier'}; } } } @@ -14160,38 +14173,38 @@ sub create_output { next if ($show{'ram-modules'} && $mod{'size'} =~ /\D/); $mod{'locator'} ||= 'N/A'; @data = ({ - main::key($num++,'Device') => $mod{'locator'}, - main::key($num++,'size') => process_size($mod{'size'}), + main::key($num++,1,2,'Device') => $mod{'locator'}, + main::key($num++,0,3,'size') => process_size($mod{'size'}), }); @rows = (@rows,@data); next if ($mod{'size'} =~ /\D/); if ($extra > 1 && $mod{'type'} ){ - $rows[$j]{main::key($num++,'info')} = $mod{'type'}; + $rows[$j]{main::key($num++,0,3,'info')} = $mod{'type'}; } - $rows[$j]{main::key($num++,'speed')} = $mod{'speed'}; + $rows[$j]{main::key($num++,0,3,'speed')} = $mod{'speed'}; if ($extra > 0 ){ $mod{'device-type'} ||= 'N/A'; - $rows[$j]{main::key($num++,'type')} = $mod{'device-type'}; + $rows[$j]{main::key($num++,0,3,'type')} = $mod{'device-type'}; if ($extra > 2 && $mod{'device-type'} ne 'N/A'){ $mod{'device-type-detail'} ||= 'N/A'; - $rows[$j]{main::key($num++,'detail')} = $mod{'device-type-detail'}; + $rows[$j]{main::key($num++,0,3,'detail')} = $mod{'device-type-detail'}; } } if ($extra > 2 ){ $mod{'data-width'} ||= 'N/A'; - $rows[$j]{main::key($num++,'bus width')} = $mod{'data-width'}; + $rows[$j]{main::key($num++,0,3,'bus width')} = $mod{'data-width'}; $mod{'total-width'} ||= 'N/A'; - $rows[$j]{main::key($num++,'total')} = $mod{'total-width'}; + $rows[$j]{main::key($num++,0,3,'total')} = $mod{'total-width'}; } if ($extra > 1 ){ $mod{'manufacturer'} ||= 'N/A'; - $rows[$j]{main::key($num++,'manufacturer')} = $mod{'manufacturer'}; + $rows[$j]{main::key($num++,0,3,'manufacturer')} = $mod{'manufacturer'}; $mod{'part-number'} ||= 'N/A'; - $rows[$j]{main::key($num++,'part-no')} = $mod{'part-number'}; + $rows[$j]{main::key($num++,0,3,'part-no')} = $mod{'part-number'}; } if ($extra > 2 ){ $mod{'serial'} = main::apply_filter($mod{'serial'}); - $rows[$j]{main::key($num++,'serial')} = $mod{'serial'}; + $rows[$j]{main::key($num++,0,3,'serial')} = $mod{'serial'}; } } } @@ -14200,11 +14213,11 @@ sub create_output { $num = 1; $type_holder ||= 'N/A'; @data = ({ - main::key($num++,'Report') => '', - main::key($num++,'arrays') => $arrays, - main::key($num++,'slots') => $slots, - main::key($num++,'modules') => $modules, - main::key($num++,'type') => $type_holder, + main::key($num++,1,1,'Report') => '', + main::key($num++,0,2,'arrays') => $arrays, + main::key($num++,0,2,'slots') => $slots, + main::key($num++,0,2,'modules') => $modules, + main::key($num++,0,2,'type') => $type_holder, }); @rows = (@rows,@data); } @@ -14678,7 +14691,7 @@ sub get { if (!@rows){ my $pm = (!$bsd_type) ? 'package manager': 'OS type'; @data = ( - {main::key($num++,'Alert') => "No repo data detected. Does $self_name support your $pm?"}, + {main::key($num++,0,1,'Alert') => "No repo data detected. Does $self_name support your $pm?"}, ); @rows = (@data); } @@ -14805,7 +14818,7 @@ sub get_repos_linux { $key = repo_data('missing','apt'); } @data = ( - {main::key($num++,$key) => $file}, + {main::key($num++,1,1,$key) => $file}, [@apt_urls], ); @rows = (@rows,@data); @@ -14842,7 +14855,7 @@ sub get_repos_linux { # set it so the debugger knows the file wasn't there push @dbg_files, $_ if $debugger_dir; @data = ( - {main::key($num++,'File listed in') => $pacman}, + {main::key($num++,1,1,'File listed in') => $pacman}, [("$_ does not seem to exist.")], ); @rows = (@rows,@data); @@ -14850,7 +14863,7 @@ sub get_repos_linux { } if (!@rows){ @data = ( - {main::key($num++,repo_data('missing','files')) => $pacman }, + {main::key($num++,0,1,repo_data('missing','files')) => $pacman }, ); @rows = (@rows,@data); } @@ -14900,7 +14913,7 @@ sub get_repos_linux { $key = repo_data('active','slackpkg+'); } @data = ( - {main::key($num++,$key) => $slackpkg_plus}, + {main::key($num++,1,1,$key) => $slackpkg_plus}, [@content], ); @data = url_cleaner(@data); @@ -14972,7 +14985,7 @@ sub get_repos_linux { $key = repo_data('active',$repo); } @data = ( - {main::key($num++,$key) => $_}, + {main::key($num++,1,1,$key) => $_}, [@content], ); @rows = (@rows,@data); @@ -15036,7 +15049,7 @@ sub get_repos_linux { $key = repo_data('active','portage'); } @data = ( - {main::key($num++,$key) => $_}, + {main::key($num++,1,1,$key) => $_}, [@content], ); @rows = (@rows,@data); @@ -15067,7 +15080,7 @@ sub get_repos_linux { $key = repo_data('active','cards'); } @data = ( - {main::key($num++,$key) => $cards}, + {main::key($num++,1,1,$key) => $cards}, [@content], ); @rows = (@rows,@data); @@ -15119,7 +15132,7 @@ sub get_repos_linux { # get the repo $repo = $2; @data = ( - {main::key($num++,'urpmq repo') => $repo}, + {main::key($num++,1,1,'urpmq repo') => $repo}, [@content], ); @rows = (@rows,@data); @@ -15165,7 +15178,7 @@ sub get_repos_linux { @content = url_cleaner(@content); $key = repo_data('active',$which); @data = ( - {main::key($num++,$key) => $repo}, + {main::key($num++,1,1,$key) => $repo}, [@content], ); @rows = (@rows,@data); @@ -15178,7 +15191,7 @@ sub get_repos_linux { @content = url_cleaner(@content); $key = repo_data('active',$which); @data = ( - {main::key($num++,$key) => $repo}, + {main::key($num++,1,1,$key) => $repo}, [@content], ); @rows = (@rows,@data); @@ -15251,7 +15264,7 @@ sub get_repos_bsd { $key = repo_data('active','bsd-package'); } @data = ( - {main::key($num++,$key) => $_}, + {main::key($num++,1,1,$key) => $_}, [@data3], ); @rows = (@rows,@data); @@ -15291,7 +15304,7 @@ sub get_repos_bsd { $key = repo_data('missing','bsd-files'); } @data = ( - {main::key($num++,'Message') => $key}, + {main::key($num++,0,1,'Message') => $key}, [()], ); @rows = (@rows,@data); @@ -15378,7 +15391,7 @@ sub repo_builder { @content = url_cleaner(@content); } @data = ( - {main::key($num++,$key) => $file}, + {main::key($num++,1,1,$key) => $file}, [@content], ); eval $end if $b_log; @@ -15430,7 +15443,7 @@ sub get { $key1 = 'Message'; $val1 = main::row_defaults('sensors-data-ipmi'); #$val1 = main::row_defaults('dev'); - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); } @rows = (@rows,@data); $source = 'lm-sensors'; # trips per sensor type output @@ -15438,7 +15451,7 @@ sub get { else { $key1 = 'Permissions'; $val1 = main::row_defaults('sensors-ipmi-root'); - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); @rows = (@rows,@data); } } @@ -15448,7 +15461,7 @@ sub get { $key1 = $$ref{'action'}; $val1 = $$ref{$key1}; $key1 = ucfirst($key1); - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); @rows = (@rows,@data); } else { @@ -15458,7 +15471,7 @@ sub get { if (!@data) { $key1 = 'Message'; $val1 = main::row_defaults('sensors-data-linux'); - @data = ({main::key($num++,$key1) => $val1,}); + @data = ({main::key($num++,0,1,$key1) => $val1,}); } @rows = (@rows,@data); } @@ -15483,38 +15496,38 @@ sub create_output { my $cpu1_key = ($sensors{'cpu2-temp'}) ? 'cpu-1': 'cpu' ; $data_source = $source if ($source eq 'ipmi' || $source eq 'lm-sensors'); @data = ({ - main::key($num++,'System Temperatures') => $data_source, - main::key($num++,$cpu1_key) => $cpu_temp, + main::key($num++,1,1,'System Temperatures') => $data_source, + main::key($num++,0,2,$cpu1_key) => $cpu_temp, }); @rows = (@rows,@data); if ($sensors{'cpu2-temp'}){ - $rows[$j]{main::key($num++,'cpu-2')} = $sensors{'cpu2-temp'} . $temp_unit; + $rows[$j]{main::key($num++,0,2,'cpu-2')} = $sensors{'cpu2-temp'} . $temp_unit; } if ($sensors{'cpu3-temp'}){ - $rows[$j]{main::key($num++,'cpu-3')} = $sensors{'cpu3-temp'} . $temp_unit; + $rows[$j]{main::key($num++,0,2,'cpu-3')} = $sensors{'cpu3-temp'} . $temp_unit; } if ($sensors{'cpu4-temp'}){ - $rows[$j]{main::key($num++,'cpu-4')} = $sensors{'cpu4-temp'} . $temp_unit; + $rows[$j]{main::key($num++,0,2,'cpu-4')} = $sensors{'cpu4-temp'} . $temp_unit; } - $rows[$j]{main::key($num++,'mobo')} = $mobo_temp; + $rows[$j]{main::key($num++,0,2,'mobo')} = $mobo_temp; if (defined $sensors{'sodimm-temp'}){ my $sodimm_temp = $sensors{'sodimm-temp'} . $temp_unit; - $rows[$j]{main::key($num++,'sodimm')} = $sodimm_temp; + $rows[$j]{main::key($num++,0,2,'sodimm')} = $sodimm_temp; } if (defined $sensors{'psu-temp'}){ my $psu_temp = $sensors{'psu-temp'} . $temp_unit; - $rows[$j]{main::key($num++,'psu')} = $psu_temp; + $rows[$j]{main::key($num++,0,2,'psu')} = $psu_temp; } if (defined $sensors{'ambient-temp'}){ my $ambient_temp = $sensors{'ambient-temp'} . $temp_unit; - $rows[$j]{main::key($num++,'ambient')} = $ambient_temp; + $rows[$j]{main::key($num++,0,2,'ambient')} = $ambient_temp; } if (scalar @gpu == 1 && defined $gpu[0]{'temp'}){ my $gpu_temp = $gpu[0]{'temp'}; my $gpu_type = $gpu[0]{'type'}; my $gpu_unit = (defined $gpu[0]{'temp-unit'} && $gpu_temp ) ? " $gpu[0]{'temp-unit'}" : ' C'; - $rows[$j]{main::key($num++,'gpu')} = $gpu_type; - $rows[$j]{main::key($num++,'temp')} = $gpu_temp . $gpu_unit; + $rows[$j]{main::key($num++,1,2,'gpu')} = $gpu_type; + $rows[$j]{main::key($num++,0,3,'temp')} = $gpu_temp . $gpu_unit; } $j = scalar @rows; my $ref_main = $sensors{'fan-main'}; @@ -15525,49 +15538,49 @@ sub create_output { if (!@fan_main && !@fan_default){ $fan_def = ($fan_def) ? "$data_source N/A" : 'N/A'; } - $rows[$j]{main::key($num++,'Fan Speeds (RPM)')} = $fan_def; + $rows[$j]{main::key($num++,1,1,'Fan Speeds (RPM)')} = $fan_def; my $b_cpu = 0; for (my $i = 0; $i < scalar @fan_main; $i++){ next if $i == 0;# starts at 1, not 0 if (defined $fan_main[$i]){ if ($i == 1 || ($i == 2 && !$b_cpu )){ - $rows[$j]{main::key($num++,'cpu')} = $fan_main[$i]; + $rows[$j]{main::key($num++,0,2,'cpu')} = $fan_main[$i]; $b_cpu = 1; } elsif ($i == 2 && $b_cpu){ - $rows[$j]{main::key($num++,'mobo')} = $fan_main[$i]; + $rows[$j]{main::key($num++,0,2,'mobo')} = $fan_main[$i]; } elsif ($i == 3){ - $rows[$j]{main::key($num++,'psu')} = $fan_main[$i]; + $rows[$j]{main::key($num++,0,2,'psu')} = $fan_main[$i]; } elsif ($i == 4){ - $rows[$j]{main::key($num++,'sodimm')} = $fan_main[$i]; + $rows[$j]{main::key($num++,0,2,'sodimm')} = $fan_main[$i]; } elsif ($i > 4){ $fan_number = $i - 4; - $rows[$j]{main::key($num++,"case-$fan_number")} = $fan_main[$i]; + $rows[$j]{main::key($num++,0,2,"case-$fan_number")} = $fan_main[$i]; } } } for (my $i = 0; $i < scalar @fan_default; $i++){ next if $i == 0;# starts at 1, not 0 if (defined $fan_default[$i]){ - $rows[$j]{main::key($num++,"fan-$i")} = $fan_default[$i]; + $rows[$j]{main::key($num++,0,2,"fan-$i")} = $fan_default[$i]; } } - $rows[$j]{main::key($num++,'psu')} = $sensors{'fan-psu'} if defined $sensors{'fan-psu'}; - $rows[$j]{main::key($num++,'psu-1')} = $sensors{'fan-psu1'} if defined $sensors{'fan-psu1'}; - $rows[$j]{main::key($num++,'psu-2')} = $sensors{'fan-psu2'} if defined $sensors{'fan-psu2'}; + $rows[$j]{main::key($num++,0,2,'psu')} = $sensors{'fan-psu'} if defined $sensors{'fan-psu'}; + $rows[$j]{main::key($num++,0,2,'psu-1')} = $sensors{'fan-psu1'} if defined $sensors{'fan-psu1'}; + $rows[$j]{main::key($num++,0,2,'psu-2')} = $sensors{'fan-psu2'} if defined $sensors{'fan-psu2'}; # note: so far, only nvidia-settings returns speed, and that's in percent if (scalar @gpu == 1 && defined $gpu[0]{'fan-speed'}){ my $gpu_fan = $gpu[0]{'fan-speed'} . $gpu[0]{'speed-unit'}; my $gpu_type = $gpu[0]{'type'}; - $rows[$j]{main::key($num++,'gpu')} = $gpu_type; - $rows[$j]{main::key($num++,'fan')} = $gpu_fan; + $rows[$j]{main::key($num++,1,2,'gpu')} = $gpu_type; + $rows[$j]{main::key($num++,0,3,'fan')} = $gpu_fan; } if (scalar @gpu > 1){ $j = scalar @rows; - $rows[$j]{main::key($num++,'GPU')} = ''; + $rows[$j]{main::key($num++,1,1,'GPU')} = ''; my $gpu_unit = (defined $gpu[0]{'temp-unit'} ) ? " $gpu[0]{'temp-unit'}" : ' C'; foreach my $ref (@gpu){ my %info = %$ref; @@ -15575,13 +15588,13 @@ sub create_output { my $gpu_fan = (defined $info{'fan-speed'}) ? $info{'fan-speed'} . $info{'speed-unit'}: undef ; my $gpu_type = $info{'type'}; my $gpu_temp = (defined $info{'temp'} ) ? $info{'temp'} . $gpu_unit: 'N/A'; - $rows[$j]{main::key($num++,'device')} = $gpu_type; + $rows[$j]{main::key($num++,1,2,'device')} = $gpu_type; if (defined $info{'screen'} ){ - $rows[$j]{main::key($num++,'screen')} = $info{'screen'}; + $rows[$j]{main::key($num++,0,3,'screen')} = $info{'screen'}; } - $rows[$j]{main::key($num++,'temp')} = $gpu_temp; + $rows[$j]{main::key($num++,0,3,'temp')} = $gpu_temp; if (defined $gpu_fan){ - $rows[$j]{main::key($num++,'fan')} = $gpu_fan; + $rows[$j]{main::key($num++,0,3,'fan')} = $gpu_fan; } } } @@ -15592,18 +15605,18 @@ sub create_output { $sensors{'volts-5'} ||= 'N/A'; $sensors{'volts-3.3'} ||= 'N/A'; $sensors{'volts-vbat'} ||= 'N/A'; - $rows[$j]{main::key($num++,'Voltages')} = $data_source; - $rows[$j]{main::key($num++,'12v')} = $sensors{'volts-12'}; - $rows[$j]{main::key($num++,'5v')} = $sensors{'volts-5'}; - $rows[$j]{main::key($num++,'3.3v')} = $sensors{'volts-3.3'}; - $rows[$j]{main::key($num++,'vbat')} = $sensors{'volts-vbat'}; + $rows[$j]{main::key($num++,1,1,'Voltages')} = $data_source; + $rows[$j]{main::key($num++,0,2,'12v')} = $sensors{'volts-12'}; + $rows[$j]{main::key($num++,0,2,'5v')} = $sensors{'volts-5'}; + $rows[$j]{main::key($num++,0,2,'3.3v')} = $sensors{'volts-3.3'}; + $rows[$j]{main::key($num++,0,2,'vbat')} = $sensors{'volts-vbat'}; if ($extra > 1 && $source eq 'ipmi' ){ $sensors{'volts-dimm-p1'} ||= 'N/A'; $sensors{'volts-dimm-p2'} ||= 'N/A'; - $rows[$j]{main::key($num++,'dimm-p1')} = $sensors{'volts-dimm-p1'} if $sensors{'volts-dimm-p1'}; - $rows[$j]{main::key($num++,'dimm-p2')} = $sensors{'volts-dimm-p2'} if $sensors{'volts-dimm-p2'}; - $rows[$j]{main::key($num++,'soc-p1')} = $sensors{'volts-soc-p1'} if $sensors{'volts-soc-p1'}; - $rows[$j]{main::key($num++,'soc-p2')} = $sensors{'volts-soc-p2'} if $sensors{'volts-soc-p2'}; + $rows[$j]{main::key($num++,0,2,'dimm-p1')} = $sensors{'volts-dimm-p1'} if $sensors{'volts-dimm-p1'}; + $rows[$j]{main::key($num++,0,2,'dimm-p2')} = $sensors{'volts-dimm-p2'} if $sensors{'volts-dimm-p2'}; + $rows[$j]{main::key($num++,0,2,'soc-p1')} = $sensors{'volts-soc-p1'} if $sensors{'volts-soc-p1'}; + $rows[$j]{main::key($num++,0,2,'soc-p2')} = $sensors{'volts-soc-p2'} if $sensors{'volts-soc-p2'}; } } eval $end if $b_log; @@ -16389,13 +16402,13 @@ sub get { elsif ($b_arm && !$b_slot_tool){ $key1 = 'ARM'; $val1 = main::row_defaults('arm-pci',''); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } elsif ( $$ref{'action'} ne 'use'){ $key1 = $$ref{'action'}; $val1 = $$ref{$key1}; $key1 = ucfirst($key1); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } eval $end if $b_log; return @rows; @@ -16443,14 +16456,14 @@ sub slot_data { } @data = ( { - main::key($num++,'Slot') => $id, - main::key($num++,'type') => $type, - main::key($num++,'status') => $usage, + main::key($num++,1,1,'Slot') => $id, + main::key($num++,0,2,'type') => $type, + main::key($num++,0,2,'status') => $usage, }, ); @rows = (@rows,@data); if ($extra > 1 ){ - $rows[$j]{main::key($num++,'length')} = $length; + $rows[$j]{main::key($num++,0,2,'length')} = $length; } } } @@ -16458,7 +16471,7 @@ sub slot_data { if (!@rows){ my $key = 'Message'; @data = ({ - main::key($num++,$key) => main::row_defaults('pci-slot-data',''), + main::key($num++,0,1,$key) => main::row_defaults('pci-slot-data',''), },); @rows = (@rows,@data); } @@ -16478,7 +16491,7 @@ sub get { @rows =create_output(); if (!@rows){ @data = ( - {main::key($num++,'Alert') => main::row_defaults('swap-data')}, + {main::key($num++,0,1,'Alert') => main::row_defaults('swap-data')}, ); @rows = (@data); } @@ -16505,22 +16518,22 @@ sub create_output { if ($b_admin && !$bsd_type && $j == 0){ $j = scalar @rows; if (defined $row{'swappiness'} || defined $row{'cache-pressure'}){ - $rows[$j]{main::key($num++,'Kernel')} = ''; + $rows[$j]{main::key($num++,1,1,'Kernel')} = ''; if (defined $row{'swappiness'}){ - $rows[$j]{main::key($num++,'swappiness')} = $row{'swappiness'}; + $rows[$j]{main::key($num++,0,2,'swappiness')} = $row{'swappiness'}; } if (defined $row{'cache-pressure'}){ - $rows[$j]{main::key($num++,'cache pressure')} = $row{'cache-pressure'}; + $rows[$j]{main::key($num++,0,2,'cache pressure')} = $row{'cache-pressure'}; } } else { - $rows[$j]{main::key($num++,'Message')} = main::row_defaults('swap-admin'); + $rows[$j]{main::key($num++,0,1,'Message')} = main::row_defaults('swap-admin'); } } $j = scalar @rows; @data = ({ - main::key($num++,'ID') => $row{'id'}, - main::key($num++,'type') => $row{'swap-type'}, + main::key($num++,1,1,'ID') => $row{'id'}, + main::key($num++,0,2,'type') => $row{'swap-type'}, }); @rows = (@rows,@data); # not used for swap as far as I know @@ -16533,32 +16546,32 @@ sub create_output { @data2 = main::get_size($row{'raw-size'}); $raw_size = (@data2) ? $data2[0] . ' ' . $data2[1]: 'N/A'; } - $rows[$j]{main::key($num++,'raw size')} = $raw_size; + $rows[$j]{main::key($num++,0,2,'raw size')} = $raw_size; } # not used for swap as far as I know if ($b_admin && $row{'raw-available'} && $size ne 'N/A'){ $size .= ' (' . $row{'raw-available'} . '%)'; } - $rows[$j]{main::key($num++,'size')} = $size; - $rows[$j]{main::key($num++,'used')} = $used . $percent; + $rows[$j]{main::key($num++,0,2,'size')} = $size; + $rows[$j]{main::key($num++,0,2,'used')} = $used . $percent; # not used for swap as far as I know if ($b_admin && $row{'block-size'}){ - $rows[$j]{main::key($num++,'block size')} = $row{'block-size'} . ' B';; - #$rows[$j]{main::key($num++,'physical')} = $row{'block-size'} . ' B'; - #$rows[$j]{main::key($num++,'logical')} = $row{'block-logical'} . ' B'; + $rows[$j]{main::key($num++,0,2,'block size')} = $row{'block-size'} . ' B';; + #$rows[$j]{main::key($num++,0,2,'physical')} = $row{'block-size'} . ' B'; + #$rows[$j]{main::key($num++,0,2,'logical')} = $row{'block-logical'} . ' B'; } if ($extra > 1 && defined $row{'priority'}){ - $rows[$j]{main::key($num++,'priority')} = $row{'priority'}; + $rows[$j]{main::key($num++,0,2,'priority')} = $row{'priority'}; } $row{'mount'} =~ s|/home/[^/]+/(.*)|/home/$filter_string/$1| if $row{'mount'} && $use{'filter'}; - $rows[$j]{main::key($num++,$dev)} = ($row{'mount'}) ? $row{'mount'} : 'N/A'; + $rows[$j]{main::key($num++,0,2,$dev)} = ($row{'mount'}) ? $row{'mount'} : 'N/A'; if ($show{'label'} && ($row{'label'} || $row{'swap-type'} eq 'partition') ){ $row{'label'} = main::apply_partition_filter('part', $row{'label'}, '') if $use{'filter-label'}; - $rows[$j]{main::key($num++,'label')} = ($row{'label'}) ? $row{'label'}: 'N/A'; + $rows[$j]{main::key($num++,0,2,'label')} = ($row{'label'}) ? $row{'label'}: 'N/A'; } if ($show{'uuid'} && ($row{'uuid'} || $row{'swap-type'} eq 'partition' )){ $row{'uuid'} = main::apply_partition_filter('part', $row{'uuid'}, '') if $use{'filter-uuid'}; - $rows[$j]{main::key($num++,'uuid')} = ($row{'uuid'}) ? $row{'uuid'}: 'N/A'; + $rows[$j]{main::key($num++,0,2,'uuid')} = ($row{'uuid'}) ? $row{'uuid'}: 'N/A'; } } eval $end if $b_log; @@ -16596,7 +16609,7 @@ sub get { } } if (!@rows && $key1){ - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } eval $end if $b_log; return @rows; @@ -16626,11 +16639,11 @@ sub create_output { $row{'label'} = main::apply_partition_filter('part', $row{'label'}, '') if $use{'filter-label'}; $row{'uuid'} = main::apply_partition_filter('part', $row{'uuid'}, '') if $use{'filter-uuid'}; @data = ({ - main::key($num++,'ID') => "/dev/$row{'dev-base'}", - main::key($num++,'size') => $size, - main::key($num++,'fs') => $fs, - main::key($num++,'label') => $row{'label'}, - main::key($num++,'uuid') => $row{'uuid'}, + main::key($num++,1,1,'ID') => "/dev/$row{'dev-base'}", + main::key($num++,0,2,'size') => $size, + main::key($num++,0,2,'fs') => $fs, + main::key($num++,0,2,'label') => $row{'label'}, + main::key($num++,0,2,'uuid') => $row{'uuid'}, }); @rows = (@rows,@data); } @@ -16771,14 +16784,14 @@ sub get { $val1 = $$ref2{$key1}; } $key1 = ucfirst($key1); - @rows = ({main::key($num++,$key1) => $val1,}); + @rows = ({main::key($num++,0,1,$key1) => $val1,}); } else { @rows = usb_data(); if (!@rows){ my $key = 'Message'; @data = ({ - main::key($num++,$key) => main::row_defaults('usb-data',''), + main::key($num++,0,1,$key) => main::row_defaults('usb-data',''), },); @rows = (@rows,@data); } @@ -16790,7 +16803,7 @@ sub usb_data { eval $start if $b_log; return if ! @usb; my (@data,@rows); - my ($b_hub,$bus_id,$chip_id,$driver,$path_id,$ports,$product,$serial,$speed,$type); + my ($b_hub,$bus_id,$chip_id,$driver,$ind_sc,$path_id,$ports,$product,$serial,$speed,$type); my $num = 0; my $j = 0; # note: the data has been presorted in set_lsusb_data by: @@ -16798,9 +16811,8 @@ sub usb_data { foreach my $ref (@usb){ my @id = @$ref; $j = scalar @rows; - $num = 1; + ($b_hub,$ind_sc,$num) = (0,3,1); $chip_id = $id[7]; - $b_hub = 0; ($driver,$path_id,$ports,$product, $serial,$speed,$type) = ('','','','','','',''); $speed = ( main::is_numeric($id[8]) ) ? sprintf("%1.1f",$id[8]) : $id[8] if $id[8]; @@ -16816,13 +16828,14 @@ sub usb_data { $ports ||= 'N/A'; #print "pt0:$protocol\n"; @data = ({ - main::key($num++,'Hub') => $bus_id, - main::key($num++,'info') => $product, - main::key($num++,'ports') => $ports, - main::key($num++,'rev') => $speed, + main::key($num++,1,1,'Hub') => $bus_id, + main::key($num++,0,2,'info') => $product, + main::key($num++,0,2,'ports') => $ports, + main::key($num++,0,2,'rev') => $speed, },); @rows = (@rows,@data); $b_hub = 1; + $ind_sc =2; } # it's a device else { @@ -16831,29 +16844,30 @@ sub usb_data { $type ||= 'N/A'; $driver ||= 'N/A'; #print "pt3:$class:$product\n"; - $rows[$j]{main::key($num++,'Device')} = $bus_id; - $rows[$j]{main::key($num++,'info')} = $product; - $rows[$j]{main::key($num++,'type')} = $type; + $rows[$j]{main::key($num++,1,2,'Device')} = $bus_id; + $rows[$j]{main::key($num++,0,3,'info')} = $product; + $rows[$j]{main::key($num++,0,3,'type')} = $type; if ($extra > 0){ - $rows[$j]{main::key($num++,'driver')} = $driver; + $rows[$j]{main::key($num++,0,3,'driver')} = $driver; } if ($extra > 2 && $id[9]){ - $rows[$j]{main::key($num++,'interfaces')} = $id[9]; + $rows[$j]{main::key($num++,0,3,'interfaces')} = $id[9]; } - $rows[$j]{main::key($num++,'rev')} = $speed; + $rows[$j]{main::key($num++,0,3,'rev')} = $speed; } + # for either hub or device if ($extra > 2 && main::is_numeric($id[17])){ my $speed = $id[17]; if ($speed >= 1000) {$speed = ($id[17] / 1000 ) . " Gb/s"} else {$speed = $id[17] . " Mb/s"} - $rows[$j]{main::key($num++,'speed')} = $speed; + $rows[$j]{main::key($num++,0,$ind_sc,'speed')} = $speed; } if ($extra > 1){ - $rows[$j]{main::key($num++,'chip ID')} = $chip_id; + $rows[$j]{main::key($num++,0,$ind_sc,'chip ID')} = $chip_id; } if (!$b_hub && $extra > 2){ if ($serial){ - $rows[$j]{main::key($num++,'serial')} = main::apply_filter($serial); + $rows[$j]{main::key($num++,0,$ind_sc,'serial')} = main::apply_filter($serial); } } } @@ -16878,7 +16892,7 @@ sub get { } sub create_output { eval $start if $b_log; - my $num = 0; + my ($j,$num) = (0,0); my (@data,@location,@rows,$value,%weather,); my ($conditions) = ('NA'); if ($show{'weather-location'}){ @@ -16903,99 +16917,110 @@ sub create_output { @location = get_location(); if (!$location[0]) { return @rows = ({ - main::key($num++,'Message') => main::row_defaults('weather-null','current location'), + main::key($num++,0,1,'Message') => main::row_defaults('weather-null','current location'), }); } } %weather = get_weather(@location); if ($weather{'error'}) { return @rows = ({ - main::key($num++,'Message') => main::row_defaults('weather-error',$weather{'error'}), + main::key($num++,0,1,'Message') => main::row_defaults('weather-error',$weather{'error'}), }); } if (!$weather{'weather'}) { return @rows = ({ - main::key($num++,'Message') => main::row_defaults('weather-null','weather data'), + main::key($num++,0,1,'Message') => main::row_defaults('weather-null','weather data'), }); } $conditions = "$weather{'weather'}"; my $temp = unit_output($weather{'temp'},$weather{'temp-c'},'C',$weather{'temp-f'},'F'); + $j = scalar @rows; @data = ({ - main::key($num++,'Temperature') => $temp, - main::key($num++,'Conditions') => $conditions, + main::key($num++,1,1,'Report') => '', + main::key($num++,0,2,'temperature') => $temp, + main::key($num++,0,2,'conditions') => $conditions, },); @rows = (@rows,@data); if ($extra > 0){ my $pressure = unit_output($weather{'pressure'},$weather{'pressure-mb'},'mb',$weather{'pressure-in'},'in'); my $wind = wind_output($weather{'wind'},$weather{'wind-direction'},$weather{'wind-mph'},$weather{'wind-ms'}, $weather{'wind-gust-mph'},$weather{'wind-gust-ms'}); - $rows[0]{main::key($num++,'Wind')} = $wind; + $rows[$j]{main::key($num++,0,2,'wind')} = $wind; if ($extra > 1){ if (defined $weather{'cloud-cover'}){ - $rows[0]{main::key($num++,'Cloud Cover')} = $weather{'cloud-cover'} . '%'; + $rows[$j]{main::key($num++,0,2,'cloud cover')} = $weather{'cloud-cover'} . '%'; } if ($weather{'precip-1h-mm'} && defined $weather{'precip-1h-in'} ){ $value = unit_output('',$weather{'precip-1h-mm'},'mm',$weather{'precip-1h-in'},'in'); - $rows[0]{main::key($num++,'Precipitation')} = $value; + $rows[$j]{main::key($num++,0,2,'precipitation')} = $value; } if ($weather{'rain-1h-mm'} && defined $weather{'rain-1h-in'} ){ $value = unit_output('',$weather{'rain-1h-mm'},'mm',$weather{'rain-1h-in'},'in'); - $rows[0]{main::key($num++,'Rain')} = $value; + $rows[$j]{main::key($num++,0,2,'rain')} = $value; } if ($weather{'snow-1h-mm'} && defined $weather{'snow-1h-in'} ){ $value = unit_output('',$weather{'snow-1h-mm'},'mm',$weather{'snow-1h-in'},'in'); - $rows[0]{main::key($num++,'Snow')} = $value; + $rows[$j]{main::key($num++,0,2,'snow')} = $value; } } - $rows[0]{main::key($num++,'Humidity')} = $weather{'humidity'} . '%'; + $rows[$j]{main::key($num++,0,2,'humidity')} = $weather{'humidity'} . '%'; if ($extra > 1){ if ($weather{'dewpoint'} || (defined $weather{'dewpoint-c'} && defined $weather{'dewpoint-f'})){ $value = unit_output($weather{'dewpoint'},$weather{'dewpoint-c'},'C',$weather{'dewpoint-f'},'F'); - $rows[0]{main::key($num++,'Dew Point')} = $value; + $rows[$j]{main::key($num++,0,2,'dew point')} = $value; } } - $rows[0]{main::key($num++,'Pressure')} = $pressure; + $rows[$j]{main::key($num++,0,2,'pressure')} = $pressure; } if ($extra > 1){ if ($weather{'heat-index'} || (defined $weather{'heat-index-c'} && defined $weather{'heat-index-f'})){ $value = unit_output($weather{'heat-index'},$weather{'heat-index-c'},'C',$weather{'heat-index-f'},'F'); - $rows[0]{main::key($num++,'Heat Index')} = $value; + $rows[$j]{main::key($num++,0,2,'heat index')} = $value; } if ($weather{'windchill'} || (defined $weather{'windchill-c'} && defined $weather{'windchill-f'})){ $value = unit_output($weather{'windchill'},$weather{'windchill-c'},'C',$weather{'windchill-f'},'F'); - $rows[0]{main::key($num++,'Wind Chill')} = $value; + $rows[$j]{main::key($num++,0,2,'wind chill')} = $value; } - } - if ($extra > 2){ - if (!$use{'filter'}){ - $rows[0]{main::key($num++,'Location')} = complete_location($location[1],$weather{'city'},$weather{'state'},$weather{'country'}); - if ($weather{'elevation-m'} || $weather{'elevation-ft'}){ - $rows[0]{main::key($num++,'altitude')} = elevation_output($weather{'elevation-m'},$weather{'elevation-ft'}); + if ($extra > 2){ + if ($weather{'forecast'}){ + $j = scalar @rows; + @data = ({ + main::key($num++,1,1,'Forecast') => $weather{'forecast'}, + },); + @rows = (@rows,@data); } } } - $rows[0]{main::key($num++,'Current Time')} = $weather{'date-time'}; + $j = scalar @rows; + my $location = ''; + if ($extra > 2 && !$use{'filter'}){ + $location = complete_location($location[1],$weather{'city'},$weather{'state'},$weather{'country'}); + } + @data = ({ + main::key($num++,1,1,'Locale') => $location, + },); + @rows = (@rows,@data); + if ($extra > 2 && !$use{'filter'} && ($weather{'elevation-m'} || $weather{'elevation-ft'} )){ + $rows[$j]{main::key($num++,0,2,'altitude')} = elevation_output($weather{'elevation-m'},$weather{'elevation-ft'}); + } + $rows[$j]{main::key($num++,0,2,'current time')} = $weather{'date-time'},; if ($extra > 2){ $weather{'observation-time-local'} = 'N/A' if !$weather{'observation-time-local'}; - $rows[0]{main::key($num++,'Observation Time')} = $weather{'observation-time-local'}; + $rows[$j]{main::key($num++,0,2,'observation time')} = $weather{'observation-time-local'}; if ($weather{'sunrise'}){ - $rows[0]{main::key($num++,'Sunrise')} = $weather{'sunrise'}; + $rows[$j]{main::key($num++,0,2,'sunrise')} = $weather{'sunrise'}; } if ($weather{'sunset'}){ - $rows[0]{main::key($num++,'Sunset')} = $weather{'sunset'}; + $rows[$j]{main::key($num++,0,2,'sunset')} = $weather{'sunset'}; } if ($weather{'moonphase'}){ $value = $weather{'moonphase'} . '%'; $value .= ($weather{'moonphase-graphic'}) ? ' ' . $weather{'moonphase-graphic'} :''; - $rows[0]{main::key($num++,'Moonphase')} = $value; - } - if ($weather{'forecast'}){ - $rows[0]{main::key($num++,'Forecast')} = $weather{'forecast'}; + $rows[$j]{main::key($num++,0,2,'moonphase')} = $value; } } - if ($weather{'api-source'}){ - $rows[0]{main::key($num++,'Source')} = $weather{'api-source'}; + $rows[$j]{main::key($num++,0,1,'Source')} = $weather{'api-source'}; } eval $end if $b_log; return @rows; @@ -18963,10 +18988,10 @@ sub get_memory_data_full { } } my $key = ($source eq 'process') ? 'System RAM': 'RAM'; - $rows[0]{main::key($num++,$key)} = ''; - $rows[0]{main::key($num++,'total')} = $total; - $rows[0]{main::key($num++,'used')} = $used; - $rows[0]{main::key($num++,'gpu')} = $gpu_ram if $gpu_ram; + $rows[0]{main::key($num++,1,1,$key)} = ''; + $rows[0]{main::key($num++,0,2,'total')} = $total; + $rows[0]{main::key($num++,0,2,'used')} = $used; + $rows[0]{main::key($num++,0,2,'gpu')} = $gpu_ram if $gpu_ram; $b_mem = 1; } eval $end if $b_log; @@ -21055,7 +21080,7 @@ sub line_handler { 'weather' => \&WeatherData::get, ); my (%data); - my $data_name = main::key($prefix++,$key); + my $data_name = main::key($prefix++,1,0,$key); my @rows = $subs{$sub}->($arg); if (@rows){ %data = ($data_name => \@rows,); @@ -21141,19 +21166,19 @@ sub generate_short_data { #print join '; ', @cpu, " sleep: $cpu_sleep\n"; $memory ||= 'N/A'; my @data = ({ - main::key($num++,'CPU') => $cpu_string, - main::key($num++,$speed_key) => $speed, - main::key($num++,$kernel_os) => &get_kernel_data(), - main::key($num++,'Up') => &get_uptime(), - main::key($num++,'Mem') => $memory, - main::key($num++,'Storage') => $disk_string, + main::key($num++,0,0,'CPU') => $cpu_string, + main::key($num++,0,0,$speed_key) => $speed, + main::key($num++,0,0,$kernel_os) => &get_kernel_data(), + main::key($num++,0,0,'Up') => &get_uptime(), + main::key($num++,0,0,'Mem') => $memory, + main::key($num++,0,0,'Storage') => $disk_string, # could make -1 for ps aux itself, -2 for ps aux and self - main::key($num++,'Procs') => scalar @ps_aux, - main::key($num++,$client_shell) => $client, - main::key($num++,$self_name) => &get_self_version(), + main::key($num++,0,0,'Procs') => scalar @ps_aux, + main::key($num++,0,0,$client_shell) => $client, + main::key($num++,0,0,$self_name) => &get_self_version(), },); my %row = ( - main::key($prefix,'SHORT') => [(@data),], + main::key($prefix,1,0,'SHORT') => [(@data),], ); eval $end if $b_log; return %row; @@ -21168,7 +21193,7 @@ sub generate_info_data { my $num = 0; my $gcc_alt = ''; my $running_in = ''; - my $data_name = main::key($prefix++,'Info'); + my $data_name = main::key($prefix++,1,0,'Info'); my ($b_gcc,$gcc,$index,$ref,%row); my ($gpu_ram,$parent,$percent,$total,$used) = (0,'','','',''); my $client_shell = ($b_irc) ? 'Client' : 'Shell'; @@ -21203,10 +21228,9 @@ sub generate_info_data { } my %data = ( $data_name => [{ - main::key($num++,'Processes') => scalar @ps_aux, - main::key($num++,'Uptime') => &get_uptime(), - - },], + main::key($num++,0,1,'Processes') => scalar @ps_aux, + main::key($num++,0,1,'Uptime') => &get_uptime(), + },], ); $index = scalar(@{ $data{$data_name} } ) - 1; if (!$b_mem){ @@ -21224,33 +21248,33 @@ sub generate_info_data { $gpu_ram = $temp2[0] . ' ' . $temp2[1] if $temp2[1]; } } - $data{$data_name}[$index]{main::key($num++,'Memory')} = $total; - $data{$data_name}[$index]{main::key($num++,'used')} = $used; + $data{$data_name}[$index]{main::key($num++,1,1,'Memory')} = $total; + $data{$data_name}[$index]{main::key($num++,0,2,'used')} = $used; } if ($gpu_ram){ - $data{$data_name}[$index]{main::key($num++,'gpu')} = $gpu_ram; + $data{$data_name}[$index]{main::key($num++,0,2,'gpu')} = $gpu_ram; } if ( (!$b_display || $b_force_display) || $extra > 0 ){ my %init = get_init_data(); my $init_type = ($init{'init-type'}) ? $init{'init-type'}: 'N/A'; - $data{$data_name}[$index]{main::key($num++,'Init')} = $init_type; + $data{$data_name}[$index]{main::key($num++,1,1,'Init')} = $init_type; if ($extra > 1 ){ my $init_version = ($init{'init-version'}) ? $init{'init-version'}: 'N/A'; - $data{$data_name}[$index]{main::key($num++,'v')} = $init_version; + $data{$data_name}[$index]{main::key($num++,0,2,'v')} = $init_version; } if ($init{'rc-type'}){ - $data{$data_name}[$index]{main::key($num++,'rc')} = $init{'rc-type'}; + $data{$data_name}[$index]{main::key($num++,1,2,'rc')} = $init{'rc-type'}; if ($init{'rc-version'}){ - $data{$data_name}[$index]{main::key($num++,'v')} = $init{'rc-version'}; + $data{$data_name}[$index]{main::key($num++,0,3,'v')} = $init{'rc-version'}; } } if ($init{'runlevel'}){ - $data{$data_name}[$index]{main::key($num++,'runlevel')} = $init{'runlevel'}; + $data{$data_name}[$index]{main::key($num++,0,2,'runlevel')} = $init{'runlevel'}; } if ($extra > 1 ){ if ($init{'default'}){ my $default = ($init{'init-type'} eq 'systemd' && $init{'default'} =~ /[^0-9]$/ ) ? 'target' : 'default'; - $data{$data_name}[$index]{main::key($num++,$default)} = $init{'default'}; + $data{$data_name}[$index]{main::key($num++,0,2,$default)} = $init{'default'}; } } } @@ -21263,28 +21287,28 @@ sub generate_info_data { $b_clang = 1; } my $compiler = ($b_gcc || $b_clang) ? '': 'N/A'; - $data{$data_name}[$index]{main::key($num++,'Compilers')} = $compiler; + $data{$data_name}[$index]{main::key($num++,1,1,'Compilers')} = $compiler; if ($b_gcc){ - $data{$data_name}[$index]{main::key($num++,'gcc')} = $gcc; + $data{$data_name}[$index]{main::key($num++,0,2,'gcc')} = $gcc; if ( $extra > 1 && $gcc_alt){ - $data{$data_name}[$index]{main::key($num++,'alt')} = $gcc_alt; + $data{$data_name}[$index]{main::key($num++,0,2,'alt')} = $gcc_alt; } } if ($b_clang){ - $data{$data_name}[$index]{main::key($num++,'clang')} = $clang_version; + $data{$data_name}[$index]{main::key($num++,0,2,'clang')} = $clang_version; } } if ($extra > 2 && $client{'su-start'}){ $client .= " ($client{'su-start'})"; } - $data{$data_name}[$index]{main::key($num++,$client_shell)} = $client; + $data{$data_name}[$index]{main::key($num++,1,1,$client_shell)} = $client; if ($extra > 0 && $client{'version'}){ - $data{$data_name}[$index]{main::key($num++,'v')} = $client{'version'}; + $data{$data_name}[$index]{main::key($num++,0,2,'v')} = $client{'version'}; } if ( $running_in ){ - $data{$data_name}[$index]{main::key($num++,'running in')} = $running_in; + $data{$data_name}[$index]{main::key($num++,0,2,'running in')} = $running_in; } - $data{$data_name}[$index]{main::key($num++,$self_name)} = &get_self_version(); + $data{$data_name}[$index]{main::key($num++,0,1,$self_name)} = &get_self_version(); eval $end if $b_log; return %data; @@ -21292,10 +21316,10 @@ sub generate_info_data { sub generate_system_data { eval $start if $b_log; - my $num = 0; + my ($cont_desk,$ind_dm,$num) = (1,2,0); my (%row,$ref,$index,$val1); - my $data_name = main::key($prefix++,'System'); - my ($desktop,$desktop_info,$desktop_key,$toolkit,$wm) = ('','','Desktop','',''); + my $data_name = main::key($prefix++,1,0,'System'); + my ($desktop,$desktop_info,$desktop_key,$dm_key,$toolkit,$wm) = ('','','Desktop','dm','',''); my (@desktop_data,$desktop_version); my %data = ( @@ -21303,20 +21327,20 @@ sub generate_system_data { ); $index = scalar(@{ $data{$data_name} } ) - 1; if ($show{'host'}){ - $data{$data_name}[$index]{main::key($num++,'Host')} = get_hostname(); + $data{$data_name}[$index]{main::key($num++,0,1,'Host')} = get_hostname(); } - $data{$data_name}[$index]{main::key($num++,'Kernel')} = get_kernel_data(); - $data{$data_name}[$index]{main::key($num++,'bits')} = get_kernel_bits(); + $data{$data_name}[$index]{main::key($num++,1,1,'Kernel')} = get_kernel_data(); + $data{$data_name}[$index]{main::key($num++,0,2,'bits')} = get_kernel_bits(); if ($extra > 0){ my @compiler = get_compiler_version(); # get compiler data if (scalar @compiler != 2){ @compiler = ('N/A', ''); } - $data{$data_name}[$index]{main::key($num++,'compiler')} = $compiler[0]; + $data{$data_name}[$index]{main::key($num++,1,2,'compiler')} = $compiler[0]; # if no compiler, obviously no version, so don't waste space showing. if ($compiler[0] ne 'N/A'){ $compiler[1] ||= 'N/A'; - $data{$data_name}[$index]{main::key($num++,'v')} = $compiler[1]; + $data{$data_name}[$index]{main::key($num++,0,3,'v')} = $compiler[1]; } } if ($b_admin && (my $params = get_kernel_parameters())){ @@ -21324,7 +21348,7 @@ sub generate_system_data { #print "$params\n"; $params = apply_partition_filter('system', $params, 'label') if $use{'filter-label'}; $params = apply_partition_filter('system', $params, 'uuid') if $use{'filter-uuid'}; - $data{$data_name}[$index]{main::key($num++,'parameters')} = $params; + $data{$data_name}[$index]{main::key($num++,0,2,'parameters')} = $params; $index = scalar(@{ $data{$data_name} } ); } # note: tty can have the value of 0 but the two tools @@ -21361,34 +21385,39 @@ sub generate_system_data { } $desktop = "tty $tty" if $tty ne ''; $desktop_key = 'Console'; + $dm_key = 'DM'; + $ind_dm = 1; + $cont_desk = 0; } $desktop ||= 'N/A'; - $data{$data_name}[$index]{main::key($num++,$desktop_key)} = $desktop; + $data{$data_name}[$index]{main::key($num++,$cont_desk,1,$desktop_key)} = $desktop; if ($toolkit){ - $data{$data_name}[$index]{main::key($num++,'tk')} = $toolkit; + $data{$data_name}[$index]{main::key($num++,0,2,'tk')} = $toolkit; } if ($extra > 2){ if ($desktop_info){ - $data{$data_name}[$index]{main::key($num++,'info')} = $desktop_info; + $data{$data_name}[$index]{main::key($num++,0,2,'info')} = $desktop_info; } } if ($extra > 1){ - $data{$data_name}[$index]{main::key($num++,'wm')} = $wm if $wm; + $data{$data_name}[$index]{main::key($num++,0,2,'wm')} = $wm if $wm; my $dms = get_display_manager(); - $dms ||= 'N/A'; - $data{$data_name}[$index]{main::key($num++,'dm')} = $dms; + if ($dms || $desktop_key ne 'Console'){ + $dms ||= 'N/A'; + $data{$data_name}[$index]{main::key($num++,0,$ind_dm,$dm_key)} = $dms; + } } #if ($extra > 2 && $desktop_key ne 'Console'){ # my $tty = get_tty_number(); - # $data{$data_name}[$index]{main::key($num++,'vc')} = $tty if $tty ne ''; + # $data{$data_name}[$index]{main::key($num++,0,1,'vc')} = $tty if $tty ne ''; #} my $distro_key = ($bsd_type) ? 'OS': 'Distro'; my @distro_data = DistroData::get(); my $distro = $distro_data[0]; $distro ||= 'N/A'; - $data{$data_name}[$index]{main::key($num++,$distro_key)} = $distro; + $data{$data_name}[$index]{main::key($num++,1,1,$distro_key)} = $distro; if ($extra > 0 && $distro_data[1]){ - $data{$data_name}[$index]{main::key($num++,'base')} = $distro_data[1]; + $data{$data_name}[$index]{main::key($num++,0,2,'base')} = $distro_data[1]; } eval $end if $b_log; return %data; diff --git a/inxi.1 b/inxi.1 index 0000fcb..1369cea 100644 --- a/inxi.1 +++ b/inxi.1 @@ -1,4 +1,4 @@ -.TH INXI 1 "2020\-05\-31" inxi "inxi manual" +.TH INXI 1 "2020\-06\-12" inxi "inxi manual" .SH NAME inxi \- Command line system information script for console and IRC @@ -614,8 +614,13 @@ not found,sets to default value, or \fBN/A\fR. This is an absolute width override which sets the output line width max. Overrides \fBCOLS_MAX_IRC\fR / \fBCOLS_MAX_CONSOLE\fR globals, or the actual widths of the terminal. \fB80\fR is the minimum width supported. -\fB\-1\fR removes width limits. If no value is given, it will set width -to 80. Examples: \fBinxi \-Fxx\ \-y 130\fR or \fBinxi \-Fxxy\fR +\fB\-1\fR removes width limits. 1 switches to a single indented key/value +pair per line, and removes all long line wrapping (similar to +\fBdmidecode\fR output). + +If no integer value is given, sets width to default of 80. + +Examples: \fBinxi \-Fxx\ \-y 130\fR or \fBinxi \-Fxxy\fR or \fBinxi \-bay1\fR .TP .B \-z\fR,\fB \-\-filter\fR @@ -963,11 +968,6 @@ Only appears if detected (SSD drives do not have rotation speeds, for example). found, nothing shows. Not all disks report this speed, so even if they are spinnning, no data will show. -.TP -.B \-xxx \-G\fR -\- Adds (if available) Xorg \fBcompositor:\fR version \fBv:\fR (always shows if -found for Wayland systems). - .TP .B \-xxx \-I\fR \- For \fBShell:\fR adds \fB(su|sudo|login)\fR to shell name if present. diff --git a/inxi.changelog b/inxi.changelog index 08e19f2..6ff8e0b 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,324 @@ +===================================================================================== +Version: 3.1.03 +Patch: 00 +Date: 2020-06-12 +----------------------------------- +Changes: +----------------------------------- + +Big internal refactor!! Fully adjustable indentation logic, built in, native! + +NOTE: none of these changes have any impact on normal inxi -y -1, -y, or -y xx +operation, everything will remain exactly the same, this only changes and +makes robust -y 1 single key: value pair per line output. + +3.1.03 finishes the -y1 introduced in 3.1.02, but makes it a core part of the inxi +logic for line printing, not a tacked on afterthought. + +Because the first draft of this in 3.1.02 was really a hack tacked onto the existing +logic, which was not very flexible or robust, and required way too much literal test +logic in the black box print_data() subroutine, which is supposed to be a 'dumb' +logic, that just does what you give it automatically, I added in key changes that +hard code the indentations per key, like so: + +Now: 34#0#3#key-name +Before: 34#key-name + +Note that anyone using the json or XML output option may need to redo their code +a bit to handle these extra 2 values that preface the actual key names. + +Fixes: +1. In order to make this work, changed a few small things internally, a few +key names were slightly altered to make them more clear. + +Changes: +1. Redo of all internal full key strings, added two new # separated items: + xx#x#y#key-name: + * xx remains the main 0 padded 2 digit sorter per row/block. + * x is a new 0/1 boolean, that shows if the value is a container or not. As + currently implemented probably not hugely useful since it won't say when + the following items it is a container of ends. + Note that the following y value will always be 1 for the item contained by + the container, so you can check that way if you want. the next item can + also be a container, but it would have either the same indentation level + as the previous container or be different. + Thus, if a key is a container, it can contain either non containers, or + other containers, but that primary container does not end until the indent + value equals or is less than the indent value of the first container. + If you are a programmer you should be able to figure this out. + * y is the indentation level, 0-xx is supported, but in practical terms, only + 4 levels are used. For single line output, these set the indentation for that + key. + * key-name remains the key string ID name. + +2. For -y 1 -G will show drivers then indented one more level unloaded, FAILED, +and alternate: to make it clear those are a subset of drivers. driver: itself +will contain the actual driver. In cases where no driver is loaded, a note +will show indented after driver: + +3. For -y 1, driver v: versions will be indented 1, and driver will be a container +that contains that version key: value pair. + +Samples: +----------------------------------- +inxi -Razy1 +RAID: + Device-1: g23-home + type: zfs + status: ONLINE + size: 2.69 TiB + free: 1.26 TiB + allocated: 1.43 TiB + Array-1: mirror + status: ONLINE + size: 1.82 TiB + free: 602.00 GiB + Components: + online: sdb sdc + Array-2: mirror + status: ONLINE + size: 888.00 GiB + free: 688.00 GiB + Components: + online: sdd sde + +----------------------------------- +sudo inxi -dazy1 +Drives: + Local Storage: + total: 1.98 TiB + used: 1.43 TiB (72.2%) + ID-1: /dev/sda + vendor: Intel + model: SSDSC2BW180A4 + family: 53x and Pro 1500/2500 Series SSDs + size: 167.68 GiB + block size: + physical: 512 B + logical: 512 B + sata: 3.0 + speed: 6.0 Gb/s + serial: + rev: DC32 + temp: 37 C + scheme: MBR + SMART: yes + state: enabled + health: PASSED + on: 291d 17h + cycles: 1346 + read: 431.94 GiB + written: 666.16 GiB + Optical-1: /dev/sr0 + vendor: HL-DT-ST + model: DVDRAM GH20LS10 + rev: FL00 + dev-links: cdrom,cdrw,dvd,dvdrw + Features: + speed: 48 + multisession: yes + audio: yes + dvd: yes + rw: cd-r,cd-rw,dvd-r,dvd-ram + state: running + +----------------------------------- +inxi -Aazy1 +Audio: + Device-1: NVIDIA High Definition Audio + vendor: Gigabyte + driver: snd_hda_intel + v: kernel + bus ID: 09:00.1 + chip ID: 10de:0be3 + Device-2: AMD Family 17h HD Audio + vendor: Gigabyte + driver: snd_hda_intel + v: kernel + bus ID: 0b:00.3 + chip ID: 1022:1457 + Device-3: N/A + type: USB + driver: hid-generic,snd-usb-audio,usbhid + bus ID: 5-1.3.4:5 + chip ID: 21b4:0083 + serial: + Sound Server: ALSA + v: k5.4.0-11.2-liquorix-amd64 + +----------------------------------- +-- Harald Hope - Fri, 12 Jun 2020 19:02:08 -0700 + +===================================================================================== +Version: 3.1.02 +Patch: 00 +Date: 2020-06-12 +----------------------------------- +Changes: +----------------------------------- + +Big change, cleanup, small bug fixes. Hot, grab it now!! + +The new -y 1 feature exposed several small and larger glitches with how sets +of data were constructed in inxi output. See Changes: for list of changes made +to improve or fix these glitches. + +These errors and minor output inconsistencies became very obvious when I was +doing heavy testing of -y 1, so I decided to just fix all of them at the same +time, plus it was very hard to make the -y 1 indenter work as expected when the +key values were not being treated consistently. + +Note that this completes the set of all possible -y results: + +Full -y Options: +1. -y [no integer given] :: set width to a default of 80. this is what you usually +want for forum posts, or for online issue reports, because it won't wrap and be +hard to read. Help us help your users and others!! Teach them to use for example +-Fxzy or -bay for their bug reports. Just add y to whatever collection of arguments +you generally ask for in support forums or issue reports. Highly recommended, +easy to type, and joins cleanly with other letters. + +2. -y -1 :: removes line width limits, this can lead to very long lines in some +cases, and removes all auto-wrapping of line widths. + +3. -y 1 :: Switch to stacked key: value pairs, with primary data blocks separated +by a blank line. Think dmidecode type output, or other command line sys info tools. +By request, a forum support guy noted it was hard for newbies to understand the +-G values, particularly -Ga when in lines, so this is another way to request +data. WARNING: for lots of data, this gets really long!!! But if you are curious +how inxi actually constructs its data internally, this sort of shows it. + +4. -y 80-xx :: set width to 80 or greater. Note you can also set these in +your configurations if you want using the various options supported. + +----------------------------------- + +Bugs: +1. Once again, no real bugs found beyond a few trivial things I can't remember. + +Fixes: +1. When out of X, dm: showed after Console: and often said dm: N/A particularly +on headless servers, which was silly. Now DM: only shows after Console: if +a DM: was actually found. If regular Desktop output, either in X, or via +--display out of X, no changes. + +2. There was a pointless sudo test when sudo values are set initially, they +were still running even if --no-sudo was used. Now they don't run in that case. + +Enhancements: +1. The biggie, now inxi can output in a similar indented way as something like +dmidecode if you use the -y 1 option. This feature was originally by request, +though the initial request actually just wanted to see it stacked simply, +but that was almost impossible to read for any output reasonably long, so +I made the indentations very dynamic and deep, they go up to 4 levels in, +which is roughly how deep in the inxi sub Categories go. This output format +makes it very easy to see how inxi 'thinks' about its data, how it views +sets, subsets, subsubsets, and subsubsubsets of data. + +Note that each data block, as with dmidecode data, is separated by a blank +line. You know what this means!!! Yes, that's right!!! You can parse inxi +output with awk!!, same way legacy bash+gawk inxi used to parse its data!! +Or if your brain just does not like lines of data, you can make it appear in +indented single key: value pairs. + +Here you can see for example that 1 Xorg Display has 1 or more Screens, +and each Screen has one or more Monitors. Note that this -Ga data first +appeared in inxi 3.1.00. + +Sample [with bug in OpenGL output!, and showing -Ga newer values as well +for dual monitor setup, with one Xorg Screen]: + +inxi -aGy1 +Graphics: + Device-1: NVIDIA GT218 [GeForce 210] + vendor: Gigabyte + driver: nouveau + v: kernel + bus ID: 09:00.0 + chip ID: 10de:0a65 + Display: x11 + server: X.Org 1.20.8 + driver: nouveau + unloaded: fbdev,modesetting,vesa + display ID: :0.0 + screens: 1 + Screen-1: 0 + s-res: 2560x1024 + s-dpi: 96 + s-size: 677x271mm (26.7x10.7") + s-diag: 729mm (28.7") + Monitor-1: DVI-I-0 + res: 1280x1024 + hz: 60 + dpi: 96 + size: 338x270mm (13.3x10.6") + diag: 433mm (17") + Monitor-2: VGA-0 + res: 1280x1024 + hz: 60 + dpi: 86 + size: 376x301mm (14.8x11.9") + diag: 482mm (19") + OpenGL: + renderer: N/A + v: N/A + direct render: N/A + +2. Refactored and cleaned up print_data(), got rid of some early testing code, +dumped some unnecessary tests, simplified old tests, and optimized the new +indentation logic reasonably well. Hopefully the print_data() will not be +quite as much of a black box now as it was. + +3. Even more drive vendors and ID matches!!! The list never ends!! An endless +series of new vendors and IDs of existing vendors sprout up, then float away. +And inxi follows them to the best of its ability. Thanks again to Linux-Lite +hardware database, which help make this ever expanding list possible, since +their users appear to use every disk known to humankind. + +Changes: +1. When out of Display, and Console: shows, -S will not show dm: if no +display manager is detected, and if it is detected, it shows DM: since it's +not part of the Console: set of data. If out of X and --display is used to +get Xorg data out of X, it will show Desktop: set of data as normal, at least +it will show the stuff it can find. This resolves the issue where dm: appeared +to be a member of the set of Console: data, instead of either its own thing, +DM:, or a member of the set of Desktop: data. + +2. For RAID Devices with sub Array-x: values, Array-x: is capitalized, it used +to be array-x: That was silly. + +3. In USB, now Device-x: resets inside each Hub: so that the Device-x: are +numbered starting at 1 within each Hub:. This makes the counter behavior act +the same as it does in for example RAM Array-x: / Device-y:, where each Array-x: +resets Device-y: count to 1. This changes the old default of having Device-x: +not reset, to let you see the total number of devices plugged in or attached +no matter which hub they were plugged into, but the output actually gets +sort of confusing in single key: value pair mode per line. + +4. The key: value syntax for weather was changed completely, now it works +like the rest of the features, with Report:... [Forecast:...] Locale:... +and Source:. Locale makes the source of the times and other date related +features, and the location if shown or available, much more obvious. Before +it was never clear if Current Time referred to your local or the remote +time, now it's clearly from the Locale: you specified with -W, or +the default -w local info. Also made Report 1 line if unwrapped, Forecast 1 +line if not wrapped, and Locale: 1 line if not wrapped, which makes the output +easier to read. + +NOTE: automated weather queries are NOT allowed, if you do it, you will be +banned!! inxi is NOT a desktop weather app!! Don't confuse it with one!! +Weather is just a small service to users who might for example want to check +the weather on a remote system, or something like that, and is not intended +to be used on a routine basis. + +5. Cleaned up and re-ordered the --version output. It had some pretty old +contexts in the language, which were removed or cleaned up and brought up to +date. If you're wondering, I roughly use rsync and nano --version as guides +for what to show or not show there. + +----------------------------------- +-- Harald Hope - Thu, 11 Jun 2020 23:53:30 -0700 + ===================================================================================== Version: 3.1.01 Patch: 00 -- cgit v1.2.3