Repository navigation
check-sof-logger.sh: use a short stream in ping_pcm_devices() #1371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -102,13 +102,44 @@ wait_for_sof_alsa_card() | |||||
|
|
||||||
| ping_pcm_devices() | ||||||
| { | ||||||
| # Open all ALSA PCM nodes and read one byte out of them. | ||||||
| # The operation will fail, but this is enough to cause | ||||||
| # the device to be powered up if it was in runtime-suspended (D3) | ||||||
| # state. | ||||||
| for pcm in /dev/snd/pcm* ; do | ||||||
| dd if="$pcm" of=/dev/null bs=1 count=1 >/dev/null 2>/dev/null || true | ||||||
| # Run a short real stream on one SOF PCM to power up the DSP (and | ||||||
| # boot it if needed), including when it was in runtime-suspended | ||||||
| # (D3) state. Merely opening the PCM device node is not enough with | ||||||
| # recent SOF drivers. Topology independent: try the PCMs of all SOF | ||||||
| # cards until one works. plughw converts format, rate and channels | ||||||
| # to what the PCM supports. Failing PCMs, e.g. HDMI without a | ||||||
| # monitor, are expected. | ||||||
| local cardpath cardnum pcm dev dir tool err | ||||||
| local params=(-q -t raw -f S16_LE -r 48000 -c 2 -d 1) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to be explicit here, no need to save characters typing here |
||||||
|
|
||||||
| for cardpath in /proc/asound/card[0-9]*; do | ||||||
| # SOF card ids start with "sof", see sof_alsa_card_found() | ||||||
| grep -q '^sof' "$cardpath/id" || continue | ||||||
| cardnum=${cardpath##*card} | ||||||
|
|
||||||
| for pcm in "$cardpath"/pcm[0-9]*[pc]; do | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to get out the fw boot log why do you need to ping all of the PCMs of the card?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ujfalusi ? the test doesn't do this, see L135 |
||||||
| test -e "$pcm" || continue | ||||||
| dev=${pcm##*/pcm} # e.g. 12p | ||||||
| dir=${dev: -1} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This syntax is valid and useful but very cryptic for non-shell experts. What is especially cryptic: it's totally different from An audio expert can guess the intent and "reverse-engineer" it but that's not ideal. |
||||||
| dev=${dev%?} | ||||||
|
|
||||||
| if [ "$dir" = p ]; then | ||||||
| tool=(aplay "${params[@]}" -D "plughw:$cardnum,$dev" /dev/zero) | ||||||
| else | ||||||
| tool=(arecord "${params[@]}" -D "plughw:$cardnum,$dev" /dev/null) | ||||||
| fi | ||||||
|
|
||||||
| # Keep the error message, it is the only hint why a PCM | ||||||
| # was skipped | ||||||
| if err=$(timeout -k 2 5 "${tool[@]}" 2>&1); then | ||||||
| return 0 | ||||||
| fi | ||||||
| dlogi "${tool[0]} on plughw:$cardnum,$dev failed, trying next PCM: $err" | ||||||
| done | ||||||
| done | ||||||
|
|
||||||
| dlogw "No SOF PCM could be opened, DSP may not be active" | ||||||
| return 0 | ||||||
| } | ||||||
|
|
||||||
| run_loggers() | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.