mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
Trying the locsmif method, querying /proc/scsi/scsi directly instead, a failure case was discovered there.
This commit is contained in:
parent
0a6347bed9
commit
b27b6507a1
48
inxi
48
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.4.15
|
||||
#### version: 0.4.16
|
||||
#### Date: November 8 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||
|
@ -1242,15 +1242,43 @@ get_hard_drive_data_advanced()
|
|||
IFS=$'\n'
|
||||
## prints out hdd device if field one is ATA type (sata compatibility mode) or prints out scsi device
|
||||
# note: pmap handles usb mounted devices, which have a null first field
|
||||
a_temp_scsi=( $( gawk -F'\t' '
|
||||
BEGIN { IGNORECASE=1 }
|
||||
# if the item starts with empty, void field, assume it is flash drive
|
||||
/^ata|^scsi|^ |^corsair|^wdc|^kingston/ {
|
||||
gsub(/,/, " ", $(NF -1) )
|
||||
gsub(/^ +| +$/, "", $(NF -1) )
|
||||
print $(NF -1)
|
||||
}
|
||||
' /proc/scsi/sg/device_strs ) )
|
||||
if [[ $B_TESTING_FLAG == 'true' ]];then
|
||||
a_temp_scsi=( $( gawk -F'\t' '
|
||||
BEGIN { IGNORECASE=1 }
|
||||
# if the item starts with empty, void field, assume it is flash drive
|
||||
/^ata|^scsi|^ |^corsair|^wdc|^kingston/ {
|
||||
gsub(/,/, " ", $(NF -1) )
|
||||
gsub(/^ +| +$/, "", $(NF -1) )
|
||||
print $(NF -1)
|
||||
}
|
||||
' /proc/scsi/sg/device_strs ) )
|
||||
else
|
||||
a_temp_scsi=( $( gawk '
|
||||
BEGIN { IGNORECASE=1 }
|
||||
/host/ {
|
||||
getline a[$0]
|
||||
getline b[$0]
|
||||
}
|
||||
END {
|
||||
for (i in a) {
|
||||
if (b[i] ~ / *type: *direct-access.*/) {
|
||||
#c=gensub(/^ *vendor: (.+) +model: (.+) +rev: (.+)$/,"\\1 \\2 \\3","g",a[i])
|
||||
#c=gensub( /^ *vendor: (.+) +model: (.+) +rev:.*$/,"\\1 \\2","g",a[i] )
|
||||
# the vendor: string is useless, and is a bug, ATA is not a vendor for example
|
||||
c=gensub( /^ *vendor: (.+) +model: (.+) +rev:.*$/,"\\2","g",a[i] )
|
||||
gsub(/,/, " ", c)
|
||||
gsub(/^ +| +$/, "", c)
|
||||
gsub(/ [ \t]+/, " ", c)
|
||||
#print a[i]
|
||||
# we actually want this data, so leaving this off for now
|
||||
# if (c ~ /\<flash\>|\<pendrive\>|memory stick|memory card/) {
|
||||
# continue
|
||||
# }
|
||||
print c
|
||||
}
|
||||
}
|
||||
}' /proc/scsi/scsi) )
|
||||
fi
|
||||
IFS="$ORIGINAL_IFS"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue