Commit Graph

40 Commits

Author SHA1 Message Date
Konrad Dybcio 6619020cab main+lib: Clean up macros further
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:01:22 +02:00
Konrad Dybcio fc4cdad412 Cargo.lock: cargo update
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:01:22 +02:00
Konrad Dybcio 309149259a Cargo.toml: Set BSD3
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:01:20 +02:00
Konrad Dybcio 703c215a58 main+lib: Implement almost all special keys
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-07 14:10:54 +02:00
Konrad Dybcio b8e622dfa4 main+lib: Allow for interrupting image sending
This could probably be generalized to all messages, but apart from
this one, I think it would only make sense to also handle this for
cases where the user pastes 1.5GiB of plaintext into MsgConsole, but
then stdin is clogged up and there's no signals, so CTRL+A would wait
for its turn anyway..

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-07 14:06:16 +02:00
Konrad Dybcio f2a9e7f229 main: Stop the write(ln)!(stdout()..) craziness
stop the crossterm docs propaganda and flush stdout where ncessary

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-07 14:06:16 +02:00
Konrad Dybcio c9d457f8ba main: Replace LF with CRLF for server status updates
These can apparently be handled too slow (because the stdin handler
thread takes its sweet time to spin up?), and receiving e.g. the
hello message ("Starting cdba server") and some warning (like
"cdba-server: Please switch to yaml config for ftdi_gpio configuration")
separated with a single LF char on the server side ends up with a
janky printout.

This is not ideal, but I suppose acking of the server status updates
could be introduced in a future update..

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-07 14:05:59 +02:00
Konrad Dybcio a450862cdd lib: Use greentext to signify send_image progress
not to be confused with 4chan memes

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-07 03:32:39 +02:00
Konrad Dybcio 83abd2274a main+lib: Locky lock, implement console writing
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-07 03:32:39 +02:00
Konrad Dybcio 90e7bfd69e main: Add some context to early returns
Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
2024-05-06 23:44:14 +02:00
Dmitry Baryshkov c9644fd423 main: get rid of unwrap()
Replace .unwrap() with the question-mark returns. The main function can
only choke on the std::io::Error, so it's simple to return this kind of
errors.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov dfe093c804 lib: drop unwrap() from send_msg()
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov e901247cd2 lib: use write! to send image percentage
Use write! instead of writeln! to remove extra linewraps.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov f49bcf417f main: simplify buffer handling
Use temporary mutable slice to reference a part of the buffer that is
used for the data.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov b50f910fb5 lib: print_string_msg: drop length argument
There is no need to pass addtional buffer size, use slice length
instead.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov eedd28230b lib: console_print: drop length argument
There is no need to pass addtional buffer size, use slice length
instead.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov fea5839501 lib: use write_all in send_msg()
Use write_all() instead of write() to send the whole buffer.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov 7bd68c3239 lib: stop using bincode::serialize()
There is little point in using bincode::serialize(). Serialize the
header manually, reducing the footprint.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Dmitry Baryshkov d661e0e8d2 lib: drop size attribute from send_msg
There is no need to pass size in addition to the slice. Use buf.len()
instead.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2024-05-06 22:55:02 +02:00
Konrad Dybcio 72dd9fb2d4 ci: Add Windows/macOS
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-01 23:01:29 +02:00
Konrad Dybcio e876b75c0e ci: matrix 2024-05-01 23:01:29 +02:00
Konrad Dybcio 41860310b5 main.rs: Redefine todo! for raw mode TTY
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-01 23:01:04 +02:00
Konrad Dybcio 67fe7d0cd5 main.rs: Fix the "Goodbye"
Add a condition to let the key-watching loop stop

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-01 23:01:04 +02:00
Konrad Dybcio d02d6b5ef1 main.rs: Print "sk8brd vVERNUM" at startup
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-01 23:01:04 +02:00
Konrad Dybcio 51339dd720 main.rs: Don't open code send_ack
it was made for this

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-01 23:01:04 +02:00