You are not logged in.

#1 2018-02-09 08:42:24

nwoki
Member
Registered: 2010-09-14
Posts: 67

Pulseaudio switch cmd being ignored as well as previously detected dev

Hi all. I have the current setup:

* HDMI output
* analog usb adaptor

No DE is installed. After starting pulseaudio with:

pulseaudio --start
pactl load-module module-switch-on-port-available

the default output is that of the analog usb adaptor.

Now, in order to change the output device, I run the following:

pacmd set-card-profile 1 output:hdmi-stereo

where i took the info from: "pacmd list-cards"

2 card(s) available.
    index: 0
        name: <alsa_card.usb-C-Media_Electronics_Inc._USB_Audio_Device-00>
        driver: <module-alsa-card.c>
        owner module: 6
        properties:
                alsa.card = "1"
                alsa.card_name = "USB Audio Device"
                alsa.long_card_name = "C-Media Electronics Inc. USB Audio Device at usb-0000:00:14.0-3, full speed"
                alsa.driver_name = "snd_usb_audio"
                device.bus_path = "pci-0000:00:14.0-usb-0:3:1.0"
                sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/sound/card1"
                udev.id = "usb-C-Media_Electronics_Inc._USB_Audio_Device-00"
                device.bus = "usb"
                device.vendor.id = "0d8c"
                device.vendor.name = "C-Media Electronics, Inc."
                device.product.id = "0014"
                device.product.name = "Audio Adapter (Unitek Y-247A)"
                device.serial = "C-Media_Electronics_Inc._USB_Audio_Device"
                device.string = "1"
                device.description = "Audio Adapter (Unitek Y-247A)"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-usb"
        profiles:
                input:analog-mono: Analog Mono Input (priority 2, available: unknown)
                output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
                output:analog-stereo+input:analog-mono: Analog Stereo Output + Analog Mono Input (priority 6002, available: unknown)
                output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500, available: unknown)
                output:iec958-stereo+input:analog-mono: Digital Stereo (IEC958) Output + Analog Mono Input (priority 5502, available: unknown)
                off: Off (priority 0, available: unknown)
        active profile: <output:iec958-stereo>
        sinks:
                alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.iec958-stereo/#0: Audio Adapter (Unitek Y-247A) Digital Stereo (IEC958)
        sources:
                alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.iec958-stereo.monitor/#0: Monitor of Audio Adapter (Unitek Y-247A) Digital Stereo (IEC958)
        ports:
                analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown)
                        properties:
                                device.icon_name = "audio-input-microphone"
                analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
                        properties:
                                device.icon_name = "audio-speakers"
                iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
                        properties:

    index: 1
        name: <alsa_card.pci-0000_00_1f.3>
        driver: <module-alsa-card.c>
        owner module: 7
        properties:
                alsa.card = "0"
                alsa.card_name = "HDA Intel PCH"
                alsa.long_card_name = "HDA Intel PCH at 0xdf140000 irq 129"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1f.3"
                sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "9d71"
                device.product.name = "Sunrise Point-LP HD Audio"
                device.form_factor = "internal"
                device.string = "0"
                device.description = "Built-in Audio"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        profiles:
                output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400, available: unknown)
                output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5200, available: no)
                output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (priority 100, available: no)
                output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 100, available: no)
                output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5200, available: no)
                output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 100, available: no)
                output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 100, available: no)
                output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5200, available: no)
                output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 100, available: no)
                output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 100, available: no)
                output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (priority 5200, available: no)
                output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (priority 100, available: no)
                output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (priority 100, available: no)
                off: Off (priority 0, available: unknown)
        active profile: <output:hdmi-stereo>
        sinks:
                alsa_output.pci-0000_00_1f.3.hdmi-stereo/#1: Built-in Audio Digital Stereo (HDMI)
        sources:
                alsa_output.pci-0000_00_1f.3.hdmi-stereo.monitor/#1: Monitor of Built-in Audio Digital Stereo (HDMI)
        ports:
                hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: yes)
                        properties:
                                device.icon_name = "video-display"
                                device.product.name = "Philips 234CL"
                hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"
                hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"
                hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"
                hdmi-output-4: HDMI / DisplayPort 5 (priority 5500, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "video-display"


The command executes without errors but the sound output is not being changed. Any ideas/clues where to look or what might be the problem?



/etc/asound.conf

# Use PulseAudio by default
pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}

