You are not logged in.

#1 2015-01-15 23:58:16

andav
Member
Registered: 2006-12-04
Posts: 121

[SOLVED] how to hotplug usb audio card?

i have usb sound card and an intel inner card which both working fine.

at first i could not make this usb card to work but after couple of searches, i installed pulse audio volume control(pavucontrol), opened it, and start playing a video from youtube.
then i see in applications(in pavucontrol) that it is using my inner card, so i switched to the usb card, and now i hear the music from the usb sound card.

so now i want that when i plug in the usb card, that it will be the default one, and after i unplug it, the sound card should get back to the default intel inner card.

in the wiki there is a section that makes udev rules to get what i want, but it does not work for me.

i also did those commands but no success and no sound from the usb card

Last edited by andav (2015-01-20 21:31:41)

Offline

#2 2015-01-16 00:09:34

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

Re: [SOLVED] how to hotplug usb audio card?

Set the usb card as your default/fallback device in pavucontrol, that way streams will be pushed to the usb when they appear. Also make sure you load module-switch-on-connect (if it already is there and it doesn't work, try putting the respective line after udev-detect, contrary to what the comment says) in you default.pa. Reverse whatever udev changes you did, those concern ALSA and pulse doesn't need them (they could be breaking stuff even, revert the asound.conf this created as well)

Offline

#3 2015-01-16 00:47:21

andav
Member
Registered: 2006-12-04
Posts: 121

Re: [SOLVED] how to hotplug usb audio card?

V1del wrote:

Set the usb card as your default/fallback device in pavucontrol, that way streams will be pushed to the usb when they appear. Also make sure you load module-switch-on-connect (if it already is there and it doesn't work, try putting the respective line after udev-detect, contrary to what the comment says) in you default.pa. Reverse whatever udev changes you did, those concern ALSA and pulse doesn't need them (they could be breaking stuff even, revert the asound.conf this created as well)

does not working :-).

i deleted the file with the udev rules:
/etc/udev/rules.d/00-local.rules

i made my usb device a fallback device in pavucontrol.

i also added this line:
load-module module-switch-on-connect
to the *end* of the file:
/etc/pulse/default.pa

restart my computer with the usb device unpluged.
as before, the sound working great with the inner card, but after pluging the usb device, there is no sound from it.

Last edited by andav (2015-01-16 01:02:49)

Offline

#4 2015-01-17 19:05:03

andav
Member
Registered: 2006-12-04
Posts: 121

Re: [SOLVED] how to hotplug usb audio card?

please help.

Offline

#5 2015-01-18 20:51:12

andav
Member
Registered: 2006-12-04
Posts: 121

Re: [SOLVED] how to hotplug usb audio card?

anyone?
i cant do it.
all the searches on google didn't get me closer to solve this issue.

Offline

#6 2015-01-19 01:06:30

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,845

Re: [SOLVED] how to hotplug usb audio card?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#7 2015-01-19 08:31:54

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

Re: [SOLVED] how to hotplug usb audio card?

Give some more information, output of

pacmd list-cards
fuser -v /dev/snd/*

while usb is plugged in for starters. You can still manually move the streams to the usb is that right? Also because you just changed fallback to usb, it may be necessary to remove ~/.pulse so that it starts every stream with a fresh notion that the USB card should be the default (move the module-switch-on-connect back to its original position to be sure).

Offline

#8 2015-01-19 13:04:31

andav
Member
Registered: 2006-12-04
Posts: 121

Re: [SOLVED] how to hotplug usb audio card?

V1del wrote:

Give some more information, output of

pacmd list-cards
fuser -v /dev/snd/*

while usb is plugged in for starters. You can still manually move the streams to the usb is that right? Also because you just changed fallback to usb, it may be necessary to remove ~/.pulse so that it starts every stream with a fresh notion that the USB card should be the default (move the module-switch-on-connect back to its original position to be sure).

thanks!

"You can still manually move the streams to the usb is that right?"
yes, indeed (with pavucontrol)

it seems that i do not have ~/.pulse file.

also, i didn't have the:
module-switch-on-connect

at the file: /etc/pulse/default.pa.
it was not there from the start, so i dont know where it should be in first place, thus i put it in the end.





here is the list of cards:

4 card(s) available.
    index: 0
    name: <alsa_card.pci-0000_01_00.1>
    driver: <module-alsa-card.c>
    owner module: 6
    properties:
        alsa.card = "1"
        alsa.card_name = "HDA ATI HDMI"
        alsa.long_card_name = "HDA ATI HDMI at 0xe5010000 irq 31"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:01:00.1"
        sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
        device.bus = "pci"
        device.vendor.id = "1002"
        device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
        device.product.id = "aa10"
        device.product.name = "RV610 HDMI Audio [Radeon HD 2350/2400 Series] (Radeon HD 2400 PRO)"
        device.string = "1"
        device.description = "RV610 HDMI Audio [Radeon HD 2350/2400 Series] (Radeon HD 2400 PRO)"
        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-surround: Digital Surround 5.1 (HDMI) Output (priority 300, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:hdmi-stereo>
    sinks:
        alsa_output.pci-0000_01_00.1.hdmi-stereo/#0: RV610 HDMI Audio [Radeon HD 2350/2400 Series] (Radeon HD 2400 PRO) Digital Stereo (HDMI)
    sources:
        alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor/#0: Monitor of RV610 HDMI Audio [Radeon HD 2350/2400 Series] (Radeon HD 2400 PRO) Digital Stereo (HDMI)
    ports:
        hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
    index: 1
    name: <alsa_card.pci-0000_00_1b.0>
    driver: <module-alsa-card.c>
    owner module: 7
    properties:
        alsa.card = "0"
        alsa.card_name = "HDA Intel"
        alsa.long_card_name = "HDA Intel at 0xe9400000 irq 30"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1b.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "284b"
        device.product.name = "82801H (ICH8 Family) HD Audio Controller"
        device.form_factor = "internal"
        device.string = "0"
        device.description = "Built-in Audio"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        input:analog-stereo: Analog Stereo Input (priority 60, available: unknown)
        input:iec958-stereo: Digital Stereo (IEC958) Input (priority 55, available: unknown)
        output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
        output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown)
        output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (priority 6055, available: unknown)
        output:analog-surround-40: Analog Surround 4.0 Output (priority 700, available: unknown)
        output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Output + Analog Stereo Input (priority 760, available: unknown)
        output:analog-surround-40+input:iec958-stereo: Analog Surround 4.0 Output + Digital Stereo (IEC958) Input (priority 755, available: unknown)
        output:analog-surround-41: Analog Surround 4.1 Output (priority 800, available: unknown)
        output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Output + Analog Stereo Input (priority 860, available: unknown)
        output:analog-surround-41+input:iec958-stereo: Analog Surround 4.1 Output + Digital Stereo (IEC958) Input (priority 855, available: unknown)
        output:analog-surround-50: Analog Surround 5.0 Output (priority 700, available: unknown)
        output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Output + Analog Stereo Input (priority 760, available: unknown)
        output:analog-surround-50+input:iec958-stereo: Analog Surround 5.0 Output + Digital Stereo (IEC958) Input (priority 755, available: unknown)
        output:analog-surround-51: Analog Surround 5.1 Output (priority 800, available: unknown)
        output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Output + Analog Stereo Input (priority 860, available: unknown)
        output:analog-surround-51+input:iec958-stereo: Analog Surround 5.1 Output + Digital Stereo (IEC958) Input (priority 855, available: unknown)
        output:analog-surround-71: Analog Surround 7.1 Output (priority 700, available: unknown)
        output:analog-surround-71+input:analog-stereo: Analog Surround 7.1 Output + Analog Stereo Input (priority 760, available: unknown)
        output:analog-surround-71+input:iec958-stereo: Analog Surround 7.1 Output + Digital Stereo (IEC958) Input (priority 755, available: unknown)
        output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500, available: unknown)
        output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560, available: unknown)
        output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (priority 5555, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:analog-stereo+input:iec958-stereo>
    sinks:
        alsa_output.pci-0000_00_1b.0.analog-stereo/#1: Built-in Audio Analog Stereo
    sources:
        alsa_output.pci-0000_00_1b.0.analog-stereo.monitor/#1: Monitor of Built-in Audio Analog Stereo
        alsa_input.pci-0000_00_1b.0.iec958-stereo/#2: Built-in Audio Digital Stereo (IEC958)
    ports:
        analog-input-front-mic: Front Microphone (priority 8500, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-rear-mic: Rear Microphone (priority 8200, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
            properties:
                
        iec958-stereo-input: Digital Input (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
            properties:
                
        analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: yes)
            properties:
                
        analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: unknown)
            properties:
                device.icon_name = "audio-headphones"
        iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
            properties:
                
    index: 2
    name: <alsa_card.usb-0d8c_USB_PnP_Sound_Device-00-Device>
    driver: <module-alsa-card.c>
    owner module: 8
    properties:
        alsa.card = "2"
        alsa.card_name = "USB PnP Sound Device"
        alsa.long_card_name = "USB PnP Sound Device at usb-0000:05:00.0-1, full speed"
        alsa.driver_name = "snd_usb_audio"
        device.bus_path = "pci-0000:05:00.0-usb-0:1:1.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1e.0/0000:05:00.0/usb10/10-1/10-1:1.0/sound/card2"
        udev.id = "usb-0d8c_USB_PnP_Sound_Device-00-Device"
        device.bus = "usb"
        device.vendor.id = "0d8c"
        device.vendor.name = "C-Media Electronics, Inc."
        device.product.id = "013c"
        device.product.name = "CM108 Audio Controller"
        device.serial = "0d8c_USB_PnP_Sound_Device"
        device.string = "2"
        device.description = "CM108 Audio Controller"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-usb"
    profiles:
        input:analog-mono: Analog Mono Input (priority 1, 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 6001, 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 5501, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:analog-stereo+input:analog-mono>
    sinks:
        alsa_output.usb-0d8c_USB_PnP_Sound_Device-00-Device.analog-stereo/#2: CM108 Audio Controller Analog Stereo
    sources:
        alsa_output.usb-0d8c_USB_PnP_Sound_Device-00-Device.analog-stereo.monitor/#3: Monitor of CM108 Audio Controller Analog Stereo
        alsa_input.usb-0d8c_USB_PnP_Sound_Device-00-Device.analog-mono/#4: CM108 Audio Controller Analog Mono
    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: 3
    name: <alsa_card.pci-0000_06_04.0>
    driver: <module-alsa-card.c>
    owner module: 9
    properties:
        alsa.card = "3"
        alsa.card_name = "Audiowerk2"
        alsa.long_card_name = "Audiowerk2 with SAA7146 irq 18"
        alsa.driver_name = "snd_aw2"
        device.bus_path = "pci-0000:06:04.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1e.0/0000:05:02.0/0000:06:04.0/sound/card3"
        device.bus = "pci"
        device.vendor.id = "1131"
        device.vendor.name = "Philips Semiconductors"
        device.product.id = "7146"
        device.product.name = "SAA7146"
        device.string = "3"
        device.description = "SAA7146"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:analog-stereo>
    sinks:
        alsa_output.pci-0000_06_04.0.analog-stereo/#3: SAA7146 Analog Stereo
    sources:
        alsa_output.pci-0000_06_04.0.analog-stereo.monitor/#5: Monitor of SAA7146 Analog Stereo
    ports:
        analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
            properties:
                

here is the output of:
fuser -v /dev/snd/*

                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  parosh      533 F.... pulseaudio
/dev/snd/controlC1:  parosh      533 F.... pulseaudio
/dev/snd/controlC2:  parosh      533 F.... pulseaudio
/dev/snd/controlC3:  parosh      533 F.... pulseaudio
/dev/snd/pcmC0D1c:   parosh      533 F...m pulseaudio

Last edited by andav (2015-01-19 15:00:25)

Offline

#9 2015-01-20 12:49:11

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

Re: [SOLVED] how to hotplug usb audio card?

Good, output checks out. The module-on-switch-connect missing explains quite something (it should be at least commented out somewhere in a default default.pa) tongue put it right before the "if... udev-detect" conditional block (not on my arch can't give you exact line, but you should find it). if you don't have ~/.pulse you may have a ~/.config/pulse, delete that one instead tongue

Offline

#10 2015-01-20 20:46:17

andav
Member
Registered: 2006-12-04
Posts: 121

Re: [SOLVED] how to hotplug usb audio card?

V1del wrote:

Good, output checks out. The module-on-switch-connect missing explains quite something (it should be at least commented out somewhere in a default default.pa) tongue put it right before the "if... udev-detect" conditional block (not on my arch can't give you exact line, but you should find it). if you don't have ~/.pulse you may have a ~/.config/pulse, delete that one instead tongue


you are the man!
yes, it is working!.
thank you very very much!!!

i clean asound.conf.
there were to lines there, that i made them a comment (#)
i also deleted ~/.config/pulse
and i add module switch-on-connect before the udev-detect's "if" conditional block
restart the computer with the usb sound card unpluged.
play some music in VLC with the inner sound card(intel) to check if it's still working good, and it is.
then i pluged in the usb sound card, and the sound from the inner sound card stoped.
then i switched my speaker's cable from the inner sound card to the usb sound card and the music is playing there as it should be :-)


i have 2 questions:

1. if pulseaudio is installed, is it "masks" alsa configuration, so i can use just pulseaudio's configuration?
    if i want to use alsa configurations files, i have to uninstall pulseaudio before?
   

2. i noticed that when i playing music from the usb sound card and then, while VLC is playing the music,  i unplug the usb sound card from the computer, and switch the speaker's cable to the inner sound card, i can't hear anything.
i have to stop the player (VLC in my example) and start it again and now the music is playing again.
is there a solution to that?

again thank you very very much.
you made me happy :-)

EDIT:
i found a strange behaviour.
if the usb is not connected and i play video in youtube(no matter if it's chromium or firefox), and while the video is playing i plug the USB card (which works good and i can hear the sound from there), and then i unplug the USB card, the video on youtube start moving in a fast forward way(without sound).
if i plug the USB again, the video still run fast forward without sound.
(i also tried to change to the inner card while it playing fast forward, but there is no sound also from there)

in chromium it's more strange because even if i refresh the page, the video is start playing fast forward again.
i have to close the page or the browser(and open them again) so the video will work normally again.

in firefox i just need to refresh the page, and the video start playing normally.

also, in firefox, if i open a video on youtube and the USB was *already connected*, and then i unplug the USB, the video continue to run normally and i can switch to my inner card and hear the sound from there.
but, if the USB card is unpluged, and then i play a video on youtube, and then plug the usb card, and now unplug it, the video is starting to move in a fast forward way(without sound).

in chromium there is no difference if the USB sound card was in or out, when i start to play a video on youtube.
it's always start playing in a fast forward way, when i unplug the USB.

Last edited by andav (2015-01-20 22:30:59)

Offline

#11 2015-01-20 22:35:43

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

Re: [SOLVED] how to hotplug usb audio card?

1. You can still use ALSA configuration but you really should have a good reason for it (and know what you're doing), most things can be done in pulse directly and chances of misconfiguration that can lead to problems is pretty high I only have the asound.conf that gets created by pulseaudio-alsa which simply redirects everything to pulse, but ultimately depends on usecase.

2. No idea that sounds weird hmm

Offline

#12 2015-01-20 23:59:23

andav
Member
Registered: 2006-12-04
Posts: 121

Re: [SOLVED] how to hotplug usb audio card?

thanks for all your help!!! :-)

Offline

Board footer

Powered by FluxBB