Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d977ed1d authored by Katherine Lai's avatar Katherine Lai
Browse files

floss: Add support for BlueZ - Floss device migration

Migrate existing device information between BlueZ and Floss on each
transition between the two so users have a seamless experience
during the transition period to Floss.

Bug: 233111678
Bug: 233111981
Tag: #floss
Test: Confirmed devices are synced between each transition
Change-Id: Ic3670c914b0fb4169e0a987e8ddb49357ccea0b6
parent 7b55e13d
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -12,7 +12,9 @@ bt_socket = { path = "../socket" }
btstack = { path = "../stack" }
btstack = { path = "../stack" }


# external deps
# external deps
base64 = "0.13.0"
clap = "2.33.3"
clap = "2.33.3"
configparser = "3.0.0"
dbus = "0.9.2"
dbus = "0.9.2"
dbus-tokio = "0.7.3"
dbus-tokio = "0.7.3"
dbus-crossroads = "0.4.0"
dbus-crossroads = "0.4.0"
@@ -20,6 +22,7 @@ dbus_projection = { path = "../dbus_projection" }
dbus_macros = { path = "../dbus_projection/dbus_macros" }
dbus_macros = { path = "../dbus_projection/dbus_macros" }
env_logger = "0.8.3"
env_logger = "0.8.3"
futures = "0.3.13"
futures = "0.3.13"
glob = "0.3.0"
inotify = "*"
inotify = "*"
log = "0.4.14"
log = "0.4.14"
nix = "*"
nix = "*"
+3 −1
Original line number Original line Diff line number Diff line
@@ -3,11 +3,11 @@ use log::{error, info, warn};
use std::collections::HashMap;
use std::collections::HashMap;
use std::process::Command;
use std::process::Command;


use crate::config_util;
use crate::iface_bluetooth_manager::{
use crate::iface_bluetooth_manager::{
    AdapterWithEnabled, IBluetoothManager, IBluetoothManagerCallback,
    AdapterWithEnabled, IBluetoothManager, IBluetoothManagerCallback,
};
};
use crate::state_machine::{state_to_enabled, AdapterState, Message, StateMachineProxy};
use crate::state_machine::{state_to_enabled, AdapterState, Message, StateMachineProxy};
use crate::{config_util, migrate};


const BLUEZ_INIT_TARGET: &str = "bluetoothd";
const BLUEZ_INIT_TARGET: &str = "bluetoothd";


@@ -119,6 +119,7 @@ impl IBluetoothManager for BluetoothManager {
            if let Err(e) = Command::new("initctl").args(&["stop", BLUEZ_INIT_TARGET]).output() {
            if let Err(e) = Command::new("initctl").args(&["stop", BLUEZ_INIT_TARGET]).output() {
                warn!("Failed to stop bluetoothd: {}", e);
                warn!("Failed to stop bluetoothd: {}", e);
            }
            }
            migrate::migrate_bluez_devices();
            for hci in config_util::list_hci_devices() {
            for hci in config_util::list_hci_devices() {
                if config_util::is_hci_n_enabled(hci) {
                if config_util::is_hci_n_enabled(hci) {
                    let _ = self.proxy.start_bluetooth(hci);
                    let _ = self.proxy.start_bluetooth(hci);
@@ -130,6 +131,7 @@ impl IBluetoothManager for BluetoothManager {
                    let _ = self.proxy.stop_bluetooth(hci);
                    let _ = self.proxy.stop_bluetooth(hci);
                }
                }
            }
            }
            migrate::migrate_floss_devices();
            if let Err(e) = Command::new("initctl").args(&["start", BLUEZ_INIT_TARGET]).output() {
            if let Err(e) = Command::new("initctl").args(&["start", BLUEZ_INIT_TARGET]).output() {
                warn!("Failed to start bluetoothd: {}", e);
                warn!("Failed to start bluetoothd: {}", e);
            }
            }
+1 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,7 @@ pub mod config_util;
pub mod dbus_arg;
pub mod dbus_arg;
pub mod dbus_iface;
pub mod dbus_iface;
pub mod iface_bluetooth_manager;
pub mod iface_bluetooth_manager;
pub mod migrate;
pub mod powerd_suspend_manager;
pub mod powerd_suspend_manager;
pub mod service_watcher;
pub mod service_watcher;
pub mod state_machine;
pub mod state_machine;
+791 −0

File added.

Preview size limit exceeded, changes collapsed.