Skip to content

Parameterize and fix race condition for i2samp#404

Merged
makermelissa merged 2 commits into
adafruit:mainfrom
makermelissa:fix-i2samp-boot-race
Jun 30, 2026
Merged

Parameterize and fix race condition for i2samp#404
makermelissa merged 2 commits into
adafruit:mainfrom
makermelissa:fix-i2samp-boot-race

Conversation

@makermelissa

Copy link
Copy Markdown
Contributor

This creates the I2S Volume control as a service so that it can be started in a particular order.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a dedicated systemd “init” unit for the I2S amplifier softvol setup so volume/control initialization can be ordered ahead of the optional /dev/zero aplay service, addressing boot-time timing/race concerns.

Changes:

  • Adds an adafruit-i2samp-init.service unit and wires aplay.service to require it.
  • Updates install/uninstall logic to manage both systemd units via parameterized service-name constants.
  • Adds a boot-time wait loop for the ALSA card to appear before running the init steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread i2samp.py Outdated
Comment on lines +204 to +206
After=local-fs.target
Wants=sound.target
Before={APLAY_SERVICE}
Comment thread i2samp.py Outdated
RestartSec=5s

ExecStartPre=/bin/sh -c 'i=0; while [ "$i" -lt 30 ]; do \\
aplay -l | grep -qi "{card_name}" && exit 0; \\
Comment thread i2samp.py Outdated
Comment on lines +220 to +221
ExecStart=/usr/bin/amixer -D plug:softvol sset PCM 100%
ExecStart=/usr/sbin/alsactl store
@makermelissa makermelissa merged commit 27f8245 into adafruit:main Jun 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants