From 48d510560130b262c6e01723db24f280aceb5f23 Mon Sep 17 00:00:00 2001 From: Brad Campbell Date: Fri, 14 Jun 2024 17:08:03 -0400 Subject: [PATCH] libtock-sync: console-write: use yield-waitfor --- libtock-sync/interface/console.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libtock-sync/interface/console.c b/libtock-sync/interface/console.c index ec4ef2e28..6223dde8a 100644 --- a/libtock-sync/interface/console.c +++ b/libtock-sync/interface/console.c @@ -22,10 +22,11 @@ returncode_t libtocksync_console_write(const uint8_t* buffer, uint32_t length, i if (err != RETURNCODE_SUCCESS) return err; // Wait for the callback. - yield_for(&result.fired); - if (result.result != RETURNCODE_SUCCESS) return result.result; + libtock_console_write_done_set_upcall(NULL, NULL); + yield_waitfor_return_t yval = yield_wait_for(DRIVER_NUM_CONSOLE, 1); + if (yval.data0 != RETURNCODE_SUCCESS) return yval.data0; - *written = result.length; + *written = yval.data1; return RETURNCODE_SUCCESS; }