summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2010-10-11 17:31:44 -0400
committerMike Lockwood <lockwood@google.com>2010-10-11 17:33:52 -0400
commitdb7743128b82d4c22f5b4d3b634d5232a6af7564 (patch)
tree2688917f86f31ebfda22baf3d25b87ccf651fab5 /media
parent4cda1e3e8bb983cf838007acb25f98c78256aea4 (diff)
downloadframeworks_base-db7743128b82d4c22f5b4d3b634d5232a6af7564.zip
frameworks_base-db7743128b82d4c22f5b4d3b634d5232a6af7564.tar.gz
frameworks_base-db7743128b82d4c22f5b4d3b634d5232a6af7564.tar.bz2
MTP: Include size of 12 byte header in packet size for GetObject data packet
Fixes file transfer from device to host with libmtp. Change-Id: Ifb304c1f106e94b2710ee5c11816b83cf5f25478 Signed-off-by: Mike Lockwood <lockwood@google.com>
Diffstat (limited to 'media')
-rw-r--r--media/mtp/MtpServer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 84a3e2c..f74f395 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -163,6 +163,7 @@ void MtpServer::run() {
mData.setOperationCode(operation);
mData.setTransactionID(transaction);
LOGV("sending data:");
+ mData.dump();
ret = mData.write(fd);
if (ret < 0) {
LOGE("request write returned %d, errno: %d", ret, errno);
@@ -177,6 +178,7 @@ void MtpServer::run() {
mResponse.setTransactionID(transaction);
LOGV("sending response %04X", mResponse.getResponseCode());
ret = mResponse.write(fd);
+ mResponse.dump();
if (ret < 0) {
LOGE("request write returned %d, errno: %d", ret, errno);
if (errno == ECANCELED) {
@@ -546,7 +548,7 @@ MtpResponseCode MtpServer::doGetObject() {
// send data header
mData.setOperationCode(mRequest.getOperationCode());
mData.setTransactionID(mRequest.getTransactionID());
- mData.writeDataHeader(mFD, fileLength);
+ mData.writeDataHeader(mFD, fileLength + MTP_CONTAINER_HEADER_SIZE);
// then transfer the file
int ret = ioctl(mFD, MTP_SEND_FILE, (unsigned long)&mfr);