From 93f22172ccc0098b2f862f046e0627b9687c8bcb Mon Sep 17 00:00:00 2001 From: esp323277 <155220199+esp323277@users.noreply.github.com> Date: Fri, 17 Oct 2025 02:54:32 +1000 Subject: [PATCH] Added HTTP GET request to check if uz801 device is online (#648) Co-authored-by: Your Name Co-authored-by: Markus Unterwaditzer --- installer/src/uz801.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/installer/src/uz801.rs b/installer/src/uz801.rs index 2d66375..d3b9528 100644 --- a/installer/src/uz801.rs +++ b/installer/src/uz801.rs @@ -54,6 +54,21 @@ pub async fn activate_usb_debug(admin_ip: &str) -> Result<()> { let referer = format!("http://{admin_ip}/usbdebug.html"); let origin = format!("http://{admin_ip}"); + // Check if device is online + echo!("Checking if device is online... "); + let client = reqwest::Client::builder() + .timeout(Duration::from_secs(5)) + .build()?; + + match client.get(&origin).send().await { + Ok(response) if response.status().is_success() => println!("ok"), + Ok(response) => anyhow::bail!( + "Device at {admin_ip} returned error status: {}", + response.status() + ), + Err(e) => anyhow::bail!("Failed to reach device at {admin_ip}: {}", e), + } + let _handle = tokio::spawn(async move { let client = reqwest::Client::builder() .timeout(Duration::from_secs(5))