Support MJPEG Video Demo
Dependents: RGA-MJPEG_VideoDemo
Fork of USBHost_custom by
Diff: USBHostHID/USBHostMouse.cpp
- Revision:
- 27:4206883f4cb7
- Parent:
- 24:868cbfe611a7
diff -r 607951c26872 -r 4206883f4cb7 USBHostHID/USBHostMouse.cpp --- a/USBHostHID/USBHostMouse.cpp Mon Aug 18 13:45:26 2014 +0100 +++ b/USBHostHID/USBHostMouse.cpp Mon Jan 19 14:30:37 2015 +0000 @@ -47,6 +47,7 @@ } bool USBHostMouse::connect() { + int len_listen; if (dev_connected) { return true; @@ -69,7 +70,11 @@ host->registerDriver(dev, mouse_intf, this, &USBHostMouse::init); int_in->attach(this, &USBHostMouse::rxHandler); - host->interruptRead(dev, int_in, report, int_in->getSize(), false); + len_listen = int_in->getSize(); + if (len_listen > sizeof(report)) { + len_listen = sizeof(report); + } + host->interruptRead(dev, int_in, report, len_listen, false); dev_connected = true; return true; @@ -109,6 +114,10 @@ y = report[2]; z = report[3]; + if (len_listen > sizeof(report)) { + len_listen = sizeof(report); + } + if (dev) host->interruptRead(dev, int_in, report, len_listen, false); }