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

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

floss: Add floss-only properties for LE scan params during AdvMon

BlueZ has separate LE scan parameters for interval and window
that are used for passive scanning supporting the advertisement
monitor APIs. Add a similar property on Floss to control those
parameters and set the default value to match BlueZ.

Bug: 328278477
Tag: #floss
Test: mmm packages/modules/Bluetooth
Test: Manually inspect snoop logs for LE scan window/interval
Test: Manually check phone hub latency with new parameters
Flag: EXEMPT, floss change for ChromeOS only
Change-Id: I864610fe053fc6af159dfcc0976e175352e3906e
parent f532b9a6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2027,8 +2027,8 @@ impl IBluetoothGatt for BluetoothGatt {

        // If the client is not specifying scan settings, the default one will be used.
        let settings = settings.unwrap_or_else(|| ScanSettings {
            interval: sysprop::get_i32(sysprop::PropertyI32::LeInquiryScanInterval),
            window: sysprop::get_i32(sysprop::PropertyI32::LeInquiryScanWindow),
            interval: sysprop::get_i32(sysprop::PropertyI32::LeAdvMonScanInterval),
            window: sysprop::get_i32(sysprop::PropertyI32::LeAdvMonScanWindow),
            scan_type: ScanType::default(),
        });

+12 −4
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@ pub enum PropertyI32 {
    // bluetooth.core.le
    LeInquiryScanInterval,
    LeInquiryScanWindow,
    LeAdvMonScanInterval,
    LeAdvMonScanWindow,

    // bluetooth.device_id
    ProductId,
@@ -21,11 +23,17 @@ impl Into<(Vec<u8>, i32)> for PropertyI32 {
    /// Convert the property into the property key name and a default value.
    fn into(self) -> (Vec<u8>, i32) {
        let (key, default_value) = match self {
            // Inquiry scan interval  = N * 0.625 ms; value of 432 = 270ms
            PropertyI32::LeInquiryScanInterval => ("bluetooth.core.le.inquiry_scan_interval", 430),
            // Inquiry scan interval = N * 0.625 ms; value of 36 = 22.5ms
            PropertyI32::LeInquiryScanInterval => ("bluetooth.core.le.inquiry_scan_interval", 36),

            //Inquiry scan window  = N * 0.625 ms; value of 216 = 135ms
            PropertyI32::LeInquiryScanWindow => ("bluetooth.core.le.inquiry_scan_window", 216),
            //Inquiry scan window = N * 0.625 ms; value of 18 = 11.25ms
            PropertyI32::LeInquiryScanWindow => ("bluetooth.core.le.inquiry_scan_window", 18),

            // Adv Mon scan interval = N * 0.625 ms; value of 40 = 25ms
            PropertyI32::LeAdvMonScanInterval => ("bluetooth.core.le.adv_mon_scan_interval", 40),

            // Adv Mon scan window = N * 0.625 ms; value of 20 = 12.5ms
            PropertyI32::LeAdvMonScanWindow => ("bluetooth.core.le.adv_mon_scan_window", 20),

            PropertyI32::ProductId => ("bluetooth.device_id.product_id", 0),
            PropertyI32::ProductVersion => ("bluetooth.device_id.product_version", 0),
+2 −0
Original line number Diff line number Diff line
@@ -104,6 +104,8 @@ void SyspropsModule::parse_config(std::string file_path) {
      "bluetooth.core.le.connection_scan_window_slow",
      "bluetooth.core.le.inquiry_scan_interval",
      "bluetooth.core.le.inquiry_scan_window",
      "bluetooth.core.le.adv_mon_scan_interval",
      "bluetooth.core.le.adv_mon_scan_window",
      "bluetooth.core.le.vendor_capabilities.enabled",
      // SCO
      "bluetooth.sco.disable_enhanced_connection",