wtarreau / bootterm Goto Github PK
View Code? Open in Web Editor NEWThe terminal written for its users by its users
License: MIT License
The terminal written for its users by its users
License: MIT License
I looked around, and was amazed by the fact that there doesn't seem to be a serial terminal which can send a BREAK to serial port on connection (only using escape command triggered by a user). Sending a BREAK on connection is the default behavior of the ser2net tool, and sought a way to emulate it. And I couldn't! As bootterm is a new tool, aspiring to improve on its predecessors, maybe it'll be interested to add it...
To elaborate why this may be useful - various devices may treat UART BREAK as analog of a "reset" signal. This is e.g. the case for CMSIS bootloader boards (many ARM boards, a random example is NXP FRDM-K64F board). So, if such a board is programmed with a simple "start, print something, stop" embedded application (common situation during initial stages of development and/or experimenting), the by sending BREAK on connection, you will cause the programmed app to re-run and get output. Whereas otherwise, you wouldn't see any output on connection, and would need to reach for a reset button, which is quite boring.
First of all thanks for bootterm, your "Motivation" section resonates with me.
I do have a feature request though - ability to optionally (with a single-character command/config file) prepend every line in the terminal/output with a (configurable?) timestamp, ala "[yyy.mm.dd hh:mm:ss] ..." . It's very useful to have timing information when debugging various issues.
P.S.
minicom has this feature (Ctrl+A + N), but it has other issues, as you mentioned in "Motivation" section.
"tio" has it, but it's not configurable, shows only time without date.
I have a microcontroller that wants to connect at 20000000 baud. I am using a SparkFun FTDI usb to UART 3.3 volt device. I can use the aging CoolTerm v1.7.0 build 825 to connect to this device via this USB/UART and see the output correctly. CoolTerm lets me select this 2000000 baud rate. When I try the same with bt 0.4.0 and the same USB device on Mac OS 12.6, it does not work and delivers the following:
dproffer@graymini hid_download_py % bt -b 2000000
No port specified, using cu.usbserial-A700eF7u (last registered). Use -l to list ports.
Trying port cu.usbserial-A700eF7u... Failed.
Failed to configure port: Invalid argument
Hint: maybe the baud rate is not supported by the port.
The following baud rates are known (not necessarily supported though):
50 75 110 134 150
200 300 600 1200 1800
2400 4800 9600 19200 38400
57600 76800 115200 230400
dproffer@graymini hid_download_py %
Thank you for your work on this project!
In minicom, there's an echo on/off setting(Ctrl + A E), this is useful in some cases, like AT Command input.
I searched the echo
keyword in this project, and the help output, it seems this function is missing.
Is this function already ready? Or would your add this function?
Thanks for this useful utils.
(continuation of #2)
Regarding auto-detection, of course /sys/class/* will not work on macos. One discovery method per OS is needed. I have already identified the use of sysctl() for freebsd. Could you please issue sysctl -a|grep ^dev on macos to see if it shares anything with freebsd just in case ?
jakub@jakub-mbp :: 00:23:32 :: ~
$ sysctl -a|grep ^dev
jakub@jakub-mbp :: 00:23:39 :: ~
$
Sadly, no :(
macOS doesn't have "Serial" hardware type in System information. Only USB devices can be listed:
$ system_profiler SPUSBDataType
USB:
USB 3.0 Bus:
Host Controller Driver: AppleUSBXHCILPTH
PCI Device ID: 0x8c31
PCI Revision ID: 0x0005
PCI Vendor ID: 0x8086
(...)
CP2102 USB to UART Bridge Controller:
Product ID: 0xea60
Vendor ID: 0x10c4 (Silicon Laboratories, Inc.)
Version: 1.00
Serial Number: 0001
Speed: Up to 12 Mb/s
Manufacturer: Silicon Labs
Location ID: 0x14200000 / 6
Current Available (mA): 500
Current Required (mA): 100
Extra Operating Current (mA): 0
but that still doesn't give us any direct info about Serial without doing VID/PID lookups.
Diff of /dev
before and after connecting CP2102.
$ diff noserial.txt serial.txt
268a269,270
> cu.SLAB_USBtoUART
> cu.usbserial-0001
462a465,466
> tty.SLAB_USBtoUART
> tty.usbserial-0001
(Weird that it is visible as two separate devices, maybe it's something related to my system setup/drivers)
[edit]
That was a driver issue - I had installed both Apple and Silabs kexts, uninstalling the later fixed the issue.
and here's for the FTDI
$ diff noserial.txt ftdi.txt
268a269
> cu.usbserial-A9APTBNR
463a465
> tty.usbserial-A9APTBNR
Looks like the Arduino IDE went the easy way and just lists all ^cu\.
devices.
Bootterm can't seem to find a connected USB CDC serial device.
$ ls /dev/ttyACM0
/dev/ttyACM0
$ bt -l
port | age (sec) | device | driver | description
------+------------+------------+------------------+----------------------
0 | 0 | ttyS0 | serial |
* 1 | 0 | ttyS1 | serial |
$ sudo bt -l
[sudo] password for mike:
port | age (sec) | device | driver | description
------+------------+------------+------------------+----------------------
0 | 8 | ttyS0 | serial |
* 1 | 8 | ttyS1 | serial |
RS485 requires some special flag in the ioctl settings. Can we support it as the new version of minicom(RTS delay...) ?
Some devices (a marvin 3D printer here) send both \r\n as a EOL. Could you please add a flag to treat this like a simple \n in terminal. (\r\n is normal in capture file).
I find /usr/bin/bt
to be a bit... generic? If I installed it a while back, and looked in my /usr/bin, I'd probably wouldn't remember what it. Conversely, if I wanted to connect to my new ESP32 board after not having done so in a while, I'd probably remember this "bootterm" utility, and I'd probably try to type "bootterm", rather than "bt".
(And this may be me, but when I see "bt", I can't stop but think "Bluetooth" for a second.)
With a quick search, I couldn't find of another package shipping in {/bin,/sbin,/usr/bin,/usr/sbin}/bt
, but it seems a bit risky, in the context of a larger namespace, like ones that distributions maintain. (I'm looking into packaging BootTerm for/in Debian, which enforces uniqueness in $PATH; no other package will be able to use "bt" if BootTerm does.)
Any reason to not use /usr/bin/bootterm
instead? Users can always add alias bt=booterm
in their preferred shell if they use this often and want to save a few characters.
I have created symlinks into /dev/serial/by-id/
to help working with several usb/serial adapters. I cannot refer to them using a relative path:
$ strace -efile bt ./ttyA35
...
openat(AT_FDCWD, "/dev/./ttyA35", O_RDWR|O_NOCTTY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
Trying port ./ttyA35... Failed! (No such file or directory)
Failed to open port: No such file or directory
+++ exited with 2 +++
A workaround is to use bt $PWD/ttyA35
but it's pretty ugly :)
Probably the argument should be considered a usual relative pass when it contains a /
?
Is it really that much of a gain to spare the user from typing /dev/
when he likely has to enter tty
anyway ? I'd think a string without a /
would make more sense to use as bt USB0
, but I guess it can be a matter of taste...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.