Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.7.2

- EE controls the USW-Pro-XG-8-PoE again after the switch updates itself to UniFi firmware 7.6.11+17272, which Ubiquiti released on November 23. EE refused that firmware because it accepted only 7.5.15+17146 for this model. The new firmware keeps the port LED controller firmware unchanged and changes the program that receives lighting commands. EE accepts it on the Pro XG 8 PoE only, and only while the switch reports exactly the lighting commands and options EE was verified with; any difference keeps EE from controlling the lighting and names the difference. The Pro HD 24, Pro HD 24 PoE and Pro XG 10 PoE still need 7.5.15+17146. `docs/HARDWARE-QUALIFICATION.md` describes the evidence and its limits.

## 0.7.1

This release updates packages in the lighting service. EE behaves as in 0.7.0. It is the first release that copies of 0.7.0 install on their own.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Company>Views2k</Company>
<Authors>Views2k</Authors>
<Description>Lighting controls for UniFi switches</Description>
<Version>0.7.1</Version>
<Version>0.7.2</Version>
<ApplicationIcon>../../src/etherlighting_evolved/assets/ee.ico</ApplicationIcon>
<InvariantGlobalization>true</InvariantGlobalization>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
Expand Down
19 changes: 18 additions & 1 deletion docs/HARDWARE-QUALIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ All six image hashes were compared with the official release metadata. The two n
| 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-8-PoE | USWED72 | 7.6.11+17272 | 8 / 2 / 0 | Reviewed for 7.5.15+17146; 7.6.11+17272 admitted on interface and owner acceptance |
| 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 |
Expand Down Expand Up @@ -62,6 +62,23 @@ EE admits the two new daemon hashes only with their corresponding MCU hash. The
| USWED42 | `9de90875f77a65c5d3006308ab4e707a79d420cca8f4c4994a3de2896df59109` | `8c79c0050ba28fa933f3b1a71d530665ef560775793f133fae17a85482508322` |
| USWF001 | `4599de216f558d4425782518a7cfd8fe234bc2d4eba3967c9802951debdb4220` | `8c79c0050ba28fa933f3b1a71d530665ef560775793f133fae17a85482508322` |

## USWED72 7.6.11+17272 on the Pro XG 8 PoE

Ubiquiti published 7.6.11+17272 for USWED72 on November 23, 2026 (11,229,856 bytes, SHA-256 `306148c37c080a58898980fbc0eb379877a1bfafc41d6bed74f31082eff82872`, matching the release metadata). An owner switch installed it automatically, and EE then refused it, because only the 7.5.15+17146 pair was admitted. Microsoft Defender found no threats in the image or its extracted files.

Of the 75 lighting-related files extracted from the image, 59 are byte-identical to 7.5.15+17146:

- The port LED MCU firmware that `/usr/share/firmware/port_led_fw.bin` links to is unchanged (`cb99c14250ed28c77a00d4df46bf699db6b87f5a1094d0b10cfc79f2d5832a8c`, version 1.19.5).
- `bin/ubus`, `bin/ubusd` and the `ubnt-etherlight.ko` kernel module are unchanged.
- The lighting daemon changed: `/bin/etherlightd` still links to `/bin/ubntbox`, now 2,084,012 bytes with SHA-256 `bea59c0a3a1c261814a1460b1420639c4e1465effa609d1dbfbbdb226203c85b`. `lib/libubnt.so.1.0.0` changed as well.

The daemon's lighting code was not compared with 7.5.15+17146, unlike the USWED42 and USWF001 updates above. The admission therefore rests on different evidence and is narrower:

