Whole document tree
    

Whole document tree

CanonDriver

CanonDriver

Name

CanonDriver -- 

Synopsis



#define     CAMERA_MASK_BATTERY
#define     CAMERA_POWER_BAD
#define     CAMERA_POWER_OK
#define     CANON_ATTR_DOWNLOADED
#define     CANON_ATTR_NON_RECURS_ENT_DIR
#define     CANON_ATTR_RECURS_ENT_DIR
#define     CANON_ATTR_UNKNOWN_2
#define     CANON_ATTR_UNKNOWN_4
#define     CANON_ATTR_UNKNOWN_40
#define     CANON_ATTR_UNKNOWN_8
#define     CANON_ATTR_WRITE_PROTECTED
#define     CANON_CMD_ACK
#define     CANON_CMD_PING
#define     CANON_ESC
#define     CANON_FBEG
#define     CANON_FEND
#define     CANON_IDENT_OFFSET
#define     CANON_PCK_CMD
#define     CANON_PCK_EOT
#define     CANON_PCK_IDENT
#define     CANON_PCK_SOT
#define     CANON_USB_FUNCTION_CAMERA_CHOWN
#define     CANON_USB_FUNCTION_DELETE_FILE
#define     CANON_USB_FUNCTION_DISK_INFO
#define     CANON_USB_FUNCTION_FLASH_DEVICE_IDENT
#define     CANON_USB_FUNCTION_GET_DIRENT
#define     CANON_USB_FUNCTION_GET_FILE
#define     CANON_USB_FUNCTION_GET_TIME
#define     CANON_USB_FUNCTION_IDENTIFY_CAMERA
#define     CANON_USB_FUNCTION_MKDIR
#define     CANON_USB_FUNCTION_POWER_STATUS
#define     CANON_USB_FUNCTION_RMDIR
#define     CANON_USB_FUNCTION_SET_ATTR
#define     CANON_USB_FUNCTION_SET_TIME
#define     CANON_XOR
struct      CameraPrivateLibrary;
#define     DATA_BLOCK
#define     DIR_CREATE
#define     DIR_REMOVE
#define     DIR_REVERSE
#define     ERROR_ADDRESSED
#define     ERROR_LOWBATT
#define     ERROR_RECEIVED
#define     FATAL_ERROR
#define     FRAG_LEN_LSB
#define     FRAG_LEN_MSB
#define     FRAG_NUM
#define     GP_MODULE
#define     HDR_FIXED_LEN
#define     JPEG_A50_SOS
#define     JPEG_BEG
#define     JPEG_END
#define     JPEG_ESC
#define     JPEG_SOS
#define     MAX_MSG_SIZE
#define     MAX_PKT_PAYLOAD
#define     MAX_PKT_SIZE
#define     MAX_TRIES
#define     MSG_02
#define     MSG_DIR
#define     MSG_HDR_LEN
#define     MSG_LEN_LSB
#define     MSG_LEN_MSB
#define     MSG_MTYPE
#define     NOERROR
#define     PKTACK_NACK
#define     PKT_ACK
#define     PKT_EOT
#define     PKT_HDR_LEN
#define     PKT_LEN_LSB
#define     PKT_LEN_MSB
#define     PKT_MSG
#define     PKT_NACK
#define     PKT_SEQ
#define     PKT_TYPE
#define     PKT_UPLOAD_EOT
#define     SPEED_115200
#define     SPEED_19200
#define     SPEED_38400
#define     SPEED_57600
#define     SPEED_9600
#define     UPLOAD_DATA_BLOCK
#define     USB_BULK_READ_SIZE
#define     USLEEP1
#define     USLEEP2
enum        canonCamModel;
int         canon_int_delete_file           (Camera *camera,
                                             const char *name,
                                             const char *dir,
                                             GPContext *context);
int         canon_int_directory_operations  (Camera *camera,
                                             const char *path,
                                             int action,
                                             GPContext *context);
void        canon_int_free_dir              (Camera *camera,
                                             struct canon_dir *list);
