Skip to content

Commit d6564a3

Browse files
committed
tools/mpremote: Add "umount" command.
Signed-off-by: Damien George <[email protected]>
1 parent ad1f523 commit d6564a3

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

docs/reference/mpremote.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ The full list of supported commands are:
135135
136136
$ mpremote mount <local-dir>
137137
138+
- unmount the local directory from the remote device:
139+
140+
.. code-block:: bash
141+
142+
$ mpremote umount
143+
138144
Multiple commands can be specified and they will be run sequentially.
139145

140146

tools/mpremote/mpremote/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"resume": (False, False, 0, "resume a previous mpremote session (will not auto soft-reset)"),
4343
"soft-reset": (False, True, 0, "perform a soft-reset of the device"),
4444
"mount": (True, False, 1, "mount local directory on device"),
45+
"umount": (True, False, 0, "unmount the local directory"),
4546
"repl": (
4647
False,
4748
True,
@@ -493,6 +494,8 @@ def main():
493494
path = args.pop(0)
494495
pyb.mount_local(path)
495496
print(f"Local directory {path} is mounted at /remote")
497+
elif cmd == "umount":
498+
pyb.umount_local()
496499
elif cmd in ("exec", "eval", "run"):
497500
follow = True
498501
if args[0] == "--no-follow":

tools/mpremote/mpremote/pyboardextended.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,3 +687,4 @@ def umount_local(self):
687687
if self.mounted:
688688
self.exec_('uos.umount("/remote")')
689689
self.mounted = False
690+
self.serial = self.serial.orig_serial

0 commit comments

Comments
 (0)