Bug fixes!! Fixes!!! Refactors!!! Edits!!!

Bugs:
1. Big bug, 3.2 appears to have introduced this bug, for disks, rotation and
partition scheme would never show, oops.

2. Tiny bug kept one specific smart value from ever showing, typo.

Fixes:
1. Accidentally followed Arch linux derived distro page, which claims KaOS as
arch derived, when of course it's not, it's its own distro, own toolchain, etc.
I kind of knew this but had forgotten, then I believed the Arch derived distro
page, oh well. Resulted in KaOS being listed with arch linux as system base
with -Sx. Arch should fix this, it's not like it's hard, just remove the distro
from the page.

2. Cleared up explanations for drivetemp vs hddtemp use, updated --recommends,
man, and help to hopefully make this clear. Debian will be dropping hddtemp,
which is not maintained, sometime in the coming years, sooner than later.
Note that users unfortunately have to manually enable drivetemp module unless
their distros enable it by default, but the man/recommands/help explain that.

3. Fixed smart indentation issues, that went along with code change 1, was
failing to indent one further level for failed/age values like it's supposed
to.

Enhancements:
1. Added /proc/device to debugger, that will help track block device main numbers

2. More disk vendors, more disk vendor IDs!!! As noted, the enternal flow flows
eternally, thanks linux-lite hardware database users!! and other inxi users,
whose outputs sometimes reveal a failure or two.

3. Added loaded kernel module tests to --recommends, this was mostly to let users
know that drivetemp is needed if you want non superuser fast drive temps, and
that this came along with kernels 5.6 or newer. Hopefully word will start drifting
out. Note that if inxi is using drivetemp values, drive temps will appear as
regular user with -Dx, and will be to 1 decimal place. hddtemp temps are
integers, and requires sudo to display the temps.

4. To handle issue #239  which I'd thought of trying off and on, but never did,
added option to -Dxxx to show SSD if a positive SSD ID was made to rotation:
So rotation will show either nothing, if no rotation or ssd data is detected,
the disk speed in rpm, or SSD if an SSD device. There may be corner cases where
this is wrong, but I don't have data for that, for example, if a disk is parked
and has zero rotation but is a HDD, not as SSD. I don't know what the data
looksl ike in that case. Note that if sudo inxi -Da is used, and smartctl is
installed, it should be right almost all the time, and with regular -Dxxx, it's
going to be right almost always, with a few corner cases. That slight
uncertainty is why I never implemented this before. Legacy drives also sometimes
did not report rotation speeds even when HDD, so those may create issues,
but inxi will only call it an SSD if it's an nvme, mmcblk device, both are
easy to ID as SSD, or if it meets certain conditions. It will not call a drive
an SSD if it was unable to meet those conditions.

INTERNAL CODE CHANGES:
1. Refactored the output logic for DiskData, that was messy, split it into a few
subs, and also refactored the way smartctl data was loaded and used, that's
much cleaner and easier to use now. Split the previous 1 big sub into:
totals_output(), drives_output(), and smart_output().
Also split out the smart field arrays into a separate sub, which loads
references to avoid creating new arrays and copying them all over when outputting
smart data. References are weird to work with directly but they are MUCH faster
to use, so I'm moving as much of the internal logic to use array raferences
instead of dereferenced arrays/hashes assigned to a new array, or hash.

2. Redid all the output modules and renamed them to be more consistent and
predictable, and redid the logic here and there to make the get() items be fairly
similar on all the data builder packages. Now as with the data subs, which
generally end in _data, now most of the output subs end with _output.

3. Roughly finished the process started in 3.2, got rid of redundant array loads,
changed:
@something = something_data();
push (@rows,@something);
to:
push (@rows,something_data());
which avoids creating an extra array, this also let me remove many arrays overall.

4. Missed a few hashes in machine data that were being passed directly, not as
references, to other subs, corrected that. I think I missed those because they
were %, so the search I did for @ in sub arg lists didn't catch the % hashes.
This commit is contained in:
Harald Hope 2021-02-08 17:07:34 -08:00
parent 6c9b259375
commit 2b49b32223
3 changed files with 708 additions and 533 deletions

