FBI Image Viewer display image on Pi shutdown
-
@__Scannigan__ I believe you could just make a bash script and then put it in
/etc/rc.local.shutdown
-
Like this, right?
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.
-
@caver01 William S. Sessions will always be the most famous FBI director to retro-gamers. :)
-
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 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
-
@__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 opennano
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 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?
-
@__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 Cheers bud I'll see if I can make any progress, worst thing that can happen is the script just won#t work
-
@__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 fileNow (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.jpgAnyone smarter than me want to chime in to let me know if this seems correct? I'll test it tonight and write back.
-
@Capeman won't be able to try it into Monday, you'll never to let me know how it goes
-
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.
-
@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
-
@Scannigan Brilliant, many thanks
-
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
#!/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)#!/bin/sh sudo /usr/bin/fbi -T 2 -once -t 30 -noverbose -a "/home/pi/scripts/image.png" &
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.