mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
add better handling for wfx HIF err condition
This commit is contained in:
parent
3f2f304202
commit
5ef7126ede
5 changed files with 18 additions and 5 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -477,7 +477,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "com_rs"
|
name = "com_rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/betrusted-io/com_rs.git?rev=7df87fd4914eb3d2f74bf630aa0b828123368fce#7df87fd4914eb3d2f74bf630aa0b828123368fce"
|
source = "git+https://github.com/betrusted-io/com_rs.git?rev=f7c46612a4181e3d33ec6c5fc90740062d2d9832#f7c46612a4181e3d33ec6c5fc90740062d2d9832"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "com_rs-ref"
|
name = "com_rs-ref"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ description = "com_rs import package"
|
||||||
|
|
||||||
# Dependency policy: fully specify dependencies to the minor version number
|
# Dependency policy: fully specify dependencies to the minor version number
|
||||||
[dependencies]
|
[dependencies]
|
||||||
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "7df87fd4914eb3d2f74bf630aa0b828123368fce" }
|
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "f7c46612a4181e3d33ec6c5fc90740062d2d9832" }
|
||||||
#com_rs = { path = "../../../betrusted-ec/sw/com_rs" }
|
#com_rs = { path = "../../../betrusted-ec/sw/com_rs" }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,7 @@ pub enum ComIntSources {
|
||||||
WlanRxErr,
|
WlanRxErr,
|
||||||
Disconnect,
|
Disconnect,
|
||||||
Connect,
|
Connect,
|
||||||
|
WfxErr,
|
||||||
Invalid,
|
Invalid,
|
||||||
}
|
}
|
||||||
impl From<u16> for ComIntSources {
|
impl From<u16> for ComIntSources {
|
||||||
|
|
@ -323,6 +324,7 @@ impl From<u16> for ComIntSources {
|
||||||
com_rs_ref::INT_WLAN_RX_ERROR => ComIntSources::WlanRxErr,
|
com_rs_ref::INT_WLAN_RX_ERROR => ComIntSources::WlanRxErr,
|
||||||
com_rs_ref::INT_WLAN_DISCONNECT => ComIntSources::Disconnect,
|
com_rs_ref::INT_WLAN_DISCONNECT => ComIntSources::Disconnect,
|
||||||
com_rs_ref::INT_WLAN_CONNECT_EVENT => ComIntSources::Connect,
|
com_rs_ref::INT_WLAN_CONNECT_EVENT => ComIntSources::Connect,
|
||||||
|
com_rs_ref::INT_WLAN_WFX_ERR => ComIntSources::WfxErr,
|
||||||
_ => ComIntSources::Invalid,
|
_ => ComIntSources::Invalid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -339,6 +341,7 @@ impl From<ComIntSources> for u16 {
|
||||||
ComIntSources::WlanRxErr => com_rs_ref::INT_WLAN_RX_ERROR,
|
ComIntSources::WlanRxErr => com_rs_ref::INT_WLAN_RX_ERROR,
|
||||||
ComIntSources::Connect => com_rs_ref::INT_WLAN_CONNECT_EVENT,
|
ComIntSources::Connect => com_rs_ref::INT_WLAN_CONNECT_EVENT,
|
||||||
ComIntSources::Disconnect => com_rs_ref::INT_WLAN_DISCONNECT,
|
ComIntSources::Disconnect => com_rs_ref::INT_WLAN_DISCONNECT,
|
||||||
|
ComIntSources::WfxErr => com_rs_ref::INT_WLAN_WFX_ERR,
|
||||||
ComIntSources::Invalid => 0,
|
ComIntSources::Invalid => 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use crate::ComIntSources;
|
||||||
const BOOT_POLL_INTERVAL_MS: usize = 3_758; // a slightly faster poll during boot so we acquire wifi faster once PDDB is mounted
|
const BOOT_POLL_INTERVAL_MS: usize = 3_758; // a slightly faster poll during boot so we acquire wifi faster once PDDB is mounted
|
||||||
/// this is shared externally so other functions (e.g. in status bar) that want to query the net manager know how long to back off, otherwise the status query will block
|
/// this is shared externally so other functions (e.g. in status bar) that want to query the net manager know how long to back off, otherwise the status query will block
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
const POLL_INTERVAL_MS: usize = 10_151; // stagger slightly off of an integer-seconds interval to even out loads. impacts rssi update frequency.
|
const POLL_INTERVAL_MS: usize = 7_151; // stagger slightly off of an integer-seconds interval to even out loads. impacts rssi update frequency.
|
||||||
const INTERVALS_BEFORE_RETRY: usize = 3; // how many poll intervals we'll wait before we give up and try a new AP
|
const INTERVALS_BEFORE_RETRY: usize = 3; // how many poll intervals we'll wait before we give up and try a new AP
|
||||||
|
|
||||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||||
|
|
@ -199,8 +199,10 @@ pub(crate) fn connection_manager(sid: xous::SID, activity_interval: Arc<AtomicU3
|
||||||
log::debug!("debug: {:x}, {:x}", ints, raw_arg);
|
log::debug!("debug: {:x}, {:x}", ints, raw_arg);
|
||||||
let mut mask_bit: u16 = 1;
|
let mut mask_bit: u16 = 1;
|
||||||
for _ in 0..16 {
|
for _ in 0..16 {
|
||||||
match ComIntSources::from(mask_bit & (ints as u16)) {
|
let source = ComIntSources::from(mask_bit & (ints as u16));
|
||||||
|
match source {
|
||||||
ComIntSources::Connect => {
|
ComIntSources::Connect => {
|
||||||
|
log::info!("{:?}", source);
|
||||||
wifi_state = match ConnectResult::decode_u16(raw_arg as u16) {
|
wifi_state = match ConnectResult::decode_u16(raw_arg as u16) {
|
||||||
ConnectResult::Success => {
|
ConnectResult::Success => {
|
||||||
com.set_ssid_scanning(false).unwrap();
|
com.set_ssid_scanning(false).unwrap();
|
||||||
|
|
@ -218,12 +220,14 @@ pub(crate) fn connection_manager(sid: xous::SID, activity_interval: Arc<AtomicU3
|
||||||
log::debug!("comint new wifi state: {:?}", wifi_state);
|
log::debug!("comint new wifi state: {:?}", wifi_state);
|
||||||
}
|
}
|
||||||
ComIntSources::Disconnect => {
|
ComIntSources::Disconnect => {
|
||||||
|
log::info!("{:?}", source);
|
||||||
ssid_list.clear(); // clear the ssid list because a likely cause of disconnect is we've moved out of range
|
ssid_list.clear(); // clear the ssid list because a likely cause of disconnect is we've moved out of range
|
||||||
com.set_ssid_scanning(true).unwrap();
|
com.set_ssid_scanning(true).unwrap();
|
||||||
scan_state = SsidScanState::Scanning;
|
scan_state = SsidScanState::Scanning;
|
||||||
wifi_state = WifiState::Disconnected;
|
wifi_state = WifiState::Disconnected;
|
||||||
},
|
},
|
||||||
ComIntSources::WlanSsidScanUpdate => {
|
ComIntSources::WlanSsidScanUpdate => {
|
||||||
|
log::info!("{:?}", source);
|
||||||
// aggressively pre-fetch results so we can connect as soon as we see an SSID
|
// aggressively pre-fetch results so we can connect as soon as we see an SSID
|
||||||
match com.ssid_fetch_as_list() {
|
match com.ssid_fetch_as_list() {
|
||||||
Ok(slist) => {
|
Ok(slist) => {
|
||||||
|
|
@ -233,9 +237,9 @@ pub(crate) fn connection_manager(sid: xous::SID, activity_interval: Arc<AtomicU3
|
||||||
},
|
},
|
||||||
_ => continue,
|
_ => continue,
|
||||||
}
|
}
|
||||||
log::debug!("ssid scan update");
|
|
||||||
},
|
},
|
||||||
ComIntSources::WlanSsidScanFinished => {
|
ComIntSources::WlanSsidScanFinished => {
|
||||||
|
log::info!("{:?}", source);
|
||||||
match com.ssid_fetch_as_list() {
|
match com.ssid_fetch_as_list() {
|
||||||
Ok(slist) => {
|
Ok(slist) => {
|
||||||
for (_rssi, ssid) in slist.iter() {
|
for (_rssi, ssid) in slist.iter() {
|
||||||
|
|
@ -247,6 +251,7 @@ pub(crate) fn connection_manager(sid: xous::SID, activity_interval: Arc<AtomicU3
|
||||||
scan_state = SsidScanState::Idle;
|
scan_state = SsidScanState::Idle;
|
||||||
}
|
}
|
||||||
ComIntSources::WlanIpConfigUpdate => {
|
ComIntSources::WlanIpConfigUpdate => {
|
||||||
|
log::info!("{:?}", source);
|
||||||
activity_interval.store(0, Ordering::SeqCst);
|
activity_interval.store(0, Ordering::SeqCst);
|
||||||
wifi_state = WifiState::Connected;
|
wifi_state = WifiState::Connected;
|
||||||
log::debug!("comint new wifi state: {:?}", wifi_state);
|
log::debug!("comint new wifi state: {:?}", wifi_state);
|
||||||
|
|
@ -259,6 +264,10 @@ pub(crate) fn connection_manager(sid: xous::SID, activity_interval: Arc<AtomicU3
|
||||||
buf.send(sub, WifiStateCallback::Update.to_u32().unwrap()).or(Err(xous::Error::InternalError)).unwrap();
|
buf.send(sub, WifiStateCallback::Update.to_u32().unwrap()).or(Err(xous::Error::InternalError)).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ComIntSources::WfxErr => {
|
||||||
|
log::info!("{:?}", source);
|
||||||
|
wifi_state = WifiState::Error;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
mask_bit <<= 1;
|
mask_bit <<= 1;
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ fn xmain() -> ! {
|
||||||
com_int_list.push(ComIntSources::Disconnect);
|
com_int_list.push(ComIntSources::Disconnect);
|
||||||
com_int_list.push(ComIntSources::WlanSsidScanUpdate);
|
com_int_list.push(ComIntSources::WlanSsidScanUpdate);
|
||||||
com_int_list.push(ComIntSources::WlanSsidScanFinished);
|
com_int_list.push(ComIntSources::WlanSsidScanFinished);
|
||||||
|
com_int_list.push(ComIntSources::WfxErr);
|
||||||
com.ints_enable(&com_int_list);
|
com.ints_enable(&com_int_list);
|
||||||
com_int_list.clear();
|
com_int_list.clear();
|
||||||
com.ints_get_active(&mut com_int_list);
|
com.ints_get_active(&mut com_int_list);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue