summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Mahaveer <vishalm@ti.com>2013-11-06 15:34:59 -0600
committerGerrit Code Review <gerrit2@git.omapzoom.org>2013-11-06 15:34:59 -0600
commitb254c03e01db64449e392181c2d2534dcf40fd29 (patch)
tree4fdecb5202941068e0301a82ce7787fd20c4b4a3
parent59ee8f140f9c38d1786e17d401276de38af8a382 (diff)
parentdf13623a80cd01d68b03b6b77a8e8009980760ca (diff)
downloadcommon-open-b254c03e01db64449e392181c2d2534dcf40fd29.tar.gz
Merge "mtpfuse: Close the usb device when the filesystem is destroyed." into d-jb-mr2.0-release
-rw-r--r--mtpfuse/mtpfuse.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/mtpfuse/mtpfuse.cpp b/mtpfuse/mtpfuse.cpp
index debbe48..1bf49bc 100644
--- a/mtpfuse/mtpfuse.cpp
+++ b/mtpfuse/mtpfuse.cpp
@@ -44,6 +44,7 @@
using namespace android;
MtpDevice* mtp_device = NULL;
+usb_device* device = NULL;
int mtp_device_found = 0;
MtpStorageIDList* storageAreaList = NULL;
KeyedVector<uint32_t, char*> storageEntries;
@@ -56,7 +57,7 @@ KeyedVector<uint32_t, String8> fileDescriptorTable;
static int usb_device_listed(const char *devname, void* client_data) {
int fd;
- usb_device* device = usb_device_open(devname);
+ device = usb_device_open(devname);
if (device == NULL) {
DBG("Error opening device\n");
return 0;
@@ -423,6 +424,7 @@ void mtpfuse_destroy (void *) {
mtpEntries.clear();
mtp_device->close();
storageEntries.clear();
+ usb_device_close(device);
start_media_scanner();
}