AC_MSG_NOTICE([MTPZ functionality disable]);
fi
+#TIZEN_EXT
+PKG_CHECK_MODULES(DLOG, dlog)
+AC_SUBST(DLOG_CFLAGS)
+AC_SUBST(DLOG_LIBS)
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LIBS)
Name: libmtp
Summary: Library for media transfer protocol (mtp)
Version: 1.1.9
-Release: 5
+Release: 8
Group: Network & Connectivity/Other
License: LGPL-2.1
Source0: libmtp-%{version}.tar.gz
# This package would be built only TV
-%if "%{?tizen_profile_name}" != "tv"
-ExcludeArch: %{arm} %ix86 x86_64
+%if "%{?profile}" != "tv"
+ExcludeArch: %arm aarch64 %ix86 x86_64
%endif
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
BuildRequires: pkgconfig(libusb-1.0)
+BuildRequires: pkgconfig(dlog)
BuildRequires: libtool-ltdl-devel
BuildRequires: gettext-devel
lib_LTLIBRARIES = libmtp.la
-libmtp_la_CFLAGS = @LIBUSB_CFLAGS@
+libmtp_la_CFLAGS = @LIBUSB_CFLAGS@ $(DLOG_CFLAGS)
libmtp_la_SOURCES = libmtp.c unicode.c unicode.h util.c util.h playlist-spl.c \
gphoto2-endian.h _stdint.h ptp.c ptp.h libusb-glue.h \
music-players.h device-flags.h playlist-spl.h mtpz.h \
endif
libmtp_la_LDFLAGS=@LDFLAGS@ -no-undefined -export-symbols $(srcdir)/libmtp.sym -version-info $(SOVERSION) $(W32_LDFLAGS)
-libmtp_la_LIBADD=$(W32_LIBS) $(LTLIBICONV) @LIBUSB_LIBS@
+libmtp_la_LIBADD=$(W32_LIBS) $(LTLIBICONV) @LIBUSB_LIBS@ $(DLOG_LIBS)
libmtp_la_DEPENDENCIES=$(srcdir)/libmtp.sym
DISTCLEANFILES = _stdint.h gphoto2-endian.h
return NULL;
}
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
if (devices == NULL) {
return NULL;
}
if (ret != PTP_RC_OK) {
/* Device is closing down or other fatal stuff, exit thread */
+ LIBMTP_INFO("ptp_usb_event_wait ret %u\n", ret);
return -1;
}
}
/* Assign linked list of devices */
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
if (devices == NULL) {
*device_list = NULL;
return LIBMTP_ERROR_NO_DEVICE_ATTACHED;
add_object_to_cache(device, object_id);
}
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
int _is_exist_handler(int **object_list, int size, int current_handler)
{
int i;
ret = ptp_getobjecthandles(params, storageid, PTP_GOH_ALL_FORMATS, parentid, ¤tHandles);
- if (ret != PTP_RC_OK)
- return ret;
+ if (ret != PTP_RC_OK) {
+ LIBMTP_INFO("LIBMTP_Get_Object_Handles ret %u\n", ret);
+ return ret;
+ }
+
+#ifdef TIZEN_EXT
+ LIBMTP_INFO("LIBMTP_Get_Object_Handles currentHandles.n %u\n", currentHandles.n);
+#endif /* TIZEN_EXT */
if (currentHandles.n == 0) {
add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL,
MTPObjectInfo *LIBMTP_Get_Object_Info(LIBMTP_mtpdevice_t *device, uint32_t object_id)
{
PTPParams *params = (PTPParams *)device->params;
+ PTPObject *ob;
MTPObjectInfo *object_info;
uint16_t ret;
object_info = (MTPObjectInfo *)malloc(sizeof(MTPObjectInfo));
- ret = ptp_getobjectinfo(params, object_id, (PTPObjectInfo *)object_info);
+ ret = ptp_object_want(params, object_id, PTPOBJECT_OBJECTINFO_LOADED, &ob);
if (ret != PTP_RC_OK) {
if (object_info != NULL)
return NULL;
}
+ object_info->StorageID = ob->oi.StorageID;
+ object_info->ObjectFormat = ob->oi.ObjectFormat;
+ object_info->ProtectionStatus = ob->oi.ProtectionStatus;
+ object_info->ObjectCompressedSize = ob->oi.ObjectCompressedSize;
+ object_info->ThumbFormat = ob->oi.ThumbFormat;
+ object_info->ThumbCompressedSize = ob->oi.ThumbCompressedSize;
+ object_info->ThumbPixWidth = ob->oi.ThumbPixWidth;
+ object_info->ThumbPixHeight = ob->oi.ThumbPixHeight;
+ object_info->ImagePixWidth = ob->oi.ImagePixWidth;
+ object_info->ImagePixHeight = ob->oi.ImagePixHeight;
+ object_info->ImageBitDepth = ob->oi.ImageBitDepth;
+
+ object_info->ParentObject = ob->oi.ParentObject;
+ object_info->AssociationType = ob->oi.AssociationType;
+ object_info->AssociationDesc = ob->oi.AssociationDesc;
+ object_info->SequenceNumber = ob->oi.SequenceNumber;
+ object_info->CaptureDate = ob->oi.CaptureDate;
+ object_info->ModificationDate = ob->oi.ModificationDate;
+
+ if (ob->oi.Filename != NULL)
+ object_info->Filename = strdup(ob->oi.Filename);
+ else
+ object_info->Filename = NULL;
+
+ if (ob->oi.Keywords != NULL)
+ object_info->Keywords = strdup(ob->oi.Keywords);
+ else
+ object_info->Keywords = NULL;
+
object_info->ObjectFormat = map_ptp_type_to_libmtp_type(object_info->ObjectFormat);
object_info->ThumbFormat = map_ptp_type_to_libmtp_type(object_info->ThumbFormat);
LIBMTP_devicestorage_t *prev; /**< Previous storage */
};
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
struct _MTPObjectInfo {
uint32_t StorageID;
uint16_t ObjectFormat;
int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
int LIBMTP_Get_Object_Handles(LIBMTP_mtpdevice_t *device, uint32_t storage,
uint32_t format, uint32_t parent, uint32_t **object_list, uint32_t *object_num);
MTPObjectInfo *LIBMTP_Get_Object_Info(LIBMTP_mtpdevice_t *device, uint32_t object_id);
LIBMTP_devicestorage_t *prev; /**< Previous storage */
};
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
struct _MTPObjectInfo {
uint32_t StorageID;
uint16_t ObjectFormat;
int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const);
int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *);
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
int LIBMTP_Get_Object_Handles(LIBMTP_mtpdevice_t *device, uint32_t storage,
uint32_t format, uint32_t parent, uint32_t **object_list, uint32_t *object_num);
MTPObjectInfo *LIBMTP_Get_Object_Info(LIBMTP_mtpdevice_t *device, uint32_t object_id);
// Out of memory
*devices = NULL;
*numdevs = 0;
-#if 1//defined TIZEN_EXT
+#ifdef TIZEN_EXT
free_mtpdevice_list(devlist);
#endif /* TIZEN_EXT */
return LIBMTP_ERROR_MEMORY_ALLOCATION;
ptp_usb = (PTP_USB *)(params->data);
ret = PTP_RC_OK;
+
+#ifdef TIZEN_EXT
+ LIBMTP_INFO("ptp_usb_event() wait[%d]", wait);
+#endif /* TIZEN_EXT */
+
switch(wait) {
case PTP_EVENT_CHECK:
- result = USB_BULK_READ(ptp_usb->handle,
- ptp_usb->intep,
- (unsigned char *) &usbevent,
- sizeof(usbevent),
- &xread,
- 0);
+ result = USB_BULK_READ(ptp_usb->handle,
+ ptp_usb->intep,
+ (unsigned char *) &usbevent,
+ sizeof(usbevent),
+ &xread,
+ 0);
+#ifdef TIZEN_EXT
+ LIBMTP_INFO("first PTP_EVENT_CHECK USB_BULK_READ() result[%d]", result);
+#endif /* TIZEN_EXT */
+
if (xread == 0)
- result = USB_BULK_READ(ptp_usb->handle,
- ptp_usb->intep,
- (unsigned char *) &usbevent,
- sizeof(usbevent),
- &xread,
- 0);
+ result = USB_BULK_READ(ptp_usb->handle,
+ ptp_usb->intep,
+ (unsigned char *) &usbevent,
+ sizeof(usbevent),
+ &xread,
+ 0);
+#ifdef TIZEN_EXT
+ LIBMTP_INFO("second PTP_EVENT_CHECK USB_BULK_READ() result[%d]", result);
+#endif /* TIZEN_EXT */
if (result < 0) ret = PTP_ERROR_IO;
break;
case PTP_EVENT_CHECK_FAST:
- result = USB_BULK_READ(ptp_usb->handle,
- ptp_usb->intep,
- (unsigned char *) &usbevent,
- sizeof(usbevent),
- &xread,
- ptp_usb->timeout);
+ result = USB_BULK_READ(ptp_usb->handle,
+ ptp_usb->intep,
+ (unsigned char *) &usbevent,
+ sizeof(usbevent),
+ &xread,
+ ptp_usb->timeout);
+#ifdef TIZEN_EXT
+ LIBMTP_INFO("first PTP_EVENT_CHECK_FAST USB_BULK_READ() result[%d]", result);
+#endif /* TIZEN_EXT */
+
if (xread == 0)
- result = USB_BULK_READ(ptp_usb->handle,
- ptp_usb->intep,
- (unsigned char *) &usbevent,
- sizeof(usbevent),
- &xread,
- ptp_usb->timeout);
+ result = USB_BULK_READ(ptp_usb->handle,
+ ptp_usb->intep,
+ (unsigned char *) &usbevent,
+ sizeof(usbevent),
+ &xread,
+ ptp_usb->timeout);
+#ifdef TIZEN_EXT
+ LIBMTP_INFO("second PTP_EVENT_CHECK_FAST USB_BULK_READ() result[%d]", result);
+#endif /* TIZEN_EXT */
if (result < 0) ret = PTP_ERROR_IO;
break;
default:
ret = libusb_open(dev, &device_handle);
if (ret != LIBUSB_SUCCESS) {
- perror("libusb_open() failed!");
+ LIBMTP_ERROR("libusb_open() failed! ret[%d]", ret);
return -1;
}
ptp_usb->handle = device_handle;
libusb_kernel_driver_active(device_handle, ptp_usb->interface)
) {
if (LIBUSB_SUCCESS != libusb_detach_kernel_driver(device_handle, ptp_usb->interface)) {
- perror("libusb_detach_kernel_driver() failed, continuing anyway...");
+ LIBMTP_ERROR("libusb_detach_kernel_driver() failed, continuing anyway...");
}
}
*/
ret = libusb_get_active_config_descriptor(dev, &config);
if (ret != LIBUSB_SUCCESS) {
- perror("libusb_get_active_config_descriptor(1) failed");
+ LIBMTP_ERROR("libusb_get_active_config_descriptor(1) failed");
fprintf(stderr, "no active configuration, trying to set configuration\n");
if (libusb_set_configuration(device_handle, ptp_usb->config) != LIBUSB_SUCCESS) {
- perror("libusb_set_configuration() failed, continuing anyway...");
+ LIBMTP_ERROR("libusb_set_configuration() failed, continuing anyway...");
}
ret = libusb_get_active_config_descriptor(dev, &config);
if (ret != LIBUSB_SUCCESS) {
- perror("libusb_get_active_config_descriptor(2) failed");
+ LIBMTP_ERROR("libusb_get_active_config_descriptor(2) failed");
return -1;
}
}
if (config->bConfigurationValue != ptp_usb->config) {
fprintf(stderr, "desired configuration different from current, trying to set configuration\n");
if (libusb_set_configuration(device_handle, ptp_usb->config)) {
- perror("libusb_set_configuration() failed, continuing anyway...");
+ LIBMTP_ERROR("libusb_set_configuration() failed, continuing anyway...");
}
/* Re-fetch the config descriptor if we changed */
libusb_free_config_descriptor(config);
ret = libusb_get_active_config_descriptor(dev, &config);
if (ret != LIBUSB_SUCCESS) {
- perror("libusb_get_active_config_descriptor(2) failed");
+ LIBMTP_ERROR("libusb_get_active_config_descriptor(2) failed");
return -1;
}
}
if (ret == PTP_RC_OK) {
ptp_unpack_OH(params, oh, objecthandles, len);
} else {
- if ( (storage == 0xffffffff) &&
-#if 1//defined TIZEN_EXT
+ if ((storage == 0xffffffff) &&
+#ifdef TIZEN_EXT
(associationOH == 0xffffffff)
#else /* TIZEN_EXT */
(objectformatcode == 0) &&
#ifndef __MTP__UTIL__H
#define __MTP__UTIL__H
#include "config.h" // To get HAVE_STRNDUP
+#ifdef TIZEN_EXT
+#include <dlog.h>
+#endif /* TIZEN_EXT */
void data_dump(FILE *f, void *buf, uint32_t nbytes);
void data_dump_ascii (FILE *f, void *buf, uint32_t n, uint32_t dump_boundry);
char *strndup (const char *s, size_t n);
#endif
+#ifdef TIZEN_EXT
+#define DLOG_TAG "LIBMTP"
+
+#define LIBMTP_INFO(format, arg...) LOG(LOG_ERROR, DLOG_TAG, format, ##arg)
+#define LIBMTP_ERROR(format, arg...) LOG(LOG_ERROR, DLOG_TAG, format, ##arg)
+#else /* TIZEN_EXT */
/**
* Info macro
*/
else \
fprintf(stderr, format, ##args); \
} while (0)
-
+#endif /* TIZEN_EXT */
#endif //__MTP__UTIL__H