Skip to content

Commit

Permalink
Issue #2083 - Fix scraping for mixer devices.
Browse files Browse the repository at this point in the history
The list of mixer devices was limited to 1 due to 'head -1' in
the command pipeline.  This means you could only every set
and persist the first mixer device of a card.

Remove the 'head -1' call so all mixer devices are scraped.
  • Loading branch information
octalthorpe committed Dec 11, 2024
1 parent 01d7bff commit aa29d4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/boot/FPPINIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1091,13 +1091,13 @@ static void setupAudio() {
break;
}
PutFileContents("/root/.asoundrc", asoundrc);
std::string mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | head -1 | cut -f2 -d\"'\"");
std::string mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | cut -f2 -d\"'\"");
if (mixers.empty()) {
// for some sound cards, the mixer devices won't show up
// until something is played. Play one second of silence
exec("/usr/bin/aplay -d 1 /opt/fpp/media/silence_5sec.wav >> /dev/null 2>&1 &");
std::this_thread::sleep_for(std::chrono::milliseconds(200));
mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | head -1 | cut -f2 -d\"'\"");
mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | cut -f2 -d\"'\"");
}
TrimWhiteSpace(mixers);
std::string mixer;
Expand Down

0 comments on commit aa29d4d

Please sign in to comment.