branch one, try at xfce id fix

This commit is contained in:
inxi-svn 2014-08-21 02:29:07 +00:00
parent ffe7932b21
commit 5d10366748

554
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.1.91
#### Date: 2014-08-12
#### Version: 2.2.0
#### Date: 2014-08-20
#### Patch Number: 01-b1
########################################################################
#### SPECIAL THANKS
@ -1832,7 +1832,7 @@ debug_data_collector()
echo 'Creating inxi output file now. This can take a few seconds...'
echo "Starting $SCRIPT_NAME from: $start_directory"
cd $start_directory
$SCRIPT_PATH/$SCRIPT_NAME -FRfrploudixxx -c 0 -@ 8 -y 120 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRfrploudixxxy120.txt
$SCRIPT_PATH/$SCRIPT_NAME -FRfrploudmxxx -c 0 -@ 8 -y 120 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRfrploudmxxxy120.txt
cp $LOG_FILE $SCRIPT_DATA_DIR/$debug_data_dir
if [[ -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz ]];then
echo "Found and removing previous tar.gz data file: $debug_data_dir.tar.gz"
@ -2635,7 +2635,7 @@ show_options()
# print_screen_output " "
print_lines_basic "0" "" "$SCRIPT_NAME supports the following options. You can combine them, or list them one by one. Examples: $SCRIPT_NAME^-v4^-c6 OR $SCRIPT_NAME^-bDc^6. If you start $SCRIPT_NAME with no arguments, it will show the short form."
print_screen_output " "
print_lines_basic "0" "" "The following options if used without -F, -b, or -v will show just option line(s): A, C, D, G, I, M, N, P, R, S, f, i, n, o, p, l, u, r, s, t - you can use these alone or together to show just the line(s) you want to see. If you use them with -v^[level], -b or -F, it will show the full output for that line along with the output for the chosen verbosity level."
print_lines_basic "0" "" "The following options if used without -F, -b, or -v will show just option line(s): A, C, D, G, I, M, N, P, R, S, f, i, m, n, o, p, l, u, r, s, t - you can use these alone or together to show just the line(s) you want to see. If you use them with -v^[level], -b or -F, it will show the full output for that line along with the output for the chosen verbosity level."
print_screen_output "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
print_screen_output "Output Control Options:"
print_lines_basic "1" "-A" "Audio/sound card information."
@ -2655,7 +2655,7 @@ show_options()
print_lines_basic "1" "-d" "Optical drive data. Same as -Dd. See also -x and -xx."
print_lines_basic "1" "-D" "Full hard Disk info, not only model, ie: /dev/sda ST380817AS 80.0GB. See also -x and -xx. Disk total used percentage includes swap partition size(s)."
print_lines_basic "1" "-f" "All cpu flags, triggers -C. Not shown with -F to avoid spamming. ARM cpus show 'features'."
print_lines_basic "1" "-F" "Full output for $SCRIPT_NAME. Includes all Upper Case line letters, plus -s and -n. Does not show extra verbose options like -x -d -f -u -l -o -p -t -r"
print_lines_basic "1" "-F" "Full output for $SCRIPT_NAME. Includes all Upper Case line letters, plus -s and -n. Does not show extra verbose options like -d -f -l -m -o -p -r -t -u -x"
print_lines_basic "1" "-G" "Graphic card information (card, display server type/version, resolution, glx renderer, version)."
print_lines_basic "1" "-i" "Wan IP address, and shows local interfaces (requires ifconfig
network tool). Same as -Nni. Not shown with -F for user security reasons, you shouldn't paste your local/wan IP."
@ -2699,7 +2699,7 @@ show_options()
print_lines_basic "2" "-G" "(for single gpu, nvidia driver) screen number gpu is running on."
print_lines_basic "2" "-i" "IPv6 as well for LAN interface (IF) devices."
print_lines_basic "2" "-I" "System GCC, default. With -xx, also show other installed GCC versions. If running in console, not in IRC client, shows shell version number, if detected. Init/RC Type and runlevel (if available)."
print_lines_basic "2" "-m" "Part number."
print_lines_basic "2" "-m" "Part number; Max memory module size (if available)."
print_lines_basic "2" "-N -A" "Version/port(s)/driver version (if available) for Network/Audio;"
print_lines_basic "2" "-N -A -G" "Network, audio, graphics, shows PCI Bus ID/Usb ID number of card."
print_lines_basic "2" "-R" "md-raid: Shows component raid id. Adds second RAID Info line: raid level; report on drives (like 5/5); blocks; chunk size; bitmap (if present). Resync line, shows blocks synced/total blocks. zfs-raid: Shows raid array full size; available size; portion allocated to RAID"
@ -2713,7 +2713,7 @@ show_options()
print_lines_basic "2" "-D" "Disk serial number."
print_lines_basic "2" "-G" "Chip vendor:product ID for each video card."
print_lines_basic "2" "-I" "Other detected installed gcc versions (if present). System default runlevel. Adds parent program (or tty) for shell info if not in IRC (like Konsole or Gterm). Adds Init/RC (if found) version number."
print_lines_basic "2" "-m" "Manufacturer, Serial Number."
print_lines_basic "2" "-m" "Manufacturer, Serial Number, single/double bank (if found)."
print_lines_basic "2" "-M" "Chassis information, bios rom size (dmidecode only), if data for either is available."
print_lines_basic "2" "-N" "Chip vendor:product ID for each nic."
print_lines_basic "2" "-R" "md-raid: Superblock (if present); algorythm, U data. Adds system info line (kernel support,read ahead, raid events). If present, adds unused device line. Resync line, shows progress bar."
@ -2723,7 +2723,7 @@ show_options()
fi
print_lines_basic "2" "-@ 11-14" "Automatically uploads debugger data tar.gz file to ftp.techpatterns.com. EG: $SCRIPT_NAME^-xx@14"
print_lines_basic "1" "-xxx" "Show extra, extra, extra data (only works with verbose or line output, not short form):"
print_lines_basic "2" "-m" "Width of channel, data and total. Detail, if present, for Type."
print_lines_basic "2" "-m" "Width of memory bus, data and total (if present and greater than data); Detail, if present, for Type; module voltage, if available."
print_lines_basic "2" "-S" "Panel/shell information in desktop output, if in X (like gnome-shell, cinnamon, mate-panel)."
if [[ $B_ALLOW_WEATHER == 'true' ]];then
print_lines_basic "2" "-w -W" "Location (uses -z/irc filter), weather observation time, wind chill, heat index, dew point (shows extra lines for data where relevant)."
@ -3881,7 +3881,6 @@ get_cpu_speed_hack()
echo $speed
}
get_cpu_data_bsd()
{
eval $LOGFS
@ -4314,6 +4313,26 @@ get_desktop_environment()
fi
fi
desktop_environment="Xfce"
elif [[ -n $( grep -is '\"xfce\"' <<< "$xprop_root" ) ]];then
version=$( get_program_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' )
# arch linux reports null, so use alternate if null
if [[ -z $version ]];then
version=$( get_program_version 'xfce4-panel' '^xfce5-panel' '2' )
if [[ -z $version ]];then
# version=$( get_program_version 'xfce5-panel' '^xfce5-panel' '2' )
#if [[ -z $version ]];then
# version='5'
#fi
version='4'
fi
fi
if [[ $B_EXTRA_DATA == 'true' ]];then
toolkit=$( get_program_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' )
if [[ -n $toolkit ]];then
version="$version (Gtk $toolkit)"
fi
fi
desktop_environment="Xfce"
elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then
if [[ -n $( grep -is 'fluxbox' <<< "$Ps_aux_Data" ) ]];then
version=$( get_program_version 'fluxbox' '^fluxbox' '2' )
@ -4889,8 +4908,7 @@ get_dmidecode_data()
{
eval $LOGFS
local dmiData="$( cat ~/bin/scripts/inxi/data/dmidecode/dmidecode-memory-variants-1.txt )"
local dmidecodePath=''
local dmiData="" b_debugger='false'
if [[ $B_DMIDECODE_SET != 'true' ]];then
dmidecodePath=$( type -p dmidecode 2>/dev/null )
@ -4902,8 +4920,12 @@ get_dmidecode_data()
# used to separate results. Then we remove the doubled empty lines to keep it clean and
# strip out all the stuff we don't want to see in the results. We want the error data in
# stdout for error handling
# DMIDECODE_DATA="$( echo "$dmiData" | gawk -F ':' '
DMIDECODE_DATA="$( $dmidecodePath 2>&1 | gawk -F ':' '
if [[ $b_debugger == 'true' && $HOSTNAME == 'yawn' ]];then
dmiData="$( cat ~/bin/scripts/inxi/svn/misc/data/dmidecode/dmidecode-memory-variants-2.txt )"
else
dmiData="$( $dmidecodePath 2>&1 )"
fi
DMIDECODE_DATA="$( echo "$dmiData" | gawk -F ':' '
BEGIN {
IGNORECASE=1
cutExtraTab="false"
@ -4937,7 +4959,7 @@ get_dmidecode_data()
# To Be Filled By O.E.M.
# strip out starting white space so that the following stuff will clear properly
sub(/^[[:space:]]+/, "", twoData)
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*|^0x[0]+$/, "", twoData)
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*|^0x[0]+$|\[Empty\]|<Bad Index>|^\.\.$/, "", twoData)
sub(/.*(AssetTagNum|Manufacturer| Or Motherboard|PartNum.*|SerNum).*/, "", twoData)
gsub(/bios|acpi/, "", twoData)
sub(/http:\/\/www.abit.com.tw\//, "Abit", twoData)
@ -4951,14 +4973,17 @@ get_dmidecode_data()
else {
sub(/^\t\t+/, "~", oneData)
}
gsub(/ [ \t]+/, " ", twoData)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", twoData)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", oneData)
gsub(/ [ \t]+/, " ", twoData)
# reconstructing the line for processing so gawk can use -F : again
if ( oneData != "" && twoHolder == "true" ) {
print oneData ":" twoData
}
else {
# make sure all null lines have no spaces in them!
gsub(/^[[:space:]]+|[[:space:]]+$/,"",$0)
print $0
}
}' \
@ -5019,8 +5044,7 @@ get_gcc_system_version()
/^gcc/ {
print $2
exit
}' )
}' )
# can't use xargs -L basename because not all systems support thats
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
gcc_others=$( ls /usr/bin/gcc-* 2>/dev/null )
@ -5929,11 +5953,6 @@ get_init_data()
init_type='launchd'
# / launchd/ version.plist /etc/launchd.conf
# init_version=$( get_program_version 'Launchd' '^Launchd' '4' )
# missing data:
# http://smarden.org/runit/sv.8.html
elif [[ -e /sbin/runit-init || -e /etc/runit || -n $( type -p sv ) ]];then
init_type='runit' # lower case
# no data on version yet
elif [[ -f /etc/inittab ]];then
init_type='SysVinit'
if type -p strings &>/dev/null;then
@ -5942,6 +5961,11 @@ get_init_data()
if [[ -n $strings_init_version ]];then
init_version=$( gawk '{print $2}' <<< "$strings_init_version" )
fi
# missing data: note, runit can install as a dependency without being the init system
# http://smarden.org/runit/sv.8.html
elif [[ -e /sbin/runit-init || -e /etc/runit || -n $( type -p sv ) ]];then
init_type='runit' # lower case
# no data on version yet
# freebsd at least
elif [[ -f /etc/ttys ]];then
init_type='init (bsd)'
@ -6240,7 +6264,7 @@ get_machine_data()
fi
fi
fi
echo $array_string
# echo $array_string
IFS=','
A_MACHINE_DATA=( $array_string )
IFS="$ORIGINAL_IFS"
@ -8141,19 +8165,98 @@ get_ram_data()
handle=""
location=""
locator=""
maxCapacity=""
aArrayData[0,"maxCapacity5"]=0
aArrayData[0,"maxCapacity16"]=0
aArrayData[0,"usedCapacity"]=0
aArrayData[0,"maxModuleSize"]=0
aArrayData[0,"derivedModuleSize"]=0
aArrayData[0,"deviceCount5"]=0
aArrayData[0,"deviceCount16"]=0
aArrayData[0,"deviceCountFound"]=0
aArrayData[0,"moduleVoltage5"]=""
moduleVoltage=""
numberOfDevices=""
primaryType=""
totalWidth=""
use=""
i=0
j=0
k=0
bDebugger1="false"
dDebugger2="false"
bType5="false"
}
/^Handle .* DMI type 16/ {
primaryType="memory-array"
function calculateSize(data,size) {
if ( data ~ /^[0-9]+[[:space:]]*[GMTP]B/) {
if ( data ~ /GB/ ) {
data=gensub(/([0-9]+)[[:space:]]*GB/,"\\1",1,data) * 1024
}
else if ( data ~ /MB/ ) {
data=gensub(/([0-9]+)[[:space:]]*MB/,"\\1",1,data)
}
else if ( data ~ /TB/ ) {
data=gensub(/([0-9]+)[[:space:]]*TB/,"\\1",1,data) * 1024 * 1000
}
else if ( data ~ /PB/ ) {
data=gensub(/([0-9]+)[[:space:]]*TB/,"\\1",1,data) * 1024 * 1000 * 1000
}
if (data ~ /^[0-9][0-9]+$/ && data > size ) {
size=data
}
}
return size
}
/^Table[[:space:]]+at[[:space:]]/ {
bType5="false"
# we need to start count here because for testing > 1 array, and we want always to have
# the actual module data assigned to the right primary array, even when it is out of
# position in dmidecode output
i=0
j=0
k++
}
# {print k ":k:" $0}
/^Handle .* DMI[[:space:]]+type[[:space:]]+5(,|[[:space:]])/ {
while ( getline && !/^$/ ) {
if ( $1 == "Maximum Memory Module Size" ) {
aArrayData[k,"maxModuleSize"]=calculateSize($2,aArrayData[k,"maxModuleSize"])
# print "mms:" aArrayData[k,"maxModuleSize"] ":" $2
}
if ($1 == "Maximum Total Memory Size") {
aArrayData[k,"maxCapacity5"]=calculateSize($2,aArrayData[k,"maxCapacity5"])
}
if ( $1 == "Memory Module Voltage" ) {
aArrayData[k,"moduleVoltage5"]=$2
}
}
aArrayData[k,"data-type"]="memory-array"
# print k ":data5:"aArrayData[k,"data-type"]
bType5="true"
}
/^Handle .* DMI[[:space:]]+type[[:space:]]+6(,|[[:space:]])/ {
while ( getline && !/^$/ ) {
if ( $1 == "Installed Size" ) {
# get module size
aMemory[k,j,18]=calculateSize($2,0)
# get data after module size
sub(/ Connection/,"",$2)
sub(/^[0-9]+[[:space:]]*[MGTP]B[[:space:]]*/,"",$2)
aMemory[k,j,16]=$2
}
if ( $1 == "Current Speed" ) {
aMemory[k,j,17]=$2
}
}
j++
}
/^Handle .* DMI[[:space:]]+type[[:space:]]+16/ {
arrayHandle=gensub(/Handle[[:space:]]([0-9a-zA-Z]+)([[:space:]]|,).*/,"\\1",$0)
while ( getline && !/^$/ ) {
# print $0
if ( $1 == "Maximum Capacity") {
maxCapacity=$2
aArrayData[k,"maxCapacity16"]=calculateSize($2,aArrayData[k,"maxCapacity16"])
#print "mc:" aArrayData[k,"maxCapacity16"] ":" $2
}
# note: these 3 have cleaned data in get_dmidecode_data, so replace stuff manually
if ( $1 == "Location") {
@ -8172,25 +8275,37 @@ get_ram_data()
if ( $1 == "Error Correction Type") {
errorCorrection=$2
if ( errorCorrection == "" ){
errorCorrection="No"
errorCorrection="None"
}
}
if ( $1 == "Number of Devices") {
numberOfDevices=$2
}
}
print primaryType "," arrayHandle "," location "," maxCapacity "," numberOfDevices "," use "," errorCorrection
aArrayData[k,"data-type"]="memory-array"
# print k ":data16:"aArrayData[k,"data-type"]
aArrayData[k,"handle"]=arrayHandle
aArrayData[k,"location"]=location
aArrayData[k,"deviceCount16"]=numberOfDevices
aArrayData[k,"use"]=use
aArrayData[k,"errorCorrection"]=errorCorrection
# reset
primaryType=""
arrayHandle=""
location=""
maxCapacity=""
numberOfDevices=""
use=""
errorCorrection=""
moduleVoltage=""
aDerivedModuleSize[k+1]=0
aArrayData[k+1,"deviceCountFound"]=0
aArrayData[k+1,"maxCapacity5"]=0
aArrayData[k+1,"maxCapacity16"]=0
aArrayData[k+1,"maxModuleSize"]=0
}
/^Handle .* DMI type 17/ {
primaryType="memory-device"
/^Handle .* DMI[[:space:]]+type[[:space:]]+17/ {
while ( getline && !/^$/ ) {
if ( $1 == "Array Handle") {
arrayHandle=$2
@ -8202,12 +8317,28 @@ get_ram_data()
totalWidth=$2
}
if ( $1 == "Size") {
deviceSize=$2
# do not try to guess from installed modules, only use this to correct type 5 data
aArrayData[k,"derivedModuleSize"]=calculateSize($2,aArrayData[k,"derivedModuleSize"])
workingSize=calculateSize($2,0)
if ( workingSize ~ /^[0-9][0-9]+$/ ){
aArrayData[k,"deviceCountFound"]++
# build up actual capacity found for override tests
aArrayData[k,"usedCapacity"]=workingSize + aArrayData[k,"usedCapacity"]
}
# print aArrayData[k,"derivedModuleSize"] " dm:" k ":mm " aMaxModuleSize[k] " uc:" aArrayData[k,"usedCapacity"]
# we want any non real size data to be preserved
if ( $2 ~ /^[0-9]+[[:space:]]*[MTPG]B/ ) {
deviceSize=workingSize
}
else {
deviceSize=$2
}
}
if ( $1 == "Locator") {
# sub(/.*_/,"",$2)
#sub(/RAM slot #|^DIMM/, "Slot",$2)
sub(/RAM slot #/, "Slot",$2)
#locator=toupper($2)
locator=$2
}
@ -8255,7 +8386,34 @@ get_ram_data()
else {
mainLocator=locator
}
print primaryType "," arrayHandle "," deviceSize "," bankLocator "," locator "," formFactor "," deviceType "," deviceTypeDetail "," deviceSpeed "," configuredClockSpeed "," dataWidth "," totalWidth "," deviceManufacturer "," devicePartNumber "," deviceSerialNumber "," mainLocator
# sometimes the data is just wrong, they reverse total/data. data I believe is
# used for the actual memory bus width, total is some synthetic thing, sometimes missing.
# note that we do not want a regular string comparison, because 128 bit memory buses are
# in our future, and 128 bits < 64 bits with string compare
intData=gensub(/(^[0-9]+).*/,"\\1",1,dataWidth)
intTotal=gensub(/(^[0-9]+).*/,"\\1",1,totalWidth)
if (intData != "" && intTotal != "" && intData > intTotal ) {
tempWidth=dataWidth
dataWidth=totalWidth
totalWidth=tempWidth
}
aMemory[k,i,0]="memory-device"
aMemory[k,i,1]=arrayHandle
aMemory[k,i,2]=deviceSize
aMemory[k,i,3]=bankLocator
aMemory[k,i,4]=locator
aMemory[k,i,5]=formFactor
aMemory[k,i,6]=deviceType
aMemory[k,i,7]=deviceTypeDetail
aMemory[k,i,8]=deviceSpeed
aMemory[k,i,9]=configuredClockSpeed
aMemory[k,i,10]=dataWidth
aMemory[k,i,11]=totalWidth
aMemory[k,i,12]=deviceManufacturer
aMemory[k,i,13]=devicePartNumber
aMemory[k,i,14]=deviceSerialNumber
aMemory[k,i,15]=mainLocator
primaryType=""
arrayHandle=""
@ -8274,8 +8432,221 @@ get_ram_data()
deviceManufacturer=""
devicePartNumber=""
deviceSerialNumber=""
i++
}
END {
## CRITICAL: gawk keeps changing integers to strings, so be explicit with int() in math
# print primaryType "," arrayHandle "," location "," maxCapacity "," numberOfDevices "," use "," errorCorrection "," maxModuleSize "," moduleVoltage
} ' <<< "$DMIDECODE_DATA" ) )
# print primaryType "," arrayHandle "," deviceSize "," bankLocator "," locator "," formFactor "," deviceType "," deviceTypeDetail "," deviceSpeed "," configuredClockSpeed "," dataWidth "," totalWidth "," deviceManufacturer "," devicePartNumber "," deviceSerialNumber "," mainLocator
for ( m=1;m<=k;m++ ) {
estCap=""
estMod=""
unit=""
altCap=0
workingMaxCap=int(aArrayData[m,"maxCapacity16"])
if ( bDebugger1 == "true" ){
print ""
print "count: " m
print "1: mmods: " aArrayData[m,"maxModuleSize"] " :dmmods: " aArrayData[m,"derivedModuleSize"] " :mcap: " workingMaxCap " :ucap: " aArrayData[m,"usedCapacity"]
}
# 1: if max cap 1 is null, and max cap 2 not null, use 2
if ( workingMaxCap == 0 ) {
if ( aArrayData[m,"maxCapacity5"] != 0 ) {
workingMaxCap=aArrayData[m,"maxCapacity5"]
}
}
if ( aArrayData[m,"deviceCount16"] == "" ) {
aArrayData[m,"deviceCount16"] = 0
}
if ( bDebugger1 == "true" ){
print "2: mmods: " aArrayData[m,"maxModuleSize"] " :dmmods: " aArrayData[m,"derivedModuleSize"] " :mcap: " workingMaxCap " :ucap: " aArrayData[m,"usedCapacity"]
}
# 2: now check to see if actually found module sizes are > than listed max module, replace if >
if (aArrayData[m,"maxModuleSize"] != 0 && aArrayData[m,"derivedModuleSize"] != 0 && int(aArrayData[m,"derivedModuleSize"]) > int(aArrayData[m,"maxModuleSize"]) ) {
aArrayData[m,"maxModuleSize"]=aArrayData[m,"derivedModuleSize"]
estMod=" (est)"
}
aArrayData[m,"maxModuleSize"]=int(aArrayData[m,"maxModuleSize"])
aArrayData[m,"derivedModuleSize"]=int(aArrayData[m,"derivedModuleSize"])
aArrayData[m,"usedCapacity"]=int(aArrayData[m,"usedCapacity"])
workingMaxCap=int(workingMaxCap)
# note: some cases memory capacity == max module size, so one stick will fill it
# but I think only with cases of 2 slots does this happen, so if > 2, use the count of slots.
if ( bDebugger1 == "true" ){
print "3: fmod: " aArrayData[m,"deviceCountFound"] " :modc: " aArrayData[m,"deviceCount16"] " :maxc1: " aArrayData[m,"maxCapacity5"] " :maxc2: " aArrayData[m,"maxCapacity16"]
}
if (workingMaxCap != 0 && ( aArrayData[m,"deviceCountFound"] != 0 || aArrayData[m,"deviceCount16"] != 0 ) ) {
aArrayData[m,"deviceCount16"]=int(aArrayData[m,"deviceCount16"])
## first check that actual memory found is not greater than listed max cap, or
## checking to see module count * max mod size is not > used capacity
if ( aArrayData[m,"usedCapacity"] != 0 && aArrayData[m,"maxCapacity16"] != 0 ) {
if ( aArrayData[m,"usedCapacity"] > workingMaxCap ) {
if ( aArrayData[m,"maxModuleSize"] != 0 &&
aArrayData[m,"usedCapacity"] < aArrayData[m,"deviceCount16"] * aArrayData[m,"maxModuleSize"] ) {
workingMaxCap=aArrayData[m,"deviceCount16"] * aArrayData[m,"maxModuleSize"]
estCap=" (est)"
if ( bDebugger1 == "true" ){
print "A"
}
}
else if ( aArrayData[m,"derivedModuleSize"] != 0 &&
aArrayData[m,"usedCapacity"] < aArrayData[m,"deviceCount16"] * aArrayData[m,"derivedModuleSize"] ) {
workingMaxCap=aArrayData[m,"deviceCount16"] * aArrayData[m,"derivedModuleSize"]
estCap=" (est)"
if ( bDebugger1 == "true" ){
print "B"
}
}
else {
workingMaxCap=aArrayData[m,"usedCapacity"]
estCap=" (est)"
if ( bDebugger1 == "true" ){
print "C"
}
}
}
}
# note that second case will never really activate except on virtual machines and maybe
# mobile devices
if ( estCap == "" ) {
# do not do this for only single modules found, max mod size can be equal to the array size
if ( ( aArrayData[m,"deviceCount16"] > 1 && aArrayData[m,"deviceCountFound"] > 1 ) &&
( workingMaxCap < aArrayData[m,"derivedModuleSize"] * aArrayData[m,"deviceCount16"] ) ) {
workingMaxCap = aArrayData[m,"derivedModuleSize"] * aArrayData[m,"deviceCount16"]
estCap=" (est)"
if ( bDebugger1 == "true" ){
print "D"
}
}
else if ( ( aArrayData[m,"deviceCountFound"] > 0 ) &&
( workingMaxCap < aArrayData[m,"derivedModuleSize"] * aArrayData[m,"deviceCountFound"] ) ) {
workingMaxCap = aArrayData[m,"derivedModuleSize"] * aArrayData[m,"deviceCountFound"]
estCap=" (est)"
if ( bDebugger1 == "true" ){
print "E"
}
}
## handle cases where we have type 5 data: mms x device count equals type 5 max cap
# however do not use it if cap / devices equals the derived module size
else if ( aArrayData[m,"maxModuleSize"] > 0 &&
( aArrayData[m,"maxModuleSize"] * aArrayData[m,"deviceCount16"] == aArrayData[m,"maxCapacity5"] ) &&
aArrayData[m,"maxCapacity5"] != aArrayData[m,"maxCapacity16"] &&
aArrayData[m,"maxCapacity16"] / aArrayData[m,"deviceCount16"] != aArrayData[m,"derivedModuleSize"] ) {
workingMaxCap = aArrayData[m,"maxCapacity5"]
altCap=aArrayData[m,"maxCapacity5"] # not used
estCap=" (check)"
if ( bDebugger1 == "true" ){
print "F"
}
}
}
}
altCap=int(altCap)
workingMaxCap=int(workingMaxCap)
if ( bDebugger1 == "true" ){
print "4: mmods: " aArrayData[m,"maxModuleSize"] " :dmmods: " aArrayData[m,"derivedModuleSize"] " :mcap: " workingMaxCap " :ucap: " aArrayData[m,"usedCapacity"]
}
# some cases of type 5 have too big module max size, just dump the data then since
# we cannot know if it is valid or not, and a guess can be wrong easily
if ( aArrayData[m,"maxModuleSize"] != 0 && workingMaxCap != "" &&
( aArrayData[m,"maxModuleSize"] > workingMaxCap ) ){
aArrayData[m,"maxModuleSize"] = 0
# print "yes"
}
if ( bDebugger1 == "true" ){
print "5: dms: " aArrayData[m,"derivedModuleSize"] " :dc: " aArrayData[m,"deviceCount16"] " :wmc: " workingMaxCap
}
## prep for output ##
if (aArrayData[m,"maxModuleSize"] == 0 ){
aArrayData[m,"maxModuleSize"]=""
# ie: 2x4gB
if ( estCap == "" && int(aArrayData[m,"derivedModuleSize"]) > 0 &&
workingMaxCap > ( int(aArrayData[m,"derivedModuleSize"]) * int(aArrayData[m,"deviceCount16"]) * 4 ) ) {
estCap=" (check)"
if ( bDebugger1 == "true" ){
print "G"
}
}
}
else {
# case where listed max cap is too big for actual slots x max cap, eg:
# listed max cap, 8gb, max mod 2gb, slots 2
if ( estCap == "" && aArrayData[m,"maxModuleSize"] > 0 ) {
if ( int(workingMaxCap) > int(aArrayData[m,"maxModuleSize"]) * aArrayData[m,"deviceCount16"] ) {
estCap=" (check)"
if ( bDebugger1 == "true" ){
print "H"
}
}
}
if (aArrayData[m,"maxModuleSize"] > 1023 ) {
aArrayData[m,"maxModuleSize"]=aArrayData[m,"maxModuleSize"] / 1024 " GB"
}
else {
aArrayData[m,"maxModuleSize"]=aArrayData[m,"maxModuleSize"] " MB"
}
}
if ( aArrayData[m,"deviceCount16"] == 0 ) {
aArrayData[m,"deviceCount16"] = ""
}
if (workingMaxCap != 0 ) {
if ( workingMaxCap < 1024 ) {
workingMaxCap = workingMaxCap
unit=" MB"
}
else if ( workingMaxCap < 1024000 ) {
workingMaxCap = workingMaxCap / 1024
unit=" GB"
}
else if ( workingMaxCap < 1024000000 ) {
workingMaxCap = workingMaxCap / 1024000
unit=" TB"
}
# we only want a max 2 decimal places, this trick gives 0 to 2
workingMaxCap=gensub(/([0-9]+\.[0-9][0-9]).*/,"\\1",1,workingMaxCap)
workingMaxCap = workingMaxCap unit estCap
}
else {
workingMaxCap == ""
}
print aArrayData[m,"data-type"] "," aArrayData[m,"handle"] "," aArrayData[m,"location"] "," workingMaxCap "," aArrayData[m,"deviceCount16"] "," aArrayData[m,"use"] "," aArrayData[m,"errorCorrection"] "," aArrayData[m,"maxModuleSize"] estMod "," aArrayData[m,"voltage5"]
# print device rows next
for ( j=0;j<=100;j++ ) {
if (aMemory[m,j,0] != "" ) {
unit=""
workingSize=aMemory[m,j,2]
if ( workingSize ~ /^[0-9]+$/ ) {
workingSize=int(workingSize)
if ( workingSize < 1024 ) {
workingSize = workingSize
unit=" MB"
}
else if ( workingSize < 1024000 ) {
workingSize = workingSize / 1024
unit=" GB"
}
else if ( workingSize < 1024000000 ) {
workingSize = workingSize / 1024000
unit=" TB"
}
# we only want a max 2 decimal places, this trick gives 0 to 2
workingSize=gensub(/([0-9]+\.[0-9][0-9]).*/,"\\1",1,workingSize)
workingSize = workingSize unit
}
print aMemory[m,j,0] "," aMemory[m,j,1] "," workingSize "," aMemory[m,j,3] "," aMemory[m,j,4] "," aMemory[m,j,5] "," aMemory[m,j,6] "," aMemory[m,j,7] "," aMemory[m,j,8] "," aMemory[m,j,9] "," aMemory[m,j,10] "," aMemory[m,j,11] "," aMemory[m,j,12] "," aMemory[m,j,13] "," aMemory[m,j,14] "," aMemory[m,j,15] "," aMemory[m,j,16] "," aMemory[m,j,17]
}
else {
break
}
}
}
}' <<< "$DMIDECODE_DATA" ) )
fi
fi
IFS="$ORIGINAL_IFS"
@ -11886,12 +12257,13 @@ print_ram_data()
{
eval $LOGFS
local memory_line='' line_2='' line_3='' b_module_present='true'
local error_string='' a_memory_item='' line_starter='Memory:' array_counter=0
local error_string='' a_memory_item='' line_starter='Memory:' array_counter=1 device_counter=1
local dmidecodeNull='No dmidecode memory data: try newer kernel.'
local manufacturer='' part_nu='' serial_nu='' device_speed='' configured_speed=''
local manufacturer='' part_nu='' serial_nu='' device_speed='' configured_speed='' bus_width=
local data_width='' total_width='' device_type='' device_type_detail='' bank='' slot='' form_factor=''
local device_size='' array_use='' location='' error_correction='' max_capacity='' nu_of_devices=''
local max_module_size='' module_voltage='' bank_connection=''
get_ram_data
#echo ${#A_MEMORY_DATA[@]}
@ -11909,10 +12281,16 @@ print_ram_data()
memory_line=''
line_2=''
line_3=''
bus_width=''
data_width=
total_width=
part_nu=''
serial_nu=''
manufacturer=''
# memory-array,0x0012,System Board,8 GB,4,System Memory,None
max_module_size=''
module_voltage=''
bank_connection=''
# memory-array,0x0012,System Board,8 GB,4,System Memory,None,max size,moudule voltage
if [[ ${a_memory_item[0]} == 'memory-array' ]];then
if [[ -n ${a_memory_item[4]} ]];then
nu_of_devices=${a_memory_item[4]}
@ -11929,33 +12307,55 @@ print_ram_data()
else
error_correction='N/A'
fi
memory_line="${C1}Array$SEP3${C2} $array_counter ${C1}capacity$SEP3${C2} $max_capacity ${C1}devices$SEP3${C2} $nu_of_devices ${C1}EC$SEP3${C2} $error_correction"
if [[ $B_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_memory_item[7]} ]];then
max_module_size="${C1}max module size${SEP3}${C2} ${a_memory_item[7]} "
fi
fi
if [[ $B_EXTRA_EXTRA_EXTRA_DATA == 'true' ]];then
if [[ -n ${a_memory_item[8]} ]];then
module_voltage="${C1}module voltage$SEP3${C2} ${a_memory_item[8]}"
fi
fi
memory_line="${C1}Array-$array_counter capacity$SEP3${C2} $max_capacity ${C1}devices$SEP3${C2} $nu_of_devices ${C1}EC$SEP3${C2} $error_correction "
line_2="$max_module_size$module_voltage"
if [[ -n $line_2 && $( calculate_line_length "$memory_line$line_2" ) -gt $COLS_INNER ]];then
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
memory_line="$line_2"
line_starter=' '
line_2=''
else
memory_line="$memory_line$line_2"
line_2=''
fi
(( array_counter++ ))
device_counter=1 # reset so device matches device count per array
else
# not used for now
if [[ -n ${a_memory_item[3333]} ]];then
if [[ -z ${a_memory_item[3]/BANK*/} ]];then
#bank=${a_memory_item[3]#BANK}
bank=${a_memory_item[3]}
bank=${bank## }
else
bank=${a_memory_item[3]}
fi
else
bank='N/A'
fi
# not used for now
if [[ -n ${a_memory_item[44444]} ]];then
if [[ -z ${a_memory_item[4]/SLOT*/} ]];then
#slot=${a_memory_item[4]#SLOT}
slot=${a_memory_item[4]}
slot=${slot## }
else
slot=${a_memory_item[4]}
fi
else
slot='N/A'
fi
# if [[ -n ${a_memory_item[3333]} ]];then
# if [[ -z ${a_memory_item[3]/BANK*/} ]];then
# #bank=${a_memory_item[3]#BANK}
# bank=${a_memory_item[3]}
# bank=${bank## }
# else
# bank=${a_memory_item[3]}
# fi
# else
# bank='N/A'
# fi
# # not used for now
# if [[ -n ${a_memory_item[44444]} ]];then
# if [[ -z ${a_memory_item[4]/SLOT*/} ]];then
# #slot=${a_memory_item[4]#SLOT}
# slot=${a_memory_item[4]}
# slot=${slot## }
# else
# slot=${a_memory_item[4]}
# fi
# else
# slot='N/A'
# fi
if [[ -n ${a_memory_item[15]} ]];then
locator=${a_memory_item[15]}
locator=${locator## }
@ -12019,32 +12419,35 @@ print_ram_data()
serial_nu='N/A'
fi
serial_nu="${C1}serial$SEP3${C2} $serial_nu "
if [[ $device_size != 'N/A' && -n ${a_memory_item[16]} ]];then
bank_connection=" ${a_memory_item[16]}"
fi
fi
fi
if [[ $B_EXTRA_EXTRA_EXTRA_DATA == 'true' ]];then
if [[ $b_module_present == 'true' ]] || \
[[ -n ${a_memory_item[11]} || -n ${a_memory_item[10]} ]];then
if [[ -n ${a_memory_item[11]} ]];then
data_width=${a_memory_item[11]}
else
data_width='N/A'
[[ -n ${a_memory_item[11]} || -n ${a_memory_item[10]} ]];then
# only create this if the total exists and is > data width
if [[ -n ${a_memory_item[10]/ bits/} && -n ${a_memory_item[11]/ bits} && \
${a_memory_item[11]/ bits/} -gt ${a_memory_item[10]/ bits/} ]];then
total_width=" (total$SEP3 ${a_memory_item[11]})"
fi
data_width="${C1}width$SEP3 total$SEP3${C2} $data_width "
if [[ -n ${a_memory_item[10]} ]];then
total_width=${a_memory_item[10]}
data_width=${a_memory_item[10]}
else
total_width='N/A'
data_width='N/A'
fi
total_width="${C1}data$SEP3${C2} $total_width "
bus_width="${C1}bus width$SEP3${C2} $data_width$total_width "
fi
fi
memory_line="${C1}Locator$SEP3${C2} $locator ${C1}size$SEP3${C2} $device_size $device_speed"
memory_line="${C1}Device-$device_counter$SEP3${C2} $locator ${C1}size$SEP3${C2} $device_size$bank_connection $device_speed"
if [[ $( calculate_line_length "$memory_line$device_type" ) -le $COLS_INNER ]];then
memory_line="$memory_line$device_type"
device_type=''
fi
line_3="$manufacturer$part_nu$serial_nu"
line_2="$device_type$data_width$total_width"
line_2="$device_type$bus_width"
# echo $( calculate_line_length "$memory_line" )
# echo $( calculate_line_length "$memory_line$line_2" )
if [[ $( calculate_line_length "$memory_line$line_2$line_3" ) -gt $COLS_INNER ]];then
@ -12052,16 +12455,17 @@ print_ram_data()
print_screen_output "$memory_line"
memory_line="$line_2"
line_starter=' '
if [[ -n $line_3 && $( calculate_line_length "$memory_line$line_3" ) -gt $COLS_INNER ]];then
if [[ -n $memory_line && -n $line_3 && $( calculate_line_length "$memory_line$line_3" ) -gt $COLS_INNER ]];then
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"
memory_line="$line_3"
else
memory_line="$line_2$line_3"
memory_line="$memory_line$line_3"
fi
else
memory_line="$memory_line$line_2$line_3"
fi
(( device_counter++ ))
fi
memory_line=$( create_print_line "$line_starter" "$memory_line${CN}" )
print_screen_output "$memory_line"