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

Incorrect ALSA control name for H3 devices (e.g. NanoPi Neo) #4833

Closed
VS-X opened this issue Oct 13, 2021 · 3 comments
Closed

Incorrect ALSA control name for H3 devices (e.g. NanoPi Neo) #4833

VS-X opened this issue Oct 13, 2021 · 3 comments
Labels
NanoPi NEO Solution available 🥂 Definite solution has been done
Milestone

Comments

@VS-X
Copy link

VS-X commented Oct 13, 2021

Creating a bug report/issue

Required Information

  • DietPi version |
G_DIETPI_VERSION_CORE=7
G_DIETPI_VERSION_SUB=6
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
G_LIVE_PATCH_STATUS[0]='not applicable'
G_LIVE_PATCH_STATUS[1]='applied'
G_LIVE_PATCH_STATUS[2]='applied'
G_LIVE_PATCH_STATUS[3]='applied'
G_LIVE_PATCH_STATUS[4]='not applicable'
  • Distro version | bullseye
  • Kernel version | Linux NanoPiMusic 5.10.60-sunxi #21.08.2 SMP Tue Sep 14 16:28:44 UTC 2021 armv7l GNU/Linux
  • SBC model | NanoPi NEO (armv7l)
  • Power supply used | 5V 2A generic
  • SDcard used | SanDisk Ultra 32gb

Additional Information (if applicable)

  • Can this issue be replicated on a fresh installation of DietPi? Yes
  • Bug report ID | f0fea896-9203-4b74-8ba6-8037f81f98c3

Steps to reproduce

  1. Install Dietpi on NanoPi with H3 cpu (e.g. NanoPI NEO)
  2. Solder a 3.5mm jack to the board
  3. Try to switch from HDMI to h3-analogue in dietpi-config

Expected behaviour

  • the audio should correctly switch to h3-analogue without errors

Actual behaviour

  • it seems that the audio does switch correctly, but the configurator throws an error amixer: Unable to find simple control 'Audio lineout',0
  • this also happens when installing/uninstalling audio apps, e.g. MPD, since dietpi tries to reset the audio card

Extra details

  • This Audio lineout control name comes from H3 code branch in Dietpi-Set_hardware. However, the kernel overlay(?) sets up this device with Line Out name
  • Was it renamed at some point in the upstream/armbian, but not renamed in Dietpi? Or are there H3 devices that get initialized with Audio lineout instead of Line Out?
  • Can it be safely renamed in Dietpi-Set_hardware, H3 code branch?
  • I also tried to use "Change command" option, to adjust the command from amixer -c 0 set Audio lineout unmute to amixer -c 0 set "Line Out" unmute, but then the error is amixer: Unable to find simple control 'Line',0 , as if it breaks at space between "Line" and "Out":
[ INFO ] DietPi-Set_hardware | Executing alternative command: amixer -c 0 set "Line Out" unmute
amixer: Unable to find simple control 'Line',0

Running the adjusted command from the terminal works correctly though... So something is also wrong with how "Change command" works.

@MichaIng
Copy link
Owner

Many thanks for your report.

Yeah currently the "Change command" option does not handle white spaces in single arguments correctly, despite given quotes. The quotes are taken literally instead of being shell-interpreted. For the letter we'd need to use eval or similar, which I was already thinking about.

I guess things have changed with newer kernels since we implemented this code. The question is whether there is any of those amixer changes still required. Probably we can remove them completely. I.e. does it work when you "Change command" all of them to : or true (bypassing, basically) and get sound output OOTB without a need to change any mixer settings? This can be also done via alsamixer, to have some console GUI.

@VS-X
Copy link
Author

VS-X commented Oct 15, 2021

I may have understood you incorrectly, but here's what I did:
I commented out the lines that mention "Audio lineout" in Dietpi-set_hardware:

1784     Soundcard_Reset_H3(){
1785     
1786         # Set HDMI
1787         SOUNDCARD_TARGET_CARD=1
1788         # [[ $INPUT_DEVICE_VALUE != 'none' && -f '/proc/asound/cards' && $(</proc/asound/cards) ]] && amixer -c 0 set 'Audio lineout' mute
1789
1790     }       
2099             h3-analogue)
2100            
2101                 # G_EXEC amixer -c 0 set 'Audio lineout' unmute
2102                 SOUNDCARD_TARGET_CARD=0
2103
2104             ;;

And tried to switch audio outputs in Config -> Audio between HDMI <---> 3.5mm and it seems to have worked correctly without any issues. Looking at these lines, they are there just to mute/unmute 3.5mm, which is why the switch worked correctly even with the errors. Since Nanopi Neo doesn't have HDMI output, I cannot test the side effects of leaving 3.5mm unmuted during the switch.

@MichaIng MichaIng added Solution available 🥂 Definite solution has been done and removed Investigating 🤔 labels Oct 16, 2021
@MichaIng MichaIng added this to the v7.7 milestone Oct 16, 2021
@MichaIng
Copy link
Owner

Just fixed with: 03bc475

Obviously analogue output is not muted by default and when switching to HDMI audio, as it is a different sound card index, not a control only, it doesn't matter whether 3.5mm is muted or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NanoPi NEO Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

2 participants