mpfshell: remote shell for esp8266

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: mpfshell: remote shell for esp8266

Post by platforma » Tue Mar 22, 2016 10:54 am

Unfortunately I won't be of any help to you, because I've never even read rshell code. And I guess we should leave it to the maintainer to port it to esp8266 if it is planned at all :)

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: mpfshell: remote shell for esp8266

Post by kfricke » Tue Mar 22, 2016 11:41 am

skylin008 wrote:Hi, platforma .I had ported the rshell to esp8266 scripts directory,but some error shows:

Code: Select all

>>>[code] import cmd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError: memory allocation failed, allocating 5112 bytes[/code]
I am also not the maintainer, but rshell is designed to usually be executed with CPython and talks to an MicroPython interpreter via a serial interface. It is not intended to be run on a microcontroller directly. Maybe a port to the MicroPython Unix port is possible or done.

You seem to try to port it onto an ESP8266 by launching it from within your firmware like a frozen module!?

rshell uses the serial interface to access the MicroPython REPL on a microcontroller in its different modes to transfer files and execute commands. This is implemented as an interactive Unix shell-like command line interface.

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

Re: mpfshell: remote shell for esp8266

Post by dhylands » Tue Mar 22, 2016 4:54 pm

rshell runs purely on the host and downloads required snippets to the board using pyboard.py

I've also written shell which runs purely on the device:
https://github.com/dhylands/upy-shell

I'd like for both of these to work with esp8266 but I've been swamped at work and haven't had any time to play with the 8266.

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: mpfshell: remote shell for esp8266

Post by wendlers » Tue Mar 22, 2016 10:02 pm

I updated the mpfshell I initially wrote for basic file access on the ESP in a way to allow mounting the FS on the ESP via FUSE (Linux/mac only, sorry). So now the following is possible:

E.g. Mount the device on port "/dev/ttyUSB0" to "$HOME/mp":

Code: Select all

test -d $HOME/mp || mkdir $HOME/mp
./mpmount.sh -p /dev/ttyUSB0 -m $HOME/mp
cd $HOME/mp
From there on, you could work under "$HOME/mp" as with a usual file system (list, create, delete, edit etc.), with the main difference, that the chances made are not written back to the board unless one commits them by executing the special file ".commit":

Code: Select all

echo 'print("Hello World!")' > test.py
./.commit
To access the REPL one could execute an other special file:

Code: Select all

./.terminal
>> import test.py
For those interested, the code could be found here (very very ALPAH :-):

https://github.com/wendlers/mpfshell

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: mpfshell: remote shell for esp8266

Post by wendlers » Fri Apr 15, 2016 9:16 pm

I made an update of the shell. It now allows to create/remove/navigate directories on the ESP flash file-system. Also it allows to enter the REPL from within the shell and supports very basic scripting through a file or command-line arguments.

For more details see https://github.com/wendlers/mpfshell.

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

mpfshell now supports connections via websockets

Post by wendlers » Wed Jun 08, 2016 7:15 pm

Hi,

I finished basic support for connecting with the "shell" to the ESP8266 via websockets (WebREPL needs to be active). Thus, all the shell operations (like put, get, full REPL, ...) are usable via a WiFi connection. Using a websocket connection is done by the following command in the shell:

Image

The shell will promt for the password, then try to connect to the ESP.

I also added support for the WiPi. The shell now has more or less this features:
  • - Support for serial connections (ESP8266 and WiPi)
    - Support for websockets (via WebREPL) connections (ESP8266 only)
    - Support for telnet connections (WiPy only)
    - Full directory handling (enter, create, remove)
    - Transfer (upload/download) of multiple files matching a reg.-exp.
    - All files are transferred in binary mode, and thus it should be possible to also upload pre-compiled code (.mpy) too.
    - Integrated REPL (supporting a workflow like: upload changed files, enter REPL, test, exit REPL, upload ...)
    - Tab-completion
    - Command history
    - Fully scriptable
The sources and more details could be found her: https://github.com/wendlers/mpfshell

Regards,
Stefan

markxr
Posts: 62
Joined: Wed Jun 01, 2016 3:41 pm

Re: mpfshell: remote shell for esp8266

Post by markxr » Thu Jun 09, 2016 7:19 pm

Hi,

It seems wrong to write a new tool which runs on Python 2; Micropython is itself based on Python3 and all new projects should surely use P3.

And you really want to fix that echoing bug.

Mark

profra
Posts: 39
Joined: Sat Jan 03, 2015 12:23 am

Re: mpfshell: remote shell for esp8266

Post by profra » Thu Jun 09, 2016 9:57 pm

@wendlers Thanks, thanks... mpfshell is handy tool... working on the first run.... some small bugs in editing cmd line but it doesn't matter.

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: mpfshell: remote shell for esp8266

Post by wendlers » Fri Jun 10, 2016 6:21 am

Hi,
markxr wrote: It seems wrong to write a new tool which runs on Python 2; Micropython is itself based on Python3 and all new projects should surely use P3.
Support for Python3 is clearly on the list. I just had no time yet to test on Python3.
markxr wrote: And you really want to fix that echoing bug.
I think the mentioned issue is caused by using PySerial 2.x (and not 3.x which is the intended version). However, I think I got around this (https://github.com/wendlers/mpfshell/issues/2), so please "git pull" and give it a try.

Regards,
Stefan

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: mpfshell: remote shell for esp8266

Post by wendlers » Fri Jun 10, 2016 6:22 am

profra wrote:@wendlers Thanks, thanks... mpfshell is handy tool... working on the first run.... some small bugs in editing cmd line but it doesn't matter.
Thanks! For bugs, your are very welcome to file an issue on github.

Post Reply