From 9b80808660c996e9c54249484cd7c8685b689d71 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Wed, 31 May 2023 10:26:24 -0400 Subject: [PATCH 01/41] Fix build issue with main's match statement --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5e38d09..e77ac46 100755 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ fn main(){ log::info!("Seymour Life Testing version: {}",VERSION); let gpio = &mut GpioPins::new(); match std::fs::read_dir("/dev/serial/by-path"){ - Ok(available_ttys){ + Ok(available_ttys)=>{ let mut possible_devices:Vec> = Vec::new(); let mut tty_test_threads:Vec>> = Vec::new(); for possible_tty in available_ttys.into_iter(){ @@ -134,7 +134,7 @@ fn main(){ thread.join().unwrap(); } } - Err(_){ + Err(_)=>{ log::error!("Invalid serial location! Please make sure that /dev/serial/by-path exists."); break; } From c69ead6670dbe4d18c6a258e4e3d31e168f2f380 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Wed, 31 May 2023 10:28:28 -0400 Subject: [PATCH 02/41] Finish fixing build issues --- src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e77ac46..346f804 100755 --- a/src/main.rs +++ b/src/main.rs @@ -136,7 +136,6 @@ fn main(){ } Err(_)=>{ log::error!("Invalid serial location! Please make sure that /dev/serial/by-path exists."); - break; } } } From 39a5feff0f0d5dbdfabbace23587c70501679db6 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Thu, 1 Jun 2023 11:13:41 -0400 Subject: [PATCH 03/41] Speed up init by darkening screen during multithreaded init --- src/device.rs | 3 +++ src/main.rs | 44 ++++++++++++++++++++++++++++---------------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/device.rs b/src/device.rs index 3dab218..a6f4e31 100755 --- a/src/device.rs +++ b/src/device.rs @@ -284,6 +284,9 @@ impl Device{ pub fn get_serial(&mut self) -> &str{ &self.serial } + pub fn get_location(&mut self) -> String{ + std::format!("{:?}",self.usb_tty) + } pub fn set_pin_address(&mut self, address:u8) -> &mut Self{ self.address = Some(address.clone()); let temp = self.gpio.get(address); diff --git a/src/main.rs b/src/main.rs index 346f804..8fb4493 100755 --- a/src/main.rs +++ b/src/main.rs @@ -61,7 +61,10 @@ fn main(){ log::debug!("{} is valid port!",tty_name); let new_device = Device::new(port,Some(response)); match new_device{ - Ok(device) => Some(device), + Ok(mut device) => { + device.darken_screen(); + Some(device) + }, Err(_) => None } } @@ -71,7 +74,6 @@ fn main(){ } }, Err(error)=>{ - //log::warn!("Invalid TTY location"); log::debug!("{}",error); None } @@ -90,28 +92,23 @@ fn main(){ } } + log::info!("\n\n--------------------------------------"); log::info!("Number of devices detected: {}",devices.len()); + log::info!("--------------------------------------\n\n"); - log::info!("Dimming all screens..."); - for device in devices.iter_mut(){ - device.darken_screen(); - } + //log::info!("Dimming all screens..."); + //for device in devices.iter_mut(){ + // device.darken_screen(); + //} for device in devices.iter_mut(){ device.brighten_screen() .set_serial(&input_filtering(Some("Enter the serial of the device with the bright screen: ")).to_string()) .darken_screen(); log::debug!("Number of unassigned addresses: {}",gpio.get_unassigned_addresses().len()); - for &address in gpio.get_unassigned_addresses(){ - device.set_pin_address(address).start_temp(); - if device.is_temp_running(){ - device.stop_temp(); - gpio.remove_address(address); - break; - } - else{ - device.stop_temp(); - } + if !find_gpio(device, gpio){ + device.set_pin_address(21); + log::error!("Unable to find GPIO for device {}. Please ensure that the probe well is installed properly, and the calibration key is plugged in.",device.get_location()); } } @@ -140,6 +137,21 @@ fn main(){ } } +fn find_gpio(device:&mut Device,gpio:&mut GpioPins) -> bool{ + for &address in gpio.get_unassigned_addresses(){ + device.set_pin_address(address).start_temp(); + if device.is_temp_running(){ + device.stop_temp(); + gpio.remove_address(address); + return true; + } + else { + device.stop_temp(); + } + } + return false; +} + pub fn setup_logs(){ let chrono_now: DateTime = Local::now(); if ! Path::new("logs").is_dir(){ From 7fda440641b920176f973e0bfc5db042b1879f38 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Thu, 1 Jun 2023 13:12:02 -0400 Subject: [PATCH 04/41] Add looping option for main loop, if successful --- src/main.rs | 181 +++++++++++++++++++++++++++------------------------- 1 file changed, 93 insertions(+), 88 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8fb4493..0617360 100755 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,10 @@ -use seymour_poc_rust::{device::Device, tty::{self,TTY,Response},gpio_facade::GpioPins}; -use std::{io::{stdin,stdout,Write},thread::{self, JoinHandle},path::Path,fs}; +use seymour_poc_rust::{device::Device, + tty::{self,TTY,Response}, + gpio_facade::GpioPins}; +use std::{io::{stdin,stdout,Write}, + thread::{self, JoinHandle}, + path::Path, + fs}; use chrono::{DateTime,Local}; const VERSION:&str="2.0.1"; @@ -38,102 +43,102 @@ fn input_filtering(prompt:Option<&str>) -> String{ fn main(){ setup_logs(); log::info!("Seymour Life Testing version: {}",VERSION); - let gpio = &mut GpioPins::new(); - match std::fs::read_dir("/dev/serial/by-path"){ - Ok(available_ttys)=>{ - let mut possible_devices:Vec> = Vec::new(); - let mut tty_test_threads:Vec>> = Vec::new(); - for possible_tty in available_ttys.into_iter(){ - tty_test_threads.push( - thread::spawn(move ||{ - let tty_ref = possible_tty.as_ref(); - match tty_ref{ - Ok(tty_real_ref)=>{ - let tty_path = tty_real_ref.path(); - let tty_name = tty_path.to_string_lossy(); - log::info!("Testing port {}. This may take a moment...",&tty_name); - let possible_port = TTY::new(&tty_name); - match possible_port{ - Some(mut port) =>{ - port.write_to_device(tty::Command::Newline); - let response = port.read_from_device(Some(":")); - if response != Response::Empty{ - log::debug!("{} is valid port!",tty_name); - let new_device = Device::new(port,Some(response)); - match new_device{ - Ok(mut device) => { - device.darken_screen(); - Some(device) - }, - Err(_) => None + loop{ + let gpio = &mut GpioPins::new(); + match std::fs::read_dir("/dev/serial/by-path"){ + Ok(available_ttys)=>{ + let mut possible_devices:Vec> = Vec::new(); + let mut tty_test_threads:Vec>> = Vec::new(); + for possible_tty in available_ttys.into_iter(){ + tty_test_threads.push( + thread::spawn(move ||{ + let tty_ref = possible_tty.as_ref(); + match tty_ref{ + Ok(tty_real_ref)=>{ + let tty_path = tty_real_ref.path(); + let tty_name = tty_path.to_string_lossy(); + log::info!("Testing port {}. This may take a moment...",&tty_name); + let possible_port = TTY::new(&tty_name); + match possible_port{ + Some(mut port) =>{ + port.write_to_device(tty::Command::Newline); + let response = port.read_from_device(Some(":")); + if response != Response::Empty{ + log::debug!("{} is valid port!",tty_name); + let new_device = Device::new(port,Some(response)); + match new_device{ + Ok(mut device) => { + device.darken_screen(); + Some(device) + }, + Err(_) => None + } } - } - else { None } - }, - None=>{None} + else { None } + }, + None=>{None} + } + }, + Err(error)=>{ + log::debug!("{}",error); + None } - }, - Err(error)=>{ - log::debug!("{}",error); - None } - } - })); - } - for thread in tty_test_threads{ - let output = thread.join().unwrap_or_else(|x|{log::trace!("{:?}",x); None}); - possible_devices.push(output); - } - - let mut devices:Vec = Vec::new(); - for possible_device in possible_devices.into_iter(){ - if let Some(device) = possible_device{ - devices.push(device); + })); } - } - - log::info!("\n\n--------------------------------------"); - log::info!("Number of devices detected: {}",devices.len()); - log::info!("--------------------------------------\n\n"); - - //log::info!("Dimming all screens..."); - //for device in devices.iter_mut(){ - // device.darken_screen(); - //} - - for device in devices.iter_mut(){ - device.brighten_screen() - .set_serial(&input_filtering(Some("Enter the serial of the device with the bright screen: ")).to_string()) - .darken_screen(); - log::debug!("Number of unassigned addresses: {}",gpio.get_unassigned_addresses().len()); - if !find_gpio(device, gpio){ - device.set_pin_address(21); - log::error!("Unable to find GPIO for device {}. Please ensure that the probe well is installed properly, and the calibration key is plugged in.",device.get_location()); + for thread in tty_test_threads{ + let output = thread.join().unwrap_or_else(|x|{log::trace!("{:?}",x); None}); + possible_devices.push(output); } - } - let mut iteration_count:u64 = 0; - while iteration_count < 1{ - iteration_count = int_input_filtering(Some("Enter the number of iterations to complete: ")); - } - - let mut iteration_threads = Vec::new(); - while let Some(mut device) = devices.pop(){ - iteration_threads.push(thread::spawn(move||{ - for i in 1..=iteration_count{ - log::info!("Starting iteration {} of {} for device {}...", - i,iteration_count,device.get_serial()); - device.test_cycle(None, None); + let mut devices:Vec = Vec::new(); + for possible_device in possible_devices.into_iter(){ + if let Some(device) = possible_device{ + devices.push(device); } - })); + } + + log::info!("\n\n--------------------------------------"); + log::info!("Number of devices detected: {}",devices.len()); + log::info!("--------------------------------------\n\n"); + + for device in devices.iter_mut(){ + device.brighten_screen() + .set_serial(&input_filtering(Some("Enter the serial of the device with the bright screen: ")).to_string()) + .darken_screen(); + log::debug!("Number of unassigned addresses: {}",gpio.get_unassigned_addresses().len()); + if !find_gpio(device, gpio){ + device.set_pin_address(21); + log::error!("Unable to find GPIO for device {}. Please ensure that the probe well is installed properly, and the calibration key is plugged in.",device.get_location()); + } + } + + let mut iteration_count:u64 = 0; + while iteration_count < 1{ + iteration_count = int_input_filtering(Some("Enter the number of iterations to complete: ")); + } + + let mut iteration_threads = Vec::new(); + while let Some(mut device) = devices.pop(){ + iteration_threads.push(thread::spawn(move||{ + for i in 1..=iteration_count{ + log::info!("Starting iteration {} of {} for device {}...", + i,iteration_count,device.get_serial()); + device.test_cycle(None, None); + } + })); + } + for thread in iteration_threads{ + thread.join().unwrap(); + } } - for thread in iteration_threads{ - thread.join().unwrap(); + Err(_)=>{ + log::error!("Invalid serial location! Please make sure that /dev/serial/by-path exists."); + break; } } - Err(_)=>{ - log::error!("Invalid serial location! Please make sure that /dev/serial/by-path exists."); - } + if input_filtering(Some("Would you like to run the tests again? (y/N): ")).to_string().contains("y") {} + else { break; } } } From a1ca94131f534bfe8df2bd19311cb973ba03d87f Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Mon, 5 Jun 2023 09:15:55 -0400 Subject: [PATCH 05/41] test push --- test.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..e69de29 From f26027c5bf522ffa55d5c81fde23c3964302eab6 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Mon, 5 Jun 2023 09:17:11 -0400 Subject: [PATCH 06/41] remove test file --- test.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index e69de29..0000000 From 0f01d4c4beeba261eb97a5c2e874aa17c7417e1e Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 09:38:04 -0400 Subject: [PATCH 07/41] Add build requirements documentation --- build_requirements.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 build_requirements.md diff --git a/build_requirements.md b/build_requirements.md new file mode 100644 index 0000000..d957683 --- /dev/null +++ b/build_requirements.md @@ -0,0 +1,2 @@ +librust-udev-sys-dev +pkg-config From d170d240ebf939b1f053b93b7a1702e11e57732f Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 10:25:58 -0400 Subject: [PATCH 08/41] Add demo CI file --- .forgejo/workflows/demo.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .forgejo/workflows/demo.yaml diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml new file mode 100644 index 0000000..d470cda --- /dev/null +++ b/.forgejo/workflows/demo.yaml @@ -0,0 +1,6 @@ +on: [push] +jobs: + test: + runs-on: docker + steps: + - run: echo All Good From ae8a50fc31fc96424d1f310514eb1b1a33f1285b Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:16:43 -0400 Subject: [PATCH 09/41] Add v1 of test build --- .forgejo/workflows/buildTest.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .forgejo/workflows/buildTest.yaml diff --git a/.forgejo/workflows/buildTest.yaml b/.forgejo/workflows/buildTest.yaml new file mode 100644 index 0000000..c747cb3 --- /dev/null +++ b/.forgejo/workflows/buildTest.yaml @@ -0,0 +1,30 @@ +on: [push] + +name: Test build +jobs: + amd_check: + name: x86_64 Check + runs-on: [ self-hosted,x64 ] + steps: + - uses: actions/checkout@v2 + - uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: https://github.com/actions-rs/cargo@v1 + with: + command: check + arm_check: + name: ARM64 Check + runs-on: [ self-hosted,arm64 ] + steps: + - uses: actions/checkout@v2 + - uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: https://github.com/actions-rs/cargo@v1 + with: + command: check From 3e925d17c812a47daf61b762e1d2ec20946f40f6 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:26:59 -0400 Subject: [PATCH 10/41] take 2 at CI build --- .forgejo/workflows/demo.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index d470cda..5bf2c1c 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -4,3 +4,29 @@ jobs: runs-on: docker steps: - run: echo All Good + amd_check: + name: x86_64 Check + runs-on: [ self-hosted,x64 ] + steps: + - uses: actions/checkout@v2 + - uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: https://github.com/actions-rs/cargo@v1 + with: + command: check + arm_check: + name: ARM64 Check + runs-on: [ self-hosted,arm64 ] + steps: + - uses: actions/checkout@v2 + - uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: https://github.com/actions-rs/cargo@v1 + with: + command: check From 20b9a3ddcaf2a3471b056ceab7762482b8174a17 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:30:55 -0400 Subject: [PATCH 11/41] test 3 --- .forgejo/workflows/buildTest.yaml | 30 ------------------------------ .forgejo/workflows/demo.yaml | 26 -------------------------- 2 files changed, 56 deletions(-) delete mode 100644 .forgejo/workflows/buildTest.yaml diff --git a/.forgejo/workflows/buildTest.yaml b/.forgejo/workflows/buildTest.yaml deleted file mode 100644 index c747cb3..0000000 --- a/.forgejo/workflows/buildTest.yaml +++ /dev/null @@ -1,30 +0,0 @@ -on: [push] - -name: Test build -jobs: - amd_check: - name: x86_64 Check - runs-on: [ self-hosted,x64 ] - steps: - - uses: actions/checkout@v2 - - uses: https://github.com/actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: https://github.com/actions-rs/cargo@v1 - with: - command: check - arm_check: - name: ARM64 Check - runs-on: [ self-hosted,arm64 ] - steps: - - uses: actions/checkout@v2 - - uses: https://github.com/actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: https://github.com/actions-rs/cargo@v1 - with: - command: check diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 5bf2c1c..d470cda 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -4,29 +4,3 @@ jobs: runs-on: docker steps: - run: echo All Good - amd_check: - name: x86_64 Check - runs-on: [ self-hosted,x64 ] - steps: - - uses: actions/checkout@v2 - - uses: https://github.com/actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: https://github.com/actions-rs/cargo@v1 - with: - command: check - arm_check: - name: ARM64 Check - runs-on: [ self-hosted,arm64 ] - steps: - - uses: actions/checkout@v2 - - uses: https://github.com/actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: https://github.com/actions-rs/cargo@v1 - with: - command: check From e144dcfb13e45ed255e7061507a1fd84020e92c7 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:46:19 -0400 Subject: [PATCH 12/41] Try build again --- .forgejo/workflows/buildTest.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .forgejo/workflows/buildTest.yaml diff --git a/.forgejo/workflows/buildTest.yaml b/.forgejo/workflows/buildTest.yaml new file mode 100644 index 0000000..c747cb3 --- /dev/null +++ b/.forgejo/workflows/buildTest.yaml @@ -0,0 +1,30 @@ +on: [push] + +name: Test build +jobs: + amd_check: + name: x86_64 Check + runs-on: [ self-hosted,x64 ] + steps: + - uses: actions/checkout@v2 + - uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: https://github.com/actions-rs/cargo@v1 + with: + command: check + arm_check: + name: ARM64 Check + runs-on: [ self-hosted,arm64 ] + steps: + - uses: actions/checkout@v2 + - uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: https://github.com/actions-rs/cargo@v1 + with: + command: check From e968eb6223fa6ad6bff0bc708248645492281942 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:48:15 -0400 Subject: [PATCH 13/41] remove demo --- .forgejo/workflows/demo.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .forgejo/workflows/demo.yaml diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml deleted file mode 100644 index d470cda..0000000 --- a/.forgejo/workflows/demo.yaml +++ /dev/null @@ -1,6 +0,0 @@ -on: [push] -jobs: - test: - runs-on: docker - steps: - - run: echo All Good From 9e8b112de659e59e410b3b2e7ab315c809154516 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:50:33 -0400 Subject: [PATCH 14/41] change build name --- .forgejo/workflows/buildTest.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/buildTest.yaml b/.forgejo/workflows/buildTest.yaml index c747cb3..d85ad42 100644 --- a/.forgejo/workflows/buildTest.yaml +++ b/.forgejo/workflows/buildTest.yaml @@ -1,6 +1,7 @@ on: [push] -name: Test build +name: Check-Build + jobs: amd_check: name: x86_64 Check From 02cc37a10433f4da6ff68b01351a56ff9b2b369c Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:52:43 -0400 Subject: [PATCH 15/41] move to new location? --- .forgejo/workflows/{buildTest.yaml => demo.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .forgejo/workflows/{buildTest.yaml => demo.yaml} (100%) diff --git a/.forgejo/workflows/buildTest.yaml b/.forgejo/workflows/demo.yaml similarity index 100% rename from .forgejo/workflows/buildTest.yaml rename to .forgejo/workflows/demo.yaml From 9ca7d89f4f1a9383448183d5fb5906720e8227bc Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 11:54:01 -0400 Subject: [PATCH 16/41] reduce complexity --- .forgejo/workflows/demo.yaml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index d85ad42..9010d5e 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -8,24 +8,24 @@ jobs: runs-on: [ self-hosted,x64 ] steps: - uses: actions/checkout@v2 - - uses: https://github.com/actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: https://github.com/actions-rs/cargo@v1 - with: - command: check + #- uses: https://github.com/actions-rs/toolchain@v1 + # with: + # profile: minimal + # toolchain: stable + # override: true + #- uses: https://github.com/actions-rs/cargo@v1 + # with: + # command: check arm_check: name: ARM64 Check runs-on: [ self-hosted,arm64 ] steps: - uses: actions/checkout@v2 - - uses: https://github.com/actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: https://github.com/actions-rs/cargo@v1 - with: - command: check + #- uses: https://github.com/actions-rs/toolchain@v1 + # with: + # profile: minimal + # toolchain: stable + # override: true + #- uses: https://github.com/actions-rs/cargo@v1 + # with: + # command: check From 8607d619d4774291740a573a203087629374e567 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 13:46:31 -0400 Subject: [PATCH 17/41] maybe it needs names... --- .forgejo/workflows/demo.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 9010d5e..1f0ba24 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -7,7 +7,8 @@ jobs: name: x86_64 Check runs-on: [ self-hosted,x64 ] steps: - - uses: actions/checkout@v2 + - name: Checkout repo code + uses: actions/checkout@v3 #- uses: https://github.com/actions-rs/toolchain@v1 # with: # profile: minimal @@ -20,7 +21,8 @@ jobs: name: ARM64 Check runs-on: [ self-hosted,arm64 ] steps: - - uses: actions/checkout@v2 + - name: Checkout repo code + uses: actions/checkout@v3 #- uses: https://github.com/actions-rs/toolchain@v1 # with: # profile: minimal From e5684c7555aeac611109165777f875c24ee5d6d8 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 13:47:23 -0400 Subject: [PATCH 18/41] no spaces? --- .forgejo/workflows/demo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 1f0ba24..7a586a8 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -4,7 +4,7 @@ name: Check-Build jobs: amd_check: - name: x86_64 Check + name: x86_64-Check runs-on: [ self-hosted,x64 ] steps: - name: Checkout repo code @@ -18,7 +18,7 @@ jobs: # with: # command: check arm_check: - name: ARM64 Check + name: ARM64-Check runs-on: [ self-hosted,arm64 ] steps: - name: Checkout repo code From ded4ff682152cc1434ccddd929fd67689b58a64c Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 13:50:11 -0400 Subject: [PATCH 19/41] rewrite to original example --- .forgejo/workflows/demo.yaml | 47 ++++++++++++------------------------ 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 7a586a8..876684c 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -1,33 +1,18 @@ +name: Demo +run-name: ${{ github.actor }} is testing on: [push] - -name: Check-Build - jobs: - amd_check: - name: x86_64-Check - runs-on: [ self-hosted,x64 ] - steps: - - name: Checkout repo code - uses: actions/checkout@v3 - #- uses: https://github.com/actions-rs/toolchain@v1 - # with: - # profile: minimal - # toolchain: stable - # override: true - #- uses: https://github.com/actions-rs/cargo@v1 - # with: - # command: check - arm_check: - name: ARM64-Check - runs-on: [ self-hosted,arm64 ] - steps: - - name: Checkout repo code - uses: actions/checkout@v3 - #- uses: https://github.com/actions-rs/toolchain@v1 - # with: - # profile: minimal - # toolchain: stable - # override: true - #- uses: https://github.com/actions-rs/cargo@v1 - # with: - # command: check + Explore-CI: + runs-on: ubuntu-latest + steps: + - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "This job is now running on a ${{ runner.os }} server." + - run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "This job's status is ${{ job.status }}." From a2001bc612a4890ca70aadcd7b2a43f29d1ad046 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 13:52:17 -0400 Subject: [PATCH 20/41] change runs-on to a valid tag --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 876684c..55c8013 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -3,7 +3,7 @@ run-name: ${{ github.actor }} is testing on: [push] jobs: Explore-CI: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "This job is now running on a ${{ runner.os }} server." From 69cd1ef86fb81a8576314d3ec2b6455e0bc0eb41 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:23:52 -0400 Subject: [PATCH 21/41] Add cargo actions? --- .forgejo/workflows/demo.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 55c8013..a90f0e7 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -5,14 +5,14 @@ jobs: Explore-CI: runs-on: self-hosted steps: - - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "This job is now running on a ${{ runner.os }} server." - - run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code uses: actions/checkout@v3 - - run: echo "The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ github.workspace }} - - run: echo "This job's status is ${{ job.status }}." + - name: Run cargo check + uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true From a3fbd7695755e10f7193309ad2b6716fcd652301 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:31:17 -0400 Subject: [PATCH 22/41] Add complete cargo check --- .forgejo/workflows/demo.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index a90f0e7..bbcfe89 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -10,9 +10,14 @@ jobs: - name: List files in the repository run: | ls ${{ github.workspace }} - - name: Run cargo check + - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: profile: minimal toolchain: stable + target: aarch64-unknown-linux-gnu override: true + - name: Run check + uses: https://github.com/actions-rs/cargo@v1 + with: + command: check From 3c8acca0fcf4ba0df1e520c0425984f824b9a373 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:34:16 -0400 Subject: [PATCH 23/41] switch from gnu to musl --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index bbcfe89..7f10d1c 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -15,7 +15,7 @@ jobs: with: profile: minimal toolchain: stable - target: aarch64-unknown-linux-gnu + target: aarch64-unknown-linux-musl override: true - name: Run check uses: https://github.com/actions-rs/cargo@v1 From ae281d24c0a23f9703234af978e248e2fca63f5b Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:38:25 -0400 Subject: [PATCH 24/41] run on x86 maybe? --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 7f10d1c..3220b09 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -3,7 +3,7 @@ run-name: ${{ github.actor }} is testing on: [push] jobs: Explore-CI: - runs-on: self-hosted + runs-on: x86-64 steps: - name: Check out repository code uses: actions/checkout@v3 From fd934576e77ff749c8b0f8de74979568cba637c5 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:45:03 -0400 Subject: [PATCH 25/41] Add LLVM (I hope) --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 3220b09..e5d42da 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -13,7 +13,7 @@ jobs: - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: - profile: minimal + profile: complete toolchain: stable target: aarch64-unknown-linux-musl override: true From 9ef78cdbcbc631ba720f9044daf3cfaec76bf95d Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:46:10 -0400 Subject: [PATCH 26/41] try default --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index e5d42da..92ddb93 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -13,7 +13,7 @@ jobs: - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: - profile: complete + profile: default toolchain: stable target: aarch64-unknown-linux-musl override: true From 768c09046202041c42ad4d3cfe3efeab7fd3fb33 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:50:26 -0400 Subject: [PATCH 27/41] try nightly --- .forgejo/workflows/demo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 92ddb93..461c175 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -13,8 +13,8 @@ jobs: - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: - profile: default - toolchain: stable + profile: complete + toolchain: nightly target: aarch64-unknown-linux-musl override: true - name: Run check From b3794a100f5cead11dadbc0a502917142ed9318c Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:53:25 -0400 Subject: [PATCH 28/41] add library? --- .forgejo/workflows/demo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 461c175..4192571 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -3,13 +3,13 @@ run-name: ${{ github.actor }} is testing on: [push] jobs: Explore-CI: - runs-on: x86-64 + runs-on: docker steps: - name: Check out repository code uses: actions/checkout@v3 - name: List files in the repository run: | - ls ${{ github.workspace }} + apt install librust-udev-sys-dev - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: From 42c6442481b5af3ce1bd3a29b4944afe75660ed0 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:55:36 -0400 Subject: [PATCH 29/41] add the *right* library --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 4192571..7b99133 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -9,7 +9,7 @@ jobs: uses: actions/checkout@v3 - name: List files in the repository run: | - apt install librust-udev-sys-dev + apt install librust-libudev-sys-dev - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: From 92601f638322687a25ee9b0ef96887a0158216d1 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 14:57:30 -0400 Subject: [PATCH 30/41] force install --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 7b99133..5c05dc5 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -9,7 +9,7 @@ jobs: uses: actions/checkout@v3 - name: List files in the repository run: | - apt install librust-libudev-sys-dev + apt install -y librust-libudev-sys-dev - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: From 3cc8ee75ce72075cfca249f0092ea5393acd0f2b Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 15:02:28 -0400 Subject: [PATCH 31/41] maybe musl is a bad idea? --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 5c05dc5..10fd08d 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -15,7 +15,7 @@ jobs: with: profile: complete toolchain: nightly - target: aarch64-unknown-linux-musl + target: aarch64-unknown-linux-gnu override: true - name: Run check uses: https://github.com/actions-rs/cargo@v1 From 573df9a8e3a2fe60d51c1184bc25393689fb05c3 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 15:07:40 -0400 Subject: [PATCH 32/41] Add build-essential --- .forgejo/workflows/demo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 10fd08d..20b9f5b 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -7,9 +7,9 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v3 - - name: List files in the repository + - name: Grab misc. dependencies run: | - apt install -y librust-libudev-sys-dev + apt install -y librust-libudev-sys-dev build-essential - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: From a8ac4c6acb83b00c0f6849cd91be188a457b75fb Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 15:11:59 -0400 Subject: [PATCH 33/41] Add dependencies first --- .forgejo/workflows/demo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 20b9f5b..2d2ee40 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -5,11 +5,11 @@ jobs: Explore-CI: runs-on: docker steps: - - name: Check out repository code - uses: actions/checkout@v3 - name: Grab misc. dependencies run: | apt install -y librust-libudev-sys-dev build-essential + - name: Check out repository code + uses: actions/checkout@v3 - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: From 0a5e335106dbdbbf4563247c80e1fb8d0cea4c69 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 15:18:31 -0400 Subject: [PATCH 34/41] Now that we know it *can* work, run faster --- .forgejo/workflows/demo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 2d2ee40..74be3c4 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -13,8 +13,8 @@ jobs: - name: Grab Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 with: - profile: complete - toolchain: nightly + profile: minimal + toolchain: stable target: aarch64-unknown-linux-gnu override: true - name: Run check From 4e1c6c992c907de50f6d75abd4241d76e51d8de9 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Tue, 6 Jun 2023 15:22:54 -0400 Subject: [PATCH 35/41] see if cross-compile works --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 74be3c4..1c31029 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -3,7 +3,7 @@ run-name: ${{ github.actor }} is testing on: [push] jobs: Explore-CI: - runs-on: docker + runs-on: amd64 steps: - name: Grab misc. dependencies run: | From 9e270565cf057a4374ee53aef53332ca341a8a7d Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Wed, 7 Jun 2023 17:00:51 -0400 Subject: [PATCH 36/41] try to run automation on docker --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 1c31029..74be3c4 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -3,7 +3,7 @@ run-name: ${{ github.actor }} is testing on: [push] jobs: Explore-CI: - runs-on: amd64 + runs-on: docker steps: - name: Grab misc. dependencies run: | From 1cdfb5ac6b45621ea76af293d8967a947b152c70 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Fri, 9 Jun 2023 09:03:59 -0400 Subject: [PATCH 37/41] Add debug mode via CLI arguments --- Cargo.lock | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/main.rs | 26 +++++-- 3 files changed, 218 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43f5093..d120f61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,6 +41,55 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -92,6 +141,48 @@ dependencies = [ "winapi", ] +[[package]] +name = "clap" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2" +dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.15", +] + +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -102,6 +193,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "const_fn" version = "0.4.9" @@ -175,6 +272,27 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fern" version = "0.6.2" @@ -184,6 +302,18 @@ dependencies = [ "log", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "iana-time-zone" version = "0.1.56" @@ -208,6 +338,29 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", +] + [[package]] name = "itoa" version = "1.0.6" @@ -258,6 +411,12 @@ dependencies = [ "cc", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "log" version = "0.4.17" @@ -392,6 +551,20 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.37.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" version = "1.0.13" @@ -469,6 +642,7 @@ name = "seymour_poc_rust" version = "2.0.1" dependencies = [ "chrono", + "clap", "derivative", "fern", "log", @@ -551,6 +725,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "syn" version = "1.0.109" @@ -643,6 +823,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "version_check" version = "0.9.4" @@ -749,6 +935,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 5226b1a..b986ef9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ chrono = "0.4.24" once_cell = "1.17.1" derivative = "2.2.0" time = "0.2.23" +clap = { version = "4.3.2", features = ["derive"] } [dev-dependencies] time = "0.2.23" diff --git a/src/main.rs b/src/main.rs index 0617360..c3908bc 100755 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,16 @@ use std::{io::{stdin,stdout,Write}, path::Path, fs}; use chrono::{DateTime,Local}; +use clap::Parser; -const VERSION:&str="2.0.1"; +#[derive(Parser,Debug)] +#[command(author,version,about)] +struct Args{ + #[arg(short,long,action)] + debug:bool +} + +const VERSION:&str="2.1.0"; fn int_input_filtering(prompt:Option<&str>) -> u64{ let internal_prompt = prompt.unwrap_or(">>>"); @@ -42,7 +50,11 @@ fn input_filtering(prompt:Option<&str>) -> String{ fn main(){ setup_logs(); + let args = Args::parse(); log::info!("Seymour Life Testing version: {}",VERSION); + if args.debug{ + log::debug!("Debug enabled!"); + } loop{ let gpio = &mut GpioPins::new(); match std::fs::read_dir("/dev/serial/by-path"){ @@ -103,9 +115,15 @@ fn main(){ log::info!("--------------------------------------\n\n"); for device in devices.iter_mut(){ - device.brighten_screen() - .set_serial(&input_filtering(Some("Enter the serial of the device with the bright screen: ")).to_string()) - .darken_screen(); + device.brighten_screen(); + if args.debug{ + let location = device.get_location(); + device.set_serial(&location); + } + else{ + device.set_serial(&input_filtering(Some("Enter the serial of the device with the bright screen: ")).to_string()); + } + device.darken_screen(); log::debug!("Number of unassigned addresses: {}",gpio.get_unassigned_addresses().len()); if !find_gpio(device, gpio){ device.set_pin_address(21); From 238acde937450380f77788069a63693b8ff42fe8 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Fri, 9 Jun 2023 09:09:45 -0400 Subject: [PATCH 38/41] change to arm CI --- .forgejo/workflows/demo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 74be3c4..7281b85 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -3,7 +3,7 @@ run-name: ${{ github.actor }} is testing on: [push] jobs: Explore-CI: - runs-on: docker + runs-on: aarch64 steps: - name: Grab misc. dependencies run: | From d67e2de161e96211957ed4db842a7d438b16824e Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Fri, 9 Jun 2023 09:16:03 -0400 Subject: [PATCH 39/41] Add required update to CI --- .forgejo/workflows/demo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/demo.yaml index 7281b85..a4e06a6 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/demo.yaml @@ -3,11 +3,11 @@ run-name: ${{ github.actor }} is testing on: [push] jobs: Explore-CI: - runs-on: aarch64 + runs-on: docker steps: - name: Grab misc. dependencies run: | - apt install -y librust-libudev-sys-dev build-essential + apt update && apt install -y librust-libudev-sys-dev build-essential - name: Check out repository code uses: actions/checkout@v3 - name: Grab Rust toolchain From 4e0362d4ac745fc03067f82b07e81b92eb34e647 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Fri, 9 Jun 2023 09:33:42 -0400 Subject: [PATCH 40/41] Professionalise CI naming scheme --- .forgejo/workflows/{demo.yaml => buildcheck.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .forgejo/workflows/{demo.yaml => buildcheck.yaml} (97%) diff --git a/.forgejo/workflows/demo.yaml b/.forgejo/workflows/buildcheck.yaml similarity index 97% rename from .forgejo/workflows/demo.yaml rename to .forgejo/workflows/buildcheck.yaml index a4e06a6..1b701bc 100644 --- a/.forgejo/workflows/demo.yaml +++ b/.forgejo/workflows/buildcheck.yaml @@ -2,7 +2,7 @@ name: Demo run-name: ${{ github.actor }} is testing on: [push] jobs: - Explore-CI: + docker-build: runs-on: docker steps: - name: Grab misc. dependencies From 23348bd175b21f9d504d1aef602893c63c8be062 Mon Sep 17 00:00:00 2001 From: Blizzard Finnegan Date: Fri, 9 Jun 2023 09:38:15 -0400 Subject: [PATCH 41/41] Add build as well as check --- .forgejo/workflows/buildcheck.yaml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/buildcheck.yaml b/.forgejo/workflows/buildcheck.yaml index 1b701bc..dc1b053 100644 --- a/.forgejo/workflows/buildcheck.yaml +++ b/.forgejo/workflows/buildcheck.yaml @@ -1,8 +1,8 @@ -name: Demo +name: Basic Cargo Checks run-name: ${{ github.actor }} is testing on: [push] jobs: - docker-build: + docker-check: runs-on: docker steps: - name: Grab misc. dependencies @@ -21,3 +21,23 @@ jobs: uses: https://github.com/actions-rs/cargo@v1 with: command: check + docker-build: + runs-on: docker + steps: + - name: Grab misc. dependencies + run: | + apt update && apt install -y librust-libudev-sys-dev build-essential + - name: Check out repository code + uses: actions/checkout@v3 + - name: Grab Rust toolchain + uses: https://github.com/actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: aarch64-unknown-linux-gnu + override: true + - name: Run check + uses: https://github.com/actions-rs/cargo@v1 + with: + command: build + args: --release