3

I am using a momentary push button to shutdown the raspberry pi using the interrupt method and the code for the same is:

#Import the modules to send commands to the system and access GPIO pins
from subprocess import call
import RPi.GPIO as gpio

# Define a function to keep script running
def loop():
     raw_input()

# Define a function to run when an interrupt is called
def shutdown(pin):
    call('halt', shell=False)

gpio.setmode(gpio.BOARD) # Set pin numbering to board numbering
gpio.setup(7, gpio.IN) # Set up pin 7 as an input
gpio.add_event_detect(7, gpio.RISING, callback=shutdown, bouncetime=200)
#Set up an interrupt to look for button presses

loop() # Run the loop function to keep script running

Then I set this script to run automatically on boot up by adding this line python /home/pi/PiSupply/softshut.py to /etc/rc.local.

The shutdown takes place but while shutting down this error appears on the screen.

map : vt01=>fb0
oops : terminated

On doing a bit of searching found that this might be because of the fbi.But since it isn't causing any problem in shutting down I just wanted this junk to be redirected to log file and not to appear on the screen.

For that I tried:

os.system('pkill fbi') 

os.system('pkill fbi >/dev/null 2>/dev/null')

exec 2> /tmp/rc.local.log 
exec 1>&2

But nothing worked.Can anyone explain what's happening and how to stop the junk from appearing on the screen or maybe removing the error alltogether.

Akshay
  • 463
  • 6
  • 15

1 Answers1

0

You can do either of the following ways:

  1. Turn your tv off before shutdown, using HDMI-CEC:

    echo "standby 0" | cec-client -s

  2. Change the console Terminal to TTY3 (for example), before shutdown:

    chvt 3

Omid1989
  • 419
  • 3
  • 8
  • 17