From ce815ef2a2b6f5880a40c9783ef906eaa994a089 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 17 Sep 2014 14:40:07 +0000 Subject: [PATCH] also allow partial data sent to handler for libmtp git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15185 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/ptp.c | 23 +++++++++++++++++++++++ camlibs/ptp2/ptp.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index 445e74a5c..69334048e 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -1446,6 +1446,29 @@ ptp_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset, return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, len); } +/** + * ptp_getpartialobject_to_handler: + * params: PTPParams* + * handle - Object handle + * offset - Offset into object + * maxbytes - Maximum of bytes to read + * handler - a ptp data handler + * + * Get object 'handle' from device and send the data to the + * data handler. Start from offset and read at most maxbytes. + * + * Return values: Some PTP_RC_* code. + **/ +uint16_t +ptp_getpartialobject_to_handler (PTPParams* params, uint32_t handle, uint32_t offset, + uint32_t maxbytes, PTPDataHandler *handler) +{ + PTPContainer ptp; + + PTP_CNT_INIT(ptp, PTP_OC_GetPartialObject, handle, offset, maxbytes); + return ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, handler); +} + /** * ptp_getthumb: * params: PTPParams* diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h index b8282fc10..754ce13ee 100644 --- a/camlibs/ptp2/ptp.h +++ b/camlibs/ptp2/ptp.h @@ -2523,6 +2523,9 @@ uint16_t ptp_getobject_to_handler (PTPParams* params, uint32_t handle, PTPDataHa uint16_t ptp_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset, uint32_t maxbytes, unsigned char** object, uint32_t *len); +uint16_t ptp_getpartialobject_to_handler (PTPParams* params, uint32_t handle, uint32_t offset, + uint32_t maxbytes, PTPDataHandler *handler); + uint16_t ptp_getthumb (PTPParams *params, uint32_t handle, unsigned char** object, unsigned int *len);