From edbbe5ae679731b48e8fe3cbd428b70c1b3ca2c2 Mon Sep 17 00:00:00 2001 From: icex2 Date: Fri, 18 Dec 2020 17:54:35 +0100 Subject: [PATCH] iidxio-ezusb: Bugfix random input/outputs on startup --- src/main/iidxio-ezusb/iidxio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/iidxio-ezusb/iidxio.c b/src/main/iidxio-ezusb/iidxio.c index 0a74a29..681594b 100644 --- a/src/main/iidxio-ezusb/iidxio.c +++ b/src/main/iidxio-ezusb/iidxio.c @@ -75,9 +75,17 @@ bool iidx_io_init( } else { log_info( "Connected ezusb: vid 0x%X, pid 0x%X", ident.vid, ident.pid); - return true; } } + + // Random data returned by device, likely not properly initalized on device side + // Triggers random inputs and lights + // Flush that by execute a few polls + for (int i = 0; i < 10; i++) { + iidx_io_ep2_recv(); + } + + return true; } void iidx_io_fini(void)