lpa: move comma-profile check to Profile.is_comma (#37965)

This commit is contained in:
Trey Moen
2026-05-05 11:50:52 -07:00
committed by GitHub
parent dd0690da6f
commit 0e58ac33ad
2 changed files with 9 additions and 5 deletions
+4 -3
View File
@@ -20,6 +20,10 @@ class Profile:
enabled: bool
provider: str
@property
def is_comma(self) -> bool:
return self.provider == 'Webbing' and self.iccid.startswith('8985235')
@dataclass
class ThermalZone:
# a zone from /sys/class/thermal/thermal_zone*
@@ -98,9 +102,6 @@ class LPABase(ABC):
def is_euicc(self) -> bool:
pass
def is_comma_profile(self, iccid: str) -> bool:
return any(iccid.startswith(prefix) for prefix in ('8985235',))
class HardwareBase(ABC):
@staticmethod
def get_cmdline() -> dict[str, str]:
+5 -2
View File
@@ -19,7 +19,7 @@ from typing import Any
from pathlib import Path
from openpilot.common.time_helpers import system_time_valid
from openpilot.system.hardware.base import LPABase, LPAError, Profile
from openpilot.system.hardware.base import LPABase, LPAError, LPAProfileNotFoundError, Profile
GSMA_CI_BUNDLE = str(Path(__file__).parent / "gsma_ci_bundle.pem")
@@ -735,7 +735,10 @@ class TiciLPA(LPABase):
process_notifications(self._client)
def delete_profile(self, iccid: str) -> None:
if self.is_comma_profile(iccid):
profile = next((p for p in self.list_profiles() if p.iccid == iccid), None)
if profile is None:
raise LPAProfileNotFoundError(f"profile not found: {iccid}")
if profile.is_comma:
raise LPAError("refusing to delete a comma profile")
with self._acquire_channel():
request = encode_tlv(TAG_DELETE_PROFILE, encode_tlv(TAG_ICCID, string_to_tbcd(iccid)))