aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJerry Zhang <zhangjerry@google.com>2017-06-08 18:19:59 -0700
committerJerry Zhang <zhangjerry@google.com>2017-06-13 15:19:44 -0700
commit60d0226d791d6a80e716c4c8ac29aa41315cf308 (patch)
tree4b3bcb33cf517b996e84f7f0aba9576ed1e8a9b8 /src
parentd06c63bd622b5a8d7c23b18a06b3bbd428f206cd (diff)
downloadlibmtp-60d0226d791d6a80e716c4c8ac29aa41315cf308.tar.gz
Add AFT specific extensions to libmtp.
Diffstat (limited to 'src')
-rw-r--r--src/libmtp.c21
-rw-r--r--src/libmtp.h.in6
-rw-r--r--src/libmtp.sym3
3 files changed, 30 insertions, 0 deletions
diff --git a/src/libmtp.c b/src/libmtp.c
index 432f6b1..7a0ac13 100644
--- a/src/libmtp.c
+++ b/src/libmtp.c
@@ -130,6 +130,7 @@ static filemap_t *g_filemap = NULL;
// This holds the global property mapping table
static propertymap_t *g_propertymap = NULL;
+static int load_cache_on_demand = 0;
/*
* Forward declarations of local (static) functions.
*/
@@ -2580,6 +2581,18 @@ void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t *device)
}
}
+void LIBMTP_Set_Device_Timeout(LIBMTP_mtpdevice_t *device, int milliseconds)
+{
+ PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
+ set_usb_device_timeout(ptp_usb, milliseconds);
+}
+
+void LIBMTP_Get_Device_Timeout(LIBMTP_mtpdevice_t *device, int *milliseconds)
+{
+ PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
+ get_usb_device_timeout(ptp_usb, milliseconds);
+}
+
/**
* This command gets all handles and stuff by FAST directory retrieveal
* which is available by getting all metadata for object
@@ -2794,6 +2807,10 @@ static void flush_handles(LIBMTP_mtpdevice_t *device)
return;
}
+ if (load_cache_on_demand) {
+ return;
+ }
+
if (params->objects != NULL) {
for (i=0;i<params->nrofobjects;i++)
ptp_free_object (&params->objects[i]);
@@ -4555,6 +4572,10 @@ LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *device,
return retfiles;
}
+void LIBMTP_Set_Load_Cache_On_Demand(int flag)
+{
+ load_cache_on_demand = flag;
+}
/**
* This creates a new track metadata structure and allocates memory
diff --git a/src/libmtp.h.in b/src/libmtp.h.in
index 6a12891..5ba6cc7 100644
--- a/src/libmtp.h.in
+++ b/src/libmtp.h.in
@@ -58,6 +58,7 @@ typedef unsigned __int64 uint64_t;
#include <stdint.h>
/* We use time_t */
#include <time.h>
+#include <utime.h>
/**
* @defgroup types libmtp global type definitions
@@ -856,6 +857,9 @@ LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*);
void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*);
void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*);
+void LIBMTP_Set_Device_Timeout(LIBMTP_mtpdevice_t *device, int milliseconds);
+void LIBMTP_Get_Device_Timeout(LIBMTP_mtpdevice_t *device, int *milliseconds);
+
#define LIBMTP_STORAGE_SORTBY_NOTSORTED 0
#define LIBMTP_STORAGE_SORTBY_FREESPACE 1
#define LIBMTP_STORAGE_SORTBY_MAXSPACE 2
@@ -952,6 +956,8 @@ int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const,
int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const,
unsigned char **data, unsigned int *size);
+void LIBMTP_Set_Load_Cache_On_Demand(int flag);
+
/**
* @}
* @defgroup tracks The track management API.
diff --git a/src/libmtp.sym b/src/libmtp.sym
index a05d6dd..01d54ff 100644
--- a/src/libmtp.sym
+++ b/src/libmtp.sym
@@ -1,4 +1,7 @@
LIBMTP_Set_Debug
+LIBMTP_Set_Device_Timeout
+LIBMTP_Get_Device_Timeout
+LIBMTP_Set_Load_Cache_On_Demand
LIBMTP_Init
LIBMTP_Get_Supported_Devices_List
LIBMTP_Detect_Raw_Devices