Page 1 of 1

Terminal S - a super simple serial terminal

Posted: Tue May 19, 2020 6:02 am
by Yhui
When playing with MicroPython on Windows, using PuTTY to open the serial REPL needs to open "Device Manager" to get the serial port number (I always forget a device's port name as I have several devices).
So I wrote a new serial terminal - Terminal S https://github.com/makerdiary/terminal-s. It has about 100 lines of Python code.

Install & Run

Code: Select all

pip install terminal-s
terminal-s
On Windows, we can also type Win + r and enter "terminal-s" to launch it

Image

Re: Terminal S - a super simple serial terminal

Posted: Tue May 19, 2020 2:52 pm
by scruss
Nice!

I tend to just use

Code: Select all

python3 -m serial.tools.miniterm
when I know I'm on a system that doesn't have minicom, c-kermit or screen on it.

Re: Terminal S - a super simple serial terminal

Posted: Tue May 19, 2020 3:28 pm
by dhylands
I also have a tool which will search for USB ports by name, serial number etc. https://github.com/dhylands/dotfiles/bl ... nd_port.py

It works on Windows/Mac/Linux. You can use it in a script to say open the port with Micropython by doing something like:

Code: Select all

$ find_port.py -n MicroPython
/dev/ttyACM0

Re: Terminal S - a super simple serial terminal

Posted: Wed May 20, 2020 12:00 am
by Yhui
scruss wrote:
Tue May 19, 2020 2:52 pm
Nice!

I tend to just use

Code: Select all

python3 -m serial.tools.miniterm
when I know I'm on a system that doesn't have minicom, c-kermit or screen on it.
I also use the miniterm, but it can not handle arrow keys and terminal color, which is one of the reason to write a new one.

Re: Terminal S - a super simple serial terminal

Posted: Wed May 20, 2020 8:55 am
by pythoncoder
Yhui wrote:
Wed May 20, 2020 12:00 am
...I also use the miniterm, but it can not handle arrow keys and terminal color, which is one of the reason to write a new one.
It supports both here under Linux. I invoke it with:

Code: Select all

miniterm.py /dev/pyboard 115200 --raw
(There is a udev rule that creates the /dev/pyboard device.)

I suspect there is something wrong with your configuration, but I have no recent experience of Windows.

To test colours I ran this (taken from one of my test programs):

Code: Select all

def print_tests():
    st = '''Available functions:
test(0)  Print this list.
test(1)  Test message acknowledge.
test(2)  Test Messge and Lock objects.
test(3)  Test the Barrier class.
test(4)  Test Semaphore
test(5)  Test BoundedSemaphore.
test(6)  Test the Condition class.
test(7)  Test the Queue class.
'''
    print('\x1b[32m')
    print(st)
    print('\x1b[39m')

print_tests()

Re: Terminal S - a super simple serial terminal

Posted: Thu May 21, 2020 1:56 am
by Yhui
On windows, miniterm.py raw mode doesn't support arrow keys. For example, left arrow key will be convert to

Code: Select all

[b'\x00',  b'K']
or

Code: Select all

[b'\xe0', b'K']
, but it need to be convert to

Code: Select all

[b'\x1b', b'[', b'D']

Re: Terminal S - a super simple serial terminal

Posted: Thu May 21, 2020 6:04 am
by pythoncoder
If this is a bug in miniterm it should be reported. But I'd first investigate if this is a Windows configuration issue. I'd be astonished if such a crippling failure didn't have a fix: a terminal that doesn't support arrow keys is essentially useless.

Re: Terminal S - a super simple serial terminal

Posted: Thu May 21, 2020 10:10 am
by Yhui
I don't think it's a bug of miniterm.py. miniterm.py raw mode just sends what it gets. Different cli environments have different escape sequences. Not every terminal supports VT100. It's just like that backspace don't work properlyon linux if you use miniterm.py without --raw. I didn't know the parameter --raw before you mentioned it.

Code: Select all

--raw                 Do no apply any encodings/transformations
Maybe add a new parameter similar with the parameter --raw.

Re: Terminal S - a super simple serial terminal

Posted: Thu May 21, 2020 8:13 pm
by tve
miniterm.py raw mode doesn't support arrow keys
have you tried

Code: Select all

--filter direct
instead of raw