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

  • Staff
    Global moderator

    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/ sudo chmod 777 /etc/ sudo sed -i '$ i /etc/ &' /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.

  • Staff
    Global moderator

  • Thanks for your help! After some fiddling around I finally got it working. I encountered the following problems: - Can´t use wget with your 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/ 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!

Want to support us ?