root/core/ptp_chdk.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef __PTP_CHDK_H
   2 #define __PTP_CHDK_H
   3 
   4 // CHDK PTP interface (CHDK specific stuff)
   5 
   6 // Note: used in modules and platform independent code. 
   7 // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values)
   8 
   9 #include "ptp.h"
  10 
  11 // PTP constants - only need to be defined in CHDK, not PC side
  12 #define PTP_RC_OK 0x2001
  13 #define PTP_RC_GeneralError 0x2002
  14 #define PTP_RC_ParameterNotSupported 0x2006
  15 #define PTP_RC_InvalidParameter 0x201D
  16 
  17 typedef struct {
  18     int code;
  19     int sess_id;
  20     int trans_id;
  21     int num_param;
  22     int param1;
  23     int param2;
  24     int param3;
  25     int param4;
  26     int param5;
  27 } PTPContainer;
  28 
  29 typedef struct {
  30     int handle;
  31     int (*send_data)(int handle, const char *buf, int part_size, int total_size, int, int, int); // (0xFF9F525C), total_size should be 0 except for the first call
  32     int (*recv_data)(int handle, char *buf, int size, int, int); // (0xFF9F5500)
  33     int (*send_resp)(int handle, PTPContainer *resp, int zero); // (0xFF9F5688), ixus30/40 needs a third argument, which is always 0
  34     int (*get_data_size)(int handle); // (0xFF9F5830)
  35     int (*send_err_resp)(int handle, PTPContainer *resp); // (0xFF9F5784)
  36     int unknown1; // ???
  37     int (*f2)(); // ??? (0xFF8D5B24)
  38     int (*f3)(); // ??? (0xFF8D5B5C)
  39     // more??
  40 } ptp_data;
  41 
  42 typedef int (*ptp_handler)(int, ptp_data*, int, int, int, int, int, int, int, int);
  43 
  44 int add_ptp_handler(int opcode, ptp_handler handler, int unknown);
  45 
  46 typedef struct {
  47     unsigned size;
  48     unsigned script_id; // id of script message is to/from 
  49     unsigned type;
  50     unsigned subtype;
  51     char data[];
  52 } ptp_script_msg;
  53 
  54 int ptp_script_write_msg(ptp_script_msg *msg);
  55 ptp_script_msg* ptp_script_read_msg(void);
  56 ptp_script_msg* ptp_script_create_msg(unsigned type, unsigned subtype, unsigned datasize, const void *data);
  57 int ptp_script_write_error_msg(unsigned errtype, const char *err);
  58 
  59 #endif // __PTP_CHDK_H

/* [<][>][^][v][top][bottom][index][help] */