Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasional Hangup with Serial Transport #182

Open
ramlco opened this issue May 21, 2021 · 2 comments
Open

Occasional Hangup with Serial Transport #182

ramlco opened this issue May 21, 2021 · 2 comments

Comments

@ramlco
Copy link
Contributor

ramlco commented May 21, 2021

Hello,

I am experiencing an occasional hangup with my application. I am using the Windows Serial transport on the Client side and my own USB-CDC port on the Server side. Normally, when the Sever is sending a response to a Client request, I see the following:

  1. Sever sends a 4 byte header
  2. Client performs serial read, gets 4 bytes
  3. Server sends the message (16 bytes in this case)
  4. Client performs serial read, gets 16 bytes
  5. All is well, Client moves on

In the error state, I see this:

  1. Server sends a 4 byte header
  2. Server sends the message (16 bytes in this case)
  3. Client performs serial read, gets 20 bytes
  4. Client is now stuck in the 'serial_read' function because it read more than the 4 bytes is was expecting

To fix this, I would propose changing the 'nNumberOfBytesToRead' paremeter in the 'ReadFile' call to use the requested read size as a maximum rather than the Rx buffer size. Here is a screenshot of the fix (line 226):
image

Thanks in advance! This has been a great application to work with!

@Hadatko
Copy link
Member

Hadatko commented May 21, 2021

Hi @ramlco, thank you for the propose. I am not sure if this is original file or we (community) changed it already. Maybe we should update file with source. Unfortunately the person who put that file into project is no longer active. I guess this can be related source: https://github.com/BusPirate/Bus_Pirate/blob/b580ca9dcda14b7c64b6be2ed1b4b376366b1738/scripts/powertools/SPISniffer/linux-version/serial.c

@Hadatko
Copy link
Member

Hadatko commented May 21, 2021

@ramlco feel free to create PR with your fix and i will create new issue to update that file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants