Loading system/gd/rust/linux/stack/Cargo.toml +0 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ num-traits = "0.2" rand = { version = "0.8.3", features = ["small_rng"] } serde_json = "1.0" syslog = "6" tempfile = "3.10" tokio = { version = "1", features = ['bytes', 'fs', 'io-util', 'libc', 'macros', 'mio', 'net', 'num_cpus', 'rt', 'rt-multi-thread', 'sync', 'time', 'tokio-macros'] } [lib] Loading system/gd/rust/linux/stack/src/bluetooth.rs +9 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ use num_traits::cast::ToPrimitive; use num_traits::pow; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; use std::fs::File; use std::fs::{File, OpenOptions}; use std::hash::Hash; use std::io::Write; use std::os::fd::AsRawFd; Loading @@ -39,7 +39,6 @@ use std::process; use std::sync::{Arc, Condvar, Mutex}; use std::time::Duration; use std::time::Instant; use tempfile::NamedTempFile; use tokio::sync::mpsc::Sender; use tokio::task::JoinHandle; use tokio::time; Loading Loading @@ -70,6 +69,8 @@ const BTM_SUCCESS: i32 = 0; const PID_DIR: &str = "/var/run/bluetooth"; const DUMPSYS_LOG: &str = "/tmp/dumpsys.log"; /// Represents various roles the adapter supports. #[derive(Debug, FromPrimitive, ToPrimitive)] #[repr(u32)] Loading Loading @@ -3021,11 +3022,15 @@ impl IBluetooth for Bluetooth { } fn get_dumpsys(&self) -> String { NamedTempFile::new() OpenOptions::new() .write(true) .create(true) .truncate(true) .open(DUMPSYS_LOG) .and_then(|file| { let fd = file.as_raw_fd(); self.intf.lock().unwrap().dump(fd); std::fs::read_to_string(file.path()) Ok(format!("dump to {}", DUMPSYS_LOG)) }) .unwrap_or_default() } Loading Loading
system/gd/rust/linux/stack/Cargo.toml +0 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ num-traits = "0.2" rand = { version = "0.8.3", features = ["small_rng"] } serde_json = "1.0" syslog = "6" tempfile = "3.10" tokio = { version = "1", features = ['bytes', 'fs', 'io-util', 'libc', 'macros', 'mio', 'net', 'num_cpus', 'rt', 'rt-multi-thread', 'sync', 'time', 'tokio-macros'] } [lib] Loading
system/gd/rust/linux/stack/src/bluetooth.rs +9 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ use num_traits::cast::ToPrimitive; use num_traits::pow; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; use std::fs::File; use std::fs::{File, OpenOptions}; use std::hash::Hash; use std::io::Write; use std::os::fd::AsRawFd; Loading @@ -39,7 +39,6 @@ use std::process; use std::sync::{Arc, Condvar, Mutex}; use std::time::Duration; use std::time::Instant; use tempfile::NamedTempFile; use tokio::sync::mpsc::Sender; use tokio::task::JoinHandle; use tokio::time; Loading Loading @@ -70,6 +69,8 @@ const BTM_SUCCESS: i32 = 0; const PID_DIR: &str = "/var/run/bluetooth"; const DUMPSYS_LOG: &str = "/tmp/dumpsys.log"; /// Represents various roles the adapter supports. #[derive(Debug, FromPrimitive, ToPrimitive)] #[repr(u32)] Loading Loading @@ -3021,11 +3022,15 @@ impl IBluetooth for Bluetooth { } fn get_dumpsys(&self) -> String { NamedTempFile::new() OpenOptions::new() .write(true) .create(true) .truncate(true) .open(DUMPSYS_LOG) .and_then(|file| { let fd = file.as_raw_fd(); self.intf.lock().unwrap().dump(fd); std::fs::read_to_string(file.path()) Ok(format!("dump to {}", DUMPSYS_LOG)) }) .unwrap_or_default() } Loading