METADATA not saving - Favorites will never remain tagged
-
@yahmez Well a regulator would convert the 5.0V to 3.3V (just a few cents) are use the internal 3.3V rail... or strip down the script ... Already done here
Thank you for your patience and helpfull explaination. So it would be nice that you would implent this in your scripts.
It has to be excuted withsudo
command -
@cyperghost no problem. Unfortunately, I do not have the knowledge to properly incorporate your script into mine. At best, it would be trial and error on my part. Perhaps @Semper-5 can tinker with it though.
-
@yahmez Well.... I can also try to deal with
raspi-gpio
Let us work together on this if you want.
sudo apt install raspi-gpio
will install a 66kB binaryhelp page ;)
raspi-gpio get [GPIO] OR raspi-gpio set <GPIO> [options] OR raspi-gpio funcs [GPIO] OR raspi-gpio raw Valid [options] for raspi-gpio set are: ip set GPIO as input op set GPIO as output a0-a5 set GPIO to alternate function alt0-alt5 pu set GPIO in-pad pull up pd set GPIO pin-pad pull down pn set GPIO pull none (no pull) dh set GPIO to drive to high (1) level (only valid if set to be an outpu$ dl set GPIO to drive low (0) level (only valid if set to be an output) Examples: raspi-gpio get Prints state of all GPIOs one per line raspi-gpio get 20 Prints state of GPIO20 raspi-gpio set 20 a5 Set GPIO20 to ALT5 function (GPCLK0) raspi-gpio set 20 pu Enable GPIO20 ~50k in-pad pull up raspi-gpio set 20 pd Enable GPIO20 ~50k in-pad pull down raspi-gpio set 20 op Set GPIO20 to be an output raspi-gpio set 20 dl Set GPIO20 to output low/zero (must already be se$ raspi-gpio set 20 ip pd Set GPIO20 to input with pull down
@Semper-5 Ready for some tests?
-
@cyperghost oh I'm excited to do some testing :)
Forgive me in advance if my replies are a bit far and few between this weekend. I packed up my system to take home but I'll be doing a lot of errands and driving. I'll check in as frequent as I can. Thank you once again team for your efforts!
Let's kick this can of worms!
-
Please install raspi-gpio, this tool gives BASH control over internal pullup resistors ;)
install withsudo apt install raspi-gpio
That are just 66kB ;)Then copy script as done times before, make it executable and execute it in SSH ;)
I'm not sure if it needs sudo privileges.- If it is not working, then you may alter
until [[ $power == 0 ]]
from 0 to 1 - If this is sill not working then alter
raspi-gpio set $GPIO_powerswitch ip pu
from pu to pd
So all in all you have 4 possibilites ;)
then the new switch.sh
#!/bin/bash # End Emulationstation if condition of running binary is true (v1.7) # v1.00 07/21/17 by cyperghost - Inital run # v1.50 07/27/17 - Great step to exit ES even if emulators is running by runcommand.sh are started // meleu # v1.56 07/30/17 - All emulators will be detected. // meleu # v1.58 08/02/17 - generel method: Use PPID to detect child PIDs now (ScummVM fix) // cyperghost # v1.59 11/14/17 - Inserted newest emucall detection // meleu # v1.60 04/20/18 - added kill -9 to terminate emulators // julenvitoria # v1.70 version for NESPi case // Yahmez, Semper-5 # Please install raspi-gpio via sudo apt install raspi-gpio before! #this is the GPIO pin connected to POWER SWITCH GPIO_powerswitch=24 #this is the GPIO pin connected to POWER ON CONTROL GPIO_powerctrl=25 # Init ... raspi-gpio set $GPIO_powerswitch ip pu raspi-gpio set $GPIO_powerctrl op dh until [[ $power == 0 ]]; do power=$(raspi-gpio get $GPIO_powerswitch | grep -c "level=1 fsel=0 func=INPUT") sleep 1 done # Detect PID or EMULATOR NAMES emucall="$(sed '4!d; s/\([\\"]\|[[:alnum:]_]\+=[^ ]* \)//g; s/[][(){}^$*.|+? ]/\\&/g' /dev/shm/runcommand.info)" espid="$(pgrep -f "/opt/retropie/supplementary/.*/emulationstation([^.]|$)")" echo "Button Pressed pullup going from 1 to 0: $power" echo "ES-PID: $espid" sleep 5 # Handle calls and send TERM signal if [[ -n "$emucall" ]]; then emupid="$(pgrep -f "$emucall" | tr '\n' ' ')" pkill -P "$(echo $emupid | tr ' ' ',')" kill -9 "$emupid" sleep 4 fi if [[ -n "$espid" ]]; then touch /tmp/es-shutdown && chown pi:pi /tmp/es-shutdown kill "$espid" exit fi echo "Script terminated not by ES!"
Thanks for your patience!
@Yahmez I tested the script on my old Pi1B+. Just connected a momentary push button to GPIO24 and to ground. Works flawless if I press the button. On default (no button action) the GPIO24 status is 1, if the button is pressed the pullup is dropped to 0 and the loop is breaked! Got an excellent knowledge base from you - Thx.
@Semper-5
If you need guidance then don't hestiate to ask. But I think the script should work out of the box after installing theraspi-gpio
binary - If it is not working, then you may alter
-
EUREKA! IT WORKS!
Just some minor bumps in the road...some emulators/ports I can add games/entries and they'll save to favorites but can't be removed (they can be removed but on a power down, power up, they remain added). I'm going to be doing some updating from sources to see if this will fix it, but this is a huge leap in the right way team :D
Also to add, this has been tested on the 4.4 Retropie image
-
@semper-5 Thx ;)
Now I have ready setted script for you!
This got working power button
If you press reset and a emulator is running it will fire you back to ES
If you are in ES and press reset again ES will reload!It's uses the same script base as here but is much much extended!
Use the same procedure to install script as always....
But now it supports parameters:
in your case:scriptname.sh --nespicase &
Get this thread here
-
@cyperghost I had a chance to update the script to its entirety from your thread and using your parameters, but unfortunately I'm set back a bit.
I ran the script with its parameter in SSH and it was complaining about not finding commands, but with executing it, it immediately starts a shutdown command and does not keep any favorites tagged. It's a good thing I didn't put it into the autostart.sh or else it'd probably start up and shutdown as soon as ES was loaded.
-
Well I don't know why this is don't running.
Did you have raspi-gpio installed?Please do so with
sudo apt install raspi-gpio
Then
cd /home/pi/RetroPie/scripts
Then
wget https://raw.githubusercontent.com/crcerror/ES-generic-shutdown/master/multi_switch.sh && chmod +x multi_switch.sh
Then run the scripts via SSH
./multi_switch.sh --nespicase &
You don't need sudo, you don't need the bash interpreter to call, all automatic done ;)
-
@cyperghost I think there is an unmatched single quote
'
in the script text above, or maybe a"
that should be a'
in theemucall
. See how the comment# Handle calls and send TERM signal
is the wrong color? Something is not right in one of the commands above that. -
@caver01 No the script is working ;)
But raspi-gpio is not installed ;) As command is not found
The ticks are taken from the original script. -
@cyperghost Ok, fair enough, but you see how the colors are messed up before that comment, right?
-
Oh... No I get you ;)
We are talking about this one here
The other script was just for testing purposes if I understand the logic of the NESPICase mod done by @Yahmez
By the way..... BASH is also capable of handling the pullup resistors.
That's very nice, becasue now you just connect the switch with an GPIO to GROUND!raspi-gpio set YOURGPIONr ip pu
sets up internal pull up resistor
Now the PULLUP is setted 1 if it's not connected to ground
Press the button and connect to ground and the pull is set to 0the logic
until [[ $power == 0 ]]; do power=$(raspi-gpio get $GPIO_powerswitch | grep -c "level=1 fsel=0 func=INPUT") done
-
@cyperghost Oh. Ok. Wow. That thing is getting pretty huge. I need to dig into this a bit. I like where things are going.
-
@caver01 Yes I posted a comment above
but I like also to use the command line parameters
--es-pid
shows PID of ES binary, if ES isn't running then it's 0
--rc-pid
shows PID of runcoomand, if no runcommand (=emulator) is running then it's 0kind of swiss knife
-
@cyperghost ok we're back to having power button functionality but no metadata saving. I was able to quickly catch it complaining about the gameslist.xml:
-
@semper-5 Set "Save Gamelist on exit" in ES
It's found in MainMenu > Other Settings > Save Metadata on exit (ON)That's a bit curious, because the scripts save metadata for me. In every usecase now (okay didn't scraped tons of emualtors but I see last played games and last accessed game)
Furthermore, does the reset button works?
If you are in ES main screen and press reset ... it will reload ES (NOT REBOOT!)
if you have an emulator running it will bring you back to ES main screenEDIT:
I release the next version in a short time
I added ... check user priviliges (if you need root and aren't using sudo, It will stop the script)
I added ... check raspi-gpio package (If not installed, then print error message, and stop the script) -
@cyperghost yup I checked the Save Metadata on Exit. And the buttons all work great and exactly as you described.
I'm just stumped why I'm getting these lines of errors AGAIN :(
I seriously starting to think I'm cursed or something. -
@semper-5 I upgraded script with packages check and user priviliges.
If you want to upgrade remove old script withrm multi_switch.sh
before usingwget
!
But this won't help you in your issue now.
Is the metadata is saved on regular exit via main menu?I'm starting to integrate the NESPi+ for this script!
EDIT:
Even with scraping games, setted to favourites and run the game
Then called script via./multi-switch.sh --es-poweroff
My scraped data was not removed, game was found in favorites and it was marked as last accesed ;)So everything is fine!
-
@cyperghost ok I had to wipe everything and start from a fresh image again. that fixed those weird errors with the XMLs.
Power button: works
Reset button: works
Tag favorite games: works
Remove tags: doesn't workso the only little snag is that you can add favorites but you can never remove them. for some reason ES doesn't unmark/delete the favorites attribute in the gamelist.XML
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.