diff options
author | Damien George <damien.p.george@gmail.com> | 2015-10-25 21:43:07 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-10-25 21:43:07 +0000 |
commit | 79f404a287808b700e2a07826aea3338e7368498 (patch) | |
tree | 28ef287203bb12bbf29a060208edd0f98b73f070 | |
parent | 8e8aac89a5c5cd9e1510f332194d286df7e08945 (diff) | |
download | micropython-79f404a287808b700e2a07826aea3338e7368498.tar.gz micropython-79f404a287808b700e2a07826aea3338e7368498.zip |
stmhal: Fix USB_VCP.recv so that it returns actual amount of bytes read.
Addresses issue #1529.
-rw-r--r-- | stmhal/usb.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c index ebd2433d26..cea0eb116b 100644 --- a/stmhal/usb.c +++ b/stmhal/usb.c @@ -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 } } |