aboutsummaryrefslogtreecommitdiff
path: root/src/ioctl.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-04-27 18:23:36 +0000
committerGitHub <[email protected]>2023-04-27 18:23:36 +0000
commitc19de2984751ba6fa2972ee66cfa2a6310d5f0c1 (patch)
tree9ba8fa01994be9ef43af404cb4399854e8c6de22 /src/ioctl.rs
parentf4bfda345d3d18232926a87b10333a2e624f4d04 (diff)
parent9e96655757180d7fe32ebff1ed93a35a4c3cff28 (diff)
Merge pull request #63 from kbleeke/generalize-events
rework event handling to allow sending data to `Control`
Diffstat (limited to 'src/ioctl.rs')
-rw-r--r--src/ioctl.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ioctl.rs b/src/ioctl.rs
index 0fee1ad19..66c6a10e5 100644
--- a/src/ioctl.rs
+++ b/src/ioctl.rs
@@ -4,6 +4,8 @@ use core::task::{Poll, Waker};
4 4
5use embassy_sync::waitqueue::WakerRegistration; 5use embassy_sync::waitqueue::WakerRegistration;
6 6
7use crate::fmt::Bytes;
8
7#[derive(Clone, Copy)] 9#[derive(Clone, Copy)]
8pub enum IoctlType { 10pub enum IoctlType {
9 Get = 0, 11 Get = 0,
@@ -108,6 +110,8 @@ impl IoctlState {
108 110
109 pub fn ioctl_done(&self, response: &[u8]) { 111 pub fn ioctl_done(&self, response: &[u8]) {
110 if let IoctlStateInner::Sent { buf } = self.state.get() { 112 if let IoctlStateInner::Sent { buf } = self.state.get() {
113 info!("IOCTL Response: {:02x}", Bytes(response));
114
111 // TODO fix this 115 // TODO fix this
112 (unsafe { &mut *buf }[..response.len()]).copy_from_slice(response); 116 (unsafe { &mut *buf }[..response.len()]).copy_from_slice(response);
113 117
@@ -115,6 +119,8 @@ impl IoctlState {
115 resp_len: response.len(), 119 resp_len: response.len(),
116 }); 120 });
117 self.wake_control(); 121 self.wake_control();
122 } else {
123 warn!("IOCTL Response but no pending Ioctl");
118 } 124 }
119 } 125 }
120} 126}