Skip to content

Commit

Permalink
do not emit keepdeviceon if its not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
msmeissn committed Aug 24, 2017
1 parent b64dbfe commit 79b9913
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions camlibs/ptp2/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -2663,7 +2663,7 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
ptp_free_devicepropdesc (&dpd);

/* Otherwise the camera will auto-shutdown */
C_PTP (ptp_canon_eos_keepdeviceon (params));
if (ptp_operation_issupported(params, PTP_OC_CANON_KeepDeviceOn)) C_PTP (ptp_canon_eos_keepdeviceon (params));

params->inliveview = 1;
event_start = time_now();
Expand Down Expand Up @@ -3512,7 +3512,7 @@ camera_canon_eos_capture (Camera *camera, CameraCaptureType type, CameraFilePath
break;

/* not really proven to help keep it on */
C_PTP_REP (ptp_canon_eos_keepdeviceon (params));
if (ptp_operation_issupported(params, PTP_OC_CANON_KeepDeviceOn)) C_PTP_REP (ptp_canon_eos_keepdeviceon (params));
gp_context_idle (context);
} while (waiting_for_timeout (&back_off_wait, capture_start, EOS_CAPTURE_TIMEOUT));

Expand Down Expand Up @@ -4851,7 +4851,7 @@ camera_wait_for_event (Camera *camera, int timeout,
PTPCanon_changes_entry entry;

/* keep device alive */
C_PTP (ptp_canon_eos_keepdeviceon (params));
if (ptp_operation_issupported(params, PTP_OC_CANON_KeepDeviceOn)) C_PTP (ptp_canon_eos_keepdeviceon (params));

C_PTP_REP_MSG (ptp_check_eos_events (params),
_("Canon EOS Get Changes failed"));
Expand Down

7 comments on commit 79b9913

@axxel
Copy link
Contributor

@axxel axxel commented on 79b9913 Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that while using --wait-for-event there is a keepdeviceon packet send to the camera for every event that is pulled from the backlog. This is clearly overkill. Given that one comment reads not really proven to help keep it on, I wonder why these calls are made at all. Is there a known situation where this call makes a difference?

@msmeissn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its needed. I did not experiment on it.
but we can reduce it to once every 5 seconds perhaps

@axxel
Copy link
Contributor

@axxel axxel commented on 79b9913 Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember when/why it was added? Do you believe that e.g. simply polling the event queue will not be sufficient to prevent the camera from shutting down?

@axxel
Copy link
Contributor

@axxel axxel commented on 79b9913 Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented your idea of limiting the number of keepdeviceon ptp transactions (to 1 every 10 seconds) in #1011.

Note this whole endeavor is related to my question in #968 about the best way to wait for the moment the camera is capable of accepting the next config/capture command.

@msmeissn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

started testing .. . takes a bit as i need charge batteries

EOS2000D - when polling events does NOT shut down after 30s timeout configured
EOS1000D - same

@axxel
Copy link
Contributor

@axxel axxel commented on 79b9913 Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that you merged #1011, I assume you found that sending those keepdeviceon ptp packets does something useful for at least one Canon body?

Just to put out the number somewhere: my R8 shuts down after 6 minutes when auto-power-off is set to 15s but the device is connected to USB without any traffic (no gphoto2 process running).

@msmeissn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would leave them in for now.
I remember the single digit bodys had some reports for it, but I cannot find them currently.

Please sign in to comment.