RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    FBI Image Viewer display image on Pi shutdown

    Scheduled Pinned Locked Moved Help and Support
    pi shutdownfbitipsandtricksimageviewer
    20 Posts 8 Posters 6.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • *
      **Scannigan** @herb_fargus
      last edited by

      @herb_fargus imagine you're talking to someone who knows nothing about stuff like that :)

      obsidianspiderO 1 Reply Last reply Reply Quote 0
      • obsidianspiderO
        obsidianspider @**Scannigan**
        last edited by

        @__Scannigan__ I believe you could just make a bash script and then put it in /etc/rc.local.shutdown

        šŸ“· @obsidianspider

        1 Reply Last reply Reply Quote 1
        • caver01C
          caver01
          last edited by caver01

          Like this, right?

          alt text

          Sorry. I couldn't resist, what with FBI mentioned. In any case, I am curious how this plays out because I would like to add a shutdown screen myself.

          My 4-player cocktail style cabinet built as a custom "roadcase"

          Lyle_JPL 1 Reply Last reply Reply Quote 3
          • Lyle_JPL
            Lyle_JP @caver01
            last edited by

            @caver01 William S. Sessions will always be the most famous FBI director to retro-gamers. :)

            1 Reply Last reply Reply Quote 3
            • obsidianspiderO
              obsidianspider
              last edited by obsidianspider

              William Steele Sessions

              Steele?! Why didn't he use that in these promos? That certainly makes him sound like a badass.

              Then again, he didn't really look the part.

              šŸ“· @obsidianspider

              mediamogulM 1 Reply Last reply Reply Quote 1
              • mediamogulM
                mediamogul Global Moderator @obsidianspider
                last edited by

                @obsidianspider

                Then again, he didn't really look the part.

                You should have seen him in his prime.

                Warning

                RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                1 Reply Last reply Reply Quote 2
                • *
                  **Scannigan**
                  last edited by

                  @obsidianspider I don't have /etc/rc.local.shutdown and where would I find the script/command for sudo poweroff.

                  @herb_fargus I see what you mean about the image being there for five seconds now, my bad here's what I mean, there's no sound obviously. link text

                  Doing a bit of searching on line, most posts seem to refer to creating a script called "asplashscreen" however that already seems to exist and looks to be associated with the "show custom splash screen" script, so I don't want to mess with that.

                  So the next thing is to create a different script and execute it from etc/rc.local, however most of the scripts I've seen have what I can only assume is a start condition which I think is determined by runlevels, does one particular run level refer to shutdown?

                  I know I'm probably making it a bit more difficult than it needs to be, but this is a little bit out side of my experience/knowledge.

                  I assume once I've got my head around this bit the sound should be very similar just using a different service.

                  If any of you guys could expand on your comments it would be greatly appreciated

                  obsidianspiderO 1 Reply Last reply Reply Quote 0
                  • obsidianspiderO
                    obsidianspider @**Scannigan**
                    last edited by

                    @__Scannigan__ said in FBI Image Viewer display image on Pi shutdown:

                    I don't have /etc/rc.local.shutdown

                    You'd have to create it. sudo nano r/etc/rc.local.shutdown should open nano with nothing in it. When you save, it'd create the file. What should go in that file? Well, whatever commands you'd like the system to run when you shut the system down. (Whatever you'd type in at the terminal.)

                    šŸ“· @obsidianspider

                    * 1 Reply Last reply Reply Quote 0
                    • *
                      **Scannigan** @obsidianspider
                      last edited by

                      @obsidianspider Excuse my ignorance, so is the rc.local basically a start up one and rc.local.shutdown would be a shut down one?

                      So let say I needed to create two script one for sound and one for an image I would need to create two .sh scripts then point to them in rc.local.shutdown?

                      obsidianspiderO 1 Reply Last reply Reply Quote 0
                      • obsidianspiderO
                        obsidianspider @**Scannigan**
                        last edited by

                        @__Scannigan__ I don't know a ton about it either, but I know that rc.local will run those commands when you boot, so I'm assuming rc.local.shutdown will run it when it's shutting down? I've not personally messed with the latter, but rc.local is what starts my Mausberry monitoring script.

                        I would think that you could write one bash script that essentially runs both commands, and then put that in the rc.local.shutdown. Obviously test the script while the Pi is running first before trying to automate it. I would think that the worst case scenario is that creating that file just ends up doing nothing at all. I don't think you'll break the Pi or your OS.

                        šŸ“· @obsidianspider

                        * 1 Reply Last reply Reply Quote 1
                        • *
                          **Scannigan** @obsidianspider
                          last edited by

                          @obsidianspider Cheers bud I'll see if I can make any progress, worst thing that can happen is the script just won#t work

                          CapemanC 1 Reply Last reply Reply Quote 0
                          • CapemanC
                            Capeman @**Scannigan**
                            last edited by Capeman

                            @__Scannigan__ Not sure if you got this working yet, but I was interested so i read into it a bit. This is the synopsis of what i've come up with, step by step for any noobs reading (i'm a bit of one myself).

                            Step 1 would be to install FBI from the command line:

                            sudo apt-get install fbi

                            This is the call you would use to run it if you wanted to do it on command:

                            fbi -d /dev/fb0 -a *.jpg

                            The -d /dev/fb0 variable defines the framebuffer device
                            The -a defines autozoom
                            And obviously *.jpg would be renamed to the path of your jpeg file

                            Now (i think) all you would need to do is create this file which is called on shutdown by default as was mentioned above:

                            /etc/rc.local.shutdown

                            And write a simple bash script inside it containing the run command above:

                            #! /bin/bash
                            #-a enables autozoom
                            #name jpg to match your file
                            #timeout -t sec / might change duration on screen
                            fbi -d /dev/fb0 -a -t 20 image.jpg

                            Anyone smarter than me want to chime in to let me know if this seems correct? I'll test it tonight and write back.

                            Vector Artist, Designer and Maker of Stuff: Laser Cut Atari / Pixel Theme Bartop

                            * 1 Reply Last reply Reply Quote 1
                            • *
                              **Scannigan** @Capeman
                              last edited by

                              @Capeman won't be able to try it into Monday, you'll never to let me know how it goes

                              1 Reply Last reply Reply Quote 0
                              • S
                                sinibomb
                                last edited by

                                Bit of a thread necro, but wondering if anyone has got this to work?

                                I've created /etc/rc.local.shutdown, written the bash script per @Capeman, but nothing seems to happen when I shutdown via Emulationstation.

                                I'm very much a noob in terms of any coding, so not sure what (if any) steps I've missed.

                                * 1 Reply Last reply Reply Quote 0
                                • *
                                  **Scannigan** @sinibomb
                                  last edited by

                                  @sinibomb I actually got something working, I'm out at the moment when I'm back at my Pi I'll send you what I added

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    sinibomb
                                    last edited by

                                    @Scannigan Brilliant, many thanks

                                    * 1 Reply Last reply Reply Quote 0
                                    • *
                                      **Scannigan** @sinibomb
                                      last edited by

                                      @sinibomb

                                      This was just a simple change to the popular shutdown button script

                                      But this played two audio files and displays an image on Shutdown, change .wav and .PNG file names to suit

                                      shutdown.py

                                      #!/usr/bin/python import RPi.GPIO as GPIO import time import subprocess # we will use the pin numbering to match the pins on the Pi, instead of the # GPIO pin outs (makes it easier to keep track of things) GPIO.setmode(GPIO.BOARD) # use the same pin that is used for the reset button (one button to rule them all!) GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP) oldButtonState1 = True while True: #grab the current button state buttonState1 = GPIO.input(5) # check to see if button has been pushed if buttonState1 != oldButtonState1 and buttonState1 == False: # start playing silence to keep audio channel open to prevent missing beginning audio myinput = open('/dev/zero') subprocess.Popen(['/usr/bin/aplay', '-c2', '-r48000', '-fS16_LE', '-N' ], stdin=myinput ) # start showing screen (underneath emulationstation) subprocess.call("/home/pi/scripts/showImg.sh", shell=True) time.sleep(1) # play audio 1
                                      subprocess.call("/usr/bin/aplay /home/pi/scripts/audio_1.wav", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(2) # quit emulation station subprocess.call("killall -SIGQUIT emulationstation", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(1) # play audio 2 subprocess.call("/usr/bin/aplay /home/pi/scripts/audio_2.wav", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(3) # shutdown subprocess.call("shutdown -h now", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) oldButtonState1 = buttonState1 time.sleep(.5)

                                      showImg.sh

                                      #!/bin/sh sudo /usr/bin/fbi -T 2 -once -t 30 -noverbose -a "/home/pi/scripts/image.png" &

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post

                                      Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                      Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.