summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShankar Rao2013-11-06 11:40:20 -0600
committerShankar Rao2013-11-06 11:40:20 -0600
commit04f77acac1d988936ee0a136d969ee45cf5e689c (patch)
tree49b49c199e7c626d5c40f21189de1447eefeae0a
parente4acde5784051be1e02ab23e2fe0fc17bfa24259 (diff)
downloaddevice-ti-common-open-04f77acac1d988936ee0a136d969ee45cf5e689c.tar.gz
device-ti-common-open-04f77acac1d988936ee0a136d969ee45cf5e689c.tar.xz
device-ti-common-open-04f77acac1d988936ee0a136d969ee45cf5e689c.zip
mtpfuse: Remove call to read object size when calling readObject.
readObject API is able to handle cases where the size passed is greater than the object size. Hence, the need to determine object size is redundant. Also, some whitespaces removed and DBG changed to printf for error scenarios. Change-Id: Iedde6b4ba7620cab31a35494899e48a700d2bfc8 Signed-off-by: Shankar Rao <shankar.nrao@ti.com>
-rw-r--r--mtpfuse/mtpfuse.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/mtpfuse/mtpfuse.cpp b/mtpfuse/mtpfuse.cpp
index 60db6c4..debbe48 100644
--- a/mtpfuse/mtpfuse.cpp
+++ b/mtpfuse/mtpfuse.cpp
@@ -399,10 +399,6 @@ static int mtpfuse_read (const char * path, char * buf,
399 struct fuse_file_info *fi) { 399 struct fuse_file_info *fi) {
400 int ret; 400 int ret;
401 MtpObjectHandle h = (MtpObjectHandle)fi->fh; 401 MtpObjectHandle h = (MtpObjectHandle)fi->fh;
402 MtpObjectInfo *info = mtp_device->getObjectInfo(h);
403 if (info->mCompressedSize < size) {
404 size = info->mCompressedSize;
405 }
406 bool status = mtp_device->readObject(h, read_callback, size, offset, buf); 402 bool status = mtp_device->readObject(h, read_callback, size, offset, buf);
407 if (status == false) { 403 if (status == false) {
408 ret = 0; 404 ret = 0;
@@ -412,7 +408,8 @@ static int mtpfuse_read (const char * path, char * buf,
412 return ret; 408 return ret;
413} 409}
414 410
415static void start_media_scanner(){ const char* cmd = 411static void start_media_scanner() {
412 const char* cmd =
416 "am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/shell/emulated/0"; 413 "am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/shell/emulated/0";
417 system(cmd); 414 system(cmd);
418} 415}
@@ -453,10 +450,10 @@ int main(int argc, char* argv[]) {
453 } 450 }
454 451
455 if (storageAreaList->size() == 0) { 452 if (storageAreaList->size() == 0) {
456 DBG("No storages found\n"); 453 printf("No storages found\n");
457 return 0; 454 return 0;
458 } 455 }
459 DBG("Found %d storage(s)\n", storageAreaList->size()); 456 printf("Found %d storage(s)\n", storageAreaList->size());
460 for (size_t i = 0;i < storageAreaList->size();i++) { 457 for (size_t i = 0;i < storageAreaList->size();i++) {
461 MtpStorageInfo* storageInfo = mtp_device->getStorageInfo(storageAreaList->itemAt(i)); 458 MtpStorageInfo* storageInfo = mtp_device->getStorageInfo(storageAreaList->itemAt(i));
462 printf("Desc: %s\n", storageInfo->mStorageDescription); 459 printf("Desc: %s\n", storageInfo->mStorageDescription);