From: <mar...@us...> - 2009-01-16 08:32:36
|
Revision: 11707 http://gphoto.svn.sourceforge.net/gphoto/?rev=11707&view=rev Author: marcusmeissner Date: 2009-01-16 08:32:22 +0000 (Fri, 16 Jan 2009) Log Message: ----------- merged last days additions Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/ChangeLog trunk/libgphoto2/camlibs/ptp2/config.c trunk/libgphoto2/camlibs/ptp2/library.c trunk/libgphoto2/camlibs/ptp2/ptp.c trunk/libgphoto2/camlibs/ptp2/ptp.h Modified: trunk/libgphoto2/camlibs/ptp2/ChangeLog =================================================================== --- trunk/libgphoto2/camlibs/ptp2/ChangeLog 2009-01-15 10:56:10 UTC (rev 11706) +++ trunk/libgphoto2/camlibs/ptp2/ChangeLog 2009-01-16 08:32:22 UTC (rev 11707) @@ -1,7 +1,11 @@ -2009-01-13 Marcus Meissner <ma...@je...> +2009-01-15 Marcus Meissner <ma...@je...> - * library.c: Added Nikon D90. + * config.c: Enable viewfinder in enable capture for Powershots, + so we can just --set-config capture=1 --set-config output=0 + or so. + * library.c: Added Nikon D90 and its hidden properties. + 2009-01-08 Marcus Meissner <ma...@je...> * library.c: Added set_info_func, to set/reset Object Protection Modified: trunk/libgphoto2/camlibs/ptp2/config.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/config.c 2009-01-15 10:56:10 UTC (rev 11706) +++ trunk/libgphoto2/camlibs/ptp2/config.c 2009-01-16 08:32:22 UTC (rev 11707) @@ -134,6 +134,12 @@ event.length,event.type,event.code,event.trans_id, event.param1, event.param2, event.param3); } + if (ptp_operation_issupported(params, PTP_OC_CANON_ViewfinderOn)) { + ret = ptp_canon_viewfinderon (params); + if (ret != PTP_RC_OK) + gp_log (GP_LOG_ERROR, "ptp", _("Canon enable viewfinder failed: %d"), ret); + /* ignore errors here */ + } /* Catch event, attempt 2 */ if (val16!=PTP_RC_OK) { if (PTP_RC_OK==params->event_wait (params, &evc)) { @@ -196,12 +202,12 @@ gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9110 of d11c to 1 failed!"); return GP_ERROR; } - ret = ptp_getdeviceinfo(&camera->pl->params, &camera->pl->params.deviceinfo); + ret = ptp_getdeviceinfo(params, ¶ms->deviceinfo); if (ret != PTP_RC_OK) { gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "getdeviceinfo failed!"); return GP_ERROR; } - fixup_cached_deviceinfo (camera, &camera->pl->params.deviceinfo); + fixup_cached_deviceinfo (camera, ¶ms->deviceinfo); ret = ptp_canon_eos_getstorageids(params, &sids); if (ret != PTP_RC_OK) { gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9101 failed!"); @@ -270,15 +276,22 @@ static int camera_unprepare_canon_powershot_capture(Camera *camera, GPContext *context) { uint16_t ret; + PTPParams *params = &camera->pl->params; - ret = ptp_canon_endshootingmode (&camera->pl->params); + ret = ptp_canon_endshootingmode (params); if (ret != PTP_RC_OK) { gp_log (GP_LOG_DEBUG, "ptp", "end shooting mode error %d\n", ret); return GP_ERROR; } + if (ptp_operation_issupported(params, PTP_OC_CANON_ViewfinderOff)) { + ret = ptp_canon_viewfinderoff (params); + if (ret != PTP_RC_OK) + gp_log (GP_LOG_ERROR, "ptp", _("Canon disable viewfinder failed: %d"), ret); + /* ignore errors here */ + } /* Reget device info, they change on the Canons. */ - ptp_getdeviceinfo(&camera->pl->params, &camera->pl->params.deviceinfo); - fixup_cached_deviceinfo (camera, &camera->pl->params.deviceinfo); + ptp_getdeviceinfo(params, ¶ms->deviceinfo); + fixup_cached_deviceinfo (camera, ¶ms->deviceinfo); return GP_OK; } @@ -1140,6 +1153,9 @@ static struct deviceproptableu8 nikon_afmode[] = { { N_("AF-S"), 0, 0 }, { N_("AF-C"), 1, 0 }, + { N_("AF-A"), 2, 0 }, + { "AF Mode 3? report.", 3, 0 }, + { N_("Manual"), 4, 0 }, /* more for newer */ }; GENERIC8TABLE(Nikon_AFMode,nikon_afmode) @@ -1456,6 +1472,8 @@ { N_("Sports"), 0x8014, PTP_VENDOR_NIKON}, { N_("Night Portrait"), 0x8015, PTP_VENDOR_NIKON}, { N_("Night Landscape"),0x8016, PTP_VENDOR_NIKON}, + { N_("Children"), 0x8017, PTP_VENDOR_NIKON}, + { N_("Automatic (No Flash)"), 0x8018, PTP_VENDOR_NIKON}, }; GENERIC16TABLE(ExposureProgram,exposure_program_modes) @@ -1468,7 +1486,8 @@ { N_("Timer"), 0x8011, PTP_VENDOR_NIKON}, { N_("Mirror Up"), 0x8012, PTP_VENDOR_NIKON}, { N_("Remote"), 0x8013, PTP_VENDOR_NIKON}, - { N_("Timer + Remote"), 0x8014, PTP_VENDOR_NIKON}, + { N_("Timer + Remote"), 0x8014, PTP_VENDOR_NIKON}, /* others nikons */ + { N_("Timer + Remote 2"), 0x8015, PTP_VENDOR_NIKON}, /* d90 */ }; GENERIC16TABLE(CaptureMode,capture_mode) @@ -2055,6 +2074,7 @@ {"AF-S Nikkor 18-200mm 1:3.5-5.6 GED DX VR", 139, 0}, {"AF-S Nikkor 24-70mm 1:2.8G ED DX", 147, 0}, {"AF-S Nikkor 18-55mm 1:3.5-F5.6G DX VR", 154, 0}, + {"Sigma EX 30mm 1:1.4 DC HSM", 248, 0}, /* from eckermann */ }; GENERIC8TABLE(Nikon_LensID,nikon_lensid) Modified: trunk/libgphoto2/camlibs/ptp2/library.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/library.c 2009-01-15 10:56:10 UTC (rev 11706) +++ trunk/libgphoto2/camlibs/ptp2/library.c 2009-01-16 08:32:22 UTC (rev 11707) @@ -396,6 +396,28 @@ 0xd200, 0xd201 }; +/* From Matthias Eckermanns D40x, extracted by Marcus. */ +const static uint16_t nikon_d40x_extra_props[] = { +0xd017, 0xd018, 0xd019, 0xd01a, 0xd01b, 0xd01c, 0xd01d, 0xd01f, +0xd025, 0xd026, 0xd02a, 0xd02b, 0xd02c, 0xd02d, +0xd045, +0xd054, 0xd05e, 0xd05f, +0xd062, 0xd063, 0xd064, 0xd065, 0xd066, 0xd06b, 0xd06c, +0xd084, 0xd08a, +0xd090, 0xd091, 0xd092, +0xd0e0, 0xd0e1, 0xd0e2, 0xd0e3, 0xd0e4, 0xd0e5, 0xd0e6, +0xd100, 0xd101, 0xd102, 0xd103, 0xd104, 0xd105, +0xd108, 0xd109, 0xd10b, 0xd10d, 0xd10e, +0xd120, 0xd121, 0xd122, 0xd124, 0xd125, 0xd126, +0xd140, 0xd142, +0xd160, 0xd161, 0xd163, 0xd164, 0xd165, 0xd167, +0xd16a, 0xd16b, 0xd16d, +0xd183, +0xd1b0, 0xd1b1, 0xd1b2, +0xd1c0, 0xd1c1, +0xd1e0, 0xd1e1 +}; + static const struct { uint16_t productid; const uint16_t *extraprops; @@ -410,7 +432,9 @@ /* D90 - confirmed by Marcus */ { 0x421, nikon_d90_extra_props, sizeof(nikon_d90_extra_props)/sizeof(nikon_d90_extra_props[0]) }, /* D200 - guessed by Marcus */ - { 0x410, nikon_d200_extra_props, sizeof(nikon_d200_extra_props)/sizeof(nikon_d200_extra_props[0]) } + { 0x410, nikon_d200_extra_props, sizeof(nikon_d200_extra_props)/sizeof(nikon_d200_extra_props[0]) }, + /* D40x - confirmed by Marcus */ + { 0x418, nikon_d40x_extra_props, sizeof(nikon_d40x_extra_props)/sizeof(nikon_d40x_extra_props[0]) } }; void @@ -1560,16 +1584,20 @@ gp_file_set_name(file, path->name); set_mimetype (camera, file, params->deviceinfo.VendorExtensionID, oi->ObjectFormat); CPR (context, ptp_getobject(params, newobject, &ximage)); + + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "setting size"); ret = gp_file_set_data_and_size(file, (char*)ximage, oi->ObjectCompressedSize); if (ret != GP_OK) { gp_file_free (file); return ret; } + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "append to fs"); ret = gp_filesystem_append(camera->fs, path->folder, path->name, context); if (ret != GP_OK) { gp_file_free (file); return ret; } + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "adding filedata to fs"); ret = gp_filesystem_set_file_noop(camera->fs, path->folder, file, context); if (ret != GP_OK) { gp_file_free (file); @@ -1594,6 +1622,7 @@ info.preview.width = oi->ThumbPixWidth; info.preview.height = oi->ThumbPixHeight; info.preview.size = oi->ThumbCompressedSize; + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "setting fileinfo in fs"); return gp_filesystem_set_info_noop(camera->fs, path->folder, info, context); } @@ -4942,6 +4971,14 @@ add_special_file("selftimer.wav", canon_theme_get, canon_theme_put); } #endif +#if 0 + { + unsigned char *x; + unsigned long l; + if (ptp_operation_issupported(&camera->pl->params, PTP_OC_CANON_EOS_GetDeviceInfoEx)) + ptp_canon_eos_getdeviceinfo (&camera->pl->params, &x, &l); + } +#endif break; case PTP_VENDOR_NIKON: if (ptp_operation_issupported(&camera->pl->params, PTP_OC_NIKON_CurveDownload)) Modified: trunk/libgphoto2/camlibs/ptp2/ptp.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/ptp.c 2009-01-15 10:56:10 UTC (rev 11706) +++ trunk/libgphoto2/camlibs/ptp2/ptp.c 2009-01-16 08:32:22 UTC (rev 11707) @@ -415,7 +415,23 @@ return ret; } +uint16_t +ptp_canon_eos_getdeviceinfo (PTPParams* params, unsigned char**di, unsigned long *len ) +{ + uint16_t ret; + PTPContainer ptp; + PTPDataHandler handler; + ptp_init_recv_memory_handler (&handler); + PTP_CNT_INIT(ptp); + ptp.Code=PTP_OC_CANON_EOS_GetDeviceInfoEx; + ptp.Nparam=0; + *len=0; + ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler); + ptp_exit_recv_memory_handler (&handler, di, len); + return ret; +} + /** * ptp_opensession: * params: PTPParams* Modified: trunk/libgphoto2/camlibs/ptp2/ptp.h =================================================================== --- trunk/libgphoto2/camlibs/ptp2/ptp.h 2009-01-15 10:56:10 UTC (rev 11706) +++ trunk/libgphoto2/camlibs/ptp2/ptp.h 2009-01-16 08:32:22 UTC (rev 11707) @@ -1832,6 +1832,7 @@ uint32_t handle, PTPCANONFolderEntry** entries, uint32_t* entnum); +uint16_t ptp_canon_eos_getdeviceinfo (PTPParams* params, unsigned char**di, unsigned long *len ); uint16_t ptp_canon_get_objecthandle_by_name (PTPParams* params, char* name, uint32_t* objectid); uint16_t ptp_canon_get_directory (PTPParams* params, PTPObjectHandles *handles, PTPObjectInfo **oinfos, uint32_t **flags); uint16_t ptp_canon_setobjectarchive (PTPParams* params, uint32_t oid, uint32_t flags); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |