rustfmt.
This commit is contained in:
parent
2a035a24a6
commit
9c4df46c46
@ -345,7 +345,9 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rx(&mut self, packet: &mut [u8]) {
|
fn rx(&mut self, packet: &mut [u8]) {
|
||||||
let Some((sdpcm_header, payload)) = SdpcmHeader::parse(packet) else { return };
|
let Some((sdpcm_header, payload)) = SdpcmHeader::parse(packet) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
self.update_credit(&sdpcm_header);
|
self.update_credit(&sdpcm_header);
|
||||||
|
|
||||||
@ -353,7 +355,9 @@ where
|
|||||||
|
|
||||||
match channel {
|
match channel {
|
||||||
CHANNEL_TYPE_CONTROL => {
|
CHANNEL_TYPE_CONTROL => {
|
||||||
let Some((cdc_header, response)) = CdcHeader::parse(payload) else { return; };
|
let Some((cdc_header, response)) = CdcHeader::parse(payload) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
trace!(" {:?}", cdc_header);
|
trace!(" {:?}", cdc_header);
|
||||||
|
|
||||||
if cdc_header.id == self.ioctl_id {
|
if cdc_header.id == self.ioctl_id {
|
||||||
@ -417,8 +421,12 @@ where
|
|||||||
let status = event_packet.msg.status;
|
let status = event_packet.msg.status;
|
||||||
let event_payload = match evt_type {
|
let event_payload = match evt_type {
|
||||||
Event::ESCAN_RESULT if status == EStatus::PARTIAL => {
|
Event::ESCAN_RESULT if status == EStatus::PARTIAL => {
|
||||||
let Some((_, bss_info)) = ScanResults::parse(evt_data) else { return };
|
let Some((_, bss_info)) = ScanResults::parse(evt_data) else {
|
||||||
let Some(bss_info) = BssInfo::parse(bss_info) else { return };
|
return;
|
||||||
|
};
|
||||||
|
let Some(bss_info) = BssInfo::parse(bss_info) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
events::Payload::BssInfo(*bss_info)
|
events::Payload::BssInfo(*bss_info)
|
||||||
}
|
}
|
||||||
Event::ESCAN_RESULT => events::Payload::None,
|
Event::ESCAN_RESULT => events::Payload::None,
|
||||||
@ -439,7 +447,9 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CHANNEL_TYPE_DATA => {
|
CHANNEL_TYPE_DATA => {
|
||||||
let Some((_, packet)) = BdcHeader::parse(payload) else { return };
|
let Some((_, packet)) = BdcHeader::parse(payload) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
trace!("rx pkt {:02x}", Bytes(&packet[..packet.len().min(48)]));
|
trace!("rx pkt {:02x}", Bytes(&packet[..packet.len().min(48)]));
|
||||||
|
|
||||||
match self.ch.try_rx_buf() {
|
match self.ch.try_rx_buf() {
|
||||||
|
@ -54,7 +54,9 @@ impl<'a> Control<'a> {
|
|||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
let resp = self.ioctl(req).await;
|
let resp = self.ioctl(req).await;
|
||||||
let proto::CtrlMsgPayload::RespConnectAp(resp) = resp.payload.unwrap() else { panic!("unexpected resp") };
|
let proto::CtrlMsgPayload::RespConnectAp(resp) = resp.payload.unwrap() else {
|
||||||
|
panic!("unexpected resp")
|
||||||
|
};
|
||||||
debug!("======= {:?}", Debug2Format(&resp));
|
debug!("======= {:?}", Debug2Format(&resp));
|
||||||
assert_eq!(resp.resp, 0);
|
assert_eq!(resp.resp, 0);
|
||||||
self.state_ch.set_link_state(LinkState::Up);
|
self.state_ch.set_link_state(LinkState::Up);
|
||||||
@ -71,7 +73,9 @@ impl<'a> Control<'a> {
|
|||||||
)),
|
)),
|
||||||
};
|
};
|
||||||
let resp = self.ioctl(req).await;
|
let resp = self.ioctl(req).await;
|
||||||
let proto::CtrlMsgPayload::RespGetMacAddress(resp) = resp.payload.unwrap() else { panic!("unexpected resp") };
|
let proto::CtrlMsgPayload::RespGetMacAddress(resp) = resp.payload.unwrap() else {
|
||||||
|
panic!("unexpected resp")
|
||||||
|
};
|
||||||
assert_eq!(resp.resp, 0);
|
assert_eq!(resp.resp, 0);
|
||||||
|
|
||||||
// WHY IS THIS A STRING? WHYYYY
|
// WHY IS THIS A STRING? WHYYYY
|
||||||
@ -100,7 +104,9 @@ impl<'a> Control<'a> {
|
|||||||
payload: Some(proto::CtrlMsgPayload::ReqSetWifiMode(proto::CtrlMsgReqSetMode { mode })),
|
payload: Some(proto::CtrlMsgPayload::ReqSetWifiMode(proto::CtrlMsgReqSetMode { mode })),
|
||||||
};
|
};
|
||||||
let resp = self.ioctl(req).await;
|
let resp = self.ioctl(req).await;
|
||||||
let proto::CtrlMsgPayload::RespSetWifiMode(resp) = resp.payload.unwrap() else { panic!("unexpected resp") };
|
let proto::CtrlMsgPayload::RespSetWifiMode(resp) = resp.payload.unwrap() else {
|
||||||
|
panic!("unexpected resp")
|
||||||
|
};
|
||||||
assert_eq!(resp.resp, 0);
|
assert_eq!(resp.resp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,14 +311,14 @@ where
|
|||||||
fn handle_event(&self, data: &[u8]) {
|
fn handle_event(&self, data: &[u8]) {
|
||||||
let Ok(event) = noproto::read::<CtrlMsg>(data) else {
|
let Ok(event) = noproto::read::<CtrlMsg>(data) else {
|
||||||
warn!("failed to parse event");
|
warn!("failed to parse event");
|
||||||
return
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!("event: {:?}", &event);
|
debug!("event: {:?}", &event);
|
||||||
|
|
||||||
let Some(payload) = &event.payload else {
|
let Some(payload) = &event.payload else {
|
||||||
warn!("event without payload?");
|
warn!("event without payload?");
|
||||||
return
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
match payload {
|
match payload {
|
||||||
|
@ -477,7 +477,7 @@ fn init_pll(num: usize, config: Option<Pll>, input: &PllInput) -> PllOutput {
|
|||||||
p: None,
|
p: None,
|
||||||
q: None,
|
q: None,
|
||||||
r: None,
|
r: None,
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
assert!(1 <= config.prediv && config.prediv <= 63);
|
assert!(1 <= config.prediv && config.prediv <= 63);
|
||||||
|
Loading…
Reference in New Issue
Block a user