If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
It Is possibile to do this?
I need to start or restart squeezelite when i Power on my USB dac.
Because if dac Is off squeezelite dont start and i need to start It manualy.
By udev event?
Formerly known as SlimServer and Squeezecenter and Squeezebox Server and Slimp3.
Paul Webster Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin
I'm not sure this will help in this case. That tweak means that once Squeezelite has started, it doesn't mind the USB DAC disappearing - it will output to it again without intervention once the DAC reappears. But in my experience Squeezelite will still fail to start at boot time if the DAC isn't there.
That tweak MAY help the OP if he can find a way to force Squeezelite to start regardless of whether the DAC is present (I'd be interested in such a solution too) - that tweak may then mean that as soon as the DAC appears Squeezelite will then be happy to output to it.
Try enabling the Close output setting (-C) option with a value of 5.
It's suppose to allow squeezelite to start and wait for the device to appear.
You need to use the hw:CARD= device with the -o option not plughw:CARD=
Not works.
Now, my dac Is Power off. Squeezelite Is down. I try to start squeezelite by SSH to Copy the output: [email protected]:~$ /usr/local/bin/squeezelite -n "Stereo" -o hw:CARD=R20,DEV=0 -a 80:4::1: -C 5
[13:10:54.592723] test_open:281 playback open error: No such device
[13:10:54.592815] output_init_common:394 unable to open output device: hw:CARD=R20,DEV=0 [email protected]:~$
As you see, if the dac Is off, squeezelite dont accept "-o hw:card....." because It not exist. If i Power on dac It works.
I'm thinking an udev rule that start squeezelite when dac Is on...
Try enabling the Close output setting (-C) option with a value of 5.
It's suppose to allow squeezelite to start and wait for the device to appear.
You need to use the hw:CARD= device with the -o option not plughw:CARD=
Thanks Ralphy - that's done the trick in my case. With the output set to hw:CARD=DAC,DEV=0, and the -C 5 option, Squeezelite starts up even if the DAC is off, and starts outputting to it as soon as the DAC appears. It's also equally robust if I should disconnect and then reconnect the DAC while it's playing.
@corrobor - you posted just before me, and evidently have different results. I think my case is slightly different, in that my USB DAC is one of several inputs built into my amp (a Hypex DLCP). Previously, if I had the amp switched to 'optical' instead of 'USB' while the Pi was booting, the DAC would not be found and Squeezelite would not start. But now I find that I can even do without the '-C 5' option. The difference is that I'm now using 'hw:CARD=DAC,DEV=0' under pCP7, whereas previously I was using 'front:CARD=DAC,DEV=0' under pCP6. Something has clearly changed, for the better in my case.
Using an ALSA output prefix other than hw: with the -o option "hides" some or all of the physical capabilities of the audio hardware from squeezelite behind the ALSA subsystems.
Using an ALSA output prefix other than hw: with the -o option "hides" some or all of the physical capabilities of the audio hardware from squeezelite behind the ALSA subsystems.
I Need to automatcly "Press" the squeezelite restart button when dac Is plugin. I can write udev rules but what Is the command ti press the restart button?
Using an ALSA output prefix other than hw: with the -o option "hides" some or all of the physical capabilities of the audio hardware from squeezelite behind the ALSA subsystems.
Sorry, why if i press the "restart" button in the web interface squeezelite start (the icon become green) and instead if i do this command in SSH Shell "/usr/local/bin/squeezelite -n "Stereo" -o hw:CARD=R20,DEV=0 -a 80:4::1:" the icon Is Red ?
Sorry, why if i press the "restart" button in the web interface squeezelite start (the icon become green) and instead if i do this command in SSH Shell "/usr/local/bin/squeezelite -n "Stereo" -o hw:CARD=R20,DEV=0 -a 80:4::1:" the icon Is Red ?
pCP calls
sudo /usr/local/etc/init.d/squeezelite status
which looks for a pid file and then checks to see if the listed process is running
So if you called
sudo /usr/local/etc/init.d/squeezelite restart
or
sudo /usr/local/etc/init.d/squeezelite start
rather than running it your way then you would get a pid file created and things would work the way that pCP expects it.
Paul Webster Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin
pCP calls
sudo /usr/local/etc/init.d/squeezelite status
which looks for a pid file and then checks to see if the listed process is running
So if you called
sudo /usr/local/etc/init.d/squeezelite restart
or
sudo /usr/local/etc/init.d/squeezelite start
rather than running it your way then you would get a pid file created and things would work the way that pCP expects it.
PERFECT!!!! With this i solved!
1) i made this udev rule in /etc/udev/rules.d
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="278b", ATTR{idProduct}=="5100", RUN+="/home/tc/rotel.sh"
My dac's Idvendor and idproduct i got from dmesg
2)i made the script rotel.sh (in my home) like this:
#!/bin/sh
giar=$(sudo /usr/local/etc/init.d/squeezelite status)
if [ "$giar" = "Squeezelite not running." ];
then
sudo /usr/local/etc/init.d/squeezelite restart
fi
So i test if squeezelite Is off and if yes then start It.
This script run everytime i poweron the amplifier/dac by the udev rules
I put in /opt/.filelist to backup the rule file and the script.
It works!!!!
I'm happy
I tried to build the same for my Harman/Kardon Soundsticks.
I found this in dmesg when I switch them off and on again:
Code:
[ 126.710090] usb 1-1.4: USB disconnect, device number 4
[ 131.288928] usb 1-1.4: new full-speed USB device number 6 using xhci_hcd
[ 131.407372] usb 1-1.4: New USB device found, idVendor=05fc, idProduct=7849, bcdDevice= 0.01
[ 131.407387] usb 1-1.4: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[ 131.407399] usb 1-1.4: Product: SoundSticks
[ 131.407411] usb 1-1.4: Manufacturer: harman/kardon
[ 131.440242] usb 1-1.4: Warning! Unlikely big volume range (=656), cval->res is probably wrong.
[ 131.440257] usb 1-1.4: [2] FU [PCM Playback Volume] ch = 2, val = -10496/0/16
[ 131.467984] input: harman/kardon SoundSticks as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:05FC:7849.0003/input/input2
[ 131.525338] hid-generic 0003:05FC:7849.0003: input,hidraw0: USB HID v1.00 Device [harman/kardon SoundSticks] on usb-0000:01:00.0-1.4/input2
So I used the following for the file /etc/udev/rules.d/97-soundsticks.rules:
And I used the following script (x-bit is set!) in /home/tc/soundsticks.sh:
Code:
#!/bin/sh
giar=$(sudo /usr/local/etc/init.d/squeezelite status)
if [ "$giar" = "Squeezelite not running." ];
then
sudo /usr/local/etc/init.d/squeezelite restart
fi
sudo /usr/local/sbin/alsactl restore
I added the file /etc/udev/rules.d/97-soundsticks.rules to /opt/.filetool.lst and did a backup.
But nothing is happening! Does someone know what I am doing wrong?
For testing i added "sudo touch /home/tc/whatever" to the soundsticks.sh file, but no file is created. So I assume that the udev rule is not started.
Pi4 4GB piCorePlayer with LMS and Squeezelite for USB inside an Argon One case
Pi3B+ (7" Display, Hifiberry DAC+ Pro) piCorePlayer with Squeezlite/Jivelite for Hifiberry inside a SmartiPi touch case
Pi Zero W only for Bluetooth headphones
Two Airport Express
Ikea Symfonisk
I tried to build the same for my Harman/Kardon Soundsticks.
I found this in dmesg when I switch them off and on again:
Code:
[ 126.710090] usb 1-1.4: USB disconnect, device number 4
[ 131.288928] usb 1-1.4: new full-speed USB device number 6 using xhci_hcd
[ 131.407372] usb 1-1.4: New USB device found, idVendor=05fc, idProduct=7849, bcdDevice= 0.01
[ 131.407387] usb 1-1.4: New USB device strings: Mfr=3, Product=1, SerialNumber=0
[ 131.407399] usb 1-1.4: Product: SoundSticks
[ 131.407411] usb 1-1.4: Manufacturer: harman/kardon
[ 131.440242] usb 1-1.4: Warning! Unlikely big volume range (=656), cval->res is probably wrong.
[ 131.440257] usb 1-1.4: [2] FU [PCM Playback Volume] ch = 2, val = -10496/0/16
[ 131.467984] input: harman/kardon SoundSticks as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.2/0003:05FC:7849.0003/input/input2
[ 131.525338] hid-generic 0003:05FC:7849.0003: input,hidraw0: USB HID v1.00 Device [harman/kardon SoundSticks] on usb-0000:01:00.0-1.4/input2
So I used the following for the file /etc/udev/rules.d/97-soundsticks.rules:
And I used the following script (x-bit is set!) in /home/tc/soundsticks.sh:
Code:
#!/bin/sh
giar=$(sudo /usr/local/etc/init.d/squeezelite status)
if [ "$giar" = "Squeezelite not running." ];
then
sudo /usr/local/etc/init.d/squeezelite restart
fi
sudo /usr/local/sbin/alsactl restore
I added the file /etc/udev/rules.d/97-soundsticks.rules to /opt/.filetool.lst and did a backup.
But nothing is happening! Does someone know what I am doing wrong?
For testing i added "sudo touch /home/tc/whatever" to the soundsticks.sh file, but no file is created. So I assume that the udev rule is not started.
My writing mistake, i have just correct the post: i missing a "comma" before "RUN" in udev rules (after idproduct). Add a comma and try.
To reload udev (instead ti reboot the Raspberry) you can do sudo udevadm control --reload
Let me know
My writing mistake, i have just correct the post: i missing a "comma" before "RUN" in udev rules (after idproduct). Add a comma and try.
I added it, made a backup, tried your commando, but nothing happened. Then I did a reboot, looked at the file and it was changed, but nothing happened. :-(
These are the rights of the files:
Code:
-rw-rw-r-- 1 root root 119 Jan 14 17:31 97-soundsticks.rules
-rwxr-xr-x 1 tc staff 225 Jan 14 16:54 soundsticks.sh
Pi4 4GB piCorePlayer with LMS and Squeezelite for USB inside an Argon One case
Pi3B+ (7" Display, Hifiberry DAC+ Pro) piCorePlayer with Squeezlite/Jivelite for Hifiberry inside a SmartiPi touch case
Pi Zero W only for Bluetooth headphones
Two Airport Express
Ikea Symfonisk
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment