diff options
-rw-r--r-- | camlibs/ptp2/Makefile-files | 1 | ||||
-rw-r--r-- | camlibs/ptp2/config.c | 2 | ||||
-rw-r--r-- | camlibs/ptp2/library.c | 94 | ||||
-rw-r--r-- | camlibs/ptp2/olympus-wrap.c | 86 | ||||
-rw-r--r-- | libgphoto2/ahd_bayer.c | 14 | ||||
-rw-r--r-- | libgphoto2/gphoto2-abilities-list.c | 3 | ||||
-rw-r--r-- | libgphoto2/gphoto2-filesys.c | 64 | ||||
-rw-r--r-- | libgphoto2/gphoto2-setting.c | 14 |
8 files changed, 132 insertions, 146 deletions
diff --git a/camlibs/ptp2/Makefile-files b/camlibs/ptp2/Makefile-files index c1a9bf426..af5c695b9 100644 --- a/camlibs/ptp2/Makefile-files +++ b/camlibs/ptp2/Makefile-files @@ -5,6 +5,7 @@ camlibdoc_DATA += ptp2/README.ptp2 EXTRA_LTLIBRARIES += ptp2.la ptp2_la_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) $(LIBXML2_CFLAGS) +ptp2_la_CFLAGS = $(AM_CFLAGS) $(CFLAGS) $(LIBXML2_CFLAGS) -Wshadow ptp2_la_SOURCES = \ ptp2/ptp.c ptp2/ptp.h ptp2/chdk_ptp.h ptp2/chdk_live_view.h \ ptp2/library.c ptp2/usb.c ptp2/ptp-bugs.h \ diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 3a9e026c4..98b47a698 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -68,8 +68,6 @@ # define __unused__ #endif -#define GP_MODULE "PTP2" - #define SET_CONTEXT(camera, ctx) ((PTPData *) camera->pl->params.data)->context = ctx static int diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 8e110cddb..0cea4ebde 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -64,8 +64,6 @@ #include "ptp-pack.c" #include "olympus-wrap.h" -#define GP_MODULE "PTP2" - #define USB_START_TIMEOUT 8000 #define USB_CANON_START_TIMEOUT 1500 /* 1.5 seconds (0.5 was too low) */ #define USB_NORMAL_TIMEOUT 20000 @@ -168,25 +166,25 @@ print_debug_deviceinfo (PTPDeviceInfo *di) { unsigned int i; - GP_DEBUG ("Device info:"); - GP_DEBUG ("Manufacturer: %s",di->Manufacturer); - GP_DEBUG (" Model: %s", di->Model); - GP_DEBUG (" device version: %s", di->DeviceVersion); - GP_DEBUG (" serial number: '%s'",di->SerialNumber); - GP_DEBUG ("Vendor extension ID: 0x%08x",di->VendorExtensionID); - GP_DEBUG ("Vendor extension version: %d",di->VendorExtensionVersion); - GP_DEBUG ("Vendor extension description: %s",di->VendorExtensionDesc); - GP_DEBUG ("Functional Mode: 0x%04x",di->FunctionalMode); - GP_DEBUG ("PTP Standard Version: %d",di->StandardVersion); - GP_DEBUG ("Supported operations:"); + GP_LOG_D ("Device info:"); + GP_LOG_D ("Manufacturer: %s",di->Manufacturer); + GP_LOG_D (" Model: %s", di->Model); + GP_LOG_D (" device version: %s", di->DeviceVersion); + GP_LOG_D (" serial number: '%s'",di->SerialNumber); + GP_LOG_D ("Vendor extension ID: 0x%08x",di->VendorExtensionID); + GP_LOG_D ("Vendor extension version: %d",di->VendorExtensionVersion); + GP_LOG_D ("Vendor extension description: %s",di->VendorExtensionDesc); + GP_LOG_D ("Functional Mode: 0x%04x",di->FunctionalMode); + GP_LOG_D ("PTP Standard Version: %d",di->StandardVersion); + GP_LOG_D ("Supported operations:"); for (i=0; i<di->OperationsSupported_len; i++) - GP_DEBUG (" 0x%04x", di->OperationsSupported[i]); - GP_DEBUG ("Events Supported:"); + GP_LOG_D (" 0x%04x", di->OperationsSupported[i]); + GP_LOG_D ("Events Supported:"); for (i=0; i<di->EventsSupported_len; i++) - GP_DEBUG (" 0x%04x", di->EventsSupported[i]); - GP_DEBUG ("Device Properties Supported:"); + GP_LOG_D (" 0x%04x", di->EventsSupported[i]); + GP_LOG_D ("Device Properties Supported:"); for (i=0; i<di->DevicePropertiesSupported_len; i++) - GP_DEBUG (" 0x%04x", di->DevicePropertiesSupported[i]); + GP_LOG_D (" 0x%04x", di->DevicePropertiesSupported[i]); } /* Changes the ptp deviceinfo with additional hidden information available, @@ -3287,7 +3285,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, PTPObjectHandles handles; tries = 5; - GP_DEBUG("PTPBUG_NIKON_BROKEN_CAPTURE bug workaround"); + GP_LOG_D ("PTPBUG_NIKON_BROKEN_CAPTURE bug workaround"); while (tries--) { unsigned int i; uint16_t ret = ptp_getobjecthandles (params, PTP_HANDLER_SPECIAL, 0x000000, 0x000000, &handles); @@ -3330,7 +3328,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, } free (beforehandles.Handler); if (!newobject) - GP_DEBUG("PTPBUG_NIKON_BROKEN_CAPTURE no new file found after 5 seconds?!?"); + GP_LOG_D ("PTPBUG_NIKON_BROKEN_CAPTURE no new file found after 5 seconds?!?"); goto out; } @@ -5469,7 +5467,7 @@ read_file_func (CameraFilesystem *fs, const char *folder, const char *filename, gp_context_error (context, _("File '%s/%s' does not exist."), folder, filename); return GP_ERROR_BAD_PARAMETERS; } - GP_DEBUG ("Reading file off=%u size=%u", offset, size); + GP_LOG_D ("Reading %u bytes from file '%s' at offset %u.", size, filename, offset); switch (type) { default: return (GP_ERROR_NOT_SUPPORTED); @@ -5578,7 +5576,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename, else gp_file_set_mtime (file, ob->oi.CaptureDate); - GP_DEBUG ("Getting file."); + GP_LOG_D ("Getting file '%s'.", filename); switch (type) { case GP_FILE_TYPE_EXIF: { uint32_t offset, xlen, maxbytes; @@ -5811,7 +5809,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *filename, return (GP_ERROR_CANCEL); C_PTP_REP (ret); } else { - GP_DEBUG ("The device does not support uploading files!"); + GP_LOG_D ("The device does not support uploading files."); return GP_ERROR_NOT_SUPPORTED; } /* update internal structures */ @@ -6091,7 +6089,7 @@ make_dir_func (CameraFilesystem *fs, const char *folder, const char *foldername, C_PTP_REP (ptp_sendobjectinfo (params, &storage, &parent, &handle, &oi)); } else { - GP_DEBUG ("The device does not support make folder!"); + GP_LOG_D ("The device does not support creating a folder."); return GP_ERROR_NOT_SUPPORTED; } /* update internal structures */ @@ -6211,25 +6209,25 @@ storage_info_func (CameraFilesystem *fs, static void debug_objectinfo(PTPParams *params, uint32_t oid, PTPObjectInfo *oi) { - GP_DEBUG ("ObjectInfo for '%s':", oi->Filename); - GP_DEBUG (" Object ID: 0x%08x", oid); - GP_DEBUG (" StorageID: 0x%08x", oi->StorageID); - GP_DEBUG (" ObjectFormat: 0x%04x", oi->ObjectFormat); - GP_DEBUG (" ProtectionStatus: 0x%04x", oi->ProtectionStatus); - GP_DEBUG (" ObjectCompressedSize: %ld", (unsigned long)oi->ObjectCompressedSize); - GP_DEBUG (" ThumbFormat: 0x%04x", oi->ThumbFormat); - GP_DEBUG (" ThumbCompressedSize: %d", oi->ThumbCompressedSize); - GP_DEBUG (" ThumbPixWidth: %d", oi->ThumbPixWidth); - GP_DEBUG (" ThumbPixHeight: %d", oi->ThumbPixHeight); - GP_DEBUG (" ImagePixWidth: %d", oi->ImagePixWidth); - GP_DEBUG (" ImagePixHeight: %d", oi->ImagePixHeight); - GP_DEBUG (" ImageBitDepth: %d", oi->ImageBitDepth); - GP_DEBUG (" ParentObject: 0x%08x", oi->ParentObject); - GP_DEBUG (" AssociationType: 0x%04x", oi->AssociationType); - GP_DEBUG (" AssociationDesc: 0x%08x", oi->AssociationDesc); - GP_DEBUG (" SequenceNumber: 0x%08x", oi->SequenceNumber); - GP_DEBUG (" ModificationDate: 0x%08x", (unsigned int)oi->ModificationDate); - GP_DEBUG (" CaptureDate: 0x%08x", (unsigned int)oi->CaptureDate); + GP_LOG_D ("ObjectInfo for '%s':", oi->Filename); + GP_LOG_D (" Object ID: 0x%08x", oid); + GP_LOG_D (" StorageID: 0x%08x", oi->StorageID); + GP_LOG_D (" ObjectFormat: 0x%04x", oi->ObjectFormat); + GP_LOG_D (" ProtectionStatus: 0x%04x", oi->ProtectionStatus); + GP_LOG_D (" ObjectCompressedSize: %ld", (unsigned long)oi->ObjectCompressedSize); + GP_LOG_D (" ThumbFormat: 0x%04x", oi->ThumbFormat); + GP_LOG_D (" ThumbCompressedSize: %d", oi->ThumbCompressedSize); + GP_LOG_D (" ThumbPixWidth: %d", oi->ThumbPixWidth); + GP_LOG_D (" ThumbPixHeight: %d", oi->ThumbPixHeight); + GP_LOG_D (" ImagePixWidth: %d", oi->ImagePixWidth); + GP_LOG_D (" ImagePixHeight: %d", oi->ImagePixHeight); + GP_LOG_D (" ImageBitDepth: %d", oi->ImageBitDepth); + GP_LOG_D (" ParentObject: 0x%08x", oi->ParentObject); + GP_LOG_D (" AssociationType: 0x%04x", oi->AssociationType); + GP_LOG_D (" AssociationDesc: 0x%08x", oi->AssociationDesc); + GP_LOG_D (" SequenceNumber: 0x%08x", oi->SequenceNumber); + GP_LOG_D (" ModificationDate: 0x%08x", (unsigned int)oi->ModificationDate); + GP_LOG_D (" CaptureDate: 0x%08x", (unsigned int)oi->CaptureDate); } #if 0 @@ -6475,12 +6473,12 @@ init_ptp_fs (Camera *camera, GPContext *context) if (nroot == 0 && params->nrofobjects > 0) { uint32_t badroothandle = 0xffffffff; - GP_DEBUG("Bug workaround: Found no root directory objects, looking for some."); + GP_LOG_D ("Bug workaround: Found no root directory objects, looking for some."); for (i = 0; i < params->nrofobjects; i++) { PTPObjectInfo *oi = ¶ms->objects[i].oi; if (strcmp(oi->Filename, "DCIM") == 0) { - GP_DEBUG("Changing DCIM ParentObject ID from 0x%x to 0", + GP_LOG_D ("Changing DCIM ParentObject ID from 0x%x to 0", oi->ParentObject); badroothandle = oi->ParentObject; oi->ParentObject = 0; @@ -6491,7 +6489,7 @@ init_ptp_fs (Camera *camera, GPContext *context) for (i = 0; i < params->nrofobjects; i++) { PTPObjectInfo *oi = ¶ms->objects[i].oi; if (oi->ParentObject == badroothandle) { - GP_DEBUG("Changing %s ParentObject ID from 0x%x to 0", + GP_LOG_D ("Changing %s ParentObject ID from 0x%x to 0", oi->Filename, oi->ParentObject); oi->ParentObject = 0; nroot++; @@ -6503,7 +6501,7 @@ init_ptp_fs (Camera *camera, GPContext *context) * O(n^2) search. Be careful. */ if (nroot == 0) { - GP_DEBUG("Bug workaround: Found no root dir entries and no DCIM dir, looking for some."); + GP_LOG_D ("Bug workaround: Found no root dir entries and no DCIM dir, looking for some."); /* look for entries with parentobjects that do not exist */ for (i = 0; i < params->nrofobjects; i++) { int j; @@ -6963,7 +6961,7 @@ camera_init (Camera *camera, GPContext *context) PTPObjectInfo oi; uint32_t parenthandle,storagehandle, handle; - GP_DEBUG("... sending empty XDISCVRY.X3C file to camera ... "); + GP_LOG_D ("Sending empty XDISCVRY.X3C file to camera ... "); storagehandle = 0x80000001; parenthandle = 0; diff --git a/camlibs/ptp2/olympus-wrap.c b/camlibs/ptp2/olympus-wrap.c index 8e8e580ee..1d0cf6b89 100644 --- a/camlibs/ptp2/olympus-wrap.c +++ b/camlibs/ptp2/olympus-wrap.c @@ -44,8 +44,6 @@ #include <gphoto2/gphoto2-result.h> #include <gphoto2/gphoto2-port-log.h> -#define GP_MODULE "olympus" - /* * The following things are the way the are just to ensure that USB * wrapper packets have the correct byte-order on all types of machines. @@ -141,9 +139,9 @@ usb_wrap_OK (GPPort *dev, uw_header_t *hdr) int ret; memset(&rsp, 0, sizeof(rsp)); - GP_DEBUG( "usb_wrap_OK" ); + GP_LOG_D ("usb_wrap_OK"); if ((ret = gp_port_read(dev, (char*)&rsp, sizeof(rsp))) != sizeof(rsp)) { - gp_log (GP_LOG_DEBUG, GP_MODULE, "gp_port_read *** FAILED (%d vs %d bytes)", (int)sizeof(rsp), ret ); + GP_LOG_D ("gp_port_read *** FAILED (%d vs %d bytes)", (int)sizeof(rsp), ret); if (ret < GP_OK) return ret; return GP_ERROR; @@ -151,7 +149,7 @@ usb_wrap_OK (GPPort *dev, uw_header_t *hdr) if ( !UW_EQUAL(rsp.magic, UW_MAGIC_IN) || !UW_EQUAL(rsp.tag, hdr->tag)) { - GP_DEBUG( "usb_wrap_OK wrong session *** FAILED" ); + GP_LOG_E ("usb_wrap_OK wrong session *** FAILED"); return GP_ERROR; } /* @@ -162,7 +160,7 @@ usb_wrap_OK (GPPort *dev, uw_header_t *hdr) rsp.residue.c3 != 0 || rsp.residue.c4 != 0 || rsp.status != 0) { - GP_DEBUG( "Error: usb_wrap_OK failed - residual non-0 or status %x", rsp.status); + GP_LOG_E ("Error: usb_wrap_OK failed - residual non-0 or status %x", rsp.status); return GP_ERROR; } return GP_OK; @@ -195,22 +193,22 @@ scsi_wrap_cmd( memcpy(hdr.cdb, cmd, cmdlen); if ((ret=gp_port_write(port, (char*)&hdr, sizeof(hdr))) < GP_OK) { - GP_DEBUG( "scsi_wrap_cmd *** FAILED to write scsi cmd" ); + GP_LOG_E ("scsi_wrap_cmd *** FAILED to write scsi cmd"); return GP_ERROR_IO; } if (todev) { if ((ret=gp_port_write(port, (char*)data, size)) < GP_OK) { - GP_DEBUG( "scsi_wrap_cmd *** FAILED to write scsi data" ); + GP_LOG_E ("scsi_wrap_cmd *** FAILED to write scsi data"); return GP_ERROR_IO; } } else { if ((ret=gp_port_read(port, (char*)data, size)) < GP_OK) { - GP_DEBUG( "scsi_wrap_cmd *** FAILED to read scsi data" ); + GP_LOG_E ("scsi_wrap_cmd *** FAILED to read scsi data"); return GP_ERROR_IO; } } if ((ret=usb_wrap_OK(port, &hdr)) != GP_OK) { - GP_DEBUG( "scsi_wrap_cmd *** FAILED to get scsi reply" ); + GP_LOG_E ("scsi_wrap_cmd *** FAILED to get scsi reply"); return GP_ERROR_IO; } return GP_OK; @@ -233,7 +231,7 @@ ums_wrap_sendreq (PTPParams* params, PTPContainer* req) { uw_scsicmd_t cmd; char sense_buffer[32]; - GP_DEBUG( "ums_wrap_sendreq" ); + GP_LOG_D ("ums_wrap_sendreq"); /* Build appropriate USB container */ usbreq.length= htod32(PTP_USB_BULK_REQ_LEN- (sizeof(uint32_t)*(5-req->Nparam))); @@ -254,7 +252,7 @@ ums_wrap_sendreq (PTPParams* params, PTPContainer* req) { ret = gp_port_send_scsi_cmd (camera->port, 1, (char*)&cmd, sizeof(cmd), sense_buffer, sizeof(sense_buffer), (char*)&usbreq, usbreq.length); - GP_DEBUG("send_scsi_cmd ret %d", ret); + GP_LOG_D ("send_scsi_cmd ret %d", ret); return PTP_RC_OK; } @@ -270,7 +268,7 @@ ums_wrap_senddata ( uw_scsicmd_t cmd; char sense_buffer[32]; - GP_DEBUG( "ums_wrap_senddata" ); + GP_LOG_D ("ums_wrap_senddata"); memset (&cmd, 0, sizeof(cmd)); cmd.cmd = cmdbyte(1); @@ -284,18 +282,18 @@ ums_wrap_senddata ( memcpy (xdata, &usbreq, 12); ret = getter->getfunc(params, getter->priv, sendlen, xdata+12, &gotlen); if (ret != PTP_RC_OK) { - GP_DEBUG( "ums_wrap_senddata *** data get from handler FAILED, ret %d", ret ); + GP_LOG_E ("ums_wrap_senddata *** data get from handler FAILED, ret %d", ret); return ret; } if (gotlen != sendlen) { - GP_DEBUG( "ums_wrap_senddata *** data get from handler got %ld instead of %ld", gotlen, sendlen ); + GP_LOG_E ("ums_wrap_senddata *** data get from handler got %ld instead of %ld", gotlen, sendlen); return PTP_ERROR_IO; } ret = gp_port_send_scsi_cmd (camera->port, 1, (char*)&cmd, sizeof(cmd), sense_buffer, sizeof(sense_buffer), (char*)xdata, sendlen+12); - GP_DEBUG("send_scsi_cmd ret %d", ret); + GP_LOG_D ("send_scsi_cmd ret %d", ret); free (xdata); @@ -312,7 +310,7 @@ ums_wrap_getresp (PTPParams* params, PTPContainer* resp) uw_scsicmd_t cmd; char sense_buffer[32]; - GP_DEBUG( "ums_wrap_getresp" ); + GP_LOG_D ("ums_wrap_getresp"); memset (&cmd, 0, sizeof(cmd)); cmd.cmd = cmdbyte(3); cmd.length = uw_value(sizeof(buf)); @@ -320,7 +318,7 @@ ums_wrap_getresp (PTPParams* params, PTPContainer* resp) ret = gp_port_send_scsi_cmd (camera->port, 0, (char*)&cmd, sizeof(cmd), sense_buffer, sizeof(sense_buffer), (char*)buf, sizeof(buf)); - GP_DEBUG("send_scsi_cmd ret %d", ret); + GP_LOG_D ("send_scsi_cmd ret %d", ret); memcpy (&usbresp, buf, sizeof(buf)); resp->Code = dtoh16(usbresp.code); @@ -345,7 +343,7 @@ ums_wrap_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *putter) uw_scsicmd_t cmd; char sense_buffer[32]; - GP_DEBUG( "ums_wrap_getdata" ); + GP_LOG_D ("ums_wrap_getdata"); memset(&cmd,0,sizeof(cmd)); cmd.cmd = cmdbyte(4); @@ -354,16 +352,16 @@ ums_wrap_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *putter) ret = gp_port_send_scsi_cmd (camera->port, 0, (char*)&cmd, sizeof(cmd), sense_buffer, sizeof(sense_buffer), (char*)buf, sizeof(buf)); - GP_DEBUG("send_scsi_cmd ret %d", ret); + GP_LOG_D ("send_scsi_cmd ret %d", ret); memcpy (&usbresp, buf, sizeof(buf)); if ((dtoh16(usbresp.code) != ptp->Code) && (dtoh16(usbresp.code) != PTP_RC_OK)) { - GP_DEBUG( "ums_wrap_getdata *** PTP code %04x during PTP data in size read", dtoh16(usbresp.code)); + GP_LOG_D ("ums_wrap_getdata *** PTP code %04x during PTP data in size read", dtoh16(usbresp.code)); /* break; */ } if (dtoh16(usbresp.length) < 16) { recvlen = 0; - GP_DEBUG( "ums_wrap_getdata *** PTP size %d during PTP data in size read, expected 16", dtoh16(usbresp.length)); + GP_LOG_D ("ums_wrap_getdata *** PTP size %d during PTP data in size read, expected 16", dtoh16(usbresp.length)); } else { recvlen = dtoh32(usbresp.payload.params.param1); } @@ -378,14 +376,14 @@ ums_wrap_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *putter) ret = gp_port_send_scsi_cmd (camera->port, 0, (char*)&cmd, sizeof(cmd), sense_buffer, sizeof(sense_buffer), (char*)data, recvlen); - GP_DEBUG("send_scsi_cmd 2 ret %d", ret); + GP_LOG_D ("send_scsi_cmd 2 ret %d", ret); /* skip away the 12 byte header */ if (recvlen >= 16) gp_log_data ("ptp2/olympus/getdata", data + PTP_USB_BULK_HDR_LEN, recvlen - PTP_USB_BULK_HDR_LEN); ret = putter->putfunc ( params, putter->priv, recvlen - PTP_USB_BULK_HDR_LEN, (unsigned char*)data + PTP_USB_BULK_HDR_LEN); free (data); if (ret != PTP_RC_OK) { - GP_DEBUG( "ums_wrap_getdata FAILED to push data into put handle, ret %x", ret ); + GP_LOG_E ("ums_wrap_getdata FAILED to push data into put handle, ret %x", ret); return PTP_ERROR_IO; } return PTP_RC_OK; @@ -406,14 +404,14 @@ olympus_xml_transfer (PTPParams *params, uint16_t ret; PTPParams *outerparams = params->outer_params; - GP_DEBUG("olympus_xml_transfer"); + GP_LOG_D ("olympus_xml_transfer"); while (1) { - GP_DEBUG("... checking camera for events ..."); + GP_LOG_D ("... checking camera for events ..."); ret = outerparams->event_check(outerparams, &ptp2); if (ret == PTP_RC_OK) { char *evxml; - GP_DEBUG("event: code %04x, p %08x", ptp2.Code, ptp2.Param1); + GP_LOG_D ("event: code %04x, p %08x", ptp2.Code, ptp2.Param1); if (ptp2.Code != PTP_EC_RequestObjectTransfer) { ptp_add_event (params, &ptp2); @@ -430,7 +428,7 @@ olympus_xml_transfer (PTPParams *params, if (ret != PTP_RC_OK) return ret; eventhandler: - GP_DEBUG("event xml transfer: got new file: %s", oi.Filename); + GP_LOG_D ("event xml transfer: got new file: %s", oi.Filename); ret = ptp_getobject (outerparams, newhandle, (unsigned char**)&resxml); if (ret != PTP_RC_OK) return ret; @@ -438,14 +436,14 @@ olympus_xml_transfer (PTPParams *params, memcpy (evxml, resxml, oi.ObjectCompressedSize); evxml[oi.ObjectCompressedSize] = 0x00; - GP_DEBUG("file content: %s", evxml); + GP_LOG_D ("file content: %s", evxml); parse_event_xml (params, evxml, &ptp2); /* parse it */ evxml = generate_event_OK_xml(params, &ptp2); - GP_DEBUG("... sending XML event reply to camera ... "); + GP_LOG_D ("... sending XML event reply to camera ... "); memset (&ptp2, 0 , sizeof (ptp2)); ptp2.Code = PTP_OC_SendObjectInfo; ptp2.Nparam = 1; @@ -472,7 +470,7 @@ olympus_xml_transfer (PTPParams *params, } skip: - GP_DEBUG("... sending XML request to camera ... "); + GP_LOG_D ("... sending XML request to camera ... "); memset (&ptp2, 0 , sizeof (ptp2)); ptp2.Code = PTP_OC_SendObjectInfo; ptp2.Nparam = 1; @@ -502,12 +500,12 @@ olympus_xml_transfer (PTPParams *params, if (res != PTP_RC_OK) return res; - GP_DEBUG("... waiting for camera ..."); + GP_LOG_D ("... waiting for camera ..."); redo: ret = outerparams->event_wait(outerparams, &ptp2); if (ret != PTP_RC_OK) return ret; - GP_DEBUG("event: code %04x, p %08x", ptp2.Code, ptp2.Param1); + GP_LOG_D ("event: code %04x, p %08x", ptp2.Code, ptp2.Param1); if (ptp2.Code != PTP_EC_RequestObjectTransfer) { ptp_add_event (params, &ptp2); goto redo; @@ -517,7 +515,7 @@ redo: ret = ptp_getobjectinfo (outerparams, newhandle, &oi); if (ret != PTP_RC_OK) return ret; - GP_DEBUG("regular xml transfer: got new file: %s", oi.Filename); + GP_LOG_D ("regular xml transfer: got new file: %s", oi.Filename); if (strcmp(oi.Filename,"DRSPONSE.X3C")) { gp_log (GP_LOG_ERROR,"olympus", "FIXME: regular xml transfer: got new file: %s", oi.Filename); goto eventhandler; @@ -529,7 +527,7 @@ redo: memcpy (*inxml, resxml, oi.ObjectCompressedSize); (*inxml)[oi.ObjectCompressedSize] = 0x00; - GP_DEBUG("file content: %s", *inxml); + GP_LOG_D ("file content: %s", *inxml); /* parse it */ break; } @@ -1184,7 +1182,7 @@ static int is_outer_operation (PTPParams* params, uint16_t opcode) { unsigned int i; - GP_DEBUG("is_outer_operation %04x", opcode); + GP_LOG_D ("is_outer_operation %04x", opcode); /* the ones we need before we can do getdeviceinfo */ if (opcode == PTP_OC_OpenSession) return 1; if (opcode == PTP_OC_SendObjectInfo) return 1; @@ -1200,7 +1198,7 @@ is_outer_operation (PTPParams* params, uint16_t opcode) { for (i=0;i<params->outer_deviceinfo.OperationsSupported_len;i++) if (params->outer_deviceinfo.OperationsSupported[i]==opcode) return TRUE; - GP_DEBUG("is_outer_operation %04x - is WRAPPED", opcode); + GP_LOG_D ("is_outer_operation %04x - is WRAPPED", opcode); return FALSE; } @@ -1216,14 +1214,14 @@ ums_wrap2_event_check (PTPParams* params, PTPContainer* req) PTPParams *outerparams = params->outer_params; char *evxml; - GP_DEBUG("ums_wrap2_event_check"); + GP_LOG_D ("ums_wrap2_event_check"); while (1) { ret = outerparams->event_check(outerparams, &ptp2); if (ret != PTP_RC_OK) return ret; - GP_DEBUG("event: code %04x, p %08x", ptp2.Code, ptp2.Param1); + GP_LOG_D ("event: code %04x, p %08x", ptp2.Code, ptp2.Param1); if (ptp2.Code != PTP_EC_RequestObjectTransfer) { gp_log (GP_LOG_DEBUG, "olympus", "event 0x%04x received, just passing on", ptp2.Code); @@ -1242,7 +1240,7 @@ ums_wrap2_event_check (PTPParams* params, PTPContainer* req) ret = ptp_getobjectinfo (outerparams, newhandle, &oi); if (ret != PTP_RC_OK) return ret; - GP_DEBUG("event xml: got new file: %s", oi.Filename); + GP_LOG_D ("event xml: got new file: %s", oi.Filename); if (!strstr(oi.Filename,".X3C")) { gp_log (GP_LOG_DEBUG, "olympus", "PTP_EC_RequestObjectTransfer with non XML filename %s", oi.Filename); memcpy (req, &ptp2, sizeof(ptp2)); @@ -1255,7 +1253,7 @@ ums_wrap2_event_check (PTPParams* params, PTPContainer* req) memcpy (evxml, resxml, oi.ObjectCompressedSize); evxml[oi.ObjectCompressedSize] = 0x00; - GP_DEBUG("file content: %s", evxml); + GP_LOG_D ("file content: %s", evxml); /* FIXME: handle the case where we get a non X3C file, like during capture */ @@ -1265,7 +1263,7 @@ ums_wrap2_event_check (PTPParams* params, PTPContainer* req) /* generate reply */ evxml = generate_event_OK_xml(params, req); - GP_DEBUG("... sending XML event reply to camera ... "); + GP_LOG_D ("... sending XML event reply to camera ... "); memset (&ptp2, 0 , sizeof (ptp2)); ptp2.Code = PTP_OC_SendObjectInfo; ptp2.Nparam = 1; @@ -1295,7 +1293,7 @@ ums_wrap2_event_check (PTPParams* params, PTPContainer* req) static uint16_t ums_wrap2_sendreq (PTPParams* params, PTPContainer* req) { - GP_DEBUG("ums_wrap2_sendreq"); + GP_LOG_D ("ums_wrap2_sendreq"); if (is_outer_operation (params,req->Code)) return ums_wrap_sendreq (params,req); /* We do stuff in either senddata, getdata or getresp, not here. */ @@ -1319,7 +1317,7 @@ ums_wrap2_senddata ( data = malloc (sendlen); ret = getter->getfunc(params, getter->priv, sendlen, data, &gotlen); if (ret != PTP_RC_OK) { - GP_DEBUG( "ums_wrap2_senddata *** data get from handler FAILED, ret %d", ret ); + GP_LOG_D ("ums_wrap2_senddata *** data get from handler FAILED, ret %d", ret); return ret; } params->olympus_cmd = generate_xml (params, ptp, data, sendlen); diff --git a/libgphoto2/ahd_bayer.c b/libgphoto2/ahd_bayer.c index e5c6b5ac3..ab59ac7b8 100644 --- a/libgphoto2/ahd_bayer.c +++ b/libgphoto2/ahd_bayer.c @@ -50,8 +50,6 @@ #include <gphoto2/gphoto2-result.h> #include <gphoto2/gphoto2-port-log.h> -#define GP_MODULE "ahd_bayer" - #define MAX(x,y) ((x < y) ? (y) : (x)) #define MIN(x,y) ((x > y) ? (y) : (x)) #define CLAMP(x) MAX(MIN(x,0xff),0) @@ -428,20 +426,20 @@ int gp_ahd_interpolate (unsigned char *image, int w, int h, BayerTile tile) window_h = calloc (w * 18, 1); if (!window_h) { - GP_DEBUG("Out of memory\n"); + GP_LOG_E ("Out of memory\n"); return GP_ERROR_NO_MEMORY; } window_v = calloc(w * 18, 1); if (!window_v) { free (window_h); - GP_DEBUG("Out of memory\n"); + GP_LOG_E ("Out of memory\n"); return GP_ERROR_NO_MEMORY; } homo_h = calloc(w*3, 1); if (!homo_h) { free (window_v); free (window_h); - GP_DEBUG("Out of memory\n"); + GP_LOG_E ("Out of memory\n"); return GP_ERROR_NO_MEMORY; } homo_v = calloc(w*3, 1); @@ -449,7 +447,7 @@ int gp_ahd_interpolate (unsigned char *image, int w, int h, BayerTile tile) free (window_v); free (window_h); free (homo_h); - GP_DEBUG("Out of memory\n"); + GP_LOG_E ("Out of memory\n"); return GP_ERROR_NO_MEMORY; } homo_ch = calloc (w, 1); @@ -458,7 +456,7 @@ int gp_ahd_interpolate (unsigned char *image, int w, int h, BayerTile tile) free (window_h); free (homo_h); free (homo_v); - GP_DEBUG("Out of memory\n"); + GP_LOG_E ("Out of memory\n"); return GP_ERROR_NO_MEMORY; } homo_cv = calloc (w, 1); @@ -468,7 +466,7 @@ int gp_ahd_interpolate (unsigned char *image, int w, int h, BayerTile tile) free (homo_ch); free (homo_v); free (homo_h); - GP_DEBUG("Out of memory\n"); + GP_LOG_E ("Out of memory\n"); return GP_ERROR_NO_MEMORY; } switch (tile) { diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c index 9d5004238..0a29d65a4 100644 --- a/libgphoto2/gphoto2-abilities-list.c +++ b/libgphoto2/gphoto2-abilities-list.c @@ -56,9 +56,6 @@ #endif /** \internal */ -#define GP_MODULE "gphoto2-abilities-list" - -/** \internal */ #define CHECK_NULL(r) {if (!(r)) return (GP_ERROR_BAD_PARAMETERS);} /** \internal */ #define CHECK_RESULT(result) {int r = (result); if (r < 0) return (r);} diff --git a/libgphoto2/gphoto2-filesys.c b/libgphoto2/gphoto2-filesys.c index 1f6991075..2566aafe9 100644 --- a/libgphoto2/gphoto2-filesys.c +++ b/libgphoto2/gphoto2-filesys.c @@ -62,8 +62,6 @@ # define N_(String) (String) #endif -#define GP_MODULE "libgphoto2" - #ifndef PATH_MAX # define PATH_MAX 4096 #endif @@ -145,7 +143,7 @@ get_exif_mtime (const unsigned char *data, unsigned long size) ed = exif_data_new_from_data (data, size); if (!ed) { - GP_DEBUG ("Could not parse data for EXIF information."); + GP_LOG_E ("Could not parse data for EXIF information."); return 0; } @@ -185,7 +183,7 @@ get_exif_mtime (const unsigned char *data, unsigned long size) #endif exif_data_unref (ed); if (!t1 && !t2 && !t3) { - GP_DEBUG ("EXIF data has not date/time tags."); + GP_LOG_D ("EXIF data has not date/time tags."); return 0; } @@ -197,7 +195,7 @@ get_exif_mtime (const unsigned char *data, unsigned long size) if (t3 > t) /* "image digitized" > max(last two) ? can not be */ t = t3; - GP_DEBUG ("Found time in EXIF data: '%s'.", asctime (localtime (&t))); + GP_LOG_D ("Found time in EXIF data: '%s'.", asctime (localtime (&t))); return (t); } @@ -222,7 +220,7 @@ gp_filesystem_get_exif_mtime (CameraFilesystem *fs, const char *folder, gp_file_new (&file); if (gp_filesystem_get_file (fs, folder, filename, GP_FILE_TYPE_EXIF, file, NULL) != GP_OK) { - GP_DEBUG ("Could not get EXIF data of '%s' in folder '%s'.", + GP_LOG_E ("Could not get EXIF data of '%s' in folder '%s'.", filename, folder); gp_file_unref (file); return 0; @@ -807,7 +805,7 @@ recursive_fs_dump (CameraFilesystemFolder *folder, int depth) { int gp_filesystem_dump (CameraFilesystem *fs) { - GP_DEBUG("Dumping Filesystem:"); + GP_LOG_D ("Dumping Filesystem:"); recursive_fs_dump (fs->rootfolder, 0); return (GP_OK); } @@ -1548,7 +1546,7 @@ gp_filesystem_get_file_impl (CameraFilesystem *fs, const char *folder, CC (context); CA (folder, context); - GP_DEBUG ("Getting file '%s' from folder '%s' (type %i)...", + GP_LOG_D ("Getting file '%s' from folder '%s' (type %i)...", filename, folder, type); CR (gp_file_set_name (file, filename)); @@ -1663,7 +1661,7 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, * cameras hide the thumbnail in EXIF data. Check it out. */ #ifdef HAVE_LIBEXIF - GP_DEBUG ("Getting previews is not supported. Trying " + GP_LOG_D ("Getting previews is not supported. Trying " "EXIF data..."); CR (gp_file_new (&efile)); CU (gp_filesystem_get_file_impl (fs, folder, filename, @@ -1672,12 +1670,12 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, ed = exif_data_new_from_data ((unsigned char*)data, size); gp_file_unref (efile); if (!ed) { - GP_DEBUG ("Could not parse EXIF data of " + GP_LOG_E ("Could not parse EXIF data of " "'%s' in folder '%s'.", filename, folder); return (GP_ERROR_CORRUPTED_DATA); } if (!ed->data) { - GP_DEBUG ("EXIF data does not contain a thumbnail."); + GP_LOG_E ("EXIF data does not contain a thumbnail."); exif_data_unref (ed); return (r); } @@ -1699,7 +1697,7 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, CR (gp_filesystem_set_file_noop (fs, folder, filename, GP_FILE_TYPE_PREVIEW, file, context)); CR (gp_file_adjust_name_for_mime_type (file)); #else - GP_DEBUG ("Getting previews is not supported and " + GP_LOG_D ("Getting previews is not supported and " "libgphoto2 has been compiled without exif " "support. "); return (r); @@ -1712,7 +1710,7 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, * out. */ #ifdef HAVE_LIBEXIF - GP_DEBUG ("Getting EXIF data is not supported. Trying " + GP_LOG_D ("Getting EXIF data is not supported. Trying " "thumbnail..."); CR (gp_file_new (&efile)); CU (gp_filesystem_get_file_impl (fs, folder, filename, @@ -1721,7 +1719,7 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, ed = exif_data_new_from_data ((unsigned char*)data, size); gp_file_unref (efile); if (!ed) { - GP_DEBUG ("Could not parse EXIF data of thumbnail of " + GP_LOG_D ("Could not parse EXIF data of thumbnail of " "'%s' in folder '%s'.", filename, folder); return (GP_ERROR_CORRUPTED_DATA); } @@ -1737,12 +1735,12 @@ gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, CR (gp_filesystem_set_file_noop (fs, folder, filename, GP_FILE_TYPE_EXIF, file, context)); CR (gp_file_adjust_name_for_mime_type (file)); #else - GP_DEBUG ("Getting EXIF data is not supported and libgphoto2 " + GP_LOG_D ("Getting EXIF data is not supported and libgphoto2 " "has been compiled without EXIF support."); return (r); #endif } else if (r < 0) { - GP_DEBUG ("Download of '%s' from '%s' (type %i) failed. " + GP_LOG_D ("Download of '%s' from '%s' (type %i) failed. " "Reason: '%s'", filename, folder, type, gp_result_as_string (r)); return (r); @@ -1876,7 +1874,7 @@ gp_filesystem_get_info (CameraFilesystem *fs, const char *folder, CC (context); CA (folder, context); - GP_DEBUG ("Getting information about '%s' in '%s'...", filename, + GP_LOG_D ("Getting information about '%s' in '%s'...", filename, folder); if (!fs->get_info_func) { @@ -1902,7 +1900,7 @@ gp_filesystem_get_info (CameraFilesystem *fs, const char *folder, */ #ifdef HAVE_LIBEXIF if (!(file->info.file.fields & GP_FILE_INFO_MTIME)) { - GP_DEBUG ("Did not get mtime. Trying EXIF information..."); + GP_LOG_D ("Did not get mtime. Trying EXIF information..."); t = gp_filesystem_get_exif_mtime (fs, folder, filename); if (t) { file->info.file.mtime = t; @@ -1920,10 +1918,10 @@ gp_filesystem_lru_clear (CameraFilesystem *fs) int n = 0; CameraFilesystemFile *ptr, *prev; - GP_DEBUG ("Clearing fscache LRU list..."); + GP_LOG_D ("Clearing fscache LRU list..."); if (fs->lru_first == NULL) { - GP_DEBUG ("fscache LRU list already empty"); + GP_LOG_D ("fscache LRU list already empty"); return (GP_OK); } @@ -1931,7 +1929,7 @@ gp_filesystem_lru_clear (CameraFilesystem *fs) while (ptr != NULL) { n++; if (ptr->lru_prev != prev) { - GP_DEBUG ("fscache LRU list corrupted (%i)", n); + GP_LOG_D ("fscache LRU list corrupted (%i)", n); return (GP_ERROR); } prev = ptr; @@ -1945,7 +1943,7 @@ gp_filesystem_lru_clear (CameraFilesystem *fs) fs->lru_last = NULL; fs->lru_size = 0; - GP_DEBUG ("fscache LRU list cleared (removed %i items)", n); + GP_LOG_D ("fscache LRU list cleared (removed %i items)", n); return (GP_OK); } @@ -1998,7 +1996,7 @@ gp_filesystem_lru_free (CameraFilesystem *fs) ptr = fs->lru_first; - GP_DEBUG ("Freeing cached data for file '%s'...", ptr->name); + GP_LOG_D ("Freeing cached data for file '%s'...", ptr->name); /* Remove it from the list. */ fs->lru_first = ptr->lru_next; @@ -2094,7 +2092,7 @@ gp_filesystem_lru_update (CameraFilesystem *fs, x = gp_filesystem_lru_count (fs); } - GP_DEBUG ("Adding file '%s' from folder '%s' to the fscache LRU list " + GP_LOG_D ("Adding file '%s' from folder '%s' to the fscache LRU list " "(type %i)...", filename, folder, type); /* Search folder and file */ @@ -2154,7 +2152,7 @@ gp_filesystem_lru_update (CameraFilesystem *fs, CR( gp_file_get_data_and_size (file, NULL, &size)); fs->lru_size += size; - GP_DEBUG ("File '%s' from folder '%s' added in fscache LRU list.", + GP_LOG_D ("File '%s' from folder '%s' added in fscache LRU list.", filename, folder); return (GP_OK); @@ -2166,10 +2164,10 @@ gp_filesystem_lru_check (CameraFilesystem *fs) int n = 0; CameraFilesystemFile *ptr, *prev; - GP_DEBUG ("Checking fscache LRU list integrity..."); + GP_LOG_D ("Checking fscache LRU list integrity..."); if (fs->lru_first == NULL) { - GP_DEBUG ("fscache LRU list empty"); + GP_LOG_D ("fscache LRU list empty"); return (GP_OK); } @@ -2177,14 +2175,14 @@ gp_filesystem_lru_check (CameraFilesystem *fs) while (ptr != NULL) { n++; if (ptr->lru_prev != prev) { - GP_DEBUG ("fscache LRU list corrupted (%i)", n); + GP_LOG_E ("fscache LRU list corrupted (%i)", n); return (GP_ERROR); } prev = ptr; ptr = ptr->lru_next; } - GP_DEBUG ("fscache LRU list ok with %i items (%ld bytes)", n, + GP_LOG_D ("fscache LRU list ok with %i items (%ld bytes)", n, fs->lru_size); return (GP_OK); @@ -2220,7 +2218,7 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs, CC (context); CA (folder, context); - GP_DEBUG ("Adding file '%s' to folder '%s' (type %i)...", + GP_LOG_D ("Adding file '%s' to folder '%s' (type %i)...", filename, folder, type); /* Search folder and file */ @@ -2286,7 +2284,7 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs, */ CR (gp_file_get_mtime (file, &t)); if (!t) { - GP_DEBUG ("File does not contain mtime. Trying " + GP_LOG_D ("File does not contain mtime. Trying " "information on the file..."); r = gp_filesystem_get_info (fs, folder, filename, &info, NULL); if ((r == GP_OK) && (info.file.fields & GP_FILE_INFO_MTIME)) @@ -2303,7 +2301,7 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs, unsigned long int size; const char *data; - GP_DEBUG ("Searching data for mtime..."); + GP_LOG_D ("Searching data for mtime..."); CR (gp_file_get_data_and_size (file, NULL, &size)); if (size < 32*1024*1024) { /* just assume stuff above 32MB is not EXIF capable */ CR (gp_file_get_data_and_size (file, &data, &size)); @@ -2315,7 +2313,7 @@ gp_filesystem_set_file_noop (CameraFilesystem *fs, * GP_FILE_TYPE_EXIF that includes information on the mtime. */ if (!t) { - GP_DEBUG ("Trying EXIF information..."); + GP_LOG_D ("Trying EXIF information..."); t = gp_filesystem_get_exif_mtime (fs, folder, filename); } #endif diff --git a/libgphoto2/gphoto2-setting.c b/libgphoto2/gphoto2-setting.c index bd27886e0..bd512be63 100644 --- a/libgphoto2/gphoto2-setting.c +++ b/libgphoto2/gphoto2-setting.c @@ -35,8 +35,6 @@ #include <gphoto2/gphoto2-port-log.h> #include <gphoto2/gphoto2-port-portability.h> -#define GP_MODULE "setting" - /** * Internal struct to store settings. */ @@ -137,7 +135,7 @@ verify_settings (char *settings_file) unsigned int x, equals; if ((f=fopen(settings_file, "r"))==NULL) { - GP_DEBUG ("Can't open settings file for reading"); + GP_LOG_E ("Can't open settings file for reading."); return(0); } @@ -155,7 +153,7 @@ verify_settings (char *settings_file) if (equals < 2) { fclose (f); - GP_DEBUG ("Incorrect settings format. resetting\n"); + GP_LOG_E ("Incorrect settings format. Resetting."); unlink(settings_file); return (GP_ERROR); } @@ -173,7 +171,7 @@ load_settings (void) char buf[1024], *id, *key, *value; /* Make sure the directories are created */ - GP_DEBUG ("Creating $HOME/.gphoto"); + GP_LOG_D ("Creating $HOME/.gphoto"); #ifdef WIN32 GetWindowsDirectory (buf, sizeof(buf)); strcat (buf, "\\gphoto"); @@ -193,10 +191,10 @@ load_settings (void) if (verify_settings(buf) != GP_OK) /* verify_settings will unlink and recreate the settings file */ return (GP_OK); - GP_DEBUG ("Loading settings from file \"%s\"", buf); + GP_LOG_D ("Loading settings from file '%s'.", buf); if ((f=fopen(buf, "r"))==NULL) { - GP_DEBUG ("Can't open settings for reading"); + GP_LOG_D ("Can't open settings file for reading."); return(GP_ERROR); } @@ -237,7 +235,7 @@ save_settings (void) glob_setting_count, buf); if ((f=fopen(buf, "w+"))==NULL) { - GP_DEBUG ("Can't open settings file for writing"); + GP_LOG_E ("Can't open settings file for writing."); return(0); } rewind(f); |