[Solved] USB DAC Hotplug

Hello all,

As far as I know there isn’t a dedicated thread to the development of USB DAC Hotplugging yet, so why not help things along :wink:

The things I found out so far are:

  • playing sound through an USB DAC (in my case a DENON DA-300USB - wonderfull DAC :slight_smile: ) at a RPi with Volumio 1.51 works perfect as long as the DAC is powered on and plugged in before the RPi is booted.
  • when Volumio is running and you unplug/switch off your DAC and you replug/switch on your DAC (“Hotplugging”), the DAC won’t play your music. As it turns out, the specific device nodes in /dev/snd have got the wrong owner and access rights. They are now owned by root and not accessible by other users/groups. The following statements will repair that situation:

chmod g+rwt /dev/snd/pcmC0D0p chmod g+rwt /dev/snd/controlC0 chown :audio /dev/snd/pcmC0D0p chown :audio /dev/snd/controlC0

  • the above does not work when the DAC is not plugged in & switched on when the RPi boots.

:question: First question: are the device nodes mentioned above universal to all USB DAC’s? They work for my USB DAC, but do they work for others as well?

:question: Second question: which udev rule should we change to make the above code be performed automagically? I’m thinking about something in /lib/udev/rules.d/91-permissions.rules, but I’m still a bit unsure about the different kernel messages…

:question: Third question: this one could be a bit harder, but what about hotplugging after booting the RPi without the DAC being plugged in… as it turns out, my system maintained the device nodes from the previous session, with correct user rights, but Volumio didn’t want to find the DAC. I had to do a reboot with the DAC plugged in before the device node management started to work properly for the DAC device nodes.

Of course I’m fiddling around with things, but my time is at the moment a bit limited, so any help, comments, responses etc are welcome :smiley:


Mm, new developments…

through another thread https://volumio.org/forum/usb-dac-getting-wrong-group-and-permissions-t747.html I picked up the advice to restart udev by

$ sudo /etc/init.d/udev restart

and you know what: after executing this statement the device nodes for the USB DAC were created correctly after every hotplug!

To make really sure if it worked all the time, I executed the following tests:

  • reboot RPi with DAC connected, no udev restart: hotplug does not work
  • reboot RPi with DAC connected, with udev restart: hotplug does work
  • reboot RPi without DAC connected, no udev restart: hotplug does not work
  • reboot RPi without DAC connected, with udev restart: hotplug does work :smiley:

:exclamation: So, instead of having to fiddle with udev statements, it turns out that udev is already configured properly and it only needs to be restarted to function correctly. Which makes hotplugging USB DAC’s also function properly :smiley:

:question: One final step of course: how can we make udev restart after booting? I guess this has to happen after the full system has initialized, so it should be one of the last things happening in the boot sequence. Anyone any ideas?

This seems to work for me as well.

Maybe through a script in crontab with @reboot to restart the process after reboot?

I will play around with this over the weekend as hot plug is one of the features I was looking for.

Hey Dave (?),

Glad to hear that hotplugging works for you as well :slight_smile:

Could you please post your solution if you find a suitable way to restart udev after the boot/init proces? Thanks in advance!

For what it’s worth: I guess the ideal situation would be to restart udev through init.d, as the last script to be executed. I don’t know however, which init methodology is being used by Volumio. I’ll have a look.


Another follow-up on my own post (sigh).

I think we could have an extra script in /ect/init.d like /etc/init.d/myruns.

‘myruns’ is used to renice mpd. So we could make something like ‘restartudev’, using myruns as a template.

…or just extend myruns…

tinkering time :slight_smile:

EDIT: first results: just adding ‘/etc/init.d/udev restart’ to /etc/init.d/myruns does work from the command line, but not from within the boot/init process. Maybe the proposed option to put it in crontab would give better results…

Hey Johan,

Thanks for working on this! I installed cron, and added a script to restart dev, but it does not appear to fire, I will look into more. I do not know if this is the best solution though. Like you, I think it would be best through init process.

I will play more this weekend


udev is killed at boot by orion_optimize script…
To disable such behaviour:

nano /var/www/command/orion_optimize.sh

And commnt the udevd related line

from this

killall -9 udevd

to this

#killall -9 udevd


I missed that! Was right in from of my eyes!

Michelangelo, Great work on this project by the way, I am enjoying it greatly


I’ll consider enabling udev in next release… Is good also for USB Music…

Works perfectly, thanks!

Volumio is now, next to all its other qualities, a bitperfect lightweight network interface between a dlna server (in my case a Mac mini with JRiver mediacenter) and an USB DAC. And due to the very moderate power consumption of a RPi B, I don’t mind leaving it on all the time, having my music available almost instantly :slight_smile:

Great job, Michelangelo :sunglasses:

Hello to you all,

I am not quite new reading Volumio forums but this is my first. Some time ago I developed a pair of active speakers based on DSP switch amps coming from company Hypex Electronics (type AS 2.100d). They came out quite well with my Sony CD drive and I decided to go step furhter to install an own music server containig my CD collection and providing internet radio.

After some searches in internet forums, I was clear about using Volumio, along with a Respberry Pi. I have a good general understanding about IT, operation systems, networks and so on, but I am not in details in any of these topics and not an expert there at all. So I was not really sure if could succeed, but the financial risk is almost deniable, so entered into the project, but with respect.

Today, I am using Volumio in it’s version 1.5. I could get trough all the hazards connecting my PC to Raspberry, to establish WLAN with hidden SSID and installing new Web radios. Very clear, I could not get through all the odds on my own, no way, the forum of Volumio was the key and it was of excellent help.

I am very happy today with my speakers and my Volumio music server, the music in my flat sounds absolutelly beautiful.

Therefore, many many thanks to the creators for this wonderful Volumio project, and all the interesting people diving so deep into all these details that help other people to come along.

There is only one thing, I could not push through. That is the hot plug of my Hypex switch amps with their DSP entrance.

I read this thread here and I was exited to have found way. But ist does not work. I followed the steps of JDuinkerken and tried out the results. I changed the file orion_optimize.sh according to the conclusions of Michelangelo. But again, it does not work.

To make the systems running I need first to switch on amps, than Raspberry Pi. After about 2 minutes booting time, everything is fine and the music plays. If than, I switch off the amps and on again, a reconnection from Raspberry Pi to the amps does not happen.

Could it be, that the correct working of the hot plug must be supported by the DSP/switch amps as well? I don’t know, maybe I have to give up here, than I will enjoy it furhter with this little weakness and accept it.

But may be, some of you have another hint. If so, I would be pleased to here from you.

Thak you again for all the phantsatic engagements and work

my regards

I see this is a very old “talk” from 2015 around Volumio 1.5. However, I have had the same issue with Volumio 2.9 and now with Volumio 3 which I have just installed this morning. I am playing from a RPi 4 into a Marantz NA7004’s Cirrus Logic CS4398 DAC via USB (the Marantz is a DAB Radio Tuner & Network Streamer). This set up works very well except for the startup and shutdown issues you talk about. Is it likely that the same scripts you run in these posts on the older Volumio version will still fix the issue on the more recent version?