- It covers the USW-Pro-XG-8-PoE only, the model with owner-observed lighting acceptance. The Pro HD 24, Pro HD 24 PoE and Pro XG 10 PoE keep 7.5.15+17146 alone.
- At every connection, the switch must report exactly the 20 arguments and types of the `etherlight.mcu` `set` method reviewed for 7.5.15+17146. Any added, missing or retyped argument keeps output closed, and the refusal names the difference. This checks the command interface, not the daemon's behavior behind it.
- The daemon hash is admitted only with the unchanged MCU hash, as for every other pair. Saved scenes keep their identity, which uses the 7.5.15+17146 pair.
- The owner's switch was tested on 7.6.11+17272 before release; the CHANGELOG entry for this version records what was observed.

## 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.
Expand Down
2 changes: 1 addition & 1 deletion docs/HARDWARE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ the reviewed command path; physical appearance and sustained load on additional

| Models | Copper ports | Optical indicators | Firmware family / release |
| --- | --- | --- | --- |
| Pro XG 8 PoE | 1–8 | 9–10 | USWED72 / 7.5.15+17146 |
| Pro XG 8 PoE | 1–8 | 9–10 | USWED72 / 7.5.15+17146, 7.6.11+17272 with the reviewed lighting interface |
| 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, 7.6.11+17272 |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "etherlighting-evolved",
"version": "0.7.1",
"version": "0.7.2",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packaging/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; passes the application version with /DAppVersion=... The default below is kept equal to it by tools/set-version.py.

#ifndef AppVersion
#define AppVersion "0.7.1"
#define AppVersion "0.7.2"
#endif

