From 9c611fc86128feec1894e39b918d6cda949b5374 Mon Sep 17 00:00:00 2001 From: linuswck Date: Mon, 2 Sep 2024 15:39:25 +0800 Subject: [PATCH] main: poll iface for dfu & hard rst ctrl msgs --- src/main.rs | 1 + src/net/cmd_handler.rs | 2 ++ src/net/net.rs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8491693..842694a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -261,6 +261,7 @@ fn main() -> ! { None, &mut socket, ); + net::net::eth_poll_iface(); } }); } diff --git a/src/net/cmd_handler.rs b/src/net/cmd_handler.rs index 080e453..51c13fd 100644 --- a/src/net/cmd_handler.rs +++ b/src/net/cmd_handler.rs @@ -296,6 +296,7 @@ pub fn execute_cmd( unsafe { dfu::set_dfu_trigger(); } + net::eth_poll_iface(); *state = State::HardReset; } Some(DeviceCmd::SetActiveReportMode) => match cmd.json.data_bool { @@ -364,6 +365,7 @@ pub fn execute_cmd( } Some(DeviceCmd::HardReset) => { send_response(buffer, ResponseEnum::Acknowledge, None, socket); + net::eth_poll_iface(); *state = State::PrepareForHardReset; } None => { /* Do Nothing */ } diff --git a/src/net/net.rs b/src/net/net.rs index 233c5b4..b6b3e17 100644 --- a/src/net/net.rs +++ b/src/net/net.rs @@ -433,7 +433,7 @@ pub fn eth_update_iface_poll_timer() { } } -fn eth_poll_iface() { +pub fn eth_poll_iface() { unsafe { if let Some(ref mut server_handle) = SERVER_HANDLE { server_handle.poll_iface();