diff --git a/src/main.c b/src/main.c index 1ab8e63..6eb2904 100644 --- a/src/main.c +++ b/src/main.c @@ -115,8 +115,8 @@ int main(int argc, char* argv[]) { struct timeval zero = {0}; libusb_handle_events_timeout(context, &zero); - struct fxlink_message* msg = fxlink_device_finish_bulk_IN(dev); - if (msg) { + struct fxlink_message* msg; + while ((msg = fxlink_device_finish_bulk_IN(dev)) != NULL) { if (!fxlink_message_is_apptype(msg, "gdb", "remote")) { elog("unknown fxlink message type\n"); ret = -1; @@ -130,15 +130,13 @@ int main(int argc, char* argv[]) { } fxlink_message_free(msg, true); - // TODO : Uhu ? - /* if (!fxlink_device_start_bulk_IN(dev)) { - * elog("unable to start bulk IN trasfer\n"); - * return -1; - * } - */ fxlink_device_start_bulk_IN(dev); } + if (ret != 0) { + break; + } + // We don't want to start a new OUT transfer if another one is still in progress if (!dev->comm->ftransfer_OUT) { int bytes_socket;