diff options
author | Mike Lockwood <lockwood@android.com> | 2011-03-14 04:02:29 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-14 04:02:29 -0700 |
commit | dec0b755fff1bf87aafd397ef0dd864f54c587cf (patch) | |
tree | 42507b534d0788e742df3794826c2d563c8c0c73 | |
parent | 767d7a03733c867da7cad466a9303208eb51699f (diff) | |
parent | bcc0516bc8d0849f64f2fe759229301aa6eb7325 (diff) | |
download | frameworks_base-dec0b755fff1bf87aafd397ef0dd864f54c587cf.zip frameworks_base-dec0b755fff1bf87aafd397ef0dd864f54c587cf.tar.gz frameworks_base-dec0b755fff1bf87aafd397ef0dd864f54c587cf.tar.bz2 |
Merge "MTP host: Fix problems reading large data packets" into honeycomb-mr1
-rw-r--r-- | media/mtp/MtpDataPacket.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/media/mtp/MtpDataPacket.cpp b/media/mtp/MtpDataPacket.cpp index 801edb0..0b0c80d 100644 --- a/media/mtp/MtpDataPacket.cpp +++ b/media/mtp/MtpDataPacket.cpp @@ -28,7 +28,7 @@ namespace android { MtpDataPacket::MtpDataPacket() - : MtpPacket(512), + : MtpPacket(16384), // MAX_USBFS_BUFFER_SIZE mOffset(MTP_CONTAINER_HEADER_SIZE) { } @@ -399,10 +399,10 @@ int MtpDataPacket::read(struct usb_request *request) { if (length >= MTP_CONTAINER_HEADER_SIZE) { // look at the length field to see if the data spans multiple packets uint32_t totalLength = MtpPacket::getUInt32(MTP_CONTAINER_LENGTH_OFFSET); + allocate(totalLength); while (totalLength > length) { - allocate(length + mAllocationIncrement); request->buffer = mBuffer + length; - request->buffer_length = mAllocationIncrement; + request->buffer_length = totalLength - length; int ret = transfer(request); if (ret >= 0) length += ret; |