30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
diff -up gphoto2-2.4.0/libgphoto2-2.4.0/camlibs/ptp2/ptp.c.data-phase gphoto2-2.4.0/libgphoto2-2.4.0/camlibs/ptp2/ptp.c
|
|
--- libgphoto2-2.4.0/camlibs/ptp2/ptp.c.data-phase 2007-07-27 02:35:37.000000000 +0200
|
|
+++ libgphoto2-2.4.0/camlibs/ptp2/ptp.c 2008-04-17 06:19:34.000000000 +0200
|
|
@@ -2775,13 +2775,23 @@ ptp_mtp_getobjectreferences (PTPParams*
|
|
PTPContainer ptp;
|
|
uint16_t ret;
|
|
unsigned char* dpv=NULL;
|
|
+ unsigned int dpvlen = 0;
|
|
|
|
PTP_CNT_INIT(ptp);
|
|
ptp.Code=PTP_OC_MTP_GetObjectReferences;
|
|
ptp.Param1=handle;
|
|
ptp.Nparam=1;
|
|
- ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, NULL);
|
|
- if (ret == PTP_RC_OK) *arraylen = ptp_unpack_uint32_t_array(params, dpv, 0, ohArray);
|
|
+ ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, &dpvlen);
|
|
+ if (ret == PTP_RC_OK) {
|
|
+ /* Sandisk Sansa skips the DATA phase, but returns OK as response.
|
|
+ * this will give us a NULL here. Handle it. -Marcus */
|
|
+ if ((dpv == NULL) || (dpvlen == 0)) {
|
|
+ *arraylen = 0;
|
|
+ *ohArray = NULL;
|
|
+ } else {
|
|
+ *arraylen = ptp_unpack_uint32_t_array(params, dpv, 0, ohArray);
|
|
+ }
|
|
+ }
|
|
free(dpv);
|
|
return ret;
|
|
}
|