summaryrefslogtreecommitdiffstats
path: root/mtp
diff options
context:
space:
mode:
Diffstat (limited to 'mtp')
-rwxr-xr-xmtp/MtpServer.cpp6
-rwxr-xr-xmtp/mtp_MtpServer.cpp2
-rwxr-xr-xmtp/mtp_MtpServer.hpp1
-rwxr-xr-xmtp/twrpMtp.cpp3
-rwxr-xr-xmtp/twrpMtp.hpp2
5 files changed, 9 insertions, 5 deletions
diff --git a/mtp/MtpServer.cpp b/mtp/MtpServer.cpp
index c044cad7f..66a641404 100755
--- a/mtp/MtpServer.cpp
+++ b/mtp/MtpServer.cpp
@@ -1078,8 +1078,10 @@ MtpResponseCode MtpServer::doSendObject() {
unlink(mSendObjectFilePath);
if (errno == ECANCELED)
result = MTP_RESPONSE_TRANSACTION_CANCELLED;
- else
+ else {
+ MTPD("errno: %d\n", errno);
result = MTP_RESPONSE_GENERAL_ERROR;
+ }
}
done:
@@ -1093,7 +1095,7 @@ done:
mSendObjectHandle = kInvalidObjectHandle;
MTPD("result: %d\n", result);
mSendObjectFormat = 0;
- return MTP_RESPONSE_OK;
+ return result;
}
static void deleteRecursive(const char* path) {
diff --git a/mtp/mtp_MtpServer.cpp b/mtp/mtp_MtpServer.cpp
index 9df564ffc..17facdd70 100755
--- a/mtp/mtp_MtpServer.cpp
+++ b/mtp/mtp_MtpServer.cpp
@@ -123,7 +123,7 @@ void twmtp_MtpServer::add_storage()
int storageID = stores->at(i)->mtpid;
long reserveSpace = 1;
bool removable = false;
- long maxFileSize = 1000000000L;
+ long maxFileSize = stores->at(i)->maxFileSize;
if (descriptionStr != "") {
MtpStorage* storage = new MtpStorage(storageID, &pathStr[0], &descriptionStr[0], reserveSpace, removable, maxFileSize, refserver);
server->addStorage(storage);
diff --git a/mtp/mtp_MtpServer.hpp b/mtp/mtp_MtpServer.hpp
index ce6b13c2d..3153e80bf 100755
--- a/mtp/mtp_MtpServer.hpp
+++ b/mtp/mtp_MtpServer.hpp
@@ -36,6 +36,7 @@ typedef struct Storage {
std::string display;
std::string mount;
int mtpid;
+ uint64_t maxFileSize;
} storage;
typedef std::vector<storage*> storages;
diff --git a/mtp/twrpMtp.cpp b/mtp/twrpMtp.cpp
index 9a7df5be1..d9db4246e 100755
--- a/mtp/twrpMtp.cpp
+++ b/mtp/twrpMtp.cpp
@@ -107,11 +107,12 @@ pid_t twrpMtp::forkserver(void) {
return 0;
}
-void twrpMtp::addStorage(std::string display, std::string path, int mtpid) {
+void twrpMtp::addStorage(std::string display, std::string path, int mtpid, uint64_t maxFileSize) {
s = new storage;
s->display = display;
s->mount = path;
s->mtpid = mtpid;
+ s->maxFileSize = maxFileSize;
MTPD("twrpMtp mtpid: %d\n", s->mtpid);
mtpstorages->push_back(s);
}
diff --git a/mtp/twrpMtp.hpp b/mtp/twrpMtp.hpp
index f0d8f4bfd..3aaa96414 100755
--- a/mtp/twrpMtp.hpp
+++ b/mtp/twrpMtp.hpp
@@ -36,7 +36,7 @@ class twrpMtp {
twrpMtp(int debug_enabled /* = 0 */);
pthread_t threadserver(void);
pid_t forkserver(void);
- void addStorage(std::string display, std::string path, int mtpid);
+ void addStorage(std::string display, std::string path, int mtpid, uint64_t maxFileSize);
private:
int start(void);
typedef int (twrpMtp::*ThreadPtr)(void);