Skip to content

Commit 276d096

Browse files
robin-nitrokeynickray
authored andcommitted
Use Service::try_new_client to construct clients
This reduces the dependency on Trussed internals for client creation.
1 parent 20d7e56 commit 276d096

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

runners/lpc55/src/types.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ include!(concat!(env!("OUT_DIR"), "/build_constants.rs"));
22

33
use crate::hal;
44
use hal::drivers::timer;
5-
use interchange::Interchange;
65
use littlefs2::{const_ram_storage, consts};
76
use trussed::types::{LfsResult, LfsStorage};
87
use trussed::{platform, store};
@@ -117,21 +116,9 @@ pub trait TrussedApp: Sized {
117116
fn with_client(trussed: TrussedClient, non_portable: Self::NonPortable) -> Self;
118117

119118
fn with(trussed: &mut trussed::Service<crate::Board>, non_portable: Self::NonPortable) -> Self {
120-
let (trussed_requester, trussed_responder) = trussed::pipe::TrussedInterchange::claim()
121-
.expect("could not setup TrussedInterchange");
122-
123-
let mut client_id = littlefs2::path::PathBuf::new();
124-
client_id.push(Self::CLIENT_ID.try_into().unwrap());
125-
assert!(trussed.add_endpoint(trussed_responder, client_id).is_ok());
126-
127-
let syscaller = Syscall::default();
128-
let trussed_client = TrussedClient::new(
129-
trussed_requester,
130-
syscaller,
131-
);
132-
133-
let app = Self::with_client(trussed_client, non_portable);
134-
app
119+
let client_id = core::str::from_utf8(Self::CLIENT_ID).unwrap();
120+
let client = trussed.try_new_client(client_id, Syscall::default()).unwrap();
121+
Self::with_client(client, non_portable)
135122
}
136123
}
137124

0 commit comments

Comments
 (0)