03-30-2025, 02:13 AM
The short answer is that you're probably not going to get this to work on Linux for a variety of reasons. On Windows `Open` has special support for serial devices via `OPEN COM`, but similar functionality is not implemented on Linux and Mac OS and the regular file logic is not designed for streams.
Your best bet would be writing a little bit of C code to read/write from the stream using `open()`, `read()`, `write()`, etc. and then call that code from QB64 using `DECLARE LIBRARY`. In theory you could do it all via pure QB64 and directly calling `open()`, `read()`, `write()`, etc. (via `DECLARE LIBRARY`) but you wouldn't be able to use the C constants for `open()` so there would be more potential for mistakes.
I'm also pretty sure the `stty` shell call won't work as intended, I don't think those settings will persist after the `Shell` call. If I'm right on that then you'll have to set the tty settings using the C APIs (`tcgetattr()` and `tcsetattr()`). Those functions pass a `struct termios` structure back and forth so you really don't want to bother trying to do that with QB64, writing C code for that would be a lot simpler.
Your best bet would be writing a little bit of C code to read/write from the stream using `open()`, `read()`, `write()`, etc. and then call that code from QB64 using `DECLARE LIBRARY`. In theory you could do it all via pure QB64 and directly calling `open()`, `read()`, `write()`, etc. (via `DECLARE LIBRARY`) but you wouldn't be able to use the C constants for `open()` so there would be more potential for mistakes.
I'm also pretty sure the `stty` shell call won't work as intended, I don't think those settings will persist after the `Shell` call. If I'm right on that then you'll have to set the tty settings using the C APIs (`tcgetattr()` and `tcsetattr()`). Those functions pass a `struct termios` structure back and forth so you really don't want to bother trying to do that with QB64, writing C code for that would be a lot simpler.

