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

Addresses issue #1529.
pull/1539/head
Damien George 2015-10-25 21:43:07 +00:00
rodzic 8e8aac89a5
commit 79f404a287
1 zmienionych plików z 1 dodań i 0 usunięć

Wyświetl plik

@ -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) {
return mp_obj_new_int(ret); // number of bytes read into given buffer
} 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
}
}