summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <meissner@suse.de>2018-12-28 14:20:37 +0100
committerMarcus Meissner <meissner@suse.de>2018-12-28 14:20:37 +0100
commit0e928e6df5b9bc96bf10f312a46ddadd8847488b (patch)
treef941152ea58f15cff4c0d8a175397209ce348245
parent27ad8c197a6b5d230c033ae04f98a5029efd1239 (diff)
downloadlibmtp-0e928e6df5b9bc96bf10f312a46ddadd8847488b.tar.gz
add more variants of proplist retrieval
-rw-r--r--src/ptp.c40
-rw-r--r--src/ptp.h2
2 files changed, 23 insertions, 19 deletions
diff --git a/src/ptp.c b/src/ptp.c
index fd3c9ac..5ac4895 100644
--- a/src/ptp.c
+++ b/src/ptp.c
@@ -4375,18 +4375,13 @@ ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArr
}
uint16_t
-ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+ptp_mtp_getobjectproplist_generic (PTPParams* params, uint32_t handle, uint32_t formats, uint32_t properties, uint32_t propertygroups, uint32_t level, MTPProperties **props, int *nrofprops)
{
PTPContainer ptp;
unsigned char *data = NULL;
unsigned int size;
- PTP_CNT_INIT(ptp, PTP_OC_MTP_GetObjPropList, handle,
- 0x00000000U, /* 0x00000000U should be "all formats" */
- 0xFFFFFFFFU, /* 0xFFFFFFFFU should be "all properties" */
- 0x00000000U,
- 0xFFFFFFFFU /* means - return full tree below the Param1 handle */
- );
+ PTP_CNT_INIT(ptp, PTP_OC_MTP_GetObjPropList, handle, formats, properties, propertygroups, level);
CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
*nrofprops = ptp_unpack_OPL(params, data, props, size);
free(data);
@@ -4394,22 +4389,29 @@ ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **p
}
uint16_t
-ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+ptp_mtp_getobjectproplist_level (PTPParams* params, uint32_t handle, uint32_t level, MTPProperties **props, int *nrofprops)
{
- PTPContainer ptp;
- unsigned char *data = NULL;
- unsigned int size;
-
- PTP_CNT_INIT(ptp, PTP_OC_MTP_GetObjPropList, handle,
+ return ptp_mtp_getobjectproplist_generic (params, handle,
0x00000000U, /* 0x00000000U should be "all formats" */
0xFFFFFFFFU, /* 0xFFFFFFFFU should be "all properties" */
- 0x00000000U,
- 0x00000000U /* means - return single tree below the Param1 handle */
+ 0,
+ level,
+ props,
+ nrofprops
);
- CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
- *nrofprops = ptp_unpack_OPL(params, data, props, size);
- free(data);
- return PTP_RC_OK;
+}
+
+
+uint16_t
+ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+{
+ return ptp_mtp_getobjectproplist_level(params, handle, 0xFFFFFFFFU, props, nrofprops);
+}
+
+uint16_t
+ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
+{
+ return ptp_mtp_getobjectproplist_level(params, handle, 0, props, nrofprops);
}
uint16_t
diff --git a/src/ptp.h b/src/ptp.h
index e44f2c5..deebdcf 100644
--- a/src/ptp.h
+++ b/src/ptp.h
@@ -3023,6 +3023,8 @@ uint16_t ptp_mtp_setobjectpropvalue (PTPParams* params, uint32_t oid, uint16_t o
PTPPropertyValue *value, uint16_t datatype);
uint16_t ptp_mtp_getobjectreferences (PTPParams* params, uint32_t handle, uint32_t** ohArray, uint32_t* arraylen);
uint16_t ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArray, uint32_t arraylen);
+uint16_t ptp_mtp_getobjectproplist_generic (PTPParams* params, uint32_t handle, uint32_t formats, uint32_t properties, uint32_t propertygroups, uint32_t level, MTPProperties **props, int *nrofprops);
+uint16_t ptp_mtp_getobjectproplist_level (PTPParams* params, uint32_t handle, uint32_t level, MTPProperties **props, int *nrofprops);
uint16_t ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops);
uint16_t ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops);
uint16_t ptp_mtp_sendobjectproplist (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle,