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_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); // (0xFF9F525C), total_size should be 0 except for the first call
  33     int (*recv_data)(int handle, char *buf, int size, int, int); // (0xFF9F5500)
  34     int (*send_resp)(int handle, PTPContainer *resp, int zero); // (0xFF9F5688), ixus30/40 needs a third argument, which is always 0
  35     int (*get_data_size)(int handle); // (0xFF9F5830)
  36     int (*send_err_resp)(int handle, PTPContainer *resp); // (0xFF9F5784)
  37     int unknown1; // ???
  38     int (*f2)(); // ??? (0xFF8D5B24)
  39     int (*f3)(); // ??? (0xFF8D5B5C)
  40     // more??
  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; // id of script message is to/from 
  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 // __PTP_CHDK_H

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