From c2b1a1d8bfc44abbcd766d4d6b3927c1634dec3e Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 1 Nov 2023 15:14:37 +1100 Subject: [PATCH] mpremote/mount: Add ioctl to specify large read buffer size. Speeds up importing files from mounted filesystem. Also fix the return code for invalid / unsupported ioctl requests. Signed-off-by: Andrew Leech --- tools/mpremote/mpremote/transport_serial.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/mpremote/mpremote/transport_serial.py b/tools/mpremote/mpremote/transport_serial.py index 23a379d16b488..e212973be4111 100644 --- a/tools/mpremote/mpremote/transport_serial.py +++ b/tools/mpremote/mpremote/transport_serial.py @@ -753,7 +753,12 @@ def ioctl(self, request, arg): machine.mem32[arg] = self.seek(machine.mem32[arg], machine.mem32[arg + 4]) elif request == 4: # CLOSE self.close() - return 0 + elif request == 11: # BUFFER_SIZE + # This is used as the vfs_reader buffer. n + 4 should be less than 255 to + # fit in stdin ringbuffer on supported ports. n + 7 should be multiple of 16 + # to efficiently use gc blocks in mp_reader_vfs_t. + return 249 + return -1 def flush(self): pass