changed gfx drivers to use array for better output control, and also for future other gfx features

This commit is contained in:
inxi-svn 2011-05-25 01:53:20 +00:00
parent 9c8489d6b0
commit b6fca3c48b

34
inxi
View file

@ -191,6 +191,7 @@ A_CPU_TYPE_PCNT_CCNT=''
A_DEBUG_BUFFER='' A_DEBUG_BUFFER=''
A_GFX_CARD_DATA='' A_GFX_CARD_DATA=''
A_GLX_DATA='' A_GLX_DATA=''
A_GRAPHIC_DRIVERS=''
A_HDD_DATA='' A_HDD_DATA=''
A_INTERFACES_DATA='' A_INTERFACES_DATA=''
A_NETWORK_DATA='' A_NETWORK_DATA=''
@ -3218,10 +3219,11 @@ get_graphics_driver()
# list is from sgfxi plus non-free drivers # list is from sgfxi plus non-free drivers
local driver_list='apm ark ati chips cirrus cyrix fbdev fglrx glint i128 i740 intel i810 imstt mach64 mga neomagic nsc nv nvidia openchrome nouveau radeon radeonhd rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng unichrome vesa vga via voodoo vmware v4l' local driver_list='apm ark ati chips cirrus cyrix fbdev fglrx glint i128 i740 intel i810 imstt mach64 mga neomagic nsc nv nvidia openchrome nouveau radeon radeonhd rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng unichrome vesa vga via voodoo vmware v4l'
local driver='' driver_string='' spacer='' xorg_log_data='' status='' local driver='' driver_string='' xorg_log_data='' status=''
if [[ $B_XORG_LOG == 'true' ]];then if [[ $B_XORG_LOG == 'true' ]];then
xorg_log_data="$( cat $FILE_XORG_LOG )" xorg_log_data="$( cat $FILE_XORG_LOG )"
A_GRAPHIC_DRIVERS=( $(
for driver in $driver_list for driver in $driver_list
do do
# note there appears to be different unload/failed syntax, so using simple conservative one # note there appears to be different unload/failed syntax, so using simple conservative one
@ -3232,14 +3234,15 @@ get_graphics_driver()
else else
status='failed' status='failed'
fi fi
driver_string="$driver_string$driver->$status$spacer" driver_string="$driver,$status"
spacer=' ' echo $driver_string
fi fi
done done
) )
xorg_log_data='' # dump from ram, does it matter? xorg_log_data='' # dump from ram, does it matter?
fi fi
log_function_data "A_GRAPHIC_DRIVERS: ${A_GRAPHIC_DRIVERS[@]}"
echo $driver_string
eval $LOGFE eval $LOGFE
} }
@ -5426,6 +5429,7 @@ print_gfx_data()
local screen_resolution="$( get_graphics_res_data )" local screen_resolution="$( get_graphics_res_data )"
local b_is_mesa='false' display_full_string='' gfx_bus_id='' gfx_card_data='' local b_is_mesa='false' display_full_string='' gfx_bus_id='' gfx_card_data=''
local res_tty='Res' xorg_data='' x_vendor_string='' x_driver_string='' x_driver_plural='' local res_tty='Res' xorg_data='' x_vendor_string='' x_driver_string='' x_driver_plural=''
local spacer=''
# set A_GFX_CARD_DATA # set A_GFX_CARD_DATA
get_graphics_card_data get_graphics_card_data
# set A_X_DATA # set A_X_DATA
@ -5439,11 +5443,27 @@ print_gfx_data()
# this can contain a long No case debugging message, so it's being sliced off # this can contain a long No case debugging message, so it's being sliced off
# note: using grep -ioE '(No|Yes)' <<< ${A_GLX_DATA[2]} did not work in Arch, no idea why # note: using grep -ioE '(No|Yes)' <<< ${A_GLX_DATA[2]} did not work in Arch, no idea why
local glx_direct_render=$( gawk '{print $1}' <<< "${A_GLX_DATA[2]}" ) local glx_direct_render=$( gawk '{print $1}' <<< "${A_GLX_DATA[2]}" )
local x_driver=$( get_graphics_driver )
if [[ -z $x_driver ]];then # set A_GRAPHIC_DRIVERS
get_graphics_driver
local x_driver=''
if [[ ${#A_GRAPHIC_DRIVERS[@]} -eq 0 ]];then
x_driver='N/A' x_driver='N/A'
elif [[ $( wc -w <<< $x_driver ) -gt 1 ]];then else
for (( i=0; i < ${#A_GRAPHIC_DRIVERS[@]}; i++ ))
do
IFS=","
a_gfx_working=( ${A_GRAPHIC_DRIVERS[i]} )
IFS="$ORIGINAL_IFS"
x_driver="$x_driver$spacer${a_gfx_working[0]}"
if [[ -n ${a_gfx_working[1]} ]];then
x_driver="$x_driver (${a_gfx_working[1]})"
fi
spacer=' '
done
fi
if [[ ${#A_GRAPHIC_DRIVERS[@]} -gt 1 ]];then
x_driver_plural='s' x_driver_plural='s'
fi fi
x_driver_string="${C1}driver$x_driver_plural${C2} $x_driver " x_driver_string="${C1}driver$x_driver_plural${C2} $x_driver "