Spike Prime remote command using screen I am trying to execute commands using the -X switch on the Spike Prime Hub but all I get is either nothing, or unknown command errors.
Here is what I tried so far:
screen /dev/ttyACM0 -X 'print(&quot;test&quot;)'
screen /dev/ttyACM0 -X $'print(&quot;test&quot;)/n'
screen /dev/ttyACM0 | 'print(&quot;test&quot;)'
screen /dev/ttyACM0 | $'print(&quot;test&quot;)/n'
The piped commands gave me unknown command errors. When I change the main.py and add some prints, they are shown even if printed before I login. So stream wise that is working no matter when I login.
Another issue occures with the rshell rsync. I had to add a switch to stop the sound files from syncing since they crash rshell. Also rshell stops the code execution on the hub. I tried the above commands before and after rshell rsync call. When I login the hub after rshell I can enter python commands without hitting ctrl+c. Before rsync I have to stop execution with ctrl+c before I am able to type.
But the screen command does not execute python in all cases. Any ideas ?
The main task I want to achieve is that the hub continues execution after rsync. I wanted that with a screen command. But the whole Spike Prime software seems buggy and sluggish from the open source point of view.
With the prime hub you need to exit the hub default process before you can send commands using ctrl-c.
Ctrl-c is the character 0x03.
This is my python script that I use to send micropython scripts over to my hub:
https://github.com/gpdaniels/spike-prime/blob/master/simulator/run.py
It has lots of nastyness in it like this:
port.write(b'\x03')
time.sleep(0.1)
port.write(b'\x03')
time.sleep(1.0)

To try and get the hub to stop the running script and behave.
Also there's functions to read the serial input from the hub until it sees the &gt;&gt;&gt; characters which indicate the REPL is ready to receive python commands.