-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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);
+
+
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);
-
-
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; }
-
-
-
-
-
-
-
-
-
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);
+
+
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);
+
+
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; }
+
+
+
+
+
+
-
-
282void ptp_update_transaction(
struct PtpRuntime *r,
int t);
-
-
-
285void ptp_set_prop_avail_info(
struct PtpRuntime *r,
int code,
int memb_size,
int cnt,
void *
data);
-
-
-
-
-
-
-
292#define CAMLIB_INCLUDE_IMPL
-
-
294#include "cl_backend.h"
-
-
-
-
-
-
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__)
-
-
-
+
+
282int ptpip_data_start_packet(
struct PtpRuntime *r,
int data_length);
+
283int ptpip_data_end_packet(
struct PtpRuntime *r,
void *
data,
int data_length);
+
+
+
286void ptp_update_transaction(
struct PtpRuntime *r,
int t);
+
+
+
289void ptp_set_prop_avail_info(
struct PtpRuntime *r,
int code,
int memb_size,
int cnt,
void *
data);
+
+
+
+
+
+
+
296#define CAMLIB_INCLUDE_IMPL
+
+
298#include "cl_backend.h"
+
+
+
+
+
+
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__)
+
+
+
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