[IR PowerButton for RPI] Gracefully shutdown LE with an IR control switch

  • I bought the IR PowerButton for RPI for my Raspberry PI 3 based Kodi player.

    After the hardware install, I went to configure the linux to support it and have the POWEROFF command do a graceful shutdown of the OS instead of a 'crash'.

    Here are the instructions I was given: http://wiki.52pi.com/index.php/Power_But..._set_it_up

    As you can see, they are NOT for LibreElec. Does anyone have reliable instructions on how to get this configured properly for a LibreElec on RPI3 Kodi box?

    Thanks in advance!!!

  • I edited your topic title a bit. Adding "Please help" to your title is unnecessary here.

  • Code
    1. wget http://sprunge.us/MRPN -O /storage/.config/gpioshutdown
    2. chmod +x /storage/.config/gpioshutdown
    3. wget http://sprunge.us/MgBZ -O /storage/.config/system.d/powerbutton.service
    4. systemctl enable powerbutton.service

    ^ The first URL has a slightly cleaned-up version of their gpioshutdown script. The second URL has a complete guess at a systemd.service that runs before Kodi startup. I am a novice at systemd things so no guarantees it will work. I also have no clue what other GPIO dependencies are required for the gpioshutdown script to work. You should consider them as a hint at how to do things; they are likely not a complete solution.

  • I also have no clue what other GPIO dependencies are required for the gpioshutdown script to work.

    It is wiringPi which we don't have?


    Support my work with small (or big) Paypal donation   <3


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • I followed your instructions, but it still appears (not sure how to check) to be simply powering off, not gracefully shutting down. The instructions all ran cleanly with no errors, and the two downloaded files look fine.

  • There doesn't appear to be a "standard" way to install the WiringPi library, which this piece of hardware apparently requires.

    I tried downloading the files manually, but the build script uses make, which apparently isn't part of LibreElec either.


    Any help would be very much appreciated!!!


    Surely there is a way to get this remote board working. This is all about Kodi, and Kodi needs to be able to be safely shut down via IR as well as started!


    Thanks again!

  • If this project is really about making a simple-to-use KODI media center, then support for most common remote-on-off board should somehow be possible. I'm extremely frustrated that this OS is SOOOO stripped down, I can't complete the configuration of KODI the way I need it. There should be some way for us to use apt-get.


    Going to a full-blown OS brings along so much crap that I DON'T need that it compromises the "appliance" nature of what we need. However, this OS has gone too far the other way. Please consider adding WiringPi to the image, or else add apt-get so that those of us who know a little can add the components we truly feel we need.


    Thanks much!

  • Here is wiringpi addon: plugin.program.wiringPi-8.1.1-RPi2.arm.zip

    It only has gpio program which I think it should be enough. With scripts from chewitt's post #3 it should work. If not you can send me one RPi2 and this button. And then I will write you detail intructions ;)


    Support my work with small (or big) Paypal donation   <3


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • If it doesn't work (gpio command not found) try adding

    Code
    1. . /etc/profile

    to second line in /storage/.config/gpioshutdown.


    Support my work with small (or big) Paypal donation   <3


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • Well, dang. Still no joy. Hitting the IR power down button still appears to be simply yanking the power, not doing a graceful shutdown.


    The gpio command is definitely working after adding your add-on, so awesome job putting that together!


    Now it's a matter of translating the other bits into their LibreElec equivalents.


    One part I can't quite figure out is what is the LibreElec equivalent of the /etc/rc.local file that is supposed to get these three lines before the exit command that is supposedly already there:


    sudo /etc/init.d/gpioshutdown &

    gpio mode 25 out

    gpio write 25 1


    There is no /etc/rc.local file to put the commands in (yes, I realize I'd need to modify the path in the first line to /storage/.config, which is where the commands in post 3 put it). What is the LibreElec equivalent? Any ideas about that bit?


    I also added these lines to the /flash/config.txt:


    device_tree=bcm2710-rpi-3-b.dtb

    dtoverlay=power-off,gpiopin=26

    dtoverlay=pi3-act-led,gpio=21


    I think part of the problem of troubleshooting this is that when it fails, the power appears to be simply instantly cut off, so you can't see if it got even partway through anything.


    And thanks again!

    Dave

  • chewitt posted service script as /storage/.config/system.d/powerbutton.service but maybe not working. Let me check it.


    Support my work with small (or big) Paypal donation   <3


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • Could it be that the powerbutton.service is referencing the wrong file? The file references /storage/.config/powerbutton.sh, but there is no such file there with that name. Instead, there is gpioshutdown, which we did set to executable.


    It's definitely an issue, I think, but apparently not the only one still. After fixing and rebooting, it still simply powers down instead of gracefully shutting down.

  • First remove old files

    Code
    1. rm /storage/.config/gpioshutdown
    2. rm /storage/.config/system.d/powerbutton.service
    3. rm /storage/.config/system.d/kodi.target.wants/powerbutton.service

    and then try this

    Code
    1. wget http://sprunge.us/LgTH -O /storage/.config/gpioshutdown.sh
    2. chmod +x /storage/.config/gpioshutdown.sh
    3. wget http://sprunge.us/hIHa -O /storage/.config/system.d/gpioshutdown.service
    4. systemctl enable gpioshutdown.service
    5. systemctl start gpioshutdown.service


    Support my work with small (or big) Paypal donation   <3


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)