If you want to used gpio to control Jivelite, you will need to simulate keyboard events. I think this is covered in the Jivelite thread.
Announcement
Collapse
No announcement yet.
[ANNOUNCE] SqueezeButtonPi - Tool to use buttons and rotary encoders on a RPi
Collapse
X
-
piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
-
Originally posted by paul- View PostLMS is the problem......you need to halt the system first. You can build or buy power relays. To drop power after the kernel shuts down.
From the 'gpio-shutdown' section here:
The default
configuration uses GPIO3 with a pullup, so if you connect a
button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
you get a shutdown and power-up button.
With a button connected between the specified pin and GND, a press of that button will call the pcp-powerbutton.sh script in /home/tc. That script will safely shut down pCP, issuing a 'halt' command to prevent corruption of the SD card caused if prefs or cache are being written when the power is cut.
If I'm on the right lines, should that button be a momentary button or a latching button? Does pCP restart when the pin is grounded a *second* time, or when the connection to ground is broken? If a momentary button is required, that button should presumably *not* be configured as part of an sbpd setup.
Originally posted by Jeff07971 View PostI just tried "gpio-shutdown" but it does not shutdown the pi as the readme suggests it only does "Player power off"
the next button push does "Player power on"
Jeff
Comment
-
Reading more carefully, it seems like the button should be a momentary button: "After shutdown, the system can be powered up again by driving GPIO3 low."
So grounding the pin while pCP is running will call the pcp-powerbutton.sh script, which issues the 'sudo /sbin/poweroff' command. Grounding GPIO3 while it's shut down will use built-in RPi functionality to restart it. I also note that GPIO3 has an external pull-up resistor, so the pull-up setting in the 'tweaks' configuration should presumably be 'off' if using GPIO3 - or does this setting have no effect on GPIO3?
Something to play with this evening. I have a DIY button panel, with a 'red' button that currently uses sbpd to power off the local player (short press) or restart LMS (long press). Assuming it's not possible to use the button configured for the gpio-shutdown overlay to also function with sbpd, I'll remove those two functions from my sbpd configuration and connect that button to GPIO3 instead.
If I were to use a different pin for the gpio-shutdown, say GPIO26, then grounding that pin would power off, and grounding GPIO3 would restart, so a SPDT toggle switch might work (GPIO26-GND-GPIO3). Would it matter if GPIO3 stays grounded after a restart? Would it matter if GPIO26 stays grounded after shutting down?
Comment
-
Grounding GPIO3 apparently performs a 'wake from halt', so it seems it'll only work if the Pi has actually been halted (e.g. by /sbin/poweroff?), rather than having the power interrupted. In its 'halted' state the Pi can then have the power removed safely. I think a toggle switch isn't such a good idea after all, but using a momentary button to ground GPIO3, to either halt the system or wake it up again, seems like the way to go.Last edited by chill; 2019-05-08, 10:44.
Comment
-
Originally posted by chill View PostWait... it doesn't seem reliable - sometimes works and sometimes doesn't. Coming back from a 'halt' (e.g. if I manually issue the 'sudo /sbin/poweroff' command in a terminal) seems reliable, but shutting down seems intermittent. Haven't spotted a pattern yet.
What I do - and it seems to work reliably, so far - is to use a different pin for shutdown (GPIO 4 in my case) and then GPIO 3 for restart. Then I wired both of these and ground (3 wires) to the same double-pole momentary switch. Thus the two pins are independent but both grounded at the same time when you push the button.
Comment
-
Last edited by paul-; 2019-05-08, 14:43.piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
Comment
-
Steering the discussion back to sbpd, I've just spotted that there's a 'stopserver' command. Would it be sufficient to issue this command, via a button press in sbpd, before pulling the power? Would this ensure that no writing to cache and prefs is taking place at the moment the power is pulled, and hence prevent corruption of the SD card?
Comment
-
you could issue a script to shutdown the server, but issuing a OS halt command is much easier.piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
Comment
-
I agree that issuing the halt command is easy enough, but in a setup that's already using sbpd a script wouldn't be necessary. Isn't it just a case of adding a new command to sbpd_command.cfg, say:
Code:XLMS=["stopserver"]
Comment
-
Originally posted by paul- View PostIf you want to used gpio to control Jivelite, you will need to simulate keyboard events. I think this is covered in the Jivelite thread.
Comment
-
piCorePlayer a small player for the Raspberry Pi in RAM.
Homepage: https://www.picoreplayer.org
Please donate if you like the piCorePlayer
Comment
Comment