Home | History | Annotate | Download | only in src

Lines Matching refs:params

63 ptp_debug (PTPParams *params, const char *format, ...)
68 if (params->debug_func!=NULL)
69 params->debug_func (params->data, format, args);
80 ptp_error (PTPParams *params, const char *format, ...)
85 if (params->error_func!=NULL)
86 params->error_func (params->data, format, args);
110 * params: PTPParams*
137 ptp_transaction_new (PTPParams* params, PTPContainer* ptp,
143 if ((params==NULL) || (ptp==NULL))
146 ptp->Transaction_ID=params->transaction_id++;
147 ptp->SessionID=params->session_id;
149 CHECK_PTP_RC(params->sendreq_func (params, ptp));
155 ret = params->senddata_func(params, ptp,
158 ret = params->cancelreq_func(params,
159 params->transaction_id-1);
170 ret = params->getdata_func(params, ptp, handler);
172 ret = params->cancelreq_func(params,
173 params->transaction_id-1);
189 CHECK_PTP_RC(params->getresp_func(params, ptp));
190 if (ptp->Transaction_ID != params->transaction_id-1) {
194 ptp_error (params,
196 ptp->Transaction_ID, params->transaction_id-1
212 memory_getfunc(PTPParams* params, void* private,
228 memory_putfunc(PTPParams* params, void* private,
305 fd_getfunc(PTPParams* params, void* private,
321 fd_putfunc(PTPParams* params, void* private,
356 ptp_transaction (PTPParams* params, PTPContainer* ptp,
372 ret = ptp_transaction_new (params, ptp, flags, sendlen, &handler);
400 * params: PTPParams*
407 ptp_getdeviceinfo (PTPParams* params, PTPDeviceInfo* deviceinfo)
420 ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler);
423 if (ret == PTP_RC_OK) ptp_unpack_DI(params, di, deviceinfo, len);
429 ptp_canon_eos_getdeviceinfo (PTPParams* params, PTPCanonEOSDeviceInfo*di)
443 ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler);
445 if (ret == PTP_RC_OK) ptp_unpack_EOS_DI(params, data, di, len);
452 * params: PTPParams*
462 ptp_generic_no_data (PTPParams* params, uint16_t code, unsigned int n_param, ...)
480 return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
485 * params: PTPParams*
493 ptp_opensession (PTPParams* params, uint32_t session)
498 ptp_debug(params,"PTP: Opening session");
502 params->session_id=0x00000000;
504 params->transaction_id=0x0000000;
506 params->response_packet = NULL;
507 params->response_packet_size = 0;
509 params->split_header_data = 0;
515 ret=ptp_transaction_new(params, &ptp, PTP_DP_NODATA, 0, NULL);
517 params->session_id=session;
523 * params: PTPParams*
530 ptp_free_params (PTPParams *params) {
533 if (params->cameraname) free (params->cameraname);
534 if (params->wifi_profiles) free (params->wifi_profiles);
535 for (i=0;i<params->nrofobjects;i++)
536 ptp_free_object (&params->objects[i]);
537 free (params->objects);
538 ptp_free_DI (&params->deviceinfo);
543 * params: PTPParams*
550 ptp_getstorageids (PTPParams* params, PTPStorageIDs* storageids)
561 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &sids, &len);
562 if (ret == PTP_RC_OK) ptp_unpack_SIDs(params, sids, storageids, len);
569 * params: PTPParams*
578 ptp_getstorageinfo (PTPParams* params, uint32_t storageid,
591 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &si, &len);
592 if (ret == PTP_RC_OK) ptp_unpack_SI(params, si, storageinfo, len);
599 * params: PTPParams*
612 ptp_getobjecthandles (PTPParams* params, uint32_t storage,
628 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &oh, &len);
630 ptp_unpack_OH(params, oh, objecthandles, len);
650 * params: PTPParams*
663 ptp_getnumobjects (PTPParams* params, uint32_t storage,
678 ret=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
690 * params: PTPParams*
699 ptp_getobjectinfo (PTPParams* params, uint32_t handle,
712 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &oi, &len);
713 if (ret == PTP_RC_OK) ptp_unpack_OI(params, oi, objectinfo, len);
720 * params: PTPParams*
730 ptp_getobject (PTPParams* params, uint32_t handle, unsigned char** object)
740 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, &len);
745 * params: PTPParams*
755 ptp_getobject_to_handler (PTPParams* params, uint32_t handle, PTPDataHandler *handler)
763 return ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, handler);
768 * params: PTPParams*
778 ptp_getobject_tofd (PTPParams* params, uint32_t handle, int fd)
789 ret = ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler);
796 * params: PTPParams*
808 ptp_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset,
821 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, &len);
826 * params: PTPParams*
836 ptp_getthumb (PTPParams* params, uint32_t handle, unsigned char** object)
845 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, &len);
850 * params: PTPParams*
859 ptp_deleteobject (PTPParams* params, uint32_t handle, uint32_t ofc)
869 ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
874 ptp_remove_object_from_cache(params, handle);
880 * params: PTPParams*
897 ptp_sendobjectinfo (PTPParams* params, uint32_t* store,
912 size=ptp_pack_OI(params, objectinfo, &oidata);
913 ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &oidata, NULL);
923 * params: PTPParams*
933 ptp_sendobject (PTPParams* params, unsigned char* object, uint32_t size)
941 return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &object, NULL);
946 * params: PTPParams*
956 ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler *handler, uint32_t size)
963 return ptp_transaction_new(params, &ptp, PTP_DP_SENDDATA, size, handler);
969 * params: PTPParams*
979 ptp_sendobject_fromfd (PTPParams* params, int fd, uint32_t size)
989 ret = ptp_transaction_new(params, &ptp, PTP_DP_SENDDATA, size, &handler);
996 ptp_getdevicepropdesc (PTPParams* params, uint16_t propcode,
1009 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpd, &len);
1010 if (ret == PTP_RC_OK) ptp_unpack_DPD(params, dpd, devicepropertydesc, len);
1017 ptp_getdevicepropvalue (PTPParams* params, uint16_t propcode,
1032 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, &len);
1033 if (ret == PTP_RC_OK) ptp_unpack_DPV(params, dpv, &offset, len, value, datatype);
1039 ptp_setdevicepropvalue (PTPParams* params, uint16_t propcode,
1051 size=ptp_pack_DPV(params, value, &dpv, datatype);
1052 ret=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &dpv, NULL);
1059 * params: PTPParams*
1076 ptp_ek_sendfileobjectinfo (PTPParams* params, uint32_t* store,
1091 size=ptp_pack_OI(params, objectinfo, &oidata);
1092 ret=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &oidata, NULL);
1102 * params: PTPParams*
1112 ptp_ek_getserial (PTPParams* params, unsigned char **data, unsigned int *size)
1119 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
1124 * params: PTPParams*
1134 ptp_ek_setserial (PTPParams* params, unsigned char *data, unsigned int size)
1141 return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
1146 ptp_ek_9007 (PTPParams* params, unsigned char **data, unsigned int *size)
1153 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
1158 ptp_ek_9009 (PTPParams* params, uint32_t *p1, uint32_t *p2)
1166 ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1174 ptp_ek_900c (PTPParams* params, unsigned char **data, unsigned int *size)
1181 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
1187 * params: PTPParams*
1196 ptp_ek_settext (PTPParams* params, PTPEKTextParams *text)
1206 if (0 == (size = ptp_pack_EK_text(params, text, &data)))
1208 ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
1215 * params: PTPParams*
1225 ptp_ek_sendfileobject (PTPParams* params, unsigned char* object, uint32_t size)
1233 return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &object, NULL);
1238 * params: PTPParams*
1248 ptp_ek_sendfileobject_from_handler (PTPParams* params, PTPDataHandler*handler, uint32_t size)
1255 return ptp_transaction_new(params, &ptp, PTP_DP_SENDDATA, size, handler);
1269 * params: PTPParams*
1285 ptp_canon_getpartialobjectinfo (PTPParams* params, uint32_t handle, uint32_t p2,
1296 ret=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1304 * params: PTPParams*
1313 ptp_canon_get_mac_address (PTPParams* params, unsigned char **mac)
1322 return ptp_transaction(params
1327 * params: PTPParams*
1338 ptp_canon_get_directory (PTPParams* params,
1351 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dir, &size);
1354 ret = ptp_unpack_canon_directory(params, dir, ptp.Param1, handles, oinfos, flags);
1361 * params: PTPParams*
1372 ptp_canon_gettreeinfo (PTPParams* params, uint32_t *out)
1381 ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
1389 * params: PTPParams*
1398 ptp_canon_getpairinginfo (PTPParams* params, uint32_t nr, unsigned char **data, unsigned int *size)
1409 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
1417 * params: PTPParams*
1428 ptp_canon_gettreesize (PTPParams* params,
1440 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &out, &size);
1449 (*entries)[i].str = ptp_unpack_string(params, cur, 4, &len);
1458 * params: PTPParams*
1476 ptp_canon_checkevent (PTPParams* params, PTPContainer* event, int* isevent)
1488 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &evdata, &len);
1491 ptp_unpack_EC(params, evdata, event, len);
1500 ptp_check_event (PTPParams *params) {
1504 if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_NIKON) &&
1505 ptp_operation_issupported(params, PTP_OC_NIKON_CheckEvent)
1510 ret = ptp_nikon_check_event(params, &xevent, &evtcnt);
1515 if (params->nrofevents)
1516 params->events = realloc(params->events, sizeof(PTPContainer)*(evtcnt+params->nrofevents));
1518 params->events = malloc(sizeof(PTPContainer)*evtcnt);
1519 memcpy (&params->events[params->nrofevents],xevent,evtcnt*sizeof(PTPContainer));
1520 params->nrofevents += evtcnt;
1525 if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) &&
1526 ptp_operation_issupported(params, PTP_OC_CANON_CheckEvent)
1530 ret = ptp_canon_checkevent (params,&event,&isevent);
1537 ret = params->event_check(params,&event);
1541 ptp_debug (params, "event: nparams=0x%X, code=0x%X, trans_id=0x%X, p1=0x%X, p2=0x%X, p3=0x%X", event.Nparam,event.Code,event.Transaction_ID, event.Param1, event.Param2, event.Param3);
1542 if (params->nrofevents)
1543 params->events = realloc(params->events, sizeof(PTPContainer)*(params->nrofevents+1));
1545 params->events = malloc(sizeof(PTPContainer)*1);
1546 memcpy (&params->events[params->nrofevents],&event,1*sizeof(PTPContainer));
1547 params->nrofevents += 1;
1555 ptp_get_one_event(PTPParams *params, PTPContainer *event) {
1556 if (!params->nrofevents)
1558 memcpy (event, params->events, sizeof(PTPContainer));
1559 memmove (params->events, params->events+1, sizeof(PTPContainer)*(params->nrofevents-1));
1561 params->nrofevents--;
1572 * params: PTPParams*
1578 ptp_canon_eos_getevent (PTPParams* params, PTPCanon_changes_entry **entries, int *nrofentries)
1590 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size);
1592 *nrofentries = ptp_unpack_CANON_changes(params,data,size,entries);
1597 ptp_canon_eos_getdevicepropdesc (PTPParams* params, uint16_t propcode,
1602 for (i=0;i<params->nrofcanon_props;i++)
1603 if (params->canon_props[i].proptype == propcode)
1605 if (params->nrofcanon_props == i)
1607 memcpy (dpd, &params->canon_props[i].dpd, sizeof (*dpd));
1612 params->canon_props[i].dpd.FORM.Enum.SupportedValue,
1617 dpd->FactoryDefaultValue.str = strdup( params->canon_props[i].dpd.FactoryDefaultValue.str );
1618 dpd->CurrentValue.str = strdup( params->canon_props[i].dpd.CurrentValue.str );
1626 ptp_canon_eos_getstorageids (PTPParams* params, PTPStorageIDs* storageids)
1636 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &sids, &len);
1637 if (ret == PTP_RC_OK) ptp_unpack_SIDs(params, sids, storageids, len);
1643 ptp_canon_eos_getstorageinfo (PTPParams* params, uint32_t p1)
1654 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size);
1666 * params: PTPParams*
1676 ptp_canon_eos_getpartialobject (PTPParams* params, uint32_t oid, uint32_t offset, uint32_t xsize, unsigned char**data)
1688 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, &size);
1692 ptp_canon_eos_setdevicepropvalueex (PTPParams* params, unsigned char* data, unsigned int size)
1699 return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
1703 ptp_canon_eos_setdevicepropvalue (PTPParams* params,
1715 for (i=0;i<params->nrofcanon_props;i++)
1716 if (params->canon_props[i].proptype == propcode)
1718 if (params->nrofcanon_props == i)
1727 size = 8 + ptp_pack_EOS_ImageFormat( params, NULL, value->u16 );
1729 params->canon_props[i].dpd.CurrentValue.u16 = value->u16;
1730 ptp_pack_EOS_ImageFormat( params, data + 8, value->u16 );
1744 params->canon_props[i].dpd.CurrentValue.u8 = value->u8;
1749 params->canon_props[i].dpd.CurrentValue.u16 = value->u16;
1754 params->canon_props[i].dpd.CurrentValue.u32 = value->u32;
1758 free (params->canon_props[i].dpd.CurrentValue.str);
1759 params->canon_props[i].dpd.CurrentValue.str = strdup(value->str);
1767 ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
1778 * params: PTPParams*
1791 ptp_canon_getpartialobject (PTPParams* params, uint32_t handle,
1809 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &len);
1826 * params: PTPParams*
1834 ptp_canon_getviewfinderimage (PTPParams* params, unsigned char** image, uint32_t* size)
1843 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, image, &len);
1858 * params: PTPParams*
1866 ptp_canon_getchanges (PTPParams* params, uint16_t** props, uint32_t* propnum)
1877 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &len);
1879 *propnum=ptp_unpack_uint16_t_array(params,data,0,props);
1890 * params: PTPParams*
1908 ptp_canon_getobjectinfo (PTPParams* params, uint32_t store, uint32_t p2,
1925 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &len);
1932 ptp_unpack_Canon_FE(params,
1953 * params: PTPParams*
1961 ptp_canon_get_objecthandle_by_name (PTPParams* params, char* name, uint32_t* objectid)
1974 ptp_pack_string (params, name, data, 0, &len);
1975 ret=ptp_transaction (params, &ptp, PTP_DP_SENDDATA, (len+1)*2+1, &data, NULL);
1987 * params: PTPParams*
1996 ptp_canon_get_customize_data (PTPParams* params, uint32_t themenr,
2007 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
2012 ptp_nikon_curve_download (PTPParams* params, unsigned char **data, unsigned int *size) {
2019 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
2027 * params: PTPParams*
2035 ptp_nikon_get_vendorpropcodes (PTPParams* params, uint16_t **props, unsigned int *size) {
2046 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &xdata, &xsize);
2048 *size = ptp_unpack_uint16_t_array(params,xdata,0,props);
2053 ptp_nikon_getfileinfoinblock ( PTPParams* params,
2066 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
2074 * params: PTPParams*
2080 ptp_nikon_get_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size)
2087 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
2095 * params: PTPParams*
2101 ptp_nikon_get_preview_image (PTPParams* params, unsigned char **xdata, unsigned int *xsize,
2110 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, xdata, xsize);
2123 * params: PTPParams*
2129 ptp_canon_eos_get_viewfinder_image (PTPParams* params, unsigned char **data, unsigned int *size)
2137 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
2145 * params: PTPParams*
2153 ptp_nikon_check_event (PTPParams* params, PTPContainer** event, int* evtcnt)
2164 ret = ptp_transaction (params, &ptp, PTP_DP_GETDATA, 0, &data, &size);
2166 ptp_unpack_Nikon_EC (params, data, size, event, evtcnt);
2177 * params: PTPParams*
2185 ptp_nikon_getptpipinfo (PTPParams* params, unsigned char **data, unsigned int *size)
2192 return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
2200 * params: PTPParams*
2206 ptp_nikon_getwifiprofilelist (PTPParams* params)
2222 CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
2226 params->wifi_profiles_version = data[0];
2227 params->wifi_profiles_number = data[1];
2228 if (params->wifi_profiles)
2229 free(params->wifi_profiles);
2231 params->wifi_profiles = malloc(params->wifi_profiles_number*sizeof(PTPNIKONWifiProfile));
2232 memset(params->wifi_profiles, 0, params->wifi_profiles_number*sizeof(PTPNIKONWifiProfile));
2236 while (profn < params->wifi_profiles_number && pos < size) {
2238 params->wifi_profiles[profn].id = data[pos++];
2239 params->wifi_profiles[profn].valid = data[pos++];
2244 strncpy(params->wifi_profiles[profn].profile_name, (char*)&data[pos], n);
2245 params->wifi_profiles[profn].profile_name[16] = '\0';
2248 params->wifi_profiles[profn].display_order = data[pos++];
2249 params->wifi_profiles[profn].device_type = data[pos++];
2250 params->wifi_profiles[profn].icon_type = data[pos++];
2252 buffer = ptp_unpack_string(params, data, pos, &len);
2253 strncpy(params->wifi_profiles[profn].creation_date, buffer, sizeof(params->wifi_profiles[profn].creation_date));
2258 buffer = ptp_unpack_string(params, data, pos, &len);
2259 strncpy(params->wifi_profiles[profn].lastusage_date, buffer, sizeof(params->wifi_profiles[profn].lastusage_date));
2267 strncpy(params->wifi_profiles[profn].essid, (char*)&data[pos], n);
2268 params->wifi_profiles[profn].essid[32] = '\0';
2286 ptp_nikon_writewifiprofile(params, &test);
2297 * params: PTPParams*
2306 ptp_nikon_writewifiprofile (PTPParams* params, PTPNIKONWifiProfile* profile)
2320 if (!params->wifi_profiles)
2321 CHECK_PTP_RC(ptp_nikon_getwifiprofilelist(params));
2323 for (i = 0; i < params->wifi_profiles_number; i++) {
2324 if (!params->wifi_profiles[i].valid) {
2325 profilenr = params->wifi_profiles[i].id;
2349 ptp_pack_string(params, "19990909T090909", data, 0x19, &len);
2390 return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
2398 * params: PTPParams*
2407 ptp_mtp_getobjectpropssupported (PTPParams* params, uint16_t ofc,
2419 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size);
2421 *propnum=ptp_unpack_uint16_t_array(params,data,0,props);
2431 * params: PTPParams*
2440 PTPParams* params, uint16_t opc, uint16_t ofc, PTPObjectPropDesc *opd
2452 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size);
2454 ptp_unpack_OPD (params, data, opd, size);
2464 * params: PTPParams*
2473 PTPParams* params, uint32_t oid, uint16_t opc,
2487 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size);
2489 ptp_unpack_DPV(params, data, &offset, size, value, datatype);
2499 * params: PTPParams*
2508 PTPParams* params, uint32_t oid, uint16_t opc,
2521 size = ptp_pack_DPV(params, value, &data, datatype);
2522 ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
2528 ptp_mtp_getobjectreferences (PTPParams* params, uint32_t handle, uint32_t** ohArray, uint32_t* arraylen)
2539 ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, &dpvlen);
2547 params, dpv, 0, ohArray);
2555 ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArray, uint32_t arraylen)
2566 size = ptp_pack_uint32_t_array(params, ohArray, arraylen, &dpv);
2567 ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, (unsigned char **)&dpv, NULL);
2573 ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops)
2588 ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &opldata, &oplsize);
2589 if (ret == PTP_RC_OK) *nrofprops = ptp_unpack_OPL(params, opldata, props, oplsize);
2596 ptp_mtp_sendobjectproplist (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle,
2614 oplsize = ptp_pack_OPL(params,props,nrofprops,&opldata);
2615 ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, oplsize, &opldata, NULL);
2625 ptp_mtp_setobjectproplist (PTPParams* params, MTPProperties *props, int nrofprops)
2636 oplsize = ptp_pack_OPL(params,props,nrofprops,&opldata);
2637 ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, oplsize, &opldata, NULL);
2647 ptp_operation_issupported(PTPParams* params, uint16_t operation)
2651 for (;i<params->deviceinfo.OperationsSupported_len;i++) {
2652 if (params->deviceinfo.OperationsSupported[i]==operation)
2660 ptp_event_issupported(PTPParams* params, uint16_t event)
2664 for (;i<params->deviceinfo.EventsSupported_len;i++) {
2665 if (params->deviceinfo.EventsSupported[i]==event)
2673 ptp_property_issupported(PTPParams* params, uint16_t property)
2677 for (i=0;i<params->deviceinfo.DevicePropertiesSupported_len;i++)
2678 if (params->deviceinfo.DevicePropertiesSupported[i]==property)
2786 ptp_perror(PTPParams* params, uint16_t error) {
2843 ptp_error(params, ptp_errors[i].txt);
2847 ptp_get_property_description(PTPParams* params, uint16_t dpc)
3470 if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_MICROSOFT
3471 || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP)
3476 if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_EASTMAN_KODAK)
3481 if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_CANON)
3486 if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_NIKON)
3539 ptp_render_property_value(PTPParams* params, uint16_t dpc,
4127 (ptp_value_trans[i].vendor == params->deviceinfo.VendorExtensionID))
4142 (ptp_value_list[i].vendor == params->deviceinfo.VendorExtensionID)) &&
4148 if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_MICROSOFT
4149 || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP) {
4275 ptp_render_ofc(PTPParams* params, uint16_t ofc, int spaceleft, char *txt)
4284 switch (params->deviceinfo.VendorExtensionID) {
4409 ptp_render_opcode(PTPParams* params, uint16_t opcode, int spaceleft, char *txt)
4418 switch (params->deviceinfo.VendorExtensionID) {
4673 ptp_find_object_prop_in_cache(PTPParams *params, uint32_t const handle, uint32_t const attribute_id)
4680 ret = ptp_object_find (params, handle, &ob);
4693 ptp_remove_object_from_cache(PTPParams *params, uint32_t handle)
4699 ret = ptp_object_find (params, handle, &ob);
4702 i = ob-params->objects;
4706 if (i < params->nrofobjects-1)
4707 memmove (ob,ob+1,(params->nrofobjects-1-i)*sizeof(PTPObject));
4708 params->nrofobjects--;
4710 params->objects = realloc(params->objects, sizeof(PTPObject)*params->nrofobjects);
4721 ptp_objects_sort (PTPParams *params) {
4722 qsort (params->objects, params->nrofobjects, sizeof(PTPObject), _cmp_ob);
4727 ptp_object_find (PTPParams *params, uint32_t handle, PTPObject **retob) {
4731 *retob = bsearch (&tmpob, params->objects, params->nrofobjects, sizeof(tmpob), _cmp_ob);
4739 ptp_object_find_or_insert (PTPParams *params, uint32_t handle, PTPObject **retob) {
4746 if (!params->nrofobjects) {
4747 params->objects = calloc(1,sizeof(PTPObject));
4748 params->nrofobjects = 1;
4749 params->objects[0].oid = handle;
4750 *retob = &params->objects[0];
4754 end = params->nrofobjects-1;
4755 /*ptp_debug (params, "searching %08x, total=%d", handle, params->nrofobjects);*/
4758 /*ptp_debug (params, "ob %d: %08x [%d-%d]", cursor, params->objects[cursor].oid, begin, end);*/
4759 if (params->objects[cursor].oid == handle) {
4760 *retob = &params->objects[cursor];
4763 if (params->objects[cursor].oid < handle)
4770 if (params->objects[begin].oid == handle) {
4771 *retob = &params->objects[begin];
4774 if (params->objects[end].oid == handle) {
4775 *retob = &params->objects[end];
4778 if ((begin == 0) && (handle < params->objects[0].oid)) {
4781 if ((end == params->nrofobjects-1) && (handle > params->objects[end].oid))
4786 /*ptp_debug (params, "inserting oid %x at [%x,%x], begin=%d, end=%d, insertat=%d\n", handle, params->objects[begin].oid, params->objects[end].oid, begin, end, insertat);*/
4787 newobs = realloc (params->objects, sizeof(PTPObject)*(params->nrofobjects+1));
4789 params->objects = newobs;
4790 if (insertat<=params->nrofobjects)
4791 memmove (&params->objects[insertat+1],&params->objects[insertat],(params->nrofobjects-insertat)*sizeof(PTPObject));
4792 memset(&params->objects[insertat],0,sizeof(PTPObject));
4793 params->objects[insertat].oid = handle;
4794 *retob = &params->objects[insertat];
4795 params->nrofobjects++;
4800 ptp_object_want (PTPParams *params, uint32_t handle, int want, PTPObject **retob) {
4803 //Camera *camera = ((PTPData *)params->data)->camera;
4807 ptp_debug (params, "ptp_object_want: querying handle 0?\n");
4810 ret = ptp_object_find_or_insert (params, handle, &ob);
4826 ret = ptp_getobjectinfo (params, handle, &ob->oi);
4847 if (params->device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST) {
4853 if (!ptp_operation_issupported(params,PTP_OC_MTP_GetObjPropList)) {
4858 ptp_debug (params, "ptp2/mtpfast: reading mtp proplist of %08x", handle);
4859 ret = ptp_mtp_getobjectproplist (params, handle, &props, &nrofprops);
4877 ptp_debug (params, "ptp2/mtpfast: parentobject has type 0x%x???", xpl->datatype);
4881 ptp_debug (params, "ptp2/mtpfast: parent 0x%x", xpl->propval.u32);
4885 ptp_debug (params, "ptp2/mtpfast: objectformat has type 0x%x???", xpl->datatype);
4889 ptp_debug (params, "ptp2/mtpfast: ofc 0x%x", xpl->propval.u16);
4900 ptp_debug (params, "ptp2/mtpfast: objectsize has type 0x%x???", xpl->datatype);
4903 ptp_debug (params, "ptp2/mtpfast: objectsize %u", xpl->propval.u32);
4907 ptp_debug (params, "ptp2/mtpfast: storageid has type 0x%x???", xpl->datatype);
4911 ptp_debug (params, "ptp2/mtpfast: storageid 0x%x", xpl->propval.u32);
4915 ptp_debug (params, "ptp2/mtpfast: protectionstatus has type 0x%x???", xpl->datatype);
4919 ptp_debug (params, "ptp2/mtpfast: protection 0x%x", xpl->propval.u16);
4923 ptp_debug (params, "ptp2/mtpfast: filename has type 0x%x???", xpl->datatype);
4927 ptp_debug (params, "ptp2/mtpfast: filename %s", xpl->propval.str);
4935 ptp_debug (params, "ptp2/mtpfast: datecreated has type 0x%x???", xpl->datatype);
4938 ptp_debug (params, "ptp2/mtpfast: capturedate %s", xpl->propval.str);
4943 ptp_debug (params, "ptp2/mtpfast: datemodified has type 0x%x???", xpl->datatype);
4946 ptp_debug (params, "ptp2/mtpfast: moddate %s", xpl->propval.str);
4951 ptp_debug (params, "ptp2/mtpfast:case %x type %x unhandled", xpl->property, xpl->datatype);
4964 ptp_debug (params, "ptp_object_want: oid 0x%08x, want flags %x, have only %x?", handle, want, ob->flags);
4970 ptp_add_object_to_cache(PTPParams *params, uint32_t handle)
4973 return ptp_object_want (params, handle, PTPOBJECT_OBJECTINFO_LOADED|PTPOBJECT_MTPPROPLIST_LOADED, &ob);