summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/mpremote.rst6
-rw-r--r--tools/mpremote/mpremote/main.py3
-rw-r--r--tools/mpremote/mpremote/pyboardextended.py1
3 files changed, 10 insertions, 0 deletions
diff --git a/docs/reference/mpremote.rst b/docs/reference/mpremote.rst
index 8e3cf9aa5..345927ef7 100644
--- a/docs/reference/mpremote.rst
+++ b/docs/reference/mpremote.rst
@@ -135,6 +135,12 @@ The full list of supported commands are:
$ mpremote mount <local-dir>
+- unmount the local directory from the remote device:
+
+ .. code-block:: bash
+
+ $ mpremote umount
+
Multiple commands can be specified and they will be run sequentially.
diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py
index a53ea66f3..524b2ec80 100644
--- a/tools/mpremote/mpremote/main.py
+++ b/tools/mpremote/mpremote/main.py
@@ -42,6 +42,7 @@ _COMMANDS = {
"resume": (False, False, 0, "resume a previous mpremote session (will not auto soft-reset)"),
"soft-reset": (False, True, 0, "perform a soft-reset of the device"),
"mount": (True, False, 1, "mount local directory on device"),
+ "umount": (True, False, 0, "unmount the local directory"),
"repl": (
False,
True,
@@ -493,6 +494,8 @@ def main():
path = args.pop(0)
pyb.mount_local(path)
print(f"Local directory {path} is mounted at /remote")
+ elif cmd == "umount":
+ pyb.umount_local()
elif cmd in ("exec", "eval", "run"):
follow = True
if args[0] == "--no-follow":
diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py
index 6817e7bbf..69cbf02ed 100644
--- a/tools/mpremote/mpremote/pyboardextended.py
+++ b/tools/mpremote/mpremote/pyboardextended.py
@@ -687,3 +687,4 @@ class PyboardExtended(Pyboard):
if self.mounted:
self.exec_('uos.umount("/remote")')
self.mounted = False
+ self.serial = self.serial.orig_serial