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

Commit 58f3a710 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Controller: Simplify ReadLocalSupportedCommands" am: f1a20b79 am: b33ad59c

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1563923

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib0a9ff9f68a50f968abcfc32fa657d729a5420dc
parents 44f66feb b33ad59c
Loading
Loading
Loading
Loading
+7 −13
Original line number Original line Diff line number Diff line
@@ -218,9 +218,6 @@ pub struct SupportedCommands {
impl SupportedCommands {
impl SupportedCommands {
    /// Check whether a given opcode is supported by the controller
    /// Check whether a given opcode is supported by the controller
    pub fn is_supported(&self, opcode: OpCode) -> bool {
    pub fn is_supported(&self, opcode: OpCode) -> bool {
        match opcode {
            OpCode::ReadLocalSupportedCommands => true,
            _ => {
        let converted = OpCodeIndex::try_from(opcode);
        let converted = OpCodeIndex::try_from(opcode);
        if converted.is_err() {
        if converted.is_err() {
            return false;
            return false;
@@ -228,13 +225,10 @@ impl SupportedCommands {


        let index = converted.unwrap().to_usize().unwrap();
        let index = converted.unwrap().to_usize().unwrap();


                // The 10 here looks sus, but hci_packets.pdl mentions the index value
        // OpCodeIndex is encoded as octet * 10 + bit for readability
                // is octet * 10 + bit
        self.supported[index / 10] & (1 << (index % 10)) == 1
        self.supported[index / 10] & (1 << (index % 10)) == 1
    }
    }
}
}
    }
}


macro_rules! supported_features {
macro_rules! supported_features {
    ($($id:ident => $page:literal : $bit:literal),*) => {
    ($($id:ident => $page:literal : $bit:literal),*) => {