Go Back   Home > Forums > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

PC Based Computer music servers, crossovers, and equalization

Squeezelite looses connection with USB DAC
Squeezelite looses connection with USB DAC
Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 21st February 2018, 12:23 PM   #1
mkusan is offline mkusan  Croatia
diyAudio Member
 
Join Date: Jan 2011
Location: Zagreb
Default Squeezelite looses connection with USB DAC

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
  Reply With Quote
Old 25th February 2018, 02:39 PM   #2
phofman is offline phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
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.
  Reply With Quote
Old 25th February 2018, 03:43 PM   #3
mkusan is offline mkusan  Croatia
diyAudio Member
 
Join Date: Jan 2011
Location: Zagreb
Quote:
Originally Posted by phofman View Post
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.
Attached Images
File Type: png Screenshot_1.png (11.9 KB, 51 views)
  Reply With Quote
Old 25th February 2018, 03:56 PM   #4
cgallery is offline cgallery  United States
diyAudio Member
 
Join Date: Mar 2015
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?
  Reply With Quote
Old 25th February 2018, 04:06 PM   #5
mkusan is offline mkusan  Croatia
diyAudio Member
 
Join Date: Jan 2011
Location: Zagreb
Quote:
Originally Posted by cgallery View Post
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
  Reply With Quote
Old 26th February 2018, 05:42 AM   #6
Greg Erskine is offline Greg Erskine  Australia
diyAudio Member
 
Greg Erskine's Avatar
 
Join Date: Jan 2002
Location: Sydney/Australia
Squeezelite looses connection with USB DAC
hi Marko,

It is best to assume that USB devices are not hot pluggable, assume they are only connected during the boot process.

regards
Greg
__________________
Greg Erskine
  Reply With Quote
Old 26th February 2018, 06:38 AM   #7
phofman is offline phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
Quote:
Originally Posted by mkusan View Post
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.
  Reply With Quote
Old 26th February 2018, 09:53 AM   #8
Greg Erskine is offline Greg Erskine  Australia
diyAudio Member
 
Greg Erskine's Avatar
 
Join Date: Jan 2002
Location: Sydney/Australia
Squeezelite looses connection with USB DAC
hi Marko,

I am referring to piCorePlayer ONLY, not computers in general.

Why not turn piCorePlayer off when you turn the DAC off?

regards
__________________
Greg Erskine
  Reply With Quote
Old 26th February 2018, 10:45 AM   #9
phofman is offline phofman  Czech Republic
diyAudio Member
 
Join Date: Apr 2005
Location: Pilsen
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.
  Reply With Quote
Old 26th February 2018, 04:54 PM   #10
mkusan is offline mkusan  Croatia
diyAudio Member
 
Join Date: Jan 2011
Location: Zagreb
Quote:
Originally Posted by phofman View Post
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
  Reply With Quote

Reply


Squeezelite looses connection with USB DACHide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
piCorePlayer = piCore Linux + Raspberry Pi + Squeezelite Greg Erskine PC Based 264 3rd April 2018 04:02 AM
ESS 9018s with Squeezelite built-in gmaff Digital Line Level 0 7th April 2016 02:51 AM
squeezelite or mpdPup - which one? bitsandbobs PC Based 11 18th March 2013 07:54 AM
HELP! Testing my amp? It looses sound on strong bass DigiSoft Car Audio 25 29th March 2010 09:40 AM


New To Site? Need Help?

All times are GMT. The time now is 09:10 AM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 14.29%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Copyright ©1999-2018 diyAudio
Wiki