summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShankar Rao2013-11-06 13:18:43 -0600
committerShankar Rao2013-11-06 13:18:43 -0600
commitdf13623a80cd01d68b03b6b77a8e8009980760ca (patch)
treed1fd7e17604742c0cc3cabd0b4f8dee415af9a41
parent04f77acac1d988936ee0a136d969ee45cf5e689c (diff)
downloaddevice-ti-common-open-df13623a80cd01d68b03b6b77a8e8009980760ca.tar.gz
device-ti-common-open-df13623a80cd01d68b03b6b77a8e8009980760ca.tar.xz
device-ti-common-open-df13623a80cd01d68b03b6b77a8e8009980760ca.zip
mtpfuse: Close the usb device when the filesystem is destroyed.
Close the usb device when the fuse filesystem is destroyed. Change-Id: I3230f82b56a2b60a741890891ea6a4350939feba Signed-off-by: Shankar Rao <shankar.nrao@ti.com>
-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