g4klx / MMDVMHost

The host program for the MMDVM
GNU General Public License v2.0
372 stars 271 forks source link

Windows Serial reading 0 bytes #750

Closed Paulo-D2000 closed 2 years ago

Paulo-D2000 commented 2 years ago

The line https://github.com/g4klx/MMDVMHost/blob/fe195c4e405867eedc871c6c345257991f42e415/UARTController.cpp#L180 always returns 0, If its bypassed then https://github.com/g4klx/MMDVMHost/blob/fe195c4e405867eedc871c6c345257991f42e415/UARTController.cpp#L188 returns 0 bytes read...

Tested on Python with pyserial the serial.read() returns the correct buffer with mmdvm version and everything...

MMDVM protocol version: 2, description: b'MMDVM 20211220 NO TCXO GitID #0000000'
CPU: ST-Micro ARM, UDID: 33001E000F47393434353335
Modes:
 D-Star
 DMR
 YSF
 P25
 NXDN
 M17
 FM
 POCSAG
 AX.25

Win10 Vs2022 MMDVM Discovery

g4klx commented 2 years ago

The fact that cbInQue returns 0 means that no data is available to read, and therefore ReadFile will read 0 bytes, what you are describing is correct behaviour. The whole read section is designed to be non-blocking which is why it is written the way it is. It has been heavily tested over many years without any problems so I suggest the problem is elsewhere.

Note that I compile with VS2019 and cannot comment about behaviour with any other version of the Visual C++ family.

Paulo-D2000 commented 2 years ago

Hm strange... I wrote some code that does the same read/write and cbInQue is > 0, while mmvmhost always 0 :/

Paulo-D2000 commented 2 years ago

After commenting some parts of the code and initiailizing some structures now it works... strange....