made the port an argument

This commit is contained in:
Robin Löhn 2025-09-25 20:23:22 +02:00
parent 073113a144
commit d5309d592b
Signed by: robin
GPG key ID: 4F5CDA3F9635EB10

View file

@ -1,6 +1,7 @@
use reqwest::Client; use reqwest::Client;
use serde::Deserialize; use serde::Deserialize;
use serial::prelude::*; use serial::prelude::*;
use std::env;
use std::io; use std::io;
use std::str::from_utf8; use std::str::from_utf8;
use std::time::Duration; use std::time::Duration;
@ -43,7 +44,9 @@ struct ImageLinks {
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
let mut port = serial::open("/dev/ttyACM0").unwrap(); let args: Vec<String> = env::args().collect();
let path_to_scanner = &args[1];
let mut port = serial::open(path_to_scanner).unwrap();
interact(&mut port).await.unwrap(); interact(&mut port).await.unwrap();
} }