From fee9f08942fb5cf81c87a9c93c0ce8bd74be5a83 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 18 May 2024 12:15:03 -0400 Subject: [PATCH] Add PTP_CANCELED, move some old stuff around --- src/camlib.h | 7 +------ src/lib.c | 4 ++++ src/liveview.c | 6 ++++++ src/ptp.h | 1 + 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/camlib.h b/src/camlib.h index f08dad6..26f527e 100644 --- a/src/camlib.h +++ b/src/camlib.h @@ -30,12 +30,6 @@ __attribute__ ((noreturn)) void ptp_panic(char *fmt, ...); // 4mb recommended default buffer size #define CAMLIB_DEFAULT_SIZE 1000000 -// Transparency pixel used in liveview processor. Will be packed as RGB uint32 -// uncompressed array of pixels in little-endian. This will be used as the first byte. -#ifndef PTP_LV_TRANSPARENCY_PIXEL - #define PTP_LV_TRANSPARENCY_PIXEL 0x0 -#endif - /// @brief Camlib library errors, not PTP return codes enum PtpGeneralError { PTP_OK = 0, @@ -47,6 +41,7 @@ enum PtpGeneralError { PTP_RUNTIME_ERR = -6, PTP_UNSUPPORTED = -7, PTP_CHECK_CODE = -8, + PTP_CANCELED = -9, }; /// @brief Evaluates PtpGeneralError into string message diff --git a/src/lib.c b/src/lib.c index 1db4d05..24802c5 100644 --- a/src/lib.c +++ b/src/lib.c @@ -190,6 +190,8 @@ int ptp_send_data(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int ptp_buffer_resize(r, 100 + length); } + //usleep(2000); + // Send operation request (data phase later on) int plength = ptp_new_cmd_packet(r, cmd); if (ptp_send_bulk_packets(r, plength) != plength) { @@ -197,6 +199,8 @@ int ptp_send_data(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int return PTP_IO_ERR; } + //usleep(2000); + if (r->connection_type == PTP_IP) { // Send data start packet first (only has payload length) plength = ptpip_data_start_packet(r, length); diff --git a/src/liveview.c b/src/liveview.c index 7a7acae..de6fc57 100644 --- a/src/liveview.c +++ b/src/liveview.c @@ -13,6 +13,12 @@ #define MAX_EOS_JPEG_SIZE 550000 +// Transparency pixel used in liveview processor. Will be packed as RGB uint32 +// uncompressed array of pixels in little-endian. This will be used as the first byte. +#ifndef PTP_LV_TRANSPARENCY_PIXEL + #define PTP_LV_TRANSPARENCY_PIXEL 0x0 +#endif + #define PTP_ML_LvWidth 360 #define PTP_ML_LvHeight 240 diff --git a/src/ptp.h b/src/ptp.h index 9605c1b..1363d62 100644 --- a/src/ptp.h +++ b/src/ptp.h @@ -1,4 +1,5 @@ // This file describes Picture Transfer Protocol (ISO 15740) +// And many vendor opcodes, property codes, and event codes. #ifndef PTP_H #define PTP_H