renamed files correctly, added developers' docs

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@3182 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Hans Ulrich Niedermann
2001-11-24 22:57:56 +00:00
parent aa06c61886
commit b7cba2d362
9 changed files with 2978 additions and 2792 deletions

View File

@@ -1,3 +1,5 @@
SUBDIRS = doc
EXTRA_DIST = .indent.pro Changelog canon.df makefile.os2 mkpatch Protocol
camlibdir = $(prefix)/lib/gphoto2

File diff suppressed because it is too large Load Diff

View File

@@ -1,57 +1,167 @@
/****************************************************************************
/*
* library.h - Canon "native" operations.
*
* File: canon.h
* Written 1999 by Wolfgang G. Reissnegger and Werner Almesberger
*
* $Id$
*
****************************************************************************/
*/
#ifndef _CANON_H
#define _CANON_H
#ifndef _LIBRARY_H
#define _LIBRARY_H
/****************************************************************************
/* Defines for error handling */
#define NOERROR 0
#define ERROR_RECEIVED 1
#define ERROR_ADDRESSED 2
#define FATAL_ERROR 3
#define ERROR_LOWBATT 4
/* Battery status values:
* hopefully obsolete values first - we now just use the bit
* that makes the difference
obsolete #define CAMERA_ON_AC 16
obsolete #define CAMERA_ON_BATTERY 48
*/
#define CAMERA_POWER_OK 6
#define CAMERA_POWER_BAD 4
#define CAMERA_MASK_BATTERY 32
struct canon_dir {
const char *name; /* NULL if at end */
unsigned int size;
time_t date;
unsigned char attrs; /* File attributes, see "Protocols" for details */
int is_file;
void *user; /* user-specific data */
};
/**
* Various Powershot camera types
*/
typedef enum {
CANON_PS_A5,
CANON_PS_A5_ZOOM,
CANON_PS_A50,
CANON_PS_S10,
CANON_PS_S20,
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;
struct _CameraPrivateLibrary
{
canonCamModel model;
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 */
int A5;
char psa50_id[200]; /* some models may have a lot to report */
int canon_comm_method;
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;
/*
* Directory access may be rather expensive, so we cache some information.
* The first variable in each block indicates whether the block is valid.
*/
int cached_ready;
int cached_disk;
char *cached_drive; /* usually something like C: */
int cached_capacity;
int cached_available;
int cached_dir;
struct canon_dir *cached_tree;
int cached_images;
char **cached_paths; /* only used by A5 */
};
/*
* Our driver now supports both USB and serial communications
*/
#define CANON_SERIAL_RS232 0
#define CANON_USB 1
#define DIR_CREATE 0
#define DIR_REMOVE 1
typedef unsigned long u32;
#ifndef byteswap32
#ifdef __sparc
#define byteswap32(val) ({ u32 x = val; x = (x << 24) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) | (x >> 24); x; })
#else
#define byteswap32(val) val
#endif
#endif
/*
* All functions returning a pointer have malloc'ed the data. The caller must
* free() it when done.
*/
/**
* Switches the camera on, detects the model and sets its speed
*/
int canon_int_ready(Camera *camera);
/*
*
*/
char *canon_int_get_disk_name(Camera *camera);
/*
*
* These are defines for packet command codes collected from several
* sources. There's no guarantee, that they are correct...
*/
int canon_int_get_battery(Camera *camera, int *pwr_status, int *pwr_source);
/*
*
* The same is true for the ident string offset
*/
int canon_int_get_disk_name_info(Camera *camera, const char *name,int *capacity,int *available);
/*
*
****************************************************************************/
*/
struct canon_dir *canon_int_list_directory(Camera *camera, const char *name);
void canon_int_free_dir(Camera *camera, struct canon_dir *list);
int canon_int_get_file(Camera *camera, const char *name, unsigned char **data, int *length);
unsigned char *canon_int_get_thumbnail(Camera *camera, const char *name,int *length);
int canon_int_put_file(Camera *camera, CameraFile *file, char *destname, char *destpath);
int canon_int_set_file_attributes(Camera *camera, const char *file, const char *dir, unsigned char attrs);
int canon_int_delete_file(Camera *camera, const char *name, const char *dir);
int canon_serial_end(Camera *camera);
int canon_serial_off(Camera *camera);
time_t canon_int_get_time(Camera *camera);
int canon_int_set_time(Camera *camera);
int canon_int_directory_operations(Camera *camera, const char *path, int action);
int canon_int_identify_camera(Camera *camera);
int canon_int_set_owner_name(Camera *camera, const char *name);
#define CANON_IDENT_OFFSET 0x1a
#define CANON_CMD_ACK 0x04
#define CANON_CMD_PING 0x10
#define CANON_PCK_SOT 0x05
#define CANON_PCK_EOT 0x04
#define CANON_PCK_CMD 0x00
#define CANON_PCK_IDENT 0x06
/****************************************************************************
*
* Canon file attributes
*
****************************************************************************/
#define CANON_ATTR_WRITE_PROTECTED 0x01
#define CANON_ATTR_UNKNOWN_2 0x02
#define CANON_ATTR_UNKNOWN_4 0x04
#define CANON_ATTR_UNKNOWN_8 0x08
#define CANON_ATTR_NON_RECURS_ENT_DIR 0x10
#define CANON_ATTR_DOWNLOADED 0x20
#define CANON_ATTR_UNKNOWN_40 0x40
#define CANON_ATTR_RECURS_ENT_DIR 0x80
void clear_readiness(Camera *camera);
#define GP_MODULE "canon"
#endif /* _CANON_H */
/****************************************************************************
*
* End of file: canon.h
*
****************************************************************************/
#endif /* _LIBRARY_H */

View File

@@ -0,0 +1,16 @@
.cvsignore~
Makefile
Makefile.in
canon-api.html
scan
html
sgml
canon-scan.c
canon-scan
canon-decl.txt
canon-decl-list.txt
canon-unused.txt
canon-undocumented.txt
html.stamp
sgml.stamp
tmpl.stamp

View File

@@ -0,0 +1,8 @@
# The name of the module.
DOC_MODULE=canon
# The directory containing the source code (if it contains documentation).
DOC_SOURCE_DIR=$(top_srcdir)/camlibs/canon
# include common doc generation rules
include $(top_srcdir)/libgphoto2_port/doc/DocRules.am

View File

@@ -0,0 +1,12 @@
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
<!entity hash "#">
<!entity canon SYSTEM "sgml/canon.sgml">
]>
<book id="index">
<bookinfo>
<title>The Canon driver reference</title>
</bookinfo>
&canon;
</book>

