Skip to content

Commit 490f73a

Browse files
committed
fix
1 parent 05027d9 commit 490f73a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tools/mpremote/mpremote/transport_serial.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ def umount_local(self):
382382
"CMD_ILISTDIR_NEXT": 3,
383383
"CMD_OPEN": 4,
384384
"CMD_CLOSE": 5,
385-
"CMD_READLINE": 6,
386-
"CMD_READ": 7,
385+
"CMD_READ": 6,
386+
"CMD_READLINE": 7,
387387
"CMD_WRITE": 8,
388388
"CMD_SEEK": 9,
389389
"CMD_REMOVE": 10,
@@ -575,11 +575,13 @@ def readline(self):
575575
c = self.cmd
576576
c.begin(CMD_READLINE)
577577
c.wr_s8(self.fd)
578-
n = c.rd_u32()
579-
buf = bytearray(n)
580-
c.rd_bytes(buf)
578+
data = c.rd_bytes(None)
581579
c.end()
582-
return bytes(buf)
580+
if self.is_text:
581+
data = str(data, 'utf8')
582+
else:
583+
data = bytes(data)
584+
return data
583585
584586
def readlines(self):
585587
ls = []
@@ -872,7 +874,6 @@ def do_read(self):
872874
def do_readline(self):
873875
fd = self.rd_s8()
874876
buf = self.data_files[fd][0].readline()
875-
self.wr_u32(len(buf))
876877
if self.data_files[fd][1]:
877878
buf = bytes(buf, "utf8")
878879
self.wr_bytes(buf)

0 commit comments

Comments
 (0)