rshell - Remote Shell

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
dhylands
Posts: 3177
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: rshell - Remote Shell

Post by dhylands » Sat May 27, 2017 6:09 pm

randmor wrote:What I am hoping for is something like

RSHELL_BUFFER_SIZE="--buffer-size=32"
Try using RSHELL_BUFFER_SIZE=32 (i.e. setting the RSHELL_BUFFER_SIZE environment variable to the value 32).

The supported environment variables are:
RSHELL_BAUD, RSHELL_PORT, RSHELL_USER, RSHELL_PASSWORD, RSHELL_EDITOR, and RSHELL_BUFFER_SIZE

randmor
Posts: 18
Joined: Wed May 03, 2017 1:44 am

Re: rshell - Remote Shell

Post by randmor » Sat May 27, 2017 9:50 pm

Thanks Robert, I finally 'got' what you were saying about "/pyboard" being the alias for the root directory of the ESP8266 file system.

So, now with "rshell --port /dev/ttyUSB0 --buffer-size=32", I can do a "cp uPy_demo1.py /pyboard" and the "uPy_demo1.py" file will be copied down to the root directory of the ESP8266 file system. We can verify that by using the "ls /pyboard" command to view all the files on the root directory. That makes it nice, because it's a little inconvenient to squirrel away your files in sub-directories when all you need is to copy a few files down to the root directory where they are most easily accessed.

/home/randmor> cd /pyboard/myScripts
/pyboard/myScripts> ls
test1.py
/pyboard/myScripts> cat test1.py

# MicroPython Test Script that blinks 2 LEDs
# out of phase with each other.
import machine
import time
led1 = machine.Pin(4,machine.Pin.OUT)
led2 = machine.Pin(5,machine.Pin.OUT)
print("Starting test...")
for i in range(100):
led1.high()
led2.low()
time.sleep(0.5)
led1.low()
led2.high()
time.sleep(0.5)
print("Test complete.")

/pyboard/myScripts> cd ..
/pyboard> ls -al
162 Jan 1 2000 boot.py
0 May 27 14:30 myScripts/
358 May 27 14:40 uPy_test1.py
/pyboard> cat boot.py
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import gc
#import webrepl
#webrepl.start()
gc.collect()
/pyboard>

Yup, "/pyboard" looks really handy!

ajie_dirgantara
Posts: 79
Joined: Fri Sep 02, 2016 9:26 am

Re: rshell - Remote Shell

Post by ajie_dirgantara » Sat Aug 26, 2017 6:07 am

dhylands wrote:X/Y/ZMODEM (or perhaps some minor variant which would allow even smaller packets) is one of the candidates that I've been looking at using for a more robust rshell transfer (not just for files, but for all of the information going back and forth).
any news on xmodem implementation on rshell?

User avatar
dhylands
Posts: 3177
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: rshell - Remote Shell

Post by dhylands » Sun Aug 27, 2017 4:38 am

I have plans to do a packet based protocol for rshell, but I was going to do something a bit different than X/Y/Z Modem. I've looked at them, and they require a fair amount of code to actually implement the various algorithms.

I don't currently have a timeline for implementing it due to other things happening in my life right now.

User avatar
on4aa
Posts: 70
Joined: Sat Nov 11, 2017 8:41 pm
Location: Europe
Contact:

Re: rshell - Remote Shell

Post by on4aa » Tue Dec 19, 2017 11:23 pm

Dear Dave,
I wish to thank you for writing rshell.
As a complete newbee in MicroPython (but not the GNU/Linux terminal), I started using it last night and I am absolutely loving it!

An additional idea that would make it 100% feature complete would be upip integration for fast & easy module installation in lib.
Some food for thought perhaps for your next coding marathon…

Thanks!
Serge
Serge

User avatar
pythoncoder
Posts: 3420
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: rshell - Remote Shell

Post by pythoncoder » Wed Dec 20, 2017 7:31 am

Interesting idea. Another approach might be to write a Bash script which creates a temporary directory, invokes upip to populate the directory, invokes rshell to sync it to the target, then (optionally) deletes the directory. I assume you're aware that rshell can be invoked at the Bash prompt with a command e.g.

Code: Select all

$ rshell cp rats.py /sd
Connecting to /dev/pyboard ...
[adminpete@axolotl]: /mnt/qnap2/data/Projects/MicroPython/micropython-async
$ 
Peter Hinch

User avatar
on4aa
Posts: 70
Joined: Sat Nov 11, 2017 8:41 pm
Location: Europe
Contact:

Re: rshell - Remote Shell

Post by on4aa » Wed Dec 20, 2017 3:14 pm

I am aware of that. However once I am inside rshell, I have to admit I rarely leave it… except for downloading modules.
Serge

slzatz
Posts: 92
Joined: Mon Feb 09, 2015 1:09 am

Re: rshell - Remote Shell

Post by slzatz » Sat Dec 23, 2017 1:23 am

I am using the @loboris micropython ESP32 port and am running rshell on ubuntu 17.10. I start rshell with:

Code: Select all

rshell --port /dev/ttyUSB0 --buffer-size=32
I can get to the repl through rshell with no problem

When I use the boards cmd I get:

Code: Select all

pyboard @ /dev.ttyUSB0 connected Dirs: /flash /pyboard/flash
but

Code: Select all

ls /flash
results in "No such file or directory" and

Code: Select all

ls /pyboard
results in this traceback.

Code: Select all

File "../rshell/bin/rshell", line 11, in <module>
    load_entry_point('rshell==0.0.11', 'console_scripts', 'rshell')()
  File "../rshell/command_line.py", line 4, in main
    rshell.main.main()
  File "../rshell/main.py", line 2658, in main
    real_main()
  File "../rshell/main.py", line 2641, in real_main
    shell.cmdloop(cmd_line)
  File "/../rshell/main.py", line 1551, in cmdloop
    cmd.Cmd.cmdloop(self)
  File "/usr/lib/python3.6/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/../rshell/main.py", line 1581, in onecmd
    self.onecmd_exec("".join(group))
  File "/../rshell/main.py", line 1592, in onecmd_exec
    return cmd.Cmd.onecmd(self, line)
  File "/usr/lib/python3.6/cmd.py", line 217, in onecmd
    return func(arg)
  File "../rshell/main.py", line 2169, in do_ls
    ldir_stat = auto(listdir_stat, filename)
  File "/../rshell/main.py", line 519, in auto
    return dev.remote_eval(func, dev_filename, *args, **kwargs)
  File "..rshell/main.py", line 1353, in remote_eval
    return eval(self.remote(func, *args, **kwargs))
  File "<string>", line 0
    ^
Anyone seen this and have any suggestions?

User avatar
pythoncoder
Posts: 3420
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: rshell - Remote Shell

Post by pythoncoder » Sat Dec 23, 2017 8:14 am

I would try to diagnose this by connecting with a terminal program to see whether the problem is with rshell or with the Loboris fork.
Peter Hinch

slzatz
Posts: 92
Joined: Mon Feb 09, 2015 1:09 am

Re: rshell - Remote Shell

Post by slzatz » Sat Dec 23, 2017 10:16 am

I would try to diagnose this by connecting with a terminal program to see whether the problem is with rshell or with the Loboris fork.

Code: Select all

ampy -p /dev/ttyUSB0 ls /flash
works fine on the same board.

Post Reply