View File

@@ -0,0 +1,148 @@
<SECTION>
<FILE>canon</FILE>
<TITLE>CanonDriver</TITLE>
CAMERA_MASK_BATTERY
CAMERA_POWER_BAD
CAMERA_POWER_OK
CANON_ATTR_DOWNLOADED
CANON_ATTR_NON_RECURS_ENT_DIR
CANON_ATTR_RECURS_ENT_DIR
CANON_ATTR_UNKNOWN_2
CANON_ATTR_UNKNOWN_4
CANON_ATTR_UNKNOWN_40
CANON_ATTR_UNKNOWN_8
CANON_ATTR_WRITE_PROTECTED
CANON_CMD_ACK
CANON_CMD_PING
CANON_ESC
CANON_FBEG
CANON_FEND
CANON_IDENT_OFFSET
CANON_PCK_CMD
CANON_PCK_EOT
CANON_PCK_IDENT
CANON_PCK_SOT
CANON_SERIAL_RS232
CANON_USB
CANON_USB_FUNCTION_CAMERA_CHOWN
CANON_USB_FUNCTION_DELETE_FILE
CANON_USB_FUNCTION_DISK_INFO
CANON_USB_FUNCTION_FLASH_DEVICE_IDENT
CANON_USB_FUNCTION_GET_DIRENT
CANON_USB_FUNCTION_GET_FILE
CANON_USB_FUNCTION_GET_TIME
CANON_USB_FUNCTION_IDENTIFY_CAMERA
CANON_USB_FUNCTION_MKDIR
CANON_USB_FUNCTION_POWER_STATUS
CANON_USB_FUNCTION_RMDIR
CANON_USB_FUNCTION_SET_ATTR
CANON_USB_FUNCTION_SET_TIME
CANON_XOR
CameraPrivateLibrary
DATA_BLOCK
DIR_CREATE
DIR_REMOVE
DIR_REVERSE
ERROR_ADDRESSED
ERROR_LOWBATT
ERROR_RECEIVED
FATAL_ERROR
FRAG_LEN_LSB
FRAG_LEN_MSB
FRAG_NUM
GP_MODULE
HDR_FIXED_LEN
JPEG_A50_SOS
JPEG_BEG
JPEG_END
JPEG_ESC
JPEG_SOS
MAX_MSG_SIZE
MAX_PKT_PAYLOAD
MAX_PKT_SIZE
MAX_TRIES
MSG_02
MSG_DIR
MSG_HDR_LEN
MSG_LEN_LSB
MSG_LEN_MSB
MSG_MTYPE
NOERROR
PKTACK_NACK
PKT_ACK
PKT_EOT
PKT_HDR_LEN
PKT_LEN_LSB
PKT_LEN_MSB
PKT_MSG
PKT_NACK
PKT_SEQ
PKT_TYPE
PKT_UPLOAD_EOT
SPEED_115200
SPEED_19200
SPEED_38400
SPEED_57600
SPEED_9600
UPLOAD_DATA_BLOCK
USB_BULK_READ_SIZE
USLEEP1
USLEEP2
byteswap32
canonCamModel
canon_int_delete_file
canon_int_directory_operations
canon_int_free_dir
canon_int_get_battery
canon_int_get_disk_name
canon_int_get_disk_name_info
canon_int_get_file
canon_int_get_thumbnail
canon_int_get_time
canon_int_identify_camera
canon_int_put_file
canon_int_ready
canon_int_set_file_attributes
canon_int_set_owner_name
canon_int_set_time
canon_psa50_chk_crc
canon_psa50_gen_crc
canon_serial_change_speed
canon_serial_dialogue
canon_serial_end
canon_serial_error_type
canon_serial_get_byte
canon_serial_get_cts
canon_serial_get_file
canon_serial_init
canon_serial_off
canon_serial_put_file
canon_serial_recv_frame
canon_serial_recv_msg
canon_serial_recv_packet
canon_serial_send
canon_serial_send_frame
canon_serial_send_packet
canon_serial_wait_for_ack
canon_usb_camera_init
canon_usb_dialogue
canon_usb_get_file
canon_usb_get_thumbnail
canon_usb_init
canon_usb_long_dialogue
canon_usb_put_file
clear_readiness
comp_dir
dump_hex
get_int
intatpos
is_crw
is_image
is_jpeg
is_movie
is_thumbnail
serial_flush_input
serial_flush_output
serial_set_timeout
u32
</SECTION>