int         canon_int_get_battery           (Camera *camera,
                                             int *pwr_status,
                                             int *pwr_source,
                                             GPContext *context);
char*       canon_int_get_disk_name         (Camera *camera,
                                             GPContext *context);
int         canon_int_get_disk_name_info    (Camera *camera,
                                             const char *name,
                                             int *capacity,
                                             int *available,
                                             GPContext *context);
int         canon_int_get_file              (Camera *camera,
                                             const char *name,
                                             unsigned char **data,
                                             int *length,
                                             GPContext *context);
int         canon_int_get_thumbnail         (Camera *camera,
                                             const char *name,
                                             unsigned char **retdata,
                                             int *length,
                                             GPContext *context);
int         canon_int_get_time              (Camera *camera,
                                             time_t *camera_time,
                                             GPContext *context);
int         canon_int_identify_camera       (Camera *camera,
                                             GPContext *context);
int         canon_int_put_file              (Camera *camera,
                                             CameraFile *file,
                                             char *destname,
                                             char *destpath,
                                             GPContext *context);
int         canon_int_ready                 (Camera *camera,
                                             GPContext *context);
int         canon_int_set_file_attributes   (Camera *camera,
                                             const char *file,
                                             const char *dir,
                                             unsigned char attrs,
                                             GPContext *context);
int         canon_int_set_owner_name        (Camera *camera,
                                             const char *name,
                                             GPContext *context);
int         canon_int_set_time              (Camera *camera,
                                             time_t date,
                                             GPContext *context);
int         canon_psa50_chk_crc             (unsigned char *pkt,
                                             int len,
                                             unsigned short crc);
unsigned short canon_psa50_gen_crc          (unsigned char *pkt,
                                             int len);
int         canon_serial_change_speed       (GPPort *gdev,
                                             int speed);
unsigned char* canon_serial_dialogue        (Camera *camera,
                                             GPContext *context,
                                             unsigned char mtype,
                                             unsigned char dir,
                                             int *len,
                                             ...);
int         canon_serial_end                (Camera *camera);
void        canon_serial_error_type         (Camera *camera);
int         canon_serial_get_byte           (GPPort *gdev);
int         canon_serial_get_cts            (GPPort *gdev);
unsigned char* canon_serial_get_file        (Camera *camera,
                                             const char *name,
                                             int *length,
                                             GPContext *context);
int         canon_serial_init               (Camera *camera);
int         canon_serial_off                (Camera *camera);
int         canon_serial_put_file           (Camera *camera,
                                             CameraFile *file,
                                             char *destname,
                                             char *destpath,
                                             GPContext *context);
unsigned char* canon_serial_recv_frame      (Camera *camera,
                                             int *len);
unsigned char* canon_serial_recv_msg        (Camera *camera,
                                             unsigned char mtype,
                                             unsigned char dir,
                                             int *total,
                                             GPContext *context);
unsigned char* canon_serial_recv_packet     (Camera *camera,
                                             unsigned char *type,
                                             unsigned char *seq,
                                             int *len);
int         canon_serial_send               (Camera *camera,
                                             unsigned char *buf,
                                             int len,
                                             int sleep);
int         canon_serial_send_frame         (Camera *camera,
                                             unsigned char *pkt,
                                             int len);
int         canon_serial_send_packet        (Camera *camera,
                                             unsigned char type,
                                             unsigned char seq,
                                             unsigned char *pkt,
                                             int len);
int         canon_serial_wait_for_ack       (Camera *camera);
int         canon_usb_camera_init           (Camera *camera,
                                             GPContext *context);
unsigned char* canon_usb_dialogue           (Camera *camera,
                                             int canon_funct,
                                             int *return_length,
                                             const char *payload,
                                             int payload_length);
int         canon_usb_get_file              (Camera *camera,
                                             const char *name,
                                             unsigned char **data,
                                             int *length,
                                             GPContext *context);
int         canon_usb_get_thumbnail         (Camera *camera,
                                             const char *name,
                                             unsigned char **data,
                                             int *length,
                                             GPContext *context);
