Commit Graph

15 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
185a977ff4 linux: Minor code cleanups 2020-03-06 21:17:12 +00:00
Wladimir J. van der Laan
e7de60ebbc linux: Reduce esptun default baudrate more
Changed to `115200 * 4`.
It's hard to get this stable...
2020-02-23 20:22:40 +00:00
Wladimir J. van der Laan
ab95e18ba8 linux: Handle "SEND FAIL" response
UDP sends can fail and then the ESP module returns "SEND FAIL";
we need to handle this, otherwise we'll never consider the send finished.
2020-02-23 20:02:42 +00:00
Wladimir J. van der Laan
7220737241 linux: Use my_err consistently in esptun
Use my_err instead of perror.

Also fix some printf format type mismatches.
2020-02-23 15:00:22 +00:00
Wladimir J. van der Laan
6a5f43b411 linux: Fix false error condition with back-to-back packets
Correct "no progress" check in `esp_read_responses` to avoid issues with
back-to-back packets crashing the tunnel.
2020-02-23 12:48:42 +00:00
Wladimir J. van der Laan
0ebae26c05 linux: Optimize binaries for size 2020-02-22 14:37:06 +00:00
Wladimir J. van der Laan
2819afaae5 linux: Mention mtu setting in esptun doc
The standard tunnel mtu of 1500 will cause packets to be dropped,
causing transferring larger files to fail.
2020-02-22 14:26:29 +00:00
Wladimir J. van der Laan
ce9505e670 linux: Unify logging function in esptun 2020-02-22 13:17:40 +00:00
Wladimir J. van der Laan
afde09e6cc linux: Don't set VTIME in UART configuration for esptun
`read(esp_fd)` should wait for 1 or more characters to be available in
the UART FIFO, no timing required.
2020-02-22 13:01:58 +00:00
Wladimir J. van der Laan
c261d4dcc7 linux: Simplify esptun by getting rid of some helper functions
`cread` and `cwrite` are trivial and only called in one place, so just
integrate them.
2020-02-22 12:55:31 +00:00
Wladimir J. van der Laan
7cbb10693e linux: Set timeout argument on poll() properly
`0` for the timeout means *return immediately* instead of
*wait forever*. This is absolutely unnecessary, so change
the argument to `-1` which does mean *wait until something happens*.
2020-02-22 12:22:25 +00:00
Wladimir J. van der Laan
aab7c0a84b linux: Solve an issue with incomplete packets
esp_read_responses was throwing away the buffer contents between
invocations, which is not a good idea if there might be a (partial)
async notification such a a received packet in there.
2020-02-22 11:40:58 +00:00
Wladimir J. van der Laan
526e9683c2 linux: Tune baudrate in esptun
The maximum baudrate seems unstable at times, tune it down a bit.
2020-02-22 11:24:42 +00:00
Wladimir J. van der Laan
885357f22f linux: deduplicate esp receive logic in esptun
Unify the two similar serial receive loops.
(as a bonus we'll no longer lose packets that come in through the ESP during
esp_tx_packet)
2020-02-22 11:24:42 +00:00
Wladimir J. van der Laan
d9750dcf73 Add k210 linux utilities 2020-02-21 15:42:04 +00:00