inxi audio driver extraction algo
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
This looks like it can patch the ugly driver extractor that inxi audio is using now

:: Code ::
lspci -nnv | gawk '{IGNORECASE = 1}; /multimedia|audio/, /^$/ {if ( $0 ~ /kernel driver/)driver = $0;if ( $0 ~ /kernel module/)module = $0} END { print "driver: " driver " module: " module}'

driver:         Kernel driver in use: Intel ICH module:         Kernel modules: snd-intel8x0


and then some gensub fine tuning:

:: Code ::
lspci -nnv | gawk '{IGNORECASE = 1}; /multimedia|audio/, /^$/ {if ( $0 ~ /kernel driver/)driver = gensub( /(.*): (.*)/,"\\2","g",$0);if ( $0 ~ /kernel module/)module = gensub(/(.*): (.*)/,"\\2","g",$0)} END { print "driver: " driver " module: " module}'
# this gives us:
driver: Intel ICH module: snd-intel8x0


and to translate this to human readable:
:: Code ::
lspci -nnv | gawk '{
IGNORECASE = 1}
/multimedia|audio/, /^$/ {
if ( $0 ~ /kernel driver/){
driver = gensub( /(.*): (.*)/,"\\2","g",$0)
}
if ( $0 ~ /kernel module/){
module = gensub(/(.*): (.*)/,"\\2","g",$0)
}
}
END {
print "driver: " driver " module: " module
}'

driver: Intel ICH module: snd-intel8x0
Back to top
Display posts from previous:   

All times are GMT - 8 Hours