diff options
| author | kbleeke <[email protected]> | 2023-04-02 20:19:47 +0200 |
|---|---|---|
| committer | kbleeke <[email protected]> | 2023-04-25 19:14:00 +0200 |
| commit | 2d7ba44621fa35abad07d2ddb8b253e815ce2c1f (patch) | |
| tree | 999561ce27e3662a22ee2590c79eaa0791099953 /src/ioctl.rs | |
| parent | 6a1a3e6877053b1b72adb3c1446f4f077ad3b03e (diff) | |
rework event handling to allow sending data
Diffstat (limited to 'src/ioctl.rs')
| -rw-r--r-- | src/ioctl.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ioctl.rs b/src/ioctl.rs index 89b20a2d6..803934cf9 100644 --- a/src/ioctl.rs +++ b/src/ioctl.rs | |||
| @@ -4,6 +4,8 @@ use core::task::{Poll, Waker}; | |||
| 4 | 4 | ||
| 5 | use embassy_sync::waitqueue::WakerRegistration; | 5 | use embassy_sync::waitqueue::WakerRegistration; |
| 6 | 6 | ||
| 7 | use crate::fmt::Bytes; | ||
| 8 | |||
| 7 | #[derive(Clone, Copy)] | 9 | #[derive(Clone, Copy)] |
| 8 | pub enum IoctlType { | 10 | pub enum IoctlType { |
| 9 | Get = 0, | 11 | Get = 0, |
| @@ -100,6 +102,8 @@ impl IoctlState { | |||
| 100 | 102 | ||
| 101 | pub fn ioctl_done(&self, response: &[u8]) { | 103 | pub fn ioctl_done(&self, response: &[u8]) { |
| 102 | if let IoctlStateInner::Sent { buf } = self.state.get() { | 104 | if let IoctlStateInner::Sent { buf } = self.state.get() { |
| 105 | info!("IOCTL Response: {:02x}", Bytes(response)); | ||
| 106 | |||
| 103 | // TODO fix this | 107 | // TODO fix this |
| 104 | (unsafe { &mut *buf }[..response.len()]).copy_from_slice(response); | 108 | (unsafe { &mut *buf }[..response.len()]).copy_from_slice(response); |
| 105 | 109 | ||
| @@ -107,6 +111,8 @@ impl IoctlState { | |||
| 107 | resp_len: response.len(), | 111 | resp_len: response.len(), |
| 108 | }); | 112 | }); |
| 109 | self.wake_control(); | 113 | self.wake_control(); |
| 114 | } else { | ||
| 115 | warn!("IOCTL Response but no pending Ioctl"); | ||
| 110 | } | 116 | } |
| 111 | } | 117 | } |
| 112 | } | 118 | } |
