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

amixer parser - no db output breaks parser #644

Open
scharc opened this issue Feb 25, 2025 · 0 comments
Open

amixer parser - no db output breaks parser #644

scharc opened this issue Feb 25, 2025 · 0 comments

Comments

@scharc
Copy link

scharc commented Feb 25, 2025

My amixer output does not provide a db field which breaks the parser:

amixer 
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 55039 [84%] [on]
  Front Right: Playback 54383 [83%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 24672 [38%] [on]
  Front Right: Capture 24672 [38%] [on]

Question: Do we need the db field at all if we have the percentage?

I fixed this by adding a check if the db field is there:

                if channel_data[0] == "":
                    continue
                if "db" in channel_data[3]:
                    db_value = channel_data[3].strip("[]")
                    status = channel_data[4].strip("[]")
                else:
                    db_value = "0.0db"
                    status = channel_data[3].strip("[]")
                playback_value = channel_data[1]
                percentage = channel_data[2].strip(

and then removed the db field in the _process function

@scharc scharc changed the title amixer parser - no db outbut breaks parser amixer parser - no db output breaks parser Feb 25, 2025
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

No branches or pull requests

1 participant