Skip to content

Commit 55de6b8

Browse files
committed
Add a sys feature to re-export ledger_secure_sdk_sys as the sys module
1 parent 48b4b3b commit 55de6b8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ledger_device_sdk/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ nano_nbgl = [ "ledger_secure_sdk_sys/nano_nbgl" ]
3030
debug_csdk = [ "ledger_secure_sdk_sys/debug_csdk" ]
3131
io_new = [] # switch to new 'io' module
3232

33+
# When enabled, this feature re-exports the `ledger_secure_sdk_sys` crate containing the
34+
# Ledger C SDK bindings through the `sys` module. Use it to access low-level (unsafe) FFI
35+
# functions, types, and constants directly from the underlying C SDK.
36+
# It is preferred to not enable this feature if possible, using instead the safe
37+
# abstractions in `ledger_device_sdk`, but it is provided for advanced use cases.
38+
sys = []
39+
3340
default = [ "heap" ]
3441

3542
[lints.rust.unexpected_cfgs]

ledger_device_sdk/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,19 @@ pub fn exiting_panic(_info: &PanicInfo) -> ! {
5959
ledger_secure_sdk_sys::exit_app(0);
6060
}
6161

62-
// re-export exit_app
62+
// Re-export exit_app
6363
pub use ledger_secure_sdk_sys::buttons;
6464
pub use ledger_secure_sdk_sys::exit_app;
6565

66-
// re-export include_gif macro
66+
// Re-export include_gif macro
6767
pub use include_gif::include_gif;
6868

69+
// Re-export the underlying Ledger C SDK bindings when the `sys` feature is enabled.
70+
// This provides direct (unsafe) FFI access. Prefer the safe abstractions in this crate
71+
// when possible.
72+
#[cfg(feature = "sys")]
73+
pub use ledger_secure_sdk_sys as sys;
74+
6975
use ledger_secure_sdk_sys::{pic_rs, pic_rs_mut};
7076

7177
/// Helper macro that sets an external panic handler

0 commit comments

Comments
 (0)