int         canon_usb_init                  (Camera *camera,
                                             GPContext *context);
int         canon_usb_long_dialogue         (Camera *camera,
                                             int canon_funct,
                                             unsigned char **data,
                                             int *data_length,
                                             int max_data_size,
                                             const char *payload,
                                             int payload_length,
                                             int display_status,
                                             GPContext *context);
int         canon_usb_put_file              (Camera *camera,
                                             CameraFile *file,
                                             char *destname,
                                             char *destpath);
void        clear_readiness                 (Camera *camera);
void        dump_hex                        (Camera *camera,
                                             const char *msg,
                                             unsigned char *buf,
                                             int len);
int         is_crw                          (const char *name);
int         is_image                        (const char *name);
int         is_jpeg                         (const char *name);
int         is_movie                        (const char *name);
int         is_thumbnail                    (const char *name);
void        serial_flush_input              (GPPort *gdev);
void        serial_flush_output             (GPPort *gdev);
void        serial_set_timeout              (GPPort *gdev,
                                             int to);

Description

Details

CAMERA_MASK_BATTERY

#define CAMERA_MASK_BATTERY  32


CAMERA_POWER_BAD

#define CAMERA_POWER_BAD    4


CAMERA_POWER_OK

#define CAMERA_POWER_OK     6


CANON_ATTR_DOWNLOADED

#define CANON_ATTR_DOWNLOADED			0x20


CANON_ATTR_NON_RECURS_ENT_DIR

#define CANON_ATTR_NON_RECURS_ENT_DIR		0x10


CANON_ATTR_RECURS_ENT_DIR

#define CANON_ATTR_RECURS_ENT_DIR		0x80


CANON_ATTR_UNKNOWN_2

#define CANON_ATTR_UNKNOWN_2			0x02


CANON_ATTR_UNKNOWN_4

#define CANON_ATTR_UNKNOWN_4			0x04


CANON_ATTR_UNKNOWN_40

#define CANON_ATTR_UNKNOWN_40			0x40


CANON_ATTR_UNKNOWN_8

#define CANON_ATTR_UNKNOWN_8			0x08			


CANON_ATTR_WRITE_PROTECTED

#define CANON_ATTR_WRITE_PROTECTED		0x01


CANON_CMD_ACK

#define CANON_CMD_ACK			0x04


CANON_CMD_PING

#define CANON_CMD_PING			0x10


CANON_ESC

#define CANON_ESC       0x7e


CANON_FBEG

#define CANON_FBEG      0xc0


CANON_FEND

#define CANON_FEND      0xc1


CANON_IDENT_OFFSET

#define CANON_IDENT_OFFSET		0x1a


CANON_PCK_CMD

#define CANON_PCK_CMD			0x00


CANON_PCK_EOT

#define CANON_PCK_EOT			0x04


CANON_PCK_IDENT

#define CANON_PCK_IDENT			0x06


CANON_PCK_SOT

#define CANON_PCK_SOT			0x05


CANON_USB_FUNCTION_CAMERA_CHOWN

#define CANON_USB_FUNCTION_CAMERA_CHOWN		6


CANON_USB_FUNCTION_DELETE_FILE

#define CANON_USB_FUNCTION_DELETE_FILE		12


CANON_USB_FUNCTION_DISK_INFO

#define CANON_USB_FUNCTION_DISK_INFO		8


CANON_USB_FUNCTION_FLASH_DEVICE_IDENT

#define CANON_USB_FUNCTION_FLASH_DEVICE_IDENT	9


CANON_USB_FUNCTION_GET_DIRENT

#define CANON_USB_FUNCTION_GET_DIRENT		11


CANON_USB_FUNCTION_GET_FILE

#define CANON_USB_FUNCTION_GET_FILE		1


CANON_USB_FUNCTION_GET_TIME

#define CANON_USB_FUNCTION_GET_TIME		3


CANON_USB_FUNCTION_IDENTIFY_CAMERA

#define CANON_USB_FUNCTION_IDENTIFY_CAMERA	2