1103
inxi

File diff suppressed because it is too large Load diff

44
inxi.1
View file

@ -1,4 +1,4 @@
.TH INXI 1 "2021\-01\-28" inxi "inxi manual"
.TH INXI 1 "2021\-02\-08" inxi "inxi manual"
.SH NAME
inxi \- Command line system information script for console and IRC
@ -210,7 +210,7 @@ it has been disabled, if you try enabling it using for example:
\fBhciconfig hci0 up\fR
and it returns a blocked by RF-Kill error, you can do one of these:
and it returns a blocked by RF\-Kill error, you can do one of these:
\fBconnmanctl enable bluetooth
@ -847,25 +847,29 @@ dds rev version to optical drive.
.B \-x \-D\fR
\- Adds HDD temperature with disk data.
Method 1: if you have hddtemp installed, if you are root
Method 1: Systems running Linux kernels ~5.6 and newer should have \fBdrivetemp\fR
module data available. If so, drive temps will come from /sys data for each drive,
and will not require root or hddtemp. This method is MUCH faster than using hddtemp.
Note that NVMe drives do not require \fBdrivetemp\fR.
If your \fBdrivetemp\fR module is not enabled, enable it:
\fBmodprobe drivetemp\fR
Once enabled, add \fBdrivetemp\fR to \fB/etc/modules\fR or
\fB/etc/modules\-load.d/***.conf\fR so it starts automatically.
If you see drive temps running as regular user and you did not configure system
to use sudo hddtemp, then your system supports this feature. If no /sys data is
found, inxi will try to use hddtemp methods instead for that drive.
Hint: if temp is /sys sourced, the temp will be to 1 decimal, like 34.8, if hddtemp
sourced, they will be integers.
Method 2: if you have hddtemp installed, if you are root
or if you have added to \fB/etc/sudoers\fR (sudo v. 1.7 or newer):
.B <username> ALL = NOPASSWD: /usr/sbin/hddtemp (sample)
Method 2: systems running Linux kernels ~5.8 and newer may have drive temp data
available from /sys. If your system has /sys hwmon drive data, the temps
will come from /sys data for each drive with that data, and will not require
root or hddtemp!! This method is MUCH faster than using hddtemp!
If you see drive temps running as regular user and you did not configure system
to use sudo hddtemp, then your system supports this feature. Sometimes one type
of drive will have the /sys temp data, and another won't, it varies widely.
If no /sys data is found, inxi will try to use hddtemp methods instead
for that drive.
Hint: is /sys sourced, the temps will be to 1 decimal, like 34.8, if hddtemp
sourced, they will be integers.
You can force use of \fBhddtemp\fR for all drives using \fB\-\-hddtemp\fR.
\- If free LVM volume group size detected (root required), show \fBlvm-free:\fR
@ -1203,9 +1207,9 @@ Requires sudo/root and \fBdmidecode\fR.
\- Adds disk partition scheme (in most cases), e.g. \fBscheme: GPT\fR. Currently not
able to detect all schemes, but handles the most common, e.g. \fBGPT\fR or \fBMBR\fR.
\- Adds disk rotation speed (in some but not all cases), e.g. \fBrotation: 7200 rpm\fR.
Only appears if detected (SSD drives do not have rotation speeds, for example). If none
found, nothing shows. Not all disks report this speed, so even if they are spinnning,
\- Adds disk rotation speed (in some but not all cases), e.g. \fBrotation: 7200 rpm\fR
or \fBrotation: SSD\fR if positive SSD identification was made. If no rotation or positive
SSD ID found, nothing shows. Not all disks report this speed, so even if they are spinnning,
no data will show.
.TP

View file

@ -1,3 +1,97 @@
=====================================================================================
Version: 3.3.01
Patch: 00
Date: 2021-02-08
-----------------------------------
Changes:
-----------------------------------
Bug fixes!! Fixes!!! Refactors!!! Edits!!!
Bugs:
1. Big bug, 3.2 appears to have introduced this bug, for disks, rotation and
partition scheme would never show, oops.
2. Tiny bug kept one specific smart value from ever showing, typo.
Fixes:
1. Accidentally followed Arch linux derived distro page, which claims KaOS as
arch derived, when of course it's not, it's its own distro, own toolchain, etc.
I kind of knew this but had forgotten, then I believed the Arch derived distro
page, oh well. Resulted in KaOS being listed with arch linux as system base
with -Sx. Arch should fix this, it's not like it's hard, just remove the distro
from the page.
2. Cleared up explanations for drivetemp vs hddtemp use, updated --recommends,
man, and help to hopefully make this clear. Debian will be dropping hddtemp,
which is not maintained, sometime in the coming years, sooner than later.
Note that users unfortunately have to manually enable drivetemp module unless
their distros enable it by default, but the man/recommands/help explain that.
3. Fixed smart indentation issues, that went along with code change 1, was
failing to indent one further level for failed/age values like it's supposed
to.
Enhancements:
1. Added /proc/device to debugger, that will help track block device main numbers
2. More disk vendors, more disk vendor IDs!!! As noted, the enternal flow flows
eternally, thanks linux-lite hardware database users!! and other inxi users,
whose outputs sometimes reveal a failure or two.
3. Added loaded kernel module tests to --recommends, this was mostly to let users
know that drivetemp is needed if you want non superuser fast drive temps, and
that this came along with kernels 5.6 or newer. Hopefully word will start drifting
out. Note that if inxi is using drivetemp values, drive temps will appear as
regular user with -Dx, and will be to 1 decimal place. hddtemp temps are
integers, and requires sudo to display the temps.
4. To handle issue #239 which I'd thought of trying off and on, but never did,
added option to -Dxxx to show SSD if a positive SSD ID was made to rotation:
So rotation will show either nothing, if no rotation or ssd data is detected,
the disk speed in rpm, or SSD if an SSD device. There may be corner cases where
this is wrong, but I don't have data for that, for example, if a disk is parked
and has zero rotation but is a HDD, not as SSD. I don't know what the data
looksl ike in that case. Note that if sudo inxi -Da is used, and smartctl is
installed, it should be right almost all the time, and with regular -Dxxx, it's
going to be right almost always, with a few corner cases. That slight
uncertainty is why I never implemented this before. Legacy drives also sometimes
did not report rotation speeds even when HDD, so those may create issues,
but inxi will only call it an SSD if it's an nvme, mmcblk device, both are
easy to ID as SSD, or if it meets certain conditions. It will not call a drive
an SSD if it was unable to meet those conditions.
INTERNAL CODE CHANGES:
1. Refactored the output logic for DiskData, that was messy, split it into a few
subs, and also refactored the way smartctl data was loaded and used, that's
much cleaner and easier to use now. Split the previous 1 big sub into:
totals_output(), drives_output(), and smart_output().
Also split out the smart field arrays into a separate sub, which loads
references to avoid creating new arrays and copying them all over when outputting
smart data. References are weird to work with directly but they are MUCH faster
to use, so I'm moving as much of the internal logic to use array raferences
instead of dereferenced arrays/hashes assigned to a new array, or hash.
2. Redid all the output modules and renamed them to be more consistent and
predictable, and redid the logic here and there to make the get() items be fairly
similar on all the data builder packages. Now as with the data subs, which
generally end in _data, now most of the output subs end with _output.
3. Roughly finished the process started in 3.2, got rid of redundant array loads,
changed:
@something = something_data();
push (@rows,@something);
to:
push (@rows,something_data());
which avoids creating an extra array, this also let me remove many arrays overall.
4. Missed a few hashes in machine data that were being passed directly, not as
references, to other subs, corrected that. I think I missed those because they
were %, so the search I did for @ in sub arg lists didn't catch the % hashes.
-----------------------------------
-- Harald Hope - Mon, 08 Feb 2021 16:16:27 -0800
=====================================================================================
Version: 3.3.00
Patch: 00