Loading system/gd/rust/linux/client/src/command_handler.rs +19 −0 Original line number Diff line number Diff line Loading @@ -389,6 +389,14 @@ fn build_commands() -> HashMap<String, CommandOption> { function_pointer: _noop, }, ); command_options.insert( String::from("dumpsys"), CommandOption { rules: vec![String::from("dumpsys")], description: String::from("Get diagnostic output."), function_pointer: CommandHandler::cmd_dumpsys, }, ); command_options } Loading Loading @@ -2341,6 +2349,17 @@ impl CommandHandler { Ok(()) } fn cmd_dumpsys(&mut self, _args: &Vec<String>) -> CommandResult { if !self.lock_context().adapter_ready { return Err(self.adapter_not_ready()); } let contents = self.lock_context().adapter_dbus.as_mut().unwrap().get_dumpsys(); println!("{}", contents); Ok(()) } } #[cfg(test)] Loading system/gd/rust/linux/client/src/dbus_iface.rs +5 −0 Original line number Diff line number Diff line Loading @@ -1035,6 +1035,11 @@ impl IBluetooth for BluetoothDBus { fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys")] fn get_dumpsys(&self) -> String { dbus_generated!() } } pub(crate) struct BluetoothQALegacyDBus { Loading system/gd/rust/linux/service/src/iface_bluetooth.rs +5 −0 Original line number Diff line number Diff line Loading @@ -770,6 +770,11 @@ impl IBluetooth for IBluetoothDBus { fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys", DBusLog::Disable)] fn get_dumpsys(&self) -> String { dbus_generated!() } } impl_dbus_arg_enum!(SocketType); Loading system/gd/rust/linux/stack/Cargo.toml +2 −1 Original line number Diff line number Diff line Loading @@ -16,14 +16,15 @@ env_logger = "0.8.3" itertools = "0.10.5" lazy_static = "1.4" log = "0.4.14" log-panics = "2.1.0" nix = "0.23" num-derive = "0.3" 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'] } log-panics = "2.1.0" [lib] path = "src/lib.rs" Loading system/gd/rust/linux/stack/src/bluetooth.rs +15 −0 Original line number Diff line number Diff line Loading @@ -34,10 +34,12 @@ use std::convert::TryInto; use std::fs::File; use std::hash::Hash; use std::io::Write; use std::os::fd::AsRawFd; 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 @@ -262,6 +264,9 @@ pub trait IBluetooth { /// Returns whether the remote device is a dual mode audio sink device (supports both classic and /// LE Audio sink roles). fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool; /// Gets diagnostic output. fn get_dumpsys(&self) -> String; } /// Adapter API for Bluetooth qualification and verification. Loading Loading @@ -2998,6 +3003,16 @@ impl IBluetooth for Bluetooth { is_dual_mode(self.get_remote_uuids(BluetoothDevice::new(*addr, "".to_string()))) }) } fn get_dumpsys(&self) -> String { NamedTempFile::new() .and_then(|file| { let fd = file.as_raw_fd(); self.intf.lock().unwrap().dump(fd); std::fs::read_to_string(file.path()) }) .unwrap_or_default() } } impl BtifSdpCallbacks for Bluetooth { Loading Loading
system/gd/rust/linux/client/src/command_handler.rs +19 −0 Original line number Diff line number Diff line Loading @@ -389,6 +389,14 @@ fn build_commands() -> HashMap<String, CommandOption> { function_pointer: _noop, }, ); command_options.insert( String::from("dumpsys"), CommandOption { rules: vec![String::from("dumpsys")], description: String::from("Get diagnostic output."), function_pointer: CommandHandler::cmd_dumpsys, }, ); command_options } Loading Loading @@ -2341,6 +2349,17 @@ impl CommandHandler { Ok(()) } fn cmd_dumpsys(&mut self, _args: &Vec<String>) -> CommandResult { if !self.lock_context().adapter_ready { return Err(self.adapter_not_ready()); } let contents = self.lock_context().adapter_dbus.as_mut().unwrap().get_dumpsys(); println!("{}", contents); Ok(()) } } #[cfg(test)] Loading
system/gd/rust/linux/client/src/dbus_iface.rs +5 −0 Original line number Diff line number Diff line Loading @@ -1035,6 +1035,11 @@ impl IBluetooth for BluetoothDBus { fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys")] fn get_dumpsys(&self) -> String { dbus_generated!() } } pub(crate) struct BluetoothQALegacyDBus { Loading
system/gd/rust/linux/service/src/iface_bluetooth.rs +5 −0 Original line number Diff line number Diff line Loading @@ -770,6 +770,11 @@ impl IBluetooth for IBluetoothDBus { fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool { dbus_generated!() } #[dbus_method("GetDumpsys", DBusLog::Disable)] fn get_dumpsys(&self) -> String { dbus_generated!() } } impl_dbus_arg_enum!(SocketType); Loading
system/gd/rust/linux/stack/Cargo.toml +2 −1 Original line number Diff line number Diff line Loading @@ -16,14 +16,15 @@ env_logger = "0.8.3" itertools = "0.10.5" lazy_static = "1.4" log = "0.4.14" log-panics = "2.1.0" nix = "0.23" num-derive = "0.3" 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'] } log-panics = "2.1.0" [lib] path = "src/lib.rs" Loading
system/gd/rust/linux/stack/src/bluetooth.rs +15 −0 Original line number Diff line number Diff line Loading @@ -34,10 +34,12 @@ use std::convert::TryInto; use std::fs::File; use std::hash::Hash; use std::io::Write; use std::os::fd::AsRawFd; 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 @@ -262,6 +264,9 @@ pub trait IBluetooth { /// Returns whether the remote device is a dual mode audio sink device (supports both classic and /// LE Audio sink roles). fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool; /// Gets diagnostic output. fn get_dumpsys(&self) -> String; } /// Adapter API for Bluetooth qualification and verification. Loading Loading @@ -2998,6 +3003,16 @@ impl IBluetooth for Bluetooth { is_dual_mode(self.get_remote_uuids(BluetoothDevice::new(*addr, "".to_string()))) }) } fn get_dumpsys(&self) -> String { NamedTempFile::new() .and_then(|file| { let fd = file.as_raw_fd(); self.intf.lock().unwrap().dump(fd); std::fs::read_to_string(file.path()) }) .unwrap_or_default() } } impl BtifSdpCallbacks for Bluetooth { Loading