diff --git a/camlib_8h.html b/camlib_8h.html index 790fda1..2455c4c 100644 --- a/camlib_8h.html +++ b/camlib_8h.html @@ -129,9 +129,6 @@ #define CAMLIB_DEFAULT_SIZE   1000000   - -#define PTP_LV_TRANSPARENCY_PIXEL   0x0 -  #define CAMLIB_INCLUDE_IMPL   @@ -171,6 +168,7 @@ , PTP_UNSUPPORTED = -7 ,
  PTP_CHECK_CODE = -8 +, PTP_CANCELED = -9
}  Camlib library errors, not PTP return codes.
diff --git a/camlib_8h_source.html b/camlib_8h_source.html index 0573597..73e82c6 100644 --- a/camlib_8h_source.html +++ b/camlib_8h_source.html @@ -116,266 +116,261 @@
30// 4mb recommended default buffer size
31#define CAMLIB_DEFAULT_SIZE 1000000
32
-
33// Transparency pixel used in liveview processor. Will be packed as RGB uint32
-
34// uncompressed array of pixels in little-endian. This will be used as the first byte.
-
35#ifndef PTP_LV_TRANSPARENCY_PIXEL
-
36 #define PTP_LV_TRANSPARENCY_PIXEL 0x0
-
37#endif
-
38
-
-
40enum PtpGeneralError {
-
41 PTP_OK = 0,
-
42 PTP_NO_DEVICE = -1,
-
43 PTP_NO_PERM = -2,
-
44 PTP_OPEN_FAIL = -3,
-
45 PTP_OUT_OF_MEM = -4,
-
46 PTP_IO_ERR = -5,
-
47 PTP_RUNTIME_ERR = -6,
-
48 PTP_UNSUPPORTED = -7,
-
49 PTP_CHECK_CODE = -8,
-
50};
+
+ +
35 PTP_OK = 0,
+
36 PTP_NO_DEVICE = -1,
+
37 PTP_NO_PERM = -2,
+
38 PTP_OPEN_FAIL = -3,
+
39 PTP_OUT_OF_MEM = -4,
+
40 PTP_IO_ERR = -5,
+
41 PTP_RUNTIME_ERR = -6,
+
42 PTP_UNSUPPORTED = -7,
+
43 PTP_CHECK_CODE = -8,
+
44 PTP_CANCELED = -9,
+
45};
-
51
-
53const char *ptp_perror(int rc);
-
54
-
55enum PtpLiveViewType {
-
56 PTP_LV_NONE = 0,
-
57 PTP_LV_EOS = 1,
-
58 PTP_LV_CANON = 2,
-
59 PTP_LV_ML = 3, // ptplv v1
-
60 PTP_LV_EOS_ML_BMP = 4, // ptplv v2
-
61};
-
62
-
- -
65 PTP_DEV_EMPTY = 0,
-
66 PTP_DEV_EOS = 1,
-
67 PTP_DEV_CANON = 2,
-
68 PTP_DEV_NIKON = 3,
-
69 PTP_DEV_SONY = 4,
-
70 PTP_DEV_FUJI = 5,
-
71 PTP_DEV_PANASONIC = 6,
-
72};
+
46
+
48const char *ptp_perror(int rc);
+
49
+
50enum PtpLiveViewType {
+
51 PTP_LV_NONE = 0,
+
52 PTP_LV_EOS = 1,
+
53 PTP_LV_CANON = 2,
+
54 PTP_LV_ML = 3, // ptplv v1
+
55 PTP_LV_EOS_ML_BMP = 4, // ptplv v2
+
56};
+
57
+
+ +
60 PTP_DEV_EMPTY = 0,
+
61 PTP_DEV_EOS = 1,
+
62 PTP_DEV_CANON = 2,
+
63 PTP_DEV_NIKON = 3,
+
64 PTP_DEV_SONY = 4,
+
65 PTP_DEV_FUJI = 5,
+
66 PTP_DEV_PANASONIC = 6,
+
67};
-
73
-
74// Wrapper types for vendor specific capture modes
-
75enum ImageFormats {
-
76 IMG_FORMAT_ETC = 0,
-
77 IMG_FORMAT_RAW = 1,
-
78 IMG_FORMAT_STD = 2,
-
79 IMG_FORMAT_HIGH = 3,
-
80 IMG_FORMAT_RAW_JPEG = 4,
-
81};
-
82
-
- -
85 PTP_IP = (1 << 0),
-
86 PTP_IP_USB = (1 << 1), // TCP-based, but using USB-style packets (Fujifilm)
-
87 PTP_USB = (1 << 2),
-
88};
+
68
+
69// Wrapper types for vendor specific capture modes
+
70enum ImageFormats {
+
71 IMG_FORMAT_ETC = 0,
+
72 IMG_FORMAT_RAW = 1,
+
73 IMG_FORMAT_STD = 2,
+
74 IMG_FORMAT_HIGH = 3,
+
75 IMG_FORMAT_RAW_JPEG = 4,
+
76};
+
77
+
+ +
80 PTP_IP = (1 << 0),
+
81 PTP_IP_USB = (1 << 1), // TCP-based, but using USB-style packets (Fujifilm)
+
82 PTP_USB = (1 << 2),
+
83};
-
89
-
- -
92 void *next;
-
93 void *prev;
-
94 int code;
-
95 int memb_size;
-
96 int memb_cnt;
-
97 void *data;
-
98};
+
84
+
+ +
87 void *next;
+
88 void *prev;
+
89 int code;
+
90 int memb_size;
+
91 int memb_cnt;
+
92 void *data;
+
93};
-
99
-
- - -
107
- -
111
- -
114 int session;
+
94
+
+
97struct PtpRuntime {
+ +
102
+ +
106
+ +
109 int session;
+
110
+
113 uint8_t *data;
+
114 int data_length;
115
-
118 uint8_t *data;
-
119 int data_length;
-
120
- + +
119
+
122 struct PtpDeviceInfo *di;
+
123 int device_type;
124
-
127 struct PtpDeviceInfo *di;
-
128 int device_type;
-
129
- -
133
- -
136
-
138 pthread_mutex_t *mutex;
-
139
- -
143
- -
146
- -
150};
+ +
128
+ +
131
+
133 pthread_mutex_t *mutex;
+
134
+ +
138
+ +
141
+ +
145};
-
151
-
- -
154 uint16_t code;
-
155 const char *name;
-
156 int value;
-
157 const char *str_value;
-
158};
+
146
+
+ +
149 uint16_t code;
+
150 const char *name;
+
151 int value;
+
152 const char *str_value;
+
153};
-
159
-
- -
162 uint16_t code;
-
163 uint32_t params[5];
-
164 int param_length;
-
165 int data_length;
-
166};
+
154
+
+ +
157 uint16_t code;
+
158 uint32_t params[5];
+
159 int param_length;
+
160 int data_length;
+
161};
-
167
-
-
169struct PtpArray {
-
170 uint32_t length;
-
171 uint32_t data[];
-
172};
+
162
+
+
164struct PtpArray {
+
165 uint32_t length;
+
166 uint32_t data[];
+
167};
+
168
+
173
- +
178
- +
182uint32_t ptp_get_param(struct PtpRuntime *r, int i);
183
-
187uint32_t ptp_get_param(struct PtpRuntime *r, int i);
+
188
- +
192uint8_t *ptp_get_payload(struct PtpRuntime *r);
193
-
197uint8_t *ptp_get_payload(struct PtpRuntime *r);
+
198
- -
203
-
206struct PtpRuntime *ptp_new(int options);
+
201struct PtpRuntime *ptp_new(int options);
+
202
+
206void ptp_reset(struct PtpRuntime *r);
207
-
211void ptp_reset(struct PtpRuntime *r);
-
212
-
215void ptp_init(struct PtpRuntime *r);
-
216
-
219void ptp_close(struct PtpRuntime *r);
-
220
-
223int ptp_send(struct PtpRuntime *r, struct PtpCommand *cmd);
-
224
-
227int ptp_send_data(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int length);
-
228
-
231int ptp_get_event(struct PtpRuntime *r, struct PtpEventContainer *ec);
-
232
- -
236
- -
243
- +
210void ptp_init(struct PtpRuntime *r);
+
211
+
214void ptp_close(struct PtpRuntime *r);
+
215
+
218int ptp_send(struct PtpRuntime *r, struct PtpCommand *cmd);
+
219
+
222int ptp_send_data(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int length);
+
223
+
226int ptp_get_event(struct PtpRuntime *r, struct PtpEventContainer *ec);
+
227
+ +
231
+ +
238
+ +
242
+
247
- +
251int ptp_check_opcode(struct PtpRuntime *r, int opcode);
252
-
256int ptp_check_opcode(struct PtpRuntime *r, int opcode);
+
256int ptp_check_prop(struct PtpRuntime *r, int code);
257
-
261int ptp_check_prop(struct PtpRuntime *r, int code);
+
261int ptp_buffer_resize(struct PtpRuntime *r, size_t size);
262
-
266int ptp_buffer_resize(struct PtpRuntime *r, size_t size);
-
267
-
268int ptp_write_unicode_string(char *dat, char *string);
-
269int ptp_read_unicode_string(char *buffer, char *dat, int max);
-
270int ptp_read_utf8_string(void *dat, char *string, int max);
-
271int ptp_read_string(uint8_t *dat, char *string, int max);
-
272int ptp_write_string(uint8_t *dat, char *string);
-
273int ptp_write_utf8_string(void *dat, char *string);
-
274int ptp_read_uint16_array(uint8_t *dat, uint16_t *buf, int max, int *length);
-
275inline static int ptp_write_u8 (void *buf, uint8_t out) { ((uint8_t *)buf)[0] = out; return 1; }
-
276inline static int ptp_write_u16(void *buf, uint16_t out) { ((uint16_t *)buf)[0] = out; return 2; }
-
277inline static int ptp_write_u32(void *buf, uint32_t out) { ((uint32_t *)buf)[0] = out; return 4; }
-
278inline static int ptp_read_u32 (void *buf, uint32_t *out) { *out = ((uint32_t *)buf)[0]; return 4; }
-
279inline static int ptp_read_u16 (void *buf, uint16_t *out) { *out = ((uint16_t *)buf)[0]; return 2; }
-
280inline static int ptp_read_u8 (void *buf, uint8_t *out) { *out = ((uint8_t *)buf)[0]; return 1; }
-
281
-
282// Build a new PTP/IP or PTP/USB command packet in r->data
-
283int ptp_new_cmd_packet(struct PtpRuntime *r, struct PtpCommand *cmd);
-
284
-
285// Only for PTP_USB or PTP_USB_IP use
-
286int ptp_new_data_packet(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int data_length);
-
287
-
288// Only use for PTP_IP
-
289int ptpip_data_start_packet(struct PtpRuntime *r, int data_length);
-
290int ptpip_data_end_packet(struct PtpRuntime *r, void *data, int data_length);
-
291
-
292// Used only by ptp_open_session
-
293void ptp_update_transaction(struct PtpRuntime *r, int t);
+
263int ptp_write_unicode_string(char *dat, char *string);
+
264int ptp_read_unicode_string(char *buffer, char *dat, int max);
+
265int ptp_read_utf8_string(void *dat, char *string, int max);
+
266int ptp_read_string(uint8_t *dat, char *string, int max);
+
267int ptp_write_string(uint8_t *dat, char *string);
+
268int ptp_write_utf8_string(void *dat, char *string);
+
269int ptp_read_uint16_array(uint8_t *dat, uint16_t *buf, int max, int *length);
+
270inline static int ptp_write_u8 (void *buf, uint8_t out) { ((uint8_t *)buf)[0] = out; return 1; }
+
271inline static int ptp_write_u16(void *buf, uint16_t out) { ((uint16_t *)buf)[0] = out; return 2; }
+
272inline static int ptp_write_u32(void *buf, uint32_t out) { ((uint32_t *)buf)[0] = out; return 4; }
+
273inline static int ptp_read_u32 (void *buf, uint32_t *out) { *out = ((uint32_t *)buf)[0]; return 4; }
+
274inline static int ptp_read_u16 (void *buf, uint16_t *out) { *out = ((uint16_t *)buf)[0]; return 2; }
+
275inline static int ptp_read_u8 (void *buf, uint8_t *out) { *out = ((uint8_t *)buf)[0]; return 1; }
+
276
+
277// Build a new PTP/IP or PTP/USB command packet in r->data
+
278int ptp_new_cmd_packet(struct PtpRuntime *r, struct PtpCommand *cmd);
+
279
+
280// Only for PTP_USB or PTP_USB_IP use
+
281int ptp_new_data_packet(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int data_length);
+
282
+
283// Only use for PTP_IP
+
284int ptpip_data_start_packet(struct PtpRuntime *r, int data_length);
+
285int ptpip_data_end_packet(struct PtpRuntime *r, void *data, int data_length);
+
286
+
287// Used only by ptp_open_session
+
288void ptp_update_transaction(struct PtpRuntime *r, int t);
+
289
+
290// Set avail info for prop
+
291void ptp_set_prop_avail_info(struct PtpRuntime *r, int code, int memb_size, int cnt, void *data);
+
292
+
293void *ptp_dup_payload(struct PtpRuntime *r);
294
-
295// Set avail info for prop
-
296void ptp_set_prop_avail_info(struct PtpRuntime *r, int code, int memb_size, int cnt, void *data);
+
295// Write r->data to a file called DUMP
+
296int ptp_dump(struct PtpRuntime *r);
297
-
298void *ptp_dup_payload(struct PtpRuntime *r);
-
299
-
300// Write r->data to a file called DUMP
-
301int ptp_dump(struct PtpRuntime *r);
-
302
-
303#define CAMLIB_INCLUDE_IMPL
-
304#include "cl_data.h"
-
305#include "cl_backend.h"
-
306#include "cl_ops.h"
-
307#include "cl_enum.h"
-
308#include "cl_bind.h"
-
309
-
310// Backwards compatibility (mostly renamed functions)
-
311#ifndef CAMLIB_NO_COMPAT
-
312 #define ptp_get_last_transaction(...) ptp_get_last_transaction_id(__VA_ARGS__)
-
313 #define ptp_generic_new(...) ptp_new(__VA_ARGS__)
-
314 #define ptp_generic_close(...) ptp_close(__VA_ARGS__)
-
315 #define ptp_generic_reset(...) ptp_reset(__VA_ARGS__)
-
316 #define ptp_generic_init(...) ptp_init(__VA_ARGS__)
-
317 #define ptp_generic_send(...) ptp_send(__VA_ARGS__)
-
318 #define ptp_generic_send_data(...) ptp_send_data(__VA_ARGS__)
-
319#endif
-
320
-
321#endif
+
298#define CAMLIB_INCLUDE_IMPL
+
299#include "cl_data.h"
+
300#include "cl_backend.h"
+
301#include "cl_ops.h"
+
302#include "cl_enum.h"
+
303#include "cl_bind.h"
+
304
+
305// Backwards compatibility (mostly renamed functions)
+
306#ifndef CAMLIB_NO_COMPAT
+
307 #define ptp_get_last_transaction(...) ptp_get_last_transaction_id(__VA_ARGS__)
+
308 #define ptp_generic_new(...) ptp_new(__VA_ARGS__)
+
309 #define ptp_generic_close(...) ptp_close(__VA_ARGS__)
+
310 #define ptp_generic_reset(...) ptp_reset(__VA_ARGS__)
+
311 #define ptp_generic_init(...) ptp_init(__VA_ARGS__)
+
312 #define ptp_generic_send(...) ptp_send(__VA_ARGS__)
+
313 #define ptp_generic_send_data(...) ptp_send_data(__VA_ARGS__)
+
314#endif
+
315
+
316#endif
const char * ptp_perror(int rc)
Evaluates PtpGeneralError into string message.
-
PtpConnType
Tells lib what backend and packet style to use.
Definition camlib.h:84
-
PtpGeneralError
Camlib library errors, not PTP return codes.
Definition camlib.h:40
-
PtpVendors
Unique camera types - each type should have similar opcodes and behavior.
Definition camlib.h:64
+
PtpConnType
Tells lib what backend and packet style to use.
Definition camlib.h:79
+
PtpGeneralError
Camlib library errors, not PTP return codes.
Definition camlib.h:34
+
PtpVendors
Unique camera types - each type should have similar opcodes and behavior.
Definition camlib.h:59
-
Generic Struct for arrays.
Definition camlib.h:169
-
Generic PTP command structure - accepted by operation API.
Definition camlib.h:161
-
Generic event / property change.
Definition camlib.h:153
-
Linked list to handle currently possible values for a property.
Definition camlib.h:91
-
Holds all camlib instance info.
Definition camlib.h:102
+
Generic Struct for arrays.
Definition camlib.h:164
+
Generic PTP command structure - accepted by operation API.
Definition camlib.h:156
+
Generic event / property change.
Definition camlib.h:148
+
Linked list to handle currently possible values for a property.
Definition camlib.h:86
+
Holds all camlib instance info.
Definition camlib.h:97
struct PtpRuntime * ptp_new(int options)
Allocate new PtpRuntime based on bitfield options - see PtpConnType.
void ptp_reset(struct PtpRuntime *r)
Reset all session-specific fields of PtpRuntime - both libusb and libwpd backends call this before es...
-
uint8_t io_kill_switch
Set to 1 to kill all IO operations. By default, this is 1. When a valid connection is achieved by lib...
Definition camlib.h:106
+
uint8_t io_kill_switch
Set to 1 to kill all IO operations. By default, this is 1. When a valid connection is achieved by lib...
Definition camlib.h:101
int ptp_send_data(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int length)
Send a command request to the device with a data phase (thread safe)
int ptp_get_param_length(struct PtpRuntime *r)
Get number of parameters in packet in data buffer.
-
uint8_t response_wait_default
Default value for wait_for_response.
Definition camlib.h:145
+
uint8_t response_wait_default
Default value for wait_for_response.
Definition camlib.h:140
void ptp_close(struct PtpRuntime *r)
Frees PtpRuntime data buffer - doesn't free the actual structure, or device info (yet)
int ptp_get_event(struct PtpRuntime *r, struct PtpEventContainer *ec)
Try and get an event from the camera over int endpoint (USB-only)
int ptp_get_return_code(struct PtpRuntime *r)
Returns the return code (RC) currently in the data buffer.
-
void * comm_backend
For session comm/io structures (holds backend instance pointers)
Definition camlib.h:135
+
void * comm_backend
For session comm/io structures (holds backend instance pointers)
Definition camlib.h:130
int ptp_check_prop(struct PtpRuntime *r, int code)
Check if a property code is supported by looking through supported props in r->di.
int ptp_send(struct PtpRuntime *r, struct PtpCommand *cmd)
Send a command request to the device with no data phase.
void ptp_init(struct PtpRuntime *r)
Init PtpRuntime locally - uses default recommended settings (USB)
-
uint8_t * data
Global buffer for data reading and writing.
Definition camlib.h:118
+
uint8_t * data
Global buffer for data reading and writing.
Definition camlib.h:113
int ptp_get_payload_length(struct PtpRuntime *r)
Get length of payload returned by ptp_get_payload.
uint8_t * ptp_get_payload(struct PtpRuntime *r)
Get ptr of packet payload in data buffer, after packet header.
-
struct PtpPropAvail * avail
For devices that implement it, this will hold a linked list of properties and an array of their suppo...
Definition camlib.h:149
+
struct PtpPropAvail * avail
For devices that implement it, this will hold a linked list of properties and an array of their suppo...
Definition camlib.h:144
int ptp_get_last_transaction_id(struct PtpRuntime *r)
Get transaction ID of packet in the data buffer.
-
int transaction
Definition camlib.h:113
+
int transaction
Definition camlib.h:108
void ptp_mutex_keep_locked(struct PtpRuntime *r)
Keep the mutex locked one more time for the current thread.
void ptp_mutex_lock(struct PtpRuntime *r)
Lock the IO mutex - only should be used by backend.
-
int max_packet_size
Definition camlib.h:123
-
pthread_mutex_t * mutex
Optional (see CAMLIB_DONT_USE_MUTEX)
Definition camlib.h:138
-
int data_phase_length
For Windows compatibility, this is set to indicate lenth for a data packet that will be sent after a ...
Definition camlib.h:132
+
int max_packet_size
Definition camlib.h:118
+
pthread_mutex_t * mutex
Optional (see CAMLIB_DONT_USE_MUTEX)
Definition camlib.h:133
+
int data_phase_length
For Windows compatibility, this is set to indicate lenth for a data packet that will be sent after a ...
Definition camlib.h:127
int ptp_buffer_resize(struct PtpRuntime *r, size_t size)
Mostly for internal use - realloc the data buffer.
uint32_t ptp_get_param(struct PtpRuntime *r, int i)
Get parameter at index i.
-
struct PtpDeviceInfo * di
Info about current connection, used to detect camera type, supported opodes, etc.
Definition camlib.h:127
-
uint8_t wait_for_response
Optionally wait up to 256 seconds for a response. Some PTP operations require this,...
Definition camlib.h:142
+
struct PtpDeviceInfo * di
Info about current connection, used to detect camera type, supported opodes, etc.
Definition camlib.h:122
+
uint8_t wait_for_response
Optionally wait up to 256 seconds for a response. Some PTP operations require this,...
Definition camlib.h:137
int ptp_check_opcode(struct PtpRuntime *r, int opcode)
Check if an opcode is supported by looking through supported props in r->di.
-
uint8_t connection_type
One of enum PtpConnType.
Definition camlib.h:110
+
uint8_t connection_type
One of enum PtpConnType.
Definition camlib.h:105
void ptp_mutex_unlock(struct PtpRuntime *r)
Unlock the IO mutex (unless it was kept locked)
int ptp_device_type(struct PtpRuntime *r)
Gets type of device from r->di.
diff --git a/cl__ops_8h_source.html b/cl__ops_8h_source.html index 73bc84b..56b6a2f 100644 --- a/cl__ops_8h_source.html +++ b/cl__ops_8h_source.html @@ -191,9 +191,9 @@
152
153#endif
int ptp_get_storage_ids(struct PtpRuntime *r, struct PtpArray **a)
Returns allocated array of storage IDs call free() afterwards.
-
Generic Struct for arrays.
Definition camlib.h:169
-
Generic event / property change.
Definition camlib.h:153
-
Holds all camlib instance info.
Definition camlib.h:102
+
Generic Struct for arrays.
Definition camlib.h:164
+
Generic event / property change.
Definition camlib.h:148
+
Holds all camlib instance info.
Definition camlib.h:97
int ptp_get_thumbnail(struct PtpRuntime *r, int handle)
Raw JPEG data is accessible from ptp_get_payload()
int ptp_set_generic_property(struct PtpRuntime *r, const char *name, int value)
Set a generic property - abstraction over SetDeviceProp.
int ptp_get_partial_object(struct PtpRuntime *r, uint32_t handle, int offset, int max)