retry lpa invocation

pull/36085/head
Trey Moen 4 weeks ago
parent 64790333f5
commit cfb7d67925
  1. 5
      system/hardware/tici/esim.py

@ -4,6 +4,7 @@ import shutil
import subprocess import subprocess
from typing import Literal from typing import Literal
from openpilot.common.retry import retry
from openpilot.system.hardware.base import LPABase, LPAError, Profile from openpilot.system.hardware.base import LPABase, LPAError, Profile
class TiciLPA(LPABase): class TiciLPA(LPABase):
@ -99,7 +100,11 @@ class TiciLPA(LPABase):
def _check_bootstrapped(self) -> None: def _check_bootstrapped(self) -> None:
assert self.is_bootstrapped(), 'eUICC is not bootstrapped, please bootstrap before performing this operation' assert self.is_bootstrapped(), 'eUICC is not bootstrapped, please bootstrap before performing this operation'
@retry(attempts=3, delay=1.)
def _invoke(self, *cmd: str): def _invoke(self, *cmd: str):
"""
the lpac command sometimes fails if the eUICC is busy, so we retry a few times
"""
proc = subprocess.Popen(['sudo', '-E', 'lpac'] + list(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self.env) proc = subprocess.Popen(['sudo', '-E', 'lpac'] + list(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self.env)
try: try:
out, err = proc.communicate(timeout=self.timeout_sec) out, err = proc.communicate(timeout=self.timeout_sec)

Loading…
Cancel
Save