diff options
author | Shankar Rao | 2013-11-06 13:18:43 -0600 |
---|---|---|
committer | Shankar Rao | 2013-11-06 13:18:43 -0600 |
commit | df13623a80cd01d68b03b6b77a8e8009980760ca (patch) | |
tree | d1fd7e17604742c0cc3cabd0b4f8dee415af9a41 | |
parent | 04f77acac1d988936ee0a136d969ee45cf5e689c (diff) | |
download | device-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.cpp | 4 |
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 @@ | |||
44 | using namespace android; | 44 | using namespace android; |
45 | 45 | ||
46 | MtpDevice* mtp_device = NULL; | 46 | MtpDevice* mtp_device = NULL; |
47 | usb_device* device = NULL; | ||
47 | int mtp_device_found = 0; | 48 | int mtp_device_found = 0; |
48 | MtpStorageIDList* storageAreaList = NULL; | 49 | MtpStorageIDList* storageAreaList = NULL; |
49 | KeyedVector<uint32_t, char*> storageEntries; | 50 | KeyedVector<uint32_t, char*> storageEntries; |
@@ -56,7 +57,7 @@ KeyedVector<uint32_t, String8> fileDescriptorTable; | |||
56 | 57 | ||
57 | static int usb_device_listed(const char *devname, void* client_data) { | 58 | static 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 | ||