Description
Apologies for the far from comprehensive write-up here. I'm normally using Linux but had to use Windows for a few weird embedded dev things. Hence, I've been using tio on Windows via MSYS2. After experiencing this issue for the past week since I downloaded tio on MSYS2, I decided to go down this rabbit hole and after getting suitably stuck, I'm now hastily writing this so that I can leave it for now and get back to what I was doing 😆
When I try to use tio, I get a constant loop of connected then immediately disconnected, followed by the reconnection a second or so later which also immediately disconnects. I didn't get any useful errors until I realised that this is probably just tio's reconnect loop, and so when passing --no-reconnect
I got:
$ tio -n COM4
[06:08:58.902] tio 3.8
[06:08:58.903] Press ctrl-t q to quit
[06:08:58.904] Connected to /dev/ttyS3
[06:08:58.905] Disconnected
[06:08:58.906] Error: Could not get port settings (Invalid argument)
However, and I have no idea what sorcery is taking place here, but when I open another Windows serial terminal app, like PuTTY, on the same COM port, with the same settings, PuTTY stays connected just fine. Then, if I close PuTTY's session/close PuTTY completely, tio magically stays connected!
(I removed -n
for this one, no longer necessary here as there's no errors, it stays connected with no issues)
$ tio COM4
[06:12:59.689] tio 3.8
[06:12:59.690] Press ctrl-t q to quit
[06:12:59.691] Connected to /dev/ttyS3
<and it works!>
<pretend there's some output here - I didn't tell my embedded device to output anything on the com port>
I've tried MSYS2 UCRT64 and MINGW64 with the tio MSYS2 package, as well as building tio myself in MSYS2 (using a process based loosely off of the tio MSYS2 package's PKGBUILD), and I could replicate this issue in all of them.
If you want me to try anything and provide further info do let me know. I also have a debug build of tio I can use to gather more info if needed (well, Meson's debug build type with the DEBUG macro defined, which I added after seeing tio_debug_printf
was a thing, but then I later realised it's not called in very many places so it didn't give me any further insight). So, if you would like me to poke a debugger at anything to get some more info I can also do that, although perhaps that may not be all that useful for this issue.