added a bunch of patchs from Johannes and Mariusz
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@740 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -10,3 +10,4 @@
|
||||
#undef CONFIG_DRIVER_FUJITSU
|
||||
#undef CONFIG_DRIVER_KONICA
|
||||
#undef CONFIG_DRIVER_PANASONIC
|
||||
#undef CONFIG_DRIVER_DIGITA
|
||||
|
||||
@@ -1,25 +1,4 @@
|
||||
## Process this file with automake to generate a GNU Makefile
|
||||
|
||||
if CONFIG_DRIVER_BARBIE
|
||||
SUBDIRS_DRIVERS=barbie
|
||||
else
|
||||
SUBDIRS_DRIVERS=
|
||||
endif
|
||||
SUBDIRS = @SUBDIRS_CAMLIBS@
|
||||
|
||||
if CONFIG_DRIVER_DIRECTORY
|
||||
SUBDIRS_DRIVERS+=directory
|
||||
endif
|
||||
|
||||
if CONFIG_DRIVER_FUJITSU
|
||||
SUBDIRS_DRIVERS+=fujitsu
|
||||
endif
|
||||
|
||||
if CONFIG_DRIVER_KONICA
|
||||
SUBDIRS_DRIVERS+=konica
|
||||
endif
|
||||
|
||||
if CONFIG_DRIVER_PANASONIC
|
||||
SUBDIRS_DRIVERS+=panasonic
|
||||
endif
|
||||
|
||||
SUBDIRS = $(SUBDIRS_DRIVERS)
|
||||
|
||||
@@ -61,11 +61,6 @@ host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
CONFIG_DRIVER_BARBIE = @CONFIG_DRIVER_BARBIE@
|
||||
CONFIG_DRIVER_DIRECTORY = @CONFIG_DRIVER_DIRECTORY@
|
||||
CONFIG_DRIVER_FUJITSU = @CONFIG_DRIVER_FUJITSU@
|
||||
CONFIG_DRIVER_KONICA = @CONFIG_DRIVER_KONICA@
|
||||
CONFIG_DRIVER_PANASONIC = @CONFIG_DRIVER_PANASONIC@
|
||||
CPP = @CPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
LD = @LD@
|
||||
@@ -83,7 +78,7 @@ NM = @NM@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
SUBDIRS_DRIVERS = @SUBDIRS_DRIVERS@
|
||||
SUBDIRS_CAMLIBS = @SUBDIRS_CAMLIBS@
|
||||
VERSION = @VERSION@
|
||||
|
||||
camlibdir = $(prefix)/lib/gphoto2
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
Note:
|
||||
|
||||
This is a Panasonic DC1580 camera gPhoto library source code.
|
||||
This is a Panasonic DC series common routines.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -60,14 +60,11 @@ typedef struct {
|
||||
char *buf;
|
||||
} dsc_t;
|
||||
|
||||
#define DSC_BLOCKSIZE 0x400 /* amount of data transfered in a single packet */
|
||||
#define DSC_MAXIMAGE 0xff /* highest possible number of an image */
|
||||
#define DSC_BLOCKSIZE 0x400 /* amount of image data transfered in a single packet */
|
||||
#define DSC_BUFSIZE 0x406 /* largest possible amount of data transfered in a single packet */
|
||||
#define DSC_MAXIMAGESIZE 0xfffff /* largest possible file that can be uploaded */
|
||||
|
||||
#ifndef DSC_PAUSE
|
||||
# define DSC_PAUSE 5 /* seconds to wait for camera to redraw screen */
|
||||
#endif
|
||||
|
||||
#define DSC_READTIMEOUT 2 /* seconds to wait for data from terminal */
|
||||
#define DSC_PAUSE 4 /* seconds to wait for camera to redraw screen */
|
||||
|
||||
#define DSC_FULLIMAGE 0
|
||||
#define DSC_THUMBNAIL 1
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
Note:
|
||||
|
||||
This is a Panasonic DC1580 camera gPhoto library source code.
|
||||
|
||||
An algorithm for checksums borrowed from Michael McCormack's Nikon
|
||||
CoolPix 600 library for gPhoto1.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -36,24 +39,42 @@
|
||||
|
||||
/* Internal utility functions */
|
||||
|
||||
/* dsc_checksum - establish checksum for size bytes in buffer */
|
||||
|
||||
u_int8_t dsc_checksum(char *buffer, int size) {
|
||||
|
||||
int checksum = 0;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < size - 2; i++) {
|
||||
checksum += buffer[i];
|
||||
checksum %= 0x100;
|
||||
}
|
||||
|
||||
return checksum;
|
||||
}
|
||||
|
||||
/* dsc_sendcmd - send command with data to DSC */
|
||||
|
||||
int dsc_sendcmd(dsc_t *dsc, int cmd, int data, int sequence) {
|
||||
int dsc_sendcmd(dsc_t *dsc, u_int8_t cmd, long int data, u_int8_t sequence) {
|
||||
|
||||
char databuf[16];
|
||||
int i;
|
||||
|
||||
DBUG_PRINT_3("Sending command: %i, data: %i, sequence: %i", cmd, data, sequence);
|
||||
DBUG_PRINT_3("Sending command: 0x%02x, data: %i, sequence: %i", cmd, data, sequence);
|
||||
|
||||
memset(databuf, 0, 16);
|
||||
memset(dsc->buf, 0, 16);
|
||||
|
||||
databuf[0] = 0x08;
|
||||
databuf[1] = sequence;
|
||||
databuf[2] = 0xff - sequence;
|
||||
databuf[3] = cmd;
|
||||
databuf[4] = data;
|
||||
databuf[14] = cmd + data - 1; /* checksum? */
|
||||
dsc->buf[0] = 0x08;
|
||||
dsc->buf[1] = sequence;
|
||||
dsc->buf[2] = 0xff - sequence;
|
||||
dsc->buf[3] = cmd;
|
||||
|
||||
return gpio_write(dsc->dev, databuf, 16);
|
||||
for (i = 0; i < sizeof(data); i++)
|
||||
dsc->buf[4 + i] = (u_int8_t)(data >> 8*i);
|
||||
|
||||
dsc->buf[14] = dsc_checksum(dsc->buf, 16);
|
||||
|
||||
return gpio_write(dsc->dev, dsc->buf, 16);
|
||||
}
|
||||
|
||||
/* dsc_retrcmd - retrieve command and its data from DSC */
|
||||
@@ -101,8 +122,7 @@ int dsc_connect(dsc_t *dsc, int speed) {
|
||||
|
||||
/* dsc_disconnect - reset camera, free buffers and close files */
|
||||
|
||||
int dsc_disconnect(dsc_t *dsc)
|
||||
{
|
||||
int dsc_disconnect(dsc_t *dsc) {
|
||||
DBUG_PRINT("Disconnecting the camera.");
|
||||
|
||||
dsc_sendcmd(dsc, DSC_CMD_RESET, 0, 0);
|
||||
@@ -144,13 +164,17 @@ int dsc_getindex(dsc_t *dsc) {
|
||||
int dsc_delete(dsc_t *dsc, int index) {
|
||||
|
||||
int s;
|
||||
char str[80];
|
||||
|
||||
DBUG_PRINT_1("Deletting the image of index: %d", index);
|
||||
DBUG_PRINT_1("Deleting the image of index: %d", index);
|
||||
|
||||
if (index < 1 || index > DSC_MAXIMAGE)
|
||||
if (index < 1)
|
||||
DBUG_RETURN(EDSCBADNUM, dsc_delete, GP_ERROR);
|
||||
/* bad image number */
|
||||
|
||||
sprintf(str, "Deleting image #%i.", index);
|
||||
gp_status(str);
|
||||
|
||||
dsc_sendcmd(dsc, DSC_CMD_DELETE, index, 0);
|
||||
|
||||
if (dsc_retrcmd(dsc) != DSC_RSP_OK)
|
||||
@@ -170,7 +194,7 @@ int dsc_selectimage(dsc_t *dsc, int index, int thumbnail)
|
||||
|
||||
DBUG_PRINT_2("Selecting the image of index: %i, thumbnail: %i", index, thumbnail);
|
||||
|
||||
if (index < 1 || index > DSC_MAXIMAGE)
|
||||
if (index < 1)
|
||||
DBUG_RETURN(EDSCBADNUM, dsc_selectimage, GP_ERROR);
|
||||
/* bad image number */
|
||||
|
||||
@@ -194,33 +218,29 @@ int dsc_selectimage(dsc_t *dsc, int index, int thumbnail)
|
||||
|
||||
/* gpio_readimageblock - read #block block (1024 bytes) of an image into buf */
|
||||
|
||||
int dsc_readimageblock(dsc_t *dsc, int block, char *buffer)
|
||||
{
|
||||
int size = DSC_BLOCKSIZE; /* always returns 1024 bytes */
|
||||
|
||||
int dsc_readimageblock(dsc_t *dsc, int block, char *buffer) {
|
||||
|
||||
DBUG_PRINT_1("Reading block: %i", block);
|
||||
|
||||
dsc_sendcmd(dsc, DSC_CMD_GET_DATA, block, block);
|
||||
|
||||
if (gpio_read(dsc->dev, dsc->buf, DSC_BUFSIZE) != DSC_BUFSIZE)
|
||||
DBUG_RETURN(EDSCNOANSW, dsc_readimageblock, GP_ERROR);
|
||||
/* no answer from camera */
|
||||
|
||||
if (gpio_read(dsc->dev, dsc->buf, 4) != 4 ||
|
||||
(u_int8_t)dsc->buf[0] != 1 ||
|
||||
if ((u_int8_t)dsc->buf[0] != 1 ||
|
||||
(u_int8_t)dsc->buf[1] != block ||
|
||||
(u_int8_t)dsc->buf[3] != 5)
|
||||
(u_int8_t)dsc->buf[2] != 0xff - block ||
|
||||
(u_int8_t)dsc->buf[3] != DSC_RSP_DATA ||
|
||||
(u_int8_t)dsc->buf[DSC_BUFSIZE - 2] != dsc_checksum(dsc->buf, DSC_BUFSIZE))
|
||||
DBUG_RETURN(EDSCBADRSP, dsc_readimageblock, GP_ERROR);
|
||||
/* bad response */
|
||||
|
||||
if (gpio_read(dsc->dev, buffer, size) != size)
|
||||
DBUG_RETURN(EDSCNOANSW, dsc_readimageblock, GP_ERROR);
|
||||
/* no answer from camera */
|
||||
memcpy(buffer, &dsc->buf[4], DSC_BLOCKSIZE);
|
||||
|
||||
/* checksum */
|
||||
if (gpio_read(dsc->dev, dsc->buf + 4, 2) != 2)
|
||||
DBUG_RETURN(EDSCNOANSW, dsc_readimageblock, GP_ERROR);
|
||||
/* no answer from camera */
|
||||
DBUG_PRINT_1("Block: %d read in.", block);
|
||||
|
||||
DBUG_PRINT_2("Block: %d of size: %d read in.", block, size);
|
||||
|
||||
return size;
|
||||
return DSC_BLOCKSIZE;
|
||||
}
|
||||
|
||||
/* dsc_readimage - read #index image or thumbnail and return its contents */
|
||||
@@ -242,7 +262,7 @@ char *dsc_readimage(dsc_t *dsc, int index, int thumbnail, int *size) {
|
||||
else
|
||||
strcpy(kind, "image");
|
||||
|
||||
sprintf(str, "Downloading %s #%i of size: %d bytes\n",
|
||||
sprintf(str, "Downloading %s #%i of size: %d bytes.",
|
||||
kind, index, *size);
|
||||
gp_status(str);
|
||||
gp_progress(0.00);
|
||||
@@ -257,76 +277,104 @@ char *dsc_readimage(dsc_t *dsc, int index, int thumbnail, int *size) {
|
||||
blocks = (*size - 1)/DSC_BLOCKSIZE + 1;
|
||||
|
||||
for (i = 0; i < blocks; i++) {
|
||||
if (dsc_readimageblock(dsc, i, &buffer[i*DSC_BLOCKSIZE]) == -1) {
|
||||
if (dsc_readimageblock(dsc, i, &buffer[i*DSC_BLOCKSIZE]) == GP_ERROR) {
|
||||
DBUG_PRINT_1("Error during %s transfer.", kind);
|
||||
sprintf(str, "Error during %s transfer.", kind);
|
||||
gp_messageg(str);
|
||||
gp_message(str);
|
||||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
gp_progress((float)(i+1)/(float)blocks);
|
||||
}
|
||||
|
||||
/* gp_progress(0.00); */ /* reset progress bar or not? */
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* dsc_setimageres - set image resolution to res */
|
||||
/* 0 - normal */
|
||||
/* 1 - fine */
|
||||
/* 2 - superfine */
|
||||
/* dsc_setimagesize - set size of an image to upload to camera */
|
||||
|
||||
int dsc_setimageres(dsc_t *dsc, dsc_quality_t res)
|
||||
{
|
||||
DBUG_PRINT_1("Setting image resolution to: %i", res);
|
||||
int dsc_setimagesize(dsc_t *dsc, int size) {
|
||||
|
||||
dsc_sendcmd(dsc, DSC_CMD_SET_RES, res, res);
|
||||
DBUG_PRINT_1("Setting image size to: %i", size);
|
||||
|
||||
dsc_sendcmd(dsc, DSC_CMD_SET_SIZE, size, 0);
|
||||
|
||||
if (dsc_retrcmd(dsc) != DSC_RSP_OK)
|
||||
DBUG_RETURN(EDSCBADRSP, dsc_setimageres, GP_ERROR);
|
||||
DBUG_RETURN(EDSCBADRSP, dsc_setimagesize, GP_ERROR);
|
||||
/* bad response */
|
||||
|
||||
DBUG_PRINT_1("Image resolution set to: %i", res);
|
||||
DBUG_PRINT_1("Image size set to: %i", size);
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
/* gpio_writeimageblock - write size bytes from buffer rounded to 1024 bytes to camera */
|
||||
|
||||
int dsc_writeimageblock(dsc_t *dsc, int block, char *buffer, int size) {
|
||||
|
||||
DBUG_PRINT_1("Writing block: %i", block);
|
||||
|
||||
memset(dsc->buf, 0, DSC_BUFSIZE);
|
||||
|
||||
dsc->buf[0] = 0x01;
|
||||
dsc->buf[1] = block;
|
||||
dsc->buf[2] = 0xff - block;
|
||||
dsc->buf[3] = DSC_CMD_SEND_DATA;
|
||||
|
||||
if (DSC_BLOCKSIZE < size)
|
||||
size = DSC_BLOCKSIZE;
|
||||
|
||||
memcpy(&dsc->buf[4], buffer, size);
|
||||
|
||||
dsc->buf[DSC_BUFSIZE - 2] = dsc_checksum(dsc->buf, DSC_BUFSIZE);
|
||||
|
||||
if (gpio_write(dsc->dev, dsc->buf, DSC_BUFSIZE) != GP_OK)
|
||||
DBUG_RETURN(EDSCSERRNO, dsc_writeimageblock, GP_ERROR);
|
||||
/* see errno value */
|
||||
|
||||
if (dsc_retrcmd(dsc) != DSC_RSP_OK)
|
||||
DBUG_RETURN(EDSCNOANSW, dsc_writeimageblock, GP_ERROR);
|
||||
/* no answer from camera */
|
||||
|
||||
DBUG_PRINT_2("Block: %i of size: %i written.", block, size);
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
/* gpio_writeimage - write an image to camera memory, size bytes at buffer */
|
||||
|
||||
int dsc_writeimage(dsc_t *dsc, char *buffer, int size)
|
||||
{
|
||||
char databuf[8];
|
||||
int blocks, blocksize, i;
|
||||
|
||||
DBUG_PRINT_1("Writing an image of size: %i", size);
|
||||
|
||||
if ((dsc_setimagesize(dsc, size)) != GP_OK)
|
||||
return GP_ERROR;
|
||||
|
||||
gp_progress(0.00);
|
||||
|
||||
memset(databuf, 0, 8);
|
||||
|
||||
databuf[0] = (u_int8_t)(0x000000ff & size);
|
||||
databuf[1] = (u_int8_t)(0x0000ff00 & size);
|
||||
databuf[2] = (u_int8_t)(0x00ff0000 & size);
|
||||
databuf[3] = (u_int8_t)(0xff000000 & size);
|
||||
databuf[4] = DSC_CMD_SEND_DATA;
|
||||
|
||||
if (glob_debug)
|
||||
dsc_dumpmem(databuf, 5);
|
||||
|
||||
if (gpio_write(dsc->dev, databuf, 5) != GP_OK)
|
||||
DBUG_RETURN(EDSCSERRNO, dsc_writeimage, GP_ERROR);
|
||||
/* see errno value */
|
||||
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
|
||||
|
||||
for (i = 0; i < blocks; i++) {
|
||||
blocksize = size - i*DSC_BLOCKSIZE;
|
||||
if (DSC_BLOCKSIZE < blocksize)
|
||||
blocksize = DSC_BLOCKSIZE;
|
||||
if (dsc_writeimageblock(dsc, i, &buffer[i*DSC_BLOCKSIZE], blocksize) != GP_OK) {
|
||||
DBUG_PRINT("Error during image transfer.");
|
||||
gp_message("Error during image transfer.");
|
||||
return GP_ERROR;
|
||||
}
|
||||
gp_progress((float)(i+1)/(float)blocks);
|
||||
}
|
||||
|
||||
if (gpio_write(dsc->dev, buffer, size) != GP_OK)
|
||||
DBUG_RETURN(EDSCSERRNO, dsc_writeimage, GP_ERROR)
|
||||
/* see errno value */
|
||||
else
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
/* dsc_preview - ??? */
|
||||
/* dsc_preview - show selected image on camera's LCD - is it supported? */
|
||||
|
||||
int dsc_preview(dsc_t *dsc, int index)
|
||||
{
|
||||
if (index < 1 || index > DSC_MAXIMAGE)
|
||||
if (index < 1)
|
||||
DBUG_RETURN(EDSCBADNUM, dsc_preview, GP_ERROR);
|
||||
/* bad image number */
|
||||
|
||||
@@ -358,7 +406,7 @@ int camera_debug_set (int onoff) {
|
||||
|
||||
int camera_abilities (CameraAbilities *abilities, int *count) {
|
||||
|
||||
*count = 1;
|
||||
*count = 2;
|
||||
|
||||
/* Fill in each camera model's abilities */
|
||||
/* Make separate entries for each conneciton type (usb, serial, etc...)
|
||||
@@ -378,6 +426,20 @@ int camera_abilities (CameraAbilities *abilities, int *count) {
|
||||
abilities[0].file_preview = 1;
|
||||
abilities[0].file_put = 1;
|
||||
|
||||
strcpy(abilities[1].model, "Nikon CoolPix 600");
|
||||
abilities[1].port = GP_PORT_SERIAL;
|
||||
abilities[1].speed[1] = 9600;
|
||||
abilities[1].speed[1] = 19200;
|
||||
abilities[1].speed[2] = 38400;
|
||||
abilities[1].speed[3] = 57600;
|
||||
abilities[1].speed[4] = 115200;
|
||||
abilities[1].speed[5] = 0;
|
||||
abilities[1].capture = 0;
|
||||
abilities[1].config = 0;
|
||||
abilities[1].file_delete = 1;
|
||||
abilities[1].file_preview = 1;
|
||||
abilities[1].file_put = 1;
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -385,7 +447,8 @@ int camera_init (CameraInit *init) {
|
||||
|
||||
dsc_error dscerror;
|
||||
|
||||
DBUG_PRINT("Initializing Panasonic DC series camera.");
|
||||
DBUG_PRINT("Initializing Panasonic DC1580 compatible camera");
|
||||
gp_status("Initializing camera.");
|
||||
|
||||
if (dsc && dsc->dev) {
|
||||
gpio_close(dsc->dev);
|
||||
@@ -416,7 +479,7 @@ int camera_init (CameraInit *init) {
|
||||
strcpy(dsc->model, init->model);
|
||||
|
||||
/* allocate memory for a dsc read/write buffer */
|
||||
if ((dsc->buf = (char *)malloc(sizeof(char)*(256))) == NULL) {
|
||||
if ((dsc->buf = (char *)malloc(sizeof(char)*(DSC_BUFSIZE))) == NULL) {
|
||||
dscerror.lerror = EDSCSERRNO;
|
||||
dscerror.lerrno = errno;
|
||||
DBUG_PRINT_ERROR(dscerror, camera_init);
|
||||
@@ -429,7 +492,9 @@ int camera_init (CameraInit *init) {
|
||||
}
|
||||
|
||||
int camera_exit () {
|
||||
|
||||
|
||||
gp_status("Disconnecting camera.");
|
||||
|
||||
dsc_disconnect(dsc);
|
||||
|
||||
if (dsc->dev) {
|
||||
@@ -503,23 +568,28 @@ int camera_file_put (CameraFile *file) {
|
||||
|
||||
char str[80];
|
||||
|
||||
DBUG_PRINT_2("Uploading image: %s of size: %d bytes", file->name, file->size);
|
||||
|
||||
/* We can not figure out file type, at least by now.
|
||||
|
||||
if (strcmp(file->type, "image/jpg") != 0) {
|
||||
DBUG_PRINT("JPEG image format allowed only.");
|
||||
sprintf(str, "JPEG image format allowed only.");
|
||||
gp_message(str);
|
||||
return GP_ERROR;
|
||||
}
|
||||
if (file->size > sizeof(u_int32_t)) {
|
||||
*/
|
||||
if (file->size > DSC_MAXIMAGESIZE) {
|
||||
DBUG_PRINT_1("File size is %i. Too big to fit in the camera memory.", file->size);
|
||||
sprintf(str, "File size is %i. Too big to fit in the camera memory.", file->size);
|
||||
gp_message(str);
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
if (dsc_setimageres(dsc, fine))
|
||||
return dsc_writeimage(dsc, file->data, file->size);
|
||||
else
|
||||
return GP_ERROR;
|
||||
|
||||
sprintf(str, "Uploading image: %s of size: %d bytes.", file->name, file->size);
|
||||
gp_status(str);
|
||||
|
||||
return dsc_writeimage(dsc, file->data, file->size);
|
||||
}
|
||||
|
||||
int camera_file_delete (int file_number) {
|
||||
@@ -544,14 +614,14 @@ int camera_capture (CameraFile *file, CameraCaptureInfo *info) {
|
||||
|
||||
int camera_summary (CameraText *summary) {
|
||||
|
||||
strcpy(summary->text, "Summary Not Available");
|
||||
strcpy(summary->text, "Summary not available.");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_manual (CameraText *manual) {
|
||||
|
||||
strcpy(manual->text, "Manual Not Available");
|
||||
strcpy(manual->text, "Manual not available.");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/* DC1580 command codes */
|
||||
|
||||
#define DSC_CMD_SEND_DATA 0x00
|
||||
#define DSC_CMD_SET_BAUD 0x04
|
||||
#define DSC_CMD_SEND_DATA 0x05
|
||||
#define DSC_CMD_GET_INDEX 0x07
|
||||
#define DSC_CMD_OK 0x08
|
||||
#define DSC_CMD_CONNECT 0x10
|
||||
#define DSC_CMD_DELETE 0x11
|
||||
#define DSC_CMD_PREVIEW 0x14
|
||||
#define DSC_CMD_SET_RES 0x15
|
||||
#define DSC_CMD_SET_SIZE 0x15
|
||||
#define DSC_CMD_THUMB 0x16
|
||||
#define DSC_CMD_SELECT 0x1a
|
||||
#define DSC_CMD_GET_DATA 0x1e
|
||||
@@ -36,9 +36,9 @@
|
||||
|
||||
/* DC1580 response codes */
|
||||
|
||||
#define DSC_RSP_DATA 0x00
|
||||
#define DSC_RSP_OK 0x01
|
||||
#define DSC_RSP_MODEL 0x03
|
||||
#define DSC_RSP_DATA 0x05
|
||||
#define DSC_RSP_INDEX 0x08
|
||||
#define DSC_RSP_IMGSIZE 0x1d
|
||||
|
||||
@@ -49,5 +49,6 @@
|
||||
#define DSC_BUF_SEQC 2
|
||||
#define DSC_BUF_CMD 3
|
||||
#define DSC_BUF_DATA 4
|
||||
#define DSC_BUF_CSUM 14
|
||||
|
||||
/* End of dc1580.h */
|
||||
|
||||
86
configure.in
86
configure.in
@@ -58,76 +58,45 @@ AC_SUBST(CFLAGS)
|
||||
AC_SUBST(LIBS)
|
||||
|
||||
dnl Find out which drivers to compile
|
||||
AC_SUBST(SUBDIRS_DRIVERS)
|
||||
CONFIG_DRIVER_BARBIE=0
|
||||
CONFIG_DRIVER_DIRECTORY=0
|
||||
CONFIG_DRIVER_FUJITSU=0
|
||||
CONFIG_DRIVER_KONICA=0
|
||||
CONFIG_DRIVER_PANASONIC=0
|
||||
camlibs='barbie directory fujitsu konica panasonic digita'
|
||||
AC_SUBST(SUBDIRS_CAMLIBS)
|
||||
for i in $camlibs; do
|
||||
d=`echo $i | tr a-z A-Z`
|
||||
eval "CONFIG_DRIVER_$d=n"
|
||||
done
|
||||
AC_MSG_CHECKING(which drivers to compile)
|
||||
AC_ARG_WITH(drivers,
|
||||
[ --with-drivers=<list> compile drivers in <list>; ]
|
||||
[ drivers may be separated with commas; ]
|
||||
[ 'all' compiles all drivers; ]
|
||||
[ possible drivers are: ]
|
||||
[ barbie, fujitsu, directory, konica, panasonic ],
|
||||
[ barbie, digita, directory, fujitsu, ]
|
||||
[ konica, panasonic ]
|
||||
drivers="$withval", drivers="all")
|
||||
if test "$drivers" = "all"; then
|
||||
CONFIG_DRIVER_BARBIE=1
|
||||
CONFIG_DRIVER_DIRECTORY=1
|
||||
CONFIG_DRIVER_FUJITSU=1
|
||||
CONFIG_DRIVER_KONICA=1
|
||||
CONFIG_DRIVER_PANASONIC=1
|
||||
AC_DEFINE(CONFIG_DRIVER_BARBIE)
|
||||
AC_DEFINE(CONFIG_DRIVER_DIRECTORY)
|
||||
AC_DEFINE(CONFIG_DRIVER_FUJITSU)
|
||||
AC_DEFINE(CONFIG_DRIVER_KONICA)
|
||||
AC_DEFINE(CONFIG_DRIVER_PANASONIC)
|
||||
AC_MSG_RESULT(all)
|
||||
for i in $camlibs; do
|
||||
d=`echo $i | tr a-z A-Z`
|
||||
eval "CONFIG_DRIVER_$d=y"
|
||||
AC_DEFINE_UNQUOTED(CONFIG_DRIVER_$d)
|
||||
SUBDIRS_CAMLIBS="$SUBDIRS_CAMLIBS $i"
|
||||
done
|
||||
|
||||
AC_MSG_RESULT(all)
|
||||
else
|
||||
drivers=`echo $drivers |sed 's/,/ /g'`
|
||||
for driver in $drivers
|
||||
do
|
||||
case "$driver" in
|
||||
barbie)
|
||||
CONFIG_DRIVER_BARBIE=1
|
||||
AC_DEFINE(CONFIG_DRIVER_BARBIE)
|
||||
;;
|
||||
directory)
|
||||
CONFIG_DRIVER_DIRECTORY=1
|
||||
AC_DEFINE(CONFIG_DRIVER_DIRECTORY)
|
||||
;;
|
||||
fujitsu)
|
||||
CONFIG_DRIVER_FUJITSU=1
|
||||
AC_DEFINE(CONFIG_DRIVER_FUJITSU)
|
||||
;;
|
||||
konica)
|
||||
CONFIG_DRIVER_KONICA=1
|
||||
AC_DEFINE(CONFIG_DRIVER_KONICA)
|
||||
;;
|
||||
panasonic)
|
||||
CONFIG_DRIVER_PANASONIC=1
|
||||
AC_DEFINE(CONFIG_DRIVER_PANASONIC)
|
||||
;;
|
||||
*)
|
||||
echo "Unknown driver $driver, exiting!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
drivers=`echo $drivers | sed 's/,/ /g'`
|
||||
for driver in $drivers; do
|
||||
if test -n "`echo $camlibs | grep -E \"(^| )$driver( |\$)\"`"; then
|
||||
d=`echo $driver | tr a-z A-Z`
|
||||
eval "CONFIG_DRIVER_$d=y"
|
||||
AC_DEFINE_UNQUOTED(CONFIG_DRIVER_$d)
|
||||
SUBDIRS_CAMLIBS="$SUBDIRS_CAMLIBS $driver"
|
||||
else
|
||||
echo "Unknown driver $driver, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
AC_MSG_RESULT($drivers)
|
||||
fi
|
||||
AM_CONDITIONAL(CONFIG_DRIVER_BARBIE, test $CONFIG_DRIVER_BARBIE = "1")
|
||||
AM_CONDITIONAL(CONFIG_DRIVER_DIRECTORY, test $CONFIG_DRIVER_DIRECTORY = "1")
|
||||
AM_CONDITIONAL(CONFIG_DRIVER_FUJITSU, test $CONFIG_DRIVER_FUJITSU = "1")
|
||||
AM_CONDITIONAL(CONFIG_DRIVER_KONICA, test $CONFIG_DRIVER_KONICA = "1")
|
||||
AM_CONDITIONAL(CONFIG_DRIVER_PANASONIC, test $CONFIG_DRIVER_PANASONIC = "1")
|
||||
AC_SUBST(CONFIG_DRIVER_BARBIE)
|
||||
AC_SUBST(CONFIG_DRIVER_DIRECTORY)
|
||||
AC_SUBST(CONFIG_DRIVER_FUJITSU)
|
||||
AC_SUBST(CONFIG_DRIVER_KONICA)
|
||||
AC_SUBST(CONFIG_DRIVER_PANASONIC)
|
||||
|
||||
|
||||
AC_OUTPUT(\
|
||||
Makefile \
|
||||
@@ -137,6 +106,7 @@ camlibs/fujitsu/Makefile \
|
||||
camlibs/directory/Makefile \
|
||||
camlibs/panasonic/Makefile \
|
||||
camlibs/konica/Makefile \
|
||||
camlibs/digita/Makefile \
|
||||
frontends/Makefile \
|
||||
frontends/command-line/Makefile \
|
||||
frontends/libgphoto2_frontend/Makefile \
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.libs
|
||||
gphoto2
|
||||
|
||||
@@ -49,7 +49,7 @@ int gp_file_open (CameraFile *file, char *filename) {
|
||||
size = ftell(fp);
|
||||
rewind(fp);
|
||||
|
||||
file->data = (char*)malloc(sizeof(char)*size);
|
||||
file->data = (char*)malloc(sizeof(char)*(size + 1));
|
||||
if (!file->data)
|
||||
return (GP_ERROR);
|
||||
size_read = fread(file->data, (size_t)sizeof(char), (size_t)size, fp);
|
||||
@@ -60,13 +60,13 @@ int gp_file_open (CameraFile *file, char *filename) {
|
||||
fclose(fp);
|
||||
|
||||
file->size = size_read;
|
||||
file->data[size_read] = 0;
|
||||
file->data[size_read] = 0;
|
||||
|
||||
name = strrchr(filename, '/');
|
||||
if (name)
|
||||
strcpy(file->name, name);
|
||||
strcpy(file->name, name + 1);
|
||||
else
|
||||
strcpy(file->name, "");
|
||||
strcpy(file->name, filename);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -146,8 +146,13 @@ int load_cameras() {
|
||||
|
||||
glob_camera_id_count = 0;
|
||||
|
||||
/* Look for available camera libraries */
|
||||
/* Look for available camera libraries */
|
||||
d = opendir(CAMLIBS);
|
||||
if (!d) {
|
||||
fprintf(stderr, "core: couldn't open %s\n", CAMLIBS);
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
do {
|
||||
/* Read each entry */
|
||||
de = readdir(d);
|
||||
@@ -176,10 +181,10 @@ int load_cameras() {
|
||||
memcpy(&glob_camera[x], &glob_camera[y], sizeof(t));
|
||||
memcpy(&glob_camera[y], &t, sizeof(t));
|
||||
|
||||
memcpy(&a, &glob_camera_abilities[x], sizeof(t));
|
||||
memcpy(&a, &glob_camera_abilities[x], sizeof(a));
|
||||
memcpy(&glob_camera_abilities[x], &glob_camera_abilities[y],
|
||||
sizeof(t));
|
||||
memcpy(&glob_camera_abilities[y], &a, sizeof(t));
|
||||
sizeof(a));
|
||||
memcpy(&glob_camera_abilities[y], &a, sizeof(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user