diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2006-05-13 19:50:54 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2006-05-13 19:50:54 +0000 |
commit | fbb0aac00b18e94bf7768e1b292e11c6bce52a08 (patch) | |
tree | 9aec8f4b96607a33cda820ed16b69ba5bb2a14a5 | |
parent | 17467126db41b149a92cd5bed2cdab07247fbd8f (diff) | |
download | libgphoto2-fbb0aac00b18e94bf7768e1b292e11c6bce52a08.tar.gz |
added fixes from mainline, minus the the new development ones.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_2/libgphoto2@8792 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | camlibs/ptp2/ChangeLog | 8 | ||||
-rw-r--r-- | camlibs/ptp2/library.c | 46 | ||||
-rw-r--r-- | camlibs/ptp2/ptp.c | 38 | ||||
-rw-r--r-- | camlibs/ptp2/ptp.h | 7 |
4 files changed, 66 insertions, 33 deletions
diff --git a/camlibs/ptp2/ChangeLog b/camlibs/ptp2/ChangeLog index c8e2bdbae..653c383ff 100644 --- a/camlibs/ptp2/ChangeLog +++ b/camlibs/ptp2/ChangeLog @@ -1,3 +1,11 @@ +2006-04-27 Marcus Meissner <marcus@jet.franken.de> + + * ptp.c: The iRiver devices occasionaly send a byte more than + we requested which could lead to memory corruption due to + logic that did not expect that. + + * library.c: Replaced fprintf by gp_log in parse_metadata. + 2006-04-17 Marcus Meissner <marcus@jet.franken.de> * ptp.c, library.c: Added several more Nikon DSLR config options. diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 1a1793ea0..812852b86 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -373,6 +373,7 @@ static struct { {"Sony:DSC-W12 (PTP mode)", 0x054c, 0x004e, 0}, {"Sony:MVC-CD300 (PTP mode)", 0x054c, 0x004e, 0}, {"Sony:MVC-CD500 (PTP mode)", 0x054c, 0x004e, 0}, + {"Sony:DSC-U10 (PTP mode)", 0x054c, 0x004e, 0}, /* Nikon Coolpix 2500: M. Meissner, 05 Oct 2003 */ {"Nikon:Coolpix 2500 (PTP mode)", 0x04b0, 0x0109, 0}, @@ -442,6 +443,9 @@ static struct { /* https://sourceforge.net/tracker/index.php?func=detail&aid=1405541&group_id=8874&atid=358874 */ {"Panasonic:DMC-LC1", 0x04da, 0x2372, 0}, + /* Søren Krarup Olesen <sko@acoustics.aau.dk> */ + {"Leica:D-LUX 2", 0x04da, 0x2375, 0}, + /* http://sourceforge.net/tracker/index.php?func=detail&aid=1275100&group_id=8874&atid=358874 */ {"Panasonic:Lumix FZ5", 0x04da, 0x2372, 0}, @@ -590,6 +594,8 @@ static struct { {"iRiver:T30", 0x4102, 0x1119, 0}, /* Petr Spatka spatka@luzanky.cz */ {"iRiver:H10", 0x4102, 0x2102, 0}, + {"iRiver:Portable Media Center", 0x1006, 0x4002, 0 }, + {"iRiver:Portable Media Center", 0x1006, 0x4003, 0 }, /* From: thanosz@softhome.net */ {"Philipps:HDD6320", 0x0471, 0x01eb, 0}, /* borrowed from libmtp source */ @@ -602,14 +608,24 @@ static struct { {"Creative:Zen Sleek", 0x041e, 0x4137, 0}, /* Jennifer Scalf <oneferna@gmail.com> */ {"Creative:Zen MicroPhoto", 0x041e, 0x413c, 0}, + {"Creative:Zen Sleek Photo", 0x041e, 0x413d, 0 }, {"Creative:Zen Vision:M", 0x041e, 0x413e, 0}, + /* http://sourceforge.net/tracker/index.php?func=detail&aid=1474056&group_id=8874&atid=108874 */ + {"Samsung:YP-T7J", 0x04e8, 0x5047, 0 }, + /* IRC reporter */ {"Dell:DJ Itty", 0x413c, 0x4500, 0}, /* Marcoen Hirschberg <marcoen@users.sourceforge.net> */ {"Toshiba:Gigabeat", 0x0930, 0x000c, 0}, + /* From Mark Veinot */ + {"JVC:Alneo XA-HD500", 0x04f1, 0x6105, 0}, + + {"Samsung:YH-999 Portable Media Center",0x04e8, 0x5a0f, 0 }, + {"Intel:Bandon Portable Media Center", 0x045e, 0x00c9, 0 }, + /* more coming soon :) */ {NULL, 0, 0, 0} }; @@ -1256,7 +1272,6 @@ camera_nikon_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pa static int capcnt = 0; PTPObjectInfo oi; PTPParams *params = &camera->pl->params; - uint32_t newobject = 0x0; PTPDevicePropDesc propdesc; int i, ret, hasc101 = 0, burstnumber = 1; @@ -1302,18 +1317,13 @@ camera_nikon_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pa free (nevent); } - /* FIXME: We only know the first Object ID, but not the later - * ones in burst mode. So reduce to 1. -Marcus - */ - burstnumber = 1; - for (i=0;i<burstnumber;i++) { - newobject = 0xffff0001 - i; - - /* FIXME: handle multiple images (as in BurstMode) */ - ret = ptp_getobjectinfo (params, newobject, &oi); + /* In Burst mode, the image is always 0xffff0001. + * The firmware just gives us one after the other for the same ID + */ + ret = ptp_getobjectinfo (params, 0xffff0001, &oi); if (ret != PTP_RC_OK) { - fprintf (stderr,"getobjectinfo(%x) failed: %d\n", newobject, ret); + fprintf (stderr,"getobjectinfo(%x) failed: %d\n", 0xffff0001, ret); return GP_ERROR_IO; } if (oi.ParentObject != 0) @@ -1323,7 +1333,7 @@ camera_nikon_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pa oi.StorageID = 0x00010001; sprintf (path->folder,"/"STORAGE_FOLDER_PREFIX"%08lx",(unsigned long)oi.StorageID); sprintf (path->name, "capt%04d.jpg", capcnt++); - ret = add_objectid_to_gphotofs(camera, path, context, newobject, &oi); + ret = add_objectid_to_gphotofs(camera, path, context, 0xffff0001, &oi); if (ret != GP_OK) { fprintf (stderr, "failed to add object\n"); return ret; @@ -3650,7 +3660,7 @@ static struct submenu capture_settings_menu[] = { { N_("Image Rotation Flag"), "imagerotationflag", PTP_DPC_NIKON_ImageRotation, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_OnOff_UINT8, _put_Nikon_OnOff_UINT8}, { N_("Release without CF card"), "nocfcardrelease", PTP_DPC_NIKON_NoCFCard, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_OnOff_UINT8, _put_Nikon_OnOff_UINT8}, { N_("Flash Mode Manual Power"), "flashmodemanualpower", PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_FlashModeManualPower, _put_Nikon_FlashModeManualPower}, - { N_("Auto Focus Area Power"), "autofocusarea", PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_AutofocusArea, _put_Nikon_AutofocusArea}, + { N_("Auto Focus Area"), "autofocusarea", PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_AutofocusArea, _put_Nikon_AutofocusArea}, { N_("Flash Exposure Compensation"), "flashexposurecompensation", PTP_DPC_NIKON_FlashExposureCompensation, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_FlashExposureCompensation, _put_Nikon_FlashExposureCompensation}, { N_("Bracket Set"), "bracketset", PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_BracketSet, _put_Nikon_BracketSet}, { N_("Bracket Order"), "bracketorder", PTP_DPC_NIKON_BracketOrder, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_BracketOrder, _put_Nikon_BracketOrder}, @@ -4071,7 +4081,7 @@ ptp_mtp_render_metadata ( default:sprintf (text, "Unknown type %d", opd.DataType); break; case PTP_DTC_STR: - snprintf (text, sizeof(text), "%s", pv.str); + snprintf (text, sizeof(text), "%s", pv.str?pv.str:""); break; case PTP_DTC_INT32: sprintf (text, "%d", pv.i32); @@ -4164,15 +4174,17 @@ ptp_mtp_parse_metadata ( *end = '\0'; content = strdup(begin); *end = '<'; - fprintf (stderr, "found tag %s, content %s\n", propname, content); + gp_log (GP_LOG_DEBUG, "ptp2", "found tag %s, content %s", propname, content); ret = ptp_mtp_getobjectpropdesc (params, props[j], ofc, &opd); if (ret != PTP_RC_OK) { - fprintf (stderr," getobjectpropdesc returns 0x%x\n", ret); + gp_log (GP_LOG_DEBUG, "ptp2", " getobjectpropdesc returns 0x%x", ret); free (content); content = NULL; continue; } - if (opd.GetSet == 0) /* property is read/only */ + if (opd.GetSet == 0) { + gp_log (GP_LOG_DEBUG, "ptp2", "Tag %s is read only, sorry.", propname); continue; + } switch (opd.DataType) { default:gp_log (GP_LOG_ERROR, "ptp2", "mtp parser: Unknown datatype %d, content %s", opd.DataType, content); free (content); content = NULL; diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index f5dacf774..8403b4aa5 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -191,6 +191,12 @@ ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, ret = dtoh16(usbdata.code); break; } + if (rlen > dtoh32(usbdata.length)) { + /* I observed this on iRiver MTP devices. -Marcus */ + ptp_debug (params, "ptp2/ptp_usb_getdata: read %d bytes too much, expect problems!", rlen - dtoh32(usbdata.length) + ); + rlen = dtoh32(usbdata.length); + } /* For most PTP devices rlen is 512 == sizeof(usbdata) * here. For MTP devices splitting header and data it might @@ -2211,29 +2217,29 @@ ptp_get_property_description(PTPParams* params, uint16_t dpc) {PTP_DPC_NIKON_NonCPULensDataMaximumAperture, /* 0xD02f */ N_("Lens Max. Aperture (Non CPU)")}, {PTP_DPC_NIKON_CSMMenuBankSelect, /* 0xD040 */ - N_("PTP_DPC_NIKON_CSMMenuBankSelect")}, + "PTP_DPC_NIKON_CSMMenuBankSelect"}, {PTP_DPC_NIKON_MenuBankNameA, /* 0xD041 */ - N_("PTP_DPC_NIKON_MenuBankNameA")}, + "PTP_DPC_NIKON_MenuBankNameA"}, {PTP_DPC_NIKON_MenuBankNameB, /* 0xD042 */ - N_("PTP_DPC_NIKON_MenuBankNameB")}, + "PTP_DPC_NIKON_MenuBankNameB"}, {PTP_DPC_NIKON_MenuBankNameC, /* 0xD043 */ - N_("PTP_DPC_NIKON_MenuBankNameC")}, + "PTP_DPC_NIKON_MenuBankNameC"}, {PTP_DPC_NIKON_MenuBankNameD, /* 0xD044 */ - N_("PTP_DPC_NIKON_MenuBankNameD")}, + "PTP_DPC_NIKON_MenuBankNameD"}, {PTP_DPC_NIKON_A1AFCModePriority, /* 0xD048 */ - N_("PTP_DPC_NIKON_A1AFCModePriority")}, + "PTP_DPC_NIKON_A1AFCModePriority"}, {PTP_DPC_NIKON_A2AFSModePriority, /* 0xD049 */ - N_("PTP_DPC_NIKON_A2AFSModePriority")}, + "PTP_DPC_NIKON_A2AFSModePriority"}, {PTP_DPC_NIKON_A3GroupDynamicAF, /* 0xD04a */ - N_("PTP_DPC_NIKON_A3GroupDynamicAF")}, + "PTP_DPC_NIKON_A3GroupDynamicAF"}, {PTP_DPC_NIKON_A4AFActivation, /* 0xD04b */ - N_("PTP_DPC_NIKON_A4AFActivation")}, + "PTP_DPC_NIKON_A4AFActivation"}, {PTP_DPC_NIKON_A5FocusAreaIllumManualFocus, /* 0xD04c */ - N_("PTP_DPC_NIKON_A5FocusAreaIllumManualFocus")}, + "PTP_DPC_NIKON_A5FocusAreaIllumManualFocus"}, {PTP_DPC_NIKON_FocusAreaIllumContinuous, /* 0xD04d */ - N_("PTP_DPC_NIKON_FocusAreaIllumContinuous")}, + "PTP_DPC_NIKON_FocusAreaIllumContinuous"}, {PTP_DPC_NIKON_FocusAreaIllumWhenSelected, /* 0xD04e */ - N_("PTP_DPC_NIKON_FocusAreaIllumWhenSelected")}, + "PTP_DPC_NIKON_FocusAreaIllumWhenSelected"}, {PTP_DPC_NIKON_FocusAreaWrap, /* 0xD04f */ N_("Focus Area Wrap")}, {PTP_DPC_NIKON_A7VerticalAFON, /* 0xD050 */ @@ -2265,17 +2271,17 @@ ptp_get_property_description(PTPParams* params, uint16_t dpc) {PTP_DPC_NIKON_D2MaximumShots, /* 0xD069 */ N_("Max. Shots")}, {PTP_DPC_NIKON_D3ExpDelayMode, /* 0xD06a */ - N_("PTP_DPC_NIKON_D3ExpDelayMode")}, + "PTP_DPC_NIKON_D3ExpDelayMode"}, {PTP_DPC_NIKON_LongExposureNoiseReduction, /* 0xD06b */ N_("Long Exposure Noise Reduction")}, {PTP_DPC_NIKON_FileNumberSequence, /* 0xD06c */ N_("File Number Sequencing")}, {PTP_DPC_NIKON_D6ControlPanelFinderRearControl, /* 0xD06d */ - N_("PTP_DPC_NIKON_D6ControlPanelFinderRearControl")}, + "PTP_DPC_NIKON_D6ControlPanelFinderRearControl"}, {PTP_DPC_NIKON_ControlPanelFinderViewfinder, /* 0xD06e */ - N_("PTP_DPC_NIKON_ControlPanelFinderViewfinder")}, + "PTP_DPC_NIKON_ControlPanelFinderViewfinder"}, {PTP_DPC_NIKON_D7Illumination, /* 0xD06f */ - N_("PTP_DPC_NIKON_D7Illumination")}, + "PTP_DPC_NIKON_D7Illumination"}, {PTP_DPC_NIKON_E1FlashSyncSpeed, /* 0xD074 */ N_("Flash Sync. Speed")}, {PTP_DPC_NIKON_FlashShutterSpeed, /* 0xD075 */ diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h index b1e03497c..e862423d8 100644 --- a/camlibs/ptp2/ptp.h +++ b/camlibs/ptp2/ptp.h @@ -244,6 +244,7 @@ typedef struct _PTPIPHeader PTPIPHeader; #define PTP_OC_MTP_SendObjectPropList 0x9808 #define PTP_OC_MTP_GetObjectReferences 0x9810 #define PTP_OC_MTP_SetObjectReferences 0x9811 +#define PTP_OC_MTP_UpdateDeviceFirmware 0x9812 /* Proprietary vendor extension operations mask */ #define PTP_OC_EXTENSION_MASK 0xF000 @@ -338,6 +339,11 @@ typedef struct _PTPIPHeader PTPIPHeader; /* Gets 1 parameter, objectid pointing to DPOF object */ #define PTP_EC_Nikon_AdvancedTransfer 0xC103 +/* constants for GetObjectHandles */ +#define PTP_GOH_ALL_STORAGE 0xffffffff +#define PTP_GOH_ALL_FORMATS 0x00000000 +#define PTP_GOH_ALL_ASSOCS 0x00000000 + /* PTP device info structure (returned by GetDevInfo) */ struct _PTPDeviceInfo { @@ -872,6 +878,7 @@ typedef struct _PTPEKTextParams PTPEKTextParams; #define PTP_DPC_NIKON_FlashModeManualPower 0xD16D #define PTP_DPC_NIKON_FlashModeCommanderPower 0xD16E #define PTP_DPC_NIKON_CSMMenu 0xD180 +#define PTP_DPC_NIKON_BracketingFramesAndSteps 0xD190 #define PTP_DPC_NIKON_LowLight 0xD1B0 #define PTP_DPC_NIKON_FlashOpen 0xD1C0 #define PTP_DPC_NIKON_FlashCharged 0xD1C1 |