From 1dd294e4054a4f52093b3982671f50069fa51612 Mon Sep 17 00:00:00 2001 From: axxel Date: Sat, 28 Sep 2024 12:08:39 +0200 Subject: [PATCH 1/3] remove lots of "discarding event type" lines from the debug log 200 lines of "discarding event type %d" on capture_image in the log is not helpful. Replace with one line "discarding %d EOS events". --- camlibs/ptp2/library.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 939809f10..403291aab 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -5990,11 +5990,14 @@ camera_trigger_canon_eos_capture (Camera *camera, GPContext *context) else CR( camera_canon_eos_update_capture_target(camera, context, -1)); - /* Get the initial bulk set of event data, otherwise - * capture might return busy. */ + /* Get all pending event data from the camera, otherwise capture might return busy. */ ptp_check_eos_events (params); - while (ptp_get_one_eos_event (params, &entry)) - GP_LOG_D("discarding event type %d", entry.type); + + /* Discard all collected events before starting the next capture. */ + GP_LOG_D("discarding %d EOS events", params->nrofbacklogentries); + free (params->backlogentries); + params->backlogentries = NULL; + params->nrofbacklogentries = 0; if (params->eos_camerastatus == 1) return GP_ERROR_CAMERA_BUSY; From 57e3f3e1efbaf23ace6826bc37cd643f06e94078 Mon Sep 17 00:00:00 2001 From: axxel Date: Sat, 28 Sep 2024 12:13:19 +0200 Subject: [PATCH 2/3] ptp2: make ptp_debug_data output easier to parse at a glance * replace "00 " with " - " * don't repeat lines with all zeros e.g.: ``` event 146: EOS prop d212 value changed, size 408 ((null)) 0x000: 0a - - - 01 - - - - - - - - - - - 0x010: - - - - - - - - - - - - - - - - [...]: 0x190: - - - - - - - - ``` --- camlibs/ptp2/ptp.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index b1a754f49..328a2eb85 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -184,7 +184,10 @@ ptp_bytes2str(const uint8_t *data, int data_size, const char *fmt) static char line[16 * 3 + 1]; int pos = 0; for (int i = 0; i < data_size && pos < (int)sizeof(line); ++i) { - pos += snprintf(line + pos, sizeof(line) - pos, fmt, data[i]); + if (data[i] || fmt) + pos += snprintf(line + pos, sizeof(line) - pos, fmt ? fmt : "%02x ", data[i]); + else + pos += snprintf(line + pos, sizeof(line) - pos, " - "); } return line; } @@ -192,8 +195,15 @@ ptp_bytes2str(const uint8_t *data, int data_size, const char *fmt) void ptp_debug_data(PTPParams *params, const uint8_t* data, int size) { - for (int k = 0; k < size; k += 16) - ptp_debug (params, " 0x%03x: %s", k, ptp_bytes2str(data + k, MIN(16, size - k), "%02x ")); + uint8_t zeros[16] = { 0 }; + int zero_lines = 0; + for (int k = 0; k < size; k += 16) { + zero_lines = (size - k > 16 && memcmp(data + k, zeros, 16) == 0) ? zero_lines + 1 : 0; + if (zero_lines < 2) + ptp_debug (params, " 0x%03x: %s", k, ptp_bytes2str(data + k, MIN(16, size - k), NULL)); + else if (zero_lines == 2) + ptp_debug (params, " [...]: %s", ""); //ptp_bytes2str(zeros, 16, "%02x ")); + } } /* Pack / unpack functions */ From 8139556815b5aea7c136568e61a209ba26b4216d Mon Sep 17 00:00:00 2001 From: axxel Date: Sat, 28 Sep 2024 12:14:23 +0200 Subject: [PATCH 3/3] ptp2: update a few OLC related comments --- camlibs/ptp2/ptp-pack.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/camlibs/ptp2/ptp-pack.c b/camlibs/ptp2/ptp-pack.c index f1e41bf30..1203e9ac2 100644 --- a/camlibs/ptp2/ptp-pack.c +++ b/camlibs/ptp2/ptp-pack.c @@ -2263,32 +2263,21 @@ static unsigned int olcsizes[0x15][13] = { {0,0,0,0,0, 0,0,0,0,0, 0,0,0 }, /* 0x4 */ {0,0,0,0,0, 0,0,0,0,0, 0,0,0 }, /* 0x5 */ {0,0,0,0,0, 0,0,0,0,0, 0,0,0 }, /* 0x6 */ - {2,6,5,4,4, 6,7,4,6,5, 5,8,1 }, /* 0x7 */ /* CONFIRMED: EOS 100D, 5D Mark 3 */ - {2,6,5,4,4, 6,7,4,6,7, 7,8,1 }, /* 0x8 */ /* CONFIRMED: EOS M10, PowerShot SX720HS: only report 0x1, 0x2, 0x4 and 0x8 masks, separately */ + {2,6,5,4,4, 6,7,4,6,5, 5,8,1 }, /* 0x7 */ /* CONFIRMED: 100D, 5Dm3, 650D, 6D */ + {2,6,5,4,4, 6,7,4,6,7, 7,8,1 }, /* 0x8 */ /* CONFIRMED: 70D, M10, PowerShot SX720HS: only report 0x1, 0x2, 0x4 and 0x8 masks, separately */ {2,6,5,4,4, 6,7,4,6,7, 7,8,1 }, /* 0x9 */ /* guessed */ {2,6,5,4,4, 6,7,4,6,7, 7,8,1 }, /* 0xa */ /* guessed */ - {2,6,5,4,4, 6,8,4,6,5, 5,9,1 }, /* 0xb */ /* CONFIRMED: EOS 750D, 5Ds */ + {2,6,5,4,4, 6,8,4,6,5, 5,9,1 }, /* 0xb */ /* CONFIRMED: 750D, 5Ds */ {2,6,5,4,4, 6,8,4,6,5, 5,9,1 }, /* 0xc */ /* guessed */ {2,6,5,4,4, 6,8,4,6,5, 5,9,1 }, /* 0xd */ /* guessed */ {2,6,5,4,4, 6,8,4,6,5, 5,9,1 }, /* 0xe */ /* guessed */ - {2,7,6,4,4, 6,8,4,6,5, 5,9,1 }, /* 0xf */ /* guessed */ + {2,7,6,4,4, 6,8,4,6,5, 5,9,1 }, /* 0xf */ /* CONFIRMED: 200D */ {2,7,6,4,4, 6,8,4,6,5, 5,9,1 }, /* 0x10 */ /* guessed */ - {2,7,6,6,4, 6,8,4,6,5, 5,9,8 }, /* 0x11 */ /* CONFIRMED: EOS R */ - {2,7,9,6,4, 6,8,5,7,5, 5,9,8 }, /* 0x12 */ /* CONFIRMED: EOS M6 Mark II */ - {2,7,9,7,4, 6,8,5,7,5, 5,9,8 }, /* 0x13 */ /* CONFIRMED: EOS R5 C info from user Ingmar */ - {2,9,9,7,4, 6,8,5,7,5, 5,9,8 }, /* 0x14 */ /* CONFIRMED: EOS R8, R10. confirmed by trace from Marc Wetli */ + {2,7,6,6,4, 6,8,4,6,5, 5,9,8 }, /* 0x11 */ /* CONFIRMED: R */ + {2,7,9,6,4, 6,8,5,7,5, 5,9,8 }, /* 0x12 */ /* CONFIRMED: M6m2 */ + {2,7,9,7,4, 6,8,5,7,5, 5,9,8 }, /* 0x13 */ /* CONFIRMED: R5, R5 C, M50m2 */ + {2,9,9,7,4, 6,8,5,7,5, 5,9,8 }, /* 0x14 */ /* CONFIRMED: R8, R10, R5m2 */ }; - /* one more information record handed to us */ - /* Versions seen: (d199) - * 100D, 5d Mark 3, 650D, 6D: 7 (original reference) - * M10, 70D: 8 - * 5Dsr, 750D: b - * 200D: f - * EOS R: 0x11 - * EOS M6 Mark2 0x12 - * EOS R5, R5 C, M50m2: 0x13 - * EOS R10: 0x14 - */ /* still unclear what OLC stands for */ case PTP_EC_CANON_EOS_OLCInfoChanged: { uint32_t len, curoff; @@ -2433,7 +2422,8 @@ static unsigned int olcsizes[0x15][13] = { 0.942222 4 bytes: 04 02 06 2f 0.942969 4 bytes: 04 01 06 2f This suggests that the very last bit indicates the readiness to process commands - and the second byte may be related to accessing storage. + and the second byte may be related to accessing storage. The latter might be true + the former does not hold true when repeating captures. */ case 0x0020: /* mask 0x0020: 6 bytes, 00 00 00 00 00 00 observed.