CANON_USB_FUNCTION_MKDIR

#define CANON_USB_FUNCTION_MKDIR		5


CANON_USB_FUNCTION_POWER_STATUS

#define CANON_USB_FUNCTION_POWER_STATUS		10


CANON_USB_FUNCTION_RMDIR

#define CANON_USB_FUNCTION_RMDIR		7


CANON_USB_FUNCTION_SET_ATTR

#define CANON_USB_FUNCTION_SET_ATTR		13


CANON_USB_FUNCTION_SET_TIME

#define CANON_USB_FUNCTION_SET_TIME		4


CANON_XOR

#define CANON_XOR       0x20


struct CameraPrivateLibrary

struct CameraPrivateLibrary
{
	struct canonCamModelData *md;
	int speed;        /* The speed we're using for this camera */
	char ident[32];   /* Model ID string given by the camera */
	char owner[32];   /* Owner name */
	char firmwrev[4]; /* Firmware revision */
	unsigned char psa50_eot[8];

	int receive_error;
	int first_init;  /* first use of camera   1 = yes 0 = no */
	int uploading;   /* 1 = yes ; 0 = no */
	int slow_send;   /* to send data via serial with a usleep(1) 
					  * between each byte 1 = yes ; 0 = no */ 

	unsigned char seq_tx;
	unsigned char seq_rx;

	/* driver settings
	 * leave these as int, as gp_widget_get_value sets them as int!
	 */
	int list_all_files; /* whether to list all files, not just know types */

	char *cached_drive;	/* usually something like C: */
	int cached_ready;       /* whether the camera is ready to rock */

/*
 * Directory access may be rather expensive, so we cached some information.
 * This is now done by libgphoto2, so we are continuously removing this stuff.
 * So the following variables are OBSOLETE.
 */

	int cached_disk;
	int cached_capacity;
	int cached_available;
	int cached_dir;
	struct canon_dir *cached_tree;
	int cached_images;
	char **cached_paths; /* only used by A5 */
};


DATA_BLOCK

#define DATA_BLOCK 1536


DIR_CREATE

#define DIR_CREATE 0


DIR_REMOVE

#define DIR_REMOVE 1


DIR_REVERSE

#define DIR_REVERSE     0x30


ERROR_ADDRESSED

#define ERROR_ADDRESSED	2


ERROR_LOWBATT

#define ERROR_LOWBATT	4


ERROR_RECEIVED

#define ERROR_RECEIVED	1


FATAL_ERROR

#define FATAL_ERROR	3


FRAG_LEN_LSB

#define FRAG_LEN_LSB    2


FRAG_LEN_MSB

#define FRAG_LEN_MSB    3


FRAG_NUM

#define FRAG_NUM                0


GP_MODULE

#define     GP_MODULE


HDR_FIXED_LEN

#define HDR_FIXED_LEN 30


JPEG_A50_SOS

#define JPEG_A50_SOS    0xC4


JPEG_BEG

#define JPEG_BEG        0xD8


JPEG_END

#define JPEG_END        0xD9


JPEG_ESC

#define JPEG_ESC        0xFF


JPEG_SOS

#define JPEG_SOS        0xDB


MAX_MSG_SIZE

#define MAX_MSG_SIZE    (MAX_PKT_PAYLOAD-12)


MAX_PKT_PAYLOAD

#define MAX_PKT_PAYLOAD 65535


MAX_PKT_SIZE

#define MAX_PKT_SIZE    (MAX_PKT_PAYLOAD+4)


MAX_TRIES

#define MAX_TRIES 10


MSG_02

#define MSG_02          0


MSG_DIR

#define MSG_DIR         7


MSG_HDR_LEN

#define MSG_HDR_LEN     16


MSG_LEN_LSB

#define MSG_LEN_LSB     8


MSG_LEN_MSB

#define MSG_LEN_MSB     9


MSG_MTYPE

#define MSG_MTYPE       4


NOERROR

#define NOERROR		0


PKTACK_NACK

#define PKTACK_NACK     0x01


PKT_ACK

