ftdi_readstream: fix timeout setting
authorMatthias Klein <matthias@extraklein.de>
Fri, 18 Nov 2022 08:59:40 +0000 (09:59 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 29 Aug 2023 15:13:55 +0000 (17:13 +0200)
Divide the whole seconds into tv_sec, and the remaining microseconds into tv_usec.

Signed-off-by: Matthias Klein <matthias@extraklein.de>

src/ftdi_stream.c

index f5f1287..4229d94 100644 (file)
@@ -241,7 +241,8 @@ ftdi_readstream(struct ftdi_context *ftdi,
     {
         FTDIProgressInfo  *progress = &state.progress;
         const double progressInterval = 1.0;
-        struct timeval timeout = { 0, ftdi->usb_read_timeout * 1000};
+        struct timeval timeout = { ftdi->usb_read_timeout / 1000,
+            (ftdi->usb_read_timeout % 1000) * 1000 };
         struct timeval now;
 
         int err = libusb_handle_events_timeout(ftdi->usb_ctx, &timeout);