From: Stefano Mora (stefano.mora_at_[hidden])
Date: 2024-06-05 16:46:32


Hi all,
I’m writing a Qt application running on both Windows and MacOs platforms.
The application is based on CMake project that includes boost-asio package 1.84.0 by vcpkg packager.
The application must communicate with a board by USB cable = virtual serial port.
I’m handling the communication with a small wrap around the asio::serial_port object, found in sample https://github.com/fedetft/serial-port/tree/master/2_with_timeout
 
The problem is on MacOS platform; Windows version works correctly.
The problem is that after some data exchanges (they are correct) the program does not receive a reply (with the TIMEOUT exception) and, after that, it receives only system_error = 89.
 
This is a chunk of my log:
 
...
 
( I send a command and I receive the reply)
 
[ReceiveLog] start
[TP] start SendCommand 'log export'
[WriteCommand] Byte[] Write - cmd: 'log export'
[WaitForResponse] ms 1000
RX [34] : ' log export -> XModem receive file'
[SendCommand] response: ' log export -> XModem receive file'
[ReceiveLog] response1: 'XModem receive file' matching: 'XModem receive file'
[ReceiveLog] ok -> XMODEM
 
(now I send a byte to start the data from the board - 3 attempts)
 
> Write BEGIN DATA RECEIVE ..
[WaitForXModemResponse] ms 4000
[WaitForXModemResponse] TIMEOUT
TO diff: 4
 
> Write BEGIN DATA RECEIVE ..
[WaitForXModemResponse] ms 4000
[ToSerial][readCompleted] error system:89
[ToSerial][readCompleted] byteTransf 0
[WaitForXModemResponse] Boost System_error
 
> Write BEGIN DATA RECEIVE ..
[WaitForXModemResponse] ms 4000
[ToSerial][readCompleted] error system:89
[ToSerial][readCompleted] byteTransf 0
[WaitForXModemResponse] Boost System_error
[TP][ReceiveLog] start XMODEM: 0
 
(now I sent an ACK, just to try ...)
 
[WaitForXModemResponse] ms 1000
[ToSerial][readCompleted] error system:89
[ToSerial][readCompleted] byteTransf 0
[WaitForXModemResponse] Boost System_error
[dlThread] ReceiveLog ret: 0

The read function is simply set the timeout and read 133 bytes:

...
_serialPort.setTimeout( boost::posix_time::millisec(timeout));

char data[XMODEM_PACKET_LENGTH];
try {
_serialPort.read( data, XMODEM_PACKET_LENGTH);
...
}
catch(timeout_exception){
...
}
catch(boost::system::system_error){
...}

Please what error 89 means (in MACos context)?
Any idea on how to exit from this situation?

Thanks!
Regards