confirm users want virtdisk feature

This commit is contained in:
Peter D. Gray 2022-07-29 11:33:21 -04:00
parent 0a444d6da5
commit d2ac24315e
No known key found for this signature in database
GPG Key ID: F0E6CC6AFC16CF7B
6 changed files with 15 additions and 10 deletions

View File

@ -738,7 +738,7 @@ async def damage_myself():
async def version_migration():
# Handle changes between upgrades, and allow downgrades when possible.
# - long term we generally cannot delete code from here, because we
# never know when a user might skip a bunch of intermetiate versions
# never know when a user might skip a bunch of intermediate versions
# Data migration issue:
# - "login countdown" feature now stored elsewhere [mk3]
@ -750,6 +750,10 @@ async def version_migration():
s.set('lgto', had_delay)
s.save()
del s
# Disable vdisk so it is off by default until re-enabled, after
# version 5.0.6 is installed
settings.remove_key('vdsk')
async def version_migration_prelogin():
# same, but for setting before login
@ -927,7 +931,7 @@ async def start_login_sequence():
import nfc
nfc.NFCHandler.startup()
if settings.get('vdsk', 0):
if settings.get('vidsk', 0):
# Maybe start virtual disk
import vdisk
vdisk.VirtDisk()

View File

@ -84,14 +84,14 @@ def nfc_enabled():
return bool(NFC)
def vdisk_enabled():
return bool(settings.get('vdsk', 0))
return bool(settings.get('vidsk', 0))
HWTogglesMenu = [
ToggleMenuItem('USB Port', 'du', ['Default On', 'Disable USB'], invert=True,
on_change=change_usb_disable, story='''\
Blocks any data over USB port. Useful when your plan is air-gap usage.'''),
ToggleMenuItem('Virtual Disk', 'vdsk', ['Default Off', 'Enable', 'Enable & Auto'],
ToggleMenuItem('Virtual Disk', 'vidsk', ['Default Off', 'Enable', 'Enable & Auto'],
predicate=lambda: version.has_psram, on_change=change_virtdisk_enable,
story='''Coldcard can emulate a virtual disk drive (4MB) where new PSBT files \
can be saved. Signed PSBT files (transactions) will also be saved here. \n\

View File

@ -29,7 +29,7 @@ transfer data easily via NFC.''' + COMMON
# Disabled for now, because limited audience and
# extra barrier to "just getting started"
if 0: # version.has_psram and not settings.get('vdsk', 0):
if 0: # version.has_psram and not settings.get('vidsk', 0):
msg = '''Enable USB Drive?\n\n\
Connect your COLDCARD directly as a USB flash drive \
to your phone or desktop. You will be able to drag-n-drop or \
@ -37,11 +37,11 @@ save PSBT files like other drives/volumes.''' + COMMON
ch = await ux_show_story(msg)
if ch == 'y':
# put them into full-auto mode: 2
settings.set('vdsk', 2)
settings.set('vidsk', 2)
await change_virtdisk_enable(2)
await ux_dramatic_pause('Enabled.', 1)
if not settings.get('vdsk', 0) and not settings.get('du', 0):
if not settings.get('vidsk', 0) and not settings.get('du', 0):
msg = '''Disable USB port?\n\n\
If you intend to operate in Air-Gap mode, where this COLDCARD \
is never connected to anything but power, then this will disable the USB port.''' + COMMON

View File

@ -50,7 +50,8 @@ from glob import PSRAM
# rz = (int) display value resolution/units: 8=BTC 5=mBTC 2=bits 0=sats
# tp = (complex) trick pins' config on Mk4
# nfc = (bool) if set, enable the NFC feature; default is OFF=>DISABLED (mk4+)
# vdsk = (bool) if set, enable the Virtual Disk features; default is OFF=>DISABLED (mk4+)
# vdsk = (bool) if set, enable the Virtual Disk features in pre 5.0.6 version; [OBSOLETE]
# vidsk = (bool) if set, enable the Virtual Disk features after v5.0.6
# emu = (bool) if set, enables the USB Keyboard emulation (BIP-85 password entry)
# Stored w/ key=00 for access before login
# _skip_pin = hard code a PIN value (dangerous, only for debug)

View File

@ -124,7 +124,7 @@ class VirtDisk:
def host_done_handler(self):
from glob import settings
if settings.get('vdsk', 0) != 2:
if settings.get('vidsk', 0) != 2:
# auto mode not enabled, so ignore changes
return

View File

@ -216,7 +216,7 @@ def main():
continue
print("Started", test_module)
if test_module == "test_vdisk.py":
test_args = ["--eject"] + DEFAULT_SIMULATOR_ARGS + ["--set", "vdsk=1"]
test_args = ["--eject"] + DEFAULT_SIMULATOR_ARGS + ["--set", "vidsk=1"]
if test_module == "test_bip39pw.py":
test_args = []
if test_module == "test_unit.py":