#define PKT_ACK         5


PKT_EOT

#define PKT_EOT         4


PKT_HDR_LEN

#define PKT_HDR_LEN     4


PKT_LEN_LSB

#define PKT_LEN_LSB     2


PKT_LEN_MSB

#define PKT_LEN_MSB     3


PKT_MSG

#define PKT_MSG         0


PKT_NACK

#define PKT_NACK        255


PKT_SEQ

#define PKT_SEQ         0


PKT_TYPE

#define PKT_TYPE        1


PKT_UPLOAD_EOT

#define PKT_UPLOAD_EOT  3


SPEED_115200

#define SPEED_115200 "\x00\x03\x80\x02\x01\x10\x00\x00\x00\x00\x4d\xf9"


SPEED_19200

#define SPEED_19200  "\x00\x03\x08\x02\x01\x10\x00\x00\x00\x00\x13\x1f"


SPEED_38400

#define SPEED_38400  "\x00\x03\x20\x02\x01\x10\x00\x00\x00\x00\x5f\x84"


SPEED_57600

#define SPEED_57600  "\x00\x03\x40\x02\x01\x10\x00\x00\x00\x00\x5e\x57"


SPEED_9600

#define SPEED_9600   "\x00\x03\x02\x02\x01\x10\x00\x00\x00\x00\xc0\x39"


UPLOAD_DATA_BLOCK

#define UPLOAD_DATA_BLOCK 900


USB_BULK_READ_SIZE

#define USB_BULK_READ_SIZE 0x3000


USLEEP1

#define USLEEP1 0


USLEEP2

#define USLEEP2 1


enum canonCamModel

typedef enum {
	CANON_PS_A5,
	CANON_PS_A5_ZOOM,
	CANON_PS_A50,
	CANON_PS_S10,
	CANON_PS_S20,
	CANON_PS_S30,
	CANON_PS_S40,
	CANON_PS_A70,
	CANON_PS_S100,
	CANON_PS_S300,
	CANON_PS_G1,
	CANON_PS_G2,
	CANON_PS_A10,
	CANON_PS_A20,
	CANON_EOS_D30,
	CANON_PS_PRO90_IS
} canonCamModel;


canon_int_delete_file ()

int         canon_int_delete_file           (Camera *camera,
                                             const char *name,
                                             const char *dir,
                                             GPContext *context);


canon_int_directory_operations ()

int         canon_int_directory_operations  (Camera *camera,
                                             const char *path,
                                             int action,
                                             GPContext *context);


canon_int_free_dir ()

void        canon_int_free_dir              (Camera *camera,
                                             struct canon_dir *list);


canon_int_get_battery ()

int         canon_int_get_battery           (Camera *camera,
                                             int *pwr_status,
                                             int *pwr_source,
                                             GPContext *context);

Gets battery status.


canon_int_get_disk_name ()

char*       canon_int_get_disk_name         (Camera *camera,
                                             GPContext *context);

Ask the camera for the name of the flash storage device. Usually "D:" or something like that.


canon_int_get_disk_name_info ()

int         canon_int_get_disk_name_info    (Camera *camera,
                                             const char *name,
                                             int *capacity,
                                             int *available,
                                             GPContext *context);

Gets available room and max capacity of a disk given by name.


canon_int_get_file ()

int         canon_int_get_file              (Camera *camera,
                                             const char *name,
                                             unsigned char **data,
                                             int *length,
                                             GPContext *context);


canon_int_get_thumbnail ()

int         canon_int_get_thumbnail         (Camera *camera,
                                             const char *name,
                                             unsigned char **retdata,
                                             int *length,
                                             GPContext *context);


canon_int_get_time ()

int         canon_int_get_time              (Camera *camera,
                                             time_t *camera_time,
                                             GPContext *context);

Get camera's current time.

The camera gives time in little endian format, therefore we need to swap the 4 bytes on big-endian machines.

Note: the time returned from the camera is not UTC but local time. This means you should only use functions that don't adjust the timezone, like gmtime(), instead of functions that do, like localtime() since otherwise you will end up with the wrong time.

