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

Commit cca5ba47 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Gerrit Code Review
Browse files

Merge "floss: Add sysprop for RTL advertisement monitor quirk" into main

parents 1053428c d55c6797
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -61,3 +61,31 @@ pub fn get_i32(prop: PropertyI32) -> i32 {
        )
    }
}

/// List of properties accessible to Rust. Add new ones here as they become
/// necessary.
pub enum PropertyBool {
    // bluetooth.core.le
    LeAdvMonRtlQuirk,
}

impl Into<(Vec<u8>, bool)> for PropertyBool {
    /// Convert the property into the property key name and a default value.
    fn into(self) -> (Vec<u8>, bool) {
        let (key, default_value) = match self {
            PropertyBool::LeAdvMonRtlQuirk => ("bluetooth.core.le.adv_mon_rtl_quirk", false),
        };

        (key.bytes().chain("\0".bytes()).collect::<Vec<u8>>(), default_value)
    }
}

/// Get the boolean value for a system property.
pub fn get_bool(prop: PropertyBool) -> bool {
    let (key, default_value) = prop.into();
    let key_cptr = LTCheckedPtr::from(&key);

    unsafe {
        bindings::osi_property_get_bool(key_cptr.cast_into::<std::os::raw::c_char>(), default_value)
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ void SyspropsModule::parse_config(std::string file_path) {
      "bluetooth.core.le.inquiry_scan_window",
      "bluetooth.core.le.adv_mon_scan_interval",
      "bluetooth.core.le.adv_mon_scan_window",
      "bluetooth.core.le.adv_mon_rtl_quirk",
      "bluetooth.core.le.vendor_capabilities.enabled",
      // SCO
      "bluetooth.sco.disable_enhanced_connection",