PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
PTPObject *ob;
+ int oldtimeout;
+
+ get_usb_device_timeout(ptp_usb, &oldtimeout);
+ set_usb_device_timeout(ptp_usb, 5000);
+
+ LIBMTP_INFO("priv set timeout value : %d, now, set timeout value to 5 sec", oldtimeout);
+
ret = ptp_object_want (params, id, PTPOBJECT_OBJECTINFO_LOADED, &ob);
if (ret != PTP_RC_OK) {
add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Could not get object info.");
+ set_usb_device_timeout(ptp_usb, oldtimeout);
return -1;
}
if (ob->oi.ObjectFormat == PTP_OFC_Association) {
add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Bad object format.");
+ set_usb_device_timeout(ptp_usb, oldtimeout);
return -1;
}
ptp_usb->current_transfer_callback = NULL;
ptp_usb->current_transfer_callback_data = NULL;
+ set_usb_device_timeout(ptp_usb, oldtimeout);
+
if (ret == PTP_ERROR_CANCEL) {
add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Get_File_From_File_Descriptor(): Cancelled transfer.");
return -1;