diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 50f8efd7f..8a0a391b5 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -273,6 +273,14 @@ camera_prepare_canon_eos_capture(Camera *camera, GPContext *context) { } params->eos_camerastatus = -1; /* aka unknown */ + if (ptp_operation_issupported(params, PTP_OC_CANON_EOS_SetRequestOLCInfoGroup)) { + ret = ptp_canon_eos_setrequestolcinfogroup(params,0x00000fff); + if (ret != PTP_RC_OK) { + gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "setrqolcinfogroup 0xfff failed!"); + return translate_ptp_result (ret); + } + } + /* Get the initial bulk set of event data */ ret = ptp_check_eos_events (params); if (ret != PTP_RC_OK) { diff --git a/camlibs/ptp2/ptp-pack.c b/camlibs/ptp2/ptp-pack.c index 272d0f580..a0a904efe 100644 --- a/camlibs/ptp2/ptp-pack.c +++ b/camlibs/ptp2/ptp-pack.c @@ -1984,6 +1984,57 @@ ptp_unpack_CANON_changes (PTPParams *params, unsigned char* data, int datasize, break; } + /* one more information record handed to us */ + case PTP_EC_CANON_EOS_OLCInfoChanged: { + uint32_t len, curoff; + uint16_t mask,proptype; + unsigned int j; + PTPDevicePropDesc *dpd; + + /* unclear what OLC stands for */ + ptp_debug (params, "event %d: EOS event OLCInfoChanged (size %d)", i, size); + if (size >= 0x8) { /* event info */ + unsigned int j; + for (j=8;jnrofcanon_props;j++) + if (params->canon_props[j].proptype == proptype) + break; + if (j == params->nrofcanon_props) + ptp_debug (params, "event %d: shutterspeed not found yet, handle this", i); + + dpd = ¶ms->canon_props[j].dpd; + dpd->CurrentValue.u16 = curdata[curoff+5]; /* just use last byte */ + + (*ce)[i].type = PTP_CANON_EOS_CHANGES_TYPE_PROPERTY; + (*ce)[i].u.propid = proptype; + curoff += 6; + break; + } + /* handle more masks */ + (*ce)[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; + (*ce)[i].u.info = malloc(strlen("OLCInfo event mask 0123456789")); + sprintf((*ce)[i].u.info, "OLCInfo event mask=%x", dtoh16a(curdata+8+2)); + break; + } case PTP_EC_CANON_EOS_CameraStatusChanged: (*ce)[i].type = PTP_CANON_EOS_CHANGES_TYPE_CAMERASTATUS; (*ce)[i].u.status = dtoh32a(curdata+8); diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h index 9d44a5fc3..c44fedc2b 100644 --- a/camlibs/ptp2/ptp.h +++ b/camlibs/ptp2/ptp.h @@ -2766,6 +2766,10 @@ uint16_t ptp_canon_checkevent (PTPParams* params, * Return values: Some PTP_RC_* code. * **/ +#define CANON_EOS_OLC_BUTTON 0x0001 +#define CANON_EOS_OLC_SHUTTERSPEED 0x0002 + +#define ptp_canon_eos_setrequestolcinfogroup(params,igmask) ptp_generic_no_data(params,PTP_OC_CANON_EOS_SetRequestOLCInfoGroup,1,igmask) #define ptp_canon_eos_requestdevicepropvalue(params,prop) ptp_generic_no_data(params,PTP_OC_CANON_EOS_RequestDevicePropValue,1,prop) uint16_t ptp_canon_eos_capture (PTPParams* params, uint32_t *result); uint16_t ptp_canon_eos_getevent (PTPParams* params, PTPCanon_changes_entry **entries, int *nrofentries);