summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishal Mahaveer2013-11-06 15:34:59 -0600
committerGerrit Code Review2013-11-06 15:34:59 -0600
commitb254c03e01db64449e392181c2d2534dcf40fd29 (patch)
tree4fdecb5202941068e0301a82ce7787fd20c4b4a3
parent59ee8f140f9c38d1786e17d401276de38af8a382 (diff)
parentdf13623a80cd01d68b03b6b77a8e8009980760ca (diff)
downloaddevice-ti-common-open-b254c03e01db64449e392181c2d2534dcf40fd29.tar.gz
device-ti-common-open-b254c03e01db64449e392181c2d2534dcf40fd29.tar.xz
device-ti-common-open-b254c03e01db64449e392181c2d2534dcf40fd29.zip
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 @@
44using namespace android; 44using namespace android;
45 45
46MtpDevice* mtp_device = NULL; 46MtpDevice* mtp_device = NULL;
47usb_device* device = NULL;
47int mtp_device_found = 0; 48int mtp_device_found = 0;
48MtpStorageIDList* storageAreaList = NULL; 49MtpStorageIDList* storageAreaList = NULL;
49KeyedVector<uint32_t, char*> storageEntries; 50KeyedVector<uint32_t, char*> storageEntries;
@@ -56,7 +57,7 @@ KeyedVector<uint32_t, String8> fileDescriptorTable;
56 57
57static int usb_device_listed(const char *devname, void* client_data) { 58static int usb_device_listed(const char *devname, void* client_data) {
58 int fd; 59 int fd;
59 usb_device* device = usb_device_open(devname); 60 device = usb_device_open(devname);
60 if (device == NULL) { 61 if (device == NULL) {
61 DBG("Error opening device\n"); 62 DBG("Error opening device\n");
62 return 0; 63 return 0;
@@ -423,6 +424,7 @@ void mtpfuse_destroy (void *) {
423 mtpEntries.clear(); 424 mtpEntries.clear();
424 mtp_device->close(); 425 mtp_device->close();
425 storageEntries.clear(); 426 storageEntries.clear();
427 usb_device_close(device);
426 start_media_scanner(); 428 start_media_scanner();
427} 429}
428 430