-
Hi Guys, Brief description of my problem: Most of the time my application is working perfectly fine: the device is properly read; when I disconnect the device, and reconnect, then the read future is properly terminating with the error. When there is no data to read, the future correclyt timeouts with 'deadline elapsed'. All is working perfectly great. The problem is that occasionally (about once a week) the cdc-acm driver stuck in an weird state (this is my assumption). Now the interesting part: ioctl(fd, USBDEVFS_RESET, 0); from quite different C program. As the result I have in dmesg:
And guess what happening for a tokio runtime... It is suddenly continuing to work! The
And all tokio tasks are starting to run back again. I'd like to confirm my assumptions - here are my questions:
I am open to your comments as I want to debug/confirm and solve this problem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Your pub async fn read_exact(&self, out: &mut [u8]) -> io::Result<()> {
while !out.is_empty() {
let len = self._read(out).await?;
out = &mut out[len..];
}
Ok(())
} |
Beta Was this translation helpful? Give feedback.
Your
read_exact
call looks wrong. Try replacing it with one that calls_read
instead: