Skip to content

Commit 79f404a

Browse files
committed
stmhal: Fix USB_VCP.recv so that it returns actual amount of bytes read.
Addresses issue adafruit#1529.
1 parent 8e8aac8 commit 79f404a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

stmhal/usb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ STATIC mp_obj_t pyb_usb_vcp_recv(mp_uint_t n_args, const mp_obj_t *args, mp_map_
440440
if (o_ret != MP_OBJ_NULL) {
441441
return mp_obj_new_int(ret); // number of bytes read into given buffer
442442
} else {
443+
vstr.len = ret; // set actual number of bytes read
443444
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); // create a new buffer
444445
}
445446
}

0 commit comments

Comments
 (0)