tmpext->minor);
tmpext = tmpext->next;
}
- printf("Supported operations:\n");
+ LIBMTP_INFO("Supported operations:");
for (i=0;i<params->deviceinfo.OperationsSupported_len;i++) {
char txt[256];
(void) ptp_render_opcode(params, params->deviceinfo.OperationsSupported[i],
sizeof(txt), txt);
- printf(" %04x: %s\n", params->deviceinfo.OperationsSupported[i], txt);
+ LIBMTP_INFO(" %04x: %s", params->deviceinfo.OperationsSupported[i], txt);
}
- printf("Events supported:\n");
+ LIBMTP_INFO("Events supported:\n");
if (params->deviceinfo.EventsSupported_len == 0) {
- printf(" None.\n");
+ LIBMTP_INFO(" None.\n");
} else {
for (i=0;i<params->deviceinfo.EventsSupported_len;i++) {
- printf(" 0x%04x\n", params->deviceinfo.EventsSupported[i]);
+ LIBMTP_INFO(" 0x%04x\n", params->deviceinfo.EventsSupported[i]);
}
}
- printf("Device Properties Supported:\n");
+ LIBMTP_INFO("Device Properties Supported:\n");
for (i=0;i<params->deviceinfo.DevicePropertiesSupported_len;i++) {
char const *propdesc = ptp_get_property_description(params,
params->deviceinfo.DevicePropertiesSupported[i]);
if (propdesc != NULL) {
- printf(" 0x%04x: %s\n",
+ LIBMTP_INFO(" 0x%04x: %s\n",
params->deviceinfo.DevicePropertiesSupported[i], propdesc);
} else {
uint16_t prop = params->deviceinfo.DevicePropertiesSupported[i];
- printf(" 0x%04x: Unknown property\n", prop);
+ LIBMTP_INFO(" 0x%04x: Unknown property\n", prop);
}
}
#endif /* TIZEN_EXT */
int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *device, uint32_t const id,
- uint64_t offset, uint32_t maxbytes,
+ uint32_t offset, uint32_t maxbytes,
unsigned char **data, unsigned int *size)
{
PTPParams *params = (PTPParams *) device->params;
uint16_t ret;
+ PTPObject *ob;
- if (!ptp_operation_issupported(params, PTP_OC_ANDROID_GetPartialObject64)) {
- if (!ptp_operation_issupported(params, PTP_OC_GetPartialObject)) {
- add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
- "LIBMTP_GetPartialObject: PTP_OC_GetPartialObject not supported");
- return -1;
- }
+ if (!ptp_operation_issupported(params, PTP_OC_GetPartialObject)) {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
+ "LIBMTP_GetPartialObject: PTP_OC_GetPartialObject not supported");
+ return -1;
+ }
- if (offset >> 32 != 0) {
- add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
- "LIBMTP_GetPartialObject: PTP_OC_GetPartialObject only supports 32bit offsets");
- return -1;
- }
+ if (ptp_object_want(params, id, PTPOBJECT_OBJECTINFO_LOADED, &ob) != PTP_RC_OK) {
+ LIBMTP_INFO("ptp_object_want fail - id %d", id);
+ return -2;
+ }
- ret = ptp_getpartialobject(params, id, (uint32_t)offset, maxbytes, data, size);
- } else {
- ret = ptp_android_getpartialobject64(params, id, offset, maxbytes, data, size);
+ if (offset >> 32 != 0) {
+ add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
+ "LIBMTP_GetPartialObject: PTP_OC_GetPartialObject only supports 32bit offsets");
+ return -3;
}
+
+ ret = ptp_getpartialobject(params, id, offset, maxbytes, data, size);
if (ret == PTP_RC_OK)
return 0;
- return -1;
+ return ret;
}