Posts
4637
Following
317
Followers
482
Linux kernel hacker and maintainer etc.

OpenPGP: 3AB05486C7752FE1

There’s also serial2 crate but I don’t really understand how to set my own settings. There was a tip from the author on how to do it but it is beyond my knowledge how to apply it. Sticking to serialport because at least it has examples on how to layout the settings.

0
0
0

It is the only virtual terminal crate that got me fully into login prompt with stream coming from serialport crate surrounded by BufReader.

1
0
0

Jarkko Sakkinen

Edited 1 year ago

For managing #terminal in #Rust the best option after trying a bunch is avt. The reason is that it has been thrown out a lot with the applications it has been used for. Not so easily found as not available in the #cargo repository. For framework like #ratatui it is pretty trivia to integrate as the the representation is just frame buffer as a byte array.

All various ratatui and tui-rs derived frameworks are pretty immature compared to its robustness. It is much better idea to just decorate avt as it feels quite rock solid with the streamed data.

#rustlang

1
0
1

not the way to do it. instead:

polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});
0
0
0

Jarkko Sakkinen

moving from line editor world to the screen editor world #serial #terminal #vt100 #zmodem
0
0
0
or maybe plug and oops...
0
0
0

Jarkko Sakkinen

Edited 1 year ago
With SBC's I've made every board to boot only with console from TTL-USB. Networking etc. gets in the way if you test kernels. This way you can sort of plug and play between the SBC's, like boot kernel with RISC-V SBC and always plug the same wires to 2x USB ports.
1
0
0

Jarkko Sakkinen

My new CI environment for TPM, ARM TEE (TrustZone/SMC) and Linux keyring. Made itself useful within 5 minutes after power on: https://lore.kernel.org/linux-integrity/CX342W32D30U.330BVFC336MA8@kernel.org/T/#t.

Environment: https://github.com/jarkkojs/buildroot-tpmdd/tree/linux-6.6.y
1
0
0

Jarkko Sakkinen

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

#note

1
0
0

Jarkko Sakkinen

Edited 1 year ago
For zmodem built-in transmit workflows allows much less involved experience when a single program has control of the serial port traffic... easier to prevent trashing the session transcript and implement canceling of the file transfer.

i was thinking also that it would nice to have a line input/editor mode (perhaps for larger quantities of text) later on. i guess the point is to make more reliable and robust console when logging into a home router, FPGA board, SBC etc. and not make feature-wise a general purpose tool.
0
0
0

Jarkko Sakkinen

Edited 1 year ago

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

1
0
0

Jarkko Sakkinen

Edited 1 year ago

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.

2
0
0

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.

0
0
0

Jarkko Sakkinen

Edited 1 year ago

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

Most of the time went to learning #clap, #serde and #tokio.

1
0
2

Jarkko Sakkinen

In #OpenSUSE, the package name you want to install is systemd-devel, not libudev-devel 🙂 #udev #linux

0
0
0

Jarkko Sakkinen

Edited 1 year ago

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.

#rustlang

2
0
1
@timojyrinki not that i like always what they do but on average one problem away from life when you can live with the defaults dictated to you :---)
0
0
0

Jarkko Sakkinen

Edited 1 year ago
@timojyrinki I just always use defacto gnome, however they feel to package it. the only savvy thing is probably using #alacritty instead of the default terminal (whatever it is called these days) because tabs are extra clutter when you have a #tmux session.

and right, because alacritty configuration is just a single file, i.e. easy to store to git with the rest of the dotfiles, and having terminal configured correctly whenever needed is pretty essential...
1
0
0
@vbabka i guess so too. do not need much else than up-to-date packages, and the QA is probably on average best within rolling release distributions so pretty objective choice tbh :-)
0
0
1

Jarkko Sakkinen

Edited 1 year ago
@timojyrinki I need just latest versions of git, nvim etc. and stable desktop. The main reason for switching from Debian. Especially I've been frustrated on downloading nvim binary from Github all the time since nvim version sticks at 0.7.something. I hate configuring my desktop and that is already way too much overhead :-) Other than latest packages, it is all the same for me what distro it is tbh.

I mean all tuning energy is already overconsumed by work so unnecessary extras just for the joy is not my thing. I even gave my NVIDIA RTX card to my daughter so that she can play some new Harry Potter game and bought Arc A770 because usually Intel GPU's have better chances to work out-of-the-box (even tho it is getting better for NVIDIA but I think this still a good bet).
0
0
1
Show older