feat(esim): enable eSIM profile hotswapping (#35324)

* reboot

* no sleep

* test

* back

* wait for sim

* simpler

* retry

* Revert "retry"

This reverts commit f1297160f3.
pull/35392/head
Trey Moen 2 weeks ago committed by GitHub
parent 1221821761
commit c4f2cf5299
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      system/hardware/esim.py

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import argparse
import time
from openpilot.system.hardware import HARDWARE
@ -14,14 +14,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)
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)
print('deleted profile, please restart device to apply changes')
mutated = True
else:
print('cancelled')
exit(0)
@ -32,6 +34,11 @@ if __name__ == '__main__':
else:
parser.print_help()
if mutated:
HARDWARE.reboot_modem()
# eUICC needs a small delay post-reboot before querying profiles
time.sleep(.5)
profiles = lpa.list_profiles()
print(f'\n{len(profiles)} profile{"s" if len(profiles) > 1 else ""}:')
for p in profiles:

Loading…
Cancel
Save