Hi all
I’ve successfully enabled a hardware switch on a raspberry pi 3 running standard raspbian stretch, simply by adding a switch connected to GPIO3 and ground, and adding the line “dtoverlay=gpio-shutdown” to /boot/config.txt as described here:
This switch will shutdown the pi (and if already shutdown, power it up again).

Now for my questions to all you masters of OSMC:
Why does this setup not work when running standard OSMC image?
How can I get it working?

Because the gpio.shutdown overlay is not part of OSMC (see /boot/overlays)

Can try to copy it into the directory or kindly ask @sam_nazarko to include it in the next update

Is it a recently added overlay? If so, it will likely come with a new kernel update

@sam_nazarko: Oh yes please include this overlay in the next update. It’s a must! :slightly_smiling_face:
Thank you very much.

Even with the correct overlay “dtoverlay=gpio-shutdown” it still is not working. I even copied gpio-shutdown.dtbo from a working Raspbian image and that didn’t help.

Under Raspbian you’ll see:
[ 10.301261] input: soc:shutdown_button as /devices/platform/soc/soc:shutdown_button/input/input0
in dmesg. But with OSMC there is nothing - so possibly something to do with the kernel?

Probably some CONFIG_GPIO options missing.

I’m sorry to revive this old thread, but it’s what comes closest to my problem.

I have this almost working on Raspbian Stretch with Kodi 17.6 Krypton. I haven’t tried on my OSMC image yet.
I have added dtoverlay=gpio-shutdown,gpio_pin=3 to /boot/config.txt (and /boot/overlays/gpio-shutdown.dtbo is of course present).
Nothing happens when I press the button, if Kodi is running, but when I exit Kodi and use the Raspbian desktop, then pressing the button works fine.
What needs to be configured to make it work inside Kodi?


This seems to be very similar to this thread. In the last post I wrote:

I came across this thread on GitHub https://github.com/osmc/osmc/issues/434 where it was suggested that Kodi was (still is?) capturing the events and doing nothing with them. What’s the current state of play @sam_nazarko?

Please stop Kodi from the command line (systemctl stop mediacenter) and see if the button then works on OSMC.