Shanti, thank you for the hints.
JSDB file ports are buffered (by JSDB, not the OS) by default. Try "wt+" mode and see if that helps.
I tried that mode, and it does not help.
Python probably calls ioctl() to set the serial port parameters, like data rate. Perhaps we need a separate Stream constructor for unix, like
new Stream('com://ttyUSB0:9600')
Following your suggestion, I straced what both Python and JSDB do.
First of all, both call open() but with the same access mode O_RDWR,
but different creation flags
[ Python ] O_NOCTTY
[ JSDB ] O_CREAT | O_TRUNC
and different file status flags
[ Python ] O_NONBLOCK | O_LARGEFILE
As for ioctl(), I could see that Python calls it five times, whereas JSDB
calls it one time, and their structures differ.
Unfortunately, this is as much as I can say, since I do not understand
what is going on. Reading man and googling did not helped me.
It's also possible to expose ioctl() to JS, but I would rather not. You can run ioctl from the command line on linux, either before starting JSDB or from a system call.
I prefer not to do this at the moment. What I am doing, instead, is to
make a system call to run the Python script that makes it possible to
write to /dev/ttyUSB0.
The relevant code for the serial port stream is in rs/io_comm.cpp (which is Windows-only now) and rs/io_file.cpp if you want to muck around with the source.
I did check this files, but not knowing C++, nor what the requirements
are, I can do nothing here.
All in all, it is unfortunate that I can not be of help in this case.
Best,
--j