Change timeout value 60s to 3s when get thumbnail from ptp devices 35/282635/1 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.060508 accepted/tizen/7.0/unified/hotfix/20221116.111004 accepted/tizen/unified/20221007.171845 tizen_7.0_m2_release
authorJihoon Jung <jh8801.jung@samsung.com>
Fri, 7 Oct 2022 05:26:20 +0000 (14:26 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Fri, 7 Oct 2022 05:27:48 +0000 (14:27 +0900)
Change-Id: I99e706148b06788127c858c7d74f198c64d054e8
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
packaging/libmtp.spec [changed mode: 0755->0644]
src/libmtp.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index ad03958..7558ea4
@@ -3,7 +3,7 @@
 Name:       libmtp
 Summary:    Library for media transfer protocol (mtp)
 Version:    1.1.11
-Release:    14
+Release:    15
 Group:      Network & Connectivity/Other
 License:    LGPL-2.1
 Source0:    libmtp-%{version}.tar.gz
old mode 100755 (executable)
new mode 100644 (file)
index 1b0d6a0..859c99c
@@ -1695,7 +1695,7 @@ LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void)
   if (devices == NULL) {
     return NULL;
   }
-  
+
   if (numdevs == 0) {
     if (devices) {
       free(devices);
@@ -8987,19 +8987,36 @@ int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *device,
 int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *device, uint32_t const id,
                          unsigned char **data, unsigned int *size)
 {
+  LIBMTP_INFO("LIBMTP_Get_Thumbnail start");
   PTPParams *params = (PTPParams *) device->params;
   uint16_t ret;
 
+  PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
+
+  int oldtimeout;
+
+  get_usb_device_timeout(ptp_usb, &oldtimeout);
+  set_usb_device_timeout(ptp_usb, 3000);
+
+  LIBMTP_INFO("priv set timeout value : %d, now, set timeout value to 3 sec", oldtimeout);
+
   ret = ptp_getthumb(params, id, data, size);
-  if (ret == PTP_RC_OK)
-      return 0;
-  return -1;
+  if (ret != PTP_RC_OK) {
+      LIBMTP_INFO("ptp_getthumb failed : %d", ret);
+      set_usb_device_timeout(ptp_usb, oldtimeout);
+      return -1;
+  }
+
+  set_usb_device_timeout(ptp_usb, oldtimeout);
+  LIBMTP_INFO("LIBMTP_Get_Thumbnail end");
+  return 0;
 }
 
 #ifdef TIZEN_EXT
 int LIBMTP_Get_Thumbnail_From_Exif_Data(LIBMTP_mtpdevice_t *device, uint32_t const id,
                          unsigned char **data, unsigned int *size)
 {
+  LIBMTP_INFO("LIBMTP_Get_Thumbnail_From_Exif_Data start");
   PTPParams *params = (PTPParams *) device->params;
   uint16_t ret;