• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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.5k 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**
    last edited by **Scannigan** 15 Mar 2017, 09:09

    I recently saw a video of a chap who'd managed to display an image and play an audio file on the Pi shutting down (I'm sure the fact that he used a reed switch is irrelevant in this case) , asked him how it was done, however a clear explanation was not forthcoming, other than a link to a Google search for "Raspberry Pi FBI", I've looked into it and I can't seem to get my head around it, it seems that FBI will display and image on the command line, so my assumption would be that it would also be visible on boot, or am I totally wrong and has anyone here ever used something similar via FBI or even Plymouth which I believe may also allow you to do something like this! shutdown gif

    H 1 Reply Last reply 15 Mar 2017, 13:24 Reply Quote 0
    • H
      herb_fargus administrators @**Scannigan**
      last edited by 15 Mar 2017, 13:24

      @__Scannigan__ sites like imgur keep links longer than 5 seconds.

      Simple as calling FBI and an audio file on shutdown . Plymouth is doable too but not sure about a sound.

      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

      * 1 Reply Last reply 15 Mar 2017, 14:31 Reply Quote 0
      • O
        obsidianspider
        last edited by 15 Mar 2017, 13:26

        On my Super Famicom Pi I have the secondary TFT displaying a "Powering Off" image when I turn off the Mausberry. It's just a script that is run before the sudo poweroff.

        📷 @obsidianspider

        1 Reply Last reply Reply Quote 0
        • *
          **Scannigan** @herb_fargus
          last edited by 15 Mar 2017, 14:31

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

          O 1 Reply Last reply 15 Mar 2017, 14:36 Reply Quote 0
          • O
            obsidianspider @**Scannigan**
            last edited by 15 Mar 2017, 14:36

            @__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
            • C
              caver01
              last edited by caver01 15 Mar 2017, 15:40

              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"

              L 1 Reply Last reply 15 Mar 2017, 16:13 Reply Quote 3
              • L
                Lyle_JP @caver01
                last edited by 15 Mar 2017, 16:13

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

                1 Reply Last reply Reply Quote 3
                • O
                  obsidianspider
                  last edited by obsidianspider 15 Mar 2017, 16:26

                  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

                  M 1 Reply Last reply 15 Mar 2017, 18:32 Reply Quote 1
                  • M
                    mediamogul Global Moderator @obsidianspider
                    last edited by 15 Mar 2017, 18:32

                    @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 17 Mar 2017, 12:36

                      @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

                      O 1 Reply Last reply 17 Mar 2017, 12:40 Reply Quote 0
                      • O
                        obsidianspider @**Scannigan**
                        last edited by 17 Mar 2017, 12:40

                        @__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 17 Mar 2017, 12:55 Reply Quote 0
                        • *
                          **Scannigan** @obsidianspider
                          last edited by 17 Mar 2017, 12:55

                          @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?

                          O 1 Reply Last reply 17 Mar 2017, 13:00 Reply Quote 0
                          • O
                            obsidianspider @**Scannigan**
                            last edited by 17 Mar 2017, 13:00

                            @__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 17 Mar 2017, 14:31 Reply Quote 1
                            • *
                              **Scannigan** @obsidianspider
                              last edited by 17 Mar 2017, 14:31

                              @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 17 Mar 2017, 17:31 Reply Quote 0
                              • CapemanC
                                Capeman @**Scannigan**
                                last edited by Capeman 17 Mar 2017, 17:31

                                @__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 17 Mar 2017, 19:17 Reply Quote 1
                                • *
                                  **Scannigan** @Capeman
                                  last edited by 17 Mar 2017, 19:17

                                  @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 8 Feb 2018, 12:26

                                    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 8 Feb 2018, 13:35 Reply Quote 0
                                    • *
                                      **Scannigan** @sinibomb
                                      last edited by 8 Feb 2018, 13:35

                                      @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 8 Feb 2018, 14:07

                                        @Scannigan Brilliant, many thanks

                                        * 1 Reply Last reply 10 Feb 2018, 06:25 Reply Quote 0
                                        • *
                                          **Scannigan** @sinibomb
                                          last edited by 10 Feb 2018, 06:25

                                          @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.

                                            This community forum collects and processes your personal information.
                                            consent.not_received