Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
rnd-ash committed Jul 18, 2024
1 parent 8255a7c commit 890a6f0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 21 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ecu_diagnostics"
version = "0.95.6"
version = "0.95.8"
authors = ["Ashcon Mohseninia <ashconm@outlook.com>"]
edition = "2021"
description = "A rust crate for ECU diagnostic servers and communication APIs"
Expand Down Expand Up @@ -31,21 +31,21 @@ passthru = ["dep:libloading", "dep:shellexpand", "dep:winreg", "dep:serde_json",
automotive_diag = "0.1"
j2534_rust = { version = "1.5.0", optional = true }
serde_json = { version = "1.0.79", optional = true }
libloading = { version = "0.7.3", optional = true }
libloading = { version = "0.8.4", optional = true }
log="0.4.16"
strum = "0.24"
strum_macros = "0.24"
strum = "0.26.3"
strum_macros = "0.26.4"
thiserror="1.0.44"

[dev-dependencies]
env_logger = "0.10.0"
env_logger = "0.11.3"

[target.'cfg(windows)'.dependencies]
winreg = { version = "0.10.1", optional = true }

[target.'cfg(unix)'.dependencies]
shellexpand = { version = "2.1.0", optional = true }
shellexpand = { version = "3.1.0", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
socketcan-isotp = { optional = true, version = "1.0.1" }
socketcan = { version = "2.0.0", optional = true }
socketcan = { version = "3.3.0", optional = true }
2 changes: 1 addition & 1 deletion src/hardware/passthru/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl PassthruDevice {
info.function_lib
);
let lib = info.function_lib.clone();
let drv = Arc::new(Mutex::new(lib_funcs::PassthruDrv::load_lib(lib)?));
let drv = Arc::new(Mutex::new(PassthruDrv::load_lib(lib)?));
let mut lck = drv.lock().unwrap();
let idx = lck.open()?;
let mut ret = Self {
Expand Down
4 changes: 2 additions & 2 deletions src/hardware/passthru/sw_isotp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ impl PtCombiChannel {

// Now decide how long to sleep for
if iso_tp_cfg.is_none() {
std::thread::sleep(std::time::Duration::from_millis(10));
std::thread::sleep(Duration::from_millis(10));
} else {
std::thread::sleep(std::time::Duration::from_millis(1));
std::thread::sleep(Duration::from_millis(1));
}
}
// Teardown
Expand Down
23 changes: 18 additions & 5 deletions src/hardware/socketcan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
time::{Instant, Duration},
};

use socketcan::Socket;
use socketcan::{Socket, SocketOptions};

use socketcan::CanFrame as SocketCanCanFrame;
use socketcan_isotp::{
Expand Down Expand Up @@ -149,7 +149,7 @@ impl PacketChannel<CanFrame> for SocketCanCanChannel {
iface.set_nonblocking(true)?;
} else {
iface.set_nonblocking(false)?;
iface.set_write_timeout(std::time::Duration::from_millis(timeout_ms as u64))?;
iface.set_write_timeout(Duration::from_millis(timeout_ms as u64))?;
}
let mut cf: SocketCanCanFrame;
for p in packets {
Expand Down Expand Up @@ -181,7 +181,7 @@ impl PacketChannel<CanFrame> for SocketCanCanChannel {

} else {
iface.set_nonblocking(false)?;
iface.set_read_timeout(std::time::Duration::from_millis(timeout_ms as u64))?;
iface.set_read_timeout(Duration::from_millis(timeout_ms as u64))?;
let start = Instant::now();
while start.elapsed().as_millis() <= timeout_ms as u128 {
let f = iface.read_frame()?;
Expand Down Expand Up @@ -280,16 +280,29 @@ impl PayloadChannel for SocketCanIsoTPChannel {
rx_ext_address = rx;
}

let opts: IsoTpOptions = IsoTpOptions::new(
let mut opts: IsoTpOptions = IsoTpOptions::new(
flags,
std::time::Duration::from_millis(0),
Duration::from_millis(0),
ext_address,
0xCC,
0xCC,
rx_ext_address,
)
.unwrap();

let mut flags = IsoTpBehaviour::empty();
if self.cfg.pad_frame {
flags |= IsoTpBehaviour::CAN_ISOTP_RX_PADDING;
flags |= IsoTpBehaviour::CAN_ISOTP_TX_PADDING;
}

if self.cfg.extended_addresses.is_some() {
flags |= IsoTpBehaviour::CAN_ISOTP_EXTEND_ADDR;
flags |= IsoTpBehaviour::CAN_ISOTP_RX_EXT_ADDR;
}

opts.set_flags(flags);

let link_opts: LinkLayerOptions = LinkLayerOptions::default();

let (tx_id, rx_id) = match self.cfg.can_use_ext_addr {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
missing_debug_implementations,
missing_copy_implementations,
trivial_numeric_casts,
unstable_features,
unused_imports,
//unstable_features,
//unused_imports,
unused_import_braces,
unused_qualifications,
clippy::uninlined_format_args
Expand Down
8 changes: 4 additions & 4 deletions src/obd2/enumerations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ impl Display for ObdEnumValue {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
ObdEnumValue::FuelSystemStatus(x) => match x {
Standard(v) => std::fmt::Display::fmt(&v, f),
Standard(v) => Display::fmt(&v, f),
_ => f.write_fmt(format_args!("Extended({:#02X})", u32::from(*self))),
},
ObdEnumValue::CommandedAirStatus(x) => match x {
Standard(v) => std::fmt::Display::fmt(&v, f),
Standard(v) => Display::fmt(&v, f),
_ => f.write_fmt(format_args!("Extended({:#02X})", u32::from(*self))),
},
ObdEnumValue::ObdStandard(x) => match x {
Standard(v) => std::fmt::Display::fmt(&v, f),
Standard(v) => Display::fmt(&v, f),
_ => f.write_fmt(format_args!("Extended({:#02X})", u32::from(*self))),
},
ObdEnumValue::FuelType(x) => match x {
Standard(v) => std::fmt::Display::fmt(&v, f),
Standard(v) => Display::fmt(&v, f),
_ => f.write_fmt(format_args!("Extended({:#02X})", u32::from(*self))),
},
}
Expand Down

0 comments on commit 890a6f0

Please sign in to comment.