我正在使用一个瞬间按钮来使用中断方法关闭覆盆子pi,同样的代码是:
#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
然后我将此脚本设置为在启动时自动运行,方法是将此行python /home/pi/PiSupply/softshut.py添加到/etc/rc.local .
关闭发生但在关闭时,屏幕上会出现此错误 .
map : vt01=>fb0
oops : terminated
在进行一些搜索时发现这可能是因为fbi.But因为它没有导致关闭任何问题我只是想将这个垃圾重定向到日志文件而不是出现在屏幕上 .
为此,我试过:
os.system('pkill fbi')
os.system('pkill fbi >/dev/null 2>/dev/null')
exec 2> /tmp/rc.local.log
exec 1>&2
但没有任何效果 . 任何人都可以解释发生了什么以及如何阻止垃圾出现在屏幕上或者可能完全消除错误 .
1 回答
您可以执行以下任一方式:
echo "standby 0" | cec-client -s
chvt 3