summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2011-12-01 18:36:06 -0500
committerMike Lockwood <lockwood@google.com>2011-12-02 15:12:30 -0500
commit8af4c7d02fc484ed1bdc082fc2a5383bc50f2180 (patch)
tree89d39512087cd15a3fb44a8bb5f28e36303eeb19 /media
parent4fe1c6c3988f79fd67c14a1f91e4b1df8a7e806f (diff)
downloadframeworks_av-8af4c7d02fc484ed1bdc082fc2a5383bc50f2180.zip
frameworks_av-8af4c7d02fc484ed1bdc082fc2a5383bc50f2180.tar.gz
frameworks_av-8af4c7d02fc484ed1bdc082fc2a5383bc50f2180.tar.bz2
MTP: Don't attempt to read more than 16K at a time from the MTP driver DO NOT MERGE
This could happen sometimes if other operations increased the size of the data packet buffer to > 16K Change-Id: I10f85f0ce32df39f46b0a984361958c0a13f6800 Signed-off-by: Mike Lockwood <lockwood@google.com>
Diffstat (limited to 'media')
-rw-r--r--media/mtp/MtpDataPacket.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/media/mtp/MtpDataPacket.cpp b/media/mtp/MtpDataPacket.cpp
index 20225ba..cfea7e8 100644
--- a/media/mtp/MtpDataPacket.cpp
+++ b/media/mtp/MtpDataPacket.cpp
@@ -25,10 +25,12 @@
#include "MtpDataPacket.h"
#include "MtpStringBuffer.h"
+#define MTP_BUFFER_SIZE 16384
+
namespace android {
MtpDataPacket::MtpDataPacket()
- : MtpPacket(16384), // MAX_USBFS_BUFFER_SIZE
+ : MtpPacket(MTP_BUFFER_SIZE), // MAX_USBFS_BUFFER_SIZE
mOffset(MTP_CONTAINER_HEADER_SIZE)
{
}
@@ -345,7 +347,7 @@ void MtpDataPacket::putString(const uint16_t* string) {
#ifdef MTP_DEVICE
int MtpDataPacket::read(int fd) {
- int ret = ::read(fd, mBuffer, mBufferSize);
+ int ret = ::read(fd, mBuffer, MTP_BUFFER_SIZE);
if (ret < MTP_CONTAINER_HEADER_SIZE)
return -1;
mPacketSize = ret;