Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FATFileSystem mbed-rtos
Fork of USBHost by
Diff: USBHostHID/USBHostMouse.cpp
- Revision:
- 27:4206883f4cb7
- Parent:
- 24:868cbfe611a7
- Child:
- 37:f1e388e7b752
--- 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);
}
