summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Walleij <triad@df.lth.se>2013-03-05 21:00:06 +0100
committerLinus Walleij <triad@df.lth.se>2013-03-05 21:00:06 +0100
commita381e8a353dfd64d25169cfb950b4dc7d4a3032a (patch)
treebca293c7fe4b7f6527e2e8b1605cc3bffecc94a7
parentbbbde1b61bb1d54f38513e406ec0d69279c39b99 (diff)
downloadlibmtp-a381e8a353dfd64d25169cfb950b4dc7d4a3032a.tar.gz
Properly update to the latest gphoto2 code, and update the
script grabbing out the source code... Signed-off-by: Linus Walleij <triad@df.lth.se>
-rwxr-xr-xsrc/gphoto2-sync.sh10
-rw-r--r--src/ptp-pack.c35
-rw-r--r--src/ptp.c116
-rw-r--r--src/ptp.h45
4 files changed, 172 insertions, 34 deletions
diff --git a/src/gphoto2-sync.sh b/src/gphoto2-sync.sh
index 43115ca..f250c6f 100755
--- a/src/gphoto2-sync.sh
+++ b/src/gphoto2-sync.sh
@@ -6,15 +6,15 @@ srcdir=`dirname $0`
# Get sources from gphoto2 SVN
WGET=`which wget`
if [ "x$WGET" != "x" ]; then
- wget -O tmpfile http://gphoto.svn.sourceforge.net/viewvc/*checkout*/gphoto/trunk/libgphoto2/camlibs/ptp2/ptp.c
+ wget -O tmpfile http://sourceforge.net/p/gphoto/code/14266/tree/trunk/libgphoto2/camlibs/ptp2/ptp.c?format=raw
mv tmpfile ptp.c.gphoto2
- wget -O tmpfile http://gphoto.svn.sourceforge.net/viewvc/*checkout*/gphoto/trunk/libgphoto2/camlibs/ptp2/ptp.h
+ wget -O tmpfile tmpfile http://sourceforge.net/p/gphoto/code/14266/tree/trunk/libgphoto2/camlibs/ptp2/ptp.h?format=raw
mv tmpfile ptp.h.gphoto2
- wget -O tmpfile http://gphoto.svn.sourceforge.net/viewvc/*checkout*/gphoto/trunk/libgphoto2/camlibs/ptp2/ptp-pack.c
+ wget -O tmpfile tmpfile http://sourceforge.net/p/gphoto/code/14266/tree/trunk/libgphoto2/camlibs/ptp2/ptp-pack.c?format=raw
mv tmpfile ptp-pack.c.gphoto2
- wget -O tmpfile http://gphoto.svn.sourceforge.net/viewvc/*checkout*/gphoto/trunk/libgphoto2/camlibs/ptp2/library.c
+ wget -O tmpfile tmpfile http://sourceforge.net/p/gphoto/code/14266/tree/trunk/libgphoto2/camlibs/ptp2/library.c?format=raw
mv tmpfile library.c.gphoto2
- wget -O tmpfile http://gphoto.svn.sourceforge.net/viewvc/*checkout*/gphoto/trunk/libgphoto2/camlibs/ptp2/music-players.h
+ wget -O tmpfile tmpfile http://sourceforge.net/p/gphoto/code/14266/tree/trunk/libgphoto2/camlibs/ptp2/music-players.h?format=raw
mv tmpfile music-players.h.gphoto2
else
echo "Could not sync to gphoto2. No WGET."
diff --git a/src/ptp-pack.c b/src/ptp-pack.c
index 716e8cb..a1ca597 100644
--- a/src/ptp-pack.c
+++ b/src/ptp-pack.c
@@ -1,3 +1,27 @@
+/* ptp-pack.c
+ *
+ * Copyright (C) 2001-2004 Mariusz Woloszyn <emsi@ipartners.pl>
+ * Copyright (C) 2003-2012 Marcus Meissner <marcus@jet.franken.de>
+ * Copyright (C) 2006-2008 Linus Walleij <triad@df.lth.se>
+ * Copyright (C) 2007 Tero Saarni <tero.saarni@gmail.com>
+ * Copyright (C) 2009 Axel Waggershauser <awagger@web.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
/* currently this file is included into ptp.c */
#ifdef HAVE_ICONV
@@ -533,7 +557,7 @@ static time_t
ptp_unpack_PTPTIME (const char *str) {
char ptpdate[40];
char tmp[5];
- int ptpdatelen;
+ size_t ptpdatelen;
struct tm tm;
if (!str)
@@ -543,11 +567,12 @@ ptp_unpack_PTPTIME (const char *str) {
/*ptp_debug (params ,"datelen is larger then size of buffer", ptpdatelen, (int)sizeof(ptpdate));*/
return 0;
}
- strcpy (ptpdate, str);
if (ptpdatelen<15) {
/*ptp_debug (params ,"datelen is less than 15 (%d)", ptpdatelen);*/
return 0;
}
+ strncpy (ptpdate, str, sizeof(ptpdate));
+ ptpdate[sizeof(ptpdate) - 1] = '\0';
memset(&tm,0,sizeof(tm));
strncpy (tmp, ptpdate, 4);
@@ -1352,7 +1377,7 @@ ptp_unpack_EOS_CustomFuncEx (PTPParams* params, unsigned char** data )
{
uint32_t s = dtoh32a( *data );
uint32_t n = s/4, i;
- char* str = (char*)malloc( s ); // n is size in uint32, average len(itoa(i)) < 4 -> alloc n chars
+ char* str = (char*)malloc( s ); /* n is size in uint32, average len(itoa(i)) < 4 -> alloc n chars */
if (!str)
return str;
char* p = str;
@@ -1375,7 +1400,7 @@ ptp_pack_EOS_CustomFuncEx (PTPParams* params, unsigned char* data, char* str)
for (i=0; i<n; i++)
{
v = strtoul(str, &str, 16);
- str++; // skip the ',' delimiter
+ str++; /* skip the ',' delimiter */
htod32a(data + i*4, v);
}
@@ -1639,6 +1664,7 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
case PTP_DPC_CANON_EOS_QuickReviewTime:
case PTP_DPC_CANON_EOS_EVFMode:
case PTP_DPC_CANON_EOS_EVFOutputDevice:
+ case PTP_DPC_CANON_EOS_AutoPowerOff:
dpd->DataType = PTP_DTC_UINT16;
break;
case PTP_DPC_CANON_EOS_PictureStyle:
@@ -1659,7 +1685,6 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize,
dpd->DataType = PTP_DTC_INT16;
break;
/* unknown props, listed from dump.... all 16 bit, but vals might be smaller */
- case 0xd114:
case PTP_DPC_CANON_EOS_DPOFVersion:
dpd->DataType = PTP_DTC_UINT16;
ptp_debug (params, "event %d: Unknown EOS property %04x, datasize is %d, using uint16", i ,proptype, size-PTP_ece_Prop_Val_Data);
diff --git a/src/ptp.c b/src/ptp.c
index d6acb43..efc01d7 100644
--- a/src/ptp.c
+++ b/src/ptp.c
@@ -136,8 +136,8 @@ ptp_error (PTPParams *params, const char *format, ...)
**/
uint16_t
ptp_transaction_new (PTPParams* params, PTPContainer* ptp,
- uint16_t flags, unsigned int sendlen,
- PTPDataHandler *handler
+ uint16_t flags, uint64_t sendlen,
+ PTPDataHandler *handler
) {
int tries;
uint16_t cmd;
@@ -380,7 +380,7 @@ ptp_exit_fd_handler (PTPDataHandler *handler) {
/* Old style transaction, based on memory */
uint16_t
ptp_transaction (PTPParams* params, PTPContainer* ptp,
- uint16_t flags, unsigned int sendlen,
+ uint16_t flags, uint64_t sendlen,
unsigned char **data, unsigned int *recvlen
) {
PTPDataHandler handler;
@@ -388,10 +388,12 @@ ptp_transaction (PTPParams* params, PTPContainer* ptp,
switch (flags & PTP_DP_DATA_MASK) {
case PTP_DP_SENDDATA:
- ptp_init_send_memory_handler (&handler, *data, sendlen);
+ ret = ptp_init_send_memory_handler (&handler, *data, sendlen);
+ if (ret != PTP_RC_OK) return ret;
break;
case PTP_DP_GETDATA:
- ptp_init_recv_memory_handler (&handler);
+ ret = ptp_init_recv_memory_handler (&handler);
+ if (ret != PTP_RC_OK) return ret;
break;
default:break;
}
@@ -1047,7 +1049,7 @@ ptp_sendobjectinfo (PTPParams* params, uint32_t* store,
* ptp_sendobject:
* params: PTPParams*
* char* object - contains the object that is to be sent
- * uint32_t size - object size
+ * uint64_t size - object size
*
* Sends object to Responder.
*
@@ -1055,7 +1057,7 @@ ptp_sendobjectinfo (PTPParams* params, uint32_t* store,
*
*/
uint16_t
-ptp_sendobject (PTPParams* params, unsigned char* object, uint32_t size)
+ptp_sendobject (PTPParams* params, unsigned char* object, uint64_t size)
{
PTPContainer ptp;
@@ -1070,7 +1072,7 @@ ptp_sendobject (PTPParams* params, unsigned char* object, uint32_t size)
* ptp_sendobject_from_handler:
* params: PTPParams*
* PTPDataHandler* - File descriptor to read() object from
- * uint32_t size - File/object size
+ * uint64_t size - File/object size
*
* Sends object from file descriptor by consecutive reads from this
* descriptor.
@@ -1078,7 +1080,7 @@ ptp_sendobject (PTPParams* params, unsigned char* object, uint32_t size)
* Return values: Some PTP_RC_* code.
**/
uint16_t
-ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler *handler, uint32_t size)
+ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler *handler, uint64_t size)
{
PTPContainer ptp;
@@ -1093,7 +1095,7 @@ ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler *handler, uint32_
* ptp_sendobject_fromfd:
* params: PTPParams*
* fd - File descriptor to read() object from
- * uint32_t size - File/object size
+ * uint64_t size - File/object size
*
* Sends object from file descriptor by consecutive reads from this
* descriptor.
@@ -1101,7 +1103,7 @@ ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler *handler, uint32_
* Return values: Some PTP_RC_* code.
**/
uint16_t
-ptp_sendobject_fromfd (PTPParams* params, int fd, uint32_t size)
+ptp_sendobject_fromfd (PTPParams* params, int fd, uint64_t size)
{
PTPContainer ptp;
PTPDataHandler handler;
@@ -3276,6 +3278,71 @@ ptp_chdk_get_video_settings(PTPParams* params, ptp_chdk_videosettings* vsettings
}
+/**
+ * Android MTP Extensions
+ */
+
+/**
+ * ptp_android_getpartialobject64:
+ * params: PTPParams*
+ * handle - Object handle
+ * offset - Offset into object
+ * maxbytes - Maximum of bytes to read
+ * object - pointer to data area
+ * len - pointer to returned length
+ *
+ * Get object 'handle' from device and store the data in newly
+ * allocated 'object'. Start from offset and read at most maxbytes.
+ *
+ * This is a 64bit offset version of the standard GetPartialObject.
+ *
+ * Return values: Some PTP_RC_* code.
+ **/
+uint16_t
+ptp_android_getpartialobject64 (PTPParams* params, uint32_t handle, uint64_t offset,
+ uint32_t maxbytes, unsigned char** object,
+ uint32_t *len)
+{
+ PTPContainer ptp;
+
+ PTP_CNT_INIT(ptp);
+ ptp.Code=PTP_OC_ANDROID_GetPartialObject64;
+ ptp.Param1=handle;
+ ptp.Param2=offset & 0xFFFFFFFF;
+ ptp.Param3=offset >> 32;
+ ptp.Param4=maxbytes;
+ ptp.Nparam=4;
+ *len=0;
+ return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, len);
+}
+
+uint16_t
+ptp_android_sendpartialobject (PTPParams* params, uint32_t handle, uint64_t offset,
+ unsigned char* object, uint32_t len)
+{
+ uint32_t err;
+ PTPContainer ptp;
+
+ PTP_CNT_INIT(ptp);
+ ptp.Code=PTP_OC_ANDROID_SendPartialObject;
+ ptp.Param1=handle;
+ ptp.Param2=offset & 0xFFFFFFFF;
+ ptp.Param3=offset >> 32;
+ ptp.Param4=len;
+ ptp.Nparam=4;
+
+ /*
+ * MtpServer.cpp is buggy: it uses write() without offset
+ * rather than pwrite to send the data for data coming with
+ * the header packet
+ */
+ params->split_header_data = 1;
+ err=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, len, &object, NULL);
+ params->split_header_data = 0;
+
+ return err;
+}
+
/* Non PTP protocol functions */
/* devinfo testing functions */
@@ -5112,7 +5179,14 @@ struct {
{PTP_OC_MTP_WMDRMND_GetWMDRMNDLicenseResponse,N_("Get WMDRM-ND License Response")},
/* WiFi Provisioning MTP Extension Codes (microsoft.com/WPDWCN: 1.0) */
- {PTP_OC_MTP_WPDWCN_ProcessWFCObject,N_("Process WFC Object")}
+ {PTP_OC_MTP_WPDWCN_ProcessWFCObject,N_("Process WFC Object")},
+
+ /* Android Direct I/O Extensions */
+ {PTP_OC_ANDROID_GetPartialObject64,N_("Get Partial Object (64bit Offset)")},
+ {PTP_OC_ANDROID_SendPartialObject,N_("Send Partial Object")},
+ {PTP_OC_ANDROID_TruncateObject,N_("Truncate Object")},
+ {PTP_OC_ANDROID_BeginEditObject,N_("Begin Edit Object")},
+ {PTP_OC_ANDROID_EndEditObject,N_("End Edit Object")},
};
int
@@ -5550,9 +5624,23 @@ ptp_object_want (PTPParams *params, uint32_t handle, int want, PTPObject **retob
/* Second EOS issue, 0x20000000 has 0x20000000 as parent */
if (ob->oi.ParentObject == handle)
ob->oi.ParentObject = 0;
- ob->flags |= X;
- /* EOS bug, DCIM links back to itself. */
+ /* Read out the canon special flags */
+ if ((params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) &&
+ ptp_operation_issupported(params,PTP_OC_CANON_GetObjectInfoEx)) {
+ PTPCANONFolderEntry *ents = NULL;
+ uint32_t numents = 0;
+
+ ret = ptp_canon_getobjectinfo(params,
+ ob->oi.StorageID,0,
+ ob->oi.ParentObject,handle,
+ &ents,&numents
+ );
+ if ((ret == PTP_RC_OK) && (numents >= 1))
+ ob->canon_flags = ents[0].Flags;
+ }
+
+ ob->flags |= X;
}
#undef X
if ( (want & PTPOBJECT_MTPPROPLIST_LOADED) &&
diff --git a/src/ptp.h b/src/ptp.h
index 8836d19..5702a6f 100644
--- a/src/ptp.h
+++ b/src/ptp.h
@@ -548,6 +548,13 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_OC_OLYMPUS_SetCameraID 0x9501
#define PTP_OC_OLYMPUS_GetCameraID 0x9581
+/* Android Random I/O Extensions Codes */
+#define PTP_OC_ANDROID_GetPartialObject64 0x95C1
+#define PTP_OC_ANDROID_SendPartialObject 0x95C2
+#define PTP_OC_ANDROID_TruncateObject 0x95C3
+#define PTP_OC_ANDROID_BeginEditObject 0x95C4
+#define PTP_OC_ANDROID_EndEditObject 0x95C5
+
/* Proprietary vendor extension operations mask */
#define PTP_OC_EXTENSION_MASK 0xF000
#define PTP_OC_EXTENSION 0x9000
@@ -716,6 +723,10 @@ typedef struct _PTPIPHeader PTPIPHeader;
#define PTP_EC_Nikon_AdvancedTransfer 0xC103
#define PTP_EC_Nikon_PreviewImageAdded 0xC104
+/* Olympus E series */
+#define PTP_EC_Olympus_PropertyChanged 0xC102
+#define PTP_EC_Olympus_CaptureComplete 0xC103
+
/* MTP Event codes */
#define PTP_EC_MTP_ObjectPropChanged 0xC801
#define PTP_EC_MTP_ObjectPropDescChanged 0xC802
@@ -861,6 +872,7 @@ typedef struct _PTPObjectInfo PTPObjectInfo;
#define PTP_OFC_CANON_CRW 0xb101
#define PTP_OFC_CANON_CRW3 0xb103
#define PTP_OFC_CANON_MOV 0xb104
+#define PTP_OFC_CANON_MOV2 0xb105
/* CHDK specific raw mode */
#define PTP_OFC_CANON_CHDK_CRW 0xb1ff
/* MTP extensions */
@@ -1367,6 +1379,7 @@ typedef struct _PTPCanonEOSDeviceInfo {
#define PTP_DPC_CANON_EOS_BatteryPower 0xD111
#define PTP_DPC_CANON_EOS_BatterySelect 0xD112
#define PTP_DPC_CANON_EOS_CameraTime 0xD113
+#define PTP_DPC_CANON_EOS_AutoPowerOff 0xD114
#define PTP_DPC_CANON_EOS_Owner 0xD115
#define PTP_DPC_CANON_EOS_ModelID 0xD116
#define PTP_DPC_CANON_EOS_PTPExtensionVersion 0xD119
@@ -2074,7 +2087,7 @@ typedef struct _PTPDataHandler {
*/
typedef uint16_t (* PTPIOSendReq) (PTPParams* params, PTPContainer* req);
typedef uint16_t (* PTPIOSendData) (PTPParams* params, PTPContainer* ptp,
- unsigned long size, PTPDataHandler*getter);
+ uint64_t size, PTPDataHandler*getter);
typedef uint16_t (* PTPIOGetResp) (PTPParams* params, PTPContainer* resp);
typedef uint16_t (* PTPIOGetData) (PTPParams* params, PTPContainer* ptp,
@@ -2181,6 +2194,7 @@ struct _PTPParams {
PTPDeviceInfo outer_deviceinfo;
char *olympus_cmd;
char *olympus_reply;
+ struct _PTPParams *outer_params;
#ifdef HAVE_ICONV
/* PTP: iconv converters */
@@ -2198,7 +2212,7 @@ struct _PTPParams {
/* last, but not least - ptp functions */
uint16_t ptp_usb_sendreq (PTPParams* params, PTPContainer* req);
uint16_t ptp_usb_senddata (PTPParams* params, PTPContainer* ptp,
- unsigned long size, PTPDataHandler *handler);
+ uint64_t size, PTPDataHandler *handler);
uint16_t ptp_usb_getresp (PTPParams* params, PTPContainer* resp);
uint16_t ptp_usb_getdata (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *handler);
@@ -2214,7 +2228,7 @@ uint16_t ptp_usb_control_cancel_request (PTPParams *params, uint32_t transid);
int ptp_ptpip_connect (PTPParams* params, const char *port);
uint16_t ptp_ptpip_sendreq (PTPParams* params, PTPContainer* req);
uint16_t ptp_ptpip_senddata (PTPParams* params, PTPContainer* ptp,
- unsigned long size, PTPDataHandler *handler);
+ uint64_t size, PTPDataHandler *handler);
uint16_t ptp_ptpip_getresp (PTPParams* params, PTPContainer* resp);
uint16_t ptp_ptpip_getdata (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *handler);
@@ -2228,11 +2242,11 @@ uint16_t ptp_generic_no_data (PTPParams* params, uint16_t opcode, unsigned int c
uint16_t ptp_opensession (PTPParams *params, uint32_t session);
uint16_t ptp_transaction_new (PTPParams* params, PTPContainer* ptp,
- uint16_t flags, unsigned int sendlen,
+ uint16_t flags, uint64_t sendlen,
PTPDataHandler *handler
);
uint16_t ptp_transaction (PTPParams* params, PTPContainer* ptp,
- uint16_t flags, unsigned int sendlen,
+ uint16_t flags, uint64_t sendlen,
unsigned char **data, unsigned int *recvlen
);
@@ -2312,9 +2326,9 @@ uint16_t ptp_sendobjectinfo (PTPParams* params, uint32_t* store,
*/
#define ptp_setobjectprotection(params,oid,newprot) ptp_generic_no_data(params,PTP_OC_SetObjectProtection,2,oid,newprot)
uint16_t ptp_sendobject (PTPParams* params, unsigned char* object,
- uint32_t size);
-uint16_t ptp_sendobject_fromfd (PTPParams* params, int fd, uint32_t size);
-uint16_t ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler*, uint32_t size);
+ uint64_t size);
+uint16_t ptp_sendobject_fromfd (PTPParams* params, int fd, uint64_t size);
+uint16_t ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler*, uint64_t size);
/**
* ptp_initiatecapture:
* params: PTPParams*
@@ -2715,7 +2729,7 @@ uint16_t ptp_nikon_writewifiprofile (PTPParams* params, PTPNIKONWifiProfile* pro
#define ptp_canon_eos_zoom(params,x) ptp_generic_no_data(params,PTP_OC_CANON_EOS_Zoom,1,x)
#define ptp_canon_eos_zoomposition(params,x,y) ptp_generic_no_data(params,PTP_OC_CANON_EOS_ZoomPosition,2,x,y)
-#define ptp_canon_eos_remotereleaseon(params,x) ptp_generic_no_data(params,PTP_OC_CANON_EOS_RemoteReleaseOn,1,x)
+#define ptp_canon_eos_remotereleaseon(params,x) ptp_generic_no_data(params,PTP_OC_CANON_EOS_RemoteReleaseOn,2,x,1)
#define ptp_canon_eos_remotereleaseoff(params,x) ptp_generic_no_data(params,PTP_OC_CANON_EOS_RemoteReleaseOff,1,x)
/**
* ptp_nikon_mfdrive:
@@ -2819,11 +2833,22 @@ uint16_t ptp_nikon_getfileinfoinblock (PTPParams* params, uint32_t p1, uint32_t
#define ptp_nikon_device_ready(params) ptp_generic_no_data (params, PTP_OC_NIKON_DeviceReady, 0)
uint16_t ptp_mtp_getobjectpropssupported (PTPParams* params, uint16_t ofc, uint32_t *propnum, uint16_t **props);
+
+/* Android MTP Extensions */
+uint16_t ptp_android_getpartialobject64 (PTPParams* params, uint32_t handle, uint64_t offset,
+ uint32_t maxbytes, unsigned char** object,
+ uint32_t *len);
+#define ptp_android_begineditobject(params,handle) ptp_generic_no_data (params, PTP_OC_ANDROID_BeginEditObject, 1, handle);
+#define ptp_android_truncate(params,handle,offset) ptp_generic_no_data (params, PTP_OC_ANDROID_TruncateObject, 3, handle, (offset & 0xFFFFFFFF), (offset >> 32));
+uint16_t ptp_android_sendpartialobject (PTPParams *params, uint32_t handle,
+ uint64_t offset, unsigned char *object, uint32_t len);
+#define ptp_android_endeditobject(params,handle) ptp_generic_no_data (params, PTP_OC_ANDROID_EndEditObject, 1, handle);
+
/* Non PTP protocol functions */
static inline int
ptp_operation_issupported(PTPParams* params, uint16_t operation)
{
- int i=0;
+ unsigned int i=0;
for (;i<params->deviceinfo.OperationsSupported_len;i++) {
if (params->deviceinfo.OperationsSupported[i]==operation)