Fixed messup with gfx arrays, mixed up glx and gfx

This commit is contained in:
inxi-svn 2008-10-30 07:23:45 +00:00
parent 78ca858d54
commit 19ad149b28

34
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 0.1.47
#### version: 0.1.48
#### Date: October 29 2008
########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -49,6 +49,7 @@ X_NUMBER=''
## primary data array holders
A_CPU_DATA=''
A_GFX_DATA=''
A_GLX_DATA=''
A_NETWORK_DATA=''
# Variable initializations: constants
@ -868,9 +869,9 @@ get_graphics_data()
local i=''
IFS=$'\n'
A_GFX_DATA=($( echo "$LSPCI" | gawk -F': ' '/VGA compatible controller/ { print $NF }' ))
A_GFX_DATA=( $( echo "$LSPCI" | gawk -F': ' '/VGA compatible controller/ { print $NF }' ) )
IFS="$OIFS"
for (( i=0; i < ${#GFX[@]}; i++ ))
for (( i=0; i < ${#A_GFX_DATA[@]}; i++ ))
do
A_GFX_DATA[i]=$( sanitize_characters A_NORMAL_BANS "${A_GFX_DATA[i]}" )
done
@ -929,7 +930,7 @@ get_graphics_data()
#however currently infobash ignores X checks when X is not found.
IFS=$'\n'
GLX=($(glxinfo | gawk -F ': ' '
A_GLX_DATA=( $( glxinfo | gawk -F ': ' '
function join(arr, sep) {
s=""
i=flag=0
@ -959,15 +960,15 @@ get_graphics_data()
END {
printf("%s\n%s\n%s\n", join(a,", "), join(b,", "), join(c,", "))
}
'))
' ) )
IFS="$OIFS"
GLXR="${A_GFX_DATA[0]}"
GLXV="${A_GFX_DATA[1]}"
GLXDR="${A_GFX_DATA[2]}"
GLXR="${A_GLX_DATA[0]}"
GLXV="${A_GLX_DATA[1]}"
GLXDR="${A_GLX_DATA[2]}"
# GLXR=$(glxinfo | gawk -F ': ' 'BEGIN {IGNORECASE=1} /opengl renderer/ && $2 !~ /mesa/ {seen[$2]++} END {for (i in seen) {printf("%s ",i)}}')
# GLXV=$(glxinfo | gawk -F ': ' 'BEGIN {IGNORECASE=1} /opengl version/ && $2 !~ /mesa/ {seen[$2]++} END {for (i in seen) {printf("%s ",i)}}')
if [ -z "$GLXR" -o -z "$GLXV" ]
then
MESA=1
@ -1193,18 +1194,18 @@ print_cpu_data()
print_gfx_data()
{
local gfx_data='' i='' card_one='Card '
gfx_data=$( create_print_line "Graphics:" "${C1}$card_one${C2}${A_GFX_DATA[0]}" )
if [[ ${#A_GFX_DATA[@]} -gt 1 ]]
then
i=1
while [[ -n ${GFX[i]} && $i -le 3 ]]
while [[ -n ${A_GFX_DATA[i]} && $i -le 3 ]]
do
gfx_data=" ${C1}Card-$(($i+1))${C2} ${GFX[i]} "
(( i++ ))
gfx_data="${gfx_data} ${C1}Card-$(($i+1))${C2} ${A_GFX_DATA[i]} "
((i++))
done
card_one='Card-1 '
fi
gfx_data=$( create_print_line "Graphics:" "${C1}$card_one${C2}${A_GFX_DATA[0]}${gfx_data}" )
if [ "$X" -gt 0 ]
then
gfx_data="${gfx_data} ${CN}| ${C1}$X_VENDOR${C2} $X_VER_NUM ${CN}| ${C1}Res${C2} ${RES}"
@ -1212,11 +1213,12 @@ print_gfx_data()
gfx_data="${gfx_data} ${C1} tty resolution ${CN}(${C2} ${RES} ${CN})"
fi
print_screen_output "$gfx_data"
# echo x$X m$MESA
# echo GLXR$GLXR GLXV$GLXV
if [ "$X" -gt 0 -a "$MESA" -eq 0 ]
then
gfx_data=$( create_print_line " " "${C1}GLX Renderer${C2} ${GLXR} ${CN}| ${C1}GLX Version${C2} ${GLXV}${CN}" )
if ((CRAP))
if [ "$CRAP" -gt 0 ]
then
gfx_data="${gfx_data} ${C1}Direct rendering${C2} ${GLXDR}${CN}"
fi