tools/mpremote: Implement seek and flush in ioctl method.

Fixes issue #8058.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-12-05 09:20:04 +11:00
parent 9ffb1ad2f8
commit 67f66795c0
1 changed files with 7 additions and 1 deletions

View File

@ -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