mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-07-28 01:48:09 -07:00
uz801: cargo fmt run
This commit is contained in:
+1
-1
@@ -243,7 +243,7 @@ async fn run_with_config(
|
|||||||
Device::Tmobile => display::tmobile::update_ui,
|
Device::Tmobile => display::tmobile::update_ui,
|
||||||
Device::Wingtech => display::wingtech::update_ui,
|
Device::Wingtech => display::wingtech::update_ui,
|
||||||
Device::Pinephone => display::headless::update_ui,
|
Device::Pinephone => display::headless::update_ui,
|
||||||
Device::Uz801 => display::uz801::update_ui
|
Device::Uz801 => display::uz801::update_ui,
|
||||||
};
|
};
|
||||||
update_ui(&task_tracker, &config, ui_shutdown_rx, ui_update_rx);
|
update_ui(&task_tracker, &config, ui_shutdown_rx, ui_update_rx);
|
||||||
|
|
||||||
|
|||||||
+16
-4
@@ -61,10 +61,22 @@ impl DiskStats {
|
|||||||
let data_line = lines[1];
|
let data_line = lines[1];
|
||||||
let mut parts = data_line.split_whitespace();
|
let mut parts = data_line.split_whitespace();
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
partition: parts.next().ok_or("error parsing df output: missing filesystem")?.to_string(),
|
partition: parts
|
||||||
total_size: parts.next().ok_or("error parsing df output: missing size")?.to_string(),
|
.next()
|
||||||
used_size: parts.next().ok_or("error parsing df output: missing used")?.to_string(),
|
.ok_or("error parsing df output: missing filesystem")?
|
||||||
available_size: parts.next().ok_or("error parsing df output: missing free")?.to_string(),
|
.to_string(),
|
||||||
|
total_size: parts
|
||||||
|
.next()
|
||||||
|
.ok_or("error parsing df output: missing size")?
|
||||||
|
.to_string(),
|
||||||
|
used_size: parts
|
||||||
|
.next()
|
||||||
|
.ok_or("error parsing df output: missing used")?
|
||||||
|
.to_string(),
|
||||||
|
available_size: parts
|
||||||
|
.next()
|
||||||
|
.ok_or("error parsing df output: missing free")?
|
||||||
|
.to_string(),
|
||||||
used_percent: "N/A".to_string(), // Uz801 df doesn't provide percentage
|
used_percent: "N/A".to_string(), // Uz801 df doesn't provide percentage
|
||||||
mounted_on: qmdl_path.to_string(), // Use the path we queried
|
mounted_on: qmdl_path.to_string(), // Use the path we queried
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ mod orbic;
|
|||||||
mod pinephone;
|
mod pinephone;
|
||||||
mod tmobile;
|
mod tmobile;
|
||||||
mod tplink;
|
mod tplink;
|
||||||
mod uz801;
|
|
||||||
mod util;
|
mod util;
|
||||||
|
mod uz801;
|
||||||
mod wingtech;
|
mod wingtech;
|
||||||
|
|
||||||
pub static CONFIG_TOML: &str = include_str!("../../dist/config.toml.in");
|
pub static CONFIG_TOML: &str = include_str!("../../dist/config.toml.in");
|
||||||
|
|||||||
+21
-12
@@ -7,10 +7,10 @@
|
|||||||
/// 4. Modify startup script to launch rayhunter on boot
|
/// 4. Modify startup script to launch rayhunter on boot
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::Result;
|
|
||||||
use tokio::time::sleep;
|
|
||||||
use adb_client::{ADBDeviceExt, ADBUSBDevice, RustADBError};
|
use adb_client::{ADBDeviceExt, ADBUSBDevice, RustADBError};
|
||||||
|
use anyhow::Result;
|
||||||
use std::io::ErrorKind;
|
use std::io::ErrorKind;
|
||||||
|
use tokio::time::sleep;
|
||||||
|
|
||||||
use crate::Uz801Args as Args;
|
use crate::Uz801Args as Args;
|
||||||
use crate::util::echo;
|
use crate::util::echo;
|
||||||
@@ -77,7 +77,8 @@ async fn wait_for_adb() -> Result<ADBUSBDevice> {
|
|||||||
anyhow::bail!("Timeout waiting for ADB connection after USB debug activation");
|
anyhow::bail!("Timeout waiting for ADB connection after USB debug activation");
|
||||||
}
|
}
|
||||||
|
|
||||||
match ADBUSBDevice::new(0x05c6, 0x9025) { // Common Qualcomm ADB VID/PID
|
match ADBUSBDevice::new(0x05c6, 0x9025) {
|
||||||
|
// Common Qualcomm ADB VID/PID
|
||||||
Ok(mut device) => {
|
Ok(mut device) => {
|
||||||
// Test ADB connection
|
// Test ADB connection
|
||||||
if test_adb_connection(&mut device).await.is_ok() {
|
if test_adb_connection(&mut device).await.is_ok() {
|
||||||
@@ -119,14 +120,16 @@ async fn install_rayhunter_files(adb_device: &mut ADBUSBDevice) -> Result<()> {
|
|||||||
adb_device.push(&mut daemon_data, &"/data/rayhunter/rayhunter-daemon")?;
|
adb_device.push(&mut daemon_data, &"/data/rayhunter/rayhunter-daemon")?;
|
||||||
|
|
||||||
// Install config file
|
// Install config file
|
||||||
let config_content = crate::CONFIG_TOML
|
let config_content = crate::CONFIG_TOML.replace("#device = \"orbic\"", "device = \"uz801\"");
|
||||||
.replace("#device = \"orbic\"", "device = \"uz801\"");
|
|
||||||
let mut config_data = config_content.as_bytes();
|
let mut config_data = config_content.as_bytes();
|
||||||
adb_device.push(&mut config_data, &"/data/rayhunter/config.toml")?;
|
adb_device.push(&mut config_data, &"/data/rayhunter/config.toml")?;
|
||||||
|
|
||||||
// Make daemon executable
|
// Make daemon executable
|
||||||
let mut buf = Vec::<u8>::new();
|
let mut buf = Vec::<u8>::new();
|
||||||
adb_device.shell_command(&["chmod", "755", "/data/rayhunter/rayhunter-daemon"], &mut buf)?;
|
adb_device.shell_command(
|
||||||
|
&["chmod", "755", "/data/rayhunter/rayhunter-daemon"],
|
||||||
|
&mut buf,
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -151,18 +154,24 @@ async fn modify_startup_script(adb_device: &mut ADBUSBDevice) -> Result<()> {
|
|||||||
|
|
||||||
// Make sure it's executable
|
// Make sure it's executable
|
||||||
let mut buf = Vec::<u8>::new();
|
let mut buf = Vec::<u8>::new();
|
||||||
adb_device.shell_command(&["chmod", "755", "/system/bin/initmifiservice.sh"], &mut buf)?;
|
adb_device.shell_command(
|
||||||
|
&["chmod", "755", "/system/bin/initmifiservice.sh"],
|
||||||
|
&mut buf,
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn start_rayhunter(adb_device: &mut ADBUSBDevice) -> Result<()> {
|
async fn start_rayhunter(adb_device: &mut ADBUSBDevice) -> Result<()> {
|
||||||
let mut buf = Vec::<u8>::new();
|
let mut buf = Vec::<u8>::new();
|
||||||
adb_device.shell_command(&[
|
adb_device.shell_command(
|
||||||
"/data/rayhunter/rayhunter-daemon",
|
&[
|
||||||
"/data/rayhunter/config.toml",
|
"/data/rayhunter/rayhunter-daemon",
|
||||||
"&"
|
"/data/rayhunter/config.toml",
|
||||||
], &mut buf)?;
|
"&",
|
||||||
|
],
|
||||||
|
&mut buf,
|
||||||
|
)?;
|
||||||
|
|
||||||
// Give it a moment to start
|
// Give it a moment to start
|
||||||
sleep(Duration::from_secs(3)).await;
|
sleep(Duration::from_secs(3)).await;
|
||||||
|
|||||||
+1
-1
@@ -25,5 +25,5 @@ pub enum Device {
|
|||||||
Tmobile,
|
Tmobile,
|
||||||
Wingtech,
|
Wingtech,
|
||||||
Pinephone,
|
Pinephone,
|
||||||
Uz801
|
Uz801,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user