1 #ifndef __PTP_CHDK_H
2 #define __PTP_CHDK_H
3
4
5
6
7
8
9 #include "ptp.h"
10
11
12 #define PTP_RC_OK 0x2001
13 #define PTP_RC_GeneralError 0x2002
14 #define PTP_RC_OperationNotSupported 0x2005
15 #define PTP_RC_ParameterNotSupported 0x2006
16 #define PTP_RC_InvalidParameter 0x201D
17
18 typedef struct {
19 int code;
20 int sess_id;
21 int trans_id;
22 int num_param;
23 int param1;
24 int param2;
25 int param3;
26 int param4;
27 int param5;
28 } PTPContainer;
29
30 typedef struct {
31 int handle;
32 int (*send_data)(int handle, const char *buf, int part_size, int total_size, int, int, int);
33 int (*recv_data)(int handle, char *buf, int size, int, int);
34 int (*send_resp)(int handle, PTPContainer *resp, int zero);
35 int (*get_data_size)(int handle);
36 int (*send_err_resp)(int handle, PTPContainer *resp);
37 int unknown1;
38 int (*f2)();
39 int (*f3)();
40
41 } ptp_data;
42
43 typedef int (*ptp_handler)(int, ptp_data*, int, int, int, int, int, int, int, int);
44
45 int add_ptp_handler(int opcode, ptp_handler handler, int unknown);
46
47 typedef struct {
48 unsigned size;
49 unsigned script_id;
50 unsigned type;
51 unsigned subtype;
52 char data[];
53 } ptp_script_msg;
54
55 int ptp_script_write_msg(ptp_script_msg *msg);
56 ptp_script_msg* ptp_script_read_msg(void);
57 ptp_script_msg* ptp_script_create_msg(unsigned type, unsigned subtype, unsigned datasize, const void *data);
58 int ptp_script_write_error_msg(unsigned errtype, const char *err);
59
60 #endif