From 67f66795c05f729ff1ca39f1d41461807c14c824 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 5 Dec 2021 09:20:04 +1100 Subject: [PATCH] tools/mpremote: Implement seek and flush in ioctl method. Fixes issue #8058. Signed-off-by: Damien George --- tools/mpremote/mpremote/pyboardextended.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py index ccd3098e38..70e3748ec8 100644 --- a/tools/mpremote/mpremote/pyboardextended.py +++ b/tools/mpremote/mpremote/pyboardextended.py @@ -142,7 +142,13 @@ class RemoteFile(uio.IOBase): self.close() def ioctl(self, request, arg): - if request == 4: # CLOSE + if request == 1: # FLUSH + self.flush() + elif request == 2: # SEEK + # This assumes a 32-bit bare-metal machine. + import machine + machine.mem32[arg] = self.seek(machine.mem32[arg], machine.mem32[arg + 4]) + elif request == 4: # CLOSE self.close() return 0