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

Runtime Error "No default sink was found" #2

Closed
Termuellinator opened this issue Jan 10, 2021 · 12 comments
Closed

Runtime Error "No default sink was found" #2

Termuellinator opened this issue Jan 10, 2021 · 12 comments

Comments

@Termuellinator
Copy link

When i try to run steamvr_utils.py on/off/daemon, i get the follwing output:

~/.../steamvr_utils/scripts >>> ./steamvr_utils.py daemon                                                                                        [2]
2021-01-10 15:57:12 [DEBUG]: dry_run: False
2021-01-10 15:57:12 [DEBUG]: 'pactl list short sinks':
0       alsa_output.usb-Astro_Gaming_Astro_A50-00.stereo-game   module-alsa-card.c      s16le 2ch 48000Hz       SUSPENDED
1       alsa_output.usb-Astro_Gaming_Astro_A50-00.stereo-chat   module-alsa-card.c      s16le 2ch 48000Hz       SUSPENDED
4       alsa_output.pci-0000_12_00.4.analog-stereo      module-alsa-card.c      s16le 2ch 44100Hz       RUNNING
5       alsa_output.usb-Creative_Technology_Ltd_Sound_Blaster_E5_040D00B00EX-00.analog-stereo   module-alsa-card.c      s24le 2ch 48000Hz       SUSPENDED
8       alsa_output.pci-0000_10_00.1.hdmi-stereo-extra4 module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED

