• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6#
7# Collect information about the audio system from top to bottom.
8
9dump_cards() {
10    for card in ${@}
11    do
12        echo '=== amixer -c' $card scontents '==='
13        amixer -c $card scontents
14        echo '=== amixer -c' $card contents '==='
15        amixer -c $card contents
16    done
17}
18
19echo '=== cras_test_client --dump_server_info ==='
20cras_test_client --dump_server_info
21
22echo '=== cras_test_client --dump_audio_thread ==='
23cras_test_client --dump_audio_thread
24
25echo '=== cras_test_client --dump_events ==='
26cras_test_client --dump_events
27
28echo '=== aplay -l ==='
29aplay -l
30echo '=== arecord -l ==='
31arecord -l
32
33output_cards=$(aplay -l | egrep ^card | sed 's/card \([0-9]\+\).*/\1/' | sort -u)
34dump_cards $output_cards
35
36input_cards=$(arecord -l | egrep ^card | sed 's/card \([0-9]\+\).*/\1/' | sort -u)
37dump_cards $input_cards
38
39# HDA codec for codecs on x86.
40codecs=$(find /proc/asound -mindepth 2 -maxdepth 2 -path '*card*/codec#*')
41for codec in $codecs
42do
43    echo '=== codec:' $codec '==='
44    cat $codec
45done
46
47# I2C dump for codecs on arm.
48# Find lines like "max98088.7-0010" and extract "7 0x0010" from it.
49if [ -e /sys/kernel/debug/asoc/codecs ]; then
50    sed_expr='s/^\([^.-]\+\)\.\([0-9]\+\)-\([0-9]\+\)$/\2 0x\3/p'
51    sed -n "$sed_expr" /sys/kernel/debug/asoc/codecs |
52    while read i2c_addr
53    do
54        echo '===' i2cdump -f -y $i2c_addr '==='
55        i2cdump -f -y $i2c_addr
56    done
57fi
58