Skip to content

Commit

Permalink
Add PTP_CANCELED, move some old stuff around
Browse files Browse the repository at this point in the history
  • Loading branch information
petabyt committed May 18, 2024
1 parent ddf3e36 commit fee9f08
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/camlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,17 @@ 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) {
ptp_mutex_unlock_thread(r);
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);
Expand Down
6 changes: 6 additions & 0 deletions src/liveview.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/ptp.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit fee9f08

Please sign in to comment.