summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/usb.c
diff options
context:
space:
mode:
authorPavol Rusnak <stick@gk2.sk>2017-01-16 16:43:09 +0100
committerDamien George <damien.p.george@gmail.com>2017-01-19 12:34:45 +1100
commit89f2b620164c72f522613997a15d7427f693409b (patch)
treec75cc93b6b775c279a855fc02882f2b31ca81a04 /stmhal/usb.c
parentc5310ee5b545316d7b8770343908c19f1ff1cd0d (diff)
downloadmicropython-89f2b620164c72f522613997a15d7427f693409b.tar.gz
micropython-89f2b620164c72f522613997a15d7427f693409b.zip
stmhal: Fix USB HID receive not receiving the first packet.
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r--stmhal/usb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c
index 5ba5ddc6e7..ac85c53714 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -607,7 +607,11 @@ STATIC mp_obj_t pyb_usb_hid_send(mp_obj_t self_in, mp_obj_t report_in) {
}
// send the data
- USBD_HID_SendReport(&hUSBDDevice, bufinfo.buf, bufinfo.len);
+ if (USBD_OK == USBD_HID_SendReport(&hUSBDDevice, bufinfo.buf, bufinfo.len)) {
+ return mp_obj_new_int(bufinfo.len);
+ } else {
+ return mp_obj_new_int(0);
+ }
#endif
return mp_const_none;