Hi,
I would like to add a function -turn off the usb power- on shutdown.sh, is it possible?
Sur
Hi,
I would like to add a function -turn off the usb power- on shutdown.sh, is it possible?
Sur
Hey, yes, looks like there’s an utility that could control the USB power: https://github.com/mvp/uhubctl
Then you’d simply add the call to the utility in the shutdown.sh script before the sudo shutdown now
line.
Hi @Giedrius Thanks I add the line but it doesn’t work. I am using rpi 3b+
I changed the script on here: /usr/local/pisound/scripts/pisound-btn/shutdown.sh
. /usr/local/pisound/scripts/common/common.sh
log “Pisound button held for $2 ms, after $1 clicks!”
if [ $1 -ne 1 ]; then
log “Ignoring hold after $1 clicks…”
exit 0
fi
aconnect -x
for i in $(seq 1 10); do
flash_leds 1
sleep 0.1
done
log “Shutting down.”
uhubctl -l 1-1 -p 2 -a 0
sudo shutdown now
Does uhubctl -l 1-1 -p 2 -a 0
work as expected when you run it in a terminal?
I got this patch@patchbox:~ $ uhubctl -l 1-1 -p 2 -a 0
bash: uhubctl: command not found
I tried
patch@patchbox:~ $ sudo uhubctl -l 1-1 -p 2 -a 0
sudo: uhubctl: command not found
Yes I done this. My steps:
You have to also do:
git clone https://github.com/mvp/uhubctl
cd uhubctl
make
sudo make install
The installation is done. I did this:
log “Pisound button held for $2 ms, after $1 clicks!”
if [ $1 -ne 1 ]; then
log “Ignoring hold after $1 clicks…”
exit 0
fi
aconnect -x
for i in $(seq 1 10); do
flash_leds 1
sleep 0.1
done
log “Shutting down.”
uhubctl -l 1-1 -p 2 -a 0
sudo shutdown now
what did I do wrong?
Try using sudo at the start of the line in the script too.
the prev code works! I made a mistake. Thx for your help @Giedrius