"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "camlibs/ptp2/library.c" between
libgphoto2-2.5.26.tar.bz2 and libgphoto2-2.5.27.tar.bz2

About: libgphoto2 is a library that can be used by applications to access various digital cameras.

library.c  (libgphoto2-2.5.26.tar.bz2):library.c  (libgphoto2-2.5.27.tar.bz2)
/* library.c /* library.c
* *
* Copyright (C) 2001-2005 Mariusz Woloszyn <emsi@ipartners.pl> * Copyright (C) 2001-2005 Mariusz Woloszyn <emsi@ipartners.pl>
* Copyright (C) 2003-2020 Marcus Meissner <marcus@jet.franken.de> * Copyright (C) 2003-2021 Marcus Meissner <marcus@jet.franken.de>
* Copyright (C) 2005 Hubert Figuiere <hfiguiere@teaser.fr> * Copyright (C) 2005 Hubert Figuiere <hfiguiere@teaser.fr>
* Copyright (C) 2009 Axel Waggershauser <awagger@web.de> * Copyright (C) 2009 Axel Waggershauser <awagger@web.de>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the * License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#define _DARWIN_C_SOURCE
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
#if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H) #if defined(HAVE_ICONV) && defined(HAVE_LANGINFO_H)
#include <langinfo.h> #include <langinfo.h>
skipping to change at line 66 skipping to change at line 67
# define _(String) (String) # define _(String) (String)
# define N_(String) (String) # define N_(String) (String)
#endif #endif
#include "ptp.h" #include "ptp.h"
#include "ptp-bugs.h" #include "ptp-bugs.h"
#include "ptp-private.h" #include "ptp-private.h"
#include "ptp-pack.c" #include "ptp-pack.c"
#include "olympus-wrap.h" #include "olympus-wrap.h"
#ifdef HAVE_LIBWS232
#include <winsock2.h>
#endif
#define USB_START_TIMEOUT 8000 #define USB_START_TIMEOUT 8000
#define USB_CANON_START_TIMEOUT 1500 /* 1.5 seconds (0.5 was too low) */ #define USB_CANON_START_TIMEOUT 1500 /* 1.5 seconds (0.5 was too low) */
#define USB_NORMAL_TIMEOUT 20000 #define USB_NORMAL_TIMEOUT 20000
static int normal_timeout = USB_NORMAL_TIMEOUT; static int normal_timeout = USB_NORMAL_TIMEOUT;
#define USB_TIMEOUT_CAPTURE 100000 #define USB_TIMEOUT_CAPTURE 100000
static int capture_timeout = USB_TIMEOUT_CAPTURE; static int capture_timeout = USB_TIMEOUT_CAPTURE;
#define SET_CONTEXT(camera, ctx) ((PTPData *) camera->pl->params.data)->c ontext = ctx #define SET_CONTEXT(camera, ctx) ((PTPData *) camera->pl->params.data)->c ontext = ctx
#define SET_CONTEXT_P(p, ctx) ((PTPData *) p->data)->context = ctx #define SET_CONTEXT_P(p, ctx) ((PTPData *) p->data)->context = ctx
skipping to change at line 243 skipping to change at line 248
/* Changes the ptp deviceinfo with additional hidden information available, /* Changes the ptp deviceinfo with additional hidden information available,
* or stuff that requires special tricks * or stuff that requires special tricks
*/ */
int int
fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) { fixup_cached_deviceinfo (Camera *camera, PTPDeviceInfo *di) {
CameraAbilities a; CameraAbilities a;
PTPParams *params = &camera->pl->params; PTPParams *params = &camera->pl->params;
gp_camera_get_abilities(camera, &a); gp_camera_get_abilities(camera, &a);
/* Panasonic GH5 */ /* Panasonic GH5, GC9 */
if ( (di->VendorExtensionID == PTP_VENDOR_PANASONIC) && if ( (di->VendorExtensionID == PTP_VENDOR_PANASONIC) &&
(camera->port->type == GP_PORT_USB) && (camera->port->type == GP_PORT_USB) &&
(a.usb_product == 0x2382) (a.usb_product == 0x2382)
) { ) {
C_MEM (di->OperationsSupported = realloc(di->OperationsSupported, sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 6))); C_MEM (di->OperationsSupported = realloc(di->OperationsSupported, sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 9)));
di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_P ANASONIC_GetProperty; di->OperationsSupported[di->OperationsSupported_len+0] = PTP_OC_P ANASONIC_GetProperty;
di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_ PANASONIC_SetProperty; di->OperationsSupported[di->OperationsSupported_len+1] = PTP_OC_ PANASONIC_SetProperty;
di->OperationsSupported[di->OperationsSupported_len+2] = PTP_OC_ PANASONIC_ListProperty; di->OperationsSupported[di->OperationsSupported_len+2] = PTP_OC_ PANASONIC_ListProperty;
di->OperationsSupported[di->OperationsSupported_len+3] = PTP_OC_ PANASONIC_InitiateCapture; di->OperationsSupported[di->OperationsSupported_len+3] = PTP_OC_ PANASONIC_InitiateCapture;
di->OperationsSupported[di->OperationsSupported_len+4] = PTP_OC_ PANASONIC_Liveview; di->OperationsSupported[di->OperationsSupported_len+4] = PTP_OC_ PANASONIC_Liveview;
di->OperationsSupported[di->OperationsSupported_len+5] = PTP_OC_ PANASONIC_LiveviewImage; di->OperationsSupported[di->OperationsSupported_len+5] = PTP_OC_ PANASONIC_LiveviewImage;
di->OperationsSupported_len += 6; di->OperationsSupported[di->OperationsSupported_len+6] = PTP_OC_
PANASONIC_MovieRecControl;
di->OperationsSupported[di->OperationsSupported_len+7] = PTP_OC_
PANASONIC_GetLiveViewParameters;
di->OperationsSupported[di->OperationsSupported_len+8] = PTP_OC_
PANASONIC_SetLiveViewParameters;
di->OperationsSupported_len += 9;
} }
/* Panasonic hack */ /* Panasonic hack */
if ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) && if ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) &&
(camera->port->type == GP_PORT_USB) && (camera->port->type == GP_PORT_USB) &&
(a.usb_vendor == 0x04da) (a.usb_vendor == 0x04da)
) { ) {
PTPPropertyValue propval; PTPPropertyValue propval;
/* Panasonic changes its device info if the MTP Initiator /* Panasonic changes its device info if the MTP Initiator
* is set, and e.g. adds DeleteObject. * is set, and e.g. adds DeleteObject.
skipping to change at line 309 skipping to change at line 317
/* dup the strings */ /* dup the strings */
if (outerdi->VendorExtensionDesc) C_MEM (newdi.VendorExtens ionDesc = strdup (outerdi->VendorExtensionDesc)); if (outerdi->VendorExtensionDesc) C_MEM (newdi.VendorExtens ionDesc = strdup (outerdi->VendorExtensionDesc));
if (outerdi->Manufacturer) C_MEM (newdi.Manufacturer = strdup (outerdi->Manufacturer)); if (outerdi->Manufacturer) C_MEM (newdi.Manufacturer = strdup (outerdi->Manufacturer));
if (outerdi->Model) C_MEM (newdi.Model = strd up (outerdi->Model)); if (outerdi->Model) C_MEM (newdi.Model = strd up (outerdi->Model));
if (outerdi->DeviceVersion) C_MEM (newdi.DeviceVersio n = strdup (outerdi->DeviceVersion)); if (outerdi->DeviceVersion) C_MEM (newdi.DeviceVersio n = strdup (outerdi->DeviceVersion));
if (outerdi->SerialNumber) C_MEM (newdi.SerialNumber = strdup (outerdi->SerialNumber)); if (outerdi->SerialNumber) C_MEM (newdi.SerialNumber = strdup (outerdi->SerialNumber));
/* Dup and merge the lists */ /* Dup and merge the lists */
#define DI_MERGE(x) \ #define DI_MERGE(x) \
C_MEM (newdi.x = malloc(sizeof(outerdi->x[0])*(ndi.x##_len + oute rdi->x##_len)));\ C_MEM (newdi.x = calloc(sizeof(outerdi->x[0]),(ndi.x##_len + oute rdi->x##_len)));\
for (i = 0; i < outerdi->x##_len ; i++) \ for (i = 0; i < outerdi->x##_len ; i++) \
newdi.x[i] = outerdi->x[i]; \ newdi.x[i] = outerdi->x[i]; \
for (i = 0; i < ndi.x##_len ; i++) \ for (i = 0; i < ndi.x##_len ; i++) \
newdi.x[i+outerdi->x##_len] = ndi.x[i]; \ newdi.x[i+outerdi->x##_len] = ndi.x[i]; \
newdi.x##_len = ndi.x##_len + outerdi->x##_len; newdi.x##_len = ndi.x##_len + outerdi->x##_len;
DI_MERGE(OperationsSupported); DI_MERGE(OperationsSupported);
DI_MERGE(EventsSupported); DI_MERGE(EventsSupported);
DI_MERGE(DevicePropertiesSupported); DI_MERGE(DevicePropertiesSupported);
DI_MERGE(CaptureFormats); DI_MERGE(CaptureFormats);
skipping to change at line 356 skipping to change at line 364
if (strstr (di->Manufacturer,"Canon")) if (strstr (di->Manufacturer,"Canon"))
di->VendorExtensionID = PTP_VENDOR_CANON; di->VendorExtensionID = PTP_VENDOR_CANON;
if (strstr (di->Manufacturer,"Nikon")) if (strstr (di->Manufacturer,"Nikon"))
di->VendorExtensionID = PTP_VENDOR_NIKON; di->VendorExtensionID = PTP_VENDOR_NIKON;
} }
/* Newer Canons say that they are MTP devices. Restore Canon vendor extid . */ /* Newer Canons say that they are MTP devices. Restore Canon vendor extid . */
if ( ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) || if ( ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) ||
(di->VendorExtensionID == PTP_VENDOR_MTP) (di->VendorExtensionID == PTP_VENDOR_MTP)
) && ) &&
(camera->port->type == GP_PORT_USB) && ( (camera->port->type == GP_PORT_USB) ||
(camera->port->type == GP_PORT_PTPIP)
) &&
(a.usb_vendor == 0x4a9) (a.usb_vendor == 0x4a9)
) { ) {
/*camera->pl->bugs |= PTP_MTP;*/ /*camera->pl->bugs |= PTP_MTP;*/
di->VendorExtensionID = PTP_VENDOR_CANON; di->VendorExtensionID = PTP_VENDOR_CANON;
} }
/* Newer Nikons (D40) say that they are MTP devices. Restore Nikon vendor extid. */ /* Newer Nikons (D40) say that they are MTP devices. Restore Nikon vendor extid. */
if ( ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) || if ( ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) ||
(di->VendorExtensionID == PTP_VENDOR_MTP) (di->VendorExtensionID == PTP_VENDOR_MTP)
) && ) &&
(camera->port->type == GP_PORT_USB) && ( (camera->port->type == GP_PORT_USB) ||
(camera->port->type == GP_PORT_PTPIP)
) &&
(a.usb_vendor == 0x4b0) (a.usb_vendor == 0x4b0)
) { ) {
/*camera->pl->bugs |= PTP_MTP;*/ /*camera->pl->bugs |= PTP_MTP;*/
di->VendorExtensionID = PTP_VENDOR_NIKON; di->VendorExtensionID = PTP_VENDOR_NIKON;
} }
/* Fuji S5 Pro mostly, make its vendor set available. */ /* Fuji S5 Pro mostly, make its vendor set available. */
if ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) && if ( (di->VendorExtensionID == PTP_VENDOR_MICROSOFT) &&
(camera->port->type == GP_PORT_USB) && (camera->port->type == GP_PORT_USB) &&
(a.usb_vendor == 0x4cb) && (a.usb_vendor == 0x4cb) &&
skipping to change at line 509 skipping to change at line 521
ptp_operation_issupported(&camera->pl->params, P TP_OC_NIKON_StartLiveView) ptp_operation_issupported(&camera->pl->params, P TP_OC_NIKON_StartLiveView)
) { ) {
di->OperationsSupported[di->OperationsSupported_l en+0] = PTP_OC_NIKON_InitiateCaptureRecInMedia; di->OperationsSupported[di->OperationsSupported_l en+0] = PTP_OC_NIKON_InitiateCaptureRecInMedia;
di->OperationsSupported_len++; di->OperationsSupported_len++;
} }
if (ptp_operation_issupported(&camera->pl->params, PTP_OC _NIKON_InitiateCaptureRecInMedia)) { if (ptp_operation_issupported(&camera->pl->params, PTP_OC _NIKON_InitiateCaptureRecInMedia)) {
di->OperationsSupported[di->OperationsSupported_l en+0] = PTP_OC_NIKON_GetVendorPropCodes; di->OperationsSupported[di->OperationsSupported_l en+0] = PTP_OC_NIKON_GetVendorPropCodes;
di->OperationsSupported_len++; di->OperationsSupported_len++;
} }
di->OperationsSupported[di->OperationsSupported_len+0] = if (strcmp(params->deviceinfo.Model,"V1")) { /* the Nikon
PTP_OC_NIKON_ChangeCameraMode; V1 does not like it */
di->OperationsSupported_len++; di->OperationsSupported[di->OperationsSupported_l
en+0] = PTP_OC_NIKON_ChangeCameraMode;
di->OperationsSupported_len++;
} else {
/* on V1 even the 90c7 getevents does not work ht
tps://github.com/gphoto/libgphoto2/issues/569 */
for (i=0;i<di->OperationsSupported_len;i++) {
if (di->OperationsSupported[i] == PTP_OC_
NIKON_GetEvent) {
GP_LOG_D("On Nikon V1: disable NI
KON_GetEvent as its unreliable");
di->OperationsSupported[i] = PTP_
OC_GetDeviceInfo; /* overwrite */
}
if (di->OperationsSupported[i] == PTP_OC_
NIKON_InitiateCaptureRecInSdram) {
GP_LOG_D("On Nikon V1: disable NI
KON_InitiateCaptureRecInSdram as its unreliable");
di->OperationsSupported[i] = PTP_
OC_InitiateCapture; /* overwrite */
}
}
}
} }
if (params->deviceinfo.Model && !strcmp(params->deviceinfo.Model, "COOLPIX A")) { if (params->deviceinfo.Model && !strcmp(params->deviceinfo.Model, "COOLPIX A")) {
/* The A also hides some commands from us ... */ /* The A also hides some commands from us ... */
if (!ptp_operation_issupported(&camera->pl->params, PTP_O C_NIKON_GetVendorPropCodes)) { if (!ptp_operation_issupported(&camera->pl->params, PTP_O C_NIKON_GetVendorPropCodes)) {
C_MEM (di->OperationsSupported = realloc(di->Oper ationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 10))); C_MEM (di->OperationsSupported = realloc(di->Oper ationsSupported,sizeof(di->OperationsSupported[0])*(di->OperationsSupported_len + 10)));
di->OperationsSupported[di->OperationsSupported_l en+0] = PTP_OC_NIKON_GetVendorPropCodes; di->OperationsSupported[di->OperationsSupported_l en+0] = PTP_OC_NIKON_GetVendorPropCodes;
di->OperationsSupported[di->OperationsSupported_l en+1] = PTP_OC_NIKON_GetEvent; di->OperationsSupported[di->OperationsSupported_l en+1] = PTP_OC_NIKON_GetEvent;
di->OperationsSupported[di->OperationsSupported_l en+2] = PTP_OC_NIKON_AfDrive; di->OperationsSupported[di->OperationsSupported_l en+2] = PTP_OC_NIKON_AfDrive;
di->OperationsSupported[di->OperationsSupported_l en+3] = PTP_OC_NIKON_ChangeCameraMode; di->OperationsSupported[di->OperationsSupported_l en+3] = PTP_OC_NIKON_ChangeCameraMode;
di->OperationsSupported[di->OperationsSupported_l en+4] = PTP_OC_NIKON_DeviceReady; di->OperationsSupported[di->OperationsSupported_l en+4] = PTP_OC_NIKON_DeviceReady;
skipping to change at line 792 skipping to change at line 818
int tries; int tries;
/* wait either 1 second, or 50 tries */ /* wait either 1 second, or 50 tries */
if (waitms) if (waitms)
tries=timeout/waitms; tries=timeout/waitms;
else else
tries=50; tries=50;
do { do {
res = ptp_nikon_device_ready(params); res = ptp_nikon_device_ready(params);
if (res != PTP_RC_DeviceBusy) { if ( (res != PTP_RC_DeviceBusy) &&
(res != PTP_RC_NIKON_Bulb_Release_Busy)
) {
if (res == PTP_RC_NIKON_Silent_Release_Busy) /* seems to mean something like "not relevant" ... will repeat forever */ if (res == PTP_RC_NIKON_Silent_Release_Busy) /* seems to mean something like "not relevant" ... will repeat forever */
return PTP_RC_OK; return PTP_RC_OK;
return res; return res;
} }
if (waitms) usleep(waitms*1000)/*wait a bit*/; if (waitms) usleep(waitms*1000)/*wait a bit*/;
} while (tries--); } while (tries--);
return res; return res;
} }
static struct { static struct {
skipping to change at line 1281 skipping to change at line 1309
/* orbital sailor <gamerdude1080@hotmail.com> */ /* orbital sailor <gamerdude1080@hotmail.com> */
{"Sony:ILCE-6400 (PC Control)", 0x054c, 0x0caa, PTP_CAP|PTP_CAP_P REVIEW}, {"Sony:ILCE-6400 (PC Control)", 0x054c, 0x0caa, PTP_CAP|PTP_CAP_P REVIEW},
/* Elias Asikainen <elias.asikainen@sulzerschmid.ch> */ /* Elias Asikainen <elias.asikainen@sulzerschmid.ch> */
{"Sony:DSC-RX100M7 (PC Control)", 0x054c, 0x0cae, PTP_CAP|PTP_CAP_P REVIEW}, {"Sony:DSC-RX100M7 (PC Control)", 0x054c, 0x0cae, PTP_CAP|PTP_CAP_P REVIEW},
/* Mikael Ståldal <mikael@staldal.nu> */ /* Mikael Ståldal <mikael@staldal.nu> */
{"Sony:DSC-RX100M5A (MTP)", 0x054c, 0x0cb1, 0}, {"Sony:DSC-RX100M5A (MTP)", 0x054c, 0x0cb1, 0},
{"Sony:DSC-RX100M5A (PC Control)", 0x054c, 0x0cb2, PTP_CAP|PTP_CAP_P REVIEW}, {"Sony:DSC-RX100M5A (PC Control)", 0x054c, 0x0cb2, PTP_CAP|PTP_CAP_P REVIEW},
/* Elijah Parker, mail@timelapseplus.com */ /* Elijah Parker, mail@timelapseplus.com */
{"Sony:DSC-A7r IV (Control)", 0x054c, 0x0ccc, PTP_CAP|PTP_CAP_P REVIEW}, {"Sony:DSC-A7r IV (Control)", 0x054c, 0x0ccc, PTP_CAP|PTP_CAP_P REVIEW},
{"Sony:DSC-A7S III (Control)", 0x054c, 0x0d18, PTP_CAP|PTP_CAP_P REVIEW},
/* Nikon Coolpix 2500: M. Meissner, 05 Oct 2003 */ /* Nikon Coolpix 2500: M. Meissner, 05 Oct 2003 */
{"Nikon:Coolpix 2500 (PTP mode)", 0x04b0, 0x0109, 0}, {"Nikon:Coolpix 2500 (PTP mode)", 0x04b0, 0x0109, 0},
/* Nikon Coolpix 5700: A. Tanenbaum, 29 Oct 2002 */ /* Nikon Coolpix 5700: A. Tanenbaum, 29 Oct 2002 */
/* no capture complete: https://sourceforge.net/tracker/index.php?func=de tail&aid=3018517&group_id=8874&atid=108874 */ /* no capture complete: https://sourceforge.net/tracker/index.php?func=de tail&aid=3018517&group_id=8874&atid=108874 */
{"Nikon:Coolpix 5700 (PTP mode)", 0x04b0, 0x010d, PTP_CAP|PTP_NO_CAPTURE_ COMPLETE}, {"Nikon:Coolpix 5700 (PTP mode)", 0x04b0, 0x010d, PTP_CAP|PTP_NO_CAPTURE_ COMPLETE},
/* Nikon Coolpix 4500: T. Kaproncai, 22 Aug 2003 */ /* Nikon Coolpix 4500: T. Kaproncai, 22 Aug 2003 */
{"Nikon:Coolpix 4500 (PTP mode)", 0x04b0, 0x010b, 0}, {"Nikon:Coolpix 4500 (PTP mode)", 0x04b0, 0x010b, 0},
/* Nikon Coolpix 4300: Marco Rodriguez, 10 dic 2002 */ /* Nikon Coolpix 4300: Marco Rodriguez, 10 dic 2002 */
{"Nikon:Coolpix 4300 (PTP mode)", 0x04b0, 0x010f, 0}, {"Nikon:Coolpix 4300 (PTP mode)", 0x04b0, 0x010f, 0},
skipping to change at line 1465 skipping to change at line 1494
{"Nikon:Coolpix P7800 (PTP mode)", 0x04b0, 0x0229, 0}, {"Nikon:Coolpix P7800 (PTP mode)", 0x04b0, 0x0229, 0},
/* t.ludewig@gmail.com */ /* t.ludewig@gmail.com */
/* Also reports 0x400d aka CaptureComplete event ... but has no /* Also reports 0x400d aka CaptureComplete event ... but has no
* vendor commands? yeah right... */ * vendor commands? yeah right... */
{"Nikon:Coolpix P520 (PTP mode)", 0x04b0, 0x0228, 0}, /* PTP_CAP */ {"Nikon:Coolpix P520 (PTP mode)", 0x04b0, 0x0228, 0}, /* PTP_CAP */
/* checamon <checamon@gmail.com> */ /* checamon <checamon@gmail.com> */
{"Nikon:Coolpix B700 (PTP mode)", 0x04b0, 0x0231, PTP_CAP|PTP_CAP_PREVIEW }, {"Nikon:Coolpix B700 (PTP mode)", 0x04b0, 0x0231, PTP_CAP|PTP_CAP_PREVIEW },
/* https://github.com/gphoto/libgphoto2/issues/477 */
{"Nikon:Coolpix P1000 (PTP mode)",0x04b0, 0x0232, PTP_CAP/*|PTP_CAP_PREVI
EW*/},
/* Nikon Coolpix 2000 */ /* Nikon Coolpix 2000 */
{"Nikon:Coolpix 2000 (PTP mode)", 0x04b0, 0x0302, 0}, {"Nikon:Coolpix 2000 (PTP mode)", 0x04b0, 0x0302, 0},
/* From IRC reporter. */ /* From IRC reporter. */
{"Nikon:Coolpix L4 (PTP mode)", 0x04b0, 0x0305, 0}, {"Nikon:Coolpix L4 (PTP mode)", 0x04b0, 0x0305, 0},
/* from Magnus Larsson */ /* from Magnus Larsson */
{"Nikon:Coolpix L11 (PTP mode)", 0x04b0, 0x0309, 0}, {"Nikon:Coolpix L11 (PTP mode)", 0x04b0, 0x0309, 0},
/* From IRC reporter. */ /* From IRC reporter. */
{"Nikon:Coolpix L10 (PTP mode)", 0x04b0, 0x030b, 0}, {"Nikon:Coolpix L10 (PTP mode)", 0x04b0, 0x030b, 0},
/* Philippe ENTZMANN <philippe@phec.net> */ /* Philippe ENTZMANN <philippe@phec.net> */
{"Nikon:Coolpix P60 (PTP mode)", 0x04b0, 0x0311, PTP_CAP|PTP_NIKON_BROKE N_CAP}, {"Nikon:Coolpix P60 (PTP mode)", 0x04b0, 0x0311, PTP_CAP|PTP_NIKON_BROKE N_CAP},
skipping to change at line 1679 skipping to change at line 1711
/* Schreiber, Steve via Gphoto-devel */ /* Schreiber, Steve via Gphoto-devel */
{"Nikon:DSC D3500", 0x04b0, 0x0445, PTP_CAP|PTP_CAP_PREVIEW }, {"Nikon:DSC D3500", 0x04b0, 0x0445, PTP_CAP|PTP_CAP_PREVIEW },
/* timelapse-VIEW */ /* timelapse-VIEW */
{"Nikon:DSC D780", 0x04b0, 0x0446, PTP_CAP|PTP_CAP_PREVIEW }, {"Nikon:DSC D780", 0x04b0, 0x0446, PTP_CAP|PTP_CAP_PREVIEW },
/* Thomas Schaad */ /* Thomas Schaad */
{"Nikon:Z5", 0x04b0, 0x0448, PTP_CAP|PTP_CAP_PREVIEW }, {"Nikon:Z5", 0x04b0, 0x0448, PTP_CAP|PTP_CAP_PREVIEW },
/* Fahrion <fahrion.2600@gmail.com> */
{"Nikon:Z7_2", 0x04b0, 0x044b, PTP_CAP|PTP_CAP_PREVIEW
},
/* Thomas Schaad <tom@avisec.ch> */
{"Nikon:Z6_2", 0x04b0, 0x044c, PTP_CAP|PTP_CAP_PREVIEW
},
/* http://sourceforge.net/tracker/?func=detail&aid=3536904&group_id=8874& atid=108874 */ /* http://sourceforge.net/tracker/?func=detail&aid=3536904&group_id=8874& atid=108874 */
/* https://github.com/gphoto/libgphoto2/issues/569 */
{"Nikon:V1", 0x04b0, 0x0601, PTP_CAP|PTP_NIKON_1}, {"Nikon:V1", 0x04b0, 0x0601, PTP_CAP|PTP_NIKON_1},
/* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=3556403&g roup_id=8874 */ /* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=3556403&g roup_id=8874 */
{"Nikon:J1", 0x04b0, 0x0602, PTP_CAP|PTP_NIKON_1}, {"Nikon:J1", 0x04b0, 0x0602, PTP_CAP|PTP_NIKON_1},
/* https://bugzilla.novell.com/show_bug.cgi?id=814622 Martin Caj at SUSE */ /* https://bugzilla.novell.com/show_bug.cgi?id=814622 Martin Caj at SUSE */
{"Nikon:J2", 0x04b0, 0x0603, PTP_CAP|PTP_NIKON_1}, {"Nikon:J2", 0x04b0, 0x0603, PTP_CAP|PTP_NIKON_1},
/* https://sourceforge.net/p/gphoto/feature-requests/432/ */ /* https://sourceforge.net/p/gphoto/feature-requests/432/ */
{"Nikon:V2", 0x04b0, 0x0604, PTP_CAP|PTP_NIKON_1}, {"Nikon:V2", 0x04b0, 0x0604, PTP_CAP|PTP_NIKON_1},
/* Ralph Schindler <ralph@ralphschindler.com> */ /* Ralph Schindler <ralph@ralphschindler.com> */
{"Nikon:J3", 0x04b0, 0x0605, PTP_CAP|PTP_NIKON_1}, {"Nikon:J3", 0x04b0, 0x0605, PTP_CAP|PTP_NIKON_1},
/* Markus Karlhuber <markus.karlhuber@gmail.com> */ /* Markus Karlhuber <markus.karlhuber@gmail.com> */
skipping to change at line 1787 skipping to change at line 1826
{"Olympus:SP-720UZ", 0x07b4, 0x012f, 0}, {"Olympus:SP-720UZ", 0x07b4, 0x012f, 0},
{"Olympus:E-PL5", 0x07b4, 0x012f, 0}, {"Olympus:E-PL5", 0x07b4, 0x012f, 0},
/* Rafał Bryndza <abigor82@gmail.com> */ /* Rafał Bryndza <abigor82@gmail.com> */
{"Olympus:E-M5", 0x07b4, 0x012f, 0}, {"Olympus:E-M5", 0x07b4, 0x012f, 0},
/* Richard Wonka <richard.wonka@gmail.com> */ /* Richard Wonka <richard.wonka@gmail.com> */
{"Olympus:E-M5 Mark II", 0x07b4, 0x0130, PTP_CAP|PTP_CAP_PREVIEW }, {"Olympus:E-M5 Mark II", 0x07b4, 0x0130, PTP_CAP|PTP_CAP_PREVIEW },
/* same id also on E-M1 */ /* same id also on E-M1 */
{"Olympus:E-M1 Mark II", 0x07b4, 0x0130, PTP_CAP|PTP_CAP_PREVIEW }, {"Olympus:E-M1 Mark II", 0x07b4, 0x0130, PTP_CAP|PTP_CAP_PREVIEW },
{"Olympus:E-M1", 0x07b4, 0x0130, PTP_CAP|PTP_CAP_PREVIEW }, {"Olympus:E-M1", 0x07b4, 0x0130, PTP_CAP|PTP_CAP_PREVIEW },
/* from timelapse-VIEW */
{"Olympus:E-M1 MII", 0x07b4, 0x0135, PTP_CAP|PTP_CAP_PREVIEW
},
/* IRC report */ /* IRC report */
{"Casio:EX-Z120", 0x07cf, 0x1042, 0}, {"Casio:EX-Z120", 0x07cf, 0x1042, 0},
/* Andrej Semen (at suse) */ /* Andrej Semen (at suse) */
{"Casio:EX-S770", 0x07cf, 0x1049, 0}, {"Casio:EX-S770", 0x07cf, 0x1049, 0},
/* https://launchpad.net/bugs/64146 */ /* https://launchpad.net/bugs/64146 */
{"Casio:EX-Z700", 0x07cf, 0x104c, 0}, {"Casio:EX-Z700", 0x07cf, 0x104c, 0},
/* IRC Reporter */ /* IRC Reporter */
{"Casio:EX-Z65", 0x07cf, 0x104d, 0}, {"Casio:EX-Z65", 0x07cf, 0x104d, 0},
/* Juan Carlos Bretal Fernandez <juanc.bretal@gmail.com> */ /* Juan Carlos Bretal Fernandez <juanc.bretal@gmail.com> */
skipping to change at line 2099 skipping to change at line 2141
{"Canon:PowerShot A3100 IS", 0x04a9, 0x31f1, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:PowerShot A3100 IS", 0x04a9, 0x31f1, PTPBUG_DELETE_SEN DS_EVENT},
{"Canon:PowerShot A3000 IS", 0x04a9, 0x31f2, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:PowerShot A3000 IS", 0x04a9, 0x31f2, PTPBUG_DELETE_SEN DS_EVENT},
{"Canon:Digital IXUS 130", 0x04a9, 0x31f3, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:Digital IXUS 130", 0x04a9, 0x31f3, PTPBUG_DELETE_SEN DS_EVENT},
/* Mark Voorhies <mvoorhie@yahoo.com> */ /* Mark Voorhies <mvoorhie@yahoo.com> */
{"Canon:PowerShot SD1300 IS", 0x04a9, 0x31f4, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:PowerShot SD1300 IS", 0x04a9, 0x31f4, PTPBUG_DELETE_SEN DS_EVENT},
/* Juergen Weigert */ /* Juergen Weigert */
{"Canon:PowerShot SX210 IS", 0x04a9, 0x31f6, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:PowerShot SX210 IS", 0x04a9, 0x31f6, PTPBUG_DELETE_SEN DS_EVENT},
/* name correct? https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1296 275?comments=all */ /* name correct? https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1296 275?comments=all */
{"Canon:Digital IXUS 300 HS", 0x04a9, 0x31f7, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:Digital IXUS 300 HS", 0x04a9, 0x31f7, PTPBUG_DELETE_SEN DS_EVENT},
/* via email */
{"Canon:PowerShot G12", 0x04a9, 0x320f, PTPBUG_DELETE_SEN
DS_EVENT},
/* http://sourceforge.net/tracker/index.php?func=detail&aid=3153412&group _id=8874&atid=358874 */ /* http://sourceforge.net/tracker/index.php?func=detail&aid=3153412&group _id=8874&atid=358874 */
{"Canon:PowerShot SX130 IS", 0x04a9, 0x3211, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:PowerShot SX130 IS", 0x04a9, 0x3211, PTPBUG_DELETE_SEN DS_EVENT},
/* novell bugzilla 871944 */ /* novell bugzilla 871944 */
{"Canon:PowerShot S95", 0x04a9, 0x3212, PTPBUG_DELETE_SEN DS_EVENT}, {"Canon:PowerShot S95", 0x04a9, 0x3212, PTPBUG_DELETE_SEN DS_EVENT},
/* IRC Reporter */ /* IRC Reporter */
{"Canon:EOS 60D", 0x04a9, 0x3215, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:EOS 60D", 0x04a9, 0x3215, PTP_CAP|PTP_CAP_P REVIEW},
/* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=3312353&g roup_id=8874 */ /* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=3312353&g roup_id=8874 */
{"Canon:EOS 1100D", 0x04a9, 0x3217, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:EOS 1100D", 0x04a9, 0x3217, PTP_CAP|PTP_CAP_P REVIEW},
{"Canon:Rebel T3", 0x04a9, 0x3217, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:Rebel T3", 0x04a9, 0x3217, PTP_CAP|PTP_CAP_P REVIEW},
/* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=3310995&g roup_id=8874 */ /* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=3310995&g roup_id=8874 */
skipping to change at line 2373 skipping to change at line 2417
/* id from timelapse-view */ /* id from timelapse-view */
{"Canon:EOS 1D X MarkIII", 0x04a9, 0x32e8, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:EOS 1D X MarkIII", 0x04a9, 0x32e8, PTP_CAP|PTP_CAP_P REVIEW},
/* Roland Förg <roland.foerg@arcor.de> */ /* Roland Förg <roland.foerg@arcor.de> */
{"Canon:EOS 250D", 0x04a9, 0x32e9, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:EOS 250D", 0x04a9, 0x32e9, PTP_CAP|PTP_CAP_P REVIEW},
/* Matthias <matthias@mail-s.eu> */ /* Matthias <matthias@mail-s.eu> */
{"Canon:EOS 90D", 0x04a9, 0x32ea, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:EOS 90D", 0x04a9, 0x32ea, PTP_CAP|PTP_CAP_P REVIEW},
/* https://github.com/gphoto/gphoto2/issues/347 */ /* https://github.com/gphoto/gphoto2/issues/347 */
{"Canon:PowerShot SX70 HS", 0x04a9, 0x32ee, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:PowerShot SX70 HS", 0x04a9, 0x32ee, PTP_CAP|PTP_CAP_P REVIEW},
/* https://github.com/gphoto/libgphoto2/issues/614 */
{"Canon:EOS M200", 0x04a9, 0x32ef, PTP_CAP|PTP_CAP_P
REVIEW},
/* from timelapse-view */ /* from timelapse-view */
{"Canon:EOS R5", 0x04a9, 0x32f4, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:EOS R5", 0x04a9, 0x32f4, PTP_CAP|PTP_CAP_P REVIEW},
/* Steve Rencontre <steve@rsn-tech.co.uk> */ /* Steve Rencontre <steve@rsn-tech.co.uk> */
{"Canon:EOS R6", 0x04a9, 0x32f5, PTP_CAP|PTP_CAP_P REVIEW}, {"Canon:EOS R6", 0x04a9, 0x32f5, PTP_CAP|PTP_CAP_P REVIEW},
/* Konica-Minolta PTP cameras */ /* Konica-Minolta PTP cameras */
{"Konica-Minolta:DiMAGE A2 (PTP mode)", 0x132b, 0x0001, 0}, {"Konica-Minolta:DiMAGE A2 (PTP mode)", 0x132b, 0x0001, 0},
{"Konica-Minolta:DiMAGE Z2 (PictBridge mode)", 0x132b, 0x0007, 0}, {"Konica-Minolta:DiMAGE Z2 (PictBridge mode)", 0x132b, 0x0007, 0},
{"Konica-Minolta:DiMAGE X21 (PictBridge mode)",0x132b, 0x0009, 0}, {"Konica-Minolta:DiMAGE X21 (PictBridge mode)",0x132b, 0x0009, 0},
{"Konica-Minolta:DiMAGE Z3 (PictBridge mode)", 0x132b, 0x0018, 0}, {"Konica-Minolta:DiMAGE Z3 (PictBridge mode)", 0x132b, 0x0018, 0},
skipping to change at line 2478 skipping to change at line 2524
/* Steve Dahl <dahl@goshawk.com> */ /* Steve Dahl <dahl@goshawk.com> */
{"Fuji:FinePix S4850", 0x04cb, 0x0298, 0}, {"Fuji:FinePix S4850", 0x04cb, 0x0298, 0},
/* Larry D. DeMaris" <demarisld@gmail.com> */ /* Larry D. DeMaris" <demarisld@gmail.com> */
{"Fuji:FinePix SL1000", 0x04cb, 0x029c, 0}, {"Fuji:FinePix SL1000", 0x04cb, 0x029c, 0},
/* t.ludewig@gmail.com */ /* t.ludewig@gmail.com */
{"Fuji:FinePix X20", 0x04cb, 0x02a6, 0}, {"Fuji:FinePix X20", 0x04cb, 0x02a6, 0},
/* https://sourceforge.net/p/libmtp/bugs/1040/ */ /* https://sourceforge.net/p/libmtp/bugs/1040/ */
{"Fuji:Fujifilm X-E2", 0x04cb, 0x02b5, 0}, {"Fuji:Fujifilm X-E2", 0x04cb, 0x02b5, 0},
/* https://github.com/gphoto/libgphoto2/issues/283 */ /* https://github.com/gphoto/libgphoto2/issues/283 */
{"Fuji:Fujifilm X-M1", 0x04cb, 0x02b6, 0}, {"Fuji:Fujifilm X-M1", 0x04cb, 0x02b6, 0},
/* luigiwriter2@gmail.com */
{"Fuji:FinePix S8600 ", 0x04cb, 0x02b9, 0},
/* https://github.com/gphoto/libgphoto2/issues/281 */ /* https://github.com/gphoto/libgphoto2/issues/281 */
{"Fuji:Fujifilm X70", 0x04cb, 0x02ba, 0}, {"Fuji:Fujifilm X70", 0x04cb, 0x02ba, 0},
/* Vladimir K <enewsletters@inbox.ru>, https://github.com/gphoto/libgphot o2/issues/283 */ /* Vladimir K <enewsletters@inbox.ru>, https://github.com/gphoto/libgphot o2/issues/283 */
{"Fuji:Fujifilm X-T1", 0x04cb, 0x02bf, PTP_CAP|PTP_CAP_P REVIEW}, {"Fuji:Fujifilm X-T1", 0x04cb, 0x02bf, PTP_CAP|PTP_CAP_P REVIEW},
/* https://github.com/gphoto/libgphoto2/issues/281 */ /* https://github.com/gphoto/libgphoto2/issues/281 */
{"Fuji:Fujifilm X30", 0x04cb, 0x02c1, 0}, {"Fuji:Fujifilm X30", 0x04cb, 0x02c1, 0},
/* https://sourceforge.net/p/gphoto/feature-requests/464/ */ /* https://sourceforge.net/p/gphoto/feature-requests/464/ */
{"Fuji:Fujifilm X-A2", 0x04cb, 0x02c6, 0}, {"Fuji:Fujifilm X-A2", 0x04cb, 0x02c6, 0},
/* https://github.com/gphoto/libgphoto2/issues/32 */ /* https://github.com/gphoto/libgphoto2/issues/32 */
{"Fuji:Fujifilm X-T10", 0x04cb, 0x02c8, 0}, {"Fuji:Fujifilm X-T10", 0x04cb, 0x02c8, 0},
skipping to change at line 2516 skipping to change at line 2564
{"Fuji:GFX 50 R", 0x04cb, 0x02dc, PTP_CAP|PTP_CAP_P REVIEW}, {"Fuji:GFX 50 R", 0x04cb, 0x02dc, PTP_CAP|PTP_CAP_P REVIEW},
/* Stefan Weiberg at SUSE */ /* Stefan Weiberg at SUSE */
{"Fuji:Fujifilm X-T3", 0x04cb, 0x02dd, PTP_CAP|PTP_CAP_P REVIEW}, {"Fuji:Fujifilm X-T3", 0x04cb, 0x02dd, PTP_CAP|PTP_CAP_P REVIEW},
/* https://github.com/gphoto/gphoto2/issues/256 */ /* https://github.com/gphoto/gphoto2/issues/256 */
{"Fuji:Fujifilm GFX100", 0x04cb, 0x02de, PTP_CAP|PTP_CAP_P REVIEW}, {"Fuji:Fujifilm GFX100", 0x04cb, 0x02de, PTP_CAP|PTP_CAP_P REVIEW},
/* Bruno Filho at SUSE (currently not working with cpature, but shows var iables) */ /* Bruno Filho at SUSE (currently not working with cpature, but shows var iables) */
/* so far looks like the low end X-T30 does not support tethering, https: //www.dpreview.com/forums/thread/4451199 */ /* so far looks like the low end X-T30 does not support tethering, https: //www.dpreview.com/forums/thread/4451199 */
{"Fuji:Fujifilm X-T30", 0x04cb, 0x02e3, 0}, {"Fuji:Fujifilm X-T30", 0x04cb, 0x02e3, 0},
/* https://github.com/gphoto/libgphoto2/issues/505 */ /* https://github.com/gphoto/libgphoto2/issues/505 */
{"Fuji:Fujifilm X-T4", 0x04cb, 0x02e6, PTP_CAP|PTP_CAP_P REVIEW}, {"Fuji:Fujifilm X-T4", 0x04cb, 0x02e6, PTP_CAP|PTP_CAP_P REVIEW},
/* https://github.com/gphoto/libgphoto2/issues/603 */
{"Fuji:Fujifilm X-S10", 0x04cb, 0x02ea, PTP_CAP_PREVIEW},
/* only webcam mode apparently */
{"Ricoh:Caplio R5 (PTP mode)", 0x05ca, 0x0110, 0}, {"Ricoh:Caplio R5 (PTP mode)", 0x05ca, 0x0110, 0},
{"Ricoh:Caplio GX (PTP mode)", 0x05ca, 0x0325, 0}, {"Ricoh:Caplio GX (PTP mode)", 0x05ca, 0x0325, 0},
{"Sea & Sea:5000G (PTP mode)", 0x05ca, 0x0327, 0}, {"Sea & Sea:5000G (PTP mode)", 0x05ca, 0x0327, 0},
/* Michael Steinhauser <mistr@online.de> */ /* Michael Steinhauser <mistr@online.de> */
{"Ricoh Caplio:R1v (PTP mode)", 0x05ca, 0x032b, 0}, {"Ricoh Caplio:R1v (PTP mode)", 0x05ca, 0x032b, 0},
{"Ricoh:Caplio R3 (PTP mode)", 0x05ca, 0x032f, 0}, {"Ricoh:Caplio R3 (PTP mode)", 0x05ca, 0x032f, 0},
/* Arthur Butler <arthurbutler@otters.ndo.co.uk> */ /* Arthur Butler <arthurbutler@otters.ndo.co.uk> */
{"Ricoh:Caplio RR750 (PTP mode)", 0x05ca, 0x033d, 0}, {"Ricoh:Caplio RR750 (PTP mode)", 0x05ca, 0x033d, 0},
/* Gerald Pfeifer at SUSE */ /* Gerald Pfeifer at SUSE */
{"Sea & Sea:2G (PTP mode)", 0x05ca, 0x0353, 0}, {"Sea & Sea:2G (PTP mode)", 0x05ca, 0x0353, 0},
/* Marcus Meissner */ /* Marcus Meissner */
{"Ricoh:Theta m15 (PTP mode)", 0x05ca, 0x0365, 0}, {"Ricoh:Theta m15 (PTP mode)", 0x05ca, 0x0365, 0},
/* "Lacy Rhoades" <lacy@colordeaf.net> */ /* "Lacy Rhoades" <lacy@colordeaf.net> */
{"Ricoh:Theta S (PTP mode)", 0x05ca, 0x0366, 0}, {"Ricoh:Theta S (PTP mode)", 0x05ca, 0x0366, 0},
{"Ricoh:Theta SC (PTP mode)", 0x05ca, 0x0367, 0}, {"Ricoh:Theta SC (PTP mode)", 0x05ca, 0x0367, 0},
/* https://github.com/libmtp/libmtp/pull/68 */
{"Ricoh:Theta V (PTP mode)", 0x05ca, 0x0368, 0},
{"Ricoh:Theta Z1 (PTP mode)", 0x05ca, 0x036d, 0},
/* Rollei dr5 */ /* Rollei dr5 */
{"Rollei:dr5 (PTP mode)", 0x05ca, 0x220f, 0}, {"Rollei:dr5 (PTP mode)", 0x05ca, 0x220f, 0},
/* Ricoh Caplio GX 8 */ /* Ricoh Caplio GX 8 */
{"Ricoh:Caplio GX 8 (PTP mode)", 0x05ca, 0x032d, 0}, {"Ricoh:Caplio GX 8 (PTP mode)", 0x05ca, 0x032d, 0},
/* Arda Kaan <ardakaan@gmail.com> */ /* Arda Kaan <ardakaan@gmail.com> */
{"Ricoh:WG-M2 (PTP mode)", 0x25fb, 0x210b, 0}, {"Ricoh:WG-M2 (PTP mode)", 0x25fb, 0x210b, 0},
/* Pentax cameras */ /* Pentax cameras */
skipping to change at line 3054 skipping to change at line 3108
* For some unknown reason. */ * For some unknown reason. */
if (0 && (camera->port!=NULL) && (camera->port->type == GP_PORT_USB)) { if (0 && (camera->port!=NULL) && (camera->port->type == GP_PORT_USB)) {
/* clear halt */ /* clear halt */
gp_port_usb_clear_halt gp_port_usb_clear_halt
(camera->port, GP_PORT_USB_ENDPOINT_IN); (camera->port, GP_PORT_USB_ENDPOINT_IN);
gp_port_usb_clear_halt gp_port_usb_clear_halt
(camera->port, GP_PORT_USB_ENDPOINT_OUT); (camera->port, GP_PORT_USB_ENDPOINT_OUT);
gp_port_usb_clear_halt gp_port_usb_clear_halt
(camera->port, GP_PORT_USB_ENDPOINT_INT); (camera->port, GP_PORT_USB_ENDPOINT_INT);
} }
#if defined(HAVE_LIBWS232) && defined(WIN32)
else if ((camera->port!=NULL) && camera->port->type != GP_PORT_PTPIP) {
WSACleanup();
}
#endif
return (GP_OK); return (GP_OK);
} }
static int static int
camera_about (Camera *camera, CameraText *text, GPContext *context) camera_about (Camera *camera, CameraText *text, GPContext *context)
{ {
/* Note that we are not a so called 'Licensed Implementation' of MTP /* Note that we are not a so called 'Licensed Implementation' of MTP
* ... (for a LI you need express approval from Microsoft etc.) * ... (for a LI you need express approval from Microsoft etc.)
*/ */
snprintf (text->text, sizeof(text->text), snprintf (text->text, sizeof(text->text),
_("PTP2 driver\n" _("PTP2 driver\n"
"(c) 2001-2005 by Mariusz Woloszyn <emsi@ipartners.pl>.\n" "(c) 2001-2005 by Mariusz Woloszyn <emsi@ipartners.pl>.\n"
"(c) 2003-%d by Marcus Meissner <marcus@jet.franken.de>.\n" "(c) 2003-%d by Marcus Meissner <marcus@jet.franken.de>.\n"
"This driver supports cameras that support PTP or PictBridge(tm), and\ n" "This driver supports cameras that support PTP or PictBridge(tm), and\ n"
"Media Players that support the Media Transfer Protocol (MTP).\n" "Media Players that support the Media Transfer Protocol (MTP).\n"
"\n" "\n"
"Enjoy!"), 2020); "Enjoy!"), 2021);
return (GP_OK); return (GP_OK);
} }
static void debug_objectinfo(PTPParams *params, uint32_t oid, PTPObjectInfo *oi) ; static void debug_objectinfo(PTPParams *params, uint32_t oid, PTPObjectInfo *oi) ;
/* Add new object to internal driver structures. issued when creating /* Add new object to internal driver structures. issued when creating
* folder, uploading objects, or captured images. * folder, uploading objects, or captured images.
*/ */
static int static int
add_object (Camera *camera, uint32_t handle, GPContext *context) add_object (Camera *camera, uint32_t handle, GPContext *context)
skipping to change at line 3207 skipping to change at line 3266
SET_CONTEXT_P(params, NULL); SET_CONTEXT_P(params, NULL);
return GP_OK; return GP_OK;
} }
/* Canon EOS DSLR preview mode */ /* Canon EOS DSLR preview mode */
if (ptp_operation_issupported(params, PTP_OC_CANON_EOS_GetViewFin derData)) { if (ptp_operation_issupported(params, PTP_OC_CANON_EOS_GetViewFin derData)) {
PTPPropertyValue val; PTPPropertyValue val;
/* FIXME: this might cause a focusing pass and take secon ds. 20 was not /* FIXME: this might cause a focusing pass and take secon ds. 20 was not
* enough (would be 0.2 seconds, too short for the mirror up operation.). */ * enough (would be 0.2 seconds, too short for the mirror up operation.). */
/* The EOS 100D takes 1.2 seconds */ /* The EOS 100D takes 1.2 seconds */
PTPDevicePropDesc dpd; PTPDevicePropDesc dpd;
int back_off_wait = 0; int try = 0;
struct timeval event_start; struct timeval event_start;
SET_CONTEXT_P(params, context); SET_CONTEXT_P(params, context);
if (!params->eos_captureenabled) if (!params->eos_captureenabled)
camera_prepare_capture (camera, context); camera_prepare_capture (camera, context);
memset (&dpd,0,sizeof(dpd)); memset (&dpd,0,sizeof(dpd));
/* do not set it everytime, it will cause delays */ /* do not set it everytime, it will cause delays */
ret = ptp_canon_eos_getdevicepropdesc (params, PTP_DPC_CA NON_EOS_EVFMode, &dpd); ret = ptp_canon_eos_getdevicepropdesc (params, PTP_DPC_CA NON_EOS_EVFMode, &dpd);
skipping to change at line 3252 skipping to change at line 3311
params->inliveview = 1; params->inliveview = 1;
event_start = time_now(); event_start = time_now();
do { do {
unsigned char *xdata; unsigned char *xdata;
/* Poll for camera events, but just call /* Poll for camera events, but just call
* it once and do not drain the queue now */ * it once and do not drain the queue now */
C_PTP (ptp_check_eos_events (params)); C_PTP (ptp_check_eos_events (params));
ret = ptp_canon_eos_get_viewfinder_image (params , &data, &size); ret = ptp_canon_eos_get_viewfinder_image (params , &data, &size);
if ((ret == 0xa102) || (ret == PTP_RC_DeviceBusy) ) { /* means "not there yet" ... so wait */ if ((ret == 0xa102) || (ret == PTP_RC_DeviceBusy) ) { /* means "not there yet" ... so wait */
/* wait 3 seconds at most */ /* wait 3 seconds at most ... use a bit o
f backoff logic for cameras where we should not drain compute. */
usleep((++try)*5*1000);
if (time_since (event_start) < 3*1000)
continue;
/*
if (waiting_for_timeout (&back_off_wait, event_start, 3*1000)) if (waiting_for_timeout (&back_off_wait, event_start, 3*1000))
continue; continue;
*/
} }
C_PTP_MSG (ret, "get_viewfinder_image failed"); C_PTP_MSG (ret, "get_viewfinder_image failed");
/* returns multiple blobs, they are usually struc tured as /* returns multiple blobs, they are usually struc tured as
* uint32 len * uint32 len
* uint32 type * uint32 type
* ... data ... * ... data ...
* *
* 1: JPEG preview * 1: JPEG preview
*/ */
skipping to change at line 3502 skipping to change at line 3566
} }
ret = ptp_getobject_with_size(params, preview_object, &xi mage, &size); ret = ptp_getobject_with_size(params, preview_object, &xi mage, &size);
if (ret == PTP_RC_OK) if (ret == PTP_RC_OK)
break; break;
if (ret != PTP_RC_AccessDenied) /* we get those when we a re too fast */ if (ret != PTP_RC_AccessDenied) /* we get those when we a re too fast */
C_PTP (ret); C_PTP (ret);
usleep(20*1000); usleep(20*1000);
} while (tries--); } while (tries--);
jpgStartPtr = ximage;
/* There is an initial blob, and we had a case where 0xff 0xd8 wa
s in the initial blob
* https://github.com/gphoto/gphoto2/issues/389
* as the data starts with an apparent offset into the data to th
e JPEG, try to use that
*/
if (size > 4) {
unsigned int offset = ximage[0] | (ximage[1] << 8) | (xim
age[2] << 16) | (ximage[3] << 24);
if ((offset+1 < size) && (ximage[offset] == 0xff) && (xim
age[offset+1] == 0xd8))
jpgStartPtr = ximage + offset;
}
/* look for the JPEG SOI marker (0xFFD8) in data */ /* look for the JPEG SOI marker (0xFFD8) in data */
jpgStartPtr = (unsigned char*)memchr(ximage, 0xff, size); jpgStartPtr = (unsigned char*)memchr(jpgStartPtr, 0xff, size);
while(jpgStartPtr && ((jpgStartPtr+1) < (ximage + size))) { while(jpgStartPtr && ((jpgStartPtr+1) < (ximage + size))) {
if(*(jpgStartPtr + 1) == 0xd8) { /* SOI found */ if(*(jpgStartPtr + 1) == 0xd8) { /* SOI found */
break; break;
} else { /* go on looking (starting at next byte) */ } else { /* go on looking (starting at next byte) */
jpgStartPtr++; jpgStartPtr++;
jpgStartPtr = (unsigned char*)memchr(jpgStartPtr, 0xff, ximage + size - jpgStartPtr); jpgStartPtr = (unsigned char*)memchr(jpgStartPtr, 0xff, ximage + size - jpgStartPtr);
} }
} }
if(!jpgStartPtr) { /* no SOI -> no JPEG */ if(!jpgStartPtr) { /* no SOI -> no JPEG */
gp_context_error (context, _("Sorry, your Sony camera doe s not seem to return a JPEG image in LiveView mode")); gp_context_error (context, _("Sorry, your Sony camera doe s not seem to return a JPEG image in LiveView mode"));
skipping to change at line 3570 skipping to change at line 3645
gp_file_set_mtime (file, time(NULL)); gp_file_set_mtime (file, time(NULL));
SET_CONTEXT_P(params, NULL); SET_CONTEXT_P(params, NULL);
return GP_OK; return GP_OK;
} }
while (tries--) { while (tries--) {
ret = ptp_getobjectinfo (params, preview_object, &oi); ret = ptp_getobjectinfo (params, preview_object, &oi);
if (ret == PTP_RC_OK) break; if (ret == PTP_RC_OK) break;
if (ret == PTP_RC_InvalidObjectHandle) { if (ret == PTP_RC_InvalidObjectHandle) {
usleep(1000); /* 1000 x 10 tries was not enough for the S10 ...
make the wait a bit longer
* see https://github.com/gphoto/libgphoto2/issue
s/603 */
usleep(5*1000);
continue; continue;
} }
C_PTP_REP (ret); C_PTP_REP (ret);
} }
if(ret != PTP_RC_OK) { if(ret != PTP_RC_OK) {
tries = 5; tries = 5;
while (tries--) { while (tries--) {
ret = ptp_initiateopencapture(params, 0x00000000, 0x00000000); ret = ptp_initiateopencapture(params, 0x00000000, 0x00000000);
if (ret == PTP_RC_OK) { if (ret == PTP_RC_OK) {
skipping to change at line 3884 skipping to change at line 3961
burstnumber = burstdesc.CurrentValue.u16; burstnumber = burstdesc.CurrentValue.u16;
GP_LOG_D ("burstnumber %d", burstnumber); GP_LOG_D ("burstnumber %d", burstnumber);
} }
ptp_free_devicepropdesc (&burstdesc); ptp_free_devicepropdesc (&burstdesc);
} }
ptp_free_devicepropdesc (&propdesc); ptp_free_devicepropdesc (&propdesc);
} }
/* if in liveview mode, we have to run non-af capture */ /* if in liveview mode, we have to run non-af capture */
params->inliveview = 0; params->inliveview = 0;
if (ptp_property_issupported (params, PTP_DPC_NIKON_LiveViewStatus)) { if (ptp_property_issupported (params, PTP_DPC_NIKON_LiveViewStatus) && pt p_operation_issupported(params,PTP_OC_NIKON_StartLiveView)) {
ret = ptp_getdevicepropvalue (params, PTP_DPC_NIKON_LiveViewStatu s, &propval, PTP_DTC_UINT8); ret = ptp_getdevicepropvalue (params, PTP_DPC_NIKON_LiveViewStatu s, &propval, PTP_DTC_UINT8);
if (ret == PTP_RC_OK) if (ret == PTP_RC_OK)
params->inliveview = propval.u8; params->inliveview = propval.u8;
if (params->inliveview) af = 0; if (params->inliveview) af = 0;
} }
if (NIKON_1(params) && ptp_operation_issupported(params,PTP_OC_NIKON_Star tLiveView)) { /* V1 does not have startliveview */ if (NIKON_1(params) && ptp_operation_issupported(params,PTP_OC_NIKON_Star tLiveView)) { /* V1 does not have startliveview */
ret = ptp_nikon_start_liveview (params); ret = ptp_nikon_start_liveview (params);
if ((ret != PTP_RC_OK) && (ret != PTP_RC_DeviceBusy)) if ((ret != PTP_RC_OK) && (ret != PTP_RC_DeviceBusy))
C_PTP_REP_MSG(ret, _("Failed to enable liveview on a Niko n 1, but it is required for capture")); C_PTP_REP_MSG(ret, _("Failed to enable liveview on a Niko n 1, but it is required for capture"));
skipping to change at line 5122 skipping to change at line 5199
//if (dpd.CurrentValue.u8 == 0) //if (dpd.CurrentValue.u8 == 0)
// dpd.CurrentValue.u8 = dpd.FactoryDefaultValue.u8; // dpd.CurrentValue.u8 = dpd.FactoryDefaultValue.u8;
//if (dpd.CurrentValue.u8 == 0x13) { //if (dpd.CurrentValue.u8 == 0x13) {
// GP_LOG_D ("expecting raw+jpeg capture"); // GP_LOG_D ("expecting raw+jpeg capture");
//} //}
uint32_t currentVal; uint32_t currentVal;
uint16_t valuesize; uint16_t valuesize;
uint32_t waitMS = 1000; uint32_t waitMS = 1000;
ptp_panasonic_getdeviceproperty(params, 0x2000030, &valuesize, &currentVa l); ptp_panasonic_getdeviceproperty(params, PTP_DPC_PANASONIC_ShutterSpeed, & valuesize, &currentVal);
float f; float f;
if(currentVal == 0xFFFFFFFF) { if(currentVal == 0xFFFFFFFF) {
waitMS = 1000; waitMS = 1000;
} else if(currentVal & 0x80000000) { } else if(currentVal & 0x80000000) {
currentVal &= ~0x80000000; currentVal &= ~0x80000000;
f = (float) currentVal; f = (float) currentVal;
waitMS = (uint32_t)f + 1000; waitMS = (uint32_t)f + 1000;
} else { } else {
waitMS = 1000; waitMS = 1000;
skipping to change at line 5301 skipping to change at line 5378
GP_LOG_D ("setting fileinfo in fs"); GP_LOG_D ("setting fileinfo in fs");
return gp_filesystem_set_info_noop(camera->fs, path->folder, path ->name, info, context); return gp_filesystem_set_info_noop(camera->fs, path->folder, path ->name, info, context);
} }
return GP_ERROR; return GP_ERROR;
} }
static int static int
camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
GPContext *context) GPContext *context)
{ {
PTPContainer event; PTPContainer event;
PTPParams *params = &camera->pl->params; PTPParams *params = &camera->pl->params;
uint32_t newobject = 0x0; uint32_t newobject = 0x0;
int done,tries; int done,tries;
PTPObjectHandles beforehandles; PTPObjectHandles beforehandles;
uint16_t ptpres;
/* adjust if we ever do sound or movie capture */ /* adjust if we ever do sound or movie capture */
if (type != GP_CAPTURE_IMAGE) if (type != GP_CAPTURE_IMAGE)
return GP_ERROR_NOT_SUPPORTED; return GP_ERROR_NOT_SUPPORTED;
SET_CONTEXT_P(params, context); SET_CONTEXT_P(params, context);
camera->pl->checkevents = TRUE; camera->pl->checkevents = TRUE;
/* first, draing existing events if the caller did not do it. */ /* first, draing existing events if the caller did not do it. */
while (ptp_get_one_event(params, &event)) { while (ptp_get_one_event(params, &event)) {
skipping to change at line 5421 skipping to change at line 5499
C_PTP (ptp_getobjecthandles (params, PTP_HANDLER_SPECIAL, 0x00000 0, 0x000000, &beforehandles)); C_PTP (ptp_getobjecthandles (params, PTP_HANDLER_SPECIAL, 0x00000 0, 0x000000, &beforehandles));
/* A capture may take longer than the standard 8 seconds. /* A capture may take longer than the standard 8 seconds.
* The G5 for instance does, or in dark rooms ... * The G5 for instance does, or in dark rooms ...
* Even 16 seconds might not be enough. (Marcus) * Even 16 seconds might not be enough. (Marcus)
*/ */
/* ptp_initiatecapture() returns immediately, only the event /* ptp_initiatecapture() returns immediately, only the event
* indicating that the capure has been completed may occur after * indicating that the capure has been completed may occur after
* few seconds. moving down the code. (kil3r) * few seconds. moving down the code. (kil3r)
*/ */
C_PTP_REP (ptp_initiatecapture(params, 0x00000000, 0x00000000));
CR (gp_port_set_timeout (camera->port, capture_timeout)); CR (gp_port_set_timeout (camera->port, capture_timeout));
ptpres = LOG_ON_PTP_E (ptp_initiatecapture(params, 0x00000000, 0x00000000
));
/* the V1 reports general error to us, but has actually captured ... so j
ust ignore GeneralError. */
if ((ptpres != PTP_RC_OK) && (ptpres != PTP_RC_GeneralError))
CR(ptpres);
/* A word of comments is worth here. /* A word of comments is worth here.
* After InitiateCapture camera should report with ObjectAdded event * After InitiateCapture camera should report with ObjectAdded event
* all newly created objects. However there might be more than one * all newly created objects. However there might be more than one
* newly created object. There a two scenarios here, which may occur * newly created object. There a two scenarios here, which may occur
* both at the time. * both at the time.
* 1) InitiateCapture trigers capture of more than one object if the * 1) InitiateCapture trigers capture of more than one object if the
* camera is in burst mode for example. * camera is in burst mode for example.
* 2) InitiateCapture creates a number of objects, but not all * 2) InitiateCapture creates a number of objects, but not all
* objects represents images. This happens when the camera creates a * objects represents images. This happens when the camera creates a
* folder for newly captured image(s). This may happen with the * folder for newly captured image(s). This may happen with the
skipping to change at line 6014 skipping to change at line 6095
C_PTP (ptp_sony_getalldevicepropdesc (params)); / * avoid caching */ C_PTP (ptp_sony_getalldevicepropdesc (params)); / * avoid caching */
C_PTP (ptp_generic_getdevicepropdesc (params, PTP _DPC_SONY_FocusFound, &dpd)); C_PTP (ptp_generic_getdevicepropdesc (params, PTP _DPC_SONY_FocusFound, &dpd));
GP_LOG_D ("DEBUG== 0xd213 after shutter press = % d", dpd.CurrentValue.u8); GP_LOG_D ("DEBUG== 0xd213 after shutter press = % d", dpd.CurrentValue.u8);
/* if prop 0xd213 = 2 or 3 (for rx0), the focus s eems to be achieved */ /* if prop 0xd213 = 2 or 3 (for rx0), the focus s eems to be achieved */
if (dpd.CurrentValue.u8 == 2 || dpd.CurrentValue. u8 == 3) { if (dpd.CurrentValue.u8 == 2 || dpd.CurrentValue. u8 == 3) {
GP_LOG_D ("SONY Property change seen, 0xd 213... ending press"); GP_LOG_D ("SONY Property change seen, 0xd 213... ending press");
break; break;
} }
} while (time_since (event_start) < 1000); } while (time_since (event_start) < 1000);
} }
ptp_free_devicepropdesc(&dpd);
GP_LOG_D ("releasing shutterbutton"); GP_LOG_D ("releasing shutterbutton");
/* release full-press */ /* release full-press */
propval.u16 = 1; propval.u16 = 1;
C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_Capt ure, &propval, PTP_DTC_UINT16)); C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_Capt ure, &propval, PTP_DTC_UINT16));
/* release half-press */ /* release half-press */
propval.u16 = 1; propval.u16 = 1;
C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_Auto Focus, &propval, PTP_DTC_UINT16)); C_PTP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_SONY_Auto Focus, &propval, PTP_DTC_UINT16));
skipping to change at line 6592 skipping to change at line 6674
newobject = 0xffffc001; newobject = 0xffffc001;
ret = ptp_getobjectinfo (params, newobject, &oi); ret = ptp_getobjectinfo (params, newobject, &oi);
if (ret != PTP_RC_OK) if (ret != PTP_RC_OK)
goto sonyout; goto sonyout;
debug_objectinfo(params, newobject, &oi); debug_objectinfo(params, newobject, &oi);
C_MEM (path = malloc(sizeof(CameraFilePath))); C_MEM (path = malloc(sizeof(CameraFilePath)));
path->name[0]='\0'; path->name[0]='\0';
strcpy (path->folder,"/"); strcpy (path->folder,"/");
ret = gp_file_new(&file); ret = gp_file_new(&file);
if (ret!=GP_OK) if (ret != GP_OK) {
ptp_free_devicepropdesc (&dpd);
ptp_free_objectinfo (&oi);
return ret; return ret;
}
if (oi.ObjectFormat != PTP_OFC_EXIF_JPEG) { if (oi.ObjectFormat != PTP_OFC_EXIF_JPEG) {
GP_LOG_D ("raw? ofc is 0x%04x, name is %s ", oi.ObjectFormat,oi.Filename); GP_LOG_D ("raw? ofc is 0x%04x, name is %s ", oi.ObjectFormat,oi.Filename);
sprintf (path->name, "capt%04d.arw", para ms->capcnt++); sprintf (path->name, "capt%04d.arw", para ms->capcnt++);
gp_file_set_mime_type (file, "image/x-son y-arw"); /* FIXME */ gp_file_set_mime_type (file, "image/x-son y-arw"); /* FIXME */
} else { } else {
sprintf (path->name, "capt%04d.jpg", para ms->capcnt++); sprintf (path->name, "capt%04d.jpg", para ms->capcnt++);
gp_file_set_mime_type (file, GP_MIME_JPEG ); gp_file_set_mime_type (file, GP_MIME_JPEG );
} }
gp_file_set_mtime (file, time(NULL)); gp_file_set_mtime (file, time(NULL));
GP_LOG_D ("trying to get object size=0x%lx", (uns igned long)oi.ObjectCompressedSize); GP_LOG_D ("trying to get object size=0x%lx", (uns igned long)oi.ObjectCompressedSize);
C_PTP_REP (ptp_getobject (params, newobject, (uns igned char**)&ximage)); C_PTP_REP (ptp_getobject (params, newobject, (uns igned char**)&ximage));
ret = gp_file_set_data_and_size(file, (char*)xima ge, oi.ObjectCompressedSize); ret = gp_file_set_data_and_size(file, (char*)xima ge, oi.ObjectCompressedSize);
if (ret != GP_OK) { if (ret != GP_OK) {
gp_file_free (file); gp_file_free (file);
ptp_free_devicepropdesc (&dpd);
ptp_free_objectinfo (&oi);
return ret; return ret;
} }
ret = gp_filesystem_append(camera->fs, path->fold er, path->name, context); ret = gp_filesystem_append(camera->fs, path->fold er, path->name, context);
if (ret != GP_OK) { if (ret != GP_OK) {
gp_file_free (file); gp_file_free (file);
ptp_free_devicepropdesc (&dpd);
ptp_free_objectinfo (&oi);
return ret; return ret;
} }
ret = gp_filesystem_set_file_noop(camera->fs, pat h->folder, path->name, GP_FILE_TYPE_NORMAL, file, context); ret = gp_filesystem_set_file_noop(camera->fs, pat h->folder, path->name, GP_FILE_TYPE_NORMAL, file, context);
if (ret != GP_OK) { if (ret != GP_OK) {
gp_file_free (file); gp_file_free (file);
ptp_free_devicepropdesc (&dpd);
ptp_free_objectinfo (&oi);
return ret; return ret;
} }
*eventtype = GP_EVENT_FILE_ADDED; *eventtype = GP_EVENT_FILE_ADDED;
*eventdata = path; *eventdata = path;
/* We have now handed over the file, disclaim res ponsibility by unref. */ /* We have now handed over the file, disclaim res ponsibility by unref. */
gp_file_unref (file); gp_file_unref (file);
/* Synthesize a capture complete event, if this w as the last image. */ /* Synthesize a capture complete event, if this w as the last image. */
if (dpd.CurrentValue.u16 == 0x8001) { if (dpd.CurrentValue.u16 == 0x8001) {
event.Code = PTP_EC_CaptureComplete; event.Code = PTP_EC_CaptureComplete;
event.Nparam = 0; event.Nparam = 0;
ptp_add_event (params, &event); ptp_add_event (params, &event);
} }
ptp_free_devicepropdesc (&dpd);
ptp_free_objectinfo (&oi);
return GP_OK; return GP_OK;
} }
sonyout: sonyout:
ptp_free_devicepropdesc (&dpd);
/* If not, check for events and handle them */ /* If not, check for events and handle them */
if (time_since(event_start) > timeout-100) { if (time_since(event_start) > timeout-100) {
/* if there is less than 0.1 seconds, just check the /* if there is less than 0.1 seconds, just check the
* queue. with libusb1 this can still make progre ss, * queue. with libusb1 this can still make progre ss,
* as above bulk calls will check and queue new p tp events * as above bulk calls will check and queue new p tp events
* async */ * async */
C_PTP_REP (ptp_check_event_queue(params)); C_PTP_REP (ptp_check_event_queue(params));
} else { } else {
C_PTP_REP (ptp_check_event(params)); C_PTP_REP (ptp_check_event(params));
} }
skipping to change at line 6911 skipping to change at line 7004
*eventdata = path; *eventdata = path;
gp_filesystem_reset (camera->fs); /* FIXME: implement mor e lightweight folder add */ gp_filesystem_reset (camera->fs); /* FIXME: implement mor e lightweight folder add */
} else { } else {
CR (gp_filesystem_append (camera->fs, path->folder, CR (gp_filesystem_append (camera->fs, path->folder,
path->name, context)); path->name, context));
*eventtype = GP_EVENT_FILE_ADDED; *eventtype = GP_EVENT_FILE_ADDED;
*eventdata = path; *eventdata = path;
} }
break; break;
} }
case PTP_EC_DeviceInfoChanged:
*eventtype = GP_EVENT_UNKNOWN;
C_MEM (*eventdata = malloc(strlen("PTP Deviceinfo changed")+1));
sprintf (*eventdata, "PTP Deviceinfo changed");
C_PTP_REP (ptp_getdeviceinfo (params, &params->deviceinfo));
CR (fixup_cached_deviceinfo (camera, &params->deviceinfo));
print_debug_deviceinfo(params, &params->deviceinfo);
break;
case PTP_EC_DevicePropChanged: case PTP_EC_DevicePropChanged:
*eventtype = GP_EVENT_UNKNOWN; *eventtype = GP_EVENT_UNKNOWN;
C_MEM (*eventdata = malloc(strlen("PTP Property 0123 changed")+1) ); C_MEM (*eventdata = malloc(strlen("PTP Property 0123 changed")+1) );
sprintf (*eventdata, "PTP Property %04x changed", event.Param1 & 0xffff); sprintf (*eventdata, "PTP Property %04x changed", event.Param1 & 0xffff);
break; break;
case PTP_EC_ObjectRemoved: case PTP_EC_ObjectRemoved:
ptp_remove_object_from_cache(params, event.Param1); ptp_remove_object_from_cache(params, event.Param1);
gp_filesystem_reset (camera->fs); gp_filesystem_reset (camera->fs);
*eventtype = GP_EVENT_UNKNOWN; *eventtype = GP_EVENT_UNKNOWN;
C_MEM (*eventdata = malloc(strlen("PTP ObjectRemoved, Param1 0123 4567")+1)); C_MEM (*eventdata = malloc(strlen("PTP ObjectRemoved, Param1 0123 4567")+1));
skipping to change at line 8333 skipping to change at line 8434
/* Note that "image" points to unsigned chars whereas all the other /* Note that "image" points to unsigned chars whereas all the other
* functions which set image return pointers to chars. * functions which set image return pointers to chars.
* However, we calculate a number of unsigned values in this function, * However, we calculate a number of unsigned values in this function,
* so we cannot make it signed either. * so we cannot make it signed either.
* Therefore, sometimes a "ximage" char* helper, since wild casts of poin ters * Therefore, sometimes a "ximage" char* helper, since wild casts of poin ters
* confuse the compilers aliasing mechanisms. * confuse the compilers aliasing mechanisms.
* If you do not like that, feel free to clean up the datatypes. * If you do not like that, feel free to clean up the datatypes.
* (TODO for Marcus and 2.2 ;) * (TODO for Marcus and 2.2 ;)
*/ */
uint32_t oid; uint32_t oid;
uint32_t size; uint64_t size;
uint32_t storage; uint32_t storage;
PTPObject *ob; PTPObject *ob;
PTPParams *params = &camera->pl->params; PTPParams *params = &camera->pl->params;
SET_CONTEXT_P(params, context); SET_CONTEXT_P(params, context);
#if 0 #if 0
/* The new Canons like to switch themselves off in the middle. */ /* The new Canons like to switch themselves off in the middle. */
if (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) { if (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) {
if (ptp_operation_issupported(params, PTP_OC_CANON_KeepDeviceOn)) if (ptp_operation_issupported(params, PTP_OC_CANON_KeepDeviceOn))
skipping to change at line 8476 skipping to change at line 8577
) )
) )
return (GP_ERROR_NOT_SUPPORTED); return (GP_ERROR_NOT_SUPPORTED);
if (is_mtp_capable (camera) && if (is_mtp_capable (camera) &&
(ob->oi.ObjectFormat == PTP_OFC_MTP_AbstractAudioVideoPlaylis t)) (ob->oi.ObjectFormat == PTP_OFC_MTP_AbstractAudioVideoPlaylis t))
return mtp_get_playlist (camera, file, oid, context); return mtp_get_playlist (camera, file, oid, context);
size=ob->oi.ObjectCompressedSize; size=ob->oi.ObjectCompressedSize;
#define BLOBSIZE 1*1024*1024 #define BLOBSIZE 1*1024*1024
if (size > 0xffffffffUL) { /* larger than 4GB */
if ( (params->deviceinfo.VendorExtensionID == PTP_VEND
OR_NIKON) &&
(ptp_operation_issupported(params,PTP_OC_NIKON_Ge
tPartialObjectEx))
) {
#define NIKONBLOBSIZE 10*1024*1024
unsigned char *ximage = NULL;
uint64_t offset = 0;
while (offset < size) {
uint64_t xsize = size - offset;
uint32_t xlen;
if (xsize > NIKONBLOBSIZE)
xsize = NIKONBLOBSIZE;
C_PTP_REP (ptp_nikon_getpartialobjectex (
params, oid, offset, xsize, &ximage, &xlen));
gp_file_append (file, (char*)ximage, xlen
);
free (ximage);
ximage = NULL;
offset += xlen;
if (!xlen) {
GP_LOG_E ("nikon_getpartialobject
loop: offset=%ld, size is %ld, xlen returned is 0?", offset, size);
break;
}
}
goto done;
}
/* fallthrough to the ptp_getobject method */
}
/* We also need this for Nikon D850 and very big RAWs (>40 MB) */ /* We also need this for Nikon D850 and very big RAWs (>40 MB) */
/* Try the generic method first, EOS R does not like the second f or some reason */ /* Try the generic method first, EOS R does not like the second f or some reason */
if ( (ptp_operation_issupported(params,PTP_OC_GetPartialObject )) && if ( (ptp_operation_issupported(params,PTP_OC_GetPartialObject )) &&
(size > BLOBSIZE) (size > BLOBSIZE) && (size <= 0xffffffffUL)
) { ) {
unsigned char *ximage = NULL; unsigned char *ximage = NULL;
uint32_t offset = 0; uint32_t offset = 0;
while (offset < size) { while (offset < size) {
uint32_t xsize = size - offset; uint32_t xsize = size - offset;
uint32_t xlen; uint32_t xlen;
if (xsize > BLOBSIZE) if (xsize > BLOBSIZE)
xsize = BLOBSIZE; xsize = BLOBSIZE;
C_PTP_REP (ptp_getpartialobject (params, oid, offset, xsize, &ximage, &xlen)); C_PTP_REP (ptp_getpartialobject (params, oid, offset, xsize, &ximage, &xlen));
gp_file_append (file, (char*)ximage, xlen ); gp_file_append (file, (char*)ximage, xlen );
free (ximage); free (ximage);
ximage = NULL; ximage = NULL;
offset += xlen; offset += xlen;
if (!xlen) { if (!xlen) {
GP_LOG_E ("getpartialobject loop: offset=%d, size is %d, xlen returned is 0?", offset, size); GP_LOG_E ("getpartialobject loop: offset=%d, size is %ld, xlen returned is 0?", offset, size);
break; break;
} }
} }
goto done; goto done;
} }
/* EOS software uses 1MB blobs, use that too... EOS R does not li ke 5MB blobs */ /* EOS software uses 1MB blobs, use that too... EOS R does not li ke 5MB blobs */
if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON ) && if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON ) &&
(ptp_operation_issupported(params,PTP_OC_CANON_EOS_GetPar tialObject)) && (ptp_operation_issupported(params,PTP_OC_CANON_EOS_GetPar tialObject)) &&
(size > BLOBSIZE) (size > BLOBSIZE)
) { ) {
skipping to change at line 8521 skipping to change at line 8650
uint32_t xsize = size - offset; uint32_t xsize = size - offset;
if (xsize > BLOBSIZE) if (xsize > BLOBSIZE)
xsize = BLOBSIZE; xsize = BLOBSIZE;
C_PTP_REP (ptp_getpartialobject (params, oid, offset, xsize, &ximage, &xsize)); C_PTP_REP (ptp_getpartialobject (params, oid, offset, xsize, &ximage, &xsize));
gp_file_append (file, (char*)ximage, xsiz e); gp_file_append (file, (char*)ximage, xsiz e);
free (ximage); free (ximage);
ximage = NULL; ximage = NULL;
offset += xsize; offset += xsize;
if (!xsize) { if (!xsize) {
GP_LOG_E ("getpartialobject loop: offset=%d, size is %d, xlen returned is 0?", offset, size); GP_LOG_E ("getpartialobject loop: offset=%d, size is %ld, xlen returned is 0?", offset, size);
break; break;
} }
} }
goto done; goto done;
} }
#undef BLOBSIZE #undef BLOBSIZE
if (size) { if (size) {
uint16_t ret; uint16_t ret;
PTPDataHandler handler; PTPDataHandler handler;
skipping to change at line 9235 skipping to change at line 9364
#else #else
gp_context_error (context, _("Olympus wrapped XML support is currently only available with libxml2 support built in.")); \ gp_context_error (context, _("Olympus wrapped XML support is currently only available with libxml2 support built in.")); \
return GP_ERROR; return GP_ERROR;
#endif #endif
} }
break; break;
case GP_PORT_PTPIP: { case GP_PORT_PTPIP: {
GPPortInfo info; GPPortInfo info;
char *xpath; char *xpath;
#if defined(HAVE_LIBWS232) && defined(WIN32)
WORD wsaVersionWanted = MAKEWORD(1, 1);
WSADATA wsaData;
if (WSAStartup(wsaVersionWanted, &wsaData)) {
GP_LOG_E("WSAStartup failed.");
return GP_ERROR;
}
#endif
ret = gp_port_get_info (camera->port, &info); ret = gp_port_get_info (camera->port, &info);
if (ret != GP_OK) { if (ret != GP_OK) {
GP_LOG_E ("Failed to get port info?"); GP_LOG_E ("Failed to get port info?");
return ret; return ret;
} }
gp_port_info_get_path (info, &xpath); gp_port_info_get_path (info, &xpath);
if (strstr(a.model,"Fuji")) { if (strstr(a.model,"Fuji")) {
ret = ptp_fujiptpip_connect (params, xpath); ret = ptp_fujiptpip_connect (params, xpath);
if (ret != GP_OK) { if (ret != GP_OK) {
 End of changes. 51 change blocks. 
29 lines changed or deleted 199 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)