How OCLP-Mod Detects Broadcom Wireless Chipsets: Architecture and Detection Logic

OCLP-Mod identifies Broadcom wireless adapters by verifying that the computer’s Wi-Fi object is an instance of device_probe.Broadcom and that its chipset attribute matches specific constants defined in the Broadcom.Chipsets enumeration.

The detection logic lives inside the OpenCore Legacy Patcher Mod (OCLP-Mod) repository and drives whether the “modern” or “legacy” Broadcom patch set is applied during system patching. By combining Python’s isinstance checks with explicit chipset whitelists, the codebase ensures that only compatible kexts and firmware are injected for each generation of Broadcom hardware.

Detection Architecture Overview

The Device Probe Layer

At the heart of the detection system is oclp_mod/detections/device_probe.py. This file defines the Broadcom class (around line 528), which inherits from a generic WirelessCard base. The class exposes a chipset attribute that holds an instance of the nested Chipsets enumeration.

When OCLP-Mod initializes, it probes the hardware and populates a Computer object. If the Wi-Fi controller reports a Broadcom vendor ID, the probe instantiates device_probe.Broadcom and stores it in computer.wifi. All downstream decisions rely on this single object.

The Chipset Enumeration

The Broadcom.Chipsets enum (defined immediately inside the Broadcom class) lists every supported controller family:

Enum Member Typical Hardware
AirPortBrcm4360 BCM4360‑based cards (802.11ac)
AirportBrcmNIC Native BCM43xx “NIC” variants
AirPortBrcmNICThirdParty Third‑party BCM NICs
AirPortBrcm4331 BCM4331 (802.11n)
AirPortBrcm43224 BCM43224/BCM43225

Patch sets reference these constants to decide whether a given card qualifies for modern or legacy treatment.

Modern vs. Legacy Broadcom Detection

Modern Wireless Chipsets

The oclp_mod/sys_patch/patchsets/hardware/networking/modern_wireless.py file (lines 26‑30 and 58‑63) implements the modern detection gate:

bcm_detected = (
    isinstance(self._computer.wifi, device_probe.Broadcom) and
    self._computer.wifi.chipset in (
        device_probe.Broadcom.Chipsets.AirPortBrcm4360,
        device_probe.Broadcom.Chipsets.AirportBrcmNIC,
        device_probe.Broadcom.Chipsets.AirPortBrcmNICThirdParty,
    )
)

If bcm_detected evaluates to True, the patch set injects the AirPortBrcm4360 or AirPortBrcmNIC kernel extensions and associated firmware, enabling 802.11ac/ax functionality on unsupported macOS versions.

Legacy Wireless Chipsets

For older hardware, oclp_mod/sys_patch/patchsets/hardware/networking/legacy_wireless.py (lines 35‑38 and 59‑60) uses a narrower whitelist:

if (
    isinstance(self._computer.wifi, device_probe.Broadcom) and
    self._computer.wifi.chipset in [
        device_probe.Broadcom.Chipsets.AirPortBrcm4331,
        device_probe.Broadcom.Chipsets.AirPortBrcm43224,
    ]
):
    self.patchName = "Broadcom无线网卡"

When this condition is met, OCLP‑Mod applies the legacy AirPortBrcm4331 or AirPortBrcm43224 patches, restoring 802.11n support on systems such as MacBookPro8,x or Macmini5,x running newer macOS releases.

Implementation in Patch Sets

Both modern and legacy patch sets follow the same three‑step pattern:

  1. Type verification – isinstance(self._computer.wifi, device_probe.Broadcom) guarantees the object exposes the Broadcom‑specific chipset attribute.
  2. Chipset whitelist – Membership testing against Broadcom.Chipsets constants filters out unsupported or non‑Broadcom hardware.
  3. Patch registration – Upon success, the patch set appends the appropriate kexts, firmware, and boot arguments to the OpenCore configuration.

Below is a condensed utility function that mirrors the internal logic:

from oclp_mod.detections import device_probe

def detect_broadcom_generation(computer):
    """
    Returns 'modern', 'legacy', or None based on the
    Broadcom wireless chipset detection rules used by OCLP‑Mod.
    """
    wifi = computer.wifi

    if not isinstance(wifi, device_probe.Broadcom):
        return None

    modern_chipsets = {
        device_probe.Broadcom.Chipsets.AirPortBrcm4360,
        device_probe.Broadcom.Chipsets.AirportBrcmNIC,
        device_probe.Broadcom.Chipsets.AirPortBrcmNICThirdParty,
    }

    legacy_chipsets = {
        device_probe.Broadcom.Chipsets.AirPortBrcm4331,
        device_probe.Broadcom.Chipsets.AirPortBrcm43224,
    }

    if wifi.chipset in modern_chipsets:
        return "modern"
    elif wifi.chipset in legacy_chipsets:
        return "legacy"
    return None

EFI Builder Integration

The same detection rules propagate into the EFI generation stage. In oclp_mod/efi_builder/networking/wireless.py (around line 53), the builder inspects self.computer.wifi using the identical isinstance and chipset checks. When a match is found, the builder injects the required AirPort kexts and firmware blobs into the OpenCore Kexts folder and updates config.plist with the appropriate Kernel → Add entries.

This mirroring guarantees that the live patching logic and the offline EFI creation stay consistent—users receive the same Broadcom support regardless of whether they run the patcher on‑the‑fly or generate a standalone USB installer.

Summary

  • Type safety first – All Broadcom detection starts with isinstance(self._computer.wifi, device_probe.Broadcom) to ensure the object carries the required chipset attribute.
  • Chipset whitelists – Modern patches target AirPortBrcm4360, AirportBrcmNIC, and AirPortBrcmNICThirdParty; legacy patches target AirPortBrcm4331 and AirPortBrcm43224.
  • Unified logic – The same detection pattern appears in modern_wireless.py, legacy_wireless.py, and efi_builder/networking/wireless.py, ensuring consistent patch application and EFI generation.
  • Extensibility – Adding support for a new Broadcom chipset only requires adding a new constant to Broadcom.Chipsets and including it in the appropriate whitelist.

Frequently Asked Questions

How does OCLP-Mod differentiate between modern and legacy Broadcom cards?

OCLP-Mod uses the chipset attribute exposed by the device_probe.Broadcom class. If the chipset is AirPortBrcm4360, AirportBrcmNIC, or AirPortBrcmNICThirdParty, the patcher selects the modern wireless patch set. If the chipset is AirPortBrcm4331 or AirPortBrcm43224, the legacy patch set is chosen instead.

Can I add support for a new Broadcom chipset without modifying the core detection logic?

Yes. You only need to append the new chipset constant to the Broadcom.Chipsets enumeration in device_probe.py and then include that constant in the relevant whitelist inside modern_wireless.py or legacy_wireless.py. The existing isinstance checks will automatically recognize the new chipset as a valid Broadcom device.

Why does the EFI builder use the same detection logic as the patch sets?

The EFI builder (efi_builder/networking/wireless.py) mirrors the patch‑set detection to guarantee that the generated OpenCore configuration contains the exact kernel extensions and firmware required for the detected Broadcom card. This parity prevents mismatches where the live patcher would apply fixes that the standalone EFI lacks, ensuring consistent wireless functionality across both installation methods.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →