Fix sudo
in #OpenSUSE #Tumbleweed:
$ sudo cat /etc/polkit-1/rules.d/60-local.rules
polkit.addRule(function(action, subject) {
if (subject.isInGroup("wheel")) {
return polkit.Result.AUTH_SELF_KEEP;
}
});
$ sudo systemctl restart polkit.service
I.e. when root login has been disabled earlier with:
# passwd -d root
# passwd -l root
This feels a glitch but works:
impl Drop for Main {
fn drop(&mut self) {
eprintln!("end\n");
terminal::disable_raw_mode().expect("terminal::disable_raw_mode()");
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _main = Main;
I wonder if there is a leaner pattern. This is pretty good Rust exercise/refresher project as you have input handling, command-line arguments, streaming, interactive i/o and file transfer later on. All basics of most system software. And nothing too fancy so that the project does not blow up out of proportions. #rustlang
Serial TTY sessions are working now. The next stop is #zmodem:
target/debug/tior
Connect to serial port
Usage: tior [OPTIONS] <COMMAND>
Commands:
open Open TTY
list List available devices
help Print this message or the help of the given subcommand(s)
Options:
-s, --speed <SPEED> Line speed [default: 115200]
-d, --data-bits <DATA_BITS> Line data bits [default: 8]
-f, --flow-control <FLOW_CONTROL> Flow control [default: none] [possible values: none, software, hardware]
-p, --parity <PARITY> Parity [default: none] [possible values: none, odd, even]
-h, --help Print help
-V, --version Print version
The binary is about 5.8 MiB after the strip, not too bad.
This also shows that Rust main site maintainers have really thought the integrity here so that it is easy for user and fairly secure. Theres a reason why --proto '=https' --tlsv1.2
is there, unlike in many other projects. Gives guarantees.
Very cool, started yesterday and I can already talk to my #FPGA :-)
sudo target/debug/tior open /dev/ttyUSB0
Hello World!
init SPI
status: 0x0000000000000025
status: 0x0000000000000025
SPI initialized!
initializing SD...
SD command cmd0 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
Installing #rustup:
alias rustup="curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s --"
E.g.
rustup --no-modify-path
Just though that good to write this up since I see some distributions packaging rustup, which makes no sense (for #rustc and #cargo it does for obvious reasons).
It is also totally safe to run rustup this way kudos to the amazing #TLS 1.2.