Mausberry ON/OFF board and Recalbox
Hello everyone, I´m currently working on my retro-console using an old NES-Case and obviously Recalbox on a RPi 2. Since I want to use the original switches from the NES I ordered the on/off board from mausberry. (http://mausberry-circuits.myshopify.com/collections/frontpage/products/shutdown-circuit-use-your-own-switch) The soldering part went fine, the NES power switch now starts the Pi. But I can´t get the script working that´s supposed to handle the shutdown. (http://mausberry-circuits.myshopify.com/pages/setup) Since recalboxOS doesn´t have rc.local the automated script from mausberry fails to install. I tried putting the script to init.d folder but this does not work either. Can someone help me out with this? I´m not very experienced with Linux and do most stuff by following tutorials...
I would need one of that to test.
Thanks for your reply. I don´t know if it helps, but this is the script:
echo '#!/bin/bash #this is the GPIO pin connected to the lead on switch labeled OUT GPIOpin1=23 #this is the GPIO pin connected to the lead on switch labeled IN GPIOpin2=24 echo "$GPIOpin1" > /sys/class/gpio/export echo "in" > /sys/class/gpio/gpio$GPIOpin1/direction echo "$GPIOpin2" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio$GPIOpin2/direction echo "1" > /sys/class/gpio/gpio$GPIOpin2/value while [ 1 = 1 ]; do power=$(cat /sys/class/gpio/gpio$GPIOpin1/value) if [ $power = 0 ]; then sleep 1 else sudo poweroff fi done' > /etc/switch.sh sudo chmod 777 /etc/switch.sh sudo sed -i '$ i /etc/switch.sh &' /etc/rc.local
If I execute it like that, I get an error that the sudo command could not be found, so I removed it. When I execute it without sudo I get an error, that rc.local could not be found. So isn´t there an alternative way where to put the script instead of rc.local? This is not about the script itself working with the on/off switch board, this is just about running the script properly on boot. So there should be a generic solution for it or am I wrong.
Thanks for your help! After some fiddling around I finally got it working. I encountered the following problems: - Can´t use wget with your box.com links because it saves the files with the long random letter sequence as filename (tried putty and linux terminal) so I had to download manually and copy to the recalbox - The setup script which is supposed to copy to /recalbox/scripts did not work for me, as I got "/recalbox/scripts/mausberry.sh not found" after executing. The other setup script from your long post worked fine - I had to re-save the S99maus file using "sed -i 's/\r//'" as I was getting a "bad interpreter" error - The switch is working now, but nevertheless I get the following error when S99maus is executed: ps: bad -o argument 'command', supported arguments: user,group,comm,args,pid,ppid,pgid,tty,vsz,stat,rss I don´t know if this is relevant. Just some feedback, I´m glad everything is working for me now. Thanks for the help!