diff options
author | Jihoon Jung <jh8801.jung@samsung.com> | 2016-11-15 11:11:27 +0900 |
---|---|---|
committer | Jihoon Jung <jh8801.jung@samsung.com> | 2016-11-16 18:58:07 -0800 |
commit | fb4dac2c451b98891aee281ca85542edf9b0a280 (patch) | |
tree | aa6f5d4115e862ae0ebed6b5a0813fce43ff666d | |
parent | 409d8de2835a078c677985f0ebc2930b5c2a8c20 (diff) | |
download | libmtp-fb4dac2c451b98891aee281ca85542edf9b0a280.tar.gz libmtp-fb4dac2c451b98891aee281ca85542edf9b0a280.tar.bz2 libmtp-fb4dac2c451b98891aee281ca85542edf9b0a280.zip |
Minor patch in libmtpsubmit/tizen_3.0/20161118.060848accepted/tizen/3.0/tv/20161121.073828accepted/tizen/3.0/mobile/20161121.073805accepted/tizen/3.0/ivi/20161121.073849accepted/tizen/3.0/common/20161121.141018
- Modify Get partial object function
- Fix for overflow issue
- Add log
Change-Id: Id6a3915b708c5ade534b7938328e1d53cdc931fd
-rwxr-xr-x | packaging/libmtp.spec | 2 | ||||
-rwxr-xr-x | src/libmtp.c | 50 | ||||
-rwxr-xr-x | src/libmtp.h | 2 | ||||
-rwxr-xr-x | src/libmtp.h.in | 2 | ||||
-rwxr-xr-x | src/libusb1-glue.c | 14 |
5 files changed, 42 insertions, 28 deletions
diff --git a/packaging/libmtp.spec b/packaging/libmtp.spec index 118d1a5..cb25aec 100755 --- a/packaging/libmtp.spec +++ b/packaging/libmtp.spec @@ -3,7 +3,7 @@ Name: libmtp Summary: Library for media transfer protocol (mtp) Version: 1.1.11 -Release: 1 +Release: 2 Group: Network & Connectivity/Other License: LGPL-2.1 Source0: libmtp-%{version}.tar.gz diff --git a/src/libmtp.c b/src/libmtp.c index 28249e1..cf34a72 100755 --- a/src/libmtp.c +++ b/src/libmtp.c @@ -3143,33 +3143,33 @@ void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t *device) 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); } } @@ -9066,32 +9066,34 @@ int LIBMTP_Get_Thumbnail_From_Exif_Data(LIBMTP_mtpdevice_t *device, uint32_t con #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; } diff --git a/src/libmtp.h b/src/libmtp.h index 704c050..1a05aa1 100755 --- a/src/libmtp.h +++ b/src/libmtp.h @@ -1079,7 +1079,7 @@ int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, - uint64_t, uint32_t, + uint32_t, uint32_t, unsigned char **, unsigned int *); int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, unsigned char *, unsigned int); diff --git a/src/libmtp.h.in b/src/libmtp.h.in index d10a624..024fce9 100755 --- a/src/libmtp.h.in +++ b/src/libmtp.h.in @@ -1079,7 +1079,7 @@ int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, - uint64_t, uint32_t, + uint32_t, uint32_t, unsigned char **, unsigned int *); int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, unsigned char *, unsigned int); diff --git a/src/libusb1-glue.c b/src/libusb1-glue.c index ef13f03..c39603f 100755 --- a/src/libusb1-glue.c +++ b/src/libusb1-glue.c @@ -905,12 +905,24 @@ ptp_read_func ( LIBMTP_USB_DEBUG("Reading in 0x%04lx bytes\n", toread); - ret = USB_BULK_READ(ptp_usb->handle, + if (ptp_usb->params != NULL && + ptp_usb->params->deviceinfo.Model != NULL && + !strcmp(ptp_usb->params->deviceinfo.Model, "SM-C200")) { + ret = USB_BULK_READ(ptp_usb->handle, + ptp_usb->inep, + bytes, + CONTEXT_BLOCK_SIZE, + &xread, + ptp_usb->timeout); + } + else { + ret = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, bytes, toread, &xread, ptp_usb->timeout); + } LIBMTP_USB_DEBUG("Result of read: 0x%04x (%d bytes)\n", ret, xread); |