diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-04-24 20:47:37 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-24 20:47:37 +0000 |
| commit | a1746f4ddac734cd8912007b6155ca340df89f19 (patch) | |
| tree | eb92a11c250eee2797e14357a8baf5172d9d9dec /embassy-net | |
| parent | b578e060d731434e900b0e70adc5b560a2f595b4 (diff) | |
| parent | d409026b95c24c1582e17d3f40daea2b75cb9304 (diff) | |
Merge #717
717: WIP: USB CDC NCM (Ethernet over USB) r=Dirbaio a=Dirbaio
TODO:
- [x] Add support for string handling in `embassy-usb`, remove the MAC addr string hax
- [x] Harden parsing of incoming NTBs to avoid panics.
- [ ] Parse all datagrams in a NDP, not just the first. -- tricky, I've made it tell the host we support only one packet per NTB instead.
- [ ] Add support for all required control transfers. -- WONTFIX, seems no OS cares about those.
- [x] Works on Linux
- [x] Doesn't work on Android, make it work
- [x] Check if it works in Windows (Win10 has some sort of CDC NCM support afaict?) -- works on Win11, CDC-NCM not supported on Win10
- [x] Check if it works in MacOS (I don't know if it's supposed to) - WORKS
I won't add the `embassy-net` driver to `embassy-usb-ncm` for now because `embassy-net` buffer management will likely be refactored soon, so there's not much point to it.
Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'embassy-net')
| -rw-r--r-- | embassy-net/src/tcp_socket.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/embassy-net/src/tcp_socket.rs b/embassy-net/src/tcp_socket.rs index 4836f8075..5637505d4 100644 --- a/embassy-net/src/tcp_socket.rs +++ b/embassy-net/src/tcp_socket.rs | |||
| @@ -58,7 +58,7 @@ impl<'a> TcpSocket<'a> { | |||
| 58 | .await | 58 | .await |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | pub async fn listen<T>(&mut self, local_endpoint: T) -> Result<()> | 61 | pub async fn accept<T>(&mut self, local_endpoint: T) -> Result<()> |
| 62 | where | 62 | where |
| 63 | T: Into<IpEndpoint>, | 63 | T: Into<IpEndpoint>, |
| 64 | { | 64 | { |
| @@ -66,9 +66,7 @@ impl<'a> TcpSocket<'a> { | |||
| 66 | 66 | ||
| 67 | futures::future::poll_fn(|cx| { | 67 | futures::future::poll_fn(|cx| { |
| 68 | self.with(|s, _| match s.state() { | 68 | self.with(|s, _| match s.state() { |
| 69 | TcpState::Closed | TcpState::TimeWait => Poll::Ready(Err(Error::Unaddressable)), | 69 | TcpState::Listen | TcpState::SynSent | TcpState::SynReceived => { |
| 70 | TcpState::Listen => Poll::Ready(Ok(())), | ||
| 71 | TcpState::SynSent | TcpState::SynReceived => { | ||
| 72 | s.register_send_waker(cx.waker()); | 70 | s.register_send_waker(cx.waker()); |
| 73 | Poll::Pending | 71 | Poll::Pending |
| 74 | } | 72 | } |
