Skip to content
Snippets Groups Projects
Commit 79f404a2 authored by Damien George's avatar Damien George
Browse files

stmhal: Fix USB_VCP.recv so that it returns actual amount of bytes read.

Addresses issue #1529.
parent 8e8aac89
No related branches found
No related tags found
No related merge requests found
...@@ -440,6 +440,7 @@ STATIC mp_obj_t pyb_usb_vcp_recv(mp_uint_t n_args, const mp_obj_t *args, mp_map_ ...@@ -440,6 +440,7 @@ STATIC mp_obj_t pyb_usb_vcp_recv(mp_uint_t n_args, const mp_obj_t *args, mp_map_
if (o_ret != MP_OBJ_NULL) { if (o_ret != MP_OBJ_NULL) {
return mp_obj_new_int(ret); // number of bytes read into given buffer return mp_obj_new_int(ret); // number of bytes read into given buffer
} else { } else {
vstr.len = ret; // set actual number of bytes read
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); // create a new buffer return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); // create a new buffer
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment