CppLinuxSerial icon indicating copy to clipboard operation
CppLinuxSerial copied to clipboard

In binary mode fails because sometimes the ioctl does not complete fast enough?

Open esteimle opened this issue 2 years ago • 1 comments

Feel free to close this if you don't think it is an issue. I was using your library to communicate with a USB serial port on Ubuntu 20.04. The device only communicates in binary mode. I was seeing some issues that happen sometimes when canonical mode was not disabled. Basically it seemed to hang or timeout when certain characters came through. I read through your setup code and it looked good though. But then I dropped a single print in SerialPort.cpp right before this line: this->SetTermios2(tty); all of a sudden all my problems went away :)

So I added a sleep but that seems a little hackish. I was wondering if you had any ideas or had seen something like this? I notice you had commented out a flush on the file descriptor and I wondered if something similar might have to happen with that ioctl call inside SetTermios2. Anyway just wondering if you had any thoughts on it, not complaining or anything. I'm just curious what's going wrong for me.

Thanks!

esteimle avatar Apr 13 '22 21:04 esteimle

Interesting @esteimle , I not sure sorry though whether it would help or not. If you do want to play around with fixing it, try adding a flush or similar and see if that changes things. Agreed that a print/sleep statement is a bit hackish, and is probably hiding the true issue.

gbmhunter avatar Apr 30 '22 01:04 gbmhunter