Squeezelite looses connection with USB DAC

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hello,
I am using XMOS based USB DAC connected to RPI3 with piCorePlayer.
RPI is always on, but I turn off DAC when I finish listening to music. Next time, and that could be a day or two after I get no sound from system unless I reboot RPI or restart squeezelite service.

I believe squeezelite is to blame, because my previous squeezelite device was PogoPlug with debian on it and the same thing was happening.

It is not a big nuisance, and I can live with it but if anybody have a solution I would be grateful.

Kind regards

Marko
 
Turning off the USB device while the device is open (playing) is likely to cause an error in the playback application. If the playback software does not count with this scenario specifically, it will not resume playing when the USB device re-appears (turned on), the playback thread communicating with the device has already died.
 
Turning off the USB device while the device is open (playing) is likely to cause an error in the playback application. If the playback software does not count with this scenario specifically, it will not resume playing when the USB device re-appears (turned on), the playback thread communicating with the device has already died.


Hello phofman,
and thank you for your reply. I don't expect to turn on the DAC and resume where I left off. I choose play on another track, album but even though the sqeeuzelite player is visible in the Logitech media server web application there is only silence in the speakers until I reboot RPI.

I googled a bit and it seems I am not alone:

Topic: Stuttering or no sound on resume every morning or so… PCM2707 USB DAC | Max2Play

Trouble is I am already using hardware name of the soundcard.
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    11.9 KB · Views: 181
Have you tried disconnecting the USB sound device from the Pi, counting to 3, and then plugging it back in?


Also, have you tried to log into the Pi and used dmesg to determine if there is anything unexpected happening when you power-cycle your USB DAC?


Hello cgallery,
I tried reconnecting USB DAC but it resulted in nasty noises trough speakers, I don't remember the outcome but I think I still had to reboot the Pi.

I will take the logs next time via dmesg and upload them here.

Kind regards

Marko
 
I don't expect to turn on the DAC and resume where I left off. I choose play on another track, album but even though the sqeeuzelite player is visible in the Logitech media server web application there is only silence in the speakers until I reboot RPI.

I did not mean resuming the track you played. I am talking about re-using the running playback application upon the USB device was detached and re-attached.

If you want to (at least try to) fix the issue, you will have to do some simple troubleshooting.

Looking at squeezelite source code in max2play, the alsa output thread is coded very reasonably.

The output thread runs the loop at method output_thread() squeezelite/output_alsa.c at master * max2play/squeezelite * GitHub This endless loop (quit only by setting the variable 'running' to false) always checks for the device existence squeezelite/output_alsa.c at master * max2play/squeezelite * GitHub , checks the device status by calling snd_pcm_state ( squeezelite/output_alsa.c at master * max2play/squeezelite * GitHub ), checks if new data to be sent to the soundcard are available snd_pcm_avail_update ( squeezelite/output_alsa.c at master * max2play/squeezelite * GitHub ), and outputs the new data.

If the device status (snd_pcm_state) was SND_PCM_STATE_DISCONNECTED ( squeezelite/output_alsa.c at master * max2play/squeezelite * GitHub ) , the probe_device flag is set and the next loop iteration jumps into the probing section squeezelite/output_alsa.c at master * max2play/squeezelite * GitHub where the thread checks every 5 seconds until the device re-appears.

If you look at the source code at the links above, all these actions are documented with proper logs. Therefore, if you enable the debug logging level of squeezelite - see parameters -d and -f as described in https://github.com/max2play/squeezelite , you should see exactly what is happening in squeezelite when you detach and re-attach the device.

USB devices do not need rebooting, they are hot-pluggable. However, the playback application must either be able to handle the loss/re-appearance of the audio device, or the application (i.e. squeezelite) must be restarted. No need to reboot the whole OS.
 
How does picoreplayer differ from other linux distributions in this respect? I see regular udev config in the piCore cpio-compressed root filesystem image in the first vfat partition of your downloadable image.

@phofman

Hello phofman, I will take the debug log when it happens again. Thank you for detailed instructions on how to acquire it.

@Greg Erskine

Hello Greg Erskine, first thank you for the pCP. I don't turn off RPI because it does not have power button and removing then reapplying the power via microUSB is unpractical for me.

Kind regards

Marko
 
I know this is an old thread that I'm resurrecting, but I also had this issue with a new install.

For others that may trip across this in a search, I found the solution here:LMS could not reestablish any USB connection after USB Dac is disconnected - Page 2

Basically, try the 'front:CARD=<DAC>,DEV=0' line as your 'Output setting' value on the Squeezelite settings tab of your piCorePlayer WEB UI. Worked great for me!
 

Attachments

  • setting.gif
    setting.gif
    22.7 KB · Views: 81
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.