summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@chromium.org>2013-05-13 19:33:06 +0800
committerChromeBot <chrome-bot@google.com>2013-05-13 21:03:52 -0700
commit76417e2ea34fa8cf9a35617aaf945f7a5d0cee27 (patch)
treebcea9f8ebb31be15caab1be8ac526a4d2208d27b /scripts
parent74f562a587d1250a49bca37f29fd6cc42aba8b80 (diff)
downloadadhd-76417e2ea34fa8cf9a35617aaf945f7a5d0cee27.tar.gz
Add audio diagnostic script.
We will use this in generate_logs script to identify the cause of audio issues. BUG=chrome-os-partner:19180 TEST=run the script on spring and link. Change-Id: I6ad89ff6bb97e32c0506c801aeb5d4c1e190f0c1 Reviewed-on: https://gerrit.chromium.org/gerrit/50978 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Chih-Chung Chang <chihchung@chromium.org> Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/audio_diagnostics44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/audio_diagnostics b/scripts/audio_diagnostics
new file mode 100755
index 00000000..39e122ba
--- /dev/null
+++ b/scripts/audio_diagnostics
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Collect information about the audio system from top to bottom.
+
+echo '=== cras_test_client --dump_server_info ==='
+cras_test_client --dump_server_info
+
+echo '=== aplay -l ==='
+aplay -l
+echo '=== arecord -l ==='
+arecord -l
+
+cards=$(aplay -l | egrep ^card | sed 's/card \([0-9]\+\).*/\1/' | sort -u)
+for card in $cards
+do
+ echo '=== amixer -c' $card scontents '==='
+ amixer -c $card scontents
+ echo '=== amixer -c' $card contents '==='
+ amixer -c $card contents
+done
+
+# HDA codec for codecs on x86.
+codecs=$(find /proc/asound -mindepth 2 -maxdepth 2 -path '*card*/codec#*')
+for codec in $codecs
+do
+ echo '=== codec:' $codec '==='
+ cat $codec
+done
+
+# I2C dump for codecs on arm.
+# Find lines like "max98088.7-0010" and extract "7 0x0010" from it.
+if [ -e /sys/kernel/debug/asoc/codecs ]; then
+ sed_expr='s/^\([^.-]\+\)\.\([0-9]\+\)-\([0-9]\+\)$/\2 0x\3/p'
+ sed -n "$sed_expr" /sys/kernel/debug/asoc/codecs |
+ while read i2c_addr
+ do
+ echo '===' i2cdump -f -y $i2c_addr '==='
+ i2cdump -f -y $i2c_addr
+ done
+fi