diff options
author | Pavol Rusnak <stick@gk2.sk> | 2016-12-28 18:56:03 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-01-19 12:34:58 +1100 |
commit | 6ace84b08962baff5baae09443e9d4f968d11e84 (patch) | |
tree | 534ed310557d0859c2784425adb276256c446201 /stmhal/usb.c | |
parent | 89f2b620164c72f522613997a15d7427f693409b (diff) |
stmhal: Implement ioctl for USB HID read.
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r-- | stmhal/usb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c index ac85c5371..7eb3f179a 100644 --- a/stmhal/usb.c +++ b/stmhal/usb.c @@ -636,6 +636,9 @@ STATIC mp_uint_t pyb_usb_hid_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_ if (request == MP_STREAM_POLL) { mp_uint_t flags = arg; ret = 0; + if ((flags & MP_STREAM_POLL_RD) && USBD_HID_RxNum() > 0) { + ret |= MP_STREAM_POLL_RD; + } if ((flags & MP_STREAM_POLL_WR) && USBD_HID_CanSendReport(&hUSBDDevice)) { ret |= MP_STREAM_POLL_WR; } |