diff --git a/docs/HARDWARE-QUALIFICATION.md b/docs/HARDWARE-QUALIFICATION.md new file mode 100644 index 0000000..75a85b2 --- /dev/null +++ b/docs/HARDWARE-QUALIFICATION.md @@ -0,0 +1,101 @@ +# Current-lineup qualification + +This engineering record tracks the current Etherlighting lineup for public-launch preparation. Catalog membership, firmware qualification, simulator checks, and physical-device acceptance are separate results. A public launch covering the entire lineup remains gated on the unresolved items below. + +## Scope and release evidence + +The November 14, 2026 inventory covers all 25 Etherlighting models in the current [U.S.](https://store.ui.com/us/en/category/all-switching) and [European](https://eu.store.ui.com/eu/en/category/all-switching) switching collections. Regional availability does not determine qualification. Vintage Enterprise models are outside this scope. The former EAV-24-PoE and EAV-Aggregation product names refer to the current EAV-XG-24-PoE and EAV-Fiber products; firmware identity is checked independently of store naming. + +Ubiquiti's model-specific release API was checked for all 25 platforms on November 14 at 23:51:59–23:52:00 UTC. Nine platforms point to two updated 7.6.11+17272 images. The other sixteen point to images already examined in the November 1 review. Release-channel metadata describes the available artifact, not an update observed on every controller. + +All six image hashes were compared with the official release metadata. The two newly downloaded images matched their official lengths and SHA-256 hashes. Microsoft Defender found no threats in those archives or their extracted files. Firmware was inspected as data, without running its programs or connecting to a switch. + +## Model matrix + +`Reviewed` means the current firmware's EE command path has static evidence and the adapter has deterministic fixtures. It is not physical acceptance. `Adapter open` means identification and topology are implemented, but output remains blocked pending the separate protocol and ownership implementation. + +| Model | Family | Release | Ethernet / optical / stacking | Current firmware | +| --- | --- | --- | --- | --- | +| USW-Pro-Max-16 | USPM16 | 7.5.15+17146 | 16 / 2 / 0 | Adapter open | +| USW-Pro-Max-16-PoE | USPM16 | 7.5.15+17146 | 16 / 2 / 0 | Adapter open | +| USW-Pro-Max-24 | USPM16 | 7.5.15+17146 | 24 / 2 / 0 | Adapter open | +| USW-Pro-Max-24-PoE | USPM16 | 7.5.15+17146 | 24 / 2 / 0 | Adapter open | +| USW-Pro-Max-48 | USPM16 | 7.5.15+17146 | 48 / 4 / 0 | Adapter open | +| USW-Pro-Max-48-PoE | USPM16 | 7.5.15+17146 | 48 / 4 / 0 | Adapter open | +| USW-Pro-HD-24 | USWED72 | 7.5.15+17146 | 24 / 4 / 0 | Reviewed | +| USW-Pro-HD-24-PoE | USWED72 | 7.5.15+17146 | 24 / 4 / 0 | Reviewed | +| USW-Pro-XG-8-PoE | USWED72 | 7.5.15+17146 | 8 / 2 / 0 | Reviewed | +| USW-Pro-XG-10-PoE | USWED72 | 7.5.15+17146 | 10 / 2 / 0 | Reviewed | +| USW-Pro-XG-24 | USWED42 | 7.6.11+17272 | 24 / 2 / 0 | Reviewed | +| USW-Pro-XG-24-PoE | USWED42 | 7.6.11+17272 | 24 / 2 / 0 | Reviewed | +| USW-Pro-XG-48 | USWED42 | 7.6.11+17272 | 48 / 4 / 0 | Reviewed | +| USW-Pro-XG-48-PoE | USWED42 | 7.6.11+17272 | 48 / 4 / 0 | Reviewed | +| USW-Pro-XG-Aggregation | USWED42 | 7.6.11+17272 | 0 / 32 / 0 | Reviewed | +| ECS-24-PoE | USWED42 | 7.6.11+17272 | 24 / 2 / 0 | Reviewed | +| ECS-48-PoE | USWED42 | 7.6.11+17272 | 48 / 4 / 0 | Reviewed | +| ECS-24S | USWF004 | 7.4.119+17363 | 24 / 4 / 2 | Reviewed | +| ECS-24S-PoE | USWF004 | 7.4.119+17363 | 24 / 4 / 2 | Reviewed | +| ECS-48S | USWF004 | 7.4.119+17363 | 48 / 4 / 2 | Reviewed | +| ECS-48S-PoE | USWF004 | 7.4.119+17363 | 48 / 4 / 2 | Reviewed | +| EAV-XG-24-PoE | USWF001 | 7.6.11+17272 | 24 / 4 / 0 | Reviewed | +| EAV-Fiber | USWF001 | 7.6.11+17272 | 0 / 22 / 0 | Reviewed | +| ECS-Aggregation | USWF066 | 4.0.1+995 | 0 / 54 / 0 | Adapter open | +| ECS-Core | USWF066 | 4.0.1+995 | 0 / 32 / 0 | Adapter open | + +The Pro XG 8 PoE has previous owner-observed lighting acceptance. The other 24 models still need independent physical acceptance. Stacking connectors and internal MCU sentinel records are excluded from lighting writes. + +## Updated firmware + +The release images are available from Ubiquiti's metadata records: + +- [USWED42 release](https://fw-update.ui.com/api/firmware/b5cfb8d3-ae65-4b6f-9e5a-9fe08349fe7c): 26,981,723 bytes, SHA-256 `6a42bab5c5a54fcecc71809cae0348f15c22beba4c98a15877267c1d9aea4e34`. +- [USWF001 release](https://fw-update.ui.com/api/firmware/39509992-77d6-4fd2-887e-15f60b315c13): 29,416,687 bytes, SHA-256 `4dce222ddc769fa4a67012b7d23aec562d4e1a4df1d540eeaf20a108349e1f9c`. + +The running daemon changes in both families. Their MCU images remain byte-identical to the previously reviewed releases. The model identities, physical port records and lighting schemas also match. The new library changes board-record stride, so static-analysis offsets cannot be reused blindly. EE reads the board identity through the existing text interface. + +The scoped comparison reached a stable set of 59 functions in each family: 6,972 instructions for USWED42 and 7,000 for USWF001. The final data-reference passes covered 402 and 400 references, respectively. The selected get/set/dump handlers, model-selected probe and cleanup callbacks, reachable internal callees, direct import targets and branch relationships match after relocation. Referenced data was checked separately, including manually resolved stack-loaded pointer bases and fixed-width constants. This establishes equivalence of the examined lighting path, not of the whole executable or every firmware subsystem. + +EE admits the two new daemon hashes only with their corresponding MCU hash. The older reviewed pairs remain accepted. Original profile identity fields remain unchanged so saved scenes are retained across the reviewed firmware change. Regression coverage exercises every admitted model/firmware pair, qualification revocation and recovery, cross-family and wrong-path rejection, synthetic crossed-pair rejection, and saved-scene loading through upgrade and return to the older pair. + +| Family | New running daemon SHA-256 | Corresponding MCU SHA-256 | +| --- | --- | --- | +| USWED42 | `9de90875f77a65c5d3006308ab4e707a79d420cca8f4c4994a3de2896df59109` | `8c79c0050ba28fa933f3b1a71d530665ef560775793f133fae17a85482508322` | +| USWF001 | `4599de216f558d4425782518a7cfd8fe234bc2d4eba3967c9802951debdb4220` | `8c79c0050ba28fa933f3b1a71d530665ef560775793f133fae17a85482508322` | + +## Pro Max adapter work + +All six current models resolve lighting device 33 to I2C bus 104 and address 0x66. Hash-pinned kernel tables and instruction paths establish this discovery; it does not grant output access. + +The existing proc helper stages values and commits shared MCU records, and it can hide transfer failures. Its kernel helper also returns zero when the adapter is absent. Built-in BusyBox checks block-write errors, but its optional readback failure or mismatch can return success. The legacy ioctl operation it uses still needs translation verified against the kernel path. + +The vendor host mapping is now traced across all 192 connector rows in the six models: ordered board configuration becomes the logical port, and the host sends the zero-based connector index in opcode 0x20. All six system-ID-to-MCU-board selections are resolved. Pro Max 16 uses host records 0–17, Pro Max 24 uses 0–25, and Pro Max 48 uses 0–51. + +The connector map is source-qualified for these exact model/firmware profiles. Each connector has a unique output ID, and those IDs are disjoint from the extra MCU records on every model. The status-bit map is a separate index space; its different ordering does not establish a routing defect. Extra MCU records must stay outside connector command masks. Physical output acceptance remains unobserved. The next adapter also needs bounded packet encoding and independent completion checks: acknowledgment occurs before execution, so successful submission is not confirmation that a queued command completed. + +The MCU has a bounded readback lead: selecting register 0x10 snapshots current RGBW and retains the selected-record echo. A checked echo plus eight color bytes can corroborate the selected record's observed MCU values. The host transfer, response lengths and interleaving behavior still need qualification. This is not a completed adapter or confirmation of animation behavior, unique command execution or physical light output. + +Ownership also requires proof. Mode 3 suppresses ordinary link/PoE writers, but locate and controller device-type changes have separate paths. A controller change can retain the same mode. Restoring a cached mode would risk overwriting newer controller intent. No output adapter should use broad configuration locks, stop vendor services or infer exclusive ownership from this mode alone. + +## Campus aggregation and core adapter work + +The SONiC daemon and MCU use a separate protocol. The current MCU's Aggregation table contains 54 physical output records plus two sentinel records; Core has 32 physical records plus two sentinels. Those internal records do not expand the public port map. + +Daemon `get` returns cached mode. `dump` logs configuration and calibration rather than reporting active output. The `off` value is parsed but follows the invalid-mode branch. Returning to speed mode does not propagate each MCU write result. These responses cannot substitute for confirmed cleanup. + +MCU selector register 0x10 can snapshot the selected port's active channels; registers 0x11–0x18 return four 16-bit values. This is useful evidence beyond the daemon cache, but the ubus interface does not expose it. A production adapter needs an atomic selector/read route sharing vendor bus serialization. A separate raw helper would bypass the daemon's process-local mutex. Physical light output remains a separate measurement. + +Mode 3 suppresses normal link events, but direct color writes bypass it. Controller-policy reconciliation and completion-aware cleanup remain required before output admission. + +## Launch acceptance + +Every enabled model/firmware pair must pass identity, schema, exact hash-pair, connector mapping, pacing, stale-connection revocation, interrupted apply, reconnect and cleanup checks. Malformed or cross-family evidence must leave the writer unbound. A firmware update must retain saved settings while requiring fresh qualification on its new connection. + +The ordinary Lighting, Effects, Automation and Profiles workspace must remain usable. No playback gate or separate effect editor is part of this work. Browser and native topology fixtures cover the model layouts; physical labeling and visible behavior need device acceptance. + +Switch-resident playback is currently specific to Pro XG 8 PoE. It uses a RAM-resident player. Other models need their own telemetry, port-map and resource-budget validation before that path is enabled. Isolated reboot recovery and direct UniFi-edit precedence remain open, including on Pro XG 8 PoE. Firmware analysis alone cannot establish those behaviors. + +Before enabling a new family, a controlled device acceptance run must verify every physical port at bounded brightness, an unchanged nonselected port, link/PoE stability, sustained CPU/memory and command latency, loss of the desktop/SSH connection, explicit handoff and recovery. Reboot testing requires a supported persistent startup mechanism and separate authorization for the network interruption. Public release notes must describe only the model/firmware behavior actually accepted. + +## Evidence handling + +Firmware images, extracted binaries, raw disassembly, private diagnostics and tool packages remain outside the source repository. The private evidence bundle records official metadata, file hashes, Defender results, reproducible table/code checks and their outputs. Repository tests cover software behavior without contacting a switch. Neither a clean scan nor static equivalence is a guarantee of zero physical risk. diff --git a/docs/HARDWARE.md b/docs/HARDWARE.md index 12d8e29..1f2ced4 100644 --- a/docs/HARDWARE.md +++ b/docs/HARDWARE.md @@ -5,7 +5,10 @@ and system ID, the exact running lighting-daemon hash, the corresponding MCU ima method schema on the current SSH lighting connection. A different firmware build requires another review. `eectl probe` performs read-only discovery and returns success only when this output gate passes. -## Firmware coverage in 0.4.10 +The [current-lineup qualification record](HARDWARE-QUALIFICATION.md) tracks the November 2026 release +inventory, firmware evidence, separate playback qualification and remaining public-launch gates. + +## Reviewed firmware coverage The following profiles have been traced through the official firmware's board dispatch, per-port RGB16 parser, MCU output mapping, native fade code, and scoped optical ownership operations. Offline fixtures @@ -17,15 +20,15 @@ the reviewed command path; physical appearance and sustained load on additional | Pro XG 8 PoE | 1–8 | 9–10 | USWED72 / 7.5.15+17146 | | Pro XG 10 PoE | 1–10 | 11–12 | USWED72 / 7.5.15+17146 | | Pro HD 24, Pro HD 24 PoE | 1–24 | 25–28 | USWED72 / 7.5.15+17146 | -| Pro XG 24, Pro XG 24 PoE | 1–24 | 25–26 | USWED42 / 7.5.15+17146 | -| Pro XG 48, Pro XG 48 PoE | 1–48 | 49–52 | USWED42 / 7.5.15+17146 | -| Pro XG Aggregation | — | 1–32 | USWED42 / 7.5.15+17146 | -| ECS-24-PoE | 1–24 | 25–26 | USWED42 / 7.5.15+17146 | -| ECS-48-PoE | 1–48 | 49–52 | USWED42 / 7.5.15+17146 | +| Pro XG 24, Pro XG 24 PoE | 1–24 | 25–26 | USWED42 / 7.5.15+17146, 7.6.11+17272 | +| Pro XG 48, Pro XG 48 PoE | 1–48 | 49–52 | USWED42 / 7.5.15+17146, 7.6.11+17272 | +| Pro XG Aggregation | — | 1–32 | USWED42 / 7.5.15+17146, 7.6.11+17272 | +| ECS-24-PoE | 1–24 | 25–26 | USWED42 / 7.5.15+17146, 7.6.11+17272 | +| ECS-48-PoE | 1–48 | 49–52 | USWED42 / 7.5.15+17146, 7.6.11+17272 | | ECS-24S, ECS-24S-PoE | 1–24 | 25–28 | USWF004 / 7.4.119+17363 | | ECS-48S, ECS-48S-PoE | 1–48 | 49–52 | USWF004 / 7.4.119+17363 | -| EAV-XG-24-PoE | 1–24 | 25–28 | USWF001 / 7.5.15+17146 | -| EAV-Fiber | — | 1–22 | USWF001 / 7.5.15+17146 | +| EAV-XG-24-PoE | 1–24 | 25–28 | USWF001 / 7.5.15+17146, 7.6.11+17272 | +| EAV-Fiber | — | 1–22 | USWF001 / 7.5.15+17146, 7.6.11+17272 | The Pro XG 8 PoE has been tested on hardware for its copper ports and both SFP indicators. The other profiles are firmware-qualified candidates that have not been tested on a physical switch. Stacking ports and extra internal MCU records are excluded from output. diff --git a/src/etherlighting_evolved/hardware.py b/src/etherlighting_evolved/hardware.py index f38d9ca..b89e152 100644 --- a/src/etherlighting_evolved/hardware.py +++ b/src/etherlighting_evolved/hardware.py @@ -17,6 +17,13 @@ "USWF004": ("36f84073384f271008f83dd37ac900b2c59e68e8a210de30fb9fa755d1d49ec3", "9d8740e2767cf676822648573d00ec82d07f5903e9ebad197684f5be17267224"), } +# Retain the original pair above because saved scene identities include it. +_ADDITIONAL_FIRMWARE = { + "USWED42": (("9de90875f77a65c5d3006308ab4e707a79d420cca8f4c4994a3de2896df59109", + "8c79c0050ba28fa933f3b1a71d530665ef560775793f133fae17a85482508322"),), + "USWF001": (("4599de216f558d4425782518a7cfd8fe234bc2d4eba3967c9802951debdb4220", + "8c79c0050ba28fa933f3b1a71d530665ef560775793f133fae17a85482508322"),), +} @dataclass(frozen=True, slots=True) @@ -34,6 +41,12 @@ class HardwareProfile: mcu_sha256: str = "" sfp_masks: tuple[tuple[int, str], ...] = () + @property + def firmware_pairs(self) -> tuple[tuple[str, str], ...]: + if PROFILES.get(self.key) is not self or not self.output_verified: + return () + return ((self.daemon_sha256, self.mcu_sha256), *_ADDITIONAL_FIRMWARE.get(self.family, ())) + def public_dict(self) -> dict: return { "id": self.key, "model": self.model, "family": self.family, diff --git a/src/etherlighting_evolved/switch.py b/src/etherlighting_evolved/switch.py index 9549b47..6f6a53d 100644 --- a/src/etherlighting_evolved/switch.py +++ b/src/etherlighting_evolved/switch.py @@ -430,15 +430,20 @@ async def probe(self) -> dict: digest = (await self.transport.run(RUNNING_DAEMON_HASH, timeout=5)).strip() except TransportError: digest = "" + daemon_match = re.fullmatch(r"([0-9a-f]{64})\s+/proc/[1-9][0-9]*/exe", digest) + firmware_pairs = profile.firmware_pairs if (generation is not None and generation is self.transport.lighting_generation - and re.fullmatch(profile.daemon_sha256 + r"\s+/proc/[1-9][0-9]*/exe", digest)): + and daemon_match is not None + and any(pair[0] == daemon_match[1] for pair in firmware_pairs)): if self.transport.behavior_supported: try: firmware = (await self.transport.run(PORT_FIRMWARE_HASH_COMMAND, timeout=5)).strip() except TransportError: firmware = "" - if (generation is self.transport.lighting_generation and re.fullmatch( - profile.mcu_sha256 + r"\s+/usr/share/firmware/port_led_fw\.bin", firmware)): + firmware_match = re.fullmatch( + r"([0-9a-f]{64})\s+/usr/share/firmware/port_led_fw\.bin", firmware) + if (generation is self.transport.lighting_generation and firmware_match is not None + and (daemon_match[1], firmware_match[1]) in firmware_pairs): self.transport.configure_lighting_profile(profile) if self.transport.sfp_mode_supported: self.sfp_ports = profile.optical_ports diff --git a/tests/test_hardware_profiles.py b/tests/test_hardware_profiles.py index a1081ac..fce5d75 100644 --- a/tests/test_hardware_profiles.py +++ b/tests/test_hardware_profiles.py @@ -17,6 +17,10 @@ def identity(profile): QUALIFIED = tuple(p for p in PROFILES.values() if p.output_verified) +QUALIFIED_FIRMWARE = tuple( + pytest.param(profile, daemon, mcu, id=f"{profile.key}-{daemon[:8]}") + for profile in QUALIFIED for daemon, mcu in profile.firmware_pairs +) @pytest.mark.parametrize("profile", PROFILES.values(), ids=lambda p: p.key) @@ -71,12 +75,12 @@ def test_catalog_presence_does_not_grant_output(profile): @pytest.mark.anyio @pytest.mark.usefixtures("clock") -@pytest.mark.parametrize("profile", QUALIFIED, ids=lambda p: p.key) -async def test_detected_layout_native_output_and_scoped_cleanup(profile): +@pytest.mark.parametrize("profile,daemon,mcu", QUALIFIED_FIRMWARE) +async def test_detected_layout_native_output_and_scoped_cleanup(profile, daemon, mcu): device = MemoryTransport() device.board = identity(profile) - device.daemon = profile.daemon_sha256 + " /proc/123/exe" - device.firmware = profile.mcu_sha256 + " /usr/share/firmware/port_led_fw.bin" + device.daemon = daemon + " /proc/123/exe" + device.firmware = mcu + " /usr/share/firmware/port_led_fw.bin" switch = EtherlightSwitch(device, auto_detect=True) await switch.connect() info = await switch.probe() @@ -106,21 +110,55 @@ async def test_detected_layout_native_output_and_scoped_cleanup(profile): @pytest.mark.anyio -@pytest.mark.parametrize("fault", ["daemon", "firmware", "identity", "topology"]) -async def test_profile_output_gate_refuses_mismatch(fault): - profile = PROFILES["USPH24"] +@pytest.mark.parametrize("profile,daemon,mcu", QUALIFIED_FIRMWARE) +@pytest.mark.parametrize("fault", ["daemon", "firmware", "identity", "topology", "schema", "connection"]) +async def test_profile_output_gate_revokes_previous_qualification_on_mismatch(profile, daemon, mcu, fault): device = MemoryTransport() device.board = identity(profile) + device.daemon = daemon + " /proc/123/exe" + device.firmware = mcu + " /usr/share/firmware/port_led_fw.bin" + switch = EtherlightSwitch(device, auto_detect=True) + await switch.connect() + await switch.probe() + switch.require_output_profile() + assert device.profile is profile + if fault in {"daemon", "firmware"}: setattr(device, fault, "0" * 64 + " " + getattr(device, fault).split()[1]) - if fault == "identity": - device.board += "board.name=USW-Pro-XG-8-PoE\n" - switch = EtherlightSwitch(device, auto_detect=fault != "topology") - await switch.connect() + elif fault == "identity": + device.board += "board.sysid=0xffff\n" + elif fault == "topology": + switch.auto_detect = False + switch.num_ports = len(profile.copper_ports) + 1 + elif fault == "schema": + device.precise_rgb_supported = device.sfp_mode_supported = False + elif fault == "connection": + from etherlighting_evolved.switch import PORT_FIRMWARE_HASH_COMMAND + + async def replace_connection(command): + if command == PORT_FIRMWARE_HASH_COMMAND: + device.lighting_generation = object() + + device.read_hook = replace_connection + await switch.probe() with pytest.raises(ValueError): switch.require_output_profile() + assert device.profile is None assert not device.events and not switch.sfp_ports + assert not switch.native_breathing and not switch.scoped_sfp + + device.board = identity(profile) + device.daemon = daemon + " /proc/123/exe" + device.firmware = mcu + " /usr/share/firmware/port_led_fw.bin" + device.precise_rgb_supported = device.sfp_mode_supported = True + device.read_hook = None + switch.auto_detect = True + await switch.probe() + switch.require_output_profile() + assert device.profile is profile + await switch.close() + assert device.profile is None and not device.events @pytest.mark.anyio @@ -136,3 +174,91 @@ async def test_unqualified_family_discovery_is_read_only(profile): assert not switch.sfp_ports and not device.events with pytest.raises(ValueError): switch.require_output_profile() + + +@pytest.mark.anyio +@pytest.mark.parametrize("profile,daemon,mcu", QUALIFIED_FIRMWARE) +@pytest.mark.parametrize("fault", ["foreign_daemon", "foreign_mcu", "daemon_path", "mcu_path"]) +async def test_firmware_admission_rejects_cross_family_hashes_and_wrong_paths(profile, daemon, mcu, fault): + other = next(p for p in QUALIFIED if p.family != profile.family and p.mcu_sha256 != mcu) + device = MemoryTransport() + device.board = identity(profile) + device.daemon = daemon + " /proc/123/exe" + device.firmware = mcu + " /usr/share/firmware/port_led_fw.bin" + if fault == "foreign_daemon": + device.daemon = other.daemon_sha256 + " /proc/123/exe" + elif fault == "foreign_mcu": + device.firmware = other.mcu_sha256 + " /usr/share/firmware/port_led_fw.bin" + elif fault == "daemon_path": + device.daemon = daemon + " /bin/ubntbox" + else: + device.firmware = mcu + " /tmp/port_led_fw.bin" + switch = EtherlightSwitch(device, auto_detect=True) + await switch.connect() + await switch.probe() + with pytest.raises(ValueError): + switch.require_output_profile() + assert device.profile is None and not device.events + assert not switch.native_breathing and not switch.scoped_sfp + await switch.close() + + +@pytest.mark.anyio +@pytest.mark.parametrize("profile", [p for p in QUALIFIED if len(p.firmware_pairs) > 1], ids=lambda p: p.key) +async def test_firmware_upgrade_preserves_saved_scene_and_device_identity(profile, config): + from etherlighting_evolved.session import SessionManager + + manager = SessionManager(config) + device = MemoryTransport() + device.board = identity(profile) + device.host_key_fingerprint = "SHA256:firmware-upgrade-fixture" + switch = EtherlightSwitch(device, auto_detect=True) + await switch.connect() + saved = None + for daemon, mcu in (*profile.firmware_pairs, profile.firmware_pairs[0]): + device.daemon = daemon + " /proc/123/exe" + device.firmware = mcu + " /usr/share/firmware/port_led_fw.bin" + await switch.probe() + switch.require_output_profile() + store = manager._device_store(switch) + if saved is None: + store.save({"brightness": 37, "name": "Saved settings"}) + saved = store + else: + assert store.path == saved.path and store.identity == saved.identity + assert store.load() == {"brightness": 37, "name": "Saved settings"} + assert not device.events + await switch.close() + + +@pytest.mark.anyio +@pytest.mark.parametrize("daemon_variant,mcu_variant,accepted", [ + (0, 0, True), (1, 1, True), (0, 1, False), (1, 0, False), +]) +async def test_firmware_pair_admission_does_not_allow_crossed_pairs( + daemon_variant, mcu_variant, accepted, monkeypatch): + from etherlighting_evolved import hardware + + profile = PROFILES["USWPXG24"] + daemons = (profile.daemon_sha256, "a" * 64) + mcus = (profile.mcu_sha256, "b" * 64) + monkeypatch.setattr(hardware, "_ADDITIONAL_FIRMWARE", { + profile.family: ((daemons[1], mcus[1]),), + }) + device = MemoryTransport() + device.board = identity(profile) + device.daemon = daemons[daemon_variant] + " /proc/123/exe" + device.firmware = mcus[mcu_variant] + " /usr/share/firmware/port_led_fw.bin" + switch = EtherlightSwitch(device, auto_detect=True) + await switch.connect() + await switch.probe() + if accepted: + switch.require_output_profile() + assert device.profile is profile + else: + with pytest.raises(ValueError): + switch.require_output_profile() + assert device.profile is None + assert not switch.native_breathing and not switch.scoped_sfp + assert not device.events + await switch.close()