Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
866 changes: 459 additions & 407 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ repository = "https://github.com/CodeConstruct/mctp-rs"
[workspace.dependencies]
anyhow = "1.0.80"
argh = "0.1.12"
async-io = "2.6"
chrono = { version = "0.4", default-features = false }
crc = "3.3"
defmt = "0.3"
deku = { git = "https://github.com/CodeConstruct/deku.git", tag = "cc/deku-v0.19.1/no-alloc-3", default-features = false }
defmt = "1"
deku = { version = "0.20.3", default-features = false }
embedded-io-adapters = { version = "0.6", features = ["std", "futures-03"] }
embedded-io-async = "0.6"
embedded-io = "0.6"
Expand Down
1 change: 1 addition & 0 deletions mctp-estack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ embedded-io-adapters = { workspace = true }
env_logger = { workspace = true }
futures = "0.3"
proptest = { workspace = true }
async-io = { workspace = true }
smol = { workspace = true }


Expand Down
1 change: 1 addition & 0 deletions mctp-estack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ struct Flow {

/// An opaque identifier that applications can use to associate responses.
#[derive(Debug, Eq, PartialEq, Clone, Copy, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct AppCookie(pub usize);

/// Low level MCTP stack.
Expand Down
2 changes: 1 addition & 1 deletion mctp-estack/tests/roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ where
F: Future<Output = R>,
{
let pktloop = router_loop(routera, routerb);
smol::block_on(async {
async_io::block_on(async {
select! {
res = test.fuse() => {
info!("Finished");
Expand Down
2 changes: 1 addition & 1 deletion mctp-linux/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ categories = ["network-programming", "embedded", "hardware-support", "os::linux-
[dependencies]
libc = "0.2"
mctp = { workspace = true, features = ["std"] }
smol = { workspace = true }
async-io = { workspace = true }

[[example]]
name = "mctp-req"
Expand Down
2 changes: 1 addition & 1 deletion mctp-linux/examples/async-req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() -> std::io::Result<()> {
let tx_buf = vec![0x02u8];
let mut rx_buf = vec![0u8; 16];

let (typ, ic, rx_buf) = smol::block_on(async {
let (typ, ic, rx_buf) = async_io::block_on(async {
ep.send(MCTP_TYPE_CONTROL, &tx_buf).await?;
ep.recv(&mut rx_buf).await
})?;
Expand Down
2 changes: 1 addition & 1 deletion mctp-linux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
//! single-endpoint communication; general MCTP requesters may want a different
//! socket model.

use async_io::Async;
use core::mem;
use smol::Async;
use std::fmt;
use std::io::Error;
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, OwnedFd, RawFd};
Expand Down
2 changes: 1 addition & 1 deletion pldm-file/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ anyhow = "1.0"
chrono = { workspace = true, features = ["clock"] }
mctp-linux = { workspace = true }
pldm-platform = { workspace = true, features = ["alloc"] }
smol = "2.0"
async-io = { workspace = true }
env_logger = "0.11.3"

[features]
Expand Down
2 changes: 1 addition & 1 deletion pldm-file/examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const EID: Eid = Eid(8);
fn main() -> Result<()> {
let mut req = MctpLinuxAsyncReq::new(EID, None)?;

smol::block_on(async {
async_io::block_on(async {
let mcm_prop =
df_properties(&mut req, DfProperty::MaxConcurrentMedium).await;
let fds_prop =
Expand Down
2 changes: 1 addition & 1 deletion pldm-file/examples/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ fn main() -> Result<()> {

let mut buf = [0u8; 4096];

smol::block_on(async {
async_io::block_on(async {
loop {
let (typ, _ic, buf, chan) = listener.recv(&mut buf).await?;

Expand Down
2 changes: 1 addition & 1 deletion pldm-platform-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ log = { workspace = true }
mctp = { workspace = true }
mctp-linux = { workspace = true }
pldm-platform = { workspace = true, features = ["std"] }
smol = { workspace = true }
async-io = { workspace = true }

[features]
deku-debug = ["deku/logging"]
2 changes: 1 addition & 1 deletion pldm-platform-util/src/bin/pldm-platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fn enable_command_state_event_enable(event: &Option<String>) -> Result<bool> {
}

fn main() -> anyhow::Result<()> {
smol::block_on(async_main())
async_io::block_on(async_main())
}

async fn async_main() -> anyhow::Result<()> {
Expand Down
14 changes: 6 additions & 8 deletions pldm-platform/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,14 @@ where
) -> core::result::Result<Self, DekuError> {
let Limit::Count(count) = limit else {
return Err(DekuError::Assertion(
"Only count implemented for heapless::Vec".into(),
"Only count implemented for heapless::Vec",
));
};

let mut v = heapless::Vec::new();
for _ in 0..count {
v.push(T::from_reader_with_ctx(reader, ctx)?).map_err(|_| {
DekuError::InvalidParam("Too many elements".into())
})?
v.push(T::from_reader_with_ctx(reader, ctx)?)
.map_err(|_| DekuError::InvalidParam("Too many elements"))?
}

Ok(VecWrap(v))
Expand Down Expand Up @@ -338,15 +337,14 @@ where
) -> core::result::Result<Self, DekuError> {
let Limit::Count(count) = limit else {
return Err(DekuError::Assertion(
"Only count implemented for heapless::Vec".into(),
"Only count implemented for heapless::Vec",
));
};

let mut v = heapless::Vec::new();
for _ in 0..count {
v.push(u8::from_reader_with_ctx(reader, ())?).map_err(|_| {
DekuError::InvalidParam("Too many elements".into())
})?
v.push(u8::from_reader_with_ctx(reader, ())?)
.map_err(|_| DekuError::InvalidParam("Too many elements"))?
}

Ok(AsciiString(VecWrap(v)))
Expand Down
1 change: 1 addition & 0 deletions standalone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ log = { workspace = true }
mctp-estack = { workspace = true, default-features = true, features = ["async"] }
mctp = { workspace = true }
smol = { workspace = true }
async-io = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion standalone/examples/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn main() -> Result<()> {
.write(true)
.read(true)
.open(args.serial)?;
let s = smol::Async::new(s)?;
let s = async_io::Async::new(s)?;
let s = embedded_io_adapters::futures_03::FromFutures::new(s);

let eid = Eid(13);
Expand Down
2 changes: 1 addition & 1 deletion standalone/examples/req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn main() -> Result<()> {
.write(true)
.read(true)
.open(args.serial)?;
let s = smol::Async::new(s)?;
let s = async_io::Async::new(s)?;
let s = embedded_io_adapters::futures_03::FromFutures::new(s);

let own_eid = Eid::new_normal(93).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions standalone/src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<S: Read + Write> Inner<S> {
match r {
SendOutput::Packet(p) => {
let fut = self.mctpserial.send_async(p, &mut self.serial);
smol::block_on(fut)?;
async_io::block_on(fut)?;
}
SendOutput::Complete { tag, .. } => break Ok(tag),
SendOutput::Error { err, .. } => break Err(err),
Expand Down Expand Up @@ -114,7 +114,7 @@ impl<S: Read + Write> Inner<S> {
Err(mctp::Error::TimedOut)
});

let pkt = smol::block_on(r)?;
let pkt = async_io::block_on(r)?;

let r = self.mctp.receive(pkt)?;

Expand Down
Loading