diff options
author | reillyg@chromium.org <reillyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-18 19:41:46 +0000 |
---|---|---|
committer | reillyg@chromium.org <reillyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-18 19:43:07 +0000 |
commit | 245f2ecfc1afa3c241a32552703b0ce6a8ccf486 (patch) | |
tree | dcf0be532a7976cd06733f71409a04b404dc2d8e /device/hid/hid_connection_mac.cc | |
parent | b1435083c087f97b0b96b06fc751155d60257865 (diff) | |
download | chromium_src-245f2ecfc1afa3c241a32552703b0ce6a8ccf486.zip chromium_src-245f2ecfc1afa3c241a32552703b0ce6a8ccf486.tar.gz chromium_src-245f2ecfc1afa3c241a32552703b0ce6a8ccf486.tar.bz2 |
Fix HID input report sizes on Windows for devices without report IDs.
Unlike Linux and OS X, Windows always writes a report ID into the
buffer passed to ReadFile. If the device does not use report IDs the
first byte of the buffer will always be zero. Because of this, and
contrary to the MSDN documentation, the maximum report size reported
in the HIDP_CAPS structure always includes a byte for the report ID.
This patch fixes the interpretation of the values in HIDP_CAPS and
the size of the buffer passed to ReadFile. To prevent uninitialized
bytes from being passed back to an app when a shorter report is read
the true number of bytes read is provided to the completion callback
on all platforms.
BUG=404253
Review URL: https://codereview.chromium.org/474273004
Cr-Commit-Position: refs/heads/master@{#290337}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/hid/hid_connection_mac.cc')
-rw-r--r-- | device/hid/hid_connection_mac.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/device/hid/hid_connection_mac.cc b/device/hid/hid_connection_mac.cc index d497ac0..b357216 100644 --- a/device/hid/hid_connection_mac.cc +++ b/device/hid/hid_connection_mac.cc @@ -163,7 +163,7 @@ void HidConnectionMac::ProcessReadQueue() { memcpy(read.buffer->data(), report.buffer->data(), report.buffer->size()); pending_reports_.pop(); - if (CompleteRead(report.buffer, read.callback)) { + if (CompleteRead(read.buffer, report.buffer->size(), read.callback)) { pending_reads_.pop(); } } |