The D<n> command is multiple bytes, right?
Yes. As I wrote, I tried the single char commands from the terminal software, and they did not work.
I think you are trying to re-use a bit too much from the backend that you used as an example. How to best read the response depends on how the protocol works. Is the length fixed or variable, do we known it in advance or not, etc.
Ok. As I may have mentioned in the beginning, this is totally unknown territory for me. From my understanding though, the code logic should be pretty simple: We do some base assumptions about buffer size, then attempt to read it full, and if the data from the device i less, then we should resize the buffer to match the actual data amount.
Going back here: When I successfully get the universal to send (even this seems to be unstable at times) the request byte, it does receive what seems to be an appropriate response.
But I think I understand your point, it could be that the chipset on the USB-cable pretending to be a serial device has some assumptions when the client is reading off it, and this has to be matched by the client software?
FWIW is it meaningful that the portmon log seems to indicate single byte read most of the time, or is it just an artifact of how portmon logs the communication?
Here's a snippet of the portmon log (I grep IRP_MJ for clarity):
87 0.00000698 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 3: 50 50 50 92 0.00001509 ProLink2010oct. IRP_MJ_CLEANUP Silabser0 SUCCESS 93 0.00320152 ProLink2010oct. IRP_MJ_CLOSE Silabser0 SUCCESS 94 0.02598515 ProLink2010oct. IRP_MJ_CREATE Silabser0 SUCCESS Options: Open 121 0.00000503 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 1: 50 130 0.00000531 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 1: 50 139 0.00000531 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 1: 50 145 0.00093783 ProLink2010oct. IRP_MJ_WRITE Silabser0 SUCCESS Length 1: 4D 155 0.00000559 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 1: 64 164 0.00000363 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 1: 0D 173 0.00000363 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 1: 0A 182 0.00000363 ProLink2010oct. IRP_MJ_READ Silabser0 SUCCESS Length 1: 76
0x50 equals P and seems to be the standby byte sent periodically.
So this equals to:
read: PPP read: P read: P read: P send: M read: d read: \r read: \n read: v ...
Poltsi