summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpServer.cpp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-11-16 17:38:43 -0500
committerMike Lockwood <lockwood@android.com>2010-11-17 16:43:24 -0500
commite1b8cf1cafb75ce1339b67eb1764e224a257c579 (patch)
tree3881a3df3eb3e1d6dd6eb37ae446cb76bf33cf18 /media/mtp/MtpServer.cpp
parentd0e9487cd8b2b4ef63583ebedfdce30b3d098f15 (diff)
downloadframeworks_av-e1b8cf1cafb75ce1339b67eb1764e224a257c579.zip
frameworks_av-e1b8cf1cafb75ce1339b67eb1764e224a257c579.tar.gz
frameworks_av-e1b8cf1cafb75ce1339b67eb1764e224a257c579.tar.bz2
MTP: Fixes to allow file transfers > 4 gigabytes
BUG: 3198248 Change-Id: I6f11c79a19d7bdd63718a7370939124b1262d221 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp/MtpServer.cpp')
-rw-r--r--media/mtp/MtpServer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 7edbeb4..ca13636 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -664,6 +664,7 @@ MtpResponseCode MtpServer::doSendObject() {
MtpResponseCode result = MTP_RESPONSE_OK;
mode_t mask;
int ret;
+ uint64_t actualSize = -1;
if (mSendObjectHandle == kInvalidObjectHandle) {
LOGE("Expected SendObjectInfo before SendObject");
@@ -706,11 +707,18 @@ MtpResponseCode MtpServer::doSendObject() {
result = MTP_RESPONSE_TRANSACTION_CANCELLED;
else
result = MTP_RESPONSE_GENERAL_ERROR;
+ } else if (mSendObjectFileSize == 0xFFFFFFFF) {
+ // actual size is likely > 4 gig so stat the file to compute actual length
+ struct stat s;
+ if (lstat(mSendObjectFilePath, &s) == 0) {
+ actualSize = s.st_size;
+ LOGD("actualSize: %lld\n", actualSize);
+ }
}
done:
mDatabase->endSendObject(mSendObjectFilePath, mSendObjectHandle, mSendObjectFormat,
- result == MTP_RESPONSE_OK);
+ actualSize, result == MTP_RESPONSE_OK);
mSendObjectHandle = kInvalidObjectHandle;
mSendObjectFormat = 0;
return result;