Commit Graph

45 Commits

Author SHA1 Message Date
Konrad Dybcio
8985dc7023 README: now you can actually read me 2024-06-18 02:19:20 +02:00
Konrad Dybcio
5a9168b40f cli: Add a non-interactive control utility
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-06-18 00:56:53 +02:00
Konrad Dybcio
b0b60406e3 treewide: Move things around
More binaries inbound

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-06-18 00:56:53 +02:00
Konrad Dybcio
42730503b4 src/main: Abstract SSH-specific code
There are other cool protocols in the wild

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-06-18 00:56:53 +02:00
Konrad Dybcio
e9eefd21e6 Cargo.lock: cargo update
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-06-18 00:56:53 +02:00
Konrad Dybcio
859bddb5f8 main+lib: Clean up macros further
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:05:03 +02:00
Konrad Dybcio
ce1145c373 Cargo.lock: cargo update
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:05:03 +02:00
Konrad Dybcio
89689ec128 Cargo.toml: Set BSD3
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:05:03 +02:00
Konrad Dybcio
39099057e2 main+lib: Implement almost all special keys
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:05:03 +02:00
Konrad Dybcio
c41df0a744 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-21 23:05:03 +02:00
Konrad Dybcio
883752dfe7 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-21 23:05:03 +02:00
Konrad Dybcio
3e6ce0127e 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-21 23:05:03 +02:00
Konrad Dybcio
5bf2dcc137 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-21 23:05:03 +02:00
Konrad Dybcio
143159b868 main+lib: Locky lock, implement console writing
Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
2024-05-21 23:05:03 +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