audio icon indicating copy to clipboard operation
audio copied to clipboard

Entry.sh breaks on Intel NUC ironically because of special handling for Intel NUC

Open bbugh opened this issue 6 months ago • 1 comments

Issue

When booting audio on an Intel NUC, the error occurs:

amixer: Control sysdefault:0 element write error: Operation not permitted

This is caused by lines 138 and 139:

https://github.com/balena-labs-projects/audio/blob/9d56da326b8cd9e85934e04b936d0363ccabba8d/entry.sh#L137-L141

Presumably this is attempting to set up the Intel NUC default audio card, but this is breaking with the error above.

Since this was added three years ago, it seems like at some point in the past this was a workaround for whatever audio device Intel NUC shipped with, but after research I'm guessing it's no longer relevant. For example, the above code mentions Master Playback Switch and Master Playback Volume controls, but on an "HDA Intel PCH / Intel Tigerlake HDMI" these ALSA controls are not exposed.

cat /proc/asound/card*/codec*
Codec: Intel Tigerlake HDMI
amixer --card hda-intel controls
amixer --card hda-intel controls
numid=25,iface=CARD,name='HDMI/DP,pcm=10 Jack'
numid=31,iface=CARD,name='HDMI/DP,pcm=11 Jack'
numid=37,iface=CARD,name='HDMI/DP,pcm=12 Jack'
numid=43,iface=CARD,name='HDMI/DP,pcm=13 Jack'
numid=49,iface=CARD,name='HDMI/DP,pcm=14 Jack'
numid=55,iface=CARD,name='HDMI/DP,pcm=15 Jack'
numid=61,iface=CARD,name='HDMI/DP,pcm=16 Jack'
numid=67,iface=CARD,name='HDMI/DP,pcm=17 Jack'
numid=1,iface=CARD,name='HDMI/DP,pcm=3 Jack'
numid=7,iface=CARD,name='HDMI/DP,pcm=7 Jack'
numid=13,iface=CARD,name='HDMI/DP,pcm=8 Jack'
numid=19,iface=CARD,name='HDMI/DP,pcm=9 Jack'
numid=2,iface=MIXER,name='IEC958 Playback Con Mask'
numid=8,iface=MIXER,name='IEC958 Playback Con Mask',index=1
numid=14,iface=MIXER,name='IEC958 Playback Con Mask',index=2
numid=20,iface=MIXER,name='IEC958 Playback Con Mask',index=3
numid=26,iface=MIXER,name='IEC958 Playback Con Mask',index=4
numid=32,iface=MIXER,name='IEC958 Playback Con Mask',index=5
numid=38,iface=MIXER,name='IEC958 Playback Con Mask',index=6
numid=44,iface=MIXER,name='IEC958 Playback Con Mask',index=7
numid=50,iface=MIXER,name='IEC958 Playback Con Mask',index=8
numid=56,iface=MIXER,name='IEC958 Playback Con Mask',index=9
numid=62,iface=MIXER,name='IEC958 Playback Con Mask',index=10
numid=68,iface=MIXER,name='IEC958 Playback Con Mask',index=11
numid=3,iface=MIXER,name='IEC958 Playback Pro Mask'
numid=9,iface=MIXER,name='IEC958 Playback Pro Mask',index=1
numid=15,iface=MIXER,name='IEC958 Playback Pro Mask',index=2
numid=21,iface=MIXER,name='IEC958 Playback Pro Mask',index=3
numid=27,iface=MIXER,name='IEC958 Playback Pro Mask',index=4
numid=33,iface=MIXER,name='IEC958 Playback Pro Mask',index=5
numid=39,iface=MIXER,name='IEC958 Playback Pro Mask',index=6
numid=45,iface=MIXER,name='IEC958 Playback Pro Mask',index=7
numid=51,iface=MIXER,name='IEC958 Playback Pro Mask',index=8
numid=57,iface=MIXER,name='IEC958 Playback Pro Mask',index=9
numid=63,iface=MIXER,name='IEC958 Playback Pro Mask',index=10
numid=69,iface=MIXER,name='IEC958 Playback Pro Mask',index=11
numid=4,iface=MIXER,name='IEC958 Playback Default'
numid=10,iface=MIXER,name='IEC958 Playback Default',index=1
numid=16,iface=MIXER,name='IEC958 Playback Default',index=2
numid=22,iface=MIXER,name='IEC958 Playback Default',index=3
numid=28,iface=MIXER,name='IEC958 Playback Default',index=4
numid=34,iface=MIXER,name='IEC958 Playback Default',index=5
numid=40,iface=MIXER,name='IEC958 Playback Default',index=6
numid=46,iface=MIXER,name='IEC958 Playback Default',index=7
numid=52,iface=MIXER,name='IEC958 Playback Default',index=8
numid=58,iface=MIXER,name='IEC958 Playback Default',index=9
numid=64,iface=MIXER,name='IEC958 Playback Default',index=10
numid=70,iface=MIXER,name='IEC958 Playback Default',index=11
numid=5,iface=MIXER,name='IEC958 Playback Switch'
numid=11,iface=MIXER,name='IEC958 Playback Switch',index=1
numid=17,iface=MIXER,name='IEC958 Playback Switch',index=2
numid=23,iface=MIXER,name='IEC958 Playback Switch',index=3
numid=29,iface=MIXER,name='IEC958 Playback Switch',index=4
numid=35,iface=MIXER,name='IEC958 Playback Switch',index=5
numid=41,iface=MIXER,name='IEC958 Playback Switch',index=6
numid=47,iface=MIXER,name='IEC958 Playback Switch',index=7
numid=53,iface=MIXER,name='IEC958 Playback Switch',index=8
numid=59,iface=MIXER,name='IEC958 Playback Switch',index=9
numid=65,iface=MIXER,name='IEC958 Playback Switch',index=10
numid=71,iface=MIXER,name='IEC958 Playback Switch',index=11
numid=6,iface=PCM,name='ELD',device=3
numid=73,iface=PCM,name='Playback Channel Map',device=3
numid=12,iface=PCM,name='ELD',device=7
numid=74,iface=PCM,name='Playback Channel Map',device=7
numid=18,iface=PCM,name='ELD',device=8
numid=75,iface=PCM,name='Playback Channel Map',device=8
numid=24,iface=PCM,name='ELD',device=9
numid=76,iface=PCM,name='Playback Channel Map',device=9
numid=30,iface=PCM,name='ELD',device=10
numid=77,iface=PCM,name='Playback Channel Map',device=10
numid=36,iface=PCM,name='ELD',device=11
numid=78,iface=PCM,name='Playback Channel Map',device=11
numid=42,iface=PCM,name='ELD',device=12
numid=79,iface=PCM,name='Playback Channel Map',device=12
numid=48,iface=PCM,name='ELD',device=13
numid=80,iface=PCM,name='Playback Channel Map',device=13
numid=54,iface=PCM,name='ELD',device=14
numid=81,iface=PCM,name='Playback Channel Map',device=14
numid=60,iface=PCM,name='ELD',device=15
numid=82,iface=PCM,name='Playback Channel Map',device=15
numid=66,iface=PCM,name='ELD',device=16
numid=83,iface=PCM,name='Playback Channel Map',device=16
numid=72,iface=PCM,name='ELD',device=17
numid=84,iface=PCM,name='Playback Channel Map',device=17

Proposed Solution

If this code is still relevant to some NUC configurations, it seems like it should only be run in circumstances where the default card is requested, or the expected card from three years ago exists.

However, we are using a USB audio device and would not want this code to run anyway, even if it didn't break the deployment, because we do not want the default audio enabled.

Perhaps a solution would be to wrap this in an environment variable that can be enabled so that this code can be disabled?

Workaround

We've had to copy entry.sh and comment this out, but it would be preferable (and more future proof) to not have to manually edit the entrypoint.

Additional Context

  • This code was originally added in https://github.com/balena-labs-projects/audio/commit/ba302b2e3933868bcebc5acdc3b8436cf7c68b67 three years ago, and may be out of date.
  • Minimally informative forum thread where someone else reported this [https://forums.balena.io/t/balena-audio-block-fails-on-intel-nuc/368803]

bbugh avatar Dec 05 '23 18:12 bbugh