We pass it along to calling functions in local time instead of UTC since it is more correct to say 'Camera time: 2002-01-01 00:00:00' if that is what the display says and not to display the cameras time converted to local timezone (which will of course be wrong if you are not in the timezone the cameras clock was set in).


canon_int_identify_camera ()

int         canon_int_identify_camera       (Camera *camera,
                                             GPContext *context);

Gets the camera identification string, usually the owner name.

This information is then stored in the "camera" structure, which is a global variable for the driver.

This function also gets the firmware revision in the camera struct.


canon_int_put_file ()

int         canon_int_put_file              (Camera *camera,
                                             CameraFile *file,
                                             char *destname,
                                             char *destpath,
                                             GPContext *context);


canon_int_ready ()

int         canon_int_ready                 (Camera *camera,
                                             GPContext *context);

Switches the camera on, detects the model and sets its speed.


canon_int_set_file_attributes ()

int         canon_int_set_file_attributes   (Camera *camera,
                                             const char *file,
                                             const char *dir,
                                             unsigned char attrs,
                                             GPContext *context);

Sets a file's attributes. See the 'Protocol' file for details.


canon_int_set_owner_name ()

int         canon_int_set_owner_name        (Camera *camera,
                                             const char *name,
                                             GPContext *context);

Sets the camera owner name. The string should not be more than 30 characters long. We call get_owner_name afterwards in order to check that everything went fine.


canon_int_set_time ()

int         canon_int_set_time              (Camera *camera,
                                             time_t date,
                                             GPContext *context);

Set camera's current time.

