diff --git a/camlib_8h.html b/camlib_8h.html index bd04af4..8d7a6a2 100644 --- a/camlib_8h.html +++ b/camlib_8h.html @@ -306,30 +306,21 @@ uint32_t ptp_read_uint32 (void *dat)   - -void ptp_read_string (void *dat, char *string, int max) -  - -int ptp_read_uint16_array (void *dat, uint16_t *buf, int max) -  - -int ptp_read_uint32_array (void *dat, uint16_t *buf, int max) -  - -int ptp_wide_string (char *buffer, int max, char *input) -  void ptp_write_uint8 (void *dat, uint8_t b)   int ptp_write_uint32 (void *dat, uint32_t b)   + +void ptp_read_string (void *dat, char *string, int max) +  + +int ptp_read_uint16_array (void *dat, uint16_t *buf, int max) +  int ptp_write_string (void *dat, char *string)   - -int ptp_write_utf8_string (void *dat, char *string) -  int ptp_write_unicode_string (char *dat, char *string)   @@ -339,6 +330,18 @@ void ptp_read_utf8_string (void *dat, char *string, int max)   + +int ptp_read_string2 (uint8_t *dat, char *string, int max) +  + +int ptp_write_string2 (uint8_t *dat, char *string) +  + +int ptp_write_utf8_string (void *dat, char *string) +  + +int ptp_read_uint16_array2 (uint8_t *dat, uint16_t *buf, int max, int *length) +  int ptp_new_cmd_packet (struct PtpRuntime *r, struct PtpCommand *cmd)   diff --git a/camlib_8h_source.html b/camlib_8h_source.html index d852dbc..2a0b076 100644 --- a/camlib_8h_source.html +++ b/camlib_8h_source.html @@ -200,153 +200,156 @@
120
123 int max_packet_size;
124
-
126 struct PtpDeviceInfo *di;
-
127 int device_type;
-
128
-
131 int data_phase_length;
-
132
-
134 void *comm_backend;
-
135
-
137 pthread_mutex_t *mutex;
-
138
-
141 uint8_t wait_for_response;
-
142
-
144 uint8_t response_wait_default;
-
145
-
148 struct PtpPropAvail *avail;
-
149};
+
127 struct PtpDeviceInfo *di;
+
128 int device_type;
+
129
+
132 int data_phase_length;
+
133
+
135 void *comm_backend;
+
136
+
138 pthread_mutex_t *mutex;
+
139
+
142 uint8_t wait_for_response;
+
143
+
145 uint8_t response_wait_default;
+
146
+
149 struct PtpPropAvail *avail;
+
150};
-
150
-
-
152struct PtpGenericEvent {
-
153 uint16_t code;
-
154 const char *name;
-
155 int value;
-
156 const char *str_value;
-
157};
+
151
+
+ +
154 uint16_t code;
+
155 const char *name;
+
156 int value;
+
157 const char *str_value;
+
158};
-
158
-
- -
161 uint16_t code;
-
162 uint32_t params[5];
-
163 int param_length;
-
164 int data_length;
-
165};
+
159
+
+ +
162 uint16_t code;
+
163 uint32_t params[5];
+
164 int param_length;
+
165 int data_length;
+
166};
-
166
-
-
168struct PtpArray {
-
169 uint32_t length;
-
170 uint32_t data[];
-
171};
+
167
+
+
169struct PtpArray {
+
170 uint32_t length;
+
171 uint32_t data[];
+
172};
-
172
- -
176
- -
180
-
183uint32_t ptp_get_param(struct PtpRuntime *r, int i);
-
184
- -
188
-
191uint8_t *ptp_get_payload(struct PtpRuntime *r);
-
192
- -
196
-
198struct PtpRuntime *ptp_new(int options);
-
199
-
202void ptp_reset(struct PtpRuntime *r);
-
203
-
205void ptp_init(struct PtpRuntime *r);
-
206
-
208void ptp_close(struct PtpRuntime *r);
-
209
-
211int ptp_send(struct PtpRuntime *r, struct PtpCommand *cmd);
-
212
-
214int ptp_send_data(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int length);
-
215
-
217int ptp_get_event(struct PtpRuntime *r, struct PtpEventContainer *ec);
-
218
- -
221
- -
227
- -
230
- -
234
-
237int ptp_check_opcode(struct PtpRuntime *r, int opcode);
-
238
-
241int ptp_check_prop(struct PtpRuntime *r, int code);
-
242
-
244int ptp_buffer_resize(struct PtpRuntime *r, size_t size);
-
245
-
246// Packet builder/unpacker helper functions. These accept a pointer-to-pointer
-
247// and will advance the dereferenced pointer by amount read. Mostly for internal use.
-
248// These functions accept (void *), but really wants (void **), but (void **) would require casting in every call
-
249uint8_t ptp_read_uint8(void *dat);
-
250uint16_t ptp_read_uint16(void *dat);
-
251uint32_t ptp_read_uint32(void *dat);
-
252void ptp_read_string(void *dat, char *string, int max);
-
253int ptp_read_uint16_array(void *dat, uint16_t *buf, int max);
-
254int ptp_read_uint32_array(void *dat, uint16_t *buf, int max);
-
255int ptp_wide_string(char *buffer, int max, char *input);
-
256void ptp_write_uint8(void *dat, uint8_t b);
-
257int ptp_write_uint32(void *dat, uint32_t b);
+
173
+ +
177
+ +
181
+
184uint32_t ptp_get_param(struct PtpRuntime *r, int i);
+
185
+ +
189
+
192uint8_t *ptp_get_payload(struct PtpRuntime *r);
+
193
+ +
197
+
199struct PtpRuntime *ptp_new(int options);
+
200
+
203void ptp_reset(struct PtpRuntime *r);
+
204
+
206void ptp_init(struct PtpRuntime *r);
+
207
+
209void ptp_close(struct PtpRuntime *r);
+
210
+
212int ptp_send(struct PtpRuntime *r, struct PtpCommand *cmd);
+
213
+
215int ptp_send_data(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int length);
+
216
+
218int ptp_get_event(struct PtpRuntime *r, struct PtpEventContainer *ec);
+
219
+ +
222
+ +
228
+ +
231
+ +
235
+
238int ptp_check_opcode(struct PtpRuntime *r, int opcode);
+
239
+
242int ptp_check_prop(struct PtpRuntime *r, int code);
+
243
+
245int ptp_buffer_resize(struct PtpRuntime *r, size_t size);
+
246
+
247// Packet builder/unpacker helper functions. These accept a pointer-to-pointer
+
248// and will advance the dereferenced pointer by amount read. Mostly for internal use.
+
249// These functions accept (void *), but really wants (void **), but (void **) would require casting in every call
+
250uint8_t ptp_read_uint8(void *dat);
+
251uint16_t ptp_read_uint16(void *dat);
+
252uint32_t ptp_read_uint32(void *dat);
+
253void ptp_write_uint8(void *dat, uint8_t b);
+
254int ptp_write_uint32(void *dat, uint32_t b);
+
255
+
256void ptp_read_string(void *dat, char *string, int max);
+
257int ptp_read_uint16_array(void *dat, uint16_t *buf, int max);
258int ptp_write_string(void *dat, char *string);
-
259int ptp_write_utf8_string(void *dat, char *string);
-
260int ptp_write_unicode_string(char *dat, char *string);
-
261int ptp_read_unicode_string(char *buffer, char *dat, int max);
-
262void ptp_read_utf8_string(void *dat, char *string, int max);
-
263
-
264inline static int ptp_write_u8 (void *buf, uint8_t out) { ((uint8_t *)buf)[0] = out; return 1; }
-
265inline static int ptp_write_u16(void *buf, uint16_t out) { ((uint16_t *)buf)[0] = out; return 2; }
-
266inline static int ptp_write_u32(void *buf, uint32_t out) { ((uint32_t *)buf)[0] = out; return 4; }
-
267inline static int ptp_read_u32 (void *buf, uint32_t *out) { *out = ((uint32_t *)buf)[0]; return 4; }
-
268inline static int ptp_read_u16 (void *buf, uint16_t *out) { *out = ((uint16_t *)buf)[0]; return 2; }
-
269inline static int ptp_read_u8 (void *buf, uint8_t *out) { *out = ((uint8_t *)buf)[0]; return 1; }
-
270
-
271// Build a new PTP/IP or PTP/USB command packet in r->data
-
272int ptp_new_cmd_packet(struct PtpRuntime *r, struct PtpCommand *cmd);
-
273
-
274// Only for PTP_USB or PTP_USB_IP use
-
275int ptp_new_data_packet(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int data_length);
-
276
-
277// Only use for PTP_IP
-
278int ptpip_data_start_packet(struct PtpRuntime *r, int data_length);
-
279int ptpip_data_end_packet(struct PtpRuntime *r, void *data, int data_length);
+
259int ptp_write_unicode_string(char *dat, char *string);
+
260int ptp_read_unicode_string(char *buffer, char *dat, int max);
+
261void ptp_read_utf8_string(void *dat, char *string, int max);
+
262
+
263int ptp_read_string2(uint8_t *dat, char *string, int max);
+
264int ptp_write_string2(uint8_t *dat, char *string);
+
265int ptp_write_utf8_string(void *dat, char *string);
+
266int ptp_read_uint16_array2(uint8_t *dat, uint16_t *buf, int max, int *length);
+
267
+
268inline static int ptp_write_u8 (void *buf, uint8_t out) { ((uint8_t *)buf)[0] = out; return 1; }
+
269inline static int ptp_write_u16(void *buf, uint16_t out) { ((uint16_t *)buf)[0] = out; return 2; }
+
270inline static int ptp_write_u32(void *buf, uint32_t out) { ((uint32_t *)buf)[0] = out; return 4; }
+
271inline static int ptp_read_u32 (void *buf, uint32_t *out) { *out = ((uint32_t *)buf)[0]; return 4; }
+
272inline static int ptp_read_u16 (void *buf, uint16_t *out) { *out = ((uint16_t *)buf)[0]; return 2; }
+
273inline static int ptp_read_u8 (void *buf, uint8_t *out) { *out = ((uint8_t *)buf)[0]; return 1; }
+
274
+
275// Build a new PTP/IP or PTP/USB command packet in r->data
+
276int ptp_new_cmd_packet(struct PtpRuntime *r, struct PtpCommand *cmd);
+
277
+
278// Only for PTP_USB or PTP_USB_IP use
+
279int ptp_new_data_packet(struct PtpRuntime *r, struct PtpCommand *cmd, void *data, int data_length);
280
-
281// Used only by ptp_open_session
-
282void ptp_update_transaction(struct PtpRuntime *r, int t);
-
283
-
284// Set avail info for prop
-
285void ptp_set_prop_avail_info(struct PtpRuntime *r, int code, int memb_size, int cnt, void *data);
-
286
-
287void *ptp_dup_payload(struct PtpRuntime *r);
-
288
-
289// Write r->data to a file called DUMP
-
290int ptp_dump(struct PtpRuntime *r);
-
291
-
292#define CAMLIB_INCLUDE_IMPL
-
293#include "cl_data.h"
-
294#include "cl_backend.h"
-
295#include "cl_ops.h"
-
296#include "cl_enum.h"
-
297#include "cl_bind.h"
-
298
-
299// Backwards compatibility (mostly renamed functions)
-
300#ifndef CAMLIB_NO_COMPAT
-
301 #define ptp_get_last_transaction(...) ptp_get_last_transaction_id(__VA_ARGS__)
-
302 #define ptp_generic_new(...) ptp_new(__VA_ARGS__)
-
303 #define ptp_generic_close(...) ptp_close(__VA_ARGS__)
-
304 #define ptp_generic_reset(...) ptp_reset(__VA_ARGS__)
-
305 #define ptp_generic_init(...) ptp_init(__VA_ARGS__)
-
306 #define ptp_generic_send(...) ptp_send(__VA_ARGS__)
-
307 #define ptp_generic_send_data(...) ptp_send_data(__VA_ARGS__)
-
308#endif
-
309
-
310#endif
+
281// Only use for PTP_IP
+
282int ptpip_data_start_packet(struct PtpRuntime *r, int data_length);
+
283int ptpip_data_end_packet(struct PtpRuntime *r, void *data, int data_length);
+
284
+
285// Used only by ptp_open_session
+
286void ptp_update_transaction(struct PtpRuntime *r, int t);
+
287
+
288// Set avail info for prop
+
289void ptp_set_prop_avail_info(struct PtpRuntime *r, int code, int memb_size, int cnt, void *data);
+
290
+
291void *ptp_dup_payload(struct PtpRuntime *r);
+
292
+
293// Write r->data to a file called DUMP
+
294int ptp_dump(struct PtpRuntime *r);
+
295
+
296#define CAMLIB_INCLUDE_IMPL
+
297#include "cl_data.h"
+
298#include "cl_backend.h"
+
299#include "cl_ops.h"
+
300#include "cl_enum.h"
+
301#include "cl_bind.h"
+
302
+
303// Backwards compatibility (mostly renamed functions)
+
304#ifndef CAMLIB_NO_COMPAT
+
305 #define ptp_get_last_transaction(...) ptp_get_last_transaction_id(__VA_ARGS__)
+
306 #define ptp_generic_new(...) ptp_new(__VA_ARGS__)
+
307 #define ptp_generic_close(...) ptp_close(__VA_ARGS__)
+
308 #define ptp_generic_reset(...) ptp_reset(__VA_ARGS__)
+
309 #define ptp_generic_init(...) ptp_init(__VA_ARGS__)
+
310 #define ptp_generic_send(...) ptp_send(__VA_ARGS__)
+
311 #define ptp_generic_send_data(...) ptp_send_data(__VA_ARGS__)
+
312#endif
+
313
+
314#endif
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...
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)
@@ -371,22 +374,22 @@
int ptp_check_opcode(struct PtpRuntime *r, int opcode)
Check if an opcode is supported by looking through supported props in r->di.
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.
-
Generic Struct for arrays.
Definition camlib.h:168
-
Generic PTP command structure - accepted by operation API.
Definition camlib.h:160
-
Generic event / property change.
Definition camlib.h:152
+
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
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 response_wait_default
Default value for wait_for_response.
Definition camlib.h:144
-
void * comm_backend
For session comm/io structures (holds backend instance pointers)
Definition camlib.h:134
+
uint8_t response_wait_default
Default value for wait_for_response.
Definition camlib.h:145
+
void * comm_backend
For session comm/io structures (holds backend instance pointers)
Definition camlib.h:135
uint8_t * data
Global buffer for data reading and writing.
Definition camlib.h:118
-
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:148
+
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
int transaction
Definition camlib.h:113
int max_packet_size
Definition camlib.h:123
-
pthread_mutex_t * mutex
Optional (see CAMLIB_DONT_USE_MUTEX)
Definition camlib.h:137
-
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:131
-
struct PtpDeviceInfo * di
Info about current connection, used to detect the vendor, supported opodes.
Definition camlib.h:126
-
uint8_t wait_for_response
Optionally wait up to 256 seconds for a response. Some PTP operations require this,...
Definition camlib.h:141
+
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
+
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
uint8_t connection_type
One of enum PtpConnType.
Definition camlib.h:110
diff --git a/structPtpRuntime.html b/structPtpRuntime.html index 58fcba7..294b687 100644 --- a/structPtpRuntime.html +++ b/structPtpRuntime.html @@ -106,9 +106,8 @@   int max_packet_size   - -struct PtpDeviceInfo * di - Info about current connection, used to detect the vendor, supported opodes.
+struct PtpDeviceInfo * di + Info about current connection, used to detect camera type, supported opodes, etc.
  int device_type @@ -172,6 +171,23 @@

Note
This is volatile - it will grow in size (pointer will change) when needed.
+

+ + +

◆ di

+ +
+
+ + + + +
struct PtpDeviceInfo* PtpRuntime::di
+
+ +

Info about current connection, used to detect camera type, supported opodes, etc.

+
Note
Set by ptp_parse_device_info.
+