ctl.!default {
  type pulse
  fallback "sysdefault"
}

# vim:set ft=alsaconf:




P.S:
if i detach the converter, the audio automatically switches to hdmi. When i replug the converter in, the audio doesn't switch and the device is no longer recognized as it was before. I get:

index: 2
        name: <alsa_card.usb-C-Media_Electronics_Inc._USB_Audio_Device-00>
        driver: <module-alsa-card.c>
        owner module: 23
        properties:
                alsa.card = "1"
                alsa.card_name = "USB Audio Device"
                alsa.long_card_name = "C-Media Electronics Inc. USB Audio Device at usb-0000:00:14.0-3, full speed"
                alsa.driver_name = "snd_usb_audio"
                device.bus_path = "pci-0000:00:14.0-usb-0:3:1.0"
                sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/sound/card1"
                udev.id = "usb-C-Media_Electronics_Inc._USB_Audio_Device-00"
                device.bus = "usb"
                device.vendor.id = "0d8c"
                device.vendor.name = "C-Media Electronics, Inc."
                device.product.id = "0014"
                device.product.name = "Audio Adapter (Unitek Y-247A)"
                device.serial = "C-Media_Electronics_Inc._USB_Audio_Device"
                device.string = "1"
                device.description = "Audio Adapter (Unitek Y-247A)"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-usb"
        profiles:
                input:analog-mono: Analog Mono Input (priority 2, available: unknown)
                off: Off (priority 0, available: unknown)
        active profile: <input:analog-mono>
        sources:
                alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono/#2: Audio Adapter (Unitek Y-247A) Analog Mono
        ports:
                analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown)
                        properties:
                                device.icon_name = "audio-input-microphone"

Offline

#2 2018-02-09 09:37:42

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,739

Re: Pulseaudio switch cmd being ignored as well as previously detected dev

Post output in [ code ] and not [ quote ] tags.

Clarify your end goal. Do you want it to automatically switch to the USB if plugged in and otherwise switch to the HDMI device? Also switch-on-port-available is the wrong module for this job, since the USB card and the HDMI card are different devices (not different ports of the same device) the module you want to use is

pactl load-module module-switch-on-connect

That should likely suffice for your usecase, given I understood your intentions correctly.

Furthermore for reliably switching profiles/ports/outputs as you have noticed, indices are unstable, use the fully qualified name, e.g. from your example

pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:hdmi-stereo

Last edited by V1del (2018-02-09 09:40:12)

Online

#3 2018-02-10 12:17:27

nwoki
Member
Registered: 2010-09-14
Posts: 67

Re: Pulseaudio switch cmd being ignored as well as previously detected dev

V1del wrote:

Post output in [ code ] and not [ quote ] tags.

Clarify your end goal. Do you want it to automatically switch to the USB if plugged in and otherwise switch to the HDMI device?

Exactly


V1del wrote:

Also switch-on-port-available is the wrong module for this job, since the USB card and the HDMI card are different devices (not different ports of the same device) the module you want to use is

pactl load-module module-switch-on-connect

That should likely suffice for your usecase, given I understood your intentions correctly.

Thanks. I tried this and it seems to do what i need. I need to clean up my configs now.


V1del wrote:

Furthermore for reliably switching profiles/ports/outputs as you have noticed, indices are unstable, use the fully qualified name, e.g. from your example

pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:hdmi-stereo

I'll try this in the next few days and let you know.

Offline

Board footer

Powered by FluxBB