Canon cameras know nothing about time zones so we have to convert it to local time (but still expressed in UNIX time format (seconds since 1970-01-01).


canon_psa50_chk_crc ()

int         canon_psa50_chk_crc             (unsigned char *pkt,
                                             int len,
                                             unsigned short crc);


canon_psa50_gen_crc ()

unsigned short canon_psa50_gen_crc          (unsigned char *pkt,
                                             int len);


canon_serial_change_speed ()

int         canon_serial_change_speed       (GPPort *gdev,
                                             int speed);


canon_serial_dialogue ()

unsigned char* canon_serial_dialogue        (Camera *camera,
                                             GPContext *context,
                                             unsigned char mtype,
                                             unsigned char dir,
                                             int *len,
                                             ...);

mtype : type dir : direction len : length of the received payload @... : The rest of the arguments will be put together to fill up the payload of the request message.

Higher level function: sends a message and waits for a reply from the camera.

Payload: each argument after "len" goes by 2: the variable itself, and the next argument has to be its length. You also have to finish the list by a "NULL".

Example: To send a string called "name" : canon_serial_dialogue(0x05,0x12,&len,name,strlen(name)+1,NULL);


canon_serial_end ()

int         canon_serial_end                (Camera *camera);

Switches the camera off


canon_serial_error_type ()

void        canon_serial_error_type         (Camera *camera);


canon_serial_get_byte ()

int         canon_serial_get_byte           (GPPort *gdev);


canon_serial_get_cts ()

int         canon_serial_get_cts            (GPPort *gdev);


canon_serial_get_file ()

unsigned char* canon_serial_get_file        (Camera *camera,
                                             const char *name,
                                             int *length,
                                             GPContext *context);


canon_serial_init ()

int         canon_serial_init               (Camera *camera);


canon_serial_off ()

int         canon_serial_off                (Camera *camera);

Switches the camera off, and resets the serial driver to 9600 bauds, in order to be ready to switch the camera back on again if wanted. Should better be named psa50_serial_off


canon_serial_put_file ()

int         canon_serial_put_file           (Camera *camera,
                                             CameraFile *file,
                                             char *destname,
                                             char *destpath,
                                             GPContext *context);


canon_serial_recv_frame ()

unsigned char* canon_serial_recv_frame      (Camera *camera,
                                             int *len);


canon_serial_recv_msg ()

unsigned char* canon_serial_recv_msg        (Camera *camera,
                                             unsigned char mtype,
                                             unsigned char dir,
                                             int *total,
                                             GPContext *context);


canon_serial_recv_packet ()

unsigned char* canon_serial_recv_packet     (Camera *camera,
                                             unsigned char *type,
                                             unsigned char *seq,
                                             int *len);


canon_serial_send ()

int         canon_serial_send               (Camera *camera,
                                             unsigned char *buf,
                                             int len,
                                             int sleep);


canon_serial_send_frame ()

int         canon_serial_send_frame         (Camera *camera,
                                             unsigned char *pkt,
                                             int len);


canon_serial_send_packet ()

int         canon_serial_send_packet        (Camera *camera,
                                             unsigned char type,
                                             unsigned char seq,
                                             unsigned char *pkt,
                                             int len);


canon_serial_wait_for_ack ()

int         canon_serial_wait_for_ack       (Camera *camera);


canon_usb_camera_init ()

int         canon_usb_camera_init           (Camera *camera,
                                             GPContext *context);


canon_usb_dialogue ()

unsigned char* canon_usb_dialogue           (Camera *camera,
                                             int canon_funct,
                                             int *return_length,
                                             const char *payload,
                                             int payload_length);

USB version of the canon_serial_dialogue function.

We construct a packet with the known command values (cmd{1,2,3}) of the function requested (canon_funct) to the camera. If return_length exists for this function, we read return_length bytes back from the camera and return this camera response to the caller.

Example :

This function gets called with canon_funct = CANON_USB_FUNCTION_SET_TIME payload = already constructed payload with the new time we construct a complete command packet and send this to the camera. The canon_usb_cmdstruct indicates that command CANON_USB_FUNCTION_SET_TIME returns four bytes, so we read those four bytes into our buffer and return a pointer to the buffer to the caller.

This should probably be changed so that the caller supplies a unsigned char ** which can be pointed to our buffer and an int returned with GP_OK or some error code.


canon_usb_get_file ()

int         canon_usb_get_file              (Camera *camera,
                                             const char *name,
                                             unsigned char **data,
                                             int *length,
                                             GPContext *context);


canon_usb_get_thumbnail ()

int         canon_usb_get_thumbnail         (Camera *camera,
                                             const char *name,
                                             unsigned char **data,
                                             int *length,
                                             GPContext *context);


canon_usb_init ()

int         canon_usb_init                  (Camera *camera,
                                             GPContext *context);


canon_usb_long_dialogue ()

int         canon_usb_long_dialogue         (Camera *camera,
                                             int canon_funct,
                                             unsigned char **data,
                                             int *data_length,
                                             int max_data_size,
                                             const char *payload,
                                             int payload_length,
                                             int display_status,
                                             GPContext *context);

This function is used to invoke camera commands which return L (long) data. It calls #canon_usb_dialogue(), if it gets a good response it will malloc() memory and read the entire returned data into this malloc'd memory and store a pointer to the malloc'd memory in 'data'.


canon_usb_put_file ()

int         canon_usb_put_file              (Camera *camera,
                                             CameraFile *file,
                                             char *destname,
                                             char *destpath);


clear_readiness ()

void        clear_readiness                 (Camera *camera);


dump_hex ()

void        dump_hex                        (Camera *camera,
                                             const char *msg,
                                             unsigned char *buf,
                                             int len);


is_crw ()

int         is_crw                          (const char *name);

Test whether the name given corresponds to a raw CRW image (.CRW).


is_image ()

int         is_image                        (const char *name);

Test whether the given name corresponds to an image (.JPG or .CRW).


is_jpeg ()

int         is_jpeg                         (const char *name);

Test whether the given name corresponds to a JPEG image (.JPG).


is_movie ()

int         is_movie                        (const char *name);

Test whether the name given corresponds to a movie (.AVI)



serial_flush_input ()

void        serial_flush_input              (GPPort *gdev);


serial_flush_output ()

void        serial_flush_output             (GPPort *gdev);


serial_set_timeout ()

void        serial_set_timeout              (GPPort *gdev,
                                             int to);