I am using a Raspberry Pi 4 with piCorePlayer. It is directly connected to the USB input of my speakers. The speakers support auto turn off when the USB goes powerless.
Is there a possibility like HDMI off for USB when turning off the player run on this Raspberry Pi?
Results 1 to 10 of 75
-
2020-08-15, 10:54 #1
- Join Date
- Aug 2020
- Posts
- 8
[piCorePlayer] Turn off USB output when turning off player?
-
2020-08-15, 11:44 #2
Depends on which pi you have.
piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
2020-08-15, 15:18 #3
- Join Date
- Dec 2018
- Location
- The Netherlands
- Posts
- 166
| LMS 8.1.2 | Squeezebox Boom | RPi0W + pCP 6.1.0 + HiFiBerry DAC Zero | SqueezeAMP |
-
2020-08-15, 16:53 #4
That's correct, it works well on a 4, not as good on the older versions. But I see now you said 4, so that works fine..... BUT
Please read the notes on that github page. As when turning off the power on the pi ports, it will kill more than one USB port, and in some boards all of the USB ports.
I've added uhubctl.tcz to our repo. Download it from the extension page
PaulpiCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
2020-08-15, 18:00 #5
- Join Date
- Aug 2020
- Posts
- 8
I installed the extension.
Now I am not sure when exactly the USB ports will be turned off. In the LMS Material Skin I can choose to power off the wanted piCorePlayer. But this does not lead to unpowered USB ports and therefore speakers.
Stopping and restarting Squeezelite does also not affect it.
Rebooting or shutting down the piCorePlayer does lead to turned off and then on again speakers.
But after shutting down I would have to manually reconnect the power supply the next time I want to listen with it.
My goal would be to have that effect with the LMS Material Skin power button.
-
2020-08-15, 18:15 #6
It’s not automatic, you have to learn how to use the program, and write scripts to do what you want.
piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
2020-08-15, 23:56 #7
- Join Date
- Apr 2005
- Location
- UK/London
- Posts
- 3,643
Take a look at the very recent thread about turning off/on HDMI and use the script and techniques discussed there as your template.
Paul Webster
http://dabdig.blogspot.com
Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland
-
2020-08-16, 02:34 #8
- Join Date
- Aug 2020
- Posts
- 8
Got it. Thank you for your replies and for giving direction. I will follow the thread
https://forums.slimdevices.com/showt...ferrerid=70536
and try to adjust it for USB.
-
2020-08-16, 10:29 #9
- Join Date
- Aug 2020
- Posts
- 8
Following the cited thread, I created the following script file:
Code:#!/bin/sh #---------------------------------------------------------------------------------------- # Script for turning RPi4 USB output on/off when Squeezelite player is turned on/off. # This script requires that extension uhubctl.tcz is installed. # Enter the path to this "Power On/Off Script" on the pCP Squeezelite Settings page. # https://github.com/mvp/uhubctl#raspberry-pi-4b #---------------------------------------------------------------------------------------- # squeezelite -S /home/tc/usb-power-on-off.sh # # squeezelite sets $1 to: # 0: off # 1: on # 2: initialising #---------------------------------------------------------------------------------------- case $1 in 0) uhubctl -l 2 -a 0 >/dev/null 2>&1 ;; 1) uhubctl -l 2 -a 1 >/dev/null 2>&1 ;; 2) uhubctl -l 2 -a 1 >/dev/null 2>&1 ;; esac
Here is what it does for me:
"Play" powers up my speakers and plays music.
"Pause" pauses the music and leads to my speakers being shut down.
"Power on/off" the player in LMS does not reliably lead to my speakers being power on/off.
Using the "uhubctl -l 2 -a 0 >/dev/null 2>&1" "/ uhubctl -l 2 -a 1 >/dev/null 2>&1" command loged in my piCorePlayer via SSH always works as expected.
- I am fine with "Play/Pause" causing my speakers to turn on/off but I expected this solution to work with "Power on/off" in LMS.
- "2: initialising": do I really need that line in my script or can I leave it out?
Last edited by sisiko; 2020-08-16 at 10:34.
-
2020-08-16, 11:04 #10
Yes, you can leave out initializing. Make sure you are not using the -C option on the squeezelite page.
piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer