Making USB DAC the default sink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Someone asked the same question a few months ago, but the answer assumed a 
graphical desktop.  In my case, the platform is headless.

The problem is that I want a USB DAC, if one is connected, always to be the 
default sink.  I can use pacmd to set the default sink to the index of the USB 
DAC.  If I reboot the system, the USB DAC remains the default.  However, the 
moment I disconnect the USB DAC, the default changes to the internal DAC (the 
only other card).  If I then reconnect the USB DAC, the default remains the 
internal DAC.  I have to run pacmd again to restore the default selection to 
the USB DAC.  It is difficult to do that because the system is headless.

I think I know a solution.  I am considering creating a udev rule that 
responds to the attachment of the USB DAC.  Maybe:

ACTION=="add", SUBSYSTEM=="snd", SUBSYSTEMS=="usb", RUN+="/usr/local/bin/udev-
usb-dac.sh"

It calls a shell script that runs 

pulseaudio -k && pulseaudio --start --log-target=syslog 

so that the USB DAC will be assigned index 1 again (otherwise, I won't know 
what index to use in the next step).  Then the script will run 

pacmd set-default sink 1 

to restore the default assignment.  I haven't tried it yet because it seems to 
me that this problem is not unusual, so surely there is a simpler solution 
completely within the domain of pulseaudio.

Actually, the udev rule that I described will not run, so it seems that I 
don't have a possible solution.  Any suggestions welcome.


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux