Skip to content
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

ALSA support #4

Closed
5 tasks done
tmigone opened this issue May 22, 2020 · 2 comments
Closed
5 tasks done

ALSA support #4

tmigone opened this issue May 22, 2020 · 2 comments

Comments

@tmigone
Copy link
Contributor

tmigone commented May 22, 2020

Device sound cards will be preconfigured and exposed to pulseaudio for supported devices with no extra configuration needed.

Raspberry Pi 3:

  • Audio jack
  • HDMI

Raspberry Pi 4:

  • Audio jack
  • HDMI0
  • HDMI1
@tmigone tmigone added this to To do in Initial release May 22, 2020
tmigone added a commit that referenced this issue May 26, 2020
Connects-to: #1 #2 #4
Signed-off-by: Tomás Migone <tomas@balena.io>
tmigone added a commit that referenced this issue May 26, 2020
- Update image to use ENTRYPOINT
- Add livepush dev-cmd-live for local dev
- Tidy up image

Connects-to: #1 #2 #4
Signed-off-by: Tomás Migone <tomas@balena.io>
tmigone added a commit that referenced this issue May 29, 2020
Connects-to: #11 #8 #5 #4
Change-type: minor
Signed-off-by: Tomás Migone <tomas@balena.io>
@tmigone tmigone moved this from To do to In progress in Initial release May 29, 2020
@tmigone
Copy link
Contributor Author

tmigone commented Jun 19, 2020

Raspberry Pi

snd_bcm2835 kernel module has two modes of operation:

  1. without parameters, it will create a single ALSA card (aplay -l) with two/three different "devices". You can switch between them using amixer cset numid=3 x.

  2. using parameters: snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_compat_alsa=0. It will create two/three different cards.

Considerations

  • Mode 2 allows you to have one pulse sink for each output (HDMI0/HDMI1/3.5mm) which is what we want because standarization is good! (pactl load-module alsa-sink device=hw:CARD=HDMI,DEV=0)
  • Mode 2 is not the default module configuration. So enabling it requires either editing cmdline.txt or modprobe-ing the module on startup.
  • Mode 1, pulseaudio overrides the default amixer card so amixer cset numid=3 x needs to be amixer -c 0 cset numid=3 x.
  • Mode 2 removes the need of installing alsa-utils package which can spur confusion.

Neat bash commands to get kernel module parameters:

cat /proc/modules | cut -f 1 -d " " | while read module; do \
 echo "Module: $module"; \
 if [ -d "/sys/module/$module/parameters" ]; then \
  ls /sys/module/$module/parameters/ | while read parameter; do \
   echo -n "Parameter: $parameter --> "; \
   cat /sys/module/$module/parameters/$parameter; \
  done; \
 fi; \
 echo; \
done

@tmigone tmigone closed this as completed Jun 23, 2020
@tmigone tmigone moved this from In progress to Done in Initial release Jun 23, 2020
@tmigone
Copy link
Contributor Author

tmigone commented Jul 7, 2020

Reopening to further evaluate in the future...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

1 participant