![]() | ![]() | ![]() | The Canon driver reference | ![]() |
---|
#include <canon.h> int canon_usb_get_dirents (Camera *camera, unsigned char **dirent_data, unsigned int *dirents_length, const char *path, GPContext *context); int canon_usb_list_all_dirs (Camera *camera, unsigned char **dirent_data, unsigned int *dirents_length, GPContext *context); enum canonDirentOffset;
int canon_usb_get_dirents (Camera *camera, unsigned char **dirent_data, unsigned int *dirents_length, const char *path, GPContext *context);
Lists a directory.
camera : | camera to initialize |
dirent_data : | to receive directory data |
dirents_length : | to receive length of |
path : | pathname of directory to list |
context : | context for error reporting |
Returns : | gphoto2 error code |
int canon_usb_list_all_dirs (Camera *camera, unsigned char **dirent_data, unsigned int *dirents_length, GPContext *context);
Lists all directories on camera. This can be executed before and after a "capture image" operation. By comparing the results, we can see where the new image went. Unfortunately, this seems to be the only way to find out, as Canon doesn't return that information from a capture command.
camera : | camera to initialize |
dirent_data : | to receive directory data |
dirents_length : | to receive length of |
context : | context for error reporting |
Returns : | gphoto2 error code |
typedef enum { CANON_DIRENT_ATTRS = 0, CANON_DIRENT_SIZE = 2, CANON_DIRENT_TIME = 6, CANON_DIRENT_NAME = 10, CANON_MINIMUM_DIRENT_SIZE } canonDirentOffset;
Offsets of fields of direntry in bytes. A minimum directory entry is: 2 bytes attributes, 4 bytes file date (UNIX localtime), 4 bytes file size, 1 byte empty path '' plus NULL byte.
Wouldn't this be better as a struct?
CANON_DIRENT_ATTRS | Attribute byte |
CANON_DIRENT_SIZE | 4 byte file size |
CANON_DIRENT_TIME | 4 byte Unix time |
CANON_DIRENT_NAME | Variable length ASCII path name |
CANON_MINIMUM_DIRENT_SIZE | Minimum size of a directory entry, including a null byte for an empty path name |
<<< Listing Directories | Power Status >>> |