async def done_splash2(): # Boot up code; after splash screen is done. # MAYBE: check if we're a brick and die again? Or show msg? if version.is_factory_mode(): # in factory mode, turn on USB early to allow debug/setup from usb import enable_usb enable_usb(loop, True) # always start the self test. if not settings.get('tested', False): from actions import start_selftest await start_selftest() else: # force them to accept terms (unless marked as already done) from actions import accept_terms await accept_terms() # Prompt for PIN and then pick appropriate top-level menu, # based on contents of secure chip (ie. is there # a wallet defined) from actions import start_login_sequence await start_login_sequence() loop.create_task(mainline())
async def start_selftest(*args): if len(args) and not version.is_factory_mode(): # called from inside menu, not directly if not await ux_confirm('''Selftest destroys settings on other profiles (not seeds). Requires MicroSD card and might have other consequences. Recommended only for factory.'''): return await ux_aborted() with imported('selftest') as st: await st.start_selftest() settings.save()
def goto_top_menu(): # Start/restart menu system from menu import MenuSystem from flow import VirginSystem, NormalSystem, EmptyWallet, FactoryMenu from main import pa if version.is_factory_mode(): m = MenuSystem(FactoryMenu) elif pa.is_blank(): # let them play a little before picking a PIN first time m = MenuSystem(VirginSystem, should_cont=lambda: pa.is_blank()) else: assert pa.is_successful(), "nonblank but wrong pin" m = MenuSystem(EmptyWallet if pa.is_secret_blank() else NormalSystem) the_ux.reset(m) return m
def handle_bag_number(self, bag_num): import version, callgate from main import dis, pa, is_devmode, settings if version.is_factory_mode() and bag_num: # check state first assert settings.get('tested', False) assert pa.is_blank() assert bag_num[0:2] == b'C0' and len(bag_num) == 8 # do the change failed = callgate.set_bag_number(bag_num) assert not failed callgate.set_rdp_level(2 if not is_devmode else 0) pa.greenlight_firmware() dis.fullscreen(bytes(bag_num).decode()) self.call_after(callgate.show_logout, 1) # always report the existing/new value val = callgate.get_bag_number() or b'' return b'asci' + val