Skip to content

Conversation

@glennrub
Copy link

No description provided.

@glennrub
Copy link
Author

Hi @aykevl,

I've rewritten a bit on the nus console to work with serial port programs.
I added a few things, such as auto-reconnect, connect on name, connect on address, log to file, silent mode and listing of nearby NUS devices.

I also put the stdin in non-blocking mode and added disconnect detection, so that it is possible to exit the loop upon such event.

Also added a socat shell script to execute the pynus as a stdio program to the socat, to provide a serial device /dev/pts/X device.

Instead of creating a new fork of this, i'm pushing it back to your source. I'm hoping you are fine with this :)

Cheers!

@glennrub
Copy link
Author

Yeah, and i removed the replace(b'\n', b'\r\n') on the notification data as i'm fixing this in mainline. It turned out mp_hal_stdout_tx_strn_cooked in the ble_uart.c did not do what it was suppose to do.

I'm also curious, why you changed the RX/TX a few months ago... i turned them back to represent the function names seen from the Peripheral. Should i reshuffle them back?

Adding parameters to pynus to make it work silent by default.

New arguments:

-a/--address  - set the address of the device to connect to.
-n/--name     - set the name of the device to connect to.
-p/--print    - print a list of available NUS capable devices.
-r/-reconnect - Automatically reconnect to the device upon disconnect.
-l/--logging  - Logging to log file, pynus.py.
-v/--verbose  - Verbose logging to console.

Adding run_pty.sh script to run the pynus.py as uart backend for pty.
This pty instance can subsequently be used as a serial port to
communicate with the device. For example 'rshell' for micropython or
similar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant