fix for SD card reading bug
This commit is contained in:
parent
a251f16ae7
commit
c225e168bf
@ -242,6 +242,10 @@ class CardSlot:
|
||||
self.mountpt = glob.VD.mount(self.readonly)
|
||||
return self
|
||||
|
||||
if not self.is_inserted():
|
||||
# bugfix on Q: #618
|
||||
raise CardMissingError
|
||||
|
||||
# Get ready!
|
||||
self.active_led.on()
|
||||
|
||||
@ -268,7 +272,7 @@ class CardSlot:
|
||||
if self.mountpt == self.get_sd_root():
|
||||
self._recover()
|
||||
elif glob.VD:
|
||||
glob.VD.unmount(self.wrote_files)
|
||||
glob.VD.unmount(self.wrote_files, self.readonly)
|
||||
|
||||
self.mountpt = None
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class VirtDisk:
|
||||
VBLKDEV.callback(None)
|
||||
glob.VD = None
|
||||
|
||||
def unmount(self, written_files):
|
||||
def unmount(self, written_files, readonly=False):
|
||||
# just unmount; ignore errors
|
||||
try:
|
||||
os.umount('/vdisk')
|
||||
@ -51,9 +51,10 @@ class VirtDisk:
|
||||
self.ignore.add(fn)
|
||||
|
||||
# allow host to change again
|
||||
enable_usb()
|
||||
if glob.VD:
|
||||
VBLKDEV.set_inserted(True)
|
||||
if not readonly:
|
||||
enable_usb()
|
||||
if glob.VD:
|
||||
VBLKDEV.set_inserted(True)
|
||||
|
||||
def mount(self, readonly=False):
|
||||
# Prepare to read the filesystem. Block host. Return mount pt.
|
||||
@ -69,7 +70,7 @@ class VirtDisk:
|
||||
try:
|
||||
if not readonly:
|
||||
disable_usb()
|
||||
VBLKDEV.set_inserted(False)
|
||||
VBLKDEV.set_inserted(False)
|
||||
os.mount(VBLKDEV, '/vdisk', readonly=readonly)
|
||||
st = os.statvfs('/vdisk')
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user