#ifndef AppSourceDir
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "etherlighting-evolved"
version = "0.7.1"
version = "0.7.2"
description = "Open-source controller for UniFi Etherlighting switches. Unofficial; not affiliated with Ubiquiti."
readme = "README.md"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/etherlighting_evolved/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
supported by Ubiquiti Inc. UniFi and Etherlighting are trademarks of Ubiquiti Inc.
"""

__version__ = "0.7.1"
__version__ = "0.7.2"
PROJECT_NAME = "Etherlighting Evolved"
SHORT_NAME = "EE"
TAGLINE = "Open-source controller for UniFi Etherlighting."
Expand Down
25 changes: 24 additions & 1 deletion src/etherlighting_evolved/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@
"USWF004": ("36f84073384f271008f83dd37ac900b2c59e68e8a210de30fb9fa755d1d49ec3",
"9d8740e2767cf676822648573d00ec82d07f5903e9ebad197684f5be17267224"),
}
# The set method of etherlight.mcu in USWED72 7.5.15+17146, as reviewed: argument names and blobmsg types
# (3 string, 5 int32, 7 int8).
USWED72_SET_FIELDS = MappingProxyType({
**dict.fromkeys(("mcu_mode", "led_stop", "board_id", "behavior", "port_pwm", "port_rgb", "port_map_rgb",
"mode_color", "led_mode", "link", "reset", "upgrade", "calibrate", "diag"), 3),
**dict.fromkeys(("brightness", "info_brightness", "info_behavior"), 5),
**dict.fromkeys(("calibration", "info_mode", "debug"), 7),
})
# USWED72 7.6.11+17272 changes the lighting daemon and keeps the port LED firmware byte-identical. Its daemon code
# was not compared with 7.5.15, so the pair is admitted only for the model with owner lighting acceptance, and only
# while the switch reports exactly the reviewed set interface.
USWED72_7_6_11_DAEMON = "bea59c0a3a1c261814a1460b1420639c4e1465effa609d1dbfbbdb226203c85b"
_MODEL_FIRMWARE = {
"USPXG8P": ((USWED72_7_6_11_DAEMON, MIPS_MCU),),
}
_REQUIRED_SET_FIELDS = {USWED72_7_6_11_DAEMON: USWED72_SET_FIELDS}
# Retain the original pair above because saved scene identities include it.
_ADDITIONAL_FIRMWARE = {
"USWED42": (("9de90875f77a65c5d3006308ab4e707a79d420cca8f4c4994a3de2896df59109",
Expand Down Expand Up @@ -45,7 +61,14 @@ class HardwareProfile:
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, ()))
return ((self.daemon_sha256, self.mcu_sha256), *_ADDITIONAL_FIRMWARE.get(self.family, ()),
*_MODEL_FIRMWARE.get(self.key, ()))

def required_set_fields(self, daemon_sha256: str):
"""The exact set interface an admitted daemon must report, or None when its pair needs no such check."""
if not any(pair[0] == daemon_sha256 for pair in self.firmware_pairs):
return None
return _REQUIRED_SET_FIELDS.get(daemon_sha256)

def public_dict(self) -> dict:
return {
Expand Down
31 changes: 30 additions & 1 deletion src/etherlighting_evolved/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ def __init__(self, transport: Transport, *, num_ports: int = 8, keepalive: float
self.num_ports = num_ports
self.auto_detect = auto_detect
self.hardware_profile: HardwareProfile | None = None
# Set by probe when admitted firmware reports another lighting interface than its reviewed one.
self.interface_difference = ""
self.sfp_ports: tuple[int, ...] = ()
self._precise_generation: object | None = None
self._native_generation: object | None = None
Expand Down Expand Up @@ -299,9 +301,34 @@ def sfp_native_gradient(self) -> bool:

def require_output_profile(self) -> None:
if not isinstance(self.transport, SimulatedTransport) and not (self.native_breathing or self.scoped_sfp):
if self.interface_difference:
raise ValueError("This switch's firmware reports a lighting interface that differs from the one EE "
f"was verified with ({self.interface_difference}), so EE does not control its "
"lighting")
raise ValueError("This switch model or firmware needs compatibility verification before EE can control "
"its lighting. Use a verified switch and firmware profile to continue")

def _reviewed_interface(self, profile, daemon_sha256: str) -> bool:
"""Firmware admitted on condition of an unchanged set interface must report exactly that interface."""
required = profile.required_set_fields(daemon_sha256)
if required is None:
return True
reported = self.transport.lighting_set_fields
if reported is not None and dict(reported) == dict(required):
return True
if reported is None:
self.interface_difference = "no set interface was reported"
return False
parts = []
if extra := sorted(reported.keys() - required.keys()):
parts.append("unexpected fields: " + ", ".join(extra))
if missing := sorted(required.keys() - reported.keys()):
parts.append("missing fields: " + ", ".join(missing))
if changed := sorted(name for name in reported.keys() & required.keys() if reported[name] != required[name]):
parts.append("changed types: " + ", ".join(changed))
self.interface_difference = "; ".join(parts)
return False

def _validate_precision(self, port: int, channels: tuple[int, int, int]) -> None:
from .ubus import validate_precise_rgb, validate_sfp_precise_rgb
if port in self.sfp_ports:
Expand Down Expand Up @@ -410,6 +437,7 @@ async def probe(self) -> dict:
self.revoke_precision()
self.sfp_ports = ()
self.hardware_profile = None
self.interface_difference = ""
board = None
if self.auto_detect:
board = await self._read_board()
Expand Down Expand Up @@ -442,7 +470,8 @@ async def probe(self) -> dict:
firmware_pairs = profile.firmware_pairs
if (generation is not None and generation is self.transport.lighting_generation
and daemon_match is not None
and any(pair[0] == daemon_match[1] for pair in firmware_pairs)):
and any(pair[0] == daemon_match[1] for pair in firmware_pairs)
and self._reviewed_interface(profile, daemon_match[1])):
if self.transport.behavior_supported:
try:
firmware = (await self.transport.run(PORT_FIRMWARE_HASH_COMMAND, timeout=5)).strip()
Expand Down
6 changes: 6 additions & 0 deletions src/etherlighting_evolved/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class Transport(ABC):
host_key_fingerprint: str | None = None
host_key_type: str | None = None
desktop_output = None
# The set method's arguments and blobmsg types as the lighting socket reported them, when one is open.
lighting_set_fields: dict[str, int] | None = None

def revoke_lighting_profile(self) -> None:
return None
Expand Down Expand Up @@ -375,6 +377,10 @@ async def prepare_rgb(self) -> bool:
def precise_rgb_supported(self) -> bool:
return bool(self._rgb_client is not None and self._rgb_client.precise_rgb_supported)

@property
def lighting_set_fields(self) -> dict[str, int] | None:
return self._rgb_client.set_fields if self._rgb_client is not None else None

def configure_lighting_profile(self, profile) -> None:
profile.require_output()
if self._rgb_client is None:
Expand Down
15 changes: 15 additions & 0 deletions src/etherlighting_evolved/ubus.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ def _supports_port_rgb(signature: bytes, field: bytes = b"port_rgb") -> bool:
return False


def _set_fields(signature: bytes) -> dict[str, int] | None:
"""The arguments of the set method and their blobmsg types (3 string, 5 int32, 7 int8), or None without one."""
for name, kind, value in list(_named_attributes(signature)):
if name == b"set" and kind == 2:
fields = {}
for argument, argument_kind, argument_value in list(_named_attributes(value)):
typed = argument_kind == 5 and len(argument_value) == 4
fields[argument.decode("utf-8", "replace")] = struct.unpack("!I", argument_value)[0] if typed else -1
return fields
return None


def _port_data(port: int, rgb: str, level: int) -> bytes:
if type(port) is not int or not 1 <= port <= 64:
raise ValueError("port must be an integer from 1 to 64")
Expand Down Expand Up @@ -162,6 +174,7 @@ def __init__(self, reader, writer, *, timeout: float = 3.0) -> None:
self.precise_rgb_supported = False
self.behavior_supported = False
self.sfp_mode_supported = False
self.set_fields: dict[str, int] | None = None
self.profile: HardwareProfile | None = None
self._binding = 0
self._sequence = 0
Expand Down Expand Up @@ -209,6 +222,7 @@ async def close(self) -> None:
self.precise_rgb_supported = False
self.behavior_supported = False
self.sfp_mode_supported = False
self.set_fields = None
self.writer.close()
with contextlib.suppress(Exception):
await asyncio.wait_for(self.writer.wait_closed(), 1)
Expand Down Expand Up @@ -286,6 +300,7 @@ async def lookup(self) -> None:
self.precise_rgb_supported = _supports_port_rgb(result.get(6, b""), b"port_pwm")
self.behavior_supported = _supports_port_rgb(result.get(6, b""), b"behavior")
self.sfp_mode_supported = _supports_port_rgb(result.get(6, b""), b"mcu_mode")
self.set_fields = _set_fields(result.get(6, b""))

async def set_port(self, port: int, rgb: str, level: int) -> None:
profile = self._require_profile()
Expand Down
80 changes: 79 additions & 1 deletion tests/test_hardware_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
from test_native_switch import MemoryTransport, clock # noqa: F401

from etherlighting_evolved.color import Color
from etherlighting_evolved.hardware import PRO_XG8, PROFILES, identify_profile
from etherlighting_evolved.hardware import (
MIPS_DAEMON,
MIPS_MCU,
PRO_XG8,
PROFILES,
USWED72_7_6_11_DAEMON,
USWED72_SET_FIELDS,
identify_profile,
)
from etherlighting_evolved.switch import EtherlightSwitch, PortOutput
from etherlighting_evolved.ubus import _precise_port_data, _sfp_mode_data, _sfp_precise_data

Expand Down Expand Up @@ -262,3 +270,73 @@ async def test_firmware_pair_admission_does_not_allow_crossed_pairs(
assert not switch.native_breathing and not switch.scoped_sfp
assert not device.events
await switch.close()


async def probe_uswed72(profile, daemon, fields):
device = MemoryTransport()
device.board = identity(profile)
device.daemon = daemon + " /proc/123/exe"
device.firmware = MIPS_MCU + " /usr/share/firmware/port_led_fw.bin"
device.lighting_set_fields = fields
switch = EtherlightSwitch(device, auto_detect=True)
await switch.connect()
await switch.probe()
return device, switch


@pytest.mark.anyio
@pytest.mark.parametrize("profile", [p for p in QUALIFIED if p.family == "USWED72"], ids=lambda p: p.key)
async def test_uswed72_7_6_11_is_admitted_only_for_the_pro_xg8(profile):
device, switch = await probe_uswed72(profile, USWED72_7_6_11_DAEMON, dict(USWED72_SET_FIELDS))
if profile is PRO_XG8:
switch.require_output_profile()
assert device.profile is profile and switch.native_breathing and switch.scoped_sfp
else:
with pytest.raises(ValueError, match="needs compatibility verification"):
switch.require_output_profile()
assert device.profile is None and not switch.native_breathing and not switch.scoped_sfp
assert not device.events
await switch.close()


@pytest.mark.anyio
@pytest.mark.parametrize("change,detail", [
({"port_rgb_v2": 3}, "unexpected fields: port_rgb_v2"),
({"diag": None}, "missing fields: diag"),
({"brightness": 3}, "changed types: brightness"),
({"port_pwm": -1}, "changed types: port_pwm"),
(None, "no set interface was reported"),
])
async def test_uswed72_7_6_11_requires_the_reviewed_set_interface(change, detail):
if change is None:
fields = None
else:
fields = dict(USWED72_SET_FIELDS)
for name, kind in change.items():
if kind is None:
del fields[name]
else:
fields[name] = kind
device, switch = await probe_uswed72(PRO_XG8, USWED72_7_6_11_DAEMON, fields)
with pytest.raises(ValueError, match="differs from the one EE was verified with") as refused:
switch.require_output_profile()
assert detail in str(refused.value)
assert device.profile is None and not device.events
assert not switch.native_breathing and not switch.scoped_sfp and not switch.precise_rgb
# The reviewed interface is admitted on the next probe, and the difference is no longer reported.
device.lighting_set_fields = dict(USWED72_SET_FIELDS)
await switch.probe()
switch.require_output_profile()
assert device.profile is PRO_XG8 and switch.interface_difference == ""
await switch.close()


@pytest.mark.anyio
async def test_uswed72_7_5_15_needs_no_interface_report():
device, switch = await probe_uswed72(PRO_XG8, MIPS_DAEMON, None)
switch.require_output_profile()
assert device.profile is PRO_XG8 and switch.interface_difference == ""
assert PRO_XG8.required_set_fields(MIPS_DAEMON) is None
assert PRO_XG8.required_set_fields(USWED72_7_6_11_DAEMON) == USWED72_SET_FIELDS
assert PROFILES["USPXG10P"].required_set_fields(USWED72_7_6_11_DAEMON) is None
await switch.close()
3 changes: 3 additions & 0 deletions tests/test_native_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from etherlighting_evolved import timing
from etherlighting_evolved.color import Color
from etherlighting_evolved.hardware import USWED72_SET_FIELDS
from etherlighting_evolved.switch import (
BOARD_LIGHTING_INFO,
HOSTNAME_COMMAND,
Expand Down Expand Up @@ -56,6 +57,8 @@ def __init__(self):
self.board = "board.shortname=USPXG8P\nboard.name=USW-Pro-XG-8-PoE\nboard.sysid=0xed76"
self.daemon = PRECISE_DAEMON_HASH + " /proc/123/exe"
self.firmware = PORT_FIRMWARE_HASH + " /usr/share/firmware/port_led_fw.bin"
# The reviewed USWED72 interface, which firmware admitted on that condition must report.
self.lighting_set_fields = dict(USWED72_SET_FIELDS)
self.events = []
self.reads = []
self.hook = self.read_hook = None
Expand Down
Loading
Loading