Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    [DSF Extension] Exec On MCode (was: Shutdown SBC)

    Scheduled Pinned Locked Moved
    DSF Development
    22
    117
    10.4k
    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.
    • CrazyCreatorundefined
      CrazyCreator @wilriker
      last edited by

      @wilriker said in [DSF Extension] Exec On MCode (was: Shutdown SBC):

      Can you check if the command poweroff does work on your system in the first place?

      How can i do this?

      @wilriker said in [DSF Extension] Exec On MCode (was: Shutdown SBC):

      Also please check execonmcode version (parameter -version). It looks to me as if you are using an older version.

      pi@CCC:~ $ sudo /usr/local/bin/execonmcode -version
      2021/05/20 16:20:43 0x24142bc
      pi@CCC:~ $ 
      

      http://www.crazycreatorcube.com

      wilrikerundefined 1 Reply Last reply Reply Quote 0
      • wilrikerundefined
        wilriker @CrazyCreator
        last edited by

        @crazycreator said in [DSF Extension] Exec On MCode (was: Shutdown SBC):

        How can i do this?

        Run sudo poweroff and check what that does.

        pi@CCC:~ $ sudo /usr/local/bin/execonmcode -version
        2021/05/20 16:20:43 0x24142bc
        pi@CCC:~ $ 
        

        That looks like a bug in previous version and it may be that DCS is rejecting this client. Please get the version 5.2.0 of execonmcode from GitHub and try again.

        Manuel
        Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
        with probably always latest firmware/DWC (incl. betas or self-compiled)
        My Tool Collection

        CrazyCreatorundefined 1 Reply Last reply Reply Quote 0
        • CrazyCreatorundefined
          CrazyCreator @wilriker
          last edited by

          @wilriker I used 5.1 so that I could imitate the tutorial 100%. now I'm back on 5.2

          sudo poweroff

          pi@CCC:~ $ sudo poweroff
          Connection to ccc.local closed by remote host.
          Connection to ccc.local closed.
          

          Versionscheck

          pi@CCC:~ $ sudo /usr/local/bin/execonmcode --version
          5.2.0
          

          Debug and Trace

          pi@CCC:~ $ sudo /usr/local/bin/execonmcode -mCode 7722 -command -poweroff -debug -trace
          2021/05/20 16:35:27 7722: -poweroff 
          2021/05/20 16:35:27 [DEBUG] <Recv> {"version":11,"id":21}
          2021/05/20 16:35:27 [DEBUG] <Send> {"Mode":"Intercept","Version":10,"InterceptionMode":"Pre","Channels":["HTTP","Telnet","File","USB","Aux","Trigger","Queue","LCD","SBC","Daemon","Aux2","AutoPause","Unknown"],"Filters":["M7722"],"PriorityCodes":false}
          2021/05/20 16:35:27 [DEBUG] <Recv> {"success":true}
          2021/05/20 16:35:27 [DEBUG] <Connect> Connection established
          

          put the M7722 command in DWC Console ... show me this in terminal

          2021/05/20 16:35:58 Connection to DCS closed
          2021/05/20 16:35:58 [DEBUG] <Close> Closing connection
          2021/05/20 16:35:58 EOF
          

          http://www.crazycreatorcube.com

          wilrikerundefined 1 Reply Last reply Reply Quote 0
          • wilrikerundefined
            wilriker @CrazyCreator
            last edited by

            @crazycreator said in [DSF Extension] Exec On MCode (was: Shutdown SBC):

            pi@CCC:~ $ sudo /usr/local/bin/execonmcode -mCode 7722 -command -poweroff -debug -trace
            

            At least this time you used -poweroff which most likely is not a valid command. 😉

            Manuel
            Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
            with probably always latest firmware/DWC (incl. betas or self-compiled)
            My Tool Collection

            CrazyCreatorundefined 1 Reply Last reply Reply Quote 0
            • CrazyCreatorundefined
              CrazyCreator @wilriker
              last edited by CrazyCreator

              @wilriker
              but in shutdownsbc.service is used and in the video tutorial too.

              What should I write / use that instead?

              What else can I try to get the script to work?

              http://www.crazycreatorcube.com

              wilrikerundefined 1 Reply Last reply Reply Quote 0
              • wilrikerundefined
                wilriker @CrazyCreator
                last edited by

                @crazycreator Just remove the dash from the start of poweroff then it should work.

                Manuel
                Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                with probably always latest firmware/DWC (incl. betas or self-compiled)
                My Tool Collection

                CrazyCreatorundefined 2 Replies Last reply Reply Quote 0
                • CrazyCreatorundefined
                  CrazyCreator @wilriker
                  last edited by

                  @wilriker
                  you mean so:

                  pi@CCC:~ $ sudo /usr/local/bin/execonmcode -mCode 7722 -command poweroff -debug -trace
                  2021/05/20 18:47:03 7722: poweroff 
                  2021/05/20 18:47:03 [DEBUG] <Recv> {"version":11,"id":80}
                  2021/05/20 18:47:03 [DEBUG] <Send> {"Mode":"Intercept","Version":10,"InterceptionMode":"Pre","Channels":["HTTP","Telnet","File","USB","Aux","Trigger","Queue","LCD","SBC","Daemon","Aux2","AutoPause","Unknown"],"Filters":["M7722"],"PriorityCodes":false}
                  2021/05/20 18:47:03 [DEBUG] <Recv> {"success":true}
                  2021/05/20 18:47:03 [DEBUG] <Connect> Connection established
                  
                  

                  http://www.crazycreatorcube.com

                  1 Reply Last reply Reply Quote 0
                  • CrazyCreatorundefined
                    CrazyCreator @wilriker
                    last edited by

                    @wilriker
                    When I send M7722 in the DWC Console I get the familiar popup with the message:
                    M7722
                    Warning: M7722: Command is not supported

                    But the Raspberry does not switch off or restarts!

                    When I send the M7722 command in the DWC console, I see the following lines in the terminal:

                    2021/05/20 18:47:47 Connection to DCS closed
                    2021/05/20 18:47:47 [DEBUG] <Close> Closing connection
                    2021/05/20 18:47:47 EOF
                    

                    http://www.crazycreatorcube.com

                    oozeBotundefined 1 Reply Last reply Reply Quote 0
                    • oozeBotundefined
                      oozeBot @CrazyCreator
                      last edited by

                      @crazycreator One note that I've found is that when rebooting or powering off the SBC from a custom mCode, DCW will report "Command not supported" as the API immediately shuts down. See this thread:

                      • https://forum.duet3d.com/topic/20968/3-2-final-execonmcode-warning-issue
                      CrazyCreatorundefined 1 Reply Last reply Reply Quote 0
                      • CrazyCreatorundefined
                        CrazyCreator @oozeBot
                        last edited by

                        @oozebot
                        thanks for the hint. I've already read that while looking for a solution to my problem.

                        if execonmcode would run, then the message would be pretty irrelevant to me;) ... but unfortunately I can't do that

                        http://www.crazycreatorcube.com

                        wilrikerundefined 1 Reply Last reply Reply Quote 0
                        • wilrikerundefined
                          wilriker @CrazyCreator
                          last edited by

                          @crazycreator TBH I have no idea why it does not work for you. Can you please post the output of

                          sudo journalctl -eu duetcontrolserver
                          

                          after you sent M7722 and execonmcode reported EOF?

                          Also another idea, please try the absolute path to poweroff, i.e. /usr/bin/poweroff.

                          Manuel
                          Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                          with probably always latest firmware/DWC (incl. betas or self-compiled)
                          My Tool Collection

                          CrazyCreatorundefined 2 Replies Last reply Reply Quote 0
                          • CrazyCreatorundefined
                            CrazyCreator @wilriker
                            last edited by

                            @wilriker
                            this the output:

                            pi@CCC:~ $ sudo /usr/local/bin/execonmcode -mCode 7722 -command poweroff -debug -trace
                            2021/05/20 20:27:38 7722: poweroff 
                            2021/05/20 20:27:38 [DEBUG] <Recv> {"version":11,"id":114}
                            2021/05/20 20:27:38 [DEBUG] <Send> {"Mode":"Intercept","Version":10,"InterceptionMode":"Pre","Channels":["HTTP","Telnet","File","USB","Aux","Trigger","Queue","LCD","SBC","Daemon","Aux2","AutoPause","Unknown"],"Filters":["M7722"],"PriorityCodes":false}
                            2021/05/20 20:27:38 [DEBUG] <Recv> {"success":true}
                            2021/05/20 20:27:38 [DEBUG] <Connect> Connection established
                            2021/05/20 20:27:47 Connection to DCS closed
                            2021/05/20 20:27:47 [DEBUG] <Close> Closing connection
                            2021/05/20 20:27:47 EOF
                            pi@CCC:~ $ sudo journalctl -eu duetcontrolserver
                            May 20 18:31:16 CCC DuetControlServer[424]: [warn] IPC#67: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:40:55 CCC DuetControlServer[424]: [warn] IPC#69: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:43:43 CCC DuetControlServer[424]: [warn] IPC#70: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:44:42 CCC DuetControlServer[424]: [warn] IPC#72: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:45:54 CCC DuetControlServer[424]: [warn] IPC#75: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:46:20 CCC DuetControlServer[424]: [warn] IPC#77: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:46:25 CCC DuetControlServer[424]: [warn] IPC#78: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:47:03 CCC DuetControlServer[424]: [warn] IPC#80: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:47:06 CCC DuetControlServer[424]: [warn] IPC#81: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:47:58 CCC DuetControlServer[424]: [warn] IPC#83: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:48:08 CCC DuetControlServer[424]: [warn] IPC#85: Client with outdated protocol version connected (got 10, want 11)
                            May 20 18:58:23 CCC DuetControlServer[424]: [info] Starting macro file homeall.g on channel HTTP
                            May 20 18:58:23 CCC DuetControlServer[424]: [info] Starting macro file homey.g on channel HTTP
                            May 20 18:58:28 CCC DuetControlServer[424]: [info] Finished macro file homey.g
                            May 20 18:58:28 CCC DuetControlServer[424]: [info] Starting macro file homex.g on channel HTTP
                            May 20 18:58:32 CCC DuetControlServer[424]: [info] Finished macro file homex.g
                            May 20 18:58:32 CCC DuetControlServer[424]: [info] Starting macro file homez.g on channel HTTP
                            May 20 18:58:47 CCC DuetControlServer[424]: [info] Starting macro file bed.g on channel HTTP
                            May 20 18:59:14 CCC DuetControlServer[424]: [info] Finished macro file bed.g
                            May 20 18:59:15 CCC DuetControlServer[424]: [info] Finished macro file homez.g
                            May 20 18:59:15 CCC DuetControlServer[424]: [info] Finished macro file homeall.g
                            May 20 20:26:35 CCC DuetControlServer[424]: [warn] IPC#109: Client with outdated protocol version connected (got 10, want 11)
                            May 20 20:27:38 CCC DuetControlServer[424]: [warn] IPC#114: Client with outdated protocol version connected (got 10, want 11)
                            lines 74-96/96 (END)
                            

                            http://www.crazycreatorcube.com

                            1 Reply Last reply Reply Quote 0
                            • CrazyCreatorundefined
                              CrazyCreator @wilriker
                              last edited by CrazyCreator

                              @wilriker
                              and with the absolute path:

                              pi@CCC:~ $ sudo /usr/local/bin/execonmcode -mCode 7722 -command /usr/bin/poweroff -debug -trace
                              2021/05/20 20:31:12 7722: /usr/bin/poweroff 
                              2021/05/20 20:31:12 [DEBUG] <Recv> {"version":11,"id":117}
                              2021/05/20 20:31:12 [DEBUG] <Send> {"Mode":"Intercept","Version":10,"InterceptionMode":"Pre","Channels":["HTTP","Telnet","File","USB","Aux","Trigger","Queue","LCD","SBC","Daemon","Aux2","AutoPause","Unknown"],"Filters":["M7722"],"PriorityCodes":false}
                              2021/05/20 20:31:12 [DEBUG] <Recv> {"success":true}
                              2021/05/20 20:31:12 [DEBUG] <Connect> Connection established
                              2021/05/20 20:31:48 Connection to DCS closed
                              2021/05/20 20:31:48 [DEBUG] <Close> Closing connection
                              2021/05/20 20:31:48 EOF
                              pi@CCC:~ $ sudo journalctl -eu duetcontrolserver
                              May 20 18:44:42 CCC DuetControlServer[424]: [warn] IPC#72: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:45:54 CCC DuetControlServer[424]: [warn] IPC#75: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:46:20 CCC DuetControlServer[424]: [warn] IPC#77: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:46:25 CCC DuetControlServer[424]: [warn] IPC#78: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:47:03 CCC DuetControlServer[424]: [warn] IPC#80: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:47:06 CCC DuetControlServer[424]: [warn] IPC#81: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:47:58 CCC DuetControlServer[424]: [warn] IPC#83: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:48:08 CCC DuetControlServer[424]: [warn] IPC#85: Client with outdated protocol version connected (got 10, want 11)
                              May 20 18:58:23 CCC DuetControlServer[424]: [info] Starting macro file homeall.g on channel HTTP
                              May 20 18:58:23 CCC DuetControlServer[424]: [info] Starting macro file homey.g on channel HTTP
                              May 20 18:58:28 CCC DuetControlServer[424]: [info] Finished macro file homey.g
                              May 20 18:58:28 CCC DuetControlServer[424]: [info] Starting macro file homex.g on channel HTTP
                              May 20 18:58:32 CCC DuetControlServer[424]: [info] Finished macro file homex.g
                              May 20 18:58:32 CCC DuetControlServer[424]: [info] Starting macro file homez.g on channel HTTP
                              May 20 18:58:47 CCC DuetControlServer[424]: [info] Starting macro file bed.g on channel HTTP
                              May 20 18:59:14 CCC DuetControlServer[424]: [info] Finished macro file bed.g
                              May 20 18:59:15 CCC DuetControlServer[424]: [info] Finished macro file homez.g
                              May 20 18:59:15 CCC DuetControlServer[424]: [info] Finished macro file homeall.g
                              May 20 20:26:35 CCC DuetControlServer[424]: [warn] IPC#109: Client with outdated protocol version connected (got 10, want 11)
                              May 20 20:27:38 CCC DuetControlServer[424]: [warn] IPC#114: Client with outdated protocol version connected (got 10, want 11)
                              May 20 20:27:57 CCC DuetControlServer[424]: [warn] IPC#116: Client with outdated protocol version connected (got 10, want 11)
                              May 20 20:31:12 CCC DuetControlServer[424]: [warn] IPC#117: Client with outdated protocol version connected (got 10, want 11)
                              May 20 20:31:58 CCC DuetControlServer[424]: [warn] IPC#119: Client with outdated protocol version connected (got 10, want 11)
                              lines 77-99/99 (END)
                              

                              http://www.crazycreatorcube.com

                              wilrikerundefined 1 Reply Last reply Reply Quote 0
                              • wilrikerundefined
                                wilriker @CrazyCreator
                                last edited by wilriker

                                @crazycreator Hm, there is something strange here. I can now reproduce your issue. I have to investigate that.

                                EDIT: It seems that you discovered a but in DCS 3.3-rc2 (and possibly earlier) that will be fixed in the next RC (I have to confirm that still).

                                Manuel
                                Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                with probably always latest firmware/DWC (incl. betas or self-compiled)
                                My Tool Collection

                                CrazyCreatorundefined 1 Reply Last reply Reply Quote 0
                                • CrazyCreatorundefined
                                  CrazyCreator @wilriker
                                  last edited by

                                  @wilriker
                                  Why does this always have to happen to me?

                                  Which RRF version do you use?
                                  How long do you think it will take to get to the RC?

                                  http://www.crazycreatorcube.com

                                  wilrikerundefined 1 Reply Last reply Reply Quote 0
                                  • wilrikerundefined
                                    wilriker @CrazyCreator
                                    last edited by

                                    @crazycreator It's not RRF but DSF (DCS to be exact) that has that problem. And the next RC is planned to be released within the next couple of days unless important issues will postpone it.

                                    Manuel
                                    Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                    with probably always latest firmware/DWC (incl. betas or self-compiled)
                                    My Tool Collection

                                    oozeBotundefined 1 Reply Last reply Reply Quote 0
                                    • CrazyCreatorundefined
                                      CrazyCreator
                                      last edited by

                                      @wilriker
                                      then I will probably have to wait ... or you can send me an image of your SD card 😄

                                      http://www.crazycreatorcube.com

                                      1 Reply Last reply Reply Quote 0
                                      • oozeBotundefined
                                        oozeBot @wilriker
                                        last edited by

                                        @wilriker - just adding in that I'm experiencing the same thing on 3.3rc2.. I was able to capture it from a console when running below.

                                        Do you know if the issue has been found and is being corrected in 3.3rc3? Any interim builds out there floating around I could download to get past this issue?

                                        Thanks

                                        Capture.PNG

                                        Phaedruxundefined wilrikerundefined 2 Replies Last reply Reply Quote 0
                                        • Phaedruxundefined
                                          Phaedrux Moderator @oozeBot
                                          last edited by

                                          @oozebot said in [DSF Extension] Exec On MCode (was: Shutdown SBC):

                                          Any interim builds out there floating around I could download to get past this issue?

                                          You could test with this build but be aware there are other potential issues.

                                          https://www.dropbox.com/sh/1bblsmpe8m6kb0p/AAD4J_9-uEEnr-Rvh3OjlXyZa?dl=0

                                          Z-Bot CoreXY Build | Thingiverse Profile

                                          1 Reply Last reply Reply Quote 0
                                          • wilrikerundefined
                                            wilriker
                                            last edited by

                                            @CrazyCreator @oozeBot I can confirm that this bug will be fixed with DSF v3.3-rc3.

                                            Manuel
                                            Duet 3 6HC (v0.6) with RPi 4B on a custom Cartesian
                                            with probably always latest firmware/DWC (incl. betas or self-compiled)
                                            My Tool Collection

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA