• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login

Mausberry Shutdown Script Doesn't Save Metadata

Scheduled Pinned Locked Moved ControlBlock, PowerBlock & Co.
mausberry
251 Posts 10 Posters 94.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    cyperghost @meleu
    last edited by cyperghost 28 Jul 2017, 17:42

    @meleu That's easy....
    The exit is needed becasue it ends the mausberry GPIO script and gives control to emulationstation.sh for proper exit

    Can you please exchange your lines

    emu_command="$(sed -n 4p /dev/shm/runcommand.info)"
    [[ -n "$emu_command" ]] && pkill -f "${emu_command%% *}" && sleep 12 # the value of 12 was suggested by @lostless

    with this one?

    emupid="$(sed -n 4p /dev/shm/runcommand.info)" #v1.5 @meleu readout 4th line command.info
    emupid="$(pgrep -f "${emupid%% *}")" #v1.5 optain PID emucall by runcommand.sh
    if [ "$emupid" ]; then #v1.5 check correct PID > avoid sleeptimer if shutdown from ES
    kill $emupid && sleep 10
    fi

    It is really the better way. Because you check value of command.info ... this value will also be active if you are back in ES so your [[ -n "$emu_command" ]] is always true and the sleep timer will used in every situation. Even if an emulator is not active. So this would be the last version called 1.6 release :)

    This is my last atempt...

    Haha ... we will see my friend :)

    M 1 Reply Last reply 28 Jul 2017, 17:50 Reply Quote 1
    • M
      meleu @cyperghost
      last edited by 28 Jul 2017, 17:50

      @cyperghost said in Mausberry Shutdown Script Doesn't Save Metadata:

      The exit is needed becasue it ends the mausberry GPIO script and gives control to emulationstation.sh for proper exit

      You're right. Good catch!

      The nerdy stuff we can discuss on our other thread ;-)

      • Useful topics
      • joystick-selection tool
      • rpie-art tool
      • achievements I made
      C 1 Reply Last reply 28 Jul 2017, 18:36 Reply Quote 1
      • C
        cyperghost @meleu
        last edited by cyperghost 28 Jul 2017, 18:36

        @meleu @hansolo77 @lostless

        This is also my last posting on this theme!

        We have three working versions now!

        meleus version 1.6 which got all features of v1.5 but gots faster GPIO response (breaks 1 second loop, use inotify tool - it's not finished now so WIP)

        cyperghosts + meleus version 1.56 which will end ES and all emulators called by runcommand.sh

        cyperghosts version 1.2 which just ends ES

        M 2 Replies Last reply 28 Jul 2017, 19:18 Reply Quote 0
        • M
          meleu @cyperghost
          last edited by 28 Jul 2017, 19:18

          @cyperghost the credit for v1.6 is not meleu's only! :)
          By the way, are you sure it really works?

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          C L 2 Replies Last reply 28 Jul 2017, 19:40 Reply Quote 0
          • C
            cyperghost @meleu
            last edited by cyperghost 28 Jul 2017, 19:40

            @meleu Yes it should work. I tested it via SSH only but I also took investigation into the python ESC-script. There is a sleep timer of 10 seconds... so 10 seconds should be a good value :)

             for pid in pids:
                    try:
                        commandpath = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
                        if commandpath[0:24] == '/opt/retropie/emulators/':
                            os.system('kill -QUIT %s' % pid)
                            print('kill -QUIT %s' % pid)
                    except IOError:
                        continue
            

            It uses kill PIDcommand to end emulators in path with path /opt/retropie/emulators/

            Your RegEx sniplets matches better :) So it works - to 100% I guarantee (tested with N64Glide and zdoom) ... there the python script would fail :)

            for v1.6 the GPIO tuning part is 100% yours. So you created it! The others part are nearly same as 1.5 so it should also work.
            Finetunig is not included like setting sleeptimers and notify - Do you agree?

            You also invested much time and you improved my commands and coding style as I explaind you the need of f%&/! exit command or introduced the second % in pkill -f "${emu_command%% *}" for example. But it is nothing against the && explaination and your RegEx magic, the magic of the testing command, the sed-command, the investigation of the runcommand.info-file ....

            So thank you :)

            1 Reply Last reply Reply Quote 0
            • L
              lostless @meleu
              last edited by 28 Jul 2017, 20:55

              @meleu 1.6 does not work. It acts as if the switch is not working. The inotify i don't think is being triggered.

              C M 2 Replies Last reply 28 Jul 2017, 21:00 Reply Quote 0
              • C
                cyperghost @lostless
                last edited by cyperghost 28 Jul 2017, 21:00

                @lostless How about 1.5? Did you check if the script is loaded? Are the permissions are right setted?

                L 1 Reply Last reply 28 Jul 2017, 21:04 Reply Quote 0
                • L
                  lostless @cyperghost
                  last edited by 28 Jul 2017, 21:04

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

                  1 Reply Last reply Reply Quote 0
                  • M
                    meleu @lostless
                    last edited by 28 Jul 2017, 21:14

                    @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 achievement make 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.)

                    • Useful topics
                    • joystick-selection tool
                    • rpie-art tool
                    • achievements I made
                    1 Reply Last reply Reply Quote 0
                    • C
                      cyperghost
                      last edited by cyperghost 28 Jul 2017, 21:15

                      @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

                      1. 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)
                      2. Investigate to 1.6... I see no errors in the script, it may be a file permission error or inotify works wrong
                      3. 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

                      1. Version 1.5 that just works without installing anything
                      2. Version 1.6 with improved GPIO handling, but needs a new package
                      L 1 Reply Last reply 28 Jul 2017, 21:35 Reply Quote 0
                      • L
                        lostless @cyperghost
                        last edited by lostless 28 Jul 2017, 21:35

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

                        C 1 Reply Last reply 28 Jul 2017, 21:37 Reply Quote 2
                        • C
                          cyperghost @lostless
                          last edited by cyperghost 28 Jul 2017, 21:37

                          @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

                          L 2 Replies Last reply 28 Jul 2017, 21:39 Reply Quote 0
                          • L
                            lostless @cyperghost
                            last edited by 28 Jul 2017, 21:39

                            @cyperghost I can experiment, 9 seems good enough. i can try lower, but as long as it shuts down, it doesn't matter much.

                            C 1 Reply Last reply 28 Jul 2017, 21:40 Reply Quote 0
                            • C
                              cyperghost @lostless
                              last edited by cyperghost 28 Jul 2017, 21:40

                              @lostless The 9 seconds are only triggered if an emulator is running! And it's important for saving metadata after the emu is closed.

                              L 1 Reply Last reply 28 Jul 2017, 21:43 Reply Quote 0
                              • L
                                lostless @cyperghost
                                last edited by 28 Jul 2017, 21:42

                                @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

                                1 Reply Last reply Reply Quote 0
                                • L
                                  lostless @cyperghost
                                  last edited by lostless 28 Jul 2017, 21:43

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

                                  1 Reply Last reply Reply Quote 0
                                  • C
                                    cyperghost
                                    last edited by cyperghost 28 Jul 2017, 21:45

                                    @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 :)

                                    L 1 Reply Last reply 28 Jul 2017, 21:51 Reply Quote 0
                                    • L
                                      lostless @cyperghost
                                      last edited by lostless 28 Jul 2017, 21:51

                                      @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.................. :/

                                      1 Reply Last reply Reply Quote 2
                                      • C
                                        cyperghost
                                        last edited by cyperghost 28 Jul 2017, 21:52

                                        @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

                                        1 Reply Last reply Reply Quote 0
                                        • H
                                          hansolo77
                                          last edited by 29 Jul 2017, 00:49

                                          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.

                                          Who's Scruffy Looking?

                                          1 Reply Last reply Reply Quote 1
                                          141 out of 251
                                          • First post
                                            141/251
                                            Last post

                                          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.

                                            This community forum collects and processes your personal information.
                                            consent.not_received