2021-01-10 15:57:12 [ERROR]: 
Traceback (most recent call last):
  File "/home/termy/projects/git/steamvr_utils/scripts/./steamvr_utils.py", line 101, in main
    steamvr_utils = SteamvrUtils(
  File "/home/termy/projects/git/steamvr_utils/scripts/./steamvr_utils.py", line 31, in __init__
    self.audio_switcher = AudioSwitcher(config)
  File "/home/termy/projects/git/steamvr_utils/scripts/audio_switcher.py", line 51, in __init__
    default_sink_name = self.get_default_sink_name()
  File "/home/termy/projects/git/steamvr_utils/scripts/audio_switcher.py", line 211, in get_default_sink_name
    raise RuntimeError('No default sink was found.')
RuntimeError: No default sink was found.

pactl list cards: https://pastebin.com/bw7Rynyf

i'm not sure what i could try? Let me know if you need any other info :)

@DavidRisch
Copy link
Owner

One way to fix this is to specify the normal audio sink explicitly in the config file:

  normal_sink_regex: 'Astro_A50-00\.stereo-game'  # Regex. Used to find the audio sink of the regular audio device. Leave empty to detect automatically (not recommended)

or (depending on which device you want)

  normal_sink_regex: 'pci-0000_12_00\.4\.analog-stereo'  # Regex. Used to find the audio sink of the regular audio device. Leave empty to detect automatically (not recommended)

That way the program does not have to search for the default sink and the error shouldn't occur.

But I am not sure why this is happening. Could you send me the output of pactl info?

@DavidRisch
Copy link
Owner

I improved the error message in b8744f4

@Termuellinator
Copy link
Author

unless i'm doing something wrong that didn't help:

~/.../steamvr_utils/scripts >>> ./steamvr_utils.py on                                                                                            [1]
2021-01-11 14:42:49 [DEBUG]: dry_run: False
2021-01-11 14:42:49 [DEBUG]: 'pactl list short sinks':
0       alsa_output.usb-Astro_Gaming_Astro_A50-00.stereo-game   module-alsa-card.c      s16le 2ch 48000Hz       SUSPENDED
1       alsa_output.usb-Astro_Gaming_Astro_A50-00.stereo-chat   module-alsa-card.c      s16le 2ch 48000Hz       SUSPENDED
2       alsa_output.pci-0000_10_00.1.hdmi-stereo        module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED
3       alsa_output.usb-Creative_Technology_Ltd_Sound_Blaster_E5_040D00B00E1-00.analog-stereo   module-alsa-card.c      s24le 2ch 48000Hz       SUSPENDED
4       alsa_output.pci-0000_12_00.4.analog-stereo      module-alsa-card.c      s16le 2ch 48000Hz       RUNNING

2021-01-11 14:42:49 [ERROR]: No normal audio sink for the was found. Tried to find a match for: analog-stereo
2021-01-11 14:42:49 [ERROR]: 
Traceback (most recent call last):
  File "/home/termy/projects/git/steamvr_utils/scripts/./steamvr_utils.py", line 101, in main
    steamvr_utils = SteamvrUtils(
  File "/home/termy/projects/git/steamvr_utils/scripts/./steamvr_utils.py", line 31, in __init__
    self.audio_switcher = AudioSwitcher(config)
  File "/home/termy/projects/git/steamvr_utils/scripts/audio_switcher.py", line 58, in __init__
    log.d('normal sink: {}'.format(self.normal_sink.name))
AttributeError: 'NoneType' object has no attribute 'name'

i tried
normal_sink_regex: 'pci-0000_12_00\.4\.analog-stereo' # Regex. Used to find the audio sink of the regular audio device. Leave empty to detect automatically (not recommended)
The path by pactl is device.bus_path = "pci-0000:12:00.4", but i guess colons are not supported?
Just "for fun" i tried just "analog-stero" (or what exactly is meant by regex?), but that gave the exact same error.

Pactl info:

Bibliotheks-Protokollversion: 34
Server-Protokollversion: 34
ist lokal: ja
Client-Index: 27
Tile-Größe: 65472
Name des Benutzers: termy
Rechnername: Zaubertrank
Name des Servers: pulseaudio
Version des Servers: 14.0
Standard-Abtastwert-Angabe: s16le 2ch 44100Hz
Standard-Kanal-Zuordnung: front-left,front-right
Standard-Ziel: alsa_output.pci-0000_12_00.4.analog-stereo
Standard-Quelle: alsa_input.usb-Astro_Gaming_Astro_A50-00.mono-chat
Cookie: a3c2:5eab

@DavidRisch
Copy link
Owner

  • Regex refers to Regular Expressions
  • I gave you a slightly wrong regex, sorry. Corrected version: normal_sink_regex: '.*pci-0000_12_00\.4\.analog-stereo' (added a .*to the start). You can use a website like https://regexr.com/ to test a regex, it should match exactly one of your sinks completely
  • The 'path by pactl' is not relevant here, only the sink name 'alsa_output....'
  • Thanks for sending the output of pactl info. You are using German, so my program fails to find some English keywords. I did not think about languages other than English. I am going to fix this.

@DavidRisch
Copy link
Owner

The language problem sould now be fixed by 6cfdb16.

@Termuellinator
Copy link
Author

wow, you are quick ;)
will test tomorrow

@Termuellinator
Copy link
Author

Termuellinator commented Jan 12, 2021

Ok, turning Off now works, when turning on, the basestations activate, but i still get an error when it tries to change the audio:

~/.../steamvr_utils/scripts >>> ./steamvr_utils.py on                                                                                               
2021-01-12 15:01:37 [DEBUG]: dry_run: False
2021-01-12 15:01:37 [DEBUG]: 'pactl list short sinks':
0       alsa_output.usb-Astro_Gaming_Astro_A50-00.stereo-game   module-alsa-card.c      s16le 2ch 48000Hz       SUSPENDED
1       alsa_output.usb-Astro_Gaming_Astro_A50-00.stereo-chat   module-alsa-card.c      s16le 2ch 48000Hz       SUSPENDED
3       alsa_output.usb-Creative_Technology_Ltd_Sound_Blaster_E5_040D00B00E1-00.analog-stereo   module-alsa-card.c      s24le 2ch 48000Hz       SUSPENDED
4       alsa_output.pci-0000_12_00.4.analog-stereo      module-alsa-card.c      s16le 2ch 48000Hz       RUNNING
5       alsa_output.pci-0000_10_00.1.hdmi-stereo-extra4 module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED

2021-01-12 15:01:37 [DEBUG]: normal sink: alsa_output.pci-0000_12_00.4.analog-stereo
2021-01-12 15:01:37 [DEBUG]: vr sink: alsa_output.pci-0000_10_00.1.hdmi-stereo-extra4
2021-01-12 15:01:37 [INFO ]: SteamvrUtils turning on:
2021-01-12 15:01:37 [INFO ]: Found Base Station LHB-394B3B98 at address e6:49:24:6a:92:43
2021-01-12 15:01:37 [INFO ]: Found Base Station LHB-B1A92D86 at address cb:01:13:ed:dc:2e
2021-01-12 15:01:39 [INFO ]: Connecting to e6:49:24:6a:92:43
2021-01-12 15:01:39 [INFO ]: Turning on
2021-01-12 15:01:39 [INFO ]: Connecting to cb:01:13:ed:dc:2e
2021-01-12 15:01:40 [INFO ]: Turning on
2021-01-12 15:01:40 [INFO ]: Success of attempt 1 of 5
2021-01-12 15:01:40 [INFO ]: Connecting to e6:49:24:6a:92:43
2021-01-12 15:01:40 [INFO ]: Turning on
2021-01-12 15:01:40 [INFO ]: Connecting to cb:01:13:ed:dc:2e
2021-01-12 15:01:40 [INFO ]: Turning on
2021-01-12 15:01:40 [INFO ]: Success of attempt 2 of 5
2021-01-12 15:01:41 [INFO ]: Connecting to e6:49:24:6a:92:43
2021-01-12 15:01:41 [INFO ]: Turning on
2021-01-12 15:01:41 [INFO ]: Connecting to cb:01:13:ed:dc:2e
2021-01-12 15:01:41 [INFO ]: Turning on
2021-01-12 15:01:41 [INFO ]: Success of attempt 3 of 5
2021-01-12 15:01:41 [INFO ]: Connecting to e6:49:24:6a:92:43
2021-01-12 15:01:41 [INFO ]: Turning on
2021-01-12 15:01:41 [INFO ]: Connecting to cb:01:13:ed:dc:2e
2021-01-12 15:01:41 [INFO ]: Turning on
2021-01-12 15:01:41 [INFO ]: Success of attempt 4 of 5
2021-01-12 15:01:42 [INFO ]: Connecting to e6:49:24:6a:92:43
2021-01-12 15:01:42 [INFO ]: Turning on
2021-01-12 15:01:42 [INFO ]: Connecting to cb:01:13:ed:dc:2e
2021-01-12 15:01:42 [INFO ]: Turning on
2021-01-12 15:01:42 [INFO ]: Success of attempt 5 of 5
2021-01-12 15:01:42 [ERROR]: 
Traceback (most recent call last):
  File "/home/termy/projects/git/steamvr_utils/scripts/./steamvr_utils.py", line 110, in main
    steamvr_utils.action(selected_action)
  File "/home/termy/projects/git/steamvr_utils/scripts/./steamvr_utils.py", line 35, in action
    self.turn_on()
  File "/home/termy/projects/git/steamvr_utils/scripts/./steamvr_utils.py", line 63, in turn_on
    self.audio_switcher.switch_to_vr()
  File "/home/termy/projects/git/steamvr_utils/scripts/audio_switcher.py", line 87, in switch_to_vr
    self.port = self.get_port()
  File "/home/termy/projects/git/steamvr_utils/scripts/audio_switcher.py", line 215, in get_port
    cards = pactl_interface.Card.get_all_cards()
  File "/home/termy/projects/git/steamvr_utils/scripts/pactl_interface/card.py", line 159, in get_all_cards
    cards.append(cls(card_dict))
  File "/home/termy/projects/git/steamvr_utils/scripts/pactl_interface/card.py", line 91, in __init__
    raise RuntimeError('Parsing of card failed.')
RuntimeError: Parsing of card failed.

i've changed the config.yaml to normal_sink_regex: '.*pci-0000_12_00\.4\.analog-stereo' like you said

edit: it seems it correctly changed the HDMI-Port to the right sink, but didn't change the general output to HDMI after that.

@DavidRisch
Copy link
Owner

For the time being you might want to disable the audio switcher, while we continue to work on fixing it:

audio:
  enabled: false  # Boolean. Enable the Base Station component.

This way you can (hopefully) use the Base Station power component without errors.

I added a script to collect the output of some pactl and your config. Please send me the output of ./scripts/debug_dump.py.

@Termuellinator
Copy link
Author

here's the output: https://pastebin.com/nE2QeiCv
hope that helps narrow down the issue :)

@DavidRisch
Copy link
Owner

I found the issue: An in correct assumption about the output of pactl list cards. Fixed in 31cd4cb.

@Termuellinator
Copy link
Author

I can confirm it seems to be working now! 👍
Only [Debug] messages in the output.
Sound is switched properly although not represented by my audio-switcher-widget (probably more a KDE-Bug?)

Is the daemon supposed to turn the lighthouse off when steamVR stops (i've included the start as daemon in the steamvr launch options as written by the install script)? Because that is not happening, stopping them with argument "off" or the steamvr-utils-off desktop file works fine though.

@DavidRisch
Copy link
Owner

Great 👍

Sound is switched properly although not represented by my audio-switcher-widget (probably more a KDE-Bug?)

I found that changing the default audio device (what your audio-switcher-widget is probably showing you) worked some but not all of the time. Instead I change the sink of individual clients. This overrides the default sink for that process, which has always worked for me.

Is the daemon supposed to turn the lighthouse off when steamVR stops

Yes. But only after 60s (wait_after_quit in the config). If this does not work for you, please open a new issue.

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

2 participants