No internet connection
  1. Home
  2. General

Possible to add a Mouse Jiggler?

By @ppxntwq
    2021-02-23 20:26:59.523Z

    Would like to be able to keep remote device awake that doesn't have typical "sleep" settings.

    Solved in post #2, click to view
    • 14 replies
    1. Michael Lynch @michael2021-02-24 21:20:59.884Z2023-07-03 16:24:45.502Z

      Edit (2023-07-23): We now have an official solution for this.

      Reply3 LikesSolution
      1. GAlfredo Granados @granadosjr
          2023-07-03 16:02:30.753Z

          exactly what i needed! thanks for the script!

          1. @granadosjr - We now have a better solution that's more robust.

            1. G2@gauravjain
                2025-02-27 14:25:14.927Z

                Script doesn't work in my ssh connection with mentioned steps. It doesn't do anything.

                JIGGLE_INTERVAL_MINUTES=1
                cat << EOF | sudo tee /etc/cron.d/tinypilot-mouse-jiggle
                */$JIGGLE_INTERVAL_MINUTES * * * * tinypilot /bin/echo -ne "\0\x03\x16\x58\x4c\0\0" > /dev/hidg1 && /bin/echo -ne "\0\xbc\x1b\xdd\x2a\0\0" > /dev/hidg1
                EOF

                gives

                */1 * * * * tinypilot /bin/echo -ne "\0\x03\x16\x58\x4c\0\0" > /dev/hidg1 && /bin/echo -ne "\0\xbc\x1b\xdd\x2a\0\0" > /dev/hidg1

                but mouse doesn't move in the target machine after a minute or several minutes.

                1. KKartheg @Kartheg
                    2025-02-27 20:02:17.545Z2025-02-27 23:15:37.437Z

                    I have the similar issue. The mouse moves once after executing the script. I don't see it moving again. Also it seems to place the pointer at the same location. However I just noticed the screen does not get locked. So its working regardless.

                    1. In reply togauravjain:
                      David @david2025-02-28 11:57:36.673Z

                      I'm sorry this doesn't seem to be working for you, @gauravjain.

                      I've just tested the script on my machine, and it seems to work as expected. I think @Kartheg's explanation is correct - the mouse cursor moves to the same spot on the interval, meaning it doesn't 'jiggle' in the traditional way, but it has the same effect.

                      Even if the mouse cursor doesn't move from that spot, when the next interval passes TinyPilot will send the same mouse command to move it to that location again. The cursor doesn't appear to move, but the target machine still receives mouse input, which is usually enough to prevent the target machine from locking / sleeping.

                      If you target machine is still locking / sleeping with this mouse jiggler, can you tell me more about the issue? If you move your cursor and wait a minute, does the cursor jump to a different location?

              • T
                In reply toppxntwq:
                Brandon Friesen @TCW
                  2022-06-24 15:28:01.132Z

                  I would like to see this added to the WebUI. I have a hardware based jiggler that moves the mouse cursor 1pixel at a time but it would be nice not to have to plug another device into the target machine.

                  1. Thanks for the feedback!

                    Have you tried using the software-based jiggle script above?

                  2. T
                    In reply toppxntwq:
                    @tinyuser2022
                      2022-11-22 09:29:28.198Z

                      Hi, the script works but how can you run it in the backround without a permanent ssh connection?

                      1. TMike @tiny_flyer
                          2022-11-29 16:49:27.111Z

                          To run any script to persist in the background add you would execute the command as follows
                          nohup ./tinypilot-jiggle.bash &

                          The nohup portion runs the command regardless of console connection. The ampersand "&" runs the process in the background. Used together it runs the script in the background and doesn't stop when the connection is dropped

                          1. Thanks for sharing this Mike! It's worth noting that the script won't automatically restart if the TinyPilot device has been rebooted when using this method - you'll need to SSH in and manually launch it each time that happens. There are ways to get the script to automatically launch on startup but I'd advise against that as it's caused issues for troubleshooting in the past.

                            1. TMike @tiny_flyer
                                2022-12-01 14:27:35.610Z

                                Thank you for clarifying Charles. You are correct.

                          2. T
                            In reply toppxntwq:
                            @tinyuser2022
                              2022-11-29 19:25:47.612Z2022-11-29 21:13:49.754Z

                              Hi, i added a cronjob with the specific mouse parameters from the script. So it just runs in the background even after a reboot. Since now i do not have any hassle.

                              # m h  dom mon dow   command
                              */5 * * * * /bin/echo -ne "\0\x03\x16\x58\x4c\0\0" > /dev/hidg1
                              */5 * * * * /bin/echo -ne "\0\xbc\x1b\xdd\x2a\0\0" > /dev/hidg1
                              
                              1. Thanks for sharing this with us @tinyuser2022!