diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1adcc8949..bda608b11 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -395,6 +395,7 @@ add_custom_target(rust-bindgen --allowlist-function secp256k1_ecdsa_anti_exfil_host_commit --allowlist-function wally_get_secp_context --allowlist-function wally_hash160 + --allowlist-function printf ${CMAKE_CURRENT_SOURCE_DIR}/rust/bitbox02-sys/wrapper.h -- -DPB_NO_PACKED_STRUCTS=1 -DPB_FIELD_16BIT=1 -fshort-enums ${RUST_BINDGEN_FLAGS} ${RUST_INCLUDES} COMMAND diff --git a/src/rust/bitbox02/src/lib.rs b/src/rust/bitbox02/src/lib.rs index c05903549..bbd7dfd07 100644 --- a/src/rust/bitbox02/src/lib.rs +++ b/src/rust/bitbox02/src/lib.rs @@ -176,6 +176,13 @@ pub fn reboot() -> ! { panic!("reboot called") } +#[cfg(feature = "testing")] +pub fn print_stdout(msg: &str) { + unsafe { + bitbox02_sys::printf(crate::util::str_to_cstr_vec(msg).unwrap().as_ptr()); + } +} + #[cfg(test)] mod tests { use super::*;