Closed qcscofield closed 1 year ago
The empty packet cause exception from the device When device receive this empty packet, it will treat it as an invalid packet, and then return error.
I'm pretty sure this is not specific to Web Serial.
IIRC, for USB CDC-ACM interfaces, zero-length packets are normal signaling mechanism and your application should be able to tolerate receiving them. And if your device is sending data, you may need to make sure that you send ZLPs as needed to avoid the case where it gets "stuck" when sending a multiple of the endpoint packet size.
It's been a while since I've reread the USB spec, so I'll leave it to other StackOverflow answers and online resources to go over the details.
That is correct. A ZLP is sent at the end of a transaction which has just sent a full packet. This is performed by the USB CDC-ACM driver and it out of the control of applications using the platform serial API, such as implementations of the Web Serial API.
Well. I'm not expert on USB CDC-ACM. What i know is that Qualcomm's own flash tool and a native windows application developed by us can communicate with the serial port correct without such error. If it's USB CDC driver's problem. I cannot explain why other native windows application works well
Is the native Windows application writing chunks that are an exact multiple of the USB packet size (looks like 1024 bytes)?
Well, after searching some document. I found Qualcomm firehose protocol have a configure option called "ZlpAwareHost=0". In Windows it should be 1. Which means, the device should handle the difference between Windows and Linux
Thanks very much. I found this solution because you mentioned "ZLP". So i just search it :)
For example:
10MB data loop 10 times to write. When writing 1MB of data, there is one empty packet for every 1KB sent. Do you know why ?![image](https://user-images.githubusercontent.com/31910172/179509219-a4cba9ff-d8fb-4be7-9950-b23dd604d7d4.png)