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

Commit 8c426e5d authored by Myles Watson's avatar Myles Watson
Browse files

Controller: Simplify ReadLocalSupportedCommands

Fixes: 175422340
Test: cert/run
Tag: #gd-refactor
Change-Id: Ie32fc5511d06f3218ecca743026876db70c8bcb4
parent 32107ef8
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -218,9 +218,6 @@ pub struct SupportedCommands {
impl SupportedCommands {
    /// Check whether a given opcode is supported by the controller
    pub fn is_supported(&self, opcode: OpCode) -> bool {
        match opcode {
            OpCode::ReadLocalSupportedCommands => true,
            _ => {
        let converted = OpCodeIndex::try_from(opcode);
        if converted.is_err() {
            return false;
@@ -228,13 +225,10 @@ impl SupportedCommands {

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

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

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