Mausberry Shutdown Script Doesn't Save Metadata
-
@meleu 1.6 does not work. It acts as if the switch is not working. The inotify i don't think is being triggered.
-
@lostless How about 1.5? Did you check if the script is loaded? Are the permissions are right setted?
-
@cyperghost 1.5 works. which script are we talking about? the one we've been working on? I'm assuming so because it works when not trying to use inotify.
-
@lostless said in Mausberry Shutdown Script Doesn't Save Metadata:
@meleu 1.6 does not work.
WTF?!!!!
It's now a matter of honor!
Let me just put the kids to sleep (4-6 hours) and I'll
get this achievementmake it work!(By the way, my first try will be to use the full path to
inotifywait
. If you know how to do it, please try it in advance.) -
@lostless Okay good news!
I'm a bit unaware of the inotify thing but I see no error in the script.
So I think you've three choices- Use 1.5 it will work with PowerOff in ES and emulator screen and will properly save metadata (easiest approch, because it's ready setted)
- Investigate to 1.6... I see no errors in the script, it may be a file permission error or inotify works wrong
- Create new script and touch control ...
3.1 I was able to get in touch with gpio-watch and it worked really fine with some scripts I made and it debounces switches relativly good. All in all it's also a lightweight
3.2 Use wiringPi (overloaded) and use it's posibilty for IRQ
3.3 There are tons of other GPIO libaries ...
It's now a matter of honor!
Surly!
@meleu I already said, you're not finished with that :)
But I'm glad that you made detection via file change ... So I hope you'll get it to run.I just checked v1.6 there seems to be no typing mistake or mistake in GPIO numbering!
For maintainig ... If you are finished with 1.6
Can you please transform 1.5 in same way (coding style and layout) as 1.6? But withouth the inotify-thing?
So we have 2 versions- Version 1.5 that just works without installing anything
- Version 1.6 with improved GPIO handling, but needs a new package
-
@cyperghost @meleu Thanks to you both. The 1.5 is fine for me. I know @meleu, you are definitely obsessed with making the switch work without the mauseberry loop. But i've been using my pi for almost a year with that loop and it working just fine. At least we've reached a point were the mauseberry runs perfect for a retropie setup. I won't lose meta data anymore.
-
@lostless Is the sleeptimer of 9 seconds not to long?
I took the value out of the python script (they used 10 seconds) but I assume it was written for an Pi 1. So I think 5-6 seconds should also work.No .. it's not obsession it's passion!
But I'm also interested in the inotify thing -
@cyperghost I can experiment, 9 seems good enough. i can try lower, but as long as it shuts down, it doesn't matter much.
-
@lostless The 9 seconds are only triggered if an emulator is running! And it's important for saving metadata after the emu is closed.
-
@cyperghost said in Mausberry Shutdown Script Doesn't Save Metadata:
No .. it's not obsession it's passion!
Is there a difference. Its all a matter of perspective LOL
-
@cyperghost said in Mausberry Shutdown Script Doesn't Save Metadata:
@lostless The 9 seconds are only triggered if an emulator is running! And it's important for saving metadata after the emu is closed.
Ya, its fine as i usually don't shut down from a game, so in that respect, having to wait will hardly be noticed.
-
@lostless If you are obsessed by a woman or passionated by a women makes a big difference.
If you don't know then ask a judge and a producer of love toys what the difference is :) -
@cyperghost getting all philosophical on me? Lets not derail to far, but i think i clearly under stand the difference between obsession and passion. Obsession is passion gone too far, when there is no need to keep going. When all is lost, yet you continue. When the path has reached its end and you gone over the cliff. I think I'm done.................. :/
-
@lostless You're right. You may help us in outfinding the best sleeptimer :) That's your passion :) you can also use floating number like 2.5 to pause
-
You guys are awesome. I haven't tried 1.5b (adding proper exit out of the loop) on my own system yet, but it sounds like you got it working. I hate not being home today to participate more. :) Thanks everybody! When I get a chance, I will put it into place and report back my own findings.
-
bug report
Our method to kill the command placed on the 4th line of
/dev/shm/runcommand.info
fails to kill ScummVM emulator. This is why:[prompt]$ sed -n 4p /dev/shm/runcommand.info bash /home/meleu/RetroPie/roms/scummvm/+Start\ ScummVM.sh "ft"
Then our approach kills
bash
processes.I'm currently trying to find a strong solution. Will post it soon...
-
@hansolo77 @lostless @cyperghost
Can you guys test this one? Let's call it v1.7:
#!/bin/bash -x # Before using this script you need to install inotify-tools: # # sudo apt-get install inotify-tools # # I'm just trying to help with the script logic here. # I DON'T HAVE A MAUSBERRY AND DIDN'T TEST THE GPIO STUFF HERE! # ######################################################### # U S E I T A T Y O U R O W N R I S K ! ! ! # ######################################################### # # meleu - July/2017 # kudos for @cyperghost , who is very persistent in help you guys! :-) #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 file="/sys/class/gpio/gpio$GPIOpin1/value" # up to here this code is executed at booting (/etc/rc.local) # let's wait for the creation of the "/sys/class/gpio/gpio$GPIOpin1/value" sleep 30 # not sure if 30 seconds is a good value... while inotifywait -qq -e modify "$file" ; do power="$(cat "$file")" [[ "$power" == 0 ]] && continue # explaining the crazy command below: # 1. get 4th line of runcommand.info (aka "emulator command") # 2. delete backslash '\' character # 3. replace every character that has a special meaning in a regex context with a dot '.' emu_command="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.')" [[ -n "$emu_command" ]] && pkill -f "$emu_command" && sleep 10 espid=$(pgrep -f "/opt/retropie/supplementary/.*/emulationstation([^.]|$)") if [[ "$espid" ]]; then touch /tmp/es-shutdown && chown pi:pi /tmp/es-shutdown kill "$espid" exit fi sudo poweroff done
I did a trick for debugging, then if this script doesn't work, please perform this command:
grep 'rc\.local' /var/log/syslog > debug.log
It creates a file named
debug.log
paste its conten in ghostbin.com or something similar. -
@meleu still did not work. I did the grep thing and can't find the syslog directory to find debug.log. also i don't have the /sys/class/gpio/gpio$GPIOpin1 directory. not sure if thats useful, but trying to help.
-
@lostless please, paste here the output of these commands:
ls -l /var/log/syslog
and
ls -lah /sys/class/gpio/*
-
first
-rw-r----- 1 root adm 2281836 Jul 29 03:38 /var/log/syslog
second
-rwxrwx--- 1 root gpio 4.0K Jul 29 02:50 /sys/class/gpio/export lrwxrwxrwx 1 root gpio 0 Jul 29 02:50 /sys/class/gpio/gpio23 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio23 lrwxrwxrwx 1 root gpio 0 Jul 29 02:50 /sys/class/gpio/gpio24 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio24 lrwxrwxrwx 1 root gpio 0 Jul 29 02:50 /sys/class/gpio/gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0 lrwxrwxrwx 1 root gpio 0 Jul 29 02:50 /sys/class/gpio/gpiochip100 -> ../../devices/gpiochip2/gpio/gpiochip100 lrwxrwxrwx 1 root gpio 0 Jul 29 02:50 /sys/class/gpio/gpiochip128 -> ../../devices/gpiochip1/gpio/gpiochip128 -rwxrwx--- 1 root gpio 4.0K Jul 29 02:50 /sys/class/gpio/unexport
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.