The RemotePi boards offers a shutdown button and infrared for connecting a remote. The shutdown button is also operated by the remote so you can turn the Pi on either with the button or using the remote.
To install on PcP requires some custom scripts top be installed. And please note that to install on top of a DAC you might need to change the pin for the remote. (this can be done 'on the board or or in the wiring' (https://www.msldigital.com/pages/support-for-remotepi-board-plus-2015) when you connect the board - I did the latter using jumper wires). As a starting point for this guide I assume you have PCP running and know how to access it through SSH. I also recommend installing Nano as an editor (you can remove it again once everything works). STEP 1: INSTALLING NANO: - Go to piCorePLayer main page and click on "extensions" - If all checks are green, click on the "available" tab, - From available extensions, select "nano.tcz" and click "load" -Step 1b: Add the following code to disable line wrap and autoindent, which is easier when copy/pasting code -- Log in with SSH and type Code: -------------------- nano .nanorc -------------------- Code: -------------------- unset autoindent set nowrap -------------------- - Exit nano (ctrl-x) and save the file. *Step 2: Add the IR power button to the RemotePi board *- Press the on/off button on the RemotePi board for 10 seconds until you see the green light flashing. - Press the power key on the remote once to learn power on, and a second time to learn power off. (this step is also described as 'step 3 in the guide here' (https://www.msldigital.com/pages/support-for-remotepi-board-plus-2015)) *Step 3: create the Shutdown monitoring and shutdown script: *- Log in with SSH and type Code: -------------------- nano /opt/shutdown.sh -------------------- Code: -------------------- #!/bin/sh #aplay /home/tc/sounds/goodbye.mp3 [optional: you can have a shutdown sound here] #send shutdown sequence to PiRemote powerboard echo "15" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio15/direction echo "1" > /sys/class/gpio/gpio15/value sleep 0.125 echo "0" > /sys/class/gpio/gpio15/value sleep 0.2 echo "1" > /sys/class/gpio/gpio15/value sleep 0.4 echo "0" > /sys/class/gpio/gpio15/value echo "14" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio14/direction echo "1" > /sys/class/gpio/gpio14/value sleep 6 -------------------- - Exit nano (ctrl-x) and save the file. - Make the file executable: chmod +x /opt/shutdown.sh *Step 4: create the monitoring script: *- Log in with SSH and type Code: -------------------- nano startup.sh -------------------- Code: -------------------- #!/bin/sh #things to do at startup pcp power off #start Irexec - optional: only if you use the ir remote with a custom lircrc file #/usr/local/bin/irexec /home/tc/.lircrc & (optional) #all set play a sound # aplay /home/tc/sounds/startup.mp3 (optional) sleep 2 #turn on player at LMS pcp power on # this is the GPIO pin receiving the shut-down signal echo "14" > /sys/class/gpio/export echo "in" > /sys/class/gpio/gpio14/direction # going into a loop until shutdown while true; do sleep 1 power=$(cat /sys/class/gpio/gpio14/value) if [ $power != 0 ]; then pcp power off sleep 2 echo "out" > /sys/class/gpio/gpio14/direction echo "1" > /sys/class/gpio/gpio14/value sleep 3 exitcheck.sh shutdown fi done -------------------- Exit nano (ctrl-x) and save the file. - Make the file executable: chmod +x startup.sh At this point you're done installing scripts. Since you're not doing this in the pCP web interface you will need to backup your changes manually. - Log in with SSH and type Code: -------------------- PCP BU -------------------- STEP 5: INSTALL LIRC AND UPLOAD A .LIRCD FILE [/B]- GO TO THE PCP WEB INTERFACE AND CLICK ON THE TWEAKS TAB. - GO TO THE IR PAGE AND INSTALL LIRC. - UNDER DEVICE SETTINGS, CHOOSE GPIO: 18, AND IRDEVICE LIRC0 (NOTE: IF YOU CHANGED IT IN THE WIRING, THIS IS GPIO 17) YOU PROBABLY ALSO NEED TO UPLOAD A LIRC.CONF FILE. IT DEPENDS ON YOUR REMOTE WHAT YOU NEED TO UPLOAD HERE. IF YOU BOUGHT A REMOTE TOGETHER WITH YOUR REMOTEPI BOARD, THE CONTENTS OF THE LIRC.CONF FILE CAN BE FOUND HERE (\"HTTPS://WWW.MSLDIGITAL.COM/PAGES/SUPPORT-FOR-REMOTEPI-BOARD-PLUS-2015\"). (PLEASE NOTE THOUGH THAT IN EVERY CONFIGURATION FILE YOU SHOULD REMOVE THE LINE THAT DEFINES THE POWER KEY, SINCE THIS IS PROCESSED AT THE REMOTEPI BOARD, SO PCP DOESN'T HAVE TO DO ANYTHING WITH THIS.) IN PRINCIPLE PCP HAS ENABLED A DEFAULT REMOTE KEY MAPPING FOR MOST FUNCTIONS ON SQUEEZELITE (PAUSE/PLAY/VOLUME,ETC..) SO THAT SHOULD WORK OUT OF THE BOX, BUT IF YOU WANT TO USE ADDITIONAL KEYS YOU ALSO NEED TO UPLOAD A '.LIRCRC' FILE. (I DID THIS TO USE THE NUMBER KEYS FOR PRESETS.) [B]STEP 6: RUN THE STARTUP SCRIPT THAT MONITORS THE REMOTEPI BUTTON: - Go to the pCP web interface and click on the tweaks tab. - Scroll down and under User Commands enter: Code: -------------------- /home/tc/startup.sh -------------------- This will make the startup script, which monitors the power button, run by default when you start pCP. You can later check the logfiles under diagnostics to see if it does. STEP 7: SHUTDOWN AND RESTART You're now all set. - Go to the main page and choose "backup" and "shutdown" to turn off your Pi . - Unplug the power and plug it back in When you plug back in the RemotePi switch lights up red. You can now use the remote to turn on the Pi. During startup the green LED will flash for 75 seconds. During this time your Pi is starting up, with pCP it usually takes about 30 seconds, but the green light will continue flashing regardless. (you can change the time it flashes green following the instructions on the 'RemotePi website' (http://www.msldigital.com/pages/configuration-tool). When you shutdown the Pi using the remote or the button on the RemotePi, the red light will flash until the Pi has fully shutdown and then switch off the power. If it doesn't shutdown properly the RemotePi will continue flashing red for 4 minutes before doing a hard shutdown. If all works well though the red LED will flash for about 30 seconds until your Pi is shut down.The RemotePi board then cuts the power and the red light in the power button turns on. STEP 8 [BONUS]: REDUCE THE POWER ON TIME AND THE LED BRIGHTNESS - You can use the 'instructions' (http://www.msldigital.com/pages/configuration-tool) on the RemotePi website to reduce the green blinking time at startup (I set mine to 45 seconds, which is more then enough) and reduce the brightness of the power button and the LED. ------------------------------------------------------------------------ jeroen2's Profile: http://forums.slimdevices.com/member.php?userid=70418 View this thread: http://forums.slimdevices.com/showthread.php?t=113693 _______________________________________________ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix