wait for sim

pull/35324/head
Trey Moen 2 months ago
parent fe57f27dca
commit f8ac76be3c
  1. 13
      system/hardware/esim.py

@ -1,7 +1,8 @@
#!/usr/bin/env python3
import argparse
import subprocess
import time
from openpilot.system.hardware import HARDWARE
@ -14,15 +15,16 @@ if __name__ == '__main__':
parser.add_argument('--nickname', nargs=2, metavar=('iccid', 'name'), help='update the nickname for a profile')
args = parser.parse_args()
mutated = False
lpa = HARDWARE.get_sim_lpa()
if args.switch:
lpa.switch_profile(args.switch)
HARDWARE.reboot_modem()
mutated = True
elif args.delete:
confirm = input('are you sure you want to delete this profile? (y/N) ')
if confirm == 'y':
lpa.delete_profile(args.delete)
HARDWARE.reboot_modem()
mutated = True
else:
print('cancelled')
exit(0)
@ -33,6 +35,11 @@ if __name__ == '__main__':
else:
parser.print_help()
if mutated:
HARDWARE.reboot_modem()
while subprocess.run(['mmcli', '-i', 'any']).returncode != 0:
time.sleep(.1)
profiles = lpa.list_profiles()
print(f'\n{len(profiles)} profile{"s" if len(profiles) > 1 else ""}:')
for p in profiles:

Loading…
Cancel
Save