Skip to content

Instantly share code, notes, and snippets.

@highgain86j
Last active May 9, 2026 02:57
Show Gist options
  • Select an option

  • Save highgain86j/df290fb7cad37d3fc78f8554cf99b6ec to your computer and use it in GitHub Desktop.

Select an option

Save highgain86j/df290fb7cad37d3fc78f8554cf99b6ec to your computer and use it in GitHub Desktop.
Use this script to get detailed reports on your Linux desktop about typical internal audio devices.
#!/usr/bin/bash
count=0
arry_summary=()
find /proc/asound/card* -mindepth 1 -maxdepth 1 -not -type d | grep -E 'codec\#[0-9]+' | \
while read -r filepath; do
arry_summary=($(cat "${filepath}" | grep -E '^Address:|^Codec:|^Vendor Id:|^Subsystem Id:|^Revision Id:' | sed -e 's/: /:/g' -e 's/ /_/g'| sort))
attr_address=$(echo ${arry_summary[0]} | awk -F':' '{print $2}')
attr_codec=$(echo ${arry_summary[1]} | awk -F':' '{print $2}')
attr_revision_id=$(echo ${arry_summary[2]} | awk -F':' '{print $2}')
attr_subsystem_id=$(echo ${arry_summary[3]} | awk -F':' '{print $2}')
attr_vendor_id=$(echo ${arry_summary[4]} | awk -F':' '{print $2}')
attr_vid=${attr_vendor_id:2:4}
attr_pid=${attr_vendor_id:6:4}
path_write_to="/tmp/CODEC_${attr_address}-VID_${attr_vid^^}-PID_${attr_pid^^}-${attr_codec}.txt"
echo "### ${filepath} ###" | tee ${path_write_to}
echo "SUMMARY:"
for ((count=0; count<${#arry_summary[@]}; count++)); do
echo -e "\t${arry_summary[count]}"
done
echo | tee ${path_write_to}
cat "${filepath}" >> ${path_write_to}
echo -e "\tA detailed report has been exported to \"${path_write_to}\"."
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment