Issue with OnOffShim & latching button

Hi there!

I’ve been having some issues with getting the OnOffShim working with an external latching button switch.
The board powers up correctly when the external switch has been pushed on, but right after the Pi does its BIOS checks, the shutdown command is triggered turning the Pi off before it loads the OS, leaving the Pi shutdown but still powered on. Turning the switch off at this point does not kill the power to the Pi.

Using the inbuilt button works as it should.

My configuration looks like this:


Do I need to do anything extra to the config for my latching button to work correctly?


I’m not sure I am following. Using a latching button, I presume you also toggle its state as part of booting the Pi?

… otherwise the pin state, which is what the software daemon checks periodically would be directly triggering a shutdown.

[quote=“Psyrinix, post:1, topic:5293”]
The board powers up correctly when the external switch has been pushed on[/quote]
reacting to this part of your post… you mean pushed out right? without knowing what type of latching button you are using, and how you have tied it up, pushing it on would set the pin to ground, the equivalent of pressing the SHIM built-in button.

I’m using a power switch on a NES console, which when pushed in, stays in the ‘on’ position until you push it again, turning it off. Similar to the switch shown here -

Are you asking if I have modified anything in the daemon to toggle the state in boot? If so, no. I’m not sure what would be involved to achieve this.

Cheers for your help,

a latching button retains its state until you toggle it out. So, you cannot just use the above as a way to ‘supply power’ to your Pi, this is not how the SHIM works.

Instead it detects the state of the button and if the trigger_pin is grounded then will initiate a shutdown. It will then assert bcm4 low. The circuitry will then kill power to the Pi. If another state change on the trigger_pin is detected later on, i.e you press the button again, then it will start feeding power to the Pi again.

I am assuming that the guy in the YouTube video is setting the state of the trigger_pin on boot of the Pi. When the Pi is booted pressing the button again will trigger the pin again?

How do you think the guy has done it in the video?

that is our very own @guru … I suspect he is not running the clean-shutdown daemon, I will ask him. Still what you describe is expected with the software as supplied.

1 Like

Is it the clean-shutdown daemon that is checking for the trigger state and causing @Psyrinix 's Pi to shut down the moment it has booted?

yes, almost certainly. It monitors the pin for a ‘low’ state, so that is the logical consequence.

I have a feeling that what is happening that because the button is always on the pin is always being registered as 1. Once the daemon has chance to boot it detects this and triggers the shutdown procedure.

It would be great to find out what @guru is running to check for the state of a non-momentary button.

well, it would be possible to support non-momentary switches, but this would make the ‘hold’ feature completely unusable i.e at the moment I can’t see a way to support both meaningfully.

Nor do I think that using a latching button makes sense in this use case, but that is another aspect of the problem. Obviously, with an ad hoc software trigger then it is possible to use that kind of setup.

Hey there,

I was using the standard software install with the soft shutdown and the button header on the OnOff SHIM. Nothing else magic, but might have to try with current software in case anything changed.