rshell, Raspberry Pi, ESP32, RS485

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.
Post Reply
User avatar
tsjoiner
Posts: 22
Joined: Tue Sep 05, 2017 3:09 pm
Location: Alberta Beach, Alberta, Canada

rshell, Raspberry Pi, ESP32, RS485

Post by tsjoiner » Wed Sep 20, 2017 3:43 pm

Hi all,

I’m new to PyBoard and MicroPython and have been experimenting with both for a few weeks - and may I say great work to all involved.

Now, however, I am working on sending and receiving data between a Raspberry Pi and several ESP32 dev boards over RS485. I have successfully used esptool to upload the MicroPython firmware for ESP32 over this network but am having some trouble with rshell. I’m trying to encorporate rshell in a short python script but get an error message. Rshell does work as expected when executed in lxterminal.

http://tomatopatch.ca/Share/code

http://tomatopatch.ca/Share/code_error_message

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

Re: rshell, Raspberry Pi, ESP32, RS485

Post by dhylands » Wed Sep 20, 2017 5:46 pm

One of the things that rshell does is to save/restore the state of stdin, and I'm guessing that the ioctl calls for doing that are inappropriate with certain devices (perhaps /dev/null).

I don't think that there is a current workaround without changing the code. I'll see if I can reproduce this and add some error handling that allows rshell to continue running even when the state of stdin can't be saved.

User avatar
tsjoiner
Posts: 22
Joined: Tue Sep 05, 2017 3:09 pm
Location: Alberta Beach, Alberta, Canada

Re: rshell, Raspberry Pi, ESP32, RS485

Post by tsjoiner » Wed Sep 20, 2017 10:27 pm

Thanks for taking an interest. Any help you can give on this will be greatly appreciated.

User avatar
tsjoiner
Posts: 22
Joined: Tue Sep 05, 2017 3:09 pm
Location: Alberta Beach, Alberta, Canada

Re: rshell, Raspberry Pi, ESP32, RS485

Post by tsjoiner » Fri Sep 22, 2017 4:02 pm

Found a dirty workaround.
I installed xterm and created a desktop shortcut containing the line:

Code: Select all

Exec=xterm -e "python /home/pi/uPython/ESP32/RS485-Tools/DAPLC-ESP32-rShell.py"
my program contains the line:

Code: Select all

subprocess.call("lxterminal -e /home/pi/uPython/ESP32/RS485-Tools/rshell-ESP32.sh", shell=True)
So xterm opens a window and runs my python program which then opens an lxterminal window running rshell.
Works but yuck. Still open to suggestions.

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

Re: rshell, Raspberry Pi, ESP32, RS485

Post by dhylands » Sun Sep 24, 2017 10:27 pm

I've upgraded rshell to version 0.0.11 which should no longer get the exception you ran into.

You should be able to upgrade by doing:

Code: Select all

sudo pip3 install --upgrade rshell

User avatar
tsjoiner
Posts: 22
Joined: Tue Sep 05, 2017 3:09 pm
Location: Alberta Beach, Alberta, Canada

Re: rshell, Raspberry Pi, ESP32, RS485

Post by tsjoiner » Tue Sep 26, 2017 2:29 am

I've upgraded to rshell version 0.0.11 and no more exception messages.
Cheers

Post Reply