Pulseaudio: how to rescan audio devices?

14

5

When adding a USB device to my system (I deliberately run no modern stack for device detection), Pulseaudio can't pickup it without restart (pulseaudio -k; pulseaudio --start).

Is there an option for, say, pactl, which will make pulseaudio to "detect" and start using newly plugged in devices?

kagali-san

Posted 2014-11-27T10:47:38.823

Reputation: 1 404

I'm confused how udev, which has been around since 2005, is too modern, and yet pulseaudio is fine... And given that udev doesn't even do device detection (the kernel does), "no modern stack for device detection" would kinda imply a kernel with no USB support. – user1686 – 2014-11-27T12:35:07.820

I'm not sure if I understood your question properly. The matter involving auto detection of audio devices (and possibly selecting the correct profile) seems to be solved once for all in Debian Buster: you simply say what is the default input/output devices you prefer and once connected Pulseaudio switches to those devices. If you are using something a bit older, you can try https://gist.github.com/pylover/d68be364adac5f946887b85e6ed6e7ae

– Richard Gomes – 2018-05-27T09:07:59.093

You may (or may not) find this useful: https://superuser.com/questions/1324152/bluetooth-headset-fails-to-connect-on-linux/1324154#1324154

– Richard Gomes – 2018-05-27T09:08:42.303

Answers

21

Actually, yes, there is a way to do so without restarting Pulseaudio:

pacmd unload-module module-udev-detect && pacmd load-module module-udev-detect

I use it everytime I plug in my external-soundcard or after waking up my laptop. Pulseaudio cleans up his room and bring back my Spotify music on my external soundcard automatically (as it is my default soundcard).

You will need pacmd to do so; it is included in the pulseaudio-utils package on Ubuntu.

Signez

Posted 2014-11-27T10:47:38.823

Reputation: 326

Sometimes works sometimes not. I guess it's a fully correct answer anyway. – Stéphane Gourichon – 2017-06-13T12:00:23.673

My Ubuntu 18.04 system on a Dell Latitude E5470 rarely loses the audio device after wake-up from suspend, but when it does, this command fixes it. – Quolonel Questions – 2019-10-09T13:19:58.287

3

Running

pulseaudio -k && pactl load-module module-detect

worked for me. This will restart pulseaudio and therefore forget existing devices. Afterwards it will rescan for devices. The difference here is not to use udev, maybe there is an issue with the setup that prevents udev support.

This was necessary for me, as I'm using external devices at my laptop, but sometimes internal speakers.

Daniel

Posted 2014-11-27T10:47:38.823

Reputation: 131