File diff suppressed because it is too large Load Diff

View File

@@ -1,167 +1,57 @@
/*
* library.h - Canon "native" operations.
/****************************************************************************
*
* Written 1999 by Wolfgang G. Reissnegger and Werner Almesberger
* File: canon.h
*
* $Id$
*
*/
****************************************************************************/
#ifndef _LIBRARY_H
#define _LIBRARY_H
#ifndef _CANON_H
#define _CANON_H
/* Defines for error handling */
#define NOERROR 0
#define ERROR_RECEIVED 1
#define ERROR_ADDRESSED 2
#define FATAL_ERROR 3
#define ERROR_LOWBATT 4
/* Battery status values:
* hopefully obsolete values first - we now just use the bit
* that makes the difference
obsolete #define CAMERA_ON_AC 16
obsolete #define CAMERA_ON_BATTERY 48
*/
#define CAMERA_POWER_OK 6
#define CAMERA_POWER_BAD 4
#define CAMERA_MASK_BATTERY 32
struct canon_dir {
const char *name; /* NULL if at end */
unsigned int size;
time_t date;
unsigned char attrs; /* File attributes, see "Protocols" for details */
int is_file;
void *user; /* user-specific data */
};
/**
* Various Powershot camera types
*/
typedef enum {
CANON_PS_A5,
CANON_PS_A5_ZOOM,
CANON_PS_A50,
CANON_PS_S10,
CANON_PS_S20,
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;
struct _CameraPrivateLibrary
{
canonCamModel model;
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 */
int A5;
char psa50_id[200]; /* some models may have a lot to report */
int canon_comm_method;
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;
/*
* Directory access may be rather expensive, so we cache some information.
* The first variable in each block indicates whether the block is valid.
*/
int cached_ready;
int cached_disk;
char *cached_drive; /* usually something like C: */
int cached_capacity;
int cached_available;
int cached_dir;
struct canon_dir *cached_tree;
int cached_images;
char **cached_paths; /* only used by A5 */
};
/*
* Our driver now supports both USB and serial communications
*/
#define CANON_SERIAL_RS232 0
#define CANON_USB 1
#define DIR_CREATE 0
#define DIR_REMOVE 1
typedef unsigned long u32;
#ifndef byteswap32
#ifdef __sparc
#define byteswap32(val) ({ u32 x = val; x = (x << 24) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) | (x >> 24); x; })
#else
#define byteswap32(val) val
#endif
#endif
/*
* All functions returning a pointer have malloc'ed the data. The caller must
* free() it when done.
*/
/**
* Switches the camera on, detects the model and sets its speed
*/
int canon_int_ready(Camera *camera);
/**
/****************************************************************************
*
*/
char *canon_int_get_disk_name(Camera *camera);
/**
* These are defines for packet command codes collected from several
* sources. There's no guarantee, that they are correct...
*
*/
int canon_int_get_battery(Camera *camera, int *pwr_status, int *pwr_source);
/**
* The same is true for the ident string offset
*
*/
int canon_int_get_disk_name_info(Camera *camera, const char *name,int *capacity,int *available);
****************************************************************************/
/**
#define CANON_IDENT_OFFSET 0x1a
#define CANON_CMD_ACK 0x04
#define CANON_CMD_PING 0x10
#define CANON_PCK_SOT 0x05
#define CANON_PCK_EOT 0x04
#define CANON_PCK_CMD 0x00
#define CANON_PCK_IDENT 0x06
/****************************************************************************
*
*/
struct canon_dir *canon_int_list_directory(Camera *camera, const char *name);
void canon_int_free_dir(Camera *camera, struct canon_dir *list);
int canon_int_get_file(Camera *camera, const char *name, unsigned char **data, int *length);
unsigned char *canon_int_get_thumbnail(Camera *camera, const char *name,int *length);
int canon_int_put_file(Camera *camera, CameraFile *file, char *destname, char *destpath);
int canon_int_set_file_attributes(Camera *camera, const char *file, const char *dir, unsigned char attrs);
int canon_int_delete_file(Camera *camera, const char *name, const char *dir);
int canon_serial_end(Camera *camera);
int canon_serial_off(Camera *camera);
time_t canon_int_get_time(Camera *camera);
int canon_int_set_time(Camera *camera);
int canon_int_directory_operations(Camera *camera, const char *path, int action);
int canon_int_identify_camera(Camera *camera);
int canon_int_set_owner_name(Camera *camera, const char *name);
* Canon file attributes
*
****************************************************************************/
#endif /* _LIBRARY_H */
#define CANON_ATTR_WRITE_PROTECTED 0x01
#define CANON_ATTR_UNKNOWN_2 0x02
#define CANON_ATTR_UNKNOWN_4 0x04
#define CANON_ATTR_UNKNOWN_8 0x08
#define CANON_ATTR_NON_RECURS_ENT_DIR 0x10
#define CANON_ATTR_DOWNLOADED 0x20
#define CANON_ATTR_UNKNOWN_40 0x40
#define CANON_ATTR_RECURS_ENT_DIR 0x80
void clear_readiness(Camera *camera);
#define GP_MODULE "canon"
#endif /* _CANON_H */
/****************************************************************************
*
* End of file: canon.h
*
****************************************************************************/