Remove trailing whitespace from all *.h and *.c files.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* ADC-65(s) camera driver
|
||||
* Released under the GPL version 2
|
||||
*
|
||||
* Released under the GPL version 2
|
||||
*
|
||||
* Copyright 2001
|
||||
* Benjamin Moos
|
||||
* <benjamin@psnw.com>
|
||||
@@ -126,7 +126,7 @@ adc65_read_data (Camera *camera, unsigned char *cmd, int cmd_size, int data_type
|
||||
*/
|
||||
strcpy(s, ppmhead);
|
||||
z = strlen(s);
|
||||
|
||||
|
||||
for (y=0; y<256; y++) {
|
||||
if (y == 255) {
|
||||
y1 = y - 1;
|
||||
@@ -143,24 +143,24 @@ adc65_read_data (Camera *camera, unsigned char *cmd, int cmd_size, int data_type
|
||||
bl = (unsigned char)us[y1 * 256 + x];
|
||||
ur = (unsigned char)us[y * 256 + x1];
|
||||
br = (unsigned char)us[y1 * 256 + x1];
|
||||
|
||||
switch ( ((y & 1) << 1) | (x & 1) ) {
|
||||
case 0: /* even row, even col, B */
|
||||
|
||||
switch ( ((y & 1) << 1) | (x & 1) ) {
|
||||
case 0: /* even row, even col, B */
|
||||
rgb.R = br;
|
||||
rgb.G = (ur + bl) / 2;
|
||||
rgb.B = ul;
|
||||
break;
|
||||
case 1: /* even row, odd col, G */
|
||||
case 1: /* even row, odd col, G */
|
||||
rgb.R = bl;
|
||||
rgb.G = ul;
|
||||
rgb.B = ur;
|
||||
break;
|
||||
case 2: /* odd row, even col, G */
|
||||
case 2: /* odd row, even col, G */
|
||||
rgb.R = ur;
|
||||
rgb.G = ul;
|
||||
rgb.B = bl;
|
||||
break;
|
||||
case 3: /* odd row, odd col, R */
|
||||
case 3: /* odd row, odd col, R */
|
||||
default:
|
||||
rgb.R = ul;
|
||||
rgb.G = (ur + bl) / 2;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* - fix number of picturs detection
|
||||
* - get rid of the heavy stack usage and use the heap instead
|
||||
* - fix USB download size
|
||||
*
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -70,13 +70,13 @@ static unsigned short to_camera(unsigned short a)
|
||||
unsigned short ret = 0;
|
||||
|
||||
ret = ret + (a / 1000) * 0x1000;
|
||||
a = a % 1000;
|
||||
a = a % 1000;
|
||||
ret = ret + ((a / 100) * 0x100);
|
||||
a = a % 100;
|
||||
ret = ret + ((a / 10) * 0x10);
|
||||
a = a % 10;
|
||||
ret = ret + a;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -90,13 +90,13 @@ static unsigned short from_camera(unsigned short a)
|
||||
unsigned short ret = 0;
|
||||
|
||||
ret = ret + ((a / 0x1000) * 1000);
|
||||
a = a % 0x1000;
|
||||
a = a % 0x1000;
|
||||
ret = ret + ((a / 0x100) * 100);
|
||||
a = a % 0x100;
|
||||
ret = ret + ((a / 0x10) * 10);
|
||||
a = a % 0x10;
|
||||
ret = ret + a;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
unsigned char * result;
|
||||
unsigned char * ptr;
|
||||
|
||||
|
||||
/* unsigned char last, next; */
|
||||
|
||||
GP_DEBUG(" * get_file_func()");
|
||||
@@ -182,19 +182,19 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_port_read(camera->port, (char*)indata, 0x100);
|
||||
|
||||
size = indata[ 5 ] + (indata[ 6 ] * 0xFF) + 3;
|
||||
|
||||
|
||||
resolution = (unsigned char)indata[ 17 ];
|
||||
if (resolution == 1) {
|
||||
char dummy;
|
||||
|
||||
result = calloc((size + 1), 0x100);
|
||||
ptr = result;
|
||||
|
||||
|
||||
gp_port_usb_msg_read(camera->port,0x00,0x0000,0x0521,&dummy,0x0001);
|
||||
gp_port_usb_msg_read(camera->port,0x00,0x0000,0x8000,&dummy,0x0001);
|
||||
|
||||
gp_port_usb_msg_write(camera->port,0x0A,to_camera(n),0x000A,NULL,0x0);
|
||||
|
||||
|
||||
for (j = 0; j < size; j++) {
|
||||
gp_port_read(camera->port, (char*)ptr, 0x100);
|
||||
ptr += 0x100;
|
||||
@@ -254,7 +254,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
data = (unsigned char *)calloc(size, 0x100);
|
||||
ptr = data;
|
||||
|
||||
|
||||
gp_port_usb_msg_write(camera->port,0x0A,to_camera(n),0x000B,NULL,0x0);
|
||||
if (size < 100) {
|
||||
for (j = 0; j < size; j++) {
|
||||
@@ -287,14 +287,14 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
unsigned int offset = 0;
|
||||
|
||||
result = calloc(1, 128 * 96 * 4 * 4 + 100 );
|
||||
|
||||
|
||||
memcpy(result, "P3\n128 96\n255\n", 14);
|
||||
offset = offset + 14;
|
||||
|
||||
temp1 = data[ thumb_start + pixel_count ];
|
||||
|
||||
while (pixel_count < (128*96*2)) {
|
||||
|
||||
|
||||
temp1 = data[ thumb_start + pixel_count ];
|
||||
temp2 = data[ thumb_start + pixel_count + 1 ];
|
||||
temp3 = data[ thumb_start + pixel_count + 2 ];
|
||||
@@ -345,18 +345,18 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case GP_FILE_TYPE_RAW: {
|
||||
char dummy;
|
||||
GP_DEBUG(" * REQUEST FOR RAW IMAGE");
|
||||
|
||||
|
||||
gp_port_usb_msg_write(camera->port,0x0A,to_camera(n),0x0008,NULL,0x0);
|
||||
gp_port_read(camera->port, (char*)indata, 0x100);
|
||||
|
||||
size = indata[ 5 ] + (indata[ 6 ] * 0xFF) + 3;
|
||||
result = calloc(size, 0x100);
|
||||
ptr = result;
|
||||
|
||||
|
||||
gp_port_usb_msg_read(camera->port,0x00,0x0000,0x0521,&dummy,0x0001);
|
||||
gp_port_usb_msg_read(camera->port,0x00,0x0000,0x8000,&dummy,0x0001);
|
||||
|
||||
@@ -387,15 +387,15 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_port_read(camera->port, (char*)indata, 0x100);
|
||||
|
||||
size = indata[ 5 ] + (indata[ 6 ] * 0xFF) + 3;
|
||||
|
||||
|
||||
result = calloc((size+1), 0x100);
|
||||
ptr = result;
|
||||
|
||||
|
||||
gp_port_usb_msg_read(camera->port,0x00,0x0000,0x0521,&dummy,0x0001);
|
||||
gp_port_usb_msg_read(camera->port,0x00,0x0000,0x8000,&dummy,0x0001);
|
||||
|
||||
gp_port_usb_msg_write(camera->port,0x0A,to_camera(n),0x000A,NULL,0x0);
|
||||
|
||||
|
||||
for (j = 0; j < size; j++) {
|
||||
gp_port_read(camera->port, (char*)ptr, 0x100);
|
||||
ptr += 0x100;
|
||||
@@ -436,7 +436,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
result[17] = 0x01;
|
||||
result[18] = 0x00;
|
||||
result[19] = 0x00;
|
||||
|
||||
|
||||
memmove(&result[20],
|
||||
&result[app1len + 4],
|
||||
(unsigned int)(size - app1len - 4));
|
||||
@@ -540,7 +540,7 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
} else {
|
||||
has_compact_flash = 0;
|
||||
}
|
||||
|
||||
|
||||
if (has_compact_flash == 0) {
|
||||
sprintf( summary->text, _("Camera appears to not be using CompactFlash storage\n"
|
||||
"Unfortunately we do not support that at the moment :-(\n"));
|
||||
@@ -613,7 +613,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
* Nevertheless, this is a 0.80 Megapixel camera, no more !!! No matter
|
||||
* what the marketing says!
|
||||
*/
|
||||
|
||||
|
||||
info->preview.fields = GP_FILE_INFO_TYPE;
|
||||
strcpy( info->preview.type, GP_MIME_PPM);
|
||||
info->preview.width = 128;
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -30,13 +30,13 @@
|
||||
|
||||
#include "aox.h"
|
||||
|
||||
#define GP_MODULE "aox"
|
||||
#define GP_MODULE "aox"
|
||||
|
||||
#define WRITE gp_port_usb_msg_write
|
||||
#define READ gp_port_usb_msg_read
|
||||
|
||||
|
||||
int aox_init (GPPort *port, Model *model, Info *info)
|
||||
int aox_init (GPPort *port, Model *model, Info *info)
|
||||
{
|
||||
char c[16];
|
||||
unsigned char hi[2];
|
||||
@@ -49,19 +49,19 @@ int aox_init (GPPort *port, Model *model, Info *info)
|
||||
|
||||
READ(port, 1, 0, 0, c,0x10);
|
||||
WRITE(port, 8, 1, 0, c, 0x10);
|
||||
READ(port, 0xff, 0x07, 0xfffc, c, 4); /* Returns version number, apparently */
|
||||
READ(port, 0x06, 0x0, 0x0, c, 2);
|
||||
READ(port, 0x04, 0x1, 0x1, (char *)lo, 2);
|
||||
GP_DEBUG("%02x %02x number of lo-res pics\n", lo[0],lo[1]);
|
||||
/* We need to keep this information. We presume that
|
||||
* more than 255 pictures is impossible with this camera.
|
||||
READ(port, 0xff, 0x07, 0xfffc, c, 4); /* Returns version number, apparently */
|
||||
READ(port, 0x06, 0x0, 0x0, c, 2);
|
||||
READ(port, 0x04, 0x1, 0x1, (char *)lo, 2);
|
||||
GP_DEBUG("%02x %02x number of lo-res pics\n", lo[0],lo[1]);
|
||||
/* We need to keep this information. We presume that
|
||||
* more than 255 pictures is impossible with this camera.
|
||||
*/
|
||||
memcpy (info, &lo[0], 1);
|
||||
READ(port, 0x04, 0x2, 0x1, c, 2);
|
||||
READ(port, 0x04, 0x3, 0x1, c, 2);
|
||||
READ(port, 0x04, 0x4, 0x1, c, 2);
|
||||
READ(port, 0x04, 0x5, 0x1, (char *)hi, 2);
|
||||
GP_DEBUG("%02i %02i number of hi-res pics\n", hi[0], hi[1]);
|
||||
READ(port, 0x04, 0x2, 0x1, c, 2);
|
||||
READ(port, 0x04, 0x3, 0x1, c, 2);
|
||||
READ(port, 0x04, 0x4, 0x1, c, 2);
|
||||
READ(port, 0x04, 0x5, 0x1, (char *)hi, 2);
|
||||
GP_DEBUG("%02i %02i number of hi-res pics\n", hi[0], hi[1]);
|
||||
/* This information, too. */
|
||||
memcpy (info +1, &hi[0], 1);
|
||||
READ(port, 0x04, 0x6, 0x1, c, 2); /* "Completion" flag.*/
|
||||
@@ -73,19 +73,19 @@ int aox_init (GPPort *port, Model *model, Info *info)
|
||||
}
|
||||
|
||||
|
||||
int aox_get_num_lo_pics (Info *info)
|
||||
int aox_get_num_lo_pics (Info *info)
|
||||
{
|
||||
GP_DEBUG("Running aox_get_num_lo_pics\n");
|
||||
return info[0];
|
||||
}
|
||||
|
||||
int aox_get_num_hi_pics (Info *info)
|
||||
|
||||
int aox_get_num_hi_pics (Info *info)
|
||||
{
|
||||
GP_DEBUG("Running aox_get_num_hi_pics\n");
|
||||
return info[1];
|
||||
}
|
||||
|
||||
int aox_get_picture_size (GPPort *port, int lo, int hi, int n, int k)
|
||||
int aox_get_picture_size (GPPort *port, int lo, int hi, int n, int k)
|
||||
{
|
||||
|
||||
unsigned char c[4];
|
||||
@@ -95,22 +95,22 @@ int aox_get_picture_size (GPPort *port, int lo, int hi, int n, int k)
|
||||
GP_DEBUG("Running aox_get_picture_size for aox_pic%03i\n", k+1);
|
||||
|
||||
if ( ( (lo) && ( n ==k ) && (k ==0)) ) {
|
||||
READ(port, 0x04, 0x1, 0x1, (char *)c, 2);
|
||||
READ(port, 0x04, 0x1, 0x1, (char *)c, 2);
|
||||
}
|
||||
if ( ( (hi) && ( n < k ) && (n == 0)) ) {
|
||||
READ(port, 0x04, 0x5, 0x1, (char *)c, 2);
|
||||
READ(port, 0x04, 0x5, 0x1, (char *)c, 2);
|
||||
}
|
||||
READ(port, 0x05, n+1, 0x1, (char *)c, 4);
|
||||
READ(port, 0x05, n+1, 0x1, (char *)c, 4);
|
||||
size = (int)c[0] + (int)c[1]*0x100 + (int)c[2]*0x10000;
|
||||
GP_DEBUG(" size of picture %i is 0x%x\n", k, size);
|
||||
if ( (size >= 0xfffff ) ) {return GP_ERROR;}
|
||||
if ( (size >= 0xfffff ) ) {return GP_ERROR;}
|
||||
GP_DEBUG("Leaving aox_get_picture_size\n");
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int aox_read_data (GPPort *port, char *data, int size)
|
||||
{
|
||||
static int aox_read_data (GPPort *port, char *data, int size)
|
||||
{
|
||||
int MAX_BULK = 0x1000;
|
||||
|
||||
while(size > 0) {
|
||||
@@ -126,8 +126,8 @@ int aox_read_picture_data (GPPort *port, char *data, int size, int n) {
|
||||
char c[4];
|
||||
memset(c,0,4);
|
||||
|
||||
READ(port, 0x06, n+1, 0x1, c, 4);
|
||||
READ(port, 0x06, n+1, 0x1, c, 4);
|
||||
aox_read_data (port, data , size);
|
||||
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -63,7 +63,7 @@ static struct {
|
||||
} models[] = {
|
||||
{"Concord EyeQMini_1", GP_DRIVER_STATUS_EXPERIMENTAL, 0x03e8, 0x2182},
|
||||
{"Concord EyeQMini_2", GP_DRIVER_STATUS_EXPERIMENTAL, 0x03e8, 0x2180},
|
||||
{"D-MAX DM3588", GP_DRIVER_STATUS_EXPERIMENTAL, 0x03e8, 0x2130},
|
||||
{"D-MAX DM3588", GP_DRIVER_STATUS_EXPERIMENTAL, 0x03e8, 0x2130},
|
||||
{NULL,0,0,0}
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ camera_id (CameraText *id)
|
||||
int
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
CameraAbilities a;
|
||||
|
||||
for (i = 0; models[i].name; i++) {
|
||||
@@ -93,7 +93,7 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
else
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW;
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW;
|
||||
gp_abilities_list_append (list, a);
|
||||
}
|
||||
return GP_OK;
|
||||
@@ -104,13 +104,13 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
{
|
||||
|
||||
int num_lo_pics =aox_get_num_lo_pics(camera->pl->info);
|
||||
int num_hi_pics =aox_get_num_hi_pics(camera->pl->info);
|
||||
int num_hi_pics =aox_get_num_hi_pics(camera->pl->info);
|
||||
|
||||
sprintf (summary->text,_("Your USB camera has an Aox chipset.\n"
|
||||
sprintf (summary->text,_("Your USB camera has an Aox chipset.\n"
|
||||
"Number of lo-res PICs = %i\n"
|
||||
"Number of hi-res PICs = %i\n"
|
||||
"Number of hi-res PICs = %i\n"
|
||||
"Number of PICs = %i\n"
|
||||
), num_lo_pics, num_hi_pics, num_lo_pics+num_hi_pics);
|
||||
), num_lo_pics, num_hi_pics, num_lo_pics+num_hi_pics);
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -130,23 +130,23 @@ static int
|
||||
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
Camera *camera = data;
|
||||
int num_lo_pics = aox_get_num_lo_pics (camera->pl->info);
|
||||
int num_hi_pics = aox_get_num_hi_pics (camera->pl->info);
|
||||
int n = num_hi_pics + num_lo_pics;
|
||||
char name[30];
|
||||
int i;
|
||||
/* Low-resolution pictures are always downloaded first. We do not know
|
||||
int i;
|
||||
/* Low-resolution pictures are always downloaded first. We do not know
|
||||
* yet how to process them, so they will remain in RAW format. */
|
||||
|
||||
|
||||
for (i=0; i< num_lo_pics; i++){
|
||||
snprintf( name, sizeof(name), "aox_pic%03i.raw", i+1 );
|
||||
gp_list_append(list, name, NULL);
|
||||
gp_list_append(list, name, NULL);
|
||||
}
|
||||
|
||||
for (i = num_lo_pics; i < n; i++){
|
||||
snprintf( name, sizeof(name), "aox_pic%03i.ppm", i+1 );
|
||||
gp_list_append(list, name, NULL);
|
||||
snprintf( name, sizeof(name), "aox_pic%03i.ppm", i+1 );
|
||||
gp_list_append(list, name, NULL);
|
||||
}
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -156,24 +156,24 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile *file, void *user_data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
Camera *camera = user_data;
|
||||
|
||||
/* The camera will always download the low-resolution pictures first, if any.
|
||||
* As those are compressed, they are not of fixed size. Unfortunately, the
|
||||
* compression method is not known.
|
||||
* For a high-resolution picture, the size is always the same.
|
||||
* As those are compressed, they are not of fixed size. Unfortunately, the
|
||||
* compression method is not known.
|
||||
* For a high-resolution picture, the size is always the same.
|
||||
* Every picture file has a header, which is of length 0x98. The high-
|
||||
* resolution pictures are just Bayer data; their headers will be discarded.
|
||||
* resolution pictures are just Bayer data; their headers will be discarded.
|
||||
*/
|
||||
|
||||
int i, j, k, n, num_lo_pics, num_hi_pics, w = 0, h = 0;
|
||||
int i, j, k, n, num_lo_pics, num_hi_pics, w = 0, h = 0;
|
||||
unsigned char temp;
|
||||
unsigned char *data;
|
||||
unsigned char *p_data = NULL;
|
||||
unsigned char *output = NULL;
|
||||
unsigned char *output = NULL;
|
||||
int len;
|
||||
int header_len;
|
||||
char header[128];
|
||||
char header[128];
|
||||
unsigned char gtable[256];
|
||||
|
||||
k = gp_filesystem_number(camera->fs, "/", filename, context);
|
||||
@@ -186,17 +186,17 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
GP_DEBUG("There are %i compressed photos\n", num_lo_pics);
|
||||
GP_DEBUG("There are %i hi-res photos\n", num_hi_pics);
|
||||
|
||||
if ( (k < num_lo_pics) ) {
|
||||
n = k;
|
||||
if ( (k < num_lo_pics) ) {
|
||||
n = k;
|
||||
w = 320;
|
||||
h = 240;
|
||||
} else {
|
||||
n = k - num_lo_pics;
|
||||
w = 640;
|
||||
w = 640;
|
||||
h = 480;
|
||||
}
|
||||
|
||||
len = aox_get_picture_size (camera->port, num_lo_pics,
|
||||
len = aox_get_picture_size (camera->port, num_lo_pics,
|
||||
num_hi_pics, n, k);
|
||||
if (len < GP_OK) return len;
|
||||
|
||||
@@ -230,13 +230,13 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
p_data = data + 0x98;
|
||||
/* Picture is mirror-imaged.*/
|
||||
for (i = 0; i < h; ++i) {
|
||||
for (j = 0 ; j < w/2; j++) {
|
||||
for (j = 0 ; j < w/2; j++) {
|
||||
temp = p_data[w*i +j];
|
||||
p_data[w*i +j] = p_data[w*i+ w -1 -j];
|
||||
p_data[w*i + w - 1 - j] = temp;
|
||||
}
|
||||
}
|
||||
/* Not only this, but some columns are
|
||||
}
|
||||
/* Not only this, but some columns are
|
||||
* interchanged, too. */
|
||||
for (i = 0; i < w*h/4; i++) {
|
||||
temp = p_data[4*i +1];
|
||||
@@ -244,22 +244,22 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
p_data[4*i+2] = temp;
|
||||
}
|
||||
/* And now create a ppm file, with our own header */
|
||||
header_len = snprintf(header, 127,
|
||||
"P6\n"
|
||||
"# CREATOR: gphoto2, aox library\n"
|
||||
"%d %d\n"
|
||||
header_len = snprintf(header, 127,
|
||||
"P6\n"
|
||||
"# CREATOR: gphoto2, aox library\n"
|
||||
"%d %d\n"
|
||||
"255\n", w, h);
|
||||
|
||||
output = malloc(3*w*h);
|
||||
if(!output) {
|
||||
free(output);
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
if (camera->pl->model == AOX_MODEL_DMAX)
|
||||
gp_bayer_decode (p_data, w, h,
|
||||
gp_bayer_decode (p_data, w, h,
|
||||
output, BAYER_TILE_RGGB);
|
||||
else
|
||||
gp_bayer_decode (p_data, w, h,
|
||||
gp_bayer_decode (p_data, w, h,
|
||||
output, BAYER_TILE_GRBG);
|
||||
/* gamma correction of .70 may not be optimal. */
|
||||
gp_gamma_fill_table (gtable, .65);
|
||||
@@ -278,7 +278,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
break;
|
||||
default:
|
||||
free (data);
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ camera_exit (Camera *camera, GPContext *context)
|
||||
static CameraFilesystemFuncs fsfuncs = {
|
||||
.file_list_func = file_list_func,
|
||||
.get_file_func = get_file_func
|
||||
};
|
||||
};
|
||||
|
||||
int
|
||||
camera_init(Camera *camera, GPContext *context)
|
||||
@@ -317,10 +317,10 @@ camera_init(Camera *camera, GPContext *context)
|
||||
|
||||
GP_DEBUG ("Initializing the camera\n");
|
||||
ret = gp_port_get_settings(camera->port,&settings);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) return ret;
|
||||
|
||||
ret = gp_camera_get_abilities(camera,&abilities);
|
||||
if (ret < 0) return ret;
|
||||
ret = gp_camera_get_abilities(camera,&abilities);
|
||||
if (ret < 0) return ret;
|
||||
GP_DEBUG("product number is 0x%x\n", abilities.usb_product);
|
||||
|
||||
switch (camera->port->type) {
|
||||
@@ -338,10 +338,10 @@ camera_init(Camera *camera, GPContext *context)
|
||||
}
|
||||
|
||||
ret = gp_port_set_settings(camera->port,settings);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) return ret;
|
||||
|
||||
GP_DEBUG("interface = %i\n", settings.usb.interface);
|
||||
GP_DEBUG("inep = %x\n", settings.usb.inep);
|
||||
GP_DEBUG("inep = %x\n", settings.usb.inep);
|
||||
GP_DEBUG("outep = %x\n", settings.usb.outep);
|
||||
|
||||
/* Tell the CameraFilesystem where to get lists from */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ static const struct eeprom_info {
|
||||
{ "MXIC MX25L8005A", 0xc21420c2, 1048576, 1 },
|
||||
{ "MXIC MX25L1605A", 0xc21520c2, 2097152, 1 },
|
||||
|
||||
{ "Nantronics N25S80", 0xd51430d5, 1048576, 1 },
|
||||
{ "Nantronics N25S80", 0xd51430d5, 1048576, 1 },
|
||||
|
||||
{ "PMC Pm25LV010", 0x007e9d7f, 524288, 0 },
|
||||
|
||||
@@ -268,9 +268,9 @@ ax203_set_time_and_date(Camera *camera, struct tm *t)
|
||||
char cmd_buffer[16];
|
||||
|
||||
memset (cmd_buffer, 0, sizeof (cmd_buffer));
|
||||
|
||||
|
||||
cmd_buffer[0] = AX203_SET_TIME;
|
||||
|
||||
|
||||
cmd_buffer[5] = t->tm_year % 100;
|
||||
|
||||
switch (camera->pl->frame_version) {
|
||||
@@ -319,12 +319,12 @@ static int
|
||||
ax203_eeprom_read(Camera *camera, int address, char *buf, int buf_size)
|
||||
{
|
||||
char cmd[4];
|
||||
|
||||
|
||||
cmd[0] = SPI_EEPROM_READ;
|
||||
cmd[1] = (address >> 16) & 0xff;
|
||||
cmd[2] = (address >> 8) & 0xff;
|
||||
cmd[3] = (address) & 0xff;
|
||||
|
||||
|
||||
return ax203_send_eeprom_cmd (camera, 0, cmd, sizeof(cmd), buf,
|
||||
buf_size, 0);
|
||||
}
|
||||
@@ -339,7 +339,7 @@ ax203_eeprom_program_page(Camera *camera, int address, char *buf, int buf_size,
|
||||
cmd[1] = (address >> 16) & 0xff;
|
||||
cmd[2] = (address >> 8) & 0xff;
|
||||
cmd[3] = (address) & 0xff;
|
||||
|
||||
|
||||
return ax203_send_eeprom_cmd (camera, 1, cmd, sizeof(cmd), buf,
|
||||
buf_size, extra_arg);
|
||||
}
|
||||
@@ -372,7 +372,7 @@ ax203_eeprom_erase_4k_sector(Camera *camera, int address)
|
||||
cmd[1] = (address >> 16) & 0xff;
|
||||
cmd[2] = (address >> 8) & 0xff;
|
||||
cmd[3] = (address) & 0xff;
|
||||
|
||||
|
||||
return ax203_send_eeprom_cmd (camera, 1, cmd, sizeof(cmd), NULL, 0, 0);
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ ax203_eeprom_erase_64k_sector(Camera *camera, int address)
|
||||
cmd[1] = (address >> 16) & 0xff;
|
||||
cmd[2] = (address >> 8) & 0xff;
|
||||
cmd[3] = (address) & 0xff;
|
||||
|
||||
|
||||
return ax203_send_eeprom_cmd (camera, 1, cmd, sizeof(cmd), NULL, 0, 0);
|
||||
}
|
||||
|
||||
@@ -782,7 +782,7 @@ ax203_filesize(Camera *camera)
|
||||
return 0;
|
||||
}
|
||||
/* Never reached */
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -800,7 +800,7 @@ ax203_max_filecount(Camera *camera)
|
||||
sizeof(struct ax3003_v3_5_x_raw_fileinfo);
|
||||
}
|
||||
/* Never reached */
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -905,7 +905,7 @@ int ax206_read_v3_5_x_fileinfo(Camera *camera, int idx,
|
||||
fileinfo->address = le32toh (raw.address);
|
||||
fileinfo->size = le16toh (raw.size);
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -1039,7 +1039,7 @@ int ax203_read_fileinfo(Camera *camera, int idx,
|
||||
return ax3003_read_v3_5_x_fileinfo (camera, idx, fileinfo);
|
||||
}
|
||||
/* Never reached */
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -1057,14 +1057,14 @@ int ax203_write_fileinfo(Camera *camera, int idx,
|
||||
return ax3003_write_v3_5_x_fileinfo (camera, idx, fileinfo);
|
||||
}
|
||||
/* Never reached */
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
ax203_file_present(Camera *camera, int idx)
|
||||
{
|
||||
struct ax203_fileinfo fileinfo;
|
||||
|
||||
|
||||
CHECK (ax203_read_fileinfo (camera, idx, &fileinfo))
|
||||
|
||||
return fileinfo.present;
|
||||
@@ -1102,7 +1102,7 @@ ax203_decode_image(Camera *camera, char *src, int src_size, int **dest)
|
||||
if (!camera->pl->jdec)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
/* Hack for width / heights which are not a multiple of 16 */
|
||||
if (camera->pl->width % 16 || camera->pl->height % 16) {
|
||||
width = (camera->pl->width + 15) & ~15;
|
||||
@@ -1305,7 +1305,7 @@ ax203_defrag_memory(Camera *camera)
|
||||
/* Delete all pictures from the frame */
|
||||
ret = ax203_delete_all (camera);
|
||||
if (ret < 0) goto cleanup;
|
||||
|
||||
|
||||
/* An last write them back (in one continuous block) */
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!fileinfo[i].present)
|
||||
@@ -1771,7 +1771,7 @@ ax203_open_device(Camera *camera)
|
||||
if (ax203_eeprom_info[i].id == id)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!ax203_eeprom_info[i].name) {
|
||||
gp_log (GP_LOG_ERROR, "ax203", "unknown eeprom id: %08x", id);
|
||||
return GP_ERROR_MODEL_NOT_FOUND;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ locate_tables_n_write(JOCTET *jpeg, int jpeg_size, JOCTET table_type,
|
||||
if (jpeg[i] != 0xff) {
|
||||
gp_log (GP_LOG_ERROR, "ax203",
|
||||
"marker does not start with ff?");
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
}
|
||||
if (jpeg[i + 1] == 0xda)
|
||||
break;
|
||||
@@ -94,7 +94,7 @@ add_mcu_info(uint8_t *outbuf, int block_nr, int last_Y, int last_Cb,
|
||||
{
|
||||
int info_addr = block_nr * 8;
|
||||
|
||||
/* skip header */
|
||||
/* skip header */
|
||||
huffman_addr -= 16;
|
||||
info_addr += 16;
|
||||
|
||||
@@ -185,7 +185,7 @@ ax206_compress_jpeg(Camera *camera, int **in, uint8_t *outbuf, int out_size,
|
||||
ret = locate_tables_n_write (regular_jpeg, regular_jpeg_size, 0xdb,
|
||||
outbuf, &outc);
|
||||
if (ret < 0) return ret;
|
||||
|
||||
|
||||
/* Locate huffman tables and write them to outbuf */
|
||||
ret = locate_tables_n_write (regular_jpeg, regular_jpeg_size, 0xc4,
|
||||
outbuf, &outc);
|
||||
@@ -195,7 +195,7 @@ ax206_compress_jpeg(Camera *camera, int **in, uint8_t *outbuf, int out_size,
|
||||
DCT coefficients:
|
||||
1) It wants the MCU huffman data for each new MCU to start on a byte
|
||||
boundary
|
||||
2) The component order in an MCU is Cb Cr Y, rather then Y Cb Cr
|
||||
2) The component order in an MCU is Cb Cr Y, rather then Y Cb Cr
|
||||
|
||||
We solve both these issues by decompressing the regular jpeg we've
|
||||
just created into its raw coefficients, following by creating
|
||||
@@ -228,7 +228,7 @@ ax206_compress_jpeg(Camera *camera, int **in, uint8_t *outbuf, int out_size,
|
||||
#endif
|
||||
jpeg_set_defaults (&cinfo);
|
||||
/* We will write Cb values as comp. 0, so give it chroma settings */
|
||||
cinfo.comp_info[0].h_samp_factor = 1;
|
||||
cinfo.comp_info[0].h_samp_factor = 1;
|
||||
cinfo.comp_info[0].v_samp_factor = 1;
|
||||
cinfo.comp_info[0].quant_tbl_no = 1;
|
||||
cinfo.comp_info[0].dc_tbl_no = 1;
|
||||
@@ -329,14 +329,14 @@ ax206_compress_jpeg(Camera *camera, int **in, uint8_t *outbuf, int out_size,
|
||||
if (i >= buf_size) {
|
||||
gp_log (GP_LOG_ERROR, "ax203",
|
||||
"missing in ff da marker?");
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
}
|
||||
|
||||
size = buf_size - i - 2;
|
||||
if ((outc + size) > out_size) {
|
||||
gp_log (GP_LOG_ERROR, "ax203",
|
||||
"jpeg output buffer overflow");
|
||||
return GP_ERROR_FIXED_LIMIT_EXCEEDED;
|
||||
return GP_ERROR_FIXED_LIMIT_EXCEEDED;
|
||||
}
|
||||
outc += copy_huffman(outbuf + outc, buf + i, size);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ ax203_decode_component_values(char *src, char *dest)
|
||||
int i, table, corr;
|
||||
dest[0] = src[0] & ~0x07;
|
||||
table = (src[0] >> 1) & 3;
|
||||
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
@@ -99,7 +99,7 @@ ax203_decode_block_yuv_delta(char *src, int **dest, int dest_x, int dest_y)
|
||||
/* The Y components are stored 4 at a time in a pattern like this:
|
||||
1 2 1 2
|
||||
3 4 3 4
|
||||
|
||||
|
||||
1 2 1 2
|
||||
3 4 3 4 */
|
||||
for (y = 0; y < 4; y += 2) {
|
||||
@@ -221,7 +221,7 @@ ax203_encode_signed_component_values(int8_t *src, char *dest)
|
||||
}
|
||||
/* If we did not break out the above loop the min / max
|
||||
correction in the current table is enough */
|
||||
if (j == 4)
|
||||
if (j == 4)
|
||||
break;
|
||||
}
|
||||
table = i;
|
||||
@@ -271,7 +271,7 @@ ax203_encode_unsigned_component_values(uint8_t *src, char *dest)
|
||||
}
|
||||
/* If we did not break out the above loop the min / max
|
||||
correction in the current table is enough */
|
||||
if (j == 4)
|
||||
if (j == 4)
|
||||
break;
|
||||
}
|
||||
table = i;
|
||||
@@ -352,7 +352,7 @@ ax203_encode_block_yuv_delta(int **src, int src_x, int src_y, char *dest)
|
||||
/* The Y components are stored 4 at a time in a pattern like this:
|
||||
1 2 1 2
|
||||
3 4 3 4
|
||||
|
||||
|
||||
1 2 1 2
|
||||
3 4 3 4 */
|
||||
for (y = 0; y < 4; y += 2) {
|
||||
|
||||
@@ -213,15 +213,15 @@ init_destination (j_compress_ptr cinfo)
|
||||
* Empty the output buffer --- called whenever buffer fills up.
|
||||
*
|
||||
* In typical applications, this should write the entire output buffer
|
||||
* (ignoring the current state of next_output_byte & free_in_buffer),
|
||||
* (ignoring the current state of next_output_byte & free_in_buffer),
|
||||
* reset the pointer & count to the start of the buffer, and return TRUE
|
||||
* indicating that the buffer has been dumped.
|
||||
*
|
||||
* In applications that need to be able to suspend compression due to output
|
||||
* overrun, a FALSE return indicates that the buffer cannot be emptied now.
|
||||
* overrun, a FALSE return indicates that the buffer cannot be emptied now.
|
||||
* In this situation, the compressor will return to its caller (possibly with
|
||||
* an indication that it has not accepted all the supplied scanlines). The
|
||||
* application should resume compression after it has made more room in the
|
||||
* an indication that it has not accepted all the supplied scanlines). The
|
||||
* application should resume compression after it has made more room in the
|
||||
* output buffer. Note that there are substantial restrictions on the use of
|
||||
* suspension --- see the documentation.
|
||||
*
|
||||
@@ -249,7 +249,7 @@ empty_output_buffer (j_compress_ptr cinfo)
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminate destination --- called by jpeg_finish_compress
|
||||
* Terminate destination --- called by jpeg_finish_compress
|
||||
* after all data has been written. Usually needs to flush buffer.
|
||||
*
|
||||
* NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
a.usb_vendor = ax203_devinfo[i].vendor_id;
|
||||
a.usb_product= ax203_devinfo[i].product_id;
|
||||
a.operations = GP_OPERATION_NONE;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_PUT_FILE |
|
||||
a.folder_operations = GP_FOLDER_OPERATION_PUT_FILE |
|
||||
GP_FOLDER_OPERATION_DELETE_ALL;
|
||||
/* FIXME add support for downloading RAW images */
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
@@ -212,7 +212,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
ret = gp_file_set_mime_type (file, GP_MIME_PNG);
|
||||
if (ret < 0) { gdFree (gdpng); return ret; }
|
||||
|
||||
ret = gp_file_set_name (file, filename);
|
||||
ret = gp_file_set_name (file, filename);
|
||||
if (ret < 0) { gdFree (gdpng); return ret; }
|
||||
|
||||
ret = gp_file_append (file, gdpng, size);
|
||||
@@ -225,7 +225,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
}
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
#ifdef HAVE_LIBGD
|
||||
@@ -360,7 +360,7 @@ static int
|
||||
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
Camera *camera = data;
|
||||
int i, count, present;
|
||||
char buf[30];
|
||||
|
||||
@@ -467,7 +467,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
}
|
||||
|
||||
static int
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
{
|
||||
char buf[2];
|
||||
|
||||
@@ -483,7 +483,7 @@ camera_exit (Camera *camera, GPContext *context)
|
||||
}
|
||||
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
CameraAbilities a;
|
||||
int i, ret;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* *** NOTE: This is a modified version to deal with the ax203 "JPEG" fmt
|
||||
* *** This version can not decompress regular JPEG files, see
|
||||
* *** README.ax203-compression for details
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2006, Luc Saillard <luc@saillard.org>
|
||||
*
|
||||
* ax203 modifications:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* *** NOTE: This is a modified version to deal with the ax203 "JPEG" fmt
|
||||
* *** This version can not decompress regular JPEG files, see
|
||||
* *** README.ax203-compression for details
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2006, Luc Saillard <luc@saillard.org>
|
||||
*
|
||||
* ax203 modifications:
|
||||
@@ -815,7 +815,7 @@ int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, u
|
||||
stream += 16;
|
||||
|
||||
/* Skip MCU info blocks (we don't need them) */
|
||||
stream += (priv->width / (8 * priv->component_infos[cY].Hfactor)) *
|
||||
stream += (priv->width / (8 * priv->component_infos[cY].Hfactor)) *
|
||||
(priv->height / (8 * priv->component_infos[cY].Vfactor)) * 8;
|
||||
|
||||
/* Parse DQT table */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* *** NOTE: This is a modified version to deal with the ax203 "JPEG" fmt
|
||||
* *** This version can not decompress regular JPEG files, see
|
||||
* *** README.ax203-compression for details
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2006, Luc Saillard <luc@saillard.org>
|
||||
*
|
||||
* ax203 modifications:
|
||||
|
||||
@@ -468,7 +468,7 @@ filename_to_audio(const char *filename, const char __unused__ *newext)
|
||||
* @camera: Camera to work on
|
||||
* @filename: the file for which to get the name of the audio annotation
|
||||
*
|
||||
* The identifier returned is
|
||||
* The identifier returned is
|
||||
* a) NULL if no audio file exists for this file or an internal error occurred
|
||||
* b) pointer to string with file name of the corresponding thumbnail
|
||||
* c) pointer to filename in case filename is a thumbnail itself
|
||||
@@ -510,7 +510,7 @@ canon_int_filename2audioname (Camera __unused__ *camera, const char *filename)
|
||||
* @camera: Camera to work on
|
||||
* @filename: the file to get the name of the thumbnail of
|
||||
*
|
||||
* The identifier returned is
|
||||
* The identifier returned is
|
||||
* a) NULL if no thumbnail exists for this file or an internal error occurred
|
||||
* b) pointer to empty string if thumbnail is contained in the file itself
|
||||
* c) pointer to string with file name of the corresponding thumbnail
|
||||
@@ -659,7 +659,7 @@ canon_int_directory_operations (Camera *camera, const char *path, canonDirFuncti
|
||||
*
|
||||
* Gets the camera identification string, usually the owner name.
|
||||
*
|
||||
* This information is then stored in the "camera" structure, which
|
||||
* 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.
|
||||
@@ -919,12 +919,12 @@ canon_int_do_control_command (Camera *camera, unsigned int subcmd, int a, int b)
|
||||
* response. It also needs an extra zero byte at the
|
||||
* end. */
|
||||
payload[payloadlen++] = 0;
|
||||
msg = canon_usb_dialogue ( camera,
|
||||
msg = canon_usb_dialogue ( camera,
|
||||
CANON_USB_FUNCTION_CONTROL_CAMERA_2,
|
||||
&datalen, payload, payloadlen );
|
||||
}
|
||||
else
|
||||
msg = canon_usb_dialogue ( camera,
|
||||
msg = canon_usb_dialogue ( camera,
|
||||
CANON_USB_FUNCTION_CONTROL_CAMERA,
|
||||
&datalen, payload, payloadlen );
|
||||
if ( msg == NULL && datalen != 0x1c) {
|
||||
@@ -948,7 +948,7 @@ canon_int_do_control_command (Camera *camera, unsigned int subcmd, int a, int b)
|
||||
* @payload: pointer to the payload data buffer to send to the camera
|
||||
* @payloadlen: length of the payload to send to the camera
|
||||
* @response_handle: pointer to a pointer where the camera response buffer
|
||||
* address should be stored.
|
||||
* address should be stored.
|
||||
* @datalen: the length of the response data from the camera
|
||||
*
|
||||
* Executes a command with arbitrary parameter data that returns data
|
||||
@@ -962,7 +962,7 @@ canon_int_do_control_command (Camera *camera, unsigned int subcmd, int a, int b)
|
||||
static int
|
||||
canon_int_do_control_dialogue_payload (Camera *camera, unsigned char *payload,
|
||||
unsigned int payloadlen,
|
||||
unsigned char **response_handle,
|
||||
unsigned char **response_handle,
|
||||
unsigned int *datalen)
|
||||
{
|
||||
unsigned char *msg;
|
||||
@@ -974,12 +974,12 @@ canon_int_do_control_dialogue_payload (Camera *camera, unsigned char *payload,
|
||||
* response. It also needs an extra zero byte at the
|
||||
* end. */
|
||||
payload[payloadlen++] = 0;
|
||||
msg = canon_usb_dialogue_full ( camera,
|
||||
msg = canon_usb_dialogue_full ( camera,
|
||||
CANON_USB_FUNCTION_CONTROL_CAMERA_2,
|
||||
datalen, payload, payloadlen);
|
||||
}
|
||||
else
|
||||
msg = canon_usb_dialogue_full ( camera,
|
||||
msg = canon_usb_dialogue_full ( camera,
|
||||
CANON_USB_FUNCTION_CONTROL_CAMERA,
|
||||
datalen, payload, payloadlen);
|
||||
|
||||
@@ -1005,10 +1005,10 @@ canon_int_do_control_dialogue_payload (Camera *camera, unsigned char *payload,
|
||||
* @a: 32-bit first word of payload (first command parameter)
|
||||
* @b: 32-bit second word of payload (second command parameter)
|
||||
* @response_handle: pointer to a pointer where the camera response buffer
|
||||
* address should be stored.
|
||||
* address should be stored.
|
||||
* @datalen: the length of the response data from the camera
|
||||
*
|
||||
* Executes a remote capture command that returns data from the
|
||||
* Executes a remote capture command that returns data from the
|
||||
* camera, e.g., get release parameters.
|
||||
*
|
||||
* Returns: gphoto2 status code, camera response data in @response_handle,
|
||||
@@ -1029,7 +1029,7 @@ canon_int_do_control_dialogue (Camera *camera, unsigned int subcmd, int a, int b
|
||||
GP_DEBUG("%s++ with %x, %x", desc, a, b);
|
||||
|
||||
status = canon_int_do_control_dialogue_payload (camera, payload,
|
||||
payloadlen,
|
||||
payloadlen,
|
||||
response_handle, datalen);
|
||||
|
||||
if ( status < 0 ) {
|
||||
@@ -1055,14 +1055,14 @@ canon_int_do_control_dialogue (Camera *camera, unsigned int subcmd, int a, int b
|
||||
* Returns: gphoto2 status code
|
||||
*
|
||||
*/
|
||||
int
|
||||
canon_int_start_remote_control (Camera *camera, GPContext __unused__ *context)
|
||||
int
|
||||
canon_int_start_remote_control (Camera *camera, GPContext __unused__ *context)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (camera->pl->remote_control) {
|
||||
GP_DEBUG ("canon_int_start_remote_control: Camera already under remote control");
|
||||
return GP_ERROR;
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
/* Init, extends camera lens, puts us in remote capture mode */
|
||||
@@ -1070,7 +1070,7 @@ canon_int_start_remote_control (Camera *camera, GPContext __unused__ *context)
|
||||
CANON_USB_CONTROL_INIT, 0, 0);
|
||||
|
||||
|
||||
if (status == GP_OK)
|
||||
if (status == GP_OK)
|
||||
camera->pl->remote_control = 1;
|
||||
|
||||
return status;
|
||||
@@ -1088,8 +1088,8 @@ canon_int_start_remote_control (Camera *camera, GPContext __unused__ *context)
|
||||
* Returns: gphoto2 status code
|
||||
*
|
||||
*/
|
||||
int
|
||||
canon_int_end_remote_control (Camera *camera, GPContext __unused__ *context)
|
||||
int
|
||||
canon_int_end_remote_control (Camera *camera, GPContext __unused__ *context)
|
||||
{
|
||||
int status;
|
||||
|
||||
@@ -1103,7 +1103,7 @@ canon_int_end_remote_control (Camera *camera, GPContext __unused__ *context)
|
||||
CANON_USB_CONTROL_EXIT, 0, 0);
|
||||
|
||||
|
||||
if (status == GP_OK)
|
||||
if (status == GP_OK)
|
||||
camera->pl->remote_control = 0;
|
||||
|
||||
return status;
|
||||
@@ -1138,14 +1138,14 @@ canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *l
|
||||
unsigned int b_length_orig = 0;
|
||||
unsigned int *b_length = &b_length_orig;
|
||||
unsigned char *b_data_orig = NULL;
|
||||
unsigned char **b_data = &b_data_orig;
|
||||
unsigned char **b_data = &b_data_orig;
|
||||
|
||||
int photo_status;
|
||||
|
||||
/* Should we download the thumbnail, or the full image ? */
|
||||
if (camera->pl->capture_size == CAPTURE_FULL_IMAGE)
|
||||
if (camera->pl->capture_size == CAPTURE_FULL_IMAGE)
|
||||
transfermode = REMOTE_CAPTURE_FULL_TO_PC;
|
||||
else
|
||||
else
|
||||
transfermode = REMOTE_CAPTURE_THUMB_TO_PC;
|
||||
|
||||
switch (camera->port->type) {
|
||||
@@ -1156,14 +1156,14 @@ canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *l
|
||||
|
||||
camera->pl->image_b_key = 0x0;
|
||||
camera->pl->image_b_length = 0x0;
|
||||
|
||||
|
||||
/*
|
||||
* Send a sequence of CONTROL_CAMERA commands.
|
||||
*/
|
||||
|
||||
if (!camera->pl->remote_control) {
|
||||
gp_port_set_timeout (camera->port, 15000);
|
||||
|
||||
|
||||
status = canon_int_start_remote_control (camera, context);
|
||||
if ( status < 0 )
|
||||
return status;
|
||||
@@ -1221,12 +1221,12 @@ canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *l
|
||||
/* Try to leave camera in a usable state. */
|
||||
canon_int_end_remote_control (camera, context);
|
||||
|
||||
/* XXX It would be nice if we had a way to
|
||||
/* XXX It would be nice if we had a way to
|
||||
decode the camera error state for the caller
|
||||
application. For example,
|
||||
application. For example,
|
||||
photo_status == 0x01 seems to mean
|
||||
"autofocus failure" on the EOS 5D. */
|
||||
if (photo_status != 0)
|
||||
if (photo_status != 0)
|
||||
return GP_ERROR_CAMERA_ERROR;
|
||||
else
|
||||
return GP_ERROR_OS_FAILURE;
|
||||
@@ -1234,7 +1234,7 @@ canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *l
|
||||
}
|
||||
|
||||
if (transfermode == REMOTE_CAPTURE_FULL_TO_PC) {
|
||||
|
||||
|
||||
/* Download the image. */
|
||||
if ( camera->pl->image_length > 0 ) {
|
||||
status = canon_usb_get_captured_image ( camera, camera->pl->image_key, data, length, context );
|
||||
@@ -1244,7 +1244,7 @@ canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *l
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Download the secondary image, if one exists */
|
||||
if ( camera->pl->image_b_length > 0 ) {
|
||||
status = canon_usb_get_captured_secondary_image ( camera, camera->pl->image_b_key, b_data, b_length, context );
|
||||
@@ -1253,15 +1253,15 @@ canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *l
|
||||
" secondary image download failed, status= %i", status );
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/* Get rid of it */
|
||||
/* XXX maybe this should be changed in the future
|
||||
/* XXX maybe this should be changed in the future
|
||||
* to do something else with it */
|
||||
free(b_data_orig);
|
||||
}
|
||||
|
||||
|
||||
} else if (transfermode == REMOTE_CAPTURE_THUMB_TO_PC) {
|
||||
|
||||
|
||||
/* Download the thumbnail image. */
|
||||
if ( camera->pl->thumb_length > 0 ) {
|
||||
status = canon_usb_get_captured_thumbnail ( camera, camera->pl->image_key, data, length, context );
|
||||
@@ -1271,9 +1271,9 @@ canon_int_capture_preview (Camera *camera, unsigned char **data, unsigned int *l
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case GP_PORT_SERIAL:
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
@@ -1473,9 +1473,9 @@ canon_int_capture_image (Camera *camera, CameraFilePath *path,
|
||||
int photo_status;
|
||||
|
||||
/* Should we save the thumbnail, or the full image ? */
|
||||
if (camera->pl->capture_size == CAPTURE_THUMB)
|
||||
if (camera->pl->capture_size == CAPTURE_THUMB)
|
||||
transfermode = REMOTE_CAPTURE_THUMB_TO_DRIVE;
|
||||
else
|
||||
else
|
||||
transfermode = REMOTE_CAPTURE_FULL_TO_DRIVE;
|
||||
|
||||
switch (camera->port->type) {
|
||||
@@ -1611,14 +1611,14 @@ canon_int_capture_image (Camera *camera, CameraFilePath *path,
|
||||
canon_int_end_remote_control (camera, context);
|
||||
|
||||
free ( initial_state );
|
||||
/* XXX It would be nice if we had a way to
|
||||
/* XXX It would be nice if we had a way to
|
||||
decode the camera error state for the caller
|
||||
application. For example,
|
||||
application. For example,
|
||||
photo_status == 0x01 seems to mean
|
||||
"autofocus failure" on the EOS 5D. */
|
||||
if (photo_status != 0)
|
||||
if (photo_status != 0)
|
||||
return GP_ERROR_CAMERA_ERROR;
|
||||
else
|
||||
else
|
||||
return GP_ERROR_OS_FAILURE;
|
||||
|
||||
}
|
||||
@@ -1720,8 +1720,8 @@ canon_int_set_file_attributes (Camera *camera, const char *file, const char *dir
|
||||
*
|
||||
* Reads the camera's release parameters (ISO, aperture, shutter speed, etc)
|
||||
*
|
||||
* Right now this has only been tested on an EOS 5D via USB.
|
||||
* Note that the camera must be under USB control via
|
||||
* Right now this has only been tested on an EOS 5D via USB.
|
||||
* Note that the camera must be under USB control via
|
||||
* canon_int_start_remote_control() before calling this function.
|
||||
*
|
||||
* Returns: gphoto2 error code
|
||||
@@ -1737,7 +1737,7 @@ canon_int_get_release_params (Camera *camera, GPContext *context)
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params()");
|
||||
|
||||
/* canon_int_start_remote_control() must be called before
|
||||
/* canon_int_start_remote_control() must be called before
|
||||
this function */
|
||||
if (!camera->pl->remote_control) {
|
||||
GP_DEBUG ("canon_int_get_release_params: Camera not under USB control");
|
||||
@@ -1770,36 +1770,36 @@ canon_int_get_release_params (Camera *camera, GPContext *context)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 0x5c is the offset to the camera parameters in the
|
||||
* get release params response data
|
||||
/*
|
||||
* 0x5c is the offset to the camera parameters in the
|
||||
* get release params response data
|
||||
*/
|
||||
memcpy(camera->pl->release_params, response + 0x5c,
|
||||
memcpy(camera->pl->release_params, response + 0x5c,
|
||||
sizeof(camera->pl->release_params));
|
||||
|
||||
for (i=0;i<sizeof(camera->pl->release_params);i++) {
|
||||
GP_DEBUG("canon_int_get_release_params: [%d] = 0x%02x", i, camera->pl->release_params[i]);
|
||||
}
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: shutter speed = 0x%02x",
|
||||
GP_DEBUG ("canon_int_get_release_params: shutter speed = 0x%02x",
|
||||
camera->pl->release_params[SHUTTERSPEED_INDEX]);
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: aperture = 0x%02x",
|
||||
GP_DEBUG ("canon_int_get_release_params: aperture = 0x%02x",
|
||||
camera->pl->release_params[APERTURE_INDEX]);
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: iso = 0x%02x",
|
||||
GP_DEBUG ("canon_int_get_release_params: iso = 0x%02x",
|
||||
camera->pl->release_params[ISO_INDEX]);
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: focus mode = 0x%02x",
|
||||
GP_DEBUG ("canon_int_get_release_params: focus mode = 0x%02x",
|
||||
camera->pl->release_params[FOCUS_MODE_INDEX]);
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: beep mode = 0x%02x",
|
||||
GP_DEBUG ("canon_int_get_release_params: beep mode = 0x%02x",
|
||||
camera->pl->release_params[BEEP_INDEX]);
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: flash mode = 0x%02x",
|
||||
GP_DEBUG ("canon_int_get_release_params: flash mode = 0x%02x",
|
||||
camera->pl->release_params[FLASH_INDEX]);
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: exposurebias = 0x%02x",
|
||||
GP_DEBUG ("canon_int_get_release_params: exposurebias = 0x%02x",
|
||||
camera->pl->release_params[EXPOSUREBIAS_INDEX]);
|
||||
|
||||
GP_DEBUG ("canon_int_get_release_params: shooting mode = 0x%02x",
|
||||
@@ -1809,13 +1809,13 @@ canon_int_get_release_params (Camera *camera, GPContext *context)
|
||||
camera->pl->secondary_image = 0;
|
||||
/* Based on the image format settings in the release params,
|
||||
determine whether we expect one or two images to be returned
|
||||
by the camera.
|
||||
I am not sure if this will work correctly for non-EOS 5D
|
||||
by the camera.
|
||||
I am not sure if this will work correctly for non-EOS 5D
|
||||
cameras - I would appreciate testing feedback from other
|
||||
Canon camera users. To test try capturing an image
|
||||
to the host computer in a single format (e.g., RAW or Large Fine
|
||||
JPEG). Also try capturing an image when the camera is set to
|
||||
a dual format, e.g., RAW + Large Fine JPEG. Note that currently, we
|
||||
Canon camera users. To test try capturing an image
|
||||
to the host computer in a single format (e.g., RAW or Large Fine
|
||||
JPEG). Also try capturing an image when the camera is set to
|
||||
a dual format, e.g., RAW + Large Fine JPEG. Note that currently, we
|
||||
only save the primary image to disk.
|
||||
Thanks - <paul@booyaka.com>
|
||||
*/
|
||||
@@ -1829,7 +1829,7 @@ canon_int_get_release_params (Camera *camera, GPContext *context)
|
||||
/**
|
||||
* canon_int_set_shutter_speed
|
||||
* @camera: camera to work with
|
||||
* @shutter_speed: shutter speed - use one of the defines such as
|
||||
* @shutter_speed: shutter speed - use one of the defines such as
|
||||
* SHUTTER_SPEED_1_15 for 1/15th of a second, etc.
|
||||
* @context: context for error reporting
|
||||
*
|
||||
@@ -1848,51 +1848,51 @@ canon_int_set_shutter_speed (Camera *camera, canonShutterSpeedState shutter_spee
|
||||
shutter_speed);
|
||||
|
||||
/* Get the current camera settings */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Modify the shutter speed */
|
||||
|
||||
|
||||
/* XXX must test for valid shutter speeds here */
|
||||
camera->pl->release_params[SHUTTERSPEED_INDEX] = shutter_speed;
|
||||
|
||||
|
||||
/* Upload the shutter speed to the camera */
|
||||
status = canon_int_set_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Make sure the camera changed it! */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
if (camera->pl->release_params[SHUTTERSPEED_INDEX] != shutter_speed) {
|
||||
GP_DEBUG ("canon_int_set_shutter_speed: Could not set shutter "
|
||||
"speed to 0x%02x (camera returned 0x%02x)",
|
||||
shutter_speed,
|
||||
"speed to 0x%02x (camera returned 0x%02x)",
|
||||
shutter_speed,
|
||||
camera->pl->release_params[SHUTTERSPEED_INDEX]);
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_shutter_speed: shutter speed change verified");
|
||||
}
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_shutter_speed() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* canon_int_set_beep
|
||||
* @camera: camera to work with
|
||||
* @beep_mode: beep mode - use one of the defines such as
|
||||
* @beep_mode: beep mode - use one of the defines such as
|
||||
* BEEP_ON for turning on the beep when the camera sets the focus.
|
||||
* @context: context for error reporting
|
||||
*
|
||||
@@ -1911,49 +1911,49 @@ canon_int_set_beep (Camera *camera, canonBeepMode beep_mode,
|
||||
beep_mode);
|
||||
|
||||
/* Get the current camera settings */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* Modify the beep mode */
|
||||
|
||||
|
||||
/* XXX must test for valid shutter speeds here */
|
||||
camera->pl->release_params[BEEP_INDEX] = beep_mode;
|
||||
|
||||
|
||||
/* Upload the beep mode to the camera */
|
||||
status = canon_int_set_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Make sure the camera changed it! */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
if (camera->pl->release_params[BEEP_INDEX] != beep_mode) {
|
||||
GP_DEBUG ("canon_int_set_beep: Could not set beep "
|
||||
"mode to 0x%02x (camera returned 0x%02x)",
|
||||
"mode to 0x%02x (camera returned 0x%02x)",
|
||||
beep_mode,
|
||||
camera->pl->release_params[BEEP_INDEX]);
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_beep: beep mode change verified");
|
||||
}
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_beep() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* canon_int_set_flash
|
||||
* @camera: camera to work with
|
||||
* @flash_mode: flash mode - use one of the defines such as
|
||||
* @flash_mode: flash mode - use one of the defines such as
|
||||
* FLASH_MODE_OFF for turning off the flash.
|
||||
* @context: context for error reporting
|
||||
*
|
||||
@@ -1972,43 +1972,43 @@ canon_int_set_flash (Camera *camera, canonFlashMode flash_mode,
|
||||
flash_mode);
|
||||
|
||||
/* Get the current camera settings */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* Modify the beep mode */
|
||||
|
||||
|
||||
/* XXX must test for valid flash mode here */
|
||||
camera->pl->release_params[FLASH_INDEX] = flash_mode;
|
||||
|
||||
|
||||
/* Upload the flash mode to the camera */
|
||||
status = canon_int_set_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Make sure the camera changed it! */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
if (camera->pl->release_params[FLASH_INDEX] != flash_mode) {
|
||||
GP_DEBUG ("canon_int_set_flash: Could not set flash "
|
||||
"mode to 0x%02x (camera returned 0x%02x)",
|
||||
"mode to 0x%02x (camera returned 0x%02x)",
|
||||
flash_mode,
|
||||
camera->pl->release_params[FLASH_INDEX]);
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_flash: flash mode change verified");
|
||||
}
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_flash() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2031,15 +2031,15 @@ canon_int_set_zoom (Camera *camera, unsigned char zoom_level,
|
||||
|
||||
GP_DEBUG ("canon_int_set_zoom() called for zoom 0x%02x",
|
||||
zoom_level);
|
||||
|
||||
|
||||
status = canon_int_do_control_command( camera, CANON_USB_CONTROL_SET_ZOOM_POS, 0x04, zoom_level );
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_zoom() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2124,7 +2124,7 @@ canon_int_get_zoom (Camera *camera,
|
||||
*/
|
||||
int
|
||||
canon_int_set_image_format (Camera *camera, unsigned char res_byte1,
|
||||
unsigned char res_byte2, unsigned char res_byte3,
|
||||
unsigned char res_byte2, unsigned char res_byte3,
|
||||
GPContext *context)
|
||||
{
|
||||
int status;
|
||||
@@ -2132,45 +2132,45 @@ canon_int_set_image_format (Camera *camera, unsigned char res_byte1,
|
||||
GP_DEBUG ("canon_int_set_image_format() called");
|
||||
|
||||
/* Get the current camera settings */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Modify the image format */
|
||||
|
||||
camera->pl->release_params[IMAGE_FORMAT_1_INDEX] = res_byte1;
|
||||
camera->pl->release_params[IMAGE_FORMAT_2_INDEX] = res_byte2;
|
||||
camera->pl->release_params[IMAGE_FORMAT_3_INDEX] = res_byte3;
|
||||
|
||||
|
||||
|
||||
/* Upload the image_format to the camera */
|
||||
status = canon_int_set_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* It seems to take the camera body a while to change this parameter
|
||||
when all three res_bytes are changed at once.
|
||||
|
||||
/* It seems to take the camera body a while to change this parameter
|
||||
when all three res_bytes are changed at once.
|
||||
So, give the camera a chance to catch up.
|
||||
3750 us was occasionally too short, but 5000 us seems to
|
||||
3750 us was occasionally too short, but 5000 us seems to
|
||||
work well. */
|
||||
usleep(5000);
|
||||
|
||||
/* Make sure the camera changed it! */
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
if (camera->pl->release_params[IMAGE_FORMAT_1_INDEX] != res_byte1 ||
|
||||
camera->pl->release_params[IMAGE_FORMAT_2_INDEX] != res_byte2 ||
|
||||
camera->pl->release_params[IMAGE_FORMAT_3_INDEX] != res_byte3) {
|
||||
GP_DEBUG ("canon_int_set_image_format: Could not set image format "
|
||||
"to 0x%02x 0x%02x 0x%02x (camera returned 0x%02x 0x%02x 0x%02x)",
|
||||
res_byte1, res_byte2, res_byte3,
|
||||
"to 0x%02x 0x%02x 0x%02x (camera returned 0x%02x 0x%02x 0x%02x)",
|
||||
res_byte1, res_byte2, res_byte3,
|
||||
camera->pl->release_params[IMAGE_FORMAT_1_INDEX],
|
||||
camera->pl->release_params[IMAGE_FORMAT_2_INDEX],
|
||||
camera->pl->release_params[IMAGE_FORMAT_3_INDEX]);
|
||||
@@ -2178,17 +2178,17 @@ canon_int_set_image_format (Camera *camera, unsigned char res_byte1,
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_image_format: image_format change verified");
|
||||
}
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_image_format() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* canon_int_set_iso
|
||||
* @camera: camera to work with
|
||||
* @iso: ISO - use one of the defines such as ISO_400, etc.
|
||||
* @iso: ISO - use one of the defines such as ISO_400, etc.
|
||||
* @context: context for error reporting
|
||||
*
|
||||
* Sets the camera's ISO speed. Only tested for EOS 5D via USB.
|
||||
@@ -2205,41 +2205,41 @@ canon_int_set_iso (Camera *camera, canonIsoState iso,
|
||||
GP_DEBUG ("canon_int_set_iso() called for ISO 0x%02x", iso);
|
||||
|
||||
/* Get the current camera settings */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* Modify the ISO */
|
||||
|
||||
|
||||
camera->pl->release_params[ISO_INDEX] = iso;
|
||||
|
||||
|
||||
/* Upload the ISO to the camera */
|
||||
status = canon_int_set_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Make sure the camera changed it! */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
if (camera->pl->release_params[ISO_INDEX] != iso) {
|
||||
GP_DEBUG ("canon_int_set_iso: Could not set ISO "
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
iso, camera->pl->release_params[ISO_INDEX]);
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_iso: ISO change verified");
|
||||
}
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_iso() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2292,7 +2292,7 @@ canon_int_set_shooting_mode (Camera *camera, unsigned char shooting_mode,
|
||||
/**
|
||||
* canon_int_set_aperture
|
||||
* @camera: camera to work with
|
||||
* @aperture: use one of the defines such as APERTURE_F5_6, etc.
|
||||
* @aperture: use one of the defines such as APERTURE_F5_6, etc.
|
||||
* @context: context for error reporting
|
||||
*
|
||||
* Sets the camera's aperture. Only tested for EOS 5D via USB.
|
||||
@@ -2310,42 +2310,42 @@ canon_int_set_aperture (Camera *camera, canonApertureState aperture,
|
||||
aperture);
|
||||
|
||||
/* Get the current camera settings */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
/* Modify the aperture */
|
||||
|
||||
|
||||
camera->pl->release_params[APERTURE_INDEX] = aperture;
|
||||
|
||||
|
||||
/* Upload the aperture to the camera */
|
||||
status = canon_int_set_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Make sure the camera changed it! */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
if (camera->pl->release_params[APERTURE_INDEX] != aperture) {
|
||||
GP_DEBUG ("canon_int_set_aperture: Could not set aperture "
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
aperture,
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
aperture,
|
||||
camera->pl->release_params[APERTURE_INDEX]);
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_aperture: aperture change verified");
|
||||
}
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_aperture() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2383,25 +2383,25 @@ canon_int_set_exposurebias (Camera *camera, unsigned char expbias,
|
||||
return status;
|
||||
if (camera->pl->release_params[EXPOSUREBIAS_INDEX] != expbias) {
|
||||
GP_DEBUG ("canon_int_set_exposurebias: Could not set exposure bias "
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
expbias,
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
expbias,
|
||||
camera->pl->release_params[EXPOSUREBIAS_INDEX]);
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_exposurebias: expbias change verified");
|
||||
}
|
||||
GP_DEBUG ("canon_int_set_exposurebias() finished successfully");
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* canon_int_set_focus_mode
|
||||
* @camera: camera to work with
|
||||
* @focus_mode: use one of the defines such as AUTO_FOCUS_AI_SERVO, etc.
|
||||
* @focus_mode: use one of the defines such as AUTO_FOCUS_AI_SERVO, etc.
|
||||
* @context: context for error reporting
|
||||
*
|
||||
* Sets the camera's focus mode. Note that the selection of focus modes is
|
||||
* Sets the camera's focus mode. Note that the selection of focus modes is
|
||||
* limited by the AF/MF switch on the lens body. In particular, this function
|
||||
* is only useful for switching between the various autofocus modes while the
|
||||
* lens focus switch is set to 'AF'. Only tested for EOS 5D via USB.
|
||||
@@ -2419,43 +2419,43 @@ canon_int_set_focus_mode (Camera *camera, canonFocusModeState focus_mode,
|
||||
focus_mode);
|
||||
|
||||
/* Get the current camera settings */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Modify the focus mode */
|
||||
|
||||
|
||||
camera->pl->release_params[FOCUS_MODE_INDEX] = focus_mode;
|
||||
|
||||
|
||||
/* Upload the focus mode to the camera */
|
||||
status = canon_int_set_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
/* Make sure the camera changed it! */
|
||||
|
||||
|
||||
status = canon_int_get_release_params (camera, context);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
|
||||
if (camera->pl->release_params[FOCUS_MODE_INDEX] != focus_mode) {
|
||||
GP_DEBUG ("canon_int_set_focus_mode: Could not set focus_mode "
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
focus_mode,
|
||||
"to 0x%02x (camera returned 0x%02x)",
|
||||
focus_mode,
|
||||
camera->pl->release_params[FOCUS_MODE_INDEX]);
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
} else {
|
||||
GP_DEBUG ("canon_int_set_focus_mode: focus_mode change verified");
|
||||
}
|
||||
|
||||
|
||||
GP_DEBUG ("canon_int_set_focus_mode() finished successfully");
|
||||
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2481,29 +2481,29 @@ canon_int_set_release_params (Camera *camera, GPContext *context)
|
||||
|
||||
if (!camera->pl->remote_control) {
|
||||
GP_DEBUG ("canon_int_set_release_params: Camera not under USB control");
|
||||
return GP_ERROR;
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
memset(payload, 0, sizeof(payload));
|
||||
|
||||
switch (camera->port->type) {
|
||||
case GP_PORT_USB:
|
||||
/* This is what we need for Canon class 6 cameras -
|
||||
/* This is what we need for Canon class 6 cameras -
|
||||
not sure what it is for previous protocols */
|
||||
payload[0x0] = CANON_USB_CONTROL_SET_ZOOM_POS;
|
||||
payload[0x0] = CANON_USB_CONTROL_SET_ZOOM_POS;
|
||||
payload[0x4] = 0x30;
|
||||
|
||||
/* Copy the release parameter block from the camera state
|
||||
* structure into the payload. The 0x08 is the byte offset
|
||||
* into the payload where the release parameters start.
|
||||
*/
|
||||
memcpy(payload + 0x08, camera->pl->release_params,
|
||||
sizeof(camera->pl->release_params));
|
||||
memcpy(payload + 0x08, camera->pl->release_params,
|
||||
sizeof(camera->pl->release_params));
|
||||
|
||||
payloadlen = RELEASE_PARAMS_LEN + 0x08;
|
||||
|
||||
status = canon_int_do_control_dialogue_payload (camera, payload, payloadlen, &msg, &len);
|
||||
|
||||
|
||||
if ( msg == NULL )
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
|
||||
@@ -2516,12 +2516,12 @@ canon_int_set_release_params (Camera *camera, GPContext *context)
|
||||
status = canon_int_do_control_dialogue (camera,
|
||||
CANON_USB_CONTROL_GET_PARAMS,
|
||||
0x00, 0, &trash_handle, &trash_int);
|
||||
|
||||
|
||||
|
||||
if ( status < 0 )
|
||||
return GP_ERROR;
|
||||
|
||||
|
||||
|
||||
status = canon_int_do_control_dialogue_payload (camera, payload, payloadlen, &msg, &len);
|
||||
|
||||
if ( msg == NULL )
|
||||
@@ -2922,12 +2922,12 @@ canon_int_get_disk_name_info (Camera *camera, const char *name, int *capacity, i
|
||||
"(expected %i got %i)", 0x0c, len);
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
}
|
||||
|
||||
|
||||
/* Capacity and available are not NULL as verified above.
|
||||
* But cap and ava are only set for the USB case, so we have to check for that.
|
||||
* If you know the logic better, feel free to improve it. */
|
||||
switch (camera->port->type) {
|
||||
case GP_PORT_USB:
|
||||
case GP_PORT_USB:
|
||||
*capacity = cap;
|
||||
*available = ava;
|
||||
GP_DEBUG ("canon_int_get_disk_name_info: "
|
||||
@@ -3100,7 +3100,7 @@ debug_fileinfo (CameraFileInfo * info)
|
||||
* Implicitly assumes that uint8_t[] is a char[] for strings.
|
||||
*
|
||||
* A few notes about listing files and camera->pl->list_all_files:
|
||||
*
|
||||
*
|
||||
* If camera->pl->list_all_files is false (intended default), then
|
||||
* we list only "primary files" or ("main" files). Those are files
|
||||
* like image files or movie files which the user explicitly created
|
||||
@@ -3604,7 +3604,7 @@ canon_int_delete_file (Camera *camera, const char *name, const char *dir, GPCont
|
||||
else if ( le32atoh ( msg ) != 0 ) {
|
||||
GP_DEBUG ( "canon_int_delete_file: "
|
||||
"non-zero return code 0x%x from camera. "
|
||||
"Possibly tried to delete a nonexistent file.",
|
||||
"Possibly tried to delete a nonexistent file.",
|
||||
le32atoh ( msg ) );
|
||||
return GP_ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ struct canonExposureBiasStateStruct {
|
||||
#define SELF_TIMER_1_INDEX 0x04 /* Currently not used */
|
||||
#define SELF_TIMER_2_INDEX 0x05 /* Currently not used */
|
||||
#define FLASH_INDEX 0x06
|
||||
#define BEEP_INDEX 0x07
|
||||
#define BEEP_INDEX 0x07
|
||||
#define FOCUS_MODE_INDEX 0x12
|
||||
#define ISO_INDEX 0x1a
|
||||
#define APERTURE_INDEX 0x1c
|
||||
@@ -426,15 +426,15 @@ struct canonExposureBiasStateStruct {
|
||||
/**
|
||||
* canonCaptureSizeClass:
|
||||
* @CAPTURE_COMPATIBILITY: operate in the traditional gphoto2 mode
|
||||
* @CAPTURE_THUMB: capture thumbnails
|
||||
* @CAPTURE_THUMB: capture thumbnails
|
||||
* @CAPTURE_FULL_IMAGES: capture full-sized images
|
||||
*
|
||||
* By default (CAPTURE_COMPATIBILITY mode), the driver will capture
|
||||
* thumbnails to the host computer in capture_preview, and full-sized
|
||||
* images to the camera's drive in capture_image.
|
||||
* CAPTURE_FULL_IMAGE will capture a full-sized image to the host
|
||||
* images to the camera's drive in capture_image.
|
||||
* CAPTURE_FULL_IMAGE will capture a full-sized image to the host
|
||||
* computer in capture_preview, or to the camera's drive in capture_image.
|
||||
* CAPTURE_THUMB is likewise intended to capture thumbnails to either
|
||||
* CAPTURE_THUMB is likewise intended to capture thumbnails to either
|
||||
* the host computer or to the camera's drive, although these modes do not
|
||||
* seem to work right now.
|
||||
*
|
||||
@@ -478,8 +478,8 @@ struct _CameraPrivateLibrary
|
||||
int receive_error; /* status of transfer on serial connection */
|
||||
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 */
|
||||
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;
|
||||
@@ -489,7 +489,7 @@ struct _CameraPrivateLibrary
|
||||
*/
|
||||
int list_all_files; /* whether to list all files, not just know types */
|
||||
|
||||
int upload_keep_filename; /* 0=DCIF compatible filenames (AUT_*),
|
||||
int upload_keep_filename; /* 0=DCIF compatible filenames (AUT_*),
|
||||
1=keep original filename */
|
||||
|
||||
char *cached_drive; /* usually something like C: */
|
||||
@@ -516,12 +516,12 @@ struct _CameraPrivateLibrary
|
||||
|
||||
unsigned int body_id; /* hardware serial number for some cameras */
|
||||
|
||||
unsigned char release_params[RELEASE_PARAMS_LEN]; /* "Release
|
||||
unsigned char release_params[RELEASE_PARAMS_LEN]; /* "Release
|
||||
parameters:"
|
||||
ISO, aperture,
|
||||
ISO, aperture,
|
||||
etc */
|
||||
|
||||
int secondary_image; /* Should we attempt to download a
|
||||
int secondary_image; /* Should we attempt to download a
|
||||
secondary image? (e.g., RAW + JPEG) */
|
||||
|
||||
/*
|
||||
@@ -565,14 +565,14 @@ typedef enum {
|
||||
/**
|
||||
* canonDirentAttributeBits:
|
||||
* @CANON_ATTR_WRITE_PROTECTED: File is write-protected
|
||||
* @CANON_ATTR_UNKNOWN_2:
|
||||
* @CANON_ATTR_UNKNOWN_4:
|
||||
* @CANON_ATTR_UNKNOWN_8:
|
||||
* @CANON_ATTR_UNKNOWN_2:
|
||||
* @CANON_ATTR_UNKNOWN_4:
|
||||
* @CANON_ATTR_UNKNOWN_8:
|
||||
* @CANON_ATTR_NON_RECURS_ENT_DIR: This entry represents a directory
|
||||
* that was not entered in this listing.
|
||||
* @CANON_ATTR_NOT_DOWNLOADED: This file has not yet been downloaded
|
||||
* (the bit is cleared by the host software).
|
||||
* @CANON_ATTR_UNKNOWN_40:
|
||||
* @CANON_ATTR_UNKNOWN_40:
|
||||
* @CANON_ATTR_RECURS_ENT_DIR: This entry represents a directory
|
||||
* that was entered in this listing; look for its contents
|
||||
* later in the listing.
|
||||
@@ -621,7 +621,7 @@ typedef enum {
|
||||
DIR_REMOVE = 1
|
||||
} canonDirFunctionCode;
|
||||
|
||||
/* These macros contain the default label for all the
|
||||
/* These macros contain the default label for all the
|
||||
* switch (camera->port->type) statements
|
||||
*/
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ int camera_id (CameraText *id)
|
||||
*
|
||||
*/
|
||||
static int
|
||||
camera_manual (Camera __unused__ *camera, CameraText *manual,
|
||||
camera_manual (Camera __unused__ *camera, CameraText *manual,
|
||||
GPContext __unused__ *context)
|
||||
{
|
||||
GP_DEBUG ("camera_manual()");
|
||||
@@ -532,9 +532,9 @@ camera_exit (Camera *camera, GPContext *context)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if (camera->port->type == GP_PORT_USB)
|
||||
if (camera->port->type == GP_PORT_USB)
|
||||
canon_usb_unlock_keys (camera, context);
|
||||
|
||||
|
||||
/* Turn off remote control if enabled (remote control only
|
||||
* applies to USB cameras, but in case of serial connection
|
||||
* remote_control should never be seen set here) */
|
||||
@@ -690,7 +690,7 @@ update_disk_cache (Camera *camera, GPContext *context)
|
||||
****************************************************************************/
|
||||
|
||||
static int
|
||||
file_list_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
file_list_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
CameraList *list, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
@@ -701,12 +701,12 @@ file_list_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
if (!check_readiness (camera, context))
|
||||
return GP_ERROR;
|
||||
|
||||
return canon_int_list_directory (camera, folder, list,
|
||||
return canon_int_list_directory (camera, folder, list,
|
||||
CANON_LIST_FILES, context);
|
||||
}
|
||||
|
||||
static int
|
||||
folder_list_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
folder_list_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
CameraList *list, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
@@ -717,13 +717,13 @@ folder_list_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
if (!check_readiness (camera, context))
|
||||
return GP_ERROR;
|
||||
|
||||
return canon_int_list_directory (camera, folder, list,
|
||||
return canon_int_list_directory (camera, folder, list,
|
||||
CANON_LIST_FOLDERS, context);
|
||||
}
|
||||
|
||||
static int
|
||||
get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile *file, void *user_data,
|
||||
CameraFileType type, CameraFile *file, void *user_data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
@@ -1123,12 +1123,12 @@ storage_info_func (
|
||||
(*sinfos)->access = GP_STORAGEINFO_AC_READONLY_WITH_DELETE;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static int
|
||||
camera_about (Camera __unused__ *camera, CameraText *about,
|
||||
camera_about (Camera __unused__ *camera, CameraText *about,
|
||||
GPContext __unused__ *context)
|
||||
{
|
||||
GP_DEBUG ("camera_about()");
|
||||
@@ -1151,7 +1151,7 @@ camera_about (Camera __unused__ *camera, CameraText *about,
|
||||
/****************************************************************************/
|
||||
|
||||
static int
|
||||
delete_file_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
delete_file_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
const char *filename, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
@@ -1205,10 +1205,10 @@ delete_file_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
#ifdef CANON_EXPERIMENTAL_UPLOAD
|
||||
/*
|
||||
* get from the filesystem the name of the highest numbered picture or directory
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
get_last_file (Camera *camera, char *directory, char *destname,
|
||||
get_last_file (Camera *camera, char *directory, char *destname,
|
||||
GPContext* context, char getdirectory, char*result)
|
||||
{
|
||||
CameraFilesystem * fs = camera->fs;
|
||||
@@ -1218,9 +1218,9 @@ get_last_file (Camera *camera, char *directory, char *destname,
|
||||
GP_DEBUG ("get_last_file()");
|
||||
|
||||
if(directory[1] == ':') {
|
||||
/* gp_file_list_folder() needs absolute filenames
|
||||
/* gp_file_list_folder() needs absolute filenames
|
||||
starting with '/' */
|
||||
GP_DEBUG ("get_last_file(): replacing '%c:%c' by '/'",
|
||||
GP_DEBUG ("get_last_file(): replacing '%c:%c' by '/'",
|
||||
directory[0], directory[2]);
|
||||
sprintf(dir2, "/%s", &directory[3]);
|
||||
directory = dir2;
|
||||
@@ -1238,7 +1238,7 @@ get_last_file (Camera *camera, char *directory, char *destname,
|
||||
for(t=0;t<list->count;t++)
|
||||
{
|
||||
char* name = list->entry[t].name;
|
||||
if(getdirectory)
|
||||
if(getdirectory)
|
||||
GP_DEBUG ("get_last_file(): folder: %s", name);
|
||||
else
|
||||
GP_DEBUG ("get_last_file(): file: %s", name);
|
||||
@@ -1251,7 +1251,7 @@ get_last_file (Camera *camera, char *directory, char *destname,
|
||||
continue;
|
||||
|
||||
/* ...and only for files similar to AUT_[0-9]{4} */
|
||||
if(!getdirectory && (!isdigit(name[6]) ||
|
||||
if(!getdirectory && (!isdigit(name[6]) ||
|
||||
!isdigit(name[7])))
|
||||
continue;
|
||||
|
||||
@@ -1278,9 +1278,9 @@ get_last_dir (Camera *camera, char *directory, char *destname, GPContext* contex
|
||||
}
|
||||
|
||||
/*
|
||||
* convert a filename to 8.3 format by truncating
|
||||
* convert a filename to 8.3 format by truncating
|
||||
* the basename to 8 and the extension to 3 chars
|
||||
*
|
||||
*
|
||||
*/
|
||||
static void
|
||||
convert_filename_to_8_3(const char* filename, char* dest)
|
||||
@@ -1293,7 +1293,7 @@ convert_filename_to_8_3(const char* filename, char* dest)
|
||||
}
|
||||
else {
|
||||
int l = c-filename;
|
||||
if(l>8)
|
||||
if(l>8)
|
||||
l=8;
|
||||
memcpy(dest, filename, l);
|
||||
dest[l]=0;
|
||||
@@ -1457,7 +1457,7 @@ put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder, c
|
||||
|
||||
gp_camera_get_abilities (camera, &a);
|
||||
/* Special case for A50 and Pro 70 */
|
||||
if ((camera->pl->speed > 57600) &&
|
||||
if ((camera->pl->speed > 57600) &&
|
||||
((camera->pl->md->model == CANON_CLASS_1)
|
||||
|| (camera->pl->md->model == CANON_CLASS_2))) {
|
||||
gp_context_error (context,
|
||||
@@ -1550,7 +1550,7 @@ put_file_func (CameraFilesystem __unused__ *fs, const char __unused__ *folder, c
|
||||
|
||||
/* Wait for an event */
|
||||
static int
|
||||
camera_wait_for_event (Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context)
|
||||
camera_wait_for_event (Camera *camera, int timeout, CameraEventType *eventtype, void **eventdata, GPContext *context)
|
||||
{
|
||||
return canon_int_wait_for_event (camera, timeout, eventtype, eventdata, context);
|
||||
}
|
||||
@@ -1602,9 +1602,9 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
/* Set to "Compatibility mode" if not currently set */
|
||||
if (menuval == -1)
|
||||
if (menuval == -1)
|
||||
gp_widget_set_value (t, _("Compatibility Mode"));
|
||||
|
||||
gp_widget_append (section, t);
|
||||
@@ -1615,7 +1615,7 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
/* Necessary for release params: ISO, aperture, etc. */
|
||||
if (!camera->pl->remote_control) {
|
||||
res = canon_int_start_remote_control (camera, context);
|
||||
if (res != GP_OK)
|
||||
if (res != GP_OK)
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1642,8 +1642,8 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Set an unknown ISO value if the
|
||||
|
||||
/* Set an unknown ISO value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
gp_widget_add_choice (t, _("Unknown"));
|
||||
@@ -1696,8 +1696,8 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Set an unknown shutter value if the
|
||||
|
||||
/* Set an unknown shutter value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
gp_widget_add_choice (t, _("Unknown"));
|
||||
@@ -1736,8 +1736,8 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Set an unknown aperture value if the
|
||||
|
||||
/* Set an unknown aperture value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
gp_widget_add_choice (t, _("Unknown"));
|
||||
@@ -1763,8 +1763,8 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Set an unknown exp bias value if the
|
||||
|
||||
/* Set an unknown exp bias value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
gp_widget_add_choice (t, _("Unknown"));
|
||||
@@ -1794,7 +1794,7 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
/* Set an unknown imageFormat value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
@@ -1822,8 +1822,8 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Set an unknown focus mode value if the
|
||||
|
||||
/* Set an unknown focus mode value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
gp_widget_add_choice (t, _("Unknown"));
|
||||
@@ -1850,8 +1850,8 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Set an unknown flash value if the
|
||||
|
||||
/* Set an unknown flash value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
gp_widget_add_choice (t, _("Unknown"));
|
||||
@@ -1878,8 +1878,8 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Set an unknown beep value if the
|
||||
|
||||
/* Set an unknown beep value if the
|
||||
* camera is set to something weird */
|
||||
if (menuval == -1) {
|
||||
gp_widget_add_choice (t, _("Unknown"));
|
||||
@@ -2013,8 +2013,8 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!captureSizeArray[i].label)
|
||||
|
||||
if (!captureSizeArray[i].label)
|
||||
gp_context_status (context, _("Invalid capture size class setting"));
|
||||
|
||||
}
|
||||
@@ -2187,7 +2187,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
while (imageFormatStateArray[i].label) {
|
||||
if (strcmp (_(imageFormatStateArray[i].label), wvalue) == 0)
|
||||
break;
|
||||
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -2258,7 +2258,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
gp_context_status (context, _("Beep mode changed"));
|
||||
else
|
||||
gp_context_status (context, _("Could not change beep mode"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2279,7 +2279,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
gp_context_status (context, _("Zoom level changed"));
|
||||
else
|
||||
gp_context_status (context, _("Could not change zoom level"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2339,7 +2339,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
gp_context_status (context, _("Flash mode changed"));
|
||||
else
|
||||
gp_context_status (context, _("Could not change flash mode"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2388,9 +2388,9 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
}
|
||||
|
||||
static int
|
||||
get_info_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
get_info_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
const char *filename,
|
||||
CameraFileInfo * info,
|
||||
CameraFileInfo * info,
|
||||
void __unused__ *data, GPContext __unused__ *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -2452,7 +2452,7 @@ make_dir_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
if (canonpath == NULL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
|
||||
r = canon_int_directory_operations (camera, canonpath,
|
||||
r = canon_int_directory_operations (camera, canonpath,
|
||||
DIR_CREATE, context);
|
||||
if (r != GP_OK)
|
||||
return (r);
|
||||
@@ -2494,7 +2494,7 @@ remove_dir_func (CameraFilesystem __unused__ *fs, const char *folder,
|
||||
if (canonpath == NULL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
|
||||
r = canon_int_directory_operations (camera, canonpath,
|
||||
r = canon_int_directory_operations (camera, canonpath,
|
||||
DIR_REMOVE, context);
|
||||
if (r != GP_OK)
|
||||
return (r);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the
|
||||
along with this program; if not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301 USA
|
||||
*/
|
||||
@@ -43,7 +43,7 @@
|
||||
only saw that when I drew the schematic. There are quite a few
|
||||
programs available that calculate this CRC, but I didn't understand
|
||||
most of them, so I wrote my own version for some experiments. (And most
|
||||
implementations that I've seen didn't have a clear copyright...)
|
||||
implementations that I've seen didn't have a clear copyright...)
|
||||
|
||||
I implemented the 16-stage shift register in a `long' variable
|
||||
that is shifted and XOR'd when necessary.
|
||||
|
||||
@@ -26,7 +26,7 @@ void main (int argc, char **argv)
|
||||
}
|
||||
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
{
|
||||
if ((jpgfile = fopen (argv[i], "rb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "File could not be opened. Aborted.\n\n");
|
||||
@@ -64,7 +64,7 @@ void main (int argc, char **argv)
|
||||
snprintf(newname, 200, "%s-%d.jpg", tempstring, newnamecounter);
|
||||
}
|
||||
|
||||
printf("File %s, size %ld, %s -> %s\n", argv[i], statbuf.st_size,
|
||||
printf("File %s, size %ld, %s -> %s\n", argv[i], statbuf.st_size,
|
||||
timestring, newname);
|
||||
|
||||
fclose(jpgfile);
|
||||
|
||||
@@ -349,8 +349,8 @@ canon_serial_recv_frame (Camera *camera, int *len)
|
||||
/**
|
||||
* canon_serial_send_packet
|
||||
* @camera: Camera object to work with
|
||||
* @type:
|
||||
* @seq:
|
||||
* @type:
|
||||
* @seq:
|
||||
* @pkt: data to send to camera
|
||||
* @len: length of data
|
||||
*
|
||||
@@ -691,7 +691,7 @@ canon_serial_recv_msg (Camera *camera, unsigned char mtype, unsigned char dir, u
|
||||
if (type == PKT_ACK && mtype == 0x3 && dir == 0x21) {
|
||||
GP_DEBUG("ignoring ACK received while waiting for MSG");
|
||||
return frag;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (len < MSG_HDR_LEN || frag[MSG_02] != 2) {
|
||||
GP_DEBUG ("ERROR: message format error");
|
||||
@@ -1368,11 +1368,11 @@ canon_serial_ready (Camera *camera, GPContext *context)
|
||||
* don't actually use id_str, but serial_id_string.
|
||||
*/
|
||||
for (i = 0; models[i].id_str != NULL; i++) {
|
||||
if ((models[i].serial_id_string != NULL) &&
|
||||
if ((models[i].serial_id_string != NULL) &&
|
||||
!strcmp (models[i].serial_id_string, cam_id_str)) {
|
||||
GP_DEBUG ("canon_serial_ready: Serial ID string matches '%s'",
|
||||
models[i].serial_id_string);
|
||||
gp_context_status (context, _("Detected a \"%s\" aka \"%s\""),
|
||||
gp_context_status (context, _("Detected a \"%s\" aka \"%s\""),
|
||||
models[i].id_str, models[i].serial_id_string);
|
||||
camera->pl->md = (struct canonCamModelData *) &models[i];
|
||||
break;
|
||||
@@ -1478,7 +1478,7 @@ canon_serial_ready (Camera *camera, GPContext *context)
|
||||
* @context: context for error reporting
|
||||
*
|
||||
* This is just the serial specific part extracted from the older
|
||||
* canon_get_thumbnail() routine.
|
||||
* canon_get_thumbnail() routine.
|
||||
*
|
||||
* Returns: gphoto2 error code
|
||||
*
|
||||
|
||||
@@ -145,7 +145,7 @@ typedef enum {
|
||||
* @PKT_LEN_MSB: Offset in packet to most-significant byte of packet length.
|
||||
* @PKT_HDR_LEN: Length of complete header.
|
||||
*
|
||||
* Offsets to bytes in a serial packet header.
|
||||
* Offsets to bytes in a serial packet header.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
@@ -182,7 +182,7 @@ typedef enum {
|
||||
} canonPacketType;
|
||||
|
||||
|
||||
|
||||
|
||||
/* #define PKT_NACK 255 */
|
||||
/* #define PKTACK_NACK 0x01 */
|
||||
/* #define PKT_UPLOAD_EOT 3 */
|
||||
|
||||
@@ -58,14 +58,14 @@
|
||||
|
||||
#define CHECK_RESULT(result) {int r = (result); if (r < 0) return (r);}
|
||||
|
||||
/* IDENTIFY_INIT_TIMEOUT: the starting timeout (in milliseconds)
|
||||
/* IDENTIFY_INIT_TIMEOUT: the starting timeout (in milliseconds)
|
||||
* to wait for the camera to respond to an "identify camera" request.
|
||||
* This timeout is doubled for each retry */
|
||||
/* It was originally 10, but this made the communication fail, so
|
||||
* bump up to 100. */
|
||||
#define IDENTIFY_INIT_TIMEOUT 100
|
||||
|
||||
/* IDENTIFY_MAX_ATTEMPTS: how many "identify camera" requests to send
|
||||
/* IDENTIFY_MAX_ATTEMPTS: how many "identify camera" requests to send
|
||||
* to the camera, until we give up for lack of response. */
|
||||
#define IDENTIFY_MAX_ATTEMPTS 5
|
||||
|
||||
@@ -379,7 +379,7 @@ canon_usb_camera_init (Camera *camera, GPContext *context)
|
||||
else
|
||||
GP_DEBUG ("canon_usb_camera_init() "
|
||||
"Step #5 of initialization failed! (returned %i, expected %i) "
|
||||
"Camera might still work though. Continuing.",
|
||||
"Camera might still work though. Continuing.",
|
||||
i, 4);
|
||||
}
|
||||
}
|
||||
@@ -460,10 +460,10 @@ int
|
||||
canon_usb_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
/* unsigned char buffer[0x44]; */
|
||||
int res, id_retry, i, camstat;
|
||||
int res, id_retry, i, camstat;
|
||||
/* int read_bytes; */
|
||||
int orig_mstimeout = -1;
|
||||
int id_mstimeout = IDENTIFY_INIT_TIMEOUT; /* separate timeout for
|
||||
int id_mstimeout = IDENTIFY_INIT_TIMEOUT; /* separate timeout for
|
||||
identify camera */
|
||||
|
||||
GP_DEBUG ("Initializing the (USB) camera.");
|
||||
@@ -480,7 +480,7 @@ canon_usb_init (Camera *camera, GPContext *context)
|
||||
if ( camstat < 0 )
|
||||
return camstat;
|
||||
|
||||
/* Save the original timeout value and set up the initial
|
||||
/* Save the original timeout value and set up the initial
|
||||
identify camera timeout value */
|
||||
gp_port_get_timeout (camera->port, &orig_mstimeout);
|
||||
gp_port_set_timeout (camera->port, id_mstimeout);
|
||||
@@ -533,7 +533,7 @@ canon_usb_init (Camera *camera, GPContext *context)
|
||||
GP_DEBUG ( "canon_usb_init: camera uses newer protocol, so we get camera abilities" );
|
||||
c_res = canon_usb_dialogue (camera,
|
||||
CANON_USB_FUNCTION_GET_PIC_ABILITIES_2,
|
||||
&bytes_read, NULL, 0);
|
||||
&bytes_read, NULL, 0);
|
||||
|
||||
if ( c_res == NULL ) {
|
||||
GP_DEBUG ( "canon_usb_init: \"get picture abilities\" failed; continuing anyway." );
|
||||
@@ -565,7 +565,7 @@ canon_usb_init (Camera *camera, GPContext *context)
|
||||
if (res != GP_OK) {
|
||||
gp_context_error (context, _("Camera not ready, get_battery failed: %s"),
|
||||
gp_result_as_string (res));
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -692,7 +692,7 @@ canon_usb_lock_keys (Camera *camera, GPContext *context)
|
||||
|
||||
c_res = canon_usb_dialogue (camera,
|
||||
CANON_USB_FUNCTION_GET_PIC_ABILITIES_2,
|
||||
&bytes_read, NULL, 0);
|
||||
&bytes_read, NULL, 0);
|
||||
|
||||
if ( c_res == NULL ) {
|
||||
GP_DEBUG ( "canon_usb_lock_keys: \"get picture abilities\" failed; continuing anyway." );
|
||||
@@ -784,7 +784,7 @@ canon_usb_unlock_keys (Camera *camera, GPContext *context)
|
||||
}
|
||||
else {
|
||||
/* Your camera model does not need unlocking, cannot do unlocking or
|
||||
* we don't know how to unlock its keys.
|
||||
* we don't know how to unlock its keys.
|
||||
*/
|
||||
GP_DEBUG ("canon_usb_unlock_keys: Key unlocking not implemented for this camera model. "
|
||||
"If unlocking works when using the Windows software with your camera, "
|
||||
@@ -1033,7 +1033,7 @@ canon_usb_capture_dialogue (Camera *camera, unsigned int *return_length, int *ph
|
||||
|
||||
GP_DEBUG ("canon_usb_capture_dialogue()");
|
||||
|
||||
*photo_status = 0; /* This should only be checked by the caller
|
||||
*photo_status = 0; /* This should only be checked by the caller
|
||||
if canon_usb_capture_dialogue() returns null */
|
||||
|
||||
/* Build payload for command, which contains subfunction code */
|
||||
@@ -1083,7 +1083,7 @@ canon_usb_capture_dialogue (Camera *camera, unsigned int *return_length, int *ph
|
||||
GP_DEBUG ( "canon_usb_capture_dialogue: Issuing unknown command 0x22 for class 6 camera." );
|
||||
buffer = canon_usb_dialogue ( camera,
|
||||
CANON_USB_FUNCTION_20D_UNKNOWN_2,
|
||||
return_length, payload, 4 );
|
||||
return_length, payload, 4 );
|
||||
|
||||
if ( buffer == NULL )
|
||||
GP_DEBUG ( "canon_usb_capture_dialogue: Unknown command 0x22 returned null buffer; continuing anyway." );
|
||||
@@ -1154,7 +1154,7 @@ canon_usb_capture_dialogue (Camera *camera, unsigned int *return_length, int *ph
|
||||
/* (only for RAW + JPEG modes) */
|
||||
GP_DEBUG ( "canon_usb_capture_dialogue: "
|
||||
"secondary image descriptor received");
|
||||
|
||||
|
||||
camera->pl->image_b_length = le32atoh ( buf2+0x11 );
|
||||
camera->pl->image_b_key = le32atoh ( buf2+0x0c );
|
||||
|
||||
@@ -1642,13 +1642,13 @@ canon_usb_dialogue (Camera *camera, canonCommandIndex canon_funct, unsigned int
|
||||
|
||||
buffer = canon_usb_dialogue_full (camera, canon_funct, return_length,
|
||||
payload, payload_length);
|
||||
|
||||
|
||||
/* Remove the packet header from the response */
|
||||
if (return_length)
|
||||
*return_length = *return_length - 0x50;
|
||||
if (buffer)
|
||||
if (buffer)
|
||||
return buffer + 0x50;
|
||||
else
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1983,7 +1983,7 @@ canon_usb_get_captured_image (Camera *camera, const int key, unsigned char **dat
|
||||
* Gets the just-captured image from a USB-connected Canon
|
||||
* camera. This function must be called soon after an image capture,
|
||||
* and needs the image key returned by canon_usb_capture_dialogue().
|
||||
* This function is only used for "secondary images," e.g., the JPEGs
|
||||
* This function is only used for "secondary images," e.g., the JPEGs
|
||||
* downloaded when the camera's capture image format mode is set to "RAW + JPEG"
|
||||
*
|
||||
* Returns: gphoto2 error code, length in @length, and image data in @data.
|
||||
@@ -2186,7 +2186,7 @@ canon_usb_set_file_attributes (Camera *camera, unsigned int attr_bits,
|
||||
* @destname: name file should have on camera
|
||||
* @destpath: pathname for directory to put file
|
||||
* @context: context for error reporting
|
||||
*
|
||||
*
|
||||
* Uploads file to USB camera
|
||||
*
|
||||
* Bugs:
|
||||
@@ -2196,9 +2196,9 @@ canon_usb_set_file_attributes (Camera *camera, unsigned int attr_bits,
|
||||
* s10sh (http://www.kyuzz.org/antirez/s10sh.html) has the same problem.
|
||||
* The problem only appears when USB deinitialisation and initialisation
|
||||
* is performed between uploads. You can call this function more than
|
||||
* once with big files during one session without encountering the problem
|
||||
* once with big files during one session without encountering the problem
|
||||
* described. <kramm@quiss.org>
|
||||
*
|
||||
*
|
||||
* Returns: gphoto2 error code
|
||||
*
|
||||
*/
|
||||
@@ -2215,7 +2215,7 @@ canon_usb_put_file (Camera __unused__ *camera, CameraFile __unused__ *file,
|
||||
#else /* else ifdef CANON_EXPERIMENTAL_UPLOAD */
|
||||
|
||||
int
|
||||
canon_usb_put_file (Camera *camera, CameraFile *file,
|
||||
canon_usb_put_file (Camera *camera, CameraFile *file,
|
||||
const char *xfilename, const char *destname, const char *destpath,
|
||||
GPContext *context)
|
||||
{
|
||||
@@ -2342,7 +2342,7 @@ canon_usb_put_file (Camera *camera, CameraFile *file,
|
||||
/* Max length of data block */
|
||||
htole32a ( packet+0x58, len2 );
|
||||
|
||||
strcpy(&packet[0x5c], filename);
|
||||
strcpy(&packet[0x5c], filename);
|
||||
memcpy(&packet[0x5c+filename_len+1], &data[offs], len2);
|
||||
|
||||
status = gp_port_write (camera->port, packet, len1+0x40);
|
||||
@@ -2443,7 +2443,7 @@ canon_usb_get_dirents (Camera *camera, unsigned char **dirent_data,
|
||||
*
|
||||
* the 0x00 before dirname means 'no recursion'
|
||||
* NOTE: the first 0x00 after dirname is the NULL byte terminating
|
||||
* the string, so payload_length is strlen(dirname) + 4
|
||||
* the string, so payload_length is strlen(dirname) + 4
|
||||
*/
|
||||
if (strlen (path) + 4 > sizeof (payload)) {
|
||||
GP_DEBUG ("canon_usb_get_dirents: "
|
||||
@@ -2514,7 +2514,7 @@ canon_usb_list_all_dirs (Camera *camera, unsigned char **dirent_data,
|
||||
* the 0x0f before dirname means 'recurse to level 15', which
|
||||
* should get all the directories on the camera.
|
||||
* NOTE: the first 0x00 after dirname is the NULL byte terminating
|
||||
* the string, so payload_length is strlen(dirname) + 4
|
||||
* the string, so payload_length is strlen(dirname) + 4
|
||||
*/
|
||||
if (strlen (disk_name) + 4 > sizeof (payload)) {
|
||||
GP_DEBUG ("canon_usb_list_all_dirs: "
|
||||
@@ -2611,9 +2611,9 @@ canon_usb_identify (Camera *camera, GPContext *context)
|
||||
* the colon/space problem. (FIXME)
|
||||
*/
|
||||
for (i = 0; models[i].id_str != NULL; i++) {
|
||||
if (models[i].usb_vendor
|
||||
if (models[i].usb_vendor
|
||||
&& models[i].usb_product
|
||||
&& (a.usb_vendor == models[i].usb_vendor)
|
||||
&& (a.usb_vendor == models[i].usb_vendor)
|
||||
&& (a.usb_product == models[i].usb_product)) {
|
||||
GP_DEBUG ("canon_usb_identify: USB ID match 0x%04x:0x%04x (model name \"%s\")",
|
||||
models[i].usb_vendor, models[i].usb_product, models[i].id_str);
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
* to select which command to issue to the camera. See the protocol
|
||||
* document for details.
|
||||
*/
|
||||
|
||||
|
||||
typedef enum {
|
||||
CANON_USB_FUNCTION_GET_FILE = 1,
|
||||
CANON_USB_FUNCTION_IDENTIFY_CAMERA,
|
||||
@@ -203,7 +203,7 @@ typedef enum {
|
||||
} canonSubcommandIndex;
|
||||
|
||||
|
||||
struct canon_usb_control_cmdstruct
|
||||
struct canon_usb_control_cmdstruct
|
||||
{
|
||||
canonSubcommandIndex num;
|
||||
char *description;
|
||||
@@ -223,7 +223,7 @@ struct canon_usb_control_cmdstruct
|
||||
|
||||
|
||||
|
||||
struct canon_usb_cmdstruct
|
||||
struct canon_usb_cmdstruct
|
||||
{
|
||||
canonCommandIndex num;
|
||||
char *description;
|
||||
@@ -253,14 +253,14 @@ struct canon_usb_status {
|
||||
|
||||
int canon_usb_init (Camera *camera, GPContext *context);
|
||||
int canon_usb_set_file_time ( Camera *camera, char *camera_filename, time_t time, GPContext *context);
|
||||
int canon_usb_put_file (Camera *camera, CameraFile *file, const char *filename, const char *destname, const char *destpath,
|
||||
int canon_usb_put_file (Camera *camera, CameraFile *file, const char *filename, const char *destname, const char *destpath,
|
||||
GPContext *context);
|
||||
unsigned char *canon_usb_capture_dialogue (Camera *camera, unsigned int *return_length, int *photo_status, GPContext *context );
|
||||
unsigned char *canon_usb_dialogue_full (Camera *camera, canonCommandIndex canon_funct,
|
||||
unsigned int *return_length, const unsigned char *payload, unsigned int payload_length);
|
||||
unsigned char *canon_usb_dialogue (Camera *camera, canonCommandIndex canon_funct,
|
||||
unsigned int *return_length, const unsigned char *payload, unsigned int payload_length);
|
||||
int canon_usb_long_dialogue (Camera *camera, canonCommandIndex canon_funct, unsigned char **data,
|
||||
int canon_usb_long_dialogue (Camera *camera, canonCommandIndex canon_funct, unsigned char **data,
|
||||
unsigned int *data_length, unsigned int max_data_size, const unsigned char *payload,
|
||||
unsigned int payload_length, int display_status, GPContext *context);
|
||||
int canon_usb_get_file (Camera *camera, const char *name, unsigned char **data, unsigned int *length, GPContext *context);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* File: util.c
|
||||
* File: util.c
|
||||
*
|
||||
* Utility functions for the gphoto2 camlibs/canon driver.
|
||||
*
|
||||
|
||||
@@ -62,16 +62,16 @@ int QVcamtojpeg(const unsigned char *cam, long int camSize, unsigned char **jpeg
|
||||
+sizeof(sos_v)+vsize
|
||||
+sizeof(eoi)
|
||||
));
|
||||
|
||||
|
||||
dst=*jpeg;
|
||||
memcpy(dst,soi,sizeof(soi)); dst+=sizeof(soi);
|
||||
memcpy(dst,app0,sizeof(app0)); dst+=sizeof(app0);
|
||||
|
||||
cam+=8;
|
||||
|
||||
|
||||
memcpy(dst,dqt0,sizeof(dqt0)); dst+=sizeof(dqt0);
|
||||
memcpy(dst,cam,64); dst+=64; cam+=64;
|
||||
|
||||
|
||||
memcpy(dst,dqt1,sizeof(dqt1)); dst+=sizeof(dqt1);
|
||||
memcpy(dst,cam,64); dst+=64; cam+=64;
|
||||
|
||||
@@ -80,7 +80,7 @@ int QVcamtojpeg(const unsigned char *cam, long int camSize, unsigned char **jpeg
|
||||
|
||||
memcpy(dst,sos_y,sizeof(sos_y)); dst+=sizeof(sos_y);
|
||||
memcpy(dst,cam,ysize); dst+=ysize; cam+=ysize;
|
||||
|
||||
|
||||
memcpy(dst,sos_u,sizeof(sos_u)); dst+=sizeof(sos_u);
|
||||
memcpy(dst,cam,usize); dst+=usize; cam+=usize;
|
||||
|
||||
@@ -97,7 +97,7 @@ int QVfinecamtojpeg(const unsigned char *cam, long int camSize, unsigned char **
|
||||
int size;
|
||||
static const unsigned char c[1] = { 1 };
|
||||
unsigned char *dst;
|
||||
|
||||
|
||||
size = u32(cam + 4);
|
||||
|
||||
*jpeg=malloc(*jpegSize=
|
||||
@@ -123,7 +123,7 @@ int QVfinecamtojpeg(const unsigned char *cam, long int camSize, unsigned char **
|
||||
|
||||
memcpy(dst,sof_f,sizeof(sof_f)); dst+=sizeof(sof_f);
|
||||
memcpy(dst,dht_f,sizeof(dht_f)); dst+=sizeof(dht_f);
|
||||
|
||||
|
||||
memcpy(dst,sos_f,sizeof(sos_f)); dst+=sizeof(sos_f);
|
||||
memcpy(dst,cam,size); dst+=size; cam+=size;
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -53,10 +53,10 @@ QVping (Camera *camera)
|
||||
switch (c) {
|
||||
case ACK:
|
||||
case ENQ:
|
||||
|
||||
|
||||
/*
|
||||
* According to gphoto, we need to wait
|
||||
* for ACK. But the camera of
|
||||
* for ACK. But the camera of
|
||||
* David Wolfskill <david@catwhisker.org>
|
||||
* seems to return ENQ after some NAK.
|
||||
*/
|
||||
@@ -70,12 +70,12 @@ QVping (Camera *camera)
|
||||
case UNKNOWN1:
|
||||
case UNKNOWN2:
|
||||
|
||||
/*
|
||||
/*
|
||||
* David Wolfskill <david@catwhisker.org>
|
||||
* has seen those two bytes if one sends
|
||||
* only ENQs to the camera. The camera first
|
||||
* answers with some NAKs, then with some
|
||||
* ACKs, and finally with UNKNOWN1 and
|
||||
* ACKs, and finally with UNKNOWN1 and
|
||||
* UNKNOWN2.
|
||||
*/
|
||||
while (gp_port_read (camera->port, (char *)&c, 1) >= 0);
|
||||
@@ -197,7 +197,7 @@ QVblockrecv (Camera *camera, unsigned char **buf, unsigned long int *buf_len)
|
||||
return (GP_ERROR_CORRUPTED_DATA);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Acknowledge and prepare for next packet */
|
||||
c = ACK;
|
||||
@@ -387,7 +387,7 @@ int
|
||||
QVstatus (Camera *camera, char *status)
|
||||
{
|
||||
unsigned char cmd[3];
|
||||
|
||||
|
||||
cmd[0] = 'D';
|
||||
cmd[1] = 'S';
|
||||
cmd[2] = STX;
|
||||
@@ -400,7 +400,7 @@ int
|
||||
QVreset (Camera *camera)
|
||||
{
|
||||
unsigned char cmd[2];
|
||||
|
||||
|
||||
cmd[0] = 'Q';
|
||||
cmd[1] = 'R';
|
||||
CR (QVsend (camera, cmd, 2, NULL, 0));
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -53,7 +53,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
|
||||
CameraFileInfo *info, void *data, GPContext *context);
|
||||
|
||||
int
|
||||
camera_id (CameraText *id)
|
||||
camera_id (CameraText *id)
|
||||
{
|
||||
strcpy (id->text, "Casio QV");
|
||||
|
||||
@@ -77,7 +77,7 @@ static struct {
|
||||
};
|
||||
|
||||
int
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
int i;
|
||||
CameraAbilities a;
|
||||
@@ -104,7 +104,7 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
|
||||
CHECK_RESULT (gp_abilities_list_append (list, a));
|
||||
}
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
|
||||
static int
|
||||
camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
strcpy (about->text, _("Driver framework written by Lutz Mueller "
|
||||
"<lutz@users.sf.net>.\n"
|
||||
@@ -278,7 +278,7 @@ camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
gp_widget_add_choice (child, _("OK"));
|
||||
if (status[0]&0x80) strcpy (t, _("Too bright"));
|
||||
else if (status[0]&0x40) strcpy (t, _("Too dark"));
|
||||
else strcpy (t, _("OK"));
|
||||
else strcpy (t, _("OK"));
|
||||
gp_widget_set_value (child, t);
|
||||
gp_widget_append (*window, child);
|
||||
|
||||
@@ -327,7 +327,7 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
};
|
||||
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
gp_port_settings settings;
|
||||
int selected_speed;
|
||||
|
||||
@@ -64,7 +64,7 @@ int QVycctoppm(const unsigned char *ycc, long int yccSize, int width, int height
|
||||
{
|
||||
for (x=0; x<width; ++x)
|
||||
{
|
||||
L = Y[y * width + x] * 100000;
|
||||
L = Y[y * width + x] * 100000;
|
||||
cb = Cb[(y/RATE_H) * width/ratew + x/ratew];
|
||||
if (cb > 127) cb = cb - 256;
|
||||
cr = Cr[(y/RATE_H) * width/ratew + x/ratew];
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "clicksmart.h"
|
||||
#include "spca50x-jpeg-header.h"
|
||||
|
||||
#define GP_MODULE "clicksmart310"
|
||||
#define GP_MODULE "clicksmart310"
|
||||
|
||||
#define CS_INIT 0x8000
|
||||
#define CS_INIT2 0xd41
|
||||
@@ -43,16 +43,16 @@
|
||||
#define CS_CH_CLEAR 0xd05
|
||||
#define CS_READCLOSE 0x8303
|
||||
|
||||
static int
|
||||
CLICKSMART_READ (GPPort *port, int index, char *data)
|
||||
static int
|
||||
CLICKSMART_READ (GPPort *port, int index, char *data)
|
||||
{
|
||||
gp_port_usb_msg_interface_read(port, 0, 0, index, data, 1);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
CLICKSMART_READ_STATUS (GPPort *port, char *data)
|
||||
{
|
||||
static int
|
||||
CLICKSMART_READ_STATUS (GPPort *port, char *data)
|
||||
{
|
||||
return gp_port_usb_msg_interface_read(port, 0, 0, CS_CH_READY, data, 1);
|
||||
}
|
||||
|
||||
@@ -72,17 +72,17 @@ int clicksmart_init (GPPort *port, CameraPrivateLibrary *priv)
|
||||
CLICKSMART_READ(port, CS_INIT2, &c);
|
||||
CLICKSMART_READ(port, CS_NUM_PICS, &c);
|
||||
|
||||
priv->num_pics = (unsigned)c;
|
||||
priv->num_pics = (unsigned)c;
|
||||
full_reads = (unsigned)c/2;
|
||||
short_read = (unsigned)c%2;
|
||||
cat_size = (unsigned)c*0x10;
|
||||
temp_catalog = malloc(cat_size);
|
||||
if (!temp_catalog)
|
||||
if (!temp_catalog)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
memset (temp_catalog, 0, cat_size);
|
||||
|
||||
/* now we need to get and put away the catalog data. */
|
||||
|
||||
|
||||
CLICKSMART_READ_STATUS (port, &c);
|
||||
gp_port_usb_msg_interface_write(port, 6, 0, 9, NULL, 0);
|
||||
while (c != 1) {
|
||||
@@ -96,18 +96,18 @@ int clicksmart_init (GPPort *port, CameraPrivateLibrary *priv)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
/*
|
||||
* The catalog data is downloaded in reverse order, which needs to be
|
||||
* The catalog data is downloaded in reverse order, which needs to be
|
||||
* straightened out.
|
||||
*/
|
||||
*/
|
||||
for (i=0; i < full_reads; i++) {
|
||||
memset (buffer, 0, 0x200);
|
||||
gp_port_read(port, (char *)buffer, 0x200);
|
||||
memcpy (temp_catalog + cat_size - (2*i+1)*0x10, buffer, 0x10);
|
||||
memcpy (temp_catalog + cat_size - (2*i+2)*0x10, buffer+0x100,
|
||||
memcpy (temp_catalog + cat_size - (2*i+2)*0x10, buffer+0x100,
|
||||
0x10);
|
||||
}
|
||||
if (short_read) {
|
||||
memset (buffer, 0, 0x200);
|
||||
memset (buffer, 0, 0x200);
|
||||
gp_port_read(port, (char *)buffer, 0x100);
|
||||
memcpy (temp_catalog, buffer, 0x10);
|
||||
}
|
||||
@@ -125,15 +125,15 @@ int clicksmart_get_res_setting (CameraPrivateLibrary *priv, int n)
|
||||
{
|
||||
GP_DEBUG("running clicksmart_get_res_setting for picture %i\n", n+1);
|
||||
/*
|
||||
* QCIF (176x144) returns 1, or if the entry is a clip frame, then 3
|
||||
* and CIF (352x288) returns 0.
|
||||
* QCIF (176x144) returns 1, or if the entry is a clip frame, then 3
|
||||
* and CIF (352x288) returns 0.
|
||||
*/
|
||||
return priv->catalog[16*n];
|
||||
}
|
||||
|
||||
int
|
||||
clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
|
||||
unsigned char **data, int n)
|
||||
int
|
||||
clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
|
||||
unsigned char **data, int n)
|
||||
{
|
||||
int offset=0;
|
||||
char c;
|
||||
@@ -154,8 +154,8 @@ clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
|
||||
return r;
|
||||
}
|
||||
/* Get the size of the data and calculate the size to download, which
|
||||
* is the next multiple of 0x100. Only for the hi-res photos is the
|
||||
* true data size actually given.
|
||||
* is the next multiple of 0x100. Only for the hi-res photos is the
|
||||
* true data size actually given.
|
||||
*/
|
||||
|
||||
size=(priv->catalog[16*n + 12] * 0x100)+(priv->catalog[16*n + 11]);
|
||||
@@ -179,18 +179,18 @@ clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
|
||||
|
||||
remainder=((remainder+0xff)/0x100)*0x100;
|
||||
GP_DEBUG("Second remainder: %x\n", remainder);
|
||||
if (remainder)
|
||||
if (remainder)
|
||||
gp_port_read(port, (char *)*data + offset, remainder);
|
||||
|
||||
gp_port_usb_msg_interface_read(port, 0, 0, CS_READCLOSE, &c, 1);
|
||||
gp_port_usb_msg_interface_write(port, 0, 2, CS_CH_READY, NULL, 0);
|
||||
|
||||
/*
|
||||
* For lo-res photos the camera does not tell us the true size, but
|
||||
/*
|
||||
* For lo-res photos the camera does not tell us the true size, but
|
||||
* when the data has ended the excess bytes downloaded are all
|
||||
* 00. The photo processing works better if these are suppressed.
|
||||
*/
|
||||
|
||||
|
||||
if (priv->catalog[16*n]) {
|
||||
while ((size > 1) && (*data)[size-1] == 0)
|
||||
size--;
|
||||
@@ -198,8 +198,8 @@ clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
|
||||
return size;
|
||||
}
|
||||
|
||||
int
|
||||
clicksmart_delete_all_pics (GPPort *port)
|
||||
int
|
||||
clicksmart_delete_all_pics (GPPort *port)
|
||||
{
|
||||
gp_port_usb_msg_interface_write(port, 0, 2, CS_CH_READY, NULL, 0);
|
||||
gp_port_usb_msg_interface_write(port, 2, 0, 5, NULL, 0);
|
||||
@@ -211,17 +211,17 @@ clicksmart_reset (GPPort *port)
|
||||
{
|
||||
char c;
|
||||
/* Release current register */
|
||||
CLICKSMART_READ (port, CS_READCLOSE, &c);
|
||||
CLICKSMART_READ (port, CS_READCLOSE, &c);
|
||||
gp_port_usb_msg_interface_write(port, 0, 2, CS_CH_READY, NULL, 0);
|
||||
CLICKSMART_READ (port, CS_CH_CLEAR, &c);
|
||||
CLICKSMART_READ (port, CS_CH_CLEAR, &c);
|
||||
CLICKSMART_READ (port, CS_CH_CLEAR, &c);
|
||||
CLICKSMART_READ (port, CS_CH_CLEAR, &c);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
/* create_jpeg_from_data adapted from camlibs/spca50x */
|
||||
|
||||
int create_jpeg_from_data (unsigned char * dst, unsigned char * src,
|
||||
int qIndex, int w, int h, unsigned char format,
|
||||
int create_jpeg_from_data (unsigned char * dst, unsigned char * src,
|
||||
int qIndex, int w, int h, unsigned char format,
|
||||
int o_size, int *size,
|
||||
int omit_huffman_table, int omit_escape)
|
||||
{
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -41,12 +41,12 @@ int clicksmart_delete_all_pics (GPPort *port);
|
||||
|
||||
int clicksmart_reset (GPPort *port);
|
||||
|
||||
int create_jpeg_from_data (unsigned char * dst, unsigned char * src,
|
||||
int qIndex, int w, int h,
|
||||
unsigned char format,
|
||||
int create_jpeg_from_data (unsigned char * dst, unsigned char * src,
|
||||
int qIndex, int w, int h,
|
||||
unsigned char format,
|
||||
int o_size, int *size,
|
||||
int omit_huffman_table,
|
||||
int omit_huffman_table,
|
||||
int omit_escape);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -151,7 +151,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
Camera *camera = data;
|
||||
int n;
|
||||
GP_DEBUG ("List files in %s\n", folder);
|
||||
n = camera->pl->num_pics;
|
||||
n = camera->pl->num_pics;
|
||||
gp_list_populate(list, "cs%03i.jpeg", n);
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
/* Get the entry number of the photo on the camera */
|
||||
k = gp_filesystem_number (camera->fs, "/", filename, context);
|
||||
|
||||
|
||||
if (GP_FILE_TYPE_EXIF==type) return GP_ERROR_FILE_EXISTS;
|
||||
|
||||
if (GP_FILE_TYPE_RAW!=type && GP_FILE_TYPE_NORMAL !=type && GP_FILE_TYPE_PREVIEW!=type)
|
||||
@@ -192,7 +192,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
jpeg_format = JPEG_QCIF_FORMAT;
|
||||
break;
|
||||
default: GP_DEBUG ( "Unknown resolution setting %i\n", res);
|
||||
return GP_ERROR;
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
data = NULL;
|
||||
@@ -205,16 +205,16 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
gp_file_set_data_and_size (file, (char *)data, b);
|
||||
/* Reset camera when done, for more graceful exit. */
|
||||
if (k +1 == camera->pl->num_pics) {
|
||||
clicksmart_reset (camera->port);
|
||||
clicksmart_reset (camera->port);
|
||||
}
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
GP_DEBUG ("size = %i\n", b);
|
||||
|
||||
GP_DEBUG ("size = %i\n", b);
|
||||
|
||||
/* It looks as though o_size = b */
|
||||
/* It seems that qIndex is byte7, which is always 3, so I use that. */
|
||||
|
||||
|
||||
file_size = b + 589 + 1024 * 10;
|
||||
|
||||
jpeg_out = malloc(file_size);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/* spca50x-jpeg-header.h
|
||||
/* spca50x-jpeg-header.h
|
||||
*
|
||||
* part of libgphoto2/camlibs/clicksmart310
|
||||
*
|
||||
* This file is essentially identical to the file of the same name,
|
||||
* found in libgphoto2/camlibs/spca50x.
|
||||
* This file is essentially identical to the file of the same name,
|
||||
* found in libgphoto2/camlibs/spca50x.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -35,7 +35,7 @@
|
||||
#define SPCA50X_JPG_DEFAULT_HEADER_PART3_LENGTH 33
|
||||
#define SPCA50X_JPG_DEFAULT_HEADER_LENGTH 589
|
||||
|
||||
static unsigned
|
||||
static unsigned
|
||||
char SPCA50xJPGDefaultHeaderPart1[SPCA50X_JPG_DEFAULT_HEADER_PART1_LENGTH] = {
|
||||
/* SOI(Start of Image) */
|
||||
0xFF,0xD8,
|
||||
@@ -53,7 +53,7 @@ char SPCA50xJPGDefaultHeaderPart1[SPCA50X_JPG_DEFAULT_HEADER_PART1_LENGTH] = {
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22
|
||||
};
|
||||
static unsigned
|
||||
static unsigned
|
||||
char SPCA50xJPGDefaultHeaderPart2[SPCA50X_JPG_DEFAULT_HEADER_PART2_LENGTH] = {
|
||||
/* DHT(Define Huffman Table) */
|
||||
0xFF,0xC4,
|
||||
@@ -89,7 +89,7 @@ char SPCA50xJPGDefaultHeaderPart2[SPCA50X_JPG_DEFAULT_HEADER_PART2_LENGTH] = {
|
||||
* 5 - 6 : Image Height(H Byte,L Byte)
|
||||
* 7 - 8 : Image Width(H Byte,L Byte)
|
||||
*/
|
||||
static unsigned
|
||||
static unsigned
|
||||
char SPCA50xJPGDefaultHeaderPart3[SPCA50X_JPG_DEFAULT_HEADER_PART3_LENGTH] = {
|
||||
/* SOFn(Start of Frame) */
|
||||
0xFF,0xC0,
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* postprocess.c
|
||||
*
|
||||
* Here are the decompression function for the compressed photos and the
|
||||
* postprocessing for uncompressed photos.
|
||||
* Here are the decompression function for the compressed photos and the
|
||||
* postprocessing for uncompressed photos.
|
||||
*
|
||||
* Copyright (c) 2005 and 2007 Theodore Kilgore <kilgota@auburn.edu>
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* The chip supported by this driver is presumed to be the SQ905,
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* The chip supported by this driver is presumed to be the SQ905,
|
||||
*
|
||||
* Licensed under GNU Lesser General Public License, as part of Gphoto
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* COPYING in the main source tree of libgphoto2.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <gamma.h>
|
||||
#include "digigr8.h"
|
||||
|
||||
#define GP_MODULE "digigr8"
|
||||
#define GP_MODULE "digigr8"
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
@@ -59,7 +59,7 @@ digi_first_decompress (unsigned char *output, unsigned char *input,
|
||||
unsigned char lookup_table[16]
|
||||
={0, 2, 6, 0x0e, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4,
|
||||
0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb};
|
||||
unsigned char translator[16] =
|
||||
unsigned char translator[16] =
|
||||
{8, 7, 9, 6, 10, 11, 12, 13, 14, 15, 5, 4, 3, 2, 1, 0};
|
||||
|
||||
GP_DEBUG ("Running first_decompress.\n");
|
||||
@@ -84,7 +84,7 @@ digi_first_decompress (unsigned char *output, unsigned char *input,
|
||||
cycles ++ ;
|
||||
if (cycles > 8) {
|
||||
GP_DEBUG ("Too many cycles?\n");
|
||||
return GP_ERROR;
|
||||
return GP_ERROR;
|
||||
}
|
||||
lookup = temp2 & 0xff;
|
||||
}
|
||||
@@ -97,12 +97,12 @@ digi_first_decompress (unsigned char *output, unsigned char *input,
|
||||
}
|
||||
if (lookup == lookup_table[i] ) {
|
||||
nibble_to_keep[parity] = translator[i];
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cycles = 0;
|
||||
parity ++ ;
|
||||
}
|
||||
}
|
||||
output[bytes_done] = (nibble_to_keep[0] << 4)
|
||||
| nibble_to_keep[1];
|
||||
bytes_done++;
|
||||
@@ -141,7 +141,7 @@ digi_second_decompress (unsigned char *uncomp, unsigned char *in,
|
||||
}
|
||||
for(i=0; i < width; i++)
|
||||
templine_green[i] = 0x80;
|
||||
|
||||
|
||||
templine_blue = malloc(width);
|
||||
if (!templine_blue) {
|
||||
free (templine_red);
|
||||
@@ -333,7 +333,7 @@ digi_postprocess(int width, int height,
|
||||
===================================================================== */
|
||||
|
||||
static int
|
||||
histogram (unsigned char *data, unsigned int size, int *htable_r,
|
||||
histogram (unsigned char *data, unsigned int size, int *htable_r,
|
||||
int *htable_g, int *htable_b)
|
||||
{
|
||||
int x;
|
||||
@@ -428,7 +428,7 @@ white_balance (unsigned char *data, unsigned int size, float saturation)
|
||||
{
|
||||
d = (data[x + 0] << 8) * r_factor + 8;
|
||||
d >>= 8;
|
||||
if (d > 0xff)
|
||||
if (d > 0xff)
|
||||
d = 0xff;
|
||||
data[x + 0] = d;
|
||||
d = (data[x + 1] << 8) * g_factor + 8;
|
||||
@@ -437,7 +437,7 @@ white_balance (unsigned char *data, unsigned int size, float saturation)
|
||||
data[x + 1] = d;
|
||||
d = (data[x + 2] << 8) * b_factor + 8;
|
||||
d >>= 8;
|
||||
if (d > 0xff)
|
||||
if (d > 0xff)
|
||||
d = 0xff;
|
||||
data[x + 2] = d;
|
||||
}
|
||||
@@ -503,7 +503,7 @@ white_balance (unsigned char *data, unsigned int size, float saturation)
|
||||
if (b > d)
|
||||
b = b + (int) ((b - d) * (0xff - b)
|
||||
/(0x100 - d) * saturation);
|
||||
else
|
||||
else
|
||||
b = b + (int) ((b - d) * (0xff - d)
|
||||
/(0x100 - b) * saturation);
|
||||
data[x+0] = CLAMP(r);
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
* digigr8.c
|
||||
*
|
||||
* Part of libgphoto2/camlibs/digigr8
|
||||
* Here are the functions which are needed to get data from the camera.
|
||||
* Here are the functions which are needed to get data from the camera.
|
||||
*
|
||||
* Copyright (c) 2005 Theodore Kilgore <kilgota@auburn.edu>
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* Cameras supported by this driver have Product ID 0x905C, 0x9050, or.
|
||||
* 0x913D.
|
||||
*
|
||||
* Licensed under GNU Lesser General Public License, as part of Gphoto
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* COPYING in the main source tree of libgphoto2.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
#include <gphoto2/gphoto2-port.h>
|
||||
#include "digigr8.h"
|
||||
|
||||
#define GP_MODULE "digigr8"
|
||||
#define GP_MODULE "digigr8"
|
||||
|
||||
#define SQWRITE gp_port_usb_msg_write
|
||||
#define SQREAD gp_port_usb_msg_read
|
||||
|
||||
int
|
||||
int
|
||||
digi_init (GPPort *port, CameraPrivateLibrary *priv)
|
||||
{
|
||||
char c[0x14];
|
||||
@@ -53,7 +53,7 @@ digi_init (GPPort *port, CameraPrivateLibrary *priv)
|
||||
digi_reset (port);
|
||||
SQWRITE (port, 0x0c, 0x14f0, 0x0, NULL, 0);
|
||||
|
||||
gp_port_read (port, c, 0x14);
|
||||
gp_port_read (port, c, 0x14);
|
||||
digi_reset(port);
|
||||
SQWRITE (port, 0x0c, 0x20, 0x40, NULL, 0);
|
||||
gp_port_read(port, (char *)catalog, 0x4000); /* We need 16 bytes for each photo. */
|
||||
@@ -68,9 +68,9 @@ digi_init (GPPort *port, CameraPrivateLibrary *priv)
|
||||
memset (catalog+i, 0, 16);
|
||||
if (i) {
|
||||
/*
|
||||
* 0x913c cameras allow individual photo deletion. This causes
|
||||
* 0x913c cameras allow individual photo deletion. This causes
|
||||
* the relevant catalog line to start with 0x64. So the related
|
||||
* lines of config data must be removed, and the deleted
|
||||
* lines of config data must be removed, and the deleted
|
||||
* images need to be cast out from the count.
|
||||
*/
|
||||
|
||||
@@ -107,7 +107,7 @@ digi_get_comp_ratio (CameraPrivateLibrary *priv, int entry)
|
||||
case 0x43:
|
||||
case 0x52:
|
||||
case 0x53:
|
||||
case 0x56:
|
||||
case 0x56:
|
||||
case 0x72: return 0;
|
||||
default:
|
||||
GP_DEBUG ("Your camera has unknown resolution settings.\n");
|
||||
@@ -118,15 +118,15 @@ digi_get_comp_ratio (CameraPrivateLibrary *priv, int entry)
|
||||
unsigned int
|
||||
digi_get_data_size (CameraPrivateLibrary *priv, int entry)
|
||||
{
|
||||
return ((priv->catalog[16*entry + 6] <<16)
|
||||
| (priv->catalog[16*entry + 5] <<8)
|
||||
return ((priv->catalog[16*entry + 6] <<16)
|
||||
| (priv->catalog[16*entry + 5] <<8)
|
||||
| (priv->catalog[16*entry + 4] ) );
|
||||
}
|
||||
|
||||
unsigned int
|
||||
digi_get_picture_width (CameraPrivateLibrary *priv, int entry)
|
||||
{
|
||||
switch (priv->catalog[16*entry]) {
|
||||
switch (priv->catalog[16*entry]) {
|
||||
case 0x41:
|
||||
case 0x52:
|
||||
case 0x61: return 352;
|
||||
@@ -148,8 +148,8 @@ int
|
||||
digi_rewind (GPPort *port, CameraPrivateLibrary *priv)
|
||||
{
|
||||
static char dummy_buf[0x4000];
|
||||
|
||||
|
||||
|
||||
|
||||
GP_DEBUG("REWIND cam's data pointer");
|
||||
|
||||
/* One has to read the catalog to rewind the data stream...
|
||||
@@ -158,7 +158,7 @@ digi_rewind (GPPort *port, CameraPrivateLibrary *priv)
|
||||
|
||||
digi_reset(port);
|
||||
SQWRITE (port, 0x0c, 0x20, 0x40, NULL, 0); /* Access config */
|
||||
gp_port_read(port, dummy_buf, 0x4000);
|
||||
gp_port_read(port, dummy_buf, 0x4000);
|
||||
digi_reset (port);
|
||||
|
||||
priv->last_fetched_entry = -1;
|
||||
@@ -184,8 +184,8 @@ digi_read_picture_data (GPPort *port, unsigned char *data, unsigned int size, in
|
||||
int ret;
|
||||
|
||||
if (!n) {
|
||||
SQWRITE (port, 0x0c, 0x30, 0x00, NULL, 0);
|
||||
}
|
||||
SQWRITE (port, 0x0c, 0x30, 0x00, NULL, 0);
|
||||
}
|
||||
while ((offset + 0x8000 < size)) {
|
||||
ret = gp_port_read (port, (char *)data + offset, 0x8000);
|
||||
if (ret < GP_OK) return ret;
|
||||
@@ -195,9 +195,9 @@ digi_read_picture_data (GPPort *port, unsigned char *data, unsigned int size, in
|
||||
if (ret < GP_OK) return ret;
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
}
|
||||
|
||||
int digi_delete_all (GPPort *port, CameraPrivateLibrary *priv)
|
||||
int digi_delete_all (GPPort *port, CameraPrivateLibrary *priv)
|
||||
{
|
||||
int size;
|
||||
int num_pics;
|
||||
@@ -232,7 +232,7 @@ int digi_delete_all (GPPort *port, CameraPrivateLibrary *priv)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
gp_port_read(port, (char *)junk, size);
|
||||
free(junk);
|
||||
free(junk);
|
||||
digi_reset (port);
|
||||
|
||||
return GP_OK;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* digigr8.h
|
||||
* digigr8.h
|
||||
*
|
||||
* Header file for libgphoto2/camlibs/digigr8.
|
||||
* Header file for libgphoto2/camlibs/digigr8.
|
||||
*
|
||||
* Copyright (c) 2005 Theodore Kilgore <kilgota@auburn.edu>
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* Cameras supported by this driver have Product ID 0x905C, 0x9050, or
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* Cameras supported by this driver have Product ID 0x905C, 0x9050, or
|
||||
* 0x913D.
|
||||
*
|
||||
* Licensed under GNU Lesser General Public License, as part of Gphoto
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* COPYING in the main source tree of libgphoto2.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef __DIGIGR8_H__
|
||||
#define __DIGIGR8_H__
|
||||
@@ -31,7 +31,7 @@ struct _CameraPrivateLibrary {
|
||||
int digi_reset (GPPort *);
|
||||
int digi_init (GPPort *, CameraPrivateLibrary *);
|
||||
int digi_rewind (GPPort *port, CameraPrivateLibrary *priv);
|
||||
int digi_read_picture_data (GPPort *, unsigned char *data,
|
||||
int digi_read_picture_data (GPPort *, unsigned char *data,
|
||||
unsigned int size, int n);
|
||||
|
||||
/* Those functions don't need data transfer with the camera */
|
||||
@@ -40,7 +40,7 @@ unsigned int digi_get_comp_ratio (CameraPrivateLibrary *, int entry);
|
||||
unsigned int digi_get_data_size (CameraPrivateLibrary *, int entry);
|
||||
unsigned int digi_get_picture_width (CameraPrivateLibrary *, int entry);
|
||||
int digi_is_clip (CameraPrivateLibrary *, int entry);
|
||||
int digi_decompress (unsigned char *out_data, unsigned char *data,
|
||||
int digi_decompress (unsigned char *out_data, unsigned char *data,
|
||||
int w, int h);
|
||||
int digi_postprocess (int width, int height, unsigned char* rgb);
|
||||
int digi_delete_all (GPPort *, CameraPrivateLibrary *priv);
|
||||
|
||||
@@ -459,7 +459,7 @@ camera_init(Camera *camera, GPContext *context)
|
||||
/* Tell the CameraFilesystem where to get lists from */
|
||||
gp_filesystem_set_funcs(camera->fs, &fsfuncs, camera);
|
||||
camera->pl = malloc(sizeof (CameraPrivateLibrary));
|
||||
if (!camera->pl)
|
||||
if (!camera->pl)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
camera->pl->catalog = NULL;
|
||||
camera->pl->nb_entries = 0;
|
||||
|
||||
@@ -97,7 +97,7 @@ int camera_abilities(CameraAbilitiesList *list)
|
||||
a.speed[5] = 0;
|
||||
a.operations = GP_OPERATION_NONE;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW |
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW |
|
||||
GP_FILE_OPERATION_DELETE;
|
||||
a.usb_vendor = models[i].usb_vendor;
|
||||
a.usb_product = models[i].usb_product;
|
||||
@@ -208,7 +208,7 @@ static int file_list_func(CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
|
||||
#define GFD_BUFSIZE 19432
|
||||
static unsigned char *digita_file_get(Camera *camera, const char *folder,
|
||||
static unsigned char *digita_file_get(Camera *camera, const char *folder,
|
||||
const char *filename, int thumbnail, int *size,
|
||||
GPContext *context)
|
||||
{
|
||||
@@ -318,7 +318,7 @@ static int get_file_func(CameraFilesystem *fs, const char *folder,
|
||||
Camera *camera = user_data;
|
||||
unsigned char *data;
|
||||
unsigned int width, height;
|
||||
char ppmhead[64];
|
||||
char ppmhead[64];
|
||||
int buflen;
|
||||
|
||||
if (folder[0] == '/')
|
||||
@@ -403,7 +403,7 @@ static int camera_about(Camera *camera, CameraText *about, GPContext *context)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int digita_file_delete(Camera *camera, const char *folder,
|
||||
static int digita_file_delete(Camera *camera, const char *folder,
|
||||
const char *filename, GPContext *context)
|
||||
{
|
||||
struct filename fn;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Program: gPhoto2 driver for Mustek VDC 3500/Relisys Dimera 3500
|
||||
*
|
||||
* Note:
|
||||
@@ -69,7 +69,7 @@
|
||||
static const char Dimera_thumbhdr[] =
|
||||
"P5\n# Dimera 3500 Thumbnail written by gphoto2\n64 48\n255\n";
|
||||
|
||||
static const char Dimera_viewhdr[] =
|
||||
static const char Dimera_viewhdr[] =
|
||||
"P5\n# Dimera 3500 Viewfinder written by gphoto2\n128 96\n15\n";
|
||||
|
||||
static const char Dimera_finehdr[] =
|
||||
@@ -93,9 +93,9 @@ Dimera_Preview( long *size, Camera *camera, GPContext *context );
|
||||
/* Gphoto2 */
|
||||
|
||||
struct _CameraPrivateLibrary {
|
||||
unsigned exposure;
|
||||
int auto_exposure;
|
||||
int auto_flash;
|
||||
unsigned exposure;
|
||||
int auto_exposure;
|
||||
int auto_flash;
|
||||
};
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ conversion_chuck (const unsigned int width, const unsigned int height,
|
||||
*
|
||||
* Convert the 4 cells into a single RGB pixel.
|
||||
* Colors are encoded as follows:
|
||||
*
|
||||
*
|
||||
* 000000000000000000........33
|
||||
* 000000000011111111........11
|
||||
* 012345678901234567........89
|
||||
@@ -216,7 +216,7 @@ conversion_chuck (const unsigned int width, const unsigned int height,
|
||||
* The exception is when x or y are zero then the neighors used are
|
||||
* the +1 cells.
|
||||
*/
|
||||
|
||||
|
||||
for (y = 0;y < height; y++)
|
||||
for (x = 0;x < width; x++) {
|
||||
p1 = ((y==0?y+1:y-1)*width) + (x==0?x+1:x-1);
|
||||
@@ -306,7 +306,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
if (!data)
|
||||
return GP_ERROR;
|
||||
gp_file_set_data_and_size (file, (char *)data, size); /* will take over data ptr ownership */
|
||||
gp_file_set_mime_type (file, GP_MIME_RAW);
|
||||
gp_file_set_mime_type (file, GP_MIME_RAW);
|
||||
gp_file_adjust_name_for_mime_type (file);
|
||||
break;
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
@@ -441,7 +441,7 @@ static int camera_summary (Camera *camera, CameraText *summary, GPContext *conte
|
||||
eeprom_capacity = eeprom_size_table[eeprom_info[11]];
|
||||
}
|
||||
/* Estimate the number of pictures that this size of flash can hold */
|
||||
hi_pics_max = eeprom_capacity / 2;
|
||||
hi_pics_max = eeprom_capacity / 2;
|
||||
lo_pics_max = (eeprom_capacity * 13) / 8;
|
||||
|
||||
if (features.feature_bits_lo & AC_PRESENT)
|
||||
@@ -645,7 +645,7 @@ Dimera_Get_Full_Image (int picnum, long *size, int *width, int *height,
|
||||
|
||||
if ( (s == GP_ERROR_TIMEOUT || s == GP_ERROR_CORRUPTED_DATA) && --retry > 0)
|
||||
{
|
||||
GP_DEBUG( "Dimera_Get_Full_Image: retrans");
|
||||
GP_DEBUG( "Dimera_Get_Full_Image: retrans");
|
||||
continue;
|
||||
}
|
||||
GP_DEBUG(
|
||||
@@ -681,7 +681,7 @@ Dimera_Get_Full_Image (int picnum, long *size, int *width, int *height,
|
||||
|
||||
if ( (s == GP_ERROR_TIMEOUT || s == GP_ERROR_CORRUPTED_DATA) && --retry > 0)
|
||||
{
|
||||
GP_DEBUG("Dimera_Get_Full_Image: retrans");
|
||||
GP_DEBUG("Dimera_Get_Full_Image: retrans");
|
||||
continue;
|
||||
}
|
||||
GP_DEBUG(
|
||||
@@ -744,7 +744,7 @@ static unsigned calc_new_exposure(unsigned exposure, unsigned brightness) {
|
||||
|
||||
/* Choose the correct curve for this camera scene */
|
||||
for (i=0; exposure_tables[i].M; ++i) {
|
||||
GP_DEBUG( "brightness %d, %f ",
|
||||
GP_DEBUG( "brightness %d, %f ",
|
||||
brightness,
|
||||
exp((double)((brightness/16.0) - exposure_tables[i].b) / exposure_tables[i].M));
|
||||
if (exp((double)((brightness/16.0) - exposure_tables[i].b) / exposure_tables[i].M) > exposure)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
dimeratab.h -- Color conversion values for the Dimera 3500
|
||||
|
||||
|
||||
These tables were deduced by analyzing the output of the Windows Dimera
|
||||
driver. Many of the values are probably wrong, but this produces a
|
||||
decent image. My analysis was done using several outdoor pictures in
|
||||
sunlight. In other lighting conditions, your mileage may vary.
|
||||
|
||||
|
||||
Comments or suggestions? Email me.
|
||||
|
||||
|
||||
-- Chuck Homic <chuck@vvisions.com>
|
||||
|
||||
$Id$
|
||||
|
||||
@@ -204,7 +204,7 @@ mesa_set_speed( GPPort *port, int speed )
|
||||
if (speed == 0)
|
||||
speed = 115200; /* use default speed */
|
||||
|
||||
GP_DEBUG(
|
||||
GP_DEBUG(
|
||||
"mesa_set_speed: speed %d", speed);
|
||||
|
||||
b[0] = SET_SPEED;
|
||||
@@ -266,7 +266,7 @@ mesa_version( GPPort *port, char *version_string)
|
||||
return GP_ERROR_TIMEOUT;
|
||||
}
|
||||
|
||||
GP_DEBUG(
|
||||
GP_DEBUG(
|
||||
"mesa_version: %02x:%02x:%02x\n", r[0], r[1], r[2] );
|
||||
sprintf(v, "%2x.%02x%c", r[1], r[0], r[2]);
|
||||
/* highest byte must be < MESA_VERSION_SZ */
|
||||
@@ -323,7 +323,7 @@ mesa_ram_test( GPPort *port )
|
||||
* * The following contradicted by traces from my Win98 twain driver* GDB
|
||||
* ******************************************************************** GDB
|
||||
* The image is stored in the camera as 504 row (0 - 503), the first 8 and the
|
||||
* last 2 are blank.
|
||||
* last 2 are blank.
|
||||
* The rows are 18 dummy pixels, 2 blanks, 646 pixels, 13 bytes garbage,
|
||||
* 2 bytes blanks
|
||||
*
|
||||
@@ -436,7 +436,7 @@ mesa_black_levels( GPPort *port, uint8_t r[2] )
|
||||
* the image can be full scale, 0, zoom 2x 1, zoom 4x, 2, and for
|
||||
* low res images, 8x, 3.
|
||||
*
|
||||
* row and column may be offset 0-197 and 0-223 for zoom.
|
||||
* row and column may be offset 0-197 and 0-223 for zoom.
|
||||
*
|
||||
* exposure is * 1/50000 seconds.
|
||||
*
|
||||
@@ -471,7 +471,7 @@ mesa_snap_view( GPPort *port, uint8_t *r, unsigned int hi_res,
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
else if ( download == 249 || download == 250 )
|
||||
bytes = 1536;
|
||||
else if ( download == 251 )
|
||||
else if ( download == 251 )
|
||||
bytes = 6144;
|
||||
else if ( download == 252 )
|
||||
bytes = 0;
|
||||
@@ -520,7 +520,7 @@ mesa_snap_view( GPPort *port, uint8_t *r, unsigned int hi_res,
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ mesa_download_view( GPPort *port, uint8_t *r, uint8_t download )
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
else if ( download == 249 )
|
||||
bytes = 1536;
|
||||
else if ( download == 250 || download == 251 )
|
||||
else if ( download == 250 || download == 251 )
|
||||
bytes = 768;
|
||||
else if ( download == 252 )
|
||||
bytes = 0;
|
||||
@@ -594,7 +594,7 @@ mesa_download_view( GPPort *port, uint8_t *r, uint8_t download )
|
||||
if ( cksum != b[0] )
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
}
|
||||
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ mesa_recv_test( GPPort *port, uint8_t r[6] )
|
||||
{
|
||||
uint8_t b[7];
|
||||
int i;
|
||||
|
||||
|
||||
b[0] = RCV_TEST;
|
||||
memcpy( &b[1], r, 6 );
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -73,7 +73,7 @@
|
||||
# endif
|
||||
#else
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define dgettext(Domain,Message) (Message)
|
||||
# define dcgettext(Domain,Message,Type) (Message)
|
||||
# define bindtextdomain(Domain,Directory) (Domain)
|
||||
@@ -86,8 +86,8 @@ static const struct {
|
||||
const char *mime_type;
|
||||
} mime_table[] = {
|
||||
{"jpeg", GP_MIME_JPEG},
|
||||
{"jpg", GP_MIME_JPEG},
|
||||
{"thm", GP_MIME_JPEG},
|
||||
{"jpg", GP_MIME_JPEG},
|
||||
{"thm", GP_MIME_JPEG},
|
||||
{"tif", GP_MIME_TIFF},
|
||||
{"ppm", GP_MIME_PPM},
|
||||
{"pgm", GP_MIME_PGM},
|
||||
@@ -182,7 +182,7 @@ int camera_abilities (CameraAbilitiesList *list)
|
||||
|
||||
#ifdef DEBUG
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW |
|
||||
GP_FILE_OPERATION_DELETE |
|
||||
GP_FILE_OPERATION_DELETE |
|
||||
GP_FILE_OPERATION_EXIF;
|
||||
#else
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
@@ -271,7 +271,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
dir = gp_system_opendir ((char*) f);
|
||||
if (!dir)
|
||||
return (GP_ERROR);
|
||||
|
||||
|
||||
/* Make sure we have 1 delimiter */
|
||||
|
||||
/* Count the files */
|
||||
@@ -373,7 +373,7 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
filename = gp_system_filename (de);
|
||||
if (*filename != '.') {
|
||||
snprintf (buf, sizeof(buf), "%s%s", f, filename);
|
||||
|
||||
|
||||
/* lstat ... do not follow symlinks */
|
||||
if (lstat (buf, &st) != 0) {
|
||||
int saved_errno = errno;
|
||||
@@ -417,7 +417,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
|
||||
}
|
||||
|
||||
info->preview.fields = GP_FILE_INFO_NONE;
|
||||
info->file.fields = GP_FILE_INFO_SIZE |
|
||||
info->file.fields = GP_FILE_INFO_SIZE |
|
||||
GP_FILE_INFO_TYPE | GP_FILE_INFO_PERMISSIONS |
|
||||
GP_FILE_INFO_MTIME;
|
||||
|
||||
@@ -719,7 +719,7 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
r = gp_file_open (file, "/usr/share/pixmaps/gnome-logo-large.png");
|
||||
if (r < 0)
|
||||
return (r);
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -786,7 +786,7 @@ storage_info_func (CameraFilesystem *fs,
|
||||
#endif
|
||||
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
static CameraFilesystemFuncs fsfuncs = {
|
||||
.file_list_func = file_list_func,
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
|
||||
/* the table of content of the camera
|
||||
it's filled in enigma_get_toc, and used in enigma_download_img */
|
||||
it's filled in enigma_get_toc, and used in enigma_download_img */
|
||||
static char* enigma13_static_toc=NULL;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ static int enigma13_detect_storage_type (Camera *camera)
|
||||
for (i=0;i<3;i++)
|
||||
{
|
||||
CHECK (gp_port_usb_msg_read (camera->port, 0x28, 0x0000,
|
||||
i, &buf[i], 0x01));
|
||||
i, &buf[i], 0x01));
|
||||
}
|
||||
gp_log(GP_LOG_DEBUG, "enigma13","Camera storage information sdram: 0x%x flash 0x%x card: 0x%x\n"
|
||||
, buf[0], buf[1], buf[2]);
|
||||
@@ -109,7 +109,7 @@ static int enigma13_detect_storage_type (Camera *camera)
|
||||
* This function deletes all the images
|
||||
* supported (sdram, flash, card)
|
||||
*
|
||||
* Status: not verified
|
||||
* Status: not verified
|
||||
*/
|
||||
static int
|
||||
enigma13_flash_delete_all(CameraFilesystem *fs, const char *folder, void *data,
|
||||
@@ -119,7 +119,7 @@ enigma13_flash_delete_all(CameraFilesystem *fs, const char *folder, void *data,
|
||||
gp_log(GP_LOG_DEBUG, "enigma13","Delete all files");
|
||||
cam = data;
|
||||
CHECK (gp_port_usb_msg_write (cam->port, 0x52, 0x0, 0x0, NULL, 0x0) );
|
||||
return GP_OK;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ static int enigma13_wait_for_ready(Camera *camera)
|
||||
#if 0
|
||||
/*
|
||||
* Get the number of images in cam
|
||||
*
|
||||
*
|
||||
* Status: Should work, but not used as enigma13_get_TOC does all.
|
||||
*
|
||||
*/
|
||||
@@ -172,7 +172,7 @@ static int enigma13_get_filecount (Camera *camera, int *filecount)
|
||||
|
||||
|
||||
/*
|
||||
* Get the table of contents (directory) from the cam
|
||||
* Get the table of contents (directory) from the cam
|
||||
*
|
||||
* Verified: Yes
|
||||
*/
|
||||
@@ -235,14 +235,14 @@ static int enigma13_get_toc(Camera *camera, int *filecount, char** toc)
|
||||
* int index : image index ( in gphoto point of view) -1 for real index
|
||||
* char* toc : pointer to toc
|
||||
* char** img_buf : returned image data
|
||||
* int* img_size : returned image data size
|
||||
* int* img_size : returned image data size
|
||||
*
|
||||
*/
|
||||
static int enigma13_download_img(Camera *camera, char *toc, int index, char **img_data, int *img_size)
|
||||
{
|
||||
uint8_t *p;
|
||||
uint32_t file_size = 0, aligned_size = 0;
|
||||
char* buf=NULL;
|
||||
char* buf=NULL;
|
||||
int align=0;
|
||||
char retbuf[2];
|
||||
|
||||
@@ -336,7 +336,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder, CameraList
|
||||
|
||||
|
||||
/*
|
||||
* File operations
|
||||
* File operations
|
||||
*/
|
||||
static int
|
||||
get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
@@ -360,7 +360,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
CHECK(enigma13_download_img(camera, enigma13_static_toc, image_no, &img_data, &img_size));
|
||||
result = gp_file_append( file, img_data, img_size);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -373,7 +373,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
}
|
||||
|
||||
int
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities a;
|
||||
|
||||
@@ -392,7 +392,7 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
}
|
||||
|
||||
int
|
||||
camera_id (CameraText *id)
|
||||
camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "Digital Dream Enigma 1.3");
|
||||
return (GP_OK);
|
||||
@@ -405,7 +405,7 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
};
|
||||
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
GPPortSettings settings;
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -148,7 +148,7 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
@@ -326,7 +326,7 @@ pre_func (Camera *camera, GPContext *context)
|
||||
CR (fuji_set_speed (camera, Speeds[i].speed, context));
|
||||
|
||||
/*
|
||||
* Change the port's speed and check if the camera is
|
||||
* Change the port's speed and check if the camera is
|
||||
* still there.
|
||||
*/
|
||||
settings.serial.speed = Speeds[i].bit_rate;
|
||||
@@ -424,7 +424,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
CR (gp_widget_get_value (widget, &id));
|
||||
CR (fuji_id_set (camera, id, context));
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -531,8 +531,8 @@ camera_init (Camera *camera, GPContext *context)
|
||||
CR (pre_func (camera, context));
|
||||
/*
|
||||
* What commands does this camera support? The question is not
|
||||
* easy to answer, as "One issue the DS7 has is that the
|
||||
* supported command list command is not supported"
|
||||
* easy to answer, as "One issue the DS7 has is that the
|
||||
* supported command list command is not supported"
|
||||
* (Matt Martin <matt.martin@ieee.org>).
|
||||
*/
|
||||
if (fuji_get_cmds (camera, camera->pl->cmds, context) >= 0) {
|
||||
|
||||
@@ -264,7 +264,7 @@ get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
Camera *camera = user_data;
|
||||
int number, filetype;
|
||||
|
||||
CHECK (number = gp_filesystem_number (camera->fs, folder, filename,
|
||||
CHECK (number = gp_filesystem_number (camera->fs, folder, filename,
|
||||
context));
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
@@ -285,7 +285,7 @@ get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
static int
|
||||
get_info_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, CameraFileInfo *info, void *data,
|
||||
const char *filename, CameraFileInfo *info, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -293,13 +293,13 @@ get_info_func (CameraFilesystem *fs, const char *folder,
|
||||
struct GsmartFile *file;
|
||||
|
||||
/* Get the file number from the CameraFileSystem */
|
||||
CHECK (n = gp_filesystem_number (camera->fs, folder, filename,
|
||||
CHECK (n = gp_filesystem_number (camera->fs, folder, filename,
|
||||
context));
|
||||
|
||||
CHECK (gsmart300_get_file_info (camera->pl, n, &file));
|
||||
|
||||
info->file.fields = GP_FILE_INFO_TYPE
|
||||
| GP_FILE_INFO_WIDTH
|
||||
info->file.fields = GP_FILE_INFO_TYPE
|
||||
| GP_FILE_INFO_WIDTH
|
||||
| GP_FILE_INFO_HEIGHT;
|
||||
if (file->mime_type == GSMART_FILE_TYPE_IMAGE) {
|
||||
strcpy (info->file.type, GP_MIME_JPEG);
|
||||
@@ -309,8 +309,8 @@ get_info_func (CameraFilesystem *fs, const char *folder,
|
||||
info->file.width = file->width;
|
||||
info->file.height = file->height;
|
||||
|
||||
info->preview.fields = GP_FILE_INFO_TYPE
|
||||
| GP_FILE_INFO_WIDTH
|
||||
info->preview.fields = GP_FILE_INFO_TYPE
|
||||
| GP_FILE_INFO_WIDTH
|
||||
| GP_FILE_INFO_HEIGHT;
|
||||
strcpy (info->preview.type, GP_MIME_BMP);
|
||||
|
||||
@@ -325,7 +325,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
int n, c;
|
||||
|
||||
/* Get the file number from the CameraFileSystem */
|
||||
CHECK (n = gp_filesystem_number (camera->fs, folder, filename,
|
||||
CHECK (n = gp_filesystem_number (camera->fs, folder, filename,
|
||||
context));
|
||||
CHECK (c = gp_filesystem_count (camera->fs, folder, context));
|
||||
if (n + 1 != c) {
|
||||
@@ -333,7 +333,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
gp_filesystem_name (fs, "/", c - 1, &name, context);
|
||||
gp_context_error (context,
|
||||
_("Your camera only supports deleting "
|
||||
_("Your camera only supports deleting "
|
||||
"the last file on the camera. In this "
|
||||
"case, this is file '%s'."), name);
|
||||
return (GP_ERROR);
|
||||
@@ -343,7 +343,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
|
||||
static int
|
||||
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -39,14 +39,14 @@ static unsigned short crctab[256] = {
|
||||
};
|
||||
|
||||
/*
|
||||
* updcrc macro derived from article Copyright 1986 Stephen Satchell.
|
||||
* updcrc macro derived from article Copyright 1986 Stephen Satchell.
|
||||
* NOTE: First srgument must be in range 0 to 255.
|
||||
* Second argument is referenced twice.
|
||||
*
|
||||
* Programmers may incorporate any or all code into their programs,
|
||||
* giving proper credit within the source. Publication of the
|
||||
* source routines is permitted so long as proper credit is given
|
||||
* to Stephen Satchell, Satchell Evaluations and Chuck Forsberg,
|
||||
*
|
||||
* Programmers may incorporate any or all code into their programs,
|
||||
* giving proper credit within the source. Publication of the
|
||||
* source routines is permitted so long as proper credit is given
|
||||
* to Stephen Satchell, Satchell Evaluations and Chuck Forsberg,
|
||||
* Omen Technology.
|
||||
*/
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this program; see the file COPYING.LIB. If not, *
|
||||
* write to the
|
||||
* write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
* *
|
||||
@@ -414,7 +414,7 @@ hp_get_timeDate_cam (Camera *cam, char *txtbuffer, size_t txtbuffersize)
|
||||
gp_log (GP_LOG_ERROR, "hp215", "too short reply block, %d bytes", msglen);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
memcpy (datebuf, msg, 15);
|
||||
gp_log (GP_LOG_DEBUG, "hp215", "0f: %02x", msg[0x0f] & 0x7f);
|
||||
gp_log (GP_LOG_DEBUG, "hp215", "10: %02x", msg[0x10] & 0x7f);
|
||||
@@ -602,7 +602,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
0000 80 80 80 85 86 85-84 84 30 31 2f 30 32 2f ..........01/02/
|
||||
0010 30 30 20 31 34 3a 34 38-00 80 81 80 80 80 80 81 00 14:48........
|
||||
0020 88 89 84 81 80 80 80 80-80 81 00 00 00 00 00 00 ................
|
||||
0030 00 00 00 00 00 00 - ......
|
||||
0030 00 00 00 00 00 00 - ......
|
||||
*/
|
||||
xmsg = msg;
|
||||
ret = decode_u32(&xmsg, &msglen, &val);
|
||||
@@ -704,7 +704,7 @@ get_shoot_mode_table (Camera *camera) {
|
||||
if (ret < GP_OK) return ret;
|
||||
ret = decode_u32(&xmsg, &msglen, &val3);
|
||||
if (ret < GP_OK) return ret;
|
||||
|
||||
|
||||
gp_log (GP_LOG_DEBUG, "hp215", "shootmode table 0x%08x, 0x%08x, 0x%08x", val1, val2, val3);
|
||||
|
||||
cnt = val1+val2;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#define HP215_OK 0xe0e0
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
unsigned int hour;
|
||||
unsigned int min;
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
* iclick.c
|
||||
*
|
||||
* Here, the functions which are needed to get data from the camera.
|
||||
* Here, the functions which are needed to get data from the camera.
|
||||
*
|
||||
* Copyright (c) 2004 Theodore Kilgore <kilgota@auburn.edu>,
|
||||
* Stephen Pollei <stephen_pollei@comcast.net>.
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* The chip supported by this driver is presumed to be the SQ915.
|
||||
* Stephen Pollei <stephen_pollei@comcast.net>.
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* The chip supported by this driver is presumed to be the SQ915.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* Licensed under GNU Lesser General Public License, as part of Gphoto
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* COPYING in the main source tree of libgphoto2.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <gphoto2/gphoto2-port.h>
|
||||
#include "iclick.h"
|
||||
|
||||
#define GP_MODULE "iclick"
|
||||
#define GP_MODULE "iclick"
|
||||
|
||||
#define SQWRITE gp_port_usb_msg_write
|
||||
#define SQREAD gp_port_usb_msg_read
|
||||
@@ -47,12 +47,12 @@
|
||||
static unsigned char *
|
||||
icl_read_data (GPPort *port, unsigned char *data, int size)
|
||||
{
|
||||
gp_port_read (port, data, size);
|
||||
gp_port_read (port, data, size);
|
||||
return GP_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
int icl_access_reg (GPPort *port, enum icl_cmnd_type reg)
|
||||
int icl_access_reg (GPPort *port, enum icl_cmnd_type reg)
|
||||
{
|
||||
SQWRITE (port, 0x0c, reg,
|
||||
(CONFIG == reg) ? CONFIG_I : 0,
|
||||
@@ -60,7 +60,7 @@ int icl_access_reg (GPPort *port, enum icl_cmnd_type reg)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
icl_init (GPPort *port, CameraPrivateLibrary *priv)
|
||||
{
|
||||
int i;
|
||||
@@ -69,29 +69,29 @@ icl_init (GPPort *port, CameraPrivateLibrary *priv)
|
||||
unsigned char *catalog_tmp;
|
||||
|
||||
priv->model=SQ_MODEL_ICLICK;
|
||||
|
||||
|
||||
|
||||
|
||||
if (!catalog) return GP_ERROR_NO_MEMORY;
|
||||
|
||||
|
||||
icl_reset (port);
|
||||
|
||||
icl_access_reg(port, CONFIG); /* Access config */
|
||||
gp_port_read(port, (char *)catalog, 0x8000);
|
||||
gp_port_read(port, (char *)catalog, 0x8000);
|
||||
/* Config data is in lines of 16 bytes. Each photo uses two lines. */
|
||||
icl_read_picture_data(port, dummy_buf, 0x28000);
|
||||
icl_reset (port);
|
||||
|
||||
/* Photo list starts with line 0040. List terminates when we
|
||||
/* Photo list starts with line 0040. List terminates when we
|
||||
* the first entry of an even-numbered line is zero. */
|
||||
for (i=0; i< (0x8000 - 64) && catalog[i+64] ; i+=32)
|
||||
for (i=0; i< (0x8000 - 64) && catalog[i+64] ; i+=32)
|
||||
;
|
||||
priv->nb_entries = i>>5;
|
||||
if (i) {
|
||||
catalog_tmp = realloc(catalog, i);
|
||||
if (catalog_tmp)
|
||||
if (catalog_tmp)
|
||||
priv->catalog = catalog_tmp;
|
||||
else
|
||||
else
|
||||
priv->catalog = catalog;
|
||||
} else {
|
||||
free(catalog);
|
||||
@@ -122,8 +122,8 @@ icl_get_size (CameraPrivateLibrary *priv, int entry)
|
||||
int
|
||||
icl_get_width_height (CameraPrivateLibrary *priv, int entry, int *w, int *h)
|
||||
{
|
||||
*w = 640;
|
||||
*h = 480;
|
||||
*w = 640;
|
||||
*h = 480;
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@ int
|
||||
icl_rewind (GPPort *port, CameraPrivateLibrary *priv)
|
||||
{
|
||||
static unsigned char dummy_buf[0x30000];
|
||||
|
||||
|
||||
GP_DEBUG("REWIND cam's data pointer");
|
||||
|
||||
/* One has to read the catalog to rewind the data stream...
|
||||
* I don't know if it's by design.
|
||||
* I don't know if it's by design.
|
||||
* There ought to be something better to do... :-/
|
||||
*/
|
||||
|
||||
@@ -161,7 +161,7 @@ icl_reset (GPPort *port)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
icl_read_picture_data (GPPort *port, unsigned char *data, int size )
|
||||
{
|
||||
int remainder = size % 0x8000;
|
||||
@@ -175,6 +175,6 @@ icl_read_picture_data (GPPort *port, unsigned char *data, int size )
|
||||
gp_port_read (port, (char *)data + offset, remainder);
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
* iclick.c
|
||||
*
|
||||
* Here, the functions which are needed to get data from the camera.
|
||||
* Here, the functions which are needed to get data from the camera.
|
||||
*
|
||||
* Copyright (c) 2004 Theodore Kilgore <kilgota@auburn.edu>,
|
||||
* Copyright (c) 2004 Theodore Kilgore <kilgota@auburn.edu>,
|
||||
* Stephen Pollei <stephen_pollei@comcast.net>.
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* The chip supported by this driver is presumed to be the SQ915.
|
||||
* Camera library support under libgphoto2.1.1 for camera(s)
|
||||
* with chipset from Service & Quality Technologies, Taiwan.
|
||||
* The chip supported by this driver is presumed to be the SQ915.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* Licensed under GNU Lesser General Public License, as part of Gphoto
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* camera support project. For a copy of the license, see the file
|
||||
* COPYING in the main source tree of libgphoto2.
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
* A 'clip' is an autoshoot clip.
|
||||
* A 'frame' is a single a picture out of a clip.
|
||||
* An 'entry' corresponds to a line listed in the camera's configuration data,
|
||||
* part of which is a rudimentary allocation table (the 'catalog').
|
||||
* An entry, therefore, may be either a picture or a clip.
|
||||
* part of which is a rudimentary allocation table (the 'catalog').
|
||||
* An entry, therefore, may be either a picture or a clip.
|
||||
* We reserve the word 'file' for the user fetchable file,
|
||||
* that is, a picture or a frame.
|
||||
*/
|
||||
|
||||
@@ -111,7 +111,7 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
|
||||
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
|
||||
{
|
||||
strcpy(manual->text,
|
||||
strcpy(manual->text,
|
||||
_(
|
||||
"Information regarding cameras with ID 0x2770:0x9153.\n\n"
|
||||
"We do not recommend the use of a GUI program to access\n"
|
||||
|
||||
@@ -199,7 +199,7 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
raw = malloc(640*480 * 3);
|
||||
ppm = malloc(640*480 * 3 + 200);
|
||||
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ static int jamcam_mmc_card_file_count (Camera *camera) {
|
||||
|
||||
jamcam_set_int_at_pos( buf, 4, position );
|
||||
jamcam_write_packet( camera, buf, 8 );
|
||||
|
||||
|
||||
jamcam_read_packet( camera, reply, 16 );
|
||||
}
|
||||
break;
|
||||
@@ -268,7 +268,7 @@ int jamcam_file_count (Camera *camera) {
|
||||
|
||||
jamcam_set_int_at_pos( buf, 4, position );
|
||||
jamcam_write_packet( camera, buf, 8 );
|
||||
|
||||
|
||||
jamcam_read_packet( camera, reply, 16 );
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ static int jamcam_fetch_memory( Camera *camera, CameraFile *file,
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bytes_left -= bytes_to_read;
|
||||
bytes_read += bytes_to_read;
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Jenoptik JD11 Camera Driver
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -61,7 +61,7 @@ decomp_1byte(struct compstate *cs) {
|
||||
int xbit;
|
||||
|
||||
while ((cs->cl[xcs].left>=0) && (cs->cl[xcs].right>=0)) {
|
||||
xbit = jd11_getbit(cs);
|
||||
xbit = jd11_getbit(cs);
|
||||
if (xbit)
|
||||
xcs = cs->cl[xcs].left;
|
||||
else
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Jenopt JD11 Camera Driver
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Jenoptik JD11 Camera Driver
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -43,13 +43,13 @@
|
||||
|
||||
#include "serial.h"
|
||||
|
||||
int camera_id (CameraText *id)
|
||||
int camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "JD11");
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_abilities (CameraAbilitiesList *list)
|
||||
int camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities a;
|
||||
|
||||
@@ -102,7 +102,7 @@ int camera_abilities (CameraAbilitiesList *list)
|
||||
}
|
||||
|
||||
static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = (Camera*)data;
|
||||
|
||||
@@ -153,23 +153,23 @@ delete_all_func (CameraFilesystem *fs, const char* folder, void *data,
|
||||
return jd11_erase_all(camera->port);
|
||||
}
|
||||
|
||||
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
|
||||
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
|
||||
{
|
||||
strcpy(manual->text,
|
||||
strcpy(manual->text,
|
||||
_(
|
||||
"The JD11 camera works rather well with this driver.\n"
|
||||
"An RS232 interface @ 115 kbit is required for image transfer.\n"
|
||||
"The driver allows you to get\n\n"
|
||||
" - thumbnails (64x48 PGM format)\n"
|
||||
" - full images (640x480 PPM format)\n"
|
||||
));
|
||||
));
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
strcpy (about->text,
|
||||
strcpy (about->text,
|
||||
_("JD11\n"
|
||||
"Marcus Meissner <marcus@jet.franken.de>\n"
|
||||
"Driver for the Jenoptik JD11 camera.\n"
|
||||
@@ -178,7 +178,7 @@ static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
return (GP_OK);
|
||||
}
|
||||
static int camera_config_get (Camera *camera, CameraWidget **window,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
CameraWidget *widget,*section;
|
||||
float value_float,red,green,blue;
|
||||
@@ -231,7 +231,7 @@ static int camera_config_get (Camera *camera, CameraWidget **window,
|
||||
}
|
||||
|
||||
static int camera_config_set (Camera *camera, CameraWidget *window,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
float f,red,green,blue;
|
||||
CameraWidget *widget,*section;
|
||||
@@ -282,7 +282,7 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
.delete_all_func = delete_all_func,
|
||||
};
|
||||
|
||||
int camera_init (Camera *camera, GPContext *context)
|
||||
int camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
gp_port_settings settings;
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Jenopt JD11 Camera Driver
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -273,7 +273,7 @@ static void cmd_TestFLASH(GPPort *port) {
|
||||
fprintf(stderr,"TestFLASH: xcmd = %x.\n",xcmd);
|
||||
}
|
||||
|
||||
/* some kind of selftest ... shuts the shutters, beeps... only stops by
|
||||
/* some kind of selftest ... shuts the shutters, beeps... only stops by
|
||||
* powercycle. */
|
||||
static void cmd_79(GPPort *port) {
|
||||
unsigned short xcmd;
|
||||
@@ -351,7 +351,7 @@ jd11_erase_all(GPPort *port) {
|
||||
}
|
||||
|
||||
/* This function reads all thumbnails at once and initializes the whole
|
||||
* camera filesystem. This can be done, because finding out how much
|
||||
* camera filesystem. This can be done, because finding out how much
|
||||
* pictures are on the camera is done by reading the whole preview picture
|
||||
* stream anyway.
|
||||
* And since the file infos are static mostly, why not just set them too at
|
||||
@@ -401,7 +401,7 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
|
||||
unsigned char thumb[64*48];
|
||||
int y;
|
||||
CameraFileInfo info;
|
||||
|
||||
|
||||
ret = gp_file_new(&file);
|
||||
if (ret!=GP_OK) {
|
||||
free(indexbuf);
|
||||
@@ -437,14 +437,14 @@ jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
|
||||
|
||||
/* we also get the fs info for free, so just set it */
|
||||
info.file.fields = GP_FILE_INFO_TYPE |
|
||||
GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT |
|
||||
GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT |
|
||||
GP_FILE_INFO_SIZE;
|
||||
strcpy(info.file.type,GP_MIME_PNM);
|
||||
info.file.width = 640;
|
||||
info.file.height = 480;
|
||||
info.file.size = 640*480*3+strlen(IMGHEADER);
|
||||
info.preview.fields = GP_FILE_INFO_TYPE |
|
||||
GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT |
|
||||
GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT |
|
||||
GP_FILE_INFO_SIZE;
|
||||
strcpy(info.preview.type,GP_MIME_PGM);
|
||||
info.preview.width = 64;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Jenopt JD11 Camera Driver
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
* Copyright 1999-2001 Marcus Meissner <marcus@jet.franken.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -32,23 +32,23 @@
|
||||
|
||||
#include "jl2005a.h"
|
||||
|
||||
#define GP_MODULE "jl2005a"
|
||||
#define GP_MODULE "jl2005a"
|
||||
|
||||
int
|
||||
jl2005a_init (Camera *camera, GPPort *port, CameraPrivateLibrary *priv)
|
||||
int
|
||||
jl2005a_init (Camera *camera, GPPort *port, CameraPrivateLibrary *priv)
|
||||
{
|
||||
GP_DEBUG("Running jl2005a_init\n");
|
||||
|
||||
jl2005a_shortquery(port, 0x0d); /* Supposed to get 0x08 */
|
||||
jl2005a_shortquery(port, 0x1c); /* Supposed to get 0x01 */
|
||||
jl2005a_shortquery(port, 0x20); /* Supposed to get 0x04 */
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa1\x02", 2);
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa2\x02", 2);
|
||||
gp_port_write (port, "\xa1\x02", 2);
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa2\x02", 2);
|
||||
jl2005a_shortquery(port, 0x1d); /* 1 if camera is full, else 0 */
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa1\x00", 2);
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa1\x00", 2);
|
||||
priv->nb_entries = jl2005a_shortquery(port, 0x0a)&0xff;
|
||||
/* Number of pix returned here */
|
||||
GP_DEBUG("%d entries in the camera\n", priv->nb_entries);
|
||||
@@ -79,7 +79,7 @@ jl2005a_get_pic_data_size (GPPort *port, int n)
|
||||
if (size == 0x3100)
|
||||
size += 0x80;
|
||||
GP_DEBUG("size = 0x%x\n", size);
|
||||
return (size);
|
||||
return (size);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -91,7 +91,7 @@ jl2005a_get_pic_width (GPPort *port)
|
||||
width = (response&0xff);
|
||||
response = (jl2005a_read_info_byte(port, 4) )&0xff;
|
||||
width = ((response&0xff) << 8)|width;
|
||||
return (width);
|
||||
return (width);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -102,23 +102,23 @@ jl2005a_get_pic_height (GPPort *port)
|
||||
response = (jl2005a_read_info_byte(port, 5) )&0xff;
|
||||
height = (response&0xff);
|
||||
response = (jl2005a_read_info_byte(port, 6) )&0xff;
|
||||
height = ((response&0xff)<< 8)|height;
|
||||
height = ((response&0xff)<< 8)|height;
|
||||
return (height);
|
||||
}
|
||||
|
||||
int
|
||||
set_usb_in_endpoint (Camera *camera, int inep)
|
||||
int
|
||||
set_usb_in_endpoint (Camera *camera, int inep)
|
||||
{
|
||||
GPPortSettings settings;
|
||||
gp_port_get_settings ( camera ->port, &settings);
|
||||
settings.usb.inep = inep;
|
||||
GP_DEBUG("inep reset to %02X\n", inep);
|
||||
return gp_port_set_settings ( camera ->port, settings);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
jl2005a_read_picture_data (Camera *camera, GPPort *port,
|
||||
unsigned char *data, unsigned int size)
|
||||
int
|
||||
jl2005a_read_picture_data (Camera *camera, GPPort *port,
|
||||
unsigned char *data, unsigned int size)
|
||||
{
|
||||
unsigned char *to_read;
|
||||
int maxdl = 0xfa00;
|
||||
@@ -132,9 +132,9 @@ jl2005a_read_picture_data (Camera *camera, GPPort *port,
|
||||
* frame in a clip, is 0x01 if it is any clip frame after the initial
|
||||
* one, and is zero if what is to be downloaded is a standalone photo.
|
||||
* If clips will in the future be processed as AVI files, then there is
|
||||
* not any information to know how many frames are present, prior to
|
||||
* not any information to know how many frames are present, prior to
|
||||
* downloading them. There is only a starting point and an indicator
|
||||
* for each frame.
|
||||
* for each frame.
|
||||
*/
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa1\x04", 2);
|
||||
@@ -145,8 +145,8 @@ jl2005a_read_picture_data (Camera *camera, GPPort *port,
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa2\x08", 2);
|
||||
|
||||
/* Switch the inep over to 0x81. */
|
||||
set_usb_in_endpoint (camera, 0x81);
|
||||
/* Switch the inep over to 0x81. */
|
||||
set_usb_in_endpoint (camera, 0x81);
|
||||
while (size > maxdl) {
|
||||
ret = gp_port_read(port, (char *)to_read, maxdl);
|
||||
if (ret < GP_OK) return ret;
|
||||
@@ -157,7 +157,7 @@ jl2005a_read_picture_data (Camera *camera, GPPort *port,
|
||||
ret = gp_port_read(port, (char *)to_read, size);
|
||||
if (ret < GP_OK) return ret;
|
||||
if (ret < size) return GP_ERROR;
|
||||
/* Switch the inep back to 0x84. */
|
||||
/* Switch the inep back to 0x84. */
|
||||
set_usb_in_endpoint (camera, 0x84);
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -165,18 +165,18 @@ jl2005a_read_picture_data (Camera *camera, GPPort *port,
|
||||
int
|
||||
jl2005a_reset (Camera *camera, GPPort *port)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
gp_port_write (port,"\xab\x00" , 2);
|
||||
gp_port_write (port, "\xa1\x00", 2);
|
||||
gp_port_write (port, "\xab\x00", 2);
|
||||
gp_port_write (port, "\xa2\x02", 2);
|
||||
for (i=0; i < 4; i++)
|
||||
for (i=0; i < 4; i++)
|
||||
jl2005a_shortquery(port, 0x1d);
|
||||
/* Supposed to get something like 0x01, 0x01, 0x01, 0x00 */
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int jl2005a_read_info_byte(GPPort *port, int n)
|
||||
int jl2005a_read_info_byte(GPPort *port, int n)
|
||||
{
|
||||
char response;
|
||||
char command[2];
|
||||
@@ -227,7 +227,7 @@ int jl2005a_decompress (unsigned char *inp, unsigned char *outp, int width,
|
||||
outp[(4*i+5)*width+j])/2;
|
||||
}
|
||||
}
|
||||
if (width == 176)
|
||||
if (width == 176)
|
||||
memmove(outp+6*width, outp, (height-6)*width);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -37,14 +37,14 @@ struct _CameraPrivateLibrary {
|
||||
};
|
||||
|
||||
|
||||
int jl2005a_init (Camera *camera, GPPort *port,
|
||||
int jl2005a_init (Camera *camera, GPPort *port,
|
||||
CameraPrivateLibrary *priv);
|
||||
int jl2005a_get_pic_data_size (GPPort *port, int n);
|
||||
int jl2005a_get_pic_width (GPPort *port);
|
||||
int jl2005a_get_pic_height (GPPort *port);
|
||||
int set_usb_in_endpoint (Camera *camera, int inep);
|
||||
int jl2005a_read_picture_data ( Camera *camera,
|
||||
GPPort *port, unsigned char *data,
|
||||
GPPort *port, unsigned char *data,
|
||||
unsigned int size);
|
||||
int jl2005a_reset (Camera *camera, GPPort *port);
|
||||
int jl2005a_read_info_byte(GPPort *port, int n);
|
||||
|
||||
@@ -159,17 +159,17 @@ white_balance (unsigned char *data, unsigned int size, float saturation)
|
||||
{
|
||||
d = (data[x + 0] << 8) * r_factor + 8;
|
||||
d >>= 8;
|
||||
if (d > 0xff)
|
||||
if (d > 0xff)
|
||||
d = 0xff;
|
||||
data[x + 0] = d;
|
||||
d = (data[x + 1] << 8) * g_factor + 8;
|
||||
d >>= 8;
|
||||
if (d > 0xff)
|
||||
if (d > 0xff)
|
||||
d = 0xff;
|
||||
data[x + 1] = d;
|
||||
d = (data[x + 2] << 8) * b_factor + 8;
|
||||
d >>= 8;
|
||||
if (d > 0xff)
|
||||
if (d > 0xff)
|
||||
d = 0xff;
|
||||
data[x + 2] = d;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@@ -273,7 +273,7 @@ jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer,
|
||||
{
|
||||
my_dest_ptr dest;
|
||||
|
||||
/* The destination object is made permanent so that multiple JPEG
|
||||
/* The destination object is made permanent so that multiple JPEG
|
||||
* images can be written to the same file without re-executing
|
||||
* jpeg_stdio_dest.
|
||||
* This makes it dangerous to use this manager and a different
|
||||
|
||||
@@ -460,7 +460,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
|
||||
GP_DEBUG ("Initializing the camera\n");
|
||||
ret = gp_port_get_settings(camera->port,&settings);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) return ret;
|
||||
|
||||
switch (camera->port->type) {
|
||||
case GP_PORT_SERIAL:
|
||||
|
||||
@@ -71,7 +71,7 @@ int camera_abilities (CameraAbilitiesList *list) {
|
||||
a.speed[4] = 115200;
|
||||
a.speed[5] = 0;
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE;
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
GP_FILE_OPERATION_PREVIEW;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
|
||||
@@ -81,7 +81,7 @@ int camera_abilities (CameraAbilitiesList *list) {
|
||||
}
|
||||
|
||||
/** Parses a path for a folder and returns folder number and card */
|
||||
static int find_folder( Camera *camera, const char *folder,
|
||||
static int find_folder( Camera *camera, const char *folder,
|
||||
int *from_card, int *folder_nr, GPContext *context)
|
||||
{
|
||||
CameraList *albums = NULL;
|
||||
@@ -89,13 +89,13 @@ static int find_folder( Camera *camera, const char *folder,
|
||||
int folder_len;
|
||||
int i;
|
||||
char *dc120_folder_card = _("CompactFlash Card");
|
||||
|
||||
|
||||
if( folder[0] != '/' ) {
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
folder++;
|
||||
|
||||
|
||||
if( folder[0] == '\0') {
|
||||
/* From memory */
|
||||
*from_card = FALSE;
|
||||
@@ -112,7 +112,7 @@ static int find_folder( Camera *camera, const char *folder,
|
||||
*from_card = FALSE;
|
||||
folder--; /* step back to slash */
|
||||
}
|
||||
|
||||
|
||||
if ( (folder[0] == 0) ||
|
||||
(folder[0] == '/' && folder[1] == 0) ) { /* ok, finished */
|
||||
*folder_nr = 0;
|
||||
@@ -120,25 +120,25 @@ static int find_folder( Camera *camera, const char *folder,
|
||||
}
|
||||
else if( folder[0] != '/' )
|
||||
return (GP_ERROR);
|
||||
|
||||
|
||||
folder++; /* remove slash */
|
||||
|
||||
|
||||
/* Have trailing slash */
|
||||
folder_len = strlen(folder);
|
||||
if (folder[folder_len-1] == '/') {
|
||||
folder_len--;
|
||||
}
|
||||
|
||||
|
||||
/* ok, now we have a album. first get all albums */
|
||||
if( gp_list_new( &albums ) != (GP_OK) ) {
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
|
||||
if( dc120_get_albums(camera, *from_card, albums, context) != (GP_OK) ) {
|
||||
gp_list_free( albums );
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/* no check if such a album exist */
|
||||
for( i = 0; i<gp_list_count( albums ); i++ )
|
||||
{
|
||||
@@ -151,7 +151,7 @@ static int find_folder( Camera *camera, const char *folder,
|
||||
return (GP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* oh, we did not find the folder. bummer. */
|
||||
gp_list_free( albums );
|
||||
return (GP_ERROR);
|
||||
@@ -165,39 +165,39 @@ static int folder_list_func (CameraFilesystem *fs, const char *folder,
|
||||
int folder_nr;
|
||||
Camera *camera = data;
|
||||
char *dc120_folder_card = _("CompactFlash Card");
|
||||
|
||||
|
||||
res = find_folder( camera, folder, &from_card, &folder_nr, context);
|
||||
if( res != (GP_OK) ) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
if( !from_card && folder_nr==0 ) {
|
||||
gp_list_append(list, dc120_folder_card, NULL);
|
||||
return (dc120_get_albums(camera, from_card, list, context));
|
||||
}
|
||||
}
|
||||
else if( from_card && folder_nr==0 ) {
|
||||
return (dc120_get_albums(camera, from_card, list, context));
|
||||
}
|
||||
}
|
||||
else {
|
||||
return (GP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
{
|
||||
int res;
|
||||
int from_card;
|
||||
int folder_nr;
|
||||
Camera *camera = data;
|
||||
|
||||
|
||||
res = find_folder( camera, folder, &from_card, &folder_nr, context);
|
||||
if( res != (GP_OK) ) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return dc120_get_filenames(camera, from_card, folder_nr, list, context);
|
||||
|
||||
|
||||
/* Save the order of the pics (wtf: no filename access on dc120???) */
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
static int camera_file_action (Camera *camera, int action, CameraFile *file,
|
||||
const char *folder, const char *filename,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
CameraList *files = NULL;
|
||||
const char* file_name;
|
||||
@@ -214,27 +214,27 @@ static int camera_file_action (Camera *camera, int action, CameraFile *file,
|
||||
char *dot;
|
||||
int picnum=0;
|
||||
int result = GP_OK;
|
||||
|
||||
|
||||
/* first find the file */
|
||||
int from_card;
|
||||
int folder_nr;
|
||||
|
||||
|
||||
result = find_folder( camera, folder, &from_card, &folder_nr, context );
|
||||
if( result != (GP_OK) ) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
result = gp_list_new( &files );
|
||||
if( result != GP_OK ) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
result = dc120_get_filenames(camera, from_card, folder_nr, files, context);
|
||||
if( result != GP_OK ) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* now we have the list, search for the file. */
|
||||
file_nr = -1;
|
||||
for( i = 0; i<gp_list_count( files ); i++ ) {
|
||||
@@ -245,18 +245,18 @@ static int camera_file_action (Camera *camera, int action, CameraFile *file,
|
||||
}
|
||||
}
|
||||
gp_list_free( files );
|
||||
|
||||
|
||||
|
||||
|
||||
if( file_nr == -1 ) { /* not found */
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
picnum = gp_filesystem_number(camera->fs, folder, filename, context);
|
||||
if (picnum < 0)
|
||||
return picnum;
|
||||
|
||||
|
||||
|
||||
|
||||
if (action == DC120_ACTION_PREVIEW) { /* FIXME: marcus, fix type */
|
||||
dot = strrchr(filename, '.');
|
||||
if( dot && strlen( dot )>3 ) {
|
||||
@@ -275,7 +275,7 @@ static int camera_file_action (Camera *camera, int action, CameraFile *file,
|
||||
|
||||
static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, CameraFileType type,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -291,14 +291,14 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
}
|
||||
|
||||
static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, void *data,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
int retval;
|
||||
|
||||
retval = camera_file_action (camera, DC120_ACTION_DELETE, NULL,
|
||||
retval = camera_file_action (camera, DC120_ACTION_DELETE, NULL,
|
||||
folder, filename, context);
|
||||
|
||||
return (retval);
|
||||
@@ -327,15 +327,15 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
|
||||
/* Set the filename */
|
||||
strcpy(path->folder, "/");
|
||||
|
||||
CHECK_RESULT (gp_filesystem_append (camera->fs,
|
||||
path->folder,
|
||||
CHECK_RESULT (gp_filesystem_append (camera->fs,
|
||||
path->folder,
|
||||
path->name, context));
|
||||
return (GP_OK);
|
||||
|
||||
}
|
||||
|
||||
static int camera_summary (Camera *camera, CameraText *summary,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
static char summary_string[2048] = "";
|
||||
char buff[1024];
|
||||
@@ -344,41 +344,41 @@ static int camera_summary (Camera *camera, CameraText *summary,
|
||||
if (dc120_get_status (camera, &status, context))
|
||||
{
|
||||
strcpy(summary_string,"Kodak DC120\n");
|
||||
|
||||
|
||||
snprintf(buff,1024,"Camera Identification: %s\n",status.camera_id);
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
snprintf(buff,1024,"Camera Type: %d\n",status.camera_type_id);
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
snprintf(buff,1024,"Firmware: %d.%d\n",status.firmware_major,status.firmware_minor);
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
snprintf(buff,1024,"Battery Status: %d\n",status.batteryStatusId);
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
snprintf(buff,1024,"AC Status: %d\n",status.acStatusId);
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
strftime(buff,1024,"Time: %a, %d %b %Y %T\n",localtime((time_t *)&status.time));
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
snprintf(buff,1024,"Total Pictures Taken: %d\n",
|
||||
status.taken_pict_mem + status.taken_pict_card );
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
strcpy(summary->text, summary_string);
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
static int camera_manual (Camera *camera, CameraText *manual,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
strcpy (manual->text,
|
||||
strcpy (manual->text,
|
||||
_("The Kodak DC120 camera uses the KDC file format "
|
||||
"for storing images. If you want to view the images you "
|
||||
"download from your camera, you will need to download "
|
||||
@@ -388,9 +388,9 @@ static int camera_manual (Camera *camera, CameraText *manual,
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
strcpy(about->text,
|
||||
strcpy(about->text,
|
||||
_("Kodak DC120 Camera Library\n"
|
||||
"Scott Fritzinger <scottf@gphoto.net>\n"
|
||||
"Camera Library for the Kodak DC120 camera.\n"
|
||||
|
||||
@@ -46,27 +46,27 @@
|
||||
|
||||
List albums (folders)
|
||||
Packet: 44 00 00 00 00 00 00 1A
|
||||
|
||||
|
||||
Response:
|
||||
ALBUMNAME1\0\0\0\0\0ALBUMNAME2\0\0\0\0\0ALBUMNAME3\0\0\0\0\0 [...] CS
|
||||
|
||||
(258 bytes, 15 byte fixed-with fields in multiple packets)
|
||||
CS (checksum)
|
||||
CS (checksum)
|
||||
|
||||
Picture count in album
|
||||
Packet: 45 LOC 00 00 AN 00 00 1A
|
||||
|
||||
|
||||
LOC (location): 00 (memory), 01 (card)
|
||||
AN (album #)
|
||||
|
||||
Response: NP4 NP3 NP2 NP1 [11 reserved bytes] CS
|
||||
|
||||
|
||||
NP4 - NP1 (number of pictures): MSB to LSB number of pictures
|
||||
CS (checksum)
|
||||
|
||||
Set Active album for next taken picture
|
||||
Packet: 49 00 AN 00 00 00 00 1A
|
||||
|
||||
|
||||
AN (album #)
|
||||
|
||||
Set Image Quality
|
||||
|
||||
@@ -85,7 +85,7 @@ dc120_response_ok (unsigned char response) {
|
||||
*/
|
||||
static int
|
||||
dc120_packet_write (Camera *camera, char *packet, int size, int read_response) {
|
||||
|
||||
|
||||
/* Writes the packet and returns the result */
|
||||
|
||||
int x=0;
|
||||
@@ -97,7 +97,7 @@ write_again:
|
||||
usleep(SLEEP_TIMEOUT * 1000);
|
||||
|
||||
/* Return error if too many retries */
|
||||
if (x++ > RETRIES)
|
||||
if (x++ > RETRIES)
|
||||
return (GP_ERROR);
|
||||
|
||||
if (gp_port_write(camera->port, packet, size) < GP_OK)
|
||||
@@ -148,7 +148,7 @@ static int dc120_packet_read_data (Camera *camera, CameraFile *file, char *cmd_p
|
||||
|
||||
id = gp_context_progress_start (context, num_packets, _("Getting data..."));
|
||||
read_data_write_again:
|
||||
if (dc120_packet_write(camera, cmd_packet, 8, 1) < GP_OK)
|
||||
if (dc120_packet_write(camera, cmd_packet, 8, 1) < GP_OK)
|
||||
return (GP_ERROR);
|
||||
|
||||
packets_received = 0;
|
||||
@@ -171,7 +171,7 @@ read_data_write_again:
|
||||
return (GP_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
packets_received++;
|
||||
|
||||
/* Default is packet was OK */
|
||||
@@ -214,7 +214,7 @@ read_data_write_again:
|
||||
gp_context_progress_stop (context, id);
|
||||
|
||||
if ((unsigned char)p[0] != CANCL)
|
||||
/* Read in command completed.
|
||||
/* Read in command completed.
|
||||
(Shouldn't we check for command completed (Ralf)) */
|
||||
dc120_packet_read(camera, p, 1);
|
||||
|
||||
@@ -222,7 +222,7 @@ read_data_write_again:
|
||||
|
||||
}
|
||||
|
||||
int dc120_set_speed (Camera *camera, int speed)
|
||||
int dc120_set_speed (Camera *camera, int speed)
|
||||
{
|
||||
int error = GP_OK;
|
||||
GPPortSettings settings;
|
||||
@@ -274,7 +274,7 @@ int dc120_set_speed (Camera *camera, int speed)
|
||||
break;
|
||||
}
|
||||
|
||||
if (dc120_packet_write(camera, p, 8, 1) == GP_ERROR)
|
||||
if (dc120_packet_write(camera, p, 8, 1) == GP_ERROR)
|
||||
{
|
||||
error = GP_ERROR;
|
||||
goto fail;
|
||||
@@ -316,7 +316,7 @@ int dc120_get_status (Camera *camera, Kodak_dc120_status *status, GPContext *con
|
||||
free (p);
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
|
||||
memset((char*)status,0,sizeof(*status));
|
||||
|
||||
status->camera_type_id = data[1];
|
||||
@@ -324,14 +324,14 @@ int dc120_get_status (Camera *camera, Kodak_dc120_status *status, GPContext *con
|
||||
status->firmware_minor = data[3];
|
||||
status->batteryStatusId = data[8];
|
||||
status->acStatusId = data[9];
|
||||
|
||||
|
||||
/* seconds since unix epoc */
|
||||
status->time = CAMERA_EPOC + (
|
||||
data[12] * 0x1000000 +
|
||||
data[13] * 0x10000 +
|
||||
data[14] * 0x100 +
|
||||
data[12] * 0x1000000 +
|
||||
data[13] * 0x10000 +
|
||||
data[14] * 0x100 +
|
||||
data[15]) / 2;
|
||||
|
||||
|
||||
status->af_mode = data[16] & 0x0f;
|
||||
status->zoom_mode = (data[16] & 0x30)>>4;
|
||||
status->flash_charged = data[18];
|
||||
@@ -340,9 +340,9 @@ int dc120_get_status (Camera *camera, Kodak_dc120_status *status, GPContext *con
|
||||
status->exposure_compensation = (data[2]&0x40?-1:1) * (data[21] & 0x3f);
|
||||
status->light_value = data[22];
|
||||
status->manual_exposure = data[23];
|
||||
status->exposure_time = (data[24] * 0x1000000 +
|
||||
data[25] * 0x10000 +
|
||||
data[26] * 0x100 +
|
||||
status->exposure_time = (data[24] * 0x1000000 +
|
||||
data[25] * 0x10000 +
|
||||
data[26] * 0x100 +
|
||||
data[27]) / 2;
|
||||
status->shutter_delay = data[29];
|
||||
status->memory_card = data[30];
|
||||
@@ -352,18 +352,18 @@ int dc120_get_status (Camera *camera, Kodak_dc120_status *status, GPContext *con
|
||||
status->distance_format = data[34];
|
||||
status->taken_pict_mem = data[36] * 0x100 + data[37];
|
||||
for( i=0; i<4; i++ ) {
|
||||
status->remaining_pic_mem[i] =
|
||||
data[46+i*2] * 0x100 +
|
||||
status->remaining_pic_mem[i] =
|
||||
data[46+i*2] * 0x100 +
|
||||
data[47+i*2];
|
||||
}
|
||||
status->taken_pict_card = data[56] * 0x100 + data[57];
|
||||
for( i=0; i<4; i++ ) {
|
||||
status->remaining_pic_card[i] =
|
||||
data[66+i*2] * 0x100 +
|
||||
status->remaining_pic_card[i] =
|
||||
data[66+i*2] * 0x100 +
|
||||
data[67+i*2];
|
||||
}
|
||||
strncpy( status->card_id, data + 77, 32 );
|
||||
strncpy( status->camera_id, data + 90, 32 );
|
||||
strncpy( status->card_id, data + 77, 32 );
|
||||
strncpy( status->camera_id, data + 90, 32 );
|
||||
}
|
||||
|
||||
|
||||
@@ -408,7 +408,7 @@ int dc120_get_albums (Camera *camera, int from_card, CameraList *list, GPContext
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int dc120_get_filenames (Camera *camera, int from_card, int album_number, CameraList *list, GPContext *context)
|
||||
int dc120_get_filenames (Camera *camera, int from_card, int album_number, CameraList *list, GPContext *context)
|
||||
{
|
||||
CameraFile *file;
|
||||
int x;
|
||||
@@ -491,7 +491,7 @@ static int dc120_get_file_preview (Camera *camera, CameraFile *file, int file_nu
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int dc120_get_file (Camera *camera, CameraFile *file, int file_number, char *cmd_packet, int *size, GPContext *context)
|
||||
static int dc120_get_file (Camera *camera, CameraFile *file, int file_number, char *cmd_packet, int *size, GPContext *context)
|
||||
{
|
||||
CameraFile *size_file; /* file used to determine the filesize */
|
||||
char *p;
|
||||
@@ -524,8 +524,8 @@ static int dc120_get_file (Camera *camera, CameraFile *file, int file_number, ch
|
||||
free (p);
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
*size = (unsigned char)file_data[offset + 16] * 256*256*256 +
|
||||
|
||||
*size = (unsigned char)file_data[offset + 16] * 256*256*256 +
|
||||
(unsigned char)file_data[offset + 17] * 256*256 +
|
||||
(unsigned char)file_data[offset + 18] * 256 +
|
||||
(unsigned char)file_data[offset + 19];
|
||||
@@ -536,7 +536,7 @@ static int dc120_get_file (Camera *camera, CameraFile *file, int file_number, ch
|
||||
|
||||
if (dc120_packet_read_data(camera, file, cmd_packet, size, 1024, context)==GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -554,10 +554,10 @@ static int dc120_wait_for_completion (Camera *camera, GPContext *context) {
|
||||
|
||||
retval = dc120_packet_read(camera, p, 1);
|
||||
switch (retval) {
|
||||
case GP_ERROR:
|
||||
return (GP_ERROR);
|
||||
case GP_ERROR:
|
||||
return (GP_ERROR);
|
||||
break;
|
||||
case GP_ERROR_TIMEOUT:
|
||||
case GP_ERROR_TIMEOUT:
|
||||
break;
|
||||
default:
|
||||
done = 1;
|
||||
@@ -578,9 +578,9 @@ static int dc120_delete_file (Camera *camera, char *cmd_packet, GPContext *conte
|
||||
|
||||
if (dc120_packet_write(camera, cmd_packet, 8, 1) == GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
|
||||
|
||||
if (dc120_packet_read(camera, p, 1)==GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
return (GP_ERROR);
|
||||
|
||||
if (dc120_wait_for_completion(camera, context)==GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
@@ -588,7 +588,7 @@ static int dc120_delete_file (Camera *camera, char *cmd_packet, GPContext *conte
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int dc120_file_action (Camera *camera, int action, int from_card, int album_number,
|
||||
int dc120_file_action (Camera *camera, int action, int from_card, int album_number,
|
||||
int file_number, CameraFile *file, GPContext *context) {
|
||||
|
||||
int retval;
|
||||
@@ -625,11 +625,11 @@ int dc120_file_action (Camera *camera, int action, int from_card, int album_numb
|
||||
return (retval);
|
||||
}
|
||||
|
||||
int dc120_capture (Camera *camera, CameraFilePath *path, GPContext *context)
|
||||
int dc120_capture (Camera *camera, CameraFilePath *path, GPContext *context)
|
||||
{
|
||||
int retval;
|
||||
char *p = dc120_packet_new(0x77);
|
||||
|
||||
|
||||
/* Take the picture to Flash memory */
|
||||
if (dc120_packet_write(camera, p, 8, 1) == GP_ERROR) {
|
||||
retval = (GP_ERROR);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#define DC120_ACTION_IMAGE 0
|
||||
#define DC120_ACTION_PREVIEW 1
|
||||
#define DC120_ACTION_DELETE 2
|
||||
#define DC120_ACTION_DELETE 2
|
||||
|
||||
/* Status structure. Copied from dc210, thus may not fit. */
|
||||
typedef struct {
|
||||
@@ -65,7 +65,7 @@ int dc120_set_speed (Camera *camera, int speed);
|
||||
int dc120_get_status (Camera *camera, Kodak_dc120_status *status, GPContext *context);
|
||||
int dc120_get_albums (Camera *camera, int from_card, CameraList *list, GPContext *context);
|
||||
int dc120_get_filenames(Camera *camera, int from_card, int album_number, CameraList *list, GPContext *context);
|
||||
int dc120_file_action (Camera *camera, int action, int from_card, int album_number,
|
||||
int dc120_file_action (Camera *camera, int action, int from_card, int album_number,
|
||||
int file_number, CameraFile *file, GPContext *context);
|
||||
int dc120_capture (Camera *camera, CameraFilePath *path, GPContext *context);
|
||||
|
||||
|
||||
@@ -84,16 +84,16 @@ int camera_abilities (CameraAbilitiesList *list) {
|
||||
}
|
||||
|
||||
static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
|
||||
return dc210_get_filenames(camera, list, context);
|
||||
}
|
||||
|
||||
static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, CameraFileType type,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -109,9 +109,9 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, void *data,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -124,7 +124,7 @@ static int get_info_func (CameraFilesystem *fs, const char *folder, const char *
|
||||
{
|
||||
Camera *camera = data;
|
||||
dc210_picture_info picinfo;
|
||||
|
||||
|
||||
if (dc210_get_picture_info_by_name(camera, &picinfo, file) == GP_ERROR)
|
||||
return GP_ERROR;
|
||||
|
||||
@@ -176,7 +176,7 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
int i;
|
||||
char * wvalue;
|
||||
char stringbuffer[12];
|
||||
|
||||
|
||||
dc210_status status;
|
||||
|
||||
if (dc210_get_status(camera, &status) == GP_ERROR) return GP_ERROR;
|
||||
@@ -192,9 +192,9 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
gp_widget_add_choice (widget, _("FlashPix"));
|
||||
|
||||
switch (status.file_type){
|
||||
case DC210_FILE_TYPE_JPEG:
|
||||
case DC210_FILE_TYPE_JPEG:
|
||||
gp_widget_set_value (widget, _("JPEG")); break;
|
||||
case DC210_FILE_TYPE_FPX:
|
||||
case DC210_FILE_TYPE_FPX:
|
||||
gp_widget_set_value (widget, _("FlashPix")); break;
|
||||
};
|
||||
gp_widget_get_value (widget, &wvalue);
|
||||
@@ -205,9 +205,9 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
gp_widget_add_choice (widget, _("1152 x 864"));
|
||||
|
||||
switch (status.resolution){
|
||||
case DC210_FILE_640:
|
||||
case DC210_FILE_640:
|
||||
gp_widget_set_value (widget, _("640 x 480")); break;
|
||||
case DC210_FILE_1152:
|
||||
case DC210_FILE_1152:
|
||||
gp_widget_set_value (widget, _("1152 x 864")); break;
|
||||
default:
|
||||
DC210_DEBUG("Undefined value for file resolution.\n"); break;
|
||||
@@ -221,11 +221,11 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
gp_widget_add_choice (widget, _("High (good quality)"));
|
||||
|
||||
switch (status.compression_type){
|
||||
case DC210_LOW_COMPRESSION:
|
||||
case DC210_LOW_COMPRESSION:
|
||||
gp_widget_set_value (widget, _("Low (best quality)")); break;
|
||||
case DC210_MEDIUM_COMPRESSION:
|
||||
case DC210_MEDIUM_COMPRESSION:
|
||||
gp_widget_set_value (widget, _("Medium (better quality)")); break;
|
||||
case DC210_HIGH_COMPRESSION:
|
||||
case DC210_HIGH_COMPRESSION:
|
||||
gp_widget_set_value (widget, _("High (good quality)")); break;
|
||||
};
|
||||
gp_widget_get_value (widget, &wvalue);
|
||||
@@ -243,17 +243,17 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
gp_widget_add_choice (widget, _("Macro"));
|
||||
|
||||
switch (status.zoom){
|
||||
case DC210_ZOOM_58:
|
||||
case DC210_ZOOM_58:
|
||||
gp_widget_set_value (widget, _("58 mm")); break;
|
||||
case DC210_ZOOM_51:
|
||||
case DC210_ZOOM_51:
|
||||
gp_widget_set_value (widget, _("51 mm")); break;
|
||||
case DC210_ZOOM_41:
|
||||
case DC210_ZOOM_41:
|
||||
gp_widget_set_value (widget, _("41 mm")); break;
|
||||
case DC210_ZOOM_34:
|
||||
case DC210_ZOOM_34:
|
||||
gp_widget_set_value (widget, _("34 mm")); break;
|
||||
case DC210_ZOOM_29:
|
||||
case DC210_ZOOM_29:
|
||||
gp_widget_set_value (widget, _("29 mm")); break;
|
||||
case DC210_ZOOM_MACRO:
|
||||
case DC210_ZOOM_MACRO:
|
||||
gp_widget_set_value (widget, _("Macro")); break;
|
||||
};
|
||||
gp_widget_get_value (widget, &wvalue);
|
||||
@@ -273,11 +273,11 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
gp_widget_add_choice (widget, _("None"));
|
||||
|
||||
switch (status.flash){
|
||||
case DC210_FLASH_AUTO:
|
||||
case DC210_FLASH_AUTO:
|
||||
gp_widget_set_value (widget, _("Auto")); break;
|
||||
case DC210_FLASH_FORCE:
|
||||
case DC210_FLASH_FORCE:
|
||||
gp_widget_set_value (widget, _("Force")); break;
|
||||
case DC210_FLASH_NONE:
|
||||
case DC210_FLASH_NONE:
|
||||
gp_widget_set_value (widget, _("None")); break;
|
||||
};
|
||||
gp_widget_get_value (widget, &wvalue);
|
||||
@@ -300,7 +300,7 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
gp_widget_append (section, widget);
|
||||
gp_widget_set_value (widget, dc210_system_time_callback);
|
||||
gp_widget_set_info (widget, _("Set clock in camera"));
|
||||
|
||||
|
||||
gp_camera_get_abilities(camera, &abilities);
|
||||
gp_port_get_settings (camera->port, &settings);
|
||||
gp_widget_new (GP_WIDGET_MENU, _("Port speed"), &widget);
|
||||
@@ -449,11 +449,11 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
gp_widget_get_value (w2, &w2value);
|
||||
switch(wvalue[0]){
|
||||
case 'A':
|
||||
dc210_set_flash(camera, DC210_FLASH_AUTO,
|
||||
dc210_set_flash(camera, DC210_FLASH_AUTO,
|
||||
w2value[1] == 'n' ? 1 : 0);
|
||||
break;
|
||||
case 'F':
|
||||
dc210_set_flash(camera, DC210_FLASH_FORCE,
|
||||
dc210_set_flash(camera, DC210_FLASH_FORCE,
|
||||
w2value[1] == 'n' ? 1 : 0);
|
||||
break;
|
||||
case 'N':
|
||||
@@ -472,7 +472,7 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
};
|
||||
|
||||
if (dc210_capture(camera, path, context) == GP_ERROR)
|
||||
if (dc210_capture(camera, path, context) == GP_ERROR)
|
||||
return GP_ERROR;
|
||||
|
||||
return gp_filesystem_append (camera->fs, path->folder, path->name, context);
|
||||
@@ -493,7 +493,7 @@ static int camera_capture_preview (Camera* camera, CameraFile* file, GPContext *
|
||||
};
|
||||
|
||||
static int camera_summary (Camera *camera, CameraText *summary,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
static char summary_string[2048] = "";
|
||||
char buff[1024];
|
||||
@@ -502,7 +502,7 @@ static int camera_summary (Camera *camera, CameraText *summary,
|
||||
if (GP_OK == dc210_get_status (camera, &status))
|
||||
{
|
||||
strcpy(summary_string,"Kodak DC210\n");
|
||||
|
||||
|
||||
snprintf(buff,1024,_("Pictures in camera: %d\n"),
|
||||
status.numPicturesInCamera);
|
||||
strcat(summary_string,buff);
|
||||
@@ -523,35 +523,35 @@ static int camera_summary (Camera *camera, CameraText *summary,
|
||||
strcat(summary_string,buff);
|
||||
|
||||
switch (status.file_type){
|
||||
case DC210_FILE_TYPE_JPEG:
|
||||
case DC210_FILE_TYPE_JPEG:
|
||||
snprintf(buff, 1024, _("Filetype: JPEG (")); break;
|
||||
case DC210_FILE_TYPE_FPX:
|
||||
case DC210_FILE_TYPE_FPX:
|
||||
snprintf(buff, 1024, _("Filetype: FlashPix (")); break;
|
||||
};
|
||||
strcat(summary_string, buff);
|
||||
|
||||
|
||||
switch (status.compression_type){
|
||||
case DC210_LOW_COMPRESSION:
|
||||
case DC210_LOW_COMPRESSION:
|
||||
snprintf(buff, 1024, _("low compression, ")); break;
|
||||
case DC210_MEDIUM_COMPRESSION:
|
||||
case DC210_MEDIUM_COMPRESSION:
|
||||
snprintf(buff, 1024, _("medium compression, ")); break;
|
||||
case DC210_HIGH_COMPRESSION:
|
||||
case DC210_HIGH_COMPRESSION:
|
||||
snprintf(buff, 1024, _("high compression, ")); break;
|
||||
default:
|
||||
default:
|
||||
snprintf(buff, 1024, _("unknown compression %d, "), status.compression_type); break;
|
||||
};
|
||||
strcat(summary_string, buff);
|
||||
|
||||
|
||||
switch (status.resolution){
|
||||
case DC210_FILE_640:
|
||||
case DC210_FILE_640:
|
||||
snprintf(buff, 1024, "640x480 pixel)\n"); break;
|
||||
case DC210_FILE_1152:
|
||||
case DC210_FILE_1152:
|
||||
snprintf(buff, 1024, "1152x864 pixel)\n"); break;
|
||||
default:
|
||||
default:
|
||||
snprintf(buff, 1024, _("unknown resolution %d)\n"), status.resolution); break;
|
||||
};
|
||||
strcat(summary_string, buff);
|
||||
|
||||
|
||||
/* battery check still doesn't work */
|
||||
/* switch (status.battery){
|
||||
case 0: snprintf(buff,1024,"Battery charge is good\n"); break;
|
||||
@@ -559,37 +559,37 @@ static int camera_summary (Camera *camera, CameraText *summary,
|
||||
case 2: snprintf(buff,1024,"Battery is not charged\n"); break;
|
||||
};
|
||||
strcat(summary_string,buff);*/
|
||||
|
||||
|
||||
if (status.acstatus)
|
||||
snprintf(buff,1024,_("AC adapter is connected.\n"));
|
||||
else
|
||||
snprintf(buff,1024,_("AC adapter is not connected.\n"));
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
/* time string, do not change the % escapes */
|
||||
strftime(buff,1024,_("Time: %a, %d %b %Y %T\n"),
|
||||
localtime((time_t *)&status.time));
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
switch (status.zoom){
|
||||
case DC210_ZOOM_58:
|
||||
case DC210_ZOOM_58:
|
||||
snprintf(buff, 1024, _("Zoom: 58 mm\n")); break;
|
||||
case DC210_ZOOM_51:
|
||||
case DC210_ZOOM_51:
|
||||
snprintf(buff, 1024, _("Zoom: 51 mm\n")); break;
|
||||
case DC210_ZOOM_41:
|
||||
case DC210_ZOOM_41:
|
||||
snprintf(buff, 1024, _("Zoom: 41 mm\n")); break;
|
||||
case DC210_ZOOM_34:
|
||||
case DC210_ZOOM_34:
|
||||
snprintf(buff, 1024, _("Zoom: 34 mm\n")); break;
|
||||
case DC210_ZOOM_29:
|
||||
case DC210_ZOOM_29:
|
||||
snprintf(buff, 1024, _("Zoom: 29 mm\n")); break;
|
||||
case DC210_ZOOM_MACRO:
|
||||
case DC210_ZOOM_MACRO:
|
||||
snprintf(buff, 1024, _("Zoom: macro\n")); break;
|
||||
default:
|
||||
snprintf(buff, 1024, _("Unknown zoom mode %d\n"),
|
||||
default:
|
||||
snprintf(buff, 1024, _("Unknown zoom mode %d\n"),
|
||||
status.zoom); break;
|
||||
};
|
||||
strcat(summary_string,buff);
|
||||
|
||||
|
||||
if (status.exp_compensation > -5 && status.exp_compensation < 4)
|
||||
snprintf(buff, 1024, _("Exposure compensation: %s\n"), exp_comp[status.exp_compensation + 4]);
|
||||
else
|
||||
@@ -597,14 +597,14 @@ static int camera_summary (Camera *camera, CameraText *summary,
|
||||
strcat(summary_string,buff);
|
||||
|
||||
switch (status.flash){
|
||||
case DC210_FLASH_AUTO:
|
||||
case DC210_FLASH_AUTO:
|
||||
snprintf(buff, 1024, _("Flash mode: auto, ")); break;
|
||||
case DC210_FLASH_FORCE:
|
||||
case DC210_FLASH_FORCE:
|
||||
snprintf(buff, 1024, _("Flash mode: force, ")); break;
|
||||
case DC210_FLASH_NONE:
|
||||
case DC210_FLASH_NONE:
|
||||
snprintf(buff, 1024, _("Flash mode: off\n")); break;
|
||||
default:
|
||||
snprintf(buff, 1024, _("Unknown flash mode %d, "),
|
||||
default:
|
||||
snprintf(buff, 1024, _("Unknown flash mode %d, "),
|
||||
status.flash); break;
|
||||
};
|
||||
strcat(summary_string,buff);
|
||||
@@ -625,22 +625,22 @@ static int camera_summary (Camera *camera, CameraText *summary,
|
||||
snprintf(buff,1024, _("Card name: %s\nFree space on card: %d kB\n"),
|
||||
status.album_name,
|
||||
status.card_status.space);
|
||||
|
||||
|
||||
strcat(summary_string,buff);
|
||||
|
||||
}
|
||||
else{
|
||||
DC210_DEBUG("Couldn't get summary for camera\n");
|
||||
};
|
||||
|
||||
|
||||
strcpy(summary->text, summary_string);
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
static int camera_manual (Camera *camera, CameraText *manual,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
strcpy (manual->text, _("This library has been tested with a Kodak DC 215 Zoom camera. "
|
||||
"It might work also with DC 200 and DC 210 cameras. "
|
||||
@@ -651,9 +651,9 @@ static int camera_manual (Camera *camera, CameraText *manual,
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
strcpy(about->text,
|
||||
strcpy(about->text,
|
||||
_("Camera Library for the Kodak DC215 Zoom camera.\n"
|
||||
"Michael Koltan <koltan@gmx.de>\n"));
|
||||
|
||||
|
||||
@@ -73,29 +73,29 @@ typedef struct {
|
||||
} dc210_card_status;
|
||||
|
||||
typedef struct {
|
||||
char camera_type_id;
|
||||
char firmwareMajor;
|
||||
char firmwareMinor;
|
||||
char battery;
|
||||
char acstatus;
|
||||
long int time;
|
||||
dc210_zoom_type zoom;
|
||||
char flash_charged;
|
||||
dc210_compression_type compression_type;
|
||||
char camera_type_id;
|
||||
char firmwareMajor;
|
||||
char firmwareMinor;
|
||||
char battery;
|
||||
char acstatus;
|
||||
long int time;
|
||||
dc210_zoom_type zoom;
|
||||
char flash_charged;
|
||||
dc210_compression_type compression_type;
|
||||
signed char exp_compensation;
|
||||
dc210_flash_type flash;
|
||||
char preflash;
|
||||
dc210_resolution_type resolution;
|
||||
dc210_file_type_type file_type;
|
||||
int totalPicturesTaken;
|
||||
int totalFlashesFired;
|
||||
int numPicturesInCamera;
|
||||
dc210_resolution_type resolution;
|
||||
dc210_file_type_type file_type;
|
||||
int totalPicturesTaken;
|
||||
int totalFlashesFired;
|
||||
int numPicturesInCamera;
|
||||
dc210_card_status card_status;
|
||||
int remainingLow;
|
||||
int remainingMedium;
|
||||
int remainingHigh;
|
||||
int remainingLow;
|
||||
int remainingMedium;
|
||||
int remainingHigh;
|
||||
int card_space;
|
||||
char album_name[12];
|
||||
char album_name[12];
|
||||
} dc210_status;
|
||||
|
||||
typedef struct {
|
||||
@@ -193,7 +193,7 @@ typedef struct {
|
||||
#define DC210_ILLEGAL_PACKET 0xE3
|
||||
#define DC210_CANCEL 0xE4
|
||||
#define DC210_BUSY 0xF0
|
||||
|
||||
|
||||
/* initialization */
|
||||
int dc210_init_port (Camera *camera);
|
||||
|
||||
|
||||
@@ -61,11 +61,11 @@ static char oldstatus[DC210_STATUS_SIZE];
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
static void cfa2ppm
|
||||
static void cfa2ppm
|
||||
(CameraFile * file)
|
||||
{
|
||||
/* this is a very quick and dirty hack to convert cfa into ppm */
|
||||
unsigned char buf[THUMBHEIGHT][THUMBWIDTH];
|
||||
unsigned char buf[THUMBHEIGHT][THUMBWIDTH];
|
||||
unsigned char rgb[THUMBHEIGHT][THUMBWIDTH][3];
|
||||
unsigned char val;
|
||||
unsigned int addval;
|
||||
@@ -102,7 +102,7 @@ static void cfa2ppm
|
||||
rgb[y][x+1][RED] = buf[y][x+1];
|
||||
rgb[y+1][x][RED] = buf[y][x+1];
|
||||
rgb[y+1][x+1][RED] = buf[y][x+1];
|
||||
rgb[y][x][BLUE] = buf[y+1][x];
|
||||
rgb[y][x][BLUE] = buf[y+1][x];
|
||||
rgb[y][x+1][BLUE] = buf[y+1][x];
|
||||
rgb[y+1][x][BLUE] = buf[y+1][x];
|
||||
rgb[y+1][x+1][BLUE] = buf[y+1][x];
|
||||
@@ -112,7 +112,7 @@ static void cfa2ppm
|
||||
for ( y = 1; y < THUMBHEIGHT - 2; y+= 2)
|
||||
for ( x = 0; x < THUMBWIDTH - 2; x +=2){
|
||||
/* 2 missing green values */
|
||||
addval = rgb[y][x][GREEN] + rgb[y][x+2][GREEN]
|
||||
addval = rgb[y][x][GREEN] + rgb[y][x+2][GREEN]
|
||||
+ rgb[y-1][x+1][GREEN] + rgb[y+1][x+1][GREEN];
|
||||
rgb[y][x+1][GREEN] = addval / 4;
|
||||
|
||||
@@ -124,7 +124,7 @@ static void cfa2ppm
|
||||
addval = rgb[y-1][x][RED] + rgb[y+1][x][RED];
|
||||
rgb[y][x][RED] = addval / 2;
|
||||
|
||||
addval = rgb[y-1][x][RED] + rgb[y-1][x+2][RED]
|
||||
addval = rgb[y-1][x][RED] + rgb[y-1][x+2][RED]
|
||||
+ rgb[y+1][x][RED] + rgb[y+1][x+2][RED];
|
||||
rgb[y][x+1][RED] = addval / 4;
|
||||
|
||||
@@ -135,7 +135,7 @@ static void cfa2ppm
|
||||
addval = rgb[y][x-1][BLUE] + rgb[y][x+1][BLUE];
|
||||
rgb[y][x][BLUE] = addval / 2;
|
||||
|
||||
addval = rgb[y][x-1][BLUE] + rgb[y][x+1][BLUE]
|
||||
addval = rgb[y][x-1][BLUE] + rgb[y][x+1][BLUE]
|
||||
+ rgb[y+2][x-1][BLUE] + rgb[y+2][x+1][BLUE];
|
||||
rgb[y+1][x][BLUE] = addval / 4;
|
||||
|
||||
@@ -177,8 +177,8 @@ static void dc210_cmd_packet_init
|
||||
|
||||
};
|
||||
|
||||
static int dc210_write_single_char
|
||||
(Camera *camera, unsigned char response)
|
||||
static int dc210_write_single_char
|
||||
(Camera *camera, unsigned char response)
|
||||
{
|
||||
/* utility procedure to write a single character */
|
||||
|
||||
@@ -193,7 +193,7 @@ static int dc210_write_single_char
|
||||
|
||||
};
|
||||
|
||||
static int dc210_read_single_char
|
||||
static int dc210_read_single_char
|
||||
(Camera *camera, unsigned char * response)
|
||||
{
|
||||
|
||||
@@ -214,18 +214,18 @@ static int dc210_read_single_char
|
||||
return GP_ERROR;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
return GP_OK;
|
||||
|
||||
};
|
||||
|
||||
|
||||
return GP_ERROR_TIMEOUT;
|
||||
|
||||
};
|
||||
|
||||
/* Command execution */
|
||||
|
||||
static int dc210_execute_command
|
||||
static int dc210_execute_command
|
||||
(Camera *camera, char *cmd)
|
||||
{
|
||||
|
||||
@@ -244,7 +244,7 @@ static int dc210_execute_command
|
||||
int i,k ;
|
||||
unsigned char response;
|
||||
signed char error;
|
||||
|
||||
|
||||
dc210_cmd_error = DC210_CMD_OKAY;
|
||||
|
||||
for (i = 0; i < RETRIES; i++){
|
||||
@@ -269,7 +269,7 @@ static int dc210_execute_command
|
||||
return error;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
switch (response){
|
||||
case DC210_COMMAND_ACK:
|
||||
DC210_DEBUG("Command 0x%02X acknowledged.\n", (unsigned char) cmd[0]);
|
||||
@@ -286,13 +286,13 @@ static int dc210_execute_command
|
||||
};
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
/* command does definitely not work */
|
||||
|
||||
DC210_DEBUG("Command definitely didn't work.\n");
|
||||
|
||||
|
||||
return GP_ERROR;
|
||||
|
||||
};
|
||||
@@ -331,7 +331,7 @@ static int dc210_write_command_packet
|
||||
if (error < 0) return GP_ERROR;
|
||||
|
||||
if (answer == DC210_CORRECT_PACKET) return GP_OK;
|
||||
|
||||
|
||||
if (answer != DC210_ILLEGAL_PACKET) {
|
||||
DC210_DEBUG("Strange answer to command packet: 0x%02X.\n", answer);
|
||||
return GP_ERROR;
|
||||
@@ -345,11 +345,11 @@ static int dc210_write_command_packet
|
||||
|
||||
};
|
||||
|
||||
static int dc210_wait_for_response
|
||||
static int dc210_wait_for_response
|
||||
(Camera *camera, int expect_busy, GPContext *context)
|
||||
{
|
||||
/* Waits for a command to finish.
|
||||
Expects either a timeout, a DC210_BUSY,
|
||||
Expects either a timeout, a DC210_BUSY,
|
||||
a DC210_COMMAND_COMPLETE or a
|
||||
DC210_PACKET_FOLLOWING; all other answers
|
||||
are considered errors */
|
||||
@@ -393,8 +393,8 @@ static int dc210_wait_for_response
|
||||
|
||||
};
|
||||
|
||||
static int dc210_read_single_block
|
||||
(Camera *camera, unsigned char * b, int blocksize)
|
||||
static int dc210_read_single_block
|
||||
(Camera *camera, unsigned char * b, int blocksize)
|
||||
{
|
||||
|
||||
int i, k, error;
|
||||
@@ -413,7 +413,7 @@ static int dc210_read_single_block
|
||||
error = 0;
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
if (error) return GP_ERROR;
|
||||
|
||||
if (dc210_read_single_char(camera, (unsigned char *)&cs_read) < 0)
|
||||
@@ -436,7 +436,7 @@ static int dc210_read_single_block
|
||||
};
|
||||
|
||||
static int dc210_read_to_file
|
||||
(Camera *camera, CameraFile * f, int blocksize, long int expectsize, GPContext *context)
|
||||
(Camera *camera, CameraFile * f, int blocksize, long int expectsize, GPContext *context)
|
||||
{
|
||||
|
||||
int packets, k, l, fatal_error, packet_following;
|
||||
@@ -469,7 +469,7 @@ static int dc210_read_to_file
|
||||
};
|
||||
/* read checksum */
|
||||
if (dc210_read_single_char(camera, &cs_read) == GP_ERROR){
|
||||
free(b);
|
||||
free(b);
|
||||
return GP_ERROR;
|
||||
};
|
||||
/* test checksum */
|
||||
@@ -544,7 +544,7 @@ static int dc210_set_option (Camera * camera, char command, unsigned int value,
|
||||
default:
|
||||
return GP_ERROR;
|
||||
};
|
||||
|
||||
|
||||
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
|
||||
|
||||
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
|
||||
@@ -572,7 +572,7 @@ int dc210_set_flash (Camera * camera, dc210_flash_type flash, char preflash){
|
||||
int dc210_set_zoom (Camera * camera, dc210_zoom_type zoom){
|
||||
|
||||
return dc210_set_option(camera, DC210_SET_ZOOM, zoom, 1);
|
||||
|
||||
|
||||
};
|
||||
|
||||
int dc210_set_file_type (Camera * camera, dc210_file_type_type file_type){
|
||||
@@ -635,7 +635,7 @@ static int dc210_format_card (Camera * camera, char * album_name, GPContext * co
|
||||
while (NULL != (subst = strchr(data, ' '))) *subst = '_';
|
||||
if (strlen(data) < 8) strncat(data, "________", 8 - strlen(data));
|
||||
};
|
||||
|
||||
|
||||
DC210_DEBUG("Album name is '%s'\n", data);
|
||||
|
||||
dc210_cmd_init(cmd, DC210_CARD_FORMAT);
|
||||
@@ -719,7 +719,7 @@ static int dc210_check_battery (Camera *camera){
|
||||
|
||||
char cmd[8];
|
||||
dc210_cmd_init(cmd, DC210_CHECK_BATTERY);
|
||||
|
||||
|
||||
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
|
||||
|
||||
@@ -751,9 +751,9 @@ int dc210_init_port (Camera *camera){
|
||||
gp_port_set_settings (camera->port, settings);
|
||||
|
||||
/* ok, run a dummy command; if the camera was off,
|
||||
this will activate it and set the speed to 9600;
|
||||
this will activate it and set the speed to 9600;
|
||||
but the command will return an error;
|
||||
It makes no sense to shorten the timout time,
|
||||
It makes no sense to shorten the timout time,
|
||||
because the camera may need up to 10 seconds (information
|
||||
of the manual) to startup */
|
||||
if (dc210_check_battery(camera) == GP_OK) return GP_OK;
|
||||
@@ -763,7 +763,7 @@ int dc210_init_port (Camera *camera){
|
||||
and has enough power.
|
||||
This is the time to send a break to reset the speed
|
||||
to 9600 */
|
||||
|
||||
|
||||
gp_camera_set_port_speed(camera, 9600);
|
||||
gp_port_send_break(camera->port, 300);
|
||||
usleep(300 * 1000);
|
||||
@@ -804,7 +804,7 @@ int dc210_set_speed (Camera *camera, int speed) {
|
||||
GPPortSettings settings;
|
||||
|
||||
dc210_cmd_init((char*)cmd, DC210_SET_SPEED);
|
||||
|
||||
|
||||
switch (speed) {
|
||||
case 9600:
|
||||
cmd[2] = 0x96; cmd[3] = 0x00; break;
|
||||
@@ -829,12 +829,12 @@ int dc210_set_speed (Camera *camera, int speed) {
|
||||
DC210_DEBUG("Port speed set to %d.\n", speed);
|
||||
|
||||
return GP_OK;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/****** Picture actions *****/
|
||||
|
||||
int dc210_take_picture
|
||||
int dc210_take_picture
|
||||
(Camera * camera, GPContext * context)
|
||||
{
|
||||
char cmd[8];
|
||||
@@ -852,7 +852,7 @@ int dc210_take_picture
|
||||
|
||||
};
|
||||
|
||||
int dc210_delete_picture
|
||||
int dc210_delete_picture
|
||||
(Camera * camera, unsigned int picno)
|
||||
{
|
||||
|
||||
@@ -870,7 +870,7 @@ int dc210_delete_picture
|
||||
|
||||
};
|
||||
|
||||
int dc210_delete_last_picture
|
||||
int dc210_delete_last_picture
|
||||
(Camera * camera )
|
||||
{
|
||||
|
||||
@@ -886,7 +886,7 @@ int dc210_delete_last_picture
|
||||
|
||||
};
|
||||
|
||||
int dc210_delete_picture_by_name
|
||||
int dc210_delete_picture_by_name
|
||||
(Camera * camera, const char * filename )
|
||||
{
|
||||
|
||||
@@ -904,7 +904,7 @@ int dc210_delete_picture_by_name
|
||||
|
||||
};
|
||||
|
||||
int dc210_download_last_picture
|
||||
int dc210_download_last_picture
|
||||
(Camera * camera, CameraFile *file, dc210_picture_type type, GPContext *context)
|
||||
{
|
||||
|
||||
@@ -961,7 +961,7 @@ static int dc210_close_card
|
||||
int dc210_download_picture_by_name
|
||||
(Camera * camera, CameraFile *file, const char *filename, dc210_picture_type type, GPContext *context)
|
||||
{
|
||||
|
||||
|
||||
char cmd[8];
|
||||
char cmd_packet[DC210_CMD_DATA_SIZE];
|
||||
dc210_picture_info picinfo;
|
||||
@@ -988,15 +988,15 @@ int dc210_download_picture_by_name
|
||||
case DC210_FULL_PICTURE:
|
||||
if (picinfo.file_type == DC210_FILE_TYPE_JPEG)
|
||||
gp_file_set_mime_type(file, GP_MIME_JPEG);
|
||||
if (dc210_read_to_file(camera, file,
|
||||
DC210_CARD_BLOCK_SIZE,
|
||||
if (dc210_read_to_file(camera, file,
|
||||
DC210_CARD_BLOCK_SIZE,
|
||||
picinfo.picture_size, context) == GP_ERROR)
|
||||
return GP_ERROR;
|
||||
break;
|
||||
case DC210_CFA_THUMB:
|
||||
/* this thumb type is much faster to download, because it has just
|
||||
a 6th of the size of rgb data */
|
||||
if (dc210_read_to_file(camera, file,
|
||||
if (dc210_read_to_file(camera, file,
|
||||
DC210_DOWNLOAD_BLOCKSIZE, 48 * 72, NULL) == GP_ERROR)
|
||||
return GP_ERROR;
|
||||
/* convert cfa data to rgb: */
|
||||
@@ -1008,16 +1008,16 @@ int dc210_download_picture_by_name
|
||||
worth the 6 times longer download time */
|
||||
gp_file_set_mime_type(file, GP_MIME_PPM);
|
||||
gp_file_append(file, ppmheader, sizeof(ppmheader) - 1);
|
||||
if (dc210_read_to_file(camera, file,
|
||||
if (dc210_read_to_file(camera, file,
|
||||
DC210_DOWNLOAD_BLOCKSIZE, 96 * 72 * 3, NULL) == GP_ERROR)
|
||||
return GP_ERROR;
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
return GP_OK;
|
||||
};
|
||||
|
||||
int dc210_capture (Camera *camera, CameraFilePath *path, GPContext *context)
|
||||
int dc210_capture (Camera *camera, CameraFilePath *path, GPContext *context)
|
||||
{
|
||||
|
||||
dc210_status status;
|
||||
@@ -1031,9 +1031,9 @@ int dc210_capture (Camera *camera, CameraFilePath *path, GPContext *context)
|
||||
pictures_in_camera = status.numPicturesInCamera;
|
||||
|
||||
if (dc210_take_picture(camera, context) == GP_ERROR) return GP_ERROR;
|
||||
|
||||
|
||||
if (dc210_get_status(camera, &status) == GP_ERROR) return GP_ERROR;
|
||||
if (pictures_in_camera == status.numPicturesInCamera) return GP_ERROR;
|
||||
if (pictures_in_camera == status.numPicturesInCamera) return GP_ERROR;
|
||||
|
||||
if (dc210_get_picture_info(camera, &picinfo, status.numPicturesInCamera) == GP_ERROR) return GP_ERROR;
|
||||
|
||||
@@ -1058,20 +1058,20 @@ int dc210_get_picture_number (Camera *camera, const char * filename){
|
||||
if (dc210_get_status(camera, &status) == GP_ERROR) return -1;
|
||||
|
||||
for (i = 1; i <= status.numPicturesInCamera; i++){
|
||||
|
||||
|
||||
if (dc210_get_picture_info(camera, &picinfo, i) == GP_ERROR) return -1;
|
||||
|
||||
|
||||
if (strcmp(picinfo.image_name, filename) == 0){
|
||||
return i;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
return -1;
|
||||
|
||||
};
|
||||
|
||||
int dc210_get_filenames (Camera *camera, CameraList *list, GPContext *context)
|
||||
int dc210_get_filenames (Camera *camera, CameraList *list, GPContext *context)
|
||||
{
|
||||
char cmd[8];
|
||||
CameraFile *file;
|
||||
@@ -1085,7 +1085,7 @@ int dc210_get_filenames (Camera *camera, CameraList *list, GPContext *context)
|
||||
dc210_cmd_init(cmd, DC210_GET_ALBUM_FILENAMES);
|
||||
|
||||
dc210_execute_command(camera, cmd);
|
||||
|
||||
|
||||
dc210_read_to_file(camera, file, DC210_DIRLIST_SIZE, 0, NULL);
|
||||
|
||||
gp_file_get_data_and_size(file, &data, &datasize);
|
||||
@@ -1117,9 +1117,9 @@ static void dc210_picinfo_from_block (dc210_picture_info * picinfo, unsigned cha
|
||||
picinfo->picture_number = data[6] * 0x100 + data[7];
|
||||
picinfo->picture_size = data[8] * 0x1000000 + data[9] * 0x10000 + data[10] * 0x100 + data[11];
|
||||
picinfo->preview_size = 96 * 72 * 3 + sizeof(ppmheader);
|
||||
picinfo->picture_time = CAMERA_GET_EPOC + ((data[12] * 0x1000000 +
|
||||
data[13] * 0x10000 +
|
||||
data[14] * 0x100 +
|
||||
picinfo->picture_time = CAMERA_GET_EPOC + ((data[12] * 0x1000000 +
|
||||
data[13] * 0x10000 +
|
||||
data[14] * 0x100 +
|
||||
data[15]) >> 1);
|
||||
picinfo->flash_used = data[16];
|
||||
picinfo->flash = data[17];
|
||||
@@ -1131,7 +1131,7 @@ static void dc210_picinfo_from_block (dc210_picture_info * picinfo, unsigned cha
|
||||
picinfo->exposure_time = data[28] * 0x1000000 + data[29] * 0x10000 + data[30] * 0x100 + data[31];
|
||||
strncpy(picinfo->image_name, (char *)&data[32], 12);
|
||||
picinfo->image_name[12] = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int dc210_get_picture_info (Camera *camera, dc210_picture_info *picinfo, unsigned int picno) {
|
||||
@@ -1143,13 +1143,13 @@ int dc210_get_picture_info (Camera *camera, dc210_picture_info *picinfo, unsigne
|
||||
dc210_cmd_init(cmd, DC210_GET_PICINFO);
|
||||
cmd[3] = pic_offset & 0xFF;
|
||||
cmd[2] = (pic_offset >> 8) & 0xFF;
|
||||
|
||||
|
||||
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_read_single_block(camera, data, DC210_PICINFO_SIZE) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
|
||||
|
||||
|
||||
dc210_picinfo_from_block(picinfo, data);
|
||||
|
||||
|
||||
return GP_OK;
|
||||
|
||||
};
|
||||
@@ -1159,17 +1159,17 @@ int dc210_get_picture_info_by_name (Camera *camera, dc210_picture_info *picinfo,
|
||||
char cmd[8];
|
||||
char cmd_packet[DC210_CMD_DATA_SIZE];
|
||||
unsigned char data[DC210_CARD_BLOCK_SIZE];
|
||||
|
||||
|
||||
dc210_cmd_init(cmd, DC210_CARD_GET_PICINFO);
|
||||
dc210_cmd_packet_init(cmd_packet, filename);
|
||||
|
||||
|
||||
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_write_command_packet(camera, cmd_packet) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_read_single_block(camera, data, DC210_CARD_BLOCK_SIZE) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
|
||||
|
||||
|
||||
dc210_picinfo_from_block(picinfo, data);
|
||||
|
||||
|
||||
return GP_OK;
|
||||
|
||||
};
|
||||
@@ -1183,7 +1183,7 @@ int dc210_get_status (Camera *camera, dc210_status *status) {
|
||||
char data[DC210_STATUS_SIZE];
|
||||
char cmd[8];
|
||||
|
||||
/* you have to check the battery status explicitly
|
||||
/* you have to check the battery status explicitly
|
||||
before reading the status table*/
|
||||
dc210_check_battery(camera);
|
||||
|
||||
@@ -1191,7 +1191,7 @@ int dc210_get_status (Camera *camera, dc210_status *status) {
|
||||
dc210_get_card_status(camera, &(status->card_status));
|
||||
|
||||
dc210_cmd_init(cmd, DC210_GET_STATUS);
|
||||
|
||||
|
||||
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_read_single_block(camera, (unsigned char *)data, DC210_STATUS_SIZE) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
|
||||
@@ -1203,7 +1203,7 @@ int dc210_get_status (Camera *camera, dc210_status *status) {
|
||||
else{
|
||||
for (i = 0; i < DC210_STATUS_SIZE; i++){
|
||||
if (oldstatus[i] != data[i] && (i < 12 || i > 15)){
|
||||
DC210_DEBUG("Statusdata differs at offset %03d (old: 0x%02X, new: 0x%02X)\n",
|
||||
DC210_DEBUG("Statusdata differs at offset %03d (old: 0x%02X, new: 0x%02X)\n",
|
||||
i, (unsigned char) oldstatus[i], (unsigned char) data[i]);
|
||||
};
|
||||
};
|
||||
@@ -1215,13 +1215,13 @@ int dc210_get_status (Camera *camera, dc210_status *status) {
|
||||
status->firmwareMinor = data[3];
|
||||
status->battery = data[8];
|
||||
status->acstatus = data[9];
|
||||
|
||||
|
||||
/* seconds since unix epoc */
|
||||
status->time = CAMERA_GET_EPOC + ((unsigned char) data[12] * 0x1000000 +
|
||||
(unsigned char) data[13] * 0x10000 +
|
||||
(unsigned char) data[14] * 0x100 +
|
||||
status->time = CAMERA_GET_EPOC + ((unsigned char) data[12] * 0x1000000 +
|
||||
(unsigned char) data[13] * 0x10000 +
|
||||
(unsigned char) data[14] * 0x100 +
|
||||
(unsigned char) data[15]) / 2;
|
||||
|
||||
|
||||
status->zoom = data[16];
|
||||
status->compression_type = data[19];
|
||||
status->flash = data[20];
|
||||
@@ -1257,7 +1257,7 @@ static int dc210_read_dummy_packet(Camera * camera){
|
||||
checksum = 0;
|
||||
lastanswer = 0;
|
||||
for ( i = 0; i < 2048; i++){
|
||||
|
||||
|
||||
error = gp_port_read(camera->port, &answer, 1);
|
||||
|
||||
if (error < 0){
|
||||
@@ -1301,7 +1301,7 @@ static int dc210_test_command
|
||||
|
||||
dc210_cmd_init(cmd, cmdbyte);
|
||||
|
||||
memcpy(cmd + 2, databytes, 4);
|
||||
memcpy(cmd + 2, databytes, 4);
|
||||
|
||||
/* okay, write the command and wait for acknowledge */
|
||||
|
||||
@@ -1323,7 +1323,7 @@ static int dc210_test_command
|
||||
DC210_DEBUG("Sorry, command 0x%02X not acknowledged.\n", cmdbyte);
|
||||
return GP_OK;
|
||||
default:
|
||||
DC210_DEBUG("Unexpected response 0x%02X to command 0x%02X.\n",
|
||||
DC210_DEBUG("Unexpected response 0x%02X to command 0x%02X.\n",
|
||||
answer, cmdbyte);
|
||||
return GP_OK;
|
||||
};
|
||||
@@ -1360,7 +1360,7 @@ static int dc210_test_command
|
||||
DC210_DEBUG("Camera is busy.\n");
|
||||
goto wait_finish;
|
||||
default:
|
||||
DC210_DEBUG("Unexpected response 0x%02X to command 0x%02X.\n",
|
||||
DC210_DEBUG("Unexpected response 0x%02X to command 0x%02X.\n",
|
||||
answer, cmdbyte);
|
||||
return GP_OK;
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#include "library.h"
|
||||
|
||||
int
|
||||
camera_id (CameraText *id)
|
||||
camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "kodak-dc240");
|
||||
|
||||
@@ -82,7 +82,7 @@ static const struct camera_to_usb {
|
||||
currently supported.
|
||||
*/
|
||||
int
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities a;
|
||||
int i;
|
||||
@@ -102,26 +102,26 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
a.usb_vendor = camera_to_usb[i].idVendor;
|
||||
a.usb_product = camera_to_usb[i].idProduct;
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE;
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
GP_FILE_OPERATION_PREVIEW;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
|
||||
|
||||
gp_abilities_list_append(list, a);
|
||||
}
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
{
|
||||
dc240_close (camera, context);
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -130,7 +130,7 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
|
||||
static int
|
||||
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -140,7 +140,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
static int
|
||||
get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile *file, void *data,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -163,13 +163,13 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
return (dc240_file_action (camera, DC240_ACTION_DELETE, NULL, folder,
|
||||
return (dc240_file_action (camera, DC240_ACTION_DELETE, NULL, folder,
|
||||
filename, context));
|
||||
}
|
||||
|
||||
static int
|
||||
camera_capture (Camera *camera, CameraCaptureType type,
|
||||
CameraFilePath *path, GPContext *context)
|
||||
CameraFilePath *path, GPContext *context)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -190,46 +190,46 @@ camera_capture (Camera *camera, CameraCaptureType type,
|
||||
}
|
||||
|
||||
static int
|
||||
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
{
|
||||
char buf [32 * 1024];
|
||||
char temp [1024];
|
||||
int retval;
|
||||
DC240StatusTable table;
|
||||
|
||||
|
||||
retval = dc240_get_status (camera, &table, context);
|
||||
if (retval == GP_OK) {
|
||||
sprintf (buf, _("Model: Kodak %s\n"), dc240_convert_type_to_camera(table.cameraType));
|
||||
sprintf (temp, _("Firmware version: %d.%02d\n"), table.fwVersInt, table.fwVersDec);
|
||||
strcat (buf, temp);
|
||||
sprintf (temp, _("Battery status: %s, AC Adapter: %s\n"),
|
||||
dc240_get_battery_status_str(table.battStatus),
|
||||
sprintf (temp, _("Battery status: %s, AC Adapter: %s\n"),
|
||||
dc240_get_battery_status_str(table.battStatus),
|
||||
dc240_get_ac_status_str(table.acAdapter));
|
||||
strcat (buf, temp);
|
||||
sprintf (temp, _("Number of pictures: %d\n"), table.numPict);
|
||||
strcat (buf, temp);
|
||||
sprintf (temp, _("Space remaining: High: %d, Medium: %d, Low: %d\n"),
|
||||
sprintf (temp, _("Space remaining: High: %d, Medium: %d, Low: %d\n"),
|
||||
table.remPictHigh, table.remPictMed, table.remPictLow);
|
||||
strcat (buf, temp);
|
||||
|
||||
|
||||
sprintf (temp, _("Memory card status (%d): %s\n"), table.memCardStatus,
|
||||
dc240_get_memcard_status_str(table.memCardStatus));
|
||||
strcat (buf, temp);
|
||||
|
||||
sprintf (temp, _("Total pictures captured: %d, Flashes fired: %d\n"),
|
||||
table.totalPictTaken, table.totalStrobeFired);
|
||||
sprintf (temp, _("Total pictures captured: %d, Flashes fired: %d\n"),
|
||||
table.totalPictTaken, table.totalStrobeFired);
|
||||
strcat (buf, temp);
|
||||
|
||||
|
||||
|
||||
|
||||
strcpy(summary->text, buf);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
strcpy (about->text,
|
||||
strcpy (about->text,
|
||||
_("Kodak DC240 Camera Library\n"
|
||||
"Scott Fritzinger <scottf@gphoto.net> and Hubert Figuiere <hfiguiere@teaser.fr>\n"
|
||||
"Camera Library for the Kodak DC240, DC280, DC3400 and DC5000 cameras.\n"
|
||||
@@ -246,11 +246,11 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
};
|
||||
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
int ret, selected_speed = 0;
|
||||
GPPortSettings settings;
|
||||
|
||||
|
||||
/* First, set up all the function pointers */
|
||||
camera->functions->exit = camera_exit;
|
||||
camera->functions->capture = camera_capture;
|
||||
@@ -284,7 +284,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
default:
|
||||
return (GP_ERROR_UNKNOWN_PORT);
|
||||
}
|
||||
|
||||
|
||||
ret = gp_port_set_settings (camera->port, settings);
|
||||
if (ret < 0)
|
||||
return (ret);
|
||||
@@ -294,16 +294,16 @@ camera_init (Camera *camera, GPContext *context)
|
||||
return (ret);
|
||||
|
||||
if (camera->port->type == GP_PORT_SERIAL) {
|
||||
char buf[8];
|
||||
char buf[8];
|
||||
/* Reset the camera to 9600 */
|
||||
gp_port_send_break(camera->port, 1);
|
||||
|
||||
/* Used to have a 1500 msec pause here to give
|
||||
* the camera time to reset - but, since
|
||||
* the serial port sometimes returns a garbage
|
||||
* character or two after the break, we do
|
||||
* character or two after the break, we do
|
||||
* a couple of TIMEOUT (750 msec) pauses here
|
||||
* force the delay as well as flush the port
|
||||
* force the delay as well as flush the port
|
||||
*/
|
||||
gp_port_read(camera->port, buf, 8);
|
||||
gp_port_read(camera->port, buf, 8);
|
||||
@@ -317,7 +317,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
ret = dc240_open (camera);
|
||||
if (ret < 0)
|
||||
return (ret);
|
||||
|
||||
|
||||
ret = dc240_packet_set_size (camera, HPBS+2);
|
||||
if (ret < 0)
|
||||
return (ret);
|
||||
|
||||
@@ -709,7 +709,7 @@ int dc240_get_status (Camera *camera, DC240StatusTable *table, GPContext *contex
|
||||
|
||||
if (retval == GP_OK) {
|
||||
retval = gp_file_get_data_and_size (file, &fdata, &fsize);
|
||||
if (retval != GP_OK) goto exit;
|
||||
if (retval != GP_OK) goto exit;
|
||||
if (fsize != 256) {
|
||||
GP_DEBUG ("wrong status packet size ! Size is %ld", fsize);
|
||||
retval = GP_ERROR;
|
||||
|
||||
@@ -71,7 +71,7 @@ typedef struct {
|
||||
uint8_t ipChainDisable; /* 81 */ /* ????? what does that mean reserved on DC280 */
|
||||
uint8_t imageIncomplete; /* 82 */
|
||||
uint8_t timerMode; /* 83 */
|
||||
|
||||
|
||||
uint16_t year; /* 88-89 BE */
|
||||
uint8_t month; /* 90 */
|
||||
uint8_t day; /* 91 */
|
||||
@@ -79,7 +79,7 @@ typedef struct {
|
||||
uint8_t minute; /* 93 */
|
||||
uint8_t second; /* 94 */
|
||||
uint8_t tenmSec; /* 95 */
|
||||
|
||||
|
||||
uint8_t strobeMode; /* 97 */
|
||||
uint16_t exposureComp; /* 98-99 BE see note */
|
||||
uint8_t aeMode; /* 100 */
|
||||
@@ -87,7 +87,7 @@ typedef struct {
|
||||
uint8_t afMode; /* 102 */
|
||||
uint8_t awbMode; /* 103 */
|
||||
uint32_t zoomMag; /* 104-107 BE see doc */
|
||||
|
||||
|
||||
uint8_t exposureMode; /* 129 */
|
||||
|
||||
uint8_t sharpControl; /* 131 */
|
||||
|
||||
@@ -65,14 +65,14 @@ This camera only supports one operation \
|
||||
at a time. Please wait until the current \
|
||||
operation has finished.")
|
||||
|
||||
int camera_id (CameraText *id)
|
||||
int camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "kodak-dc3200");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_abilities (CameraAbilitiesList *list)
|
||||
int camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities a;
|
||||
|
||||
@@ -136,7 +136,7 @@ int init(Camera *camera)
|
||||
|
||||
/* setup the camera */
|
||||
if (dc3200_setup(camera) == GP_ERROR)
|
||||
return GP_ERROR;
|
||||
return GP_ERROR;
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ int check_last_use(Camera *camera)
|
||||
time_t t;
|
||||
|
||||
time(&t);
|
||||
|
||||
|
||||
if(t - camera->pl->last > 9) {
|
||||
/* we have to re-init the camera */
|
||||
printf(_("camera inactive for > 9 seconds, re-initing.\n"));
|
||||
@@ -205,7 +205,7 @@ static int folder_list_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (data == NULL)
|
||||
{
|
||||
return GP_ERROR;
|
||||
@@ -222,14 +222,14 @@ static int folder_list_func (CameraFilesystem *fs, const char *folder,
|
||||
i += 20;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* skip directories starting with . */
|
||||
if(ptr_data_buff[0] == '.') {
|
||||
ptr_data_buff += 20;
|
||||
i += 20;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* copy the filename */
|
||||
strncpy(filename, (char *)ptr_data_buff, sizeof(filename));
|
||||
|
||||
@@ -239,10 +239,10 @@ static int folder_list_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
/* in case of long directory */
|
||||
filename[12] = 0;
|
||||
|
||||
|
||||
/* append dir to the list */
|
||||
gp_list_append(list, filename, NULL);
|
||||
|
||||
|
||||
ptr_data_buff += 20;
|
||||
i += 20;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* get file list data */
|
||||
res = dc3200_get_data (camera, &data, &data_len, CMD_LIST_FILES, folder,
|
||||
NULL);
|
||||
@@ -280,7 +280,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* check the data length */
|
||||
if(data_len%20 != 0 || data_len < 1)
|
||||
{
|
||||
@@ -295,7 +295,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
/* add files to the list */
|
||||
ptr_data_buff = data;
|
||||
i = 0;
|
||||
|
||||
|
||||
while(i < data_len) {
|
||||
/* files don't have 0x10 in their attribute */
|
||||
if(ptr_data_buff[11] & 0x10) {
|
||||
@@ -303,7 +303,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
i += 20;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* copy the first 8 bytes of filename */
|
||||
strncpy(filename, (char *)ptr_data_buff, 8);
|
||||
filename[8] = 0;
|
||||
@@ -311,7 +311,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
strcat(filename, ".");
|
||||
/* copy extension, last 3 bytes*/
|
||||
strncat(filename, (char *)ptr_data_buff+8, 3);
|
||||
|
||||
|
||||
if(!strstr(filename, ".JPG") && !strstr(filename, ".jpg")) {
|
||||
ptr_data_buff += 20;
|
||||
i += 20;
|
||||
@@ -320,7 +320,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
/* append file to the list */
|
||||
gp_list_append(list, filename, NULL);
|
||||
|
||||
|
||||
ptr_data_buff += 20;
|
||||
i += 20;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, CameraFileType type,
|
||||
CameraFile *file, void *user_data,
|
||||
CameraFile *file, void *user_data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
@@ -359,7 +359,7 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
CMD_GET_PREVIEW, folder, filename);
|
||||
break;
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
res = dc3200_get_data (camera, &data, &data_len,
|
||||
res = dc3200_get_data (camera, &data, &data_len,
|
||||
CMD_GET_FILE, folder, filename);
|
||||
break;
|
||||
default:
|
||||
@@ -411,11 +411,11 @@ get_info_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
strcpy(file, folder);
|
||||
if(folder[strlen(folder)-1] != '\\' || folder[strlen(folder)-1] != '/')
|
||||
strcat(file, "\\");
|
||||
strcat(file, filename);
|
||||
strcat(file, filename);
|
||||
|
||||
/* get file list data */
|
||||
res = dc3200_get_data (camera, &data, &data_len, CMD_LIST_FILES, file,
|
||||
@@ -441,7 +441,7 @@ get_info_func (CameraFilesystem *fs, const char *folder,
|
||||
info->file.fields = GP_FILE_INFO_SIZE | GP_FILE_INFO_TYPE;
|
||||
info->file.size = bytes_to_l(data[19], data[18], data[17], data[16]);
|
||||
strcpy (info->file.type, GP_MIME_JPEG);
|
||||
|
||||
|
||||
info->preview.fields = GP_FILE_INFO_TYPE;
|
||||
strcpy (info->preview.type, GP_MIME_JPEG);
|
||||
|
||||
@@ -451,7 +451,7 @@ get_info_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
|
||||
{
|
||||
strcpy (manual->text,
|
||||
strcpy (manual->text,
|
||||
_("Known problems:\n"
|
||||
"\n"
|
||||
"1. If the Kodak DC3200 does not receive a command at least "
|
||||
@@ -464,7 +464,7 @@ static int camera_manual (Camera *camera, CameraText *manual, GPContext *context
|
||||
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
strcpy (about->text,
|
||||
strcpy (about->text,
|
||||
_("Kodak DC3200 Driver\n"
|
||||
"Donn Morrison <dmorriso@gulf.uvic.ca>\n"
|
||||
"\n"
|
||||
@@ -479,7 +479,7 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
.folder_list_func = folder_list_func
|
||||
};
|
||||
|
||||
int camera_init (Camera *camera, GPContext *context)
|
||||
int camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -138,7 +138,7 @@ k_check (GPContext *c, const unsigned char *rb)
|
||||
"error that has not yet been discovered. Please "
|
||||
"report the following to %s "
|
||||
"with additional information how you got this error: "
|
||||
"(0x%x,0x%x). Thank you very much!"),
|
||||
"(0x%x,0x%x). Thank you very much!"),
|
||||
MAIL_GPHOTO_DEVEL, rb[2], rb[3]);
|
||||
return (GP_ERROR);
|
||||
}
|
||||
@@ -775,7 +775,7 @@ k_get_status (GPPort *p, GPContext *c, KStatus *status)
|
||||
CHECK_NULL (status);
|
||||
|
||||
CRF (c, l_send_receive (p, c, sb, 6, &rb, &rbs, 0, NULL, NULL), rb);
|
||||
|
||||
|
||||
status->self_test_result = (rb[5] << 8) | rb[4];
|
||||
status->power_level = rb[6];
|
||||
status->power_source = rb[7];
|
||||
@@ -1285,7 +1285,7 @@ k_localization_data_put (GPPort *p, GPContext *c,
|
||||
* packets but make sure we don't loop
|
||||
* forever.
|
||||
*/
|
||||
if (i > 131072)
|
||||
if (i > 131072)
|
||||
return (GP_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <gphoto2/gphoto2-context.h>
|
||||
|
||||
/*
|
||||
* The following are the commands that are supported by the
|
||||
* The following are the commands that are supported by the
|
||||
* camera. All other commands will be rejected as unsupported.
|
||||
*
|
||||
* 0x9200: On 'HP PhotoSmart C20', this command seems to
|
||||
@@ -59,7 +59,7 @@ typedef enum
|
||||
K_SET_PREFERENCE = 0x90c0,
|
||||
K_RESET_PREFERENCES = 0x90c1,
|
||||
K_TAKE_PICTURE = 0x9100,
|
||||
K_PUT_LOCALIZATION_FILE = 0x9200,
|
||||
K_PUT_LOCALIZATION_FILE = 0x9200,
|
||||
K_CANCEL = 0x9e00
|
||||
/* ? = 0x9e10, */
|
||||
/* ? = 0x9e20, */
|
||||
@@ -183,7 +183,7 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
K_POWER_LEVEL_LOW = 0x00,
|
||||
K_POWER_LEVEL_LOW = 0x00,
|
||||
K_POWER_LEVEL_NORMAL = 0x01,
|
||||
K_POWER_LEVEL_HIGH = 0x02
|
||||
} KPowerLevel;
|
||||
@@ -271,9 +271,9 @@ int k_format_memory_card (GPPort *, GPContext *);
|
||||
int k_take_picture (
|
||||
GPPort *device, GPContext *,
|
||||
int image_id_long,
|
||||
unsigned long *image_id,
|
||||
unsigned long *image_id,
|
||||
unsigned int *exif_size,
|
||||
unsigned char **information_buffer,
|
||||
unsigned char **information_buffer,
|
||||
unsigned int *information_buffer_size,
|
||||
int *protected);
|
||||
|
||||
@@ -352,18 +352,18 @@ int k_get_image_information (
|
||||
GPPort *device, GPContext *,
|
||||
int image_id_long,
|
||||
unsigned long image_number,
|
||||
unsigned long *image_id,
|
||||
unsigned int *exif_size,
|
||||
int *protected,
|
||||
unsigned long *image_id,
|
||||
unsigned int *exif_size,
|
||||
int *protected,
|
||||
unsigned char **information_buffer,
|
||||
unsigned int *information_buffer_size);
|
||||
|
||||
int k_get_image (
|
||||
GPPort *device, GPContext *,
|
||||
int image_id_long,
|
||||
unsigned long image_id,
|
||||
KImageType image_type,
|
||||
unsigned char **image_buffer,
|
||||
unsigned long image_id,
|
||||
KImageType image_type,
|
||||
unsigned char **image_buffer,
|
||||
unsigned int *image_buffer_size);
|
||||
|
||||
/* Localization */
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -38,7 +38,7 @@
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
@@ -96,7 +96,7 @@ l_ping_rec (GPPort *p, unsigned int level)
|
||||
else
|
||||
return (GP_ERROR_CORRUPTED_DATA);
|
||||
case ENQ:
|
||||
|
||||
|
||||
/*
|
||||
* ENQ received. It seems that the camera would like
|
||||
* to send us data, but we do not want it and
|
||||
@@ -152,7 +152,7 @@ l_ping (GPPort *p, GPContext *c)
|
||||
return (l_ping_rec (p, 0));
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
l_init (GPPort *p, GPContext *c)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -168,7 +168,7 @@ l_init (GPPort *p, GPContext *c)
|
||||
return (result);
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
l_esc_read (GPPort *p, unsigned char *c)
|
||||
{
|
||||
CHECK_NULL (p && c);
|
||||
@@ -223,7 +223,7 @@ l_send (GPPort *p, GPContext *context, unsigned char *send_buffer,
|
||||
/* sb: A pointer to the buffer that we will send. */
|
||||
/* sbs: Its size. */
|
||||
/**********************************************************************/
|
||||
unsigned char *sb;
|
||||
unsigned char *sb;
|
||||
unsigned int sbs;
|
||||
int i = 0;
|
||||
|
||||
@@ -253,10 +253,10 @@ l_send (GPPort *p, GPContext *context, unsigned char *send_buffer,
|
||||
checksum += sb[2];
|
||||
for (i = 3; i < (sbs - 2); i++) {
|
||||
checksum += *send_buffer;
|
||||
if ( (*send_buffer == STX ) ||
|
||||
if ( (*send_buffer == STX ) ||
|
||||
(*send_buffer == ETX ) ||
|
||||
(*send_buffer == ENQ ) ||
|
||||
(*send_buffer == ACK ) ||
|
||||
(*send_buffer == ACK ) ||
|
||||
(*send_buffer == XOFF) ||
|
||||
(*send_buffer == XON ) ||
|
||||
(*send_buffer == NACK) ||
|
||||
@@ -270,13 +270,13 @@ l_send (GPPort *p, GPContext *context, unsigned char *send_buffer,
|
||||
}
|
||||
sb[sbs - 2] = ETX;
|
||||
checksum += ETX;
|
||||
if ( (checksum == STX ) ||
|
||||
(checksum == ETX ) ||
|
||||
(checksum == ENQ ) ||
|
||||
(checksum == ACK ) ||
|
||||
if ( (checksum == STX ) ||
|
||||
(checksum == ETX ) ||
|
||||
(checksum == ENQ ) ||
|
||||
(checksum == ACK ) ||
|
||||
(checksum == XOFF) ||
|
||||
(checksum == XON ) ||
|
||||
(checksum == NACK) ||
|
||||
(checksum == XON ) ||
|
||||
(checksum == NACK) ||
|
||||
(checksum == ETB ) ||
|
||||
(checksum == ESC )) {
|
||||
sb = realloc (sb, ++sbs * sizeof (char));
|
||||
@@ -315,7 +315,7 @@ l_send (GPPort *p, GPContext *context, unsigned char *send_buffer,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
l_receive (GPPort *p, GPContext *context,
|
||||
unsigned char **rb, unsigned int *rbs,
|
||||
unsigned int timeout)
|
||||
@@ -426,7 +426,7 @@ while (read < rbs_internal) {
|
||||
* Read the specified amount of bytes. We will probably read more
|
||||
* because some bytes will be quoted.
|
||||
*/
|
||||
GP_DEBUG ("Reading %i bytes (%i of %i already read)...",
|
||||
GP_DEBUG ("Reading %i bytes (%i of %i already read)...",
|
||||
rbs_internal - read, read, rbs_internal);
|
||||
result = gp_port_read (p, (char *)&((*rb)[*rbs + read]),
|
||||
rbs_internal - read);
|
||||
@@ -560,7 +560,7 @@ while (read < rbs_internal) {
|
||||
/*
|
||||
* Depending on d, we will either continue to receive data or
|
||||
* stop.
|
||||
*
|
||||
*
|
||||
* - ETX: We are all done.
|
||||
* - ETB: We expect more data.
|
||||
* - else: Should not happen.
|
||||
@@ -612,10 +612,10 @@ while (read < rbs_internal) {
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
l_send_receive (
|
||||
GPPort *p, GPContext *c,
|
||||
unsigned char *send_buffer, unsigned int send_buffer_size,
|
||||
unsigned char *send_buffer, unsigned int send_buffer_size,
|
||||
unsigned char **receive_buffer, unsigned int *receive_buffer_size,
|
||||
unsigned int timeout,
|
||||
unsigned char **image_buffer, unsigned int *image_buffer_size)
|
||||
@@ -639,10 +639,10 @@ l_send_receive (
|
||||
return (GP_OK);
|
||||
|
||||
/* We didn't receive control data yet. */
|
||||
*image_buffer = *receive_buffer;
|
||||
*image_buffer = *receive_buffer;
|
||||
*image_buffer_size = *receive_buffer_size;
|
||||
*receive_buffer = NULL;
|
||||
|
||||
|
||||
/* Receive control data. */
|
||||
CHECK (l_receive (p, c, receive_buffer, receive_buffer_size,
|
||||
DEFAULT_TIMEOUT));
|
||||
@@ -651,6 +651,6 @@ l_send_receive (
|
||||
if (((*receive_buffer)[0] != send_buffer[0]) ||
|
||||
((*receive_buffer)[1] != send_buffer[1]))
|
||||
return (GP_ERROR_CORRUPTED_DATA);
|
||||
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -30,7 +30,7 @@ int l_init (GPPort *, GPContext *);
|
||||
/*
|
||||
* Some comments on the structure of send_buffer, image_buffer,
|
||||
* and receive_buffer:
|
||||
*
|
||||
*
|
||||
* send_buffer: The first two bytes are low order and high
|
||||
* byte of the command, followed by at least two
|
||||
* more bytes. The number of sent bytes has to be
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -19,7 +19,7 @@
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Modified by Aurélien Croc (AP²C) <programming@ap2c.com>
|
||||
* In particular : fix some bugs, and implementation of advanced
|
||||
* In particular : fix some bugs, and implementation of advanced
|
||||
* functions : delete some images, delete all images, capture new image,
|
||||
* update an image to the camera, get thumbnails, get information, get
|
||||
* summary, get configuration, get manual, get about, get EXIF informations
|
||||
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
/* NOTES :
|
||||
* Becareful, image information number starts at 1 and finish at the
|
||||
* Becareful, image information number starts at 1 and finish at the
|
||||
* max image number. But when you want to work on the images, you must
|
||||
* read image informations, and check the real image number in the image
|
||||
* information header and use this number with all functions !!
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
/** Local functions **********************************************************/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check the integrity of datas
|
||||
*/
|
||||
static unsigned char
|
||||
@@ -149,17 +149,17 @@ k_calculate_checksum (unsigned char *buf, unsigned long int len)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check the connection and the camera
|
||||
*/
|
||||
static int
|
||||
k_ping (GPPort *port) {
|
||||
char cmd[2], buf[1];
|
||||
int ret;
|
||||
|
||||
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = PING;
|
||||
ret = gp_port_write (port, cmd, 2);
|
||||
ret = gp_port_write (port, cmd, 2);
|
||||
if (ret<GP_OK) return ret;
|
||||
ret = gp_port_read (port, buf, 1);
|
||||
if (ret<GP_OK) return ret;
|
||||
@@ -167,11 +167,11 @@ k_ping (GPPort *port) {
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read image informations
|
||||
/*
|
||||
* Read image informations
|
||||
*/
|
||||
static int
|
||||
k_info_img (unsigned int image_no, void *data, CameraFileInfo* info,
|
||||
k_info_img (unsigned int image_no, void *data, CameraFileInfo* info,
|
||||
int *data_number)
|
||||
{
|
||||
unsigned char cmd[6], buf[INFO_BUFFER];
|
||||
@@ -185,7 +185,7 @@ k_info_img (unsigned int image_no, void *data, CameraFileInfo* info,
|
||||
cmd[3] = 0x30 + ((image_no/100 )%10);
|
||||
cmd[4] = 0x30 + ((image_no/10 )%10);
|
||||
cmd[5] = 0x30 + ( image_no %10);
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK) return ret;
|
||||
ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER);
|
||||
if (ret<GP_OK) return ret;
|
||||
@@ -199,10 +199,10 @@ k_info_img (unsigned int image_no, void *data, CameraFileInfo* info,
|
||||
/* There is no audio support with this camera */
|
||||
info->audio.fields = GP_FILE_INFO_NONE;
|
||||
/* Preview informations */
|
||||
info->preview.fields = GP_FILE_INFO_TYPE | GP_FILE_INFO_SIZE
|
||||
info->preview.fields = GP_FILE_INFO_TYPE | GP_FILE_INFO_SIZE
|
||||
| GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT;
|
||||
strcpy (info->preview.type, GP_MIME_JPEG);
|
||||
info->preview.size = ((buf[PREVIEW_SIZE_PTR] << 24) |
|
||||
info->preview.size = ((buf[PREVIEW_SIZE_PTR] << 24) |
|
||||
(buf[PREVIEW_SIZE_PTR+1] << 16) | (buf[PREVIEW_SIZE_PTR+2] << 8)
|
||||
| buf[PREVIEW_SIZE_PTR+3]);
|
||||
info->preview.width = PREVIEW_WIDTH;
|
||||
@@ -230,7 +230,7 @@ k_info_img (unsigned int image_no, void *data, CameraFileInfo* info,
|
||||
* type = GP_FILE_TYPE_NORMAL, GP_FILE_TYPE_PREVIEW or GP_FILE_TYPE_EXIF
|
||||
*/
|
||||
static int
|
||||
k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
unsigned char *d, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -259,7 +259,7 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
|
||||
/* Download the required image */
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
id = gp_context_progress_start (context, len,
|
||||
id = gp_context_progress_start (context, len,
|
||||
_("Downloading image..."));
|
||||
for (i=0; i <= (len+DATA_BUFFER-1)/DATA_BUFFER ; i++) {
|
||||
unsigned char csum;
|
||||
@@ -269,7 +269,7 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
if (xret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
gp_context_progress_stop (context, id);
|
||||
return xret;
|
||||
return xret;
|
||||
}
|
||||
ret = gp_port_read (camera->port, (char*)&csum, CSUM_LEN);
|
||||
if (ret < GP_OK) {
|
||||
@@ -297,7 +297,7 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
}
|
||||
|
||||
/* acknowledge the packet */
|
||||
ack = ACK;
|
||||
ack = ACK;
|
||||
ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
@@ -317,7 +317,7 @@ k_getdata (int image_no, int type, unsigned int len, void *data,
|
||||
gp_context_progress_update (context, id, bytes_read);
|
||||
}
|
||||
/* acknowledge the packet */
|
||||
ack = ACK;
|
||||
ack = ACK;
|
||||
ret = gp_port_write (camera->port, (char*)&ack, ACK_LEN);
|
||||
if (ret < GP_OK) {
|
||||
if (type == GP_FILE_TYPE_NORMAL)
|
||||
@@ -354,7 +354,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
/* Search the image informations */
|
||||
image_no++;
|
||||
ret = k_info_img (image_no, data, (CameraFileInfo *)&file_info,
|
||||
ret = k_info_img (image_no, data, (CameraFileInfo *)&file_info,
|
||||
&image_number);
|
||||
image_no = image_number;
|
||||
if (ret < GP_OK)
|
||||
@@ -369,14 +369,14 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
data, d, context);
|
||||
if (ret < GP_OK) {
|
||||
free(d);
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
len = file_info.preview.size;
|
||||
if (!(d = (unsigned char *)malloc(len)))
|
||||
return (GP_ERROR_NO_MEMORY);
|
||||
ret = k_getdata(image_no, GP_FILE_TYPE_PREVIEW, len,
|
||||
ret = k_getdata(image_no, GP_FILE_TYPE_PREVIEW, len,
|
||||
data, d, context);
|
||||
if (ret < GP_OK) {
|
||||
free(d);
|
||||
@@ -403,7 +403,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
len = file_info.preview.size;
|
||||
if (!(d = (unsigned char *)malloc(len)))
|
||||
return (GP_ERROR_NO_MEMORY);
|
||||
ret = k_getdata(image_no, GP_FILE_TYPE_EXIF, len,
|
||||
ret = k_getdata(image_no, GP_FILE_TYPE_EXIF, len,
|
||||
data, d, context);
|
||||
if (ret < GP_OK) {
|
||||
free(d);
|
||||
@@ -411,7 +411,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gp_context_error(context,
|
||||
gp_context_error(context,
|
||||
_("Image type %d is not supported by this camera !"), type);
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
@@ -426,7 +426,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
* The image mustn't be protected
|
||||
*/
|
||||
static int
|
||||
delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -441,7 +441,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
if (image_no < 0) return image_no;
|
||||
|
||||
image_no++;
|
||||
ret = k_info_img (image_no, data, (CameraFileInfo *)&file_info,
|
||||
ret = k_info_img (image_no, data, (CameraFileInfo *)&file_info,
|
||||
&image_no);
|
||||
if (ret < GP_OK)
|
||||
return ret;
|
||||
@@ -468,7 +468,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
if (ack != ACK) {
|
||||
gp_context_error(context, _("Can't delete image %s."),filename);
|
||||
return (GP_ERROR);
|
||||
}
|
||||
}
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
if (ack != ACK) {
|
||||
gp_context_error(context, _("Can't delete all images."));
|
||||
return (GP_ERROR);
|
||||
}
|
||||
}
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
*/
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFileType type, CameraFile *file,
|
||||
CameraFileType type, CameraFile *file,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
@@ -520,14 +520,14 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
unsigned long int len, len_sent=0;
|
||||
unsigned int id;
|
||||
int ret,i;
|
||||
|
||||
|
||||
GP_DEBUG ("*** ENTER: put_file_func ***");
|
||||
|
||||
/* Send function */
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = UPLOADDATA;
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK)
|
||||
ret = gp_port_write (camera->port, (char*)cmd, sizeof(cmd));
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
gp_file_get_data_and_size(file, &d, &len);
|
||||
id = gp_context_progress_start (context, len, _("Uploading image..."));
|
||||
@@ -539,13 +539,13 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
}
|
||||
if (ack != ACK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
gp_context_error(context,
|
||||
gp_context_error(context,
|
||||
_("Can't upload this image to the camera. "
|
||||
"An error has occurred."));
|
||||
return (GP_ERROR);
|
||||
}
|
||||
state = NEXTFRAME;
|
||||
ret = gp_port_write (camera->port, (char*)&state, STATE_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&state, STATE_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
@@ -560,7 +560,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
}
|
||||
/* and complete with zeros */
|
||||
memset(buf,0,DATA_BUFFER);
|
||||
ret = gp_port_write (camera->port, (char*)buf, (DATA_BUFFER -
|
||||
ret = gp_port_write (camera->port, (char*)buf, (DATA_BUFFER -
|
||||
(len - len_sent)));
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
@@ -585,7 +585,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
(unsigned char *)&d[i*DATA_BUFFER],
|
||||
DATA_BUFFER);
|
||||
}
|
||||
ret = gp_port_write (camera->port, (char*)&sum, CSUM_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&sum, CSUM_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
@@ -593,7 +593,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
gp_context_progress_update (context, id, len_sent);
|
||||
}
|
||||
state = EOT;
|
||||
ret = gp_port_write (camera->port, (char*)&state, STATE_LEN);
|
||||
ret = gp_port_write (camera->port, (char*)&state, STATE_LEN);
|
||||
if (ret<GP_OK) {
|
||||
gp_context_progress_stop (context, id);
|
||||
return ret;
|
||||
@@ -628,7 +628,7 @@ camera_capture (Camera* camera, CameraCaptureType type, CameraFilePath* path,
|
||||
/* Just check if there is space available yet */
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = GETCAMINFO;
|
||||
ret = gp_port_write (camera->port, (char*)cmd, 2);
|
||||
ret = gp_port_write (camera->port, (char*)cmd, 2);
|
||||
if (ret<GP_OK)
|
||||
return ret;
|
||||
ret = gp_port_read (camera->port, (char*)buf, INFO_BUFFER);
|
||||
@@ -755,7 +755,7 @@ camera_get_config (Camera* camera, CameraWidget** window, GPContext *context)
|
||||
timestamp = (buf[TIMESTAMP_PTR] << 24) + (buf[TIMESTAMP_PTR+1] << 16)
|
||||
+ (buf[TIMESTAMP_PTR+2] << 8) + buf[TIMESTAMP_PTR+3];
|
||||
/*
|
||||
* This timestamp start the 1 January 1980 at 00:00
|
||||
* This timestamp start the 1 January 1980 at 00:00
|
||||
* but UNIX timestamp start the 1 January 1970 at 00:00
|
||||
* so we calculate the UNIX timestamp with the camera's one
|
||||
*/
|
||||
@@ -874,14 +874,14 @@ camera_get_config (Camera* camera, CameraWidget** window, GPContext *context)
|
||||
break;
|
||||
case 1:
|
||||
if (buf[RED_EYE_STATE_PTR] == 1)
|
||||
gp_widget_set_value (widget,
|
||||
gp_widget_set_value (widget,
|
||||
_("On, red-eye reduction"));
|
||||
else
|
||||
gp_widget_set_value (widget, _("On"));
|
||||
break;
|
||||
case 0:
|
||||
if (buf[RED_EYE_STATE_PTR] == 1)
|
||||
gp_widget_set_value (widget,
|
||||
gp_widget_set_value (widget,
|
||||
_("Auto, red-eye reduction"));
|
||||
else
|
||||
gp_widget_set_value (widget, _("Auto"));
|
||||
@@ -1177,7 +1177,7 @@ camera_summary (Camera *camera, CameraText *text, GPContext *context)
|
||||
snprintf(date_disp,sizeof(date_disp),_("MM/DD/YYYY"));
|
||||
break;
|
||||
}
|
||||
snprintf(text->text, sizeof(text->text),
|
||||
snprintf(text->text, sizeof(text->text),
|
||||
_("Model: %s\n"
|
||||
"Capacity: %i Mb\n"
|
||||
"Power: %s\n"
|
||||
@@ -1230,7 +1230,7 @@ camera_manual (Camera *camera, CameraText *manual, GPContext *context)
|
||||
* Camera's identification
|
||||
*/
|
||||
int
|
||||
camera_id (CameraText *id)
|
||||
camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "konica qm150");
|
||||
return (GP_OK);
|
||||
@@ -1240,7 +1240,7 @@ camera_id (CameraText *id)
|
||||
* List all camera's abilities
|
||||
*/
|
||||
int
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities a;
|
||||
|
||||
@@ -1250,11 +1250,11 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
a.port = GP_PORT_SERIAL;
|
||||
a.speed[0] = 115200;
|
||||
a.speed[1] = 0;
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE |
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE |
|
||||
GP_OPERATION_CAPTURE_PREVIEW | GP_OPERATION_CONFIG;
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
GP_FILE_OPERATION_EXIF | GP_FILE_OPERATION_PREVIEW;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL |
|
||||
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL |
|
||||
GP_FOLDER_OPERATION_PUT_FILE;
|
||||
gp_abilities_list_append(list, a);
|
||||
return (GP_OK);
|
||||
@@ -1274,7 +1274,7 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
.delete_all_func = delete_all_func,
|
||||
};
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
GPPortSettings settings;
|
||||
int speeds[] = { 115200, 9600, 19200, 38400, 57600, 115200 };
|
||||
@@ -1305,7 +1305,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
settings.serial.parity = 0;
|
||||
gp_port_set_settings (camera->port, settings);
|
||||
/*
|
||||
* Once you have configured the port, you should check if a
|
||||
* Once you have configured the port, you should check if a
|
||||
* connection to the camera can be established.
|
||||
*/
|
||||
for (i=0;i<sizeof(speeds)/sizeof(speeds[0]);i++) {
|
||||
@@ -1320,7 +1320,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
cmd[0] = ESC;
|
||||
cmd[1] = SETSPEED;
|
||||
cmd[2] = 0x30 + 4; /* speed nr 4:(9600, 19200, 38400, 57600, 115200) */
|
||||
ret = gp_port_write (camera->port, cmd, 3);
|
||||
ret = gp_port_write (camera->port, cmd, 3);
|
||||
if (ret<GP_OK) return ret;
|
||||
ret = gp_port_read (camera->port, buf, 1);
|
||||
if (ret<GP_OK) return ret;
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -58,7 +58,7 @@
|
||||
static uint8_t convert_name_to_index (const char * name);
|
||||
|
||||
int
|
||||
camera_id (CameraText *id)
|
||||
camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "largan-lmini");
|
||||
|
||||
@@ -83,7 +83,7 @@ static const struct largan_cameras {
|
||||
};
|
||||
|
||||
int
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities a;
|
||||
int i;
|
||||
@@ -107,10 +107,10 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
|
||||
}
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE;
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
GP_FILE_OPERATION_PREVIEW;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
|
||||
|
||||
if (a.port) {
|
||||
/* only append if port is defined.*/
|
||||
gp_abilities_list_append(list, a);
|
||||
@@ -120,7 +120,7 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
}
|
||||
|
||||
static int
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
{
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
largan_pict_type pict_type;
|
||||
|
||||
index = convert_name_to_index (filename);
|
||||
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
pict_type = LARGAN_PICT;
|
||||
@@ -153,7 +153,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
default:
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
pict = largan_pict_new ();
|
||||
ret = largan_get_pict (camera, pict_type, (uint8_t)index, pict);
|
||||
if (ret == GP_OK) {
|
||||
@@ -171,7 +171,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
static uint8_t
|
||||
convert_name_to_index (const char * name)
|
||||
{
|
||||
long index;
|
||||
@@ -192,10 +192,10 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = data;
|
||||
int index;
|
||||
|
||||
/* Delete one file from the camera.
|
||||
|
||||
/* Delete one file from the camera.
|
||||
(only the last file can be deleted)*/
|
||||
|
||||
|
||||
index = convert_name_to_index (filename);
|
||||
return largan_erase (camera, index);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
};
|
||||
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
int ret;
|
||||
GPPortSettings settings;
|
||||
@@ -307,13 +307,13 @@ camera_init (Camera *camera, GPContext *context)
|
||||
default:
|
||||
return (GP_ERROR_UNKNOWN_PORT);
|
||||
}
|
||||
|
||||
|
||||
ret = gp_port_set_settings (camera->port, settings);
|
||||
if (ret < 0)
|
||||
return (ret);
|
||||
|
||||
/*
|
||||
* Once you have configured the port, you should check if a
|
||||
* Once you have configured the port, you should check if a
|
||||
* connection to the camera can be established.
|
||||
*/
|
||||
return largan_open (camera);
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -50,7 +50,7 @@ static const char BMPheader[54]={
|
||||
static struct largan_baud_rate {
|
||||
int baud;
|
||||
char value; /* value to be sent in the protocol */
|
||||
} bauds [] = {
|
||||
} bauds [] = {
|
||||
{19200, 0x02 }, /* default */
|
||||
{38400, 0x03 },
|
||||
{ 9600, 0x01 },
|
||||
@@ -69,9 +69,9 @@ enum {
|
||||
|
||||
static int purge_camera (Camera * camera);
|
||||
static int wakeup_camera (Camera * camera);
|
||||
static int largan_send_command (Camera * camera, uint8_t cmd,
|
||||
static int largan_send_command (Camera * camera, uint8_t cmd,
|
||||
uint8_t param1, uint8_t param2);
|
||||
static int largan_recv_reply (Camera * camera, uint8_t *reply,
|
||||
static int largan_recv_reply (Camera * camera, uint8_t *reply,
|
||||
uint8_t *code, uint8_t * code2);
|
||||
static int set_serial_speed (Camera * camera, int speed);
|
||||
|
||||
@@ -108,7 +108,7 @@ largan_pict_alloc_data (largan_pict_info * ptr, uint32_t size)
|
||||
int largan_open (Camera * camera)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
ret = largan_get_num_pict (camera);
|
||||
if (ret < 0){
|
||||
ret = purge_camera (camera);
|
||||
@@ -175,7 +175,7 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
|
||||
return ret;
|
||||
}
|
||||
ret = largan_recv_reply (camera, &reply, &code, NULL);
|
||||
/* here we have to receive 7 bytes back
|
||||
/* here we have to receive 7 bytes back
|
||||
the 2nd contains 00 for thumbnail or 01 for original picture
|
||||
the 3rd contains the picturenumber for an original picture
|
||||
or 00 for an thumbnail for an lowres picture
|
||||
@@ -205,7 +205,7 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
|
||||
GP_DEBUG ("largan_get_pict(): code != 0x01 && 0x00\n");
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* the remaining 5 bytes are read here */
|
||||
|
||||
ret = gp_port_read (camera->port, (char *)buf, sizeof(buf));
|
||||
@@ -231,7 +231,7 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
|
||||
pict->type = type;
|
||||
pict_size = be32atoh (&buf[1]);
|
||||
switch (type) {
|
||||
case LARGAN_PICT:
|
||||
case LARGAN_PICT:
|
||||
largan_pict_alloc_data (pict, pict_size);
|
||||
ret = gp_port_read (camera->port, pict->data, pict->data_size);
|
||||
if (ret < GP_OK) {
|
||||
@@ -243,7 +243,7 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
|
||||
}
|
||||
pict->quality = 0xff; /* this is not a thumbnail */
|
||||
break;
|
||||
case LARGAN_THUMBNAIL:
|
||||
case LARGAN_THUMBNAIL:
|
||||
{
|
||||
char * buffer = (char*)malloc(pict_size);
|
||||
|
||||
@@ -258,7 +258,7 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
|
||||
memcpy (pict->data, BMPheader, sizeof(BMPheader));
|
||||
/*this is the segfaulty function */
|
||||
largan_ccd2dib (buffer, pict->data + sizeof(BMPheader), 240, 1);
|
||||
|
||||
|
||||
free (buffer);
|
||||
pict->quality = buf[0];
|
||||
break;
|
||||
@@ -416,7 +416,7 @@ static int largan_recv_reply (Camera * camera, uint8_t *reply,
|
||||
packet_size = 2;
|
||||
break;
|
||||
case LARGAN_GET_PICT_CMD:
|
||||
packet_size = 2;
|
||||
packet_size = 2;
|
||||
break;
|
||||
case LARGAN_BAUD_ERASE_CMD:
|
||||
packet_size = 2;
|
||||
@@ -507,18 +507,18 @@ static int set_serial_speed (Camera * camera, int speed)
|
||||
int ret;
|
||||
GPPortSettings settings;
|
||||
GP_DEBUG ("set_serial_speed() called ***************\n");
|
||||
|
||||
|
||||
if (camera->port->type != GP_PORT_SERIAL) {
|
||||
GP_DEBUG ("set_serial_speed() called on non serial port\n");
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
ret = gp_port_get_settings (camera->port, &settings);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
settings.serial.speed = speed;
|
||||
|
||||
|
||||
ret = gp_port_set_settings (camera->port, settings);
|
||||
return ret;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ static int purge_camera (Camera * camera)
|
||||
while (1)
|
||||
{
|
||||
count = gp_port_read (camera->port, (char *)buffer, 1);
|
||||
if (count < GP_OK)
|
||||
if (count < GP_OK)
|
||||
return count;
|
||||
|
||||
if (count)
|
||||
@@ -567,7 +567,7 @@ static int wakeup_camera (Camera * camera)
|
||||
{
|
||||
int num_pix;
|
||||
/* int i;*/
|
||||
|
||||
|
||||
if (camera->port->type == GP_PORT_SERIAL) {
|
||||
set_serial_speed (camera, 4800); /*wakes camera best*/
|
||||
num_pix = largan_get_num_pict (camera); /*this wakes*/
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -49,7 +49,7 @@ void largan_pict_free (largan_pict_info *);
|
||||
|
||||
int largan_open (Camera * camera);
|
||||
int largan_get_num_pict (Camera * camera);
|
||||
int largan_get_pict (Camera * camera, largan_pict_type type,
|
||||
int largan_get_pict (Camera * camera, largan_pict_type type,
|
||||
uint8_t index, largan_pict_info * pict);
|
||||
int largan_erase (Camera *camera, int all);
|
||||
int largan_capture (Camera *camera);
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "lg_gsm.h"
|
||||
|
||||
#define GP_MODULE "lg_gsm"
|
||||
#define GP_MODULE "lg_gsm"
|
||||
|
||||
#define MSGWRITE gp_port_usb_msg_write
|
||||
#define WRITE gp_port_write
|
||||
@@ -42,7 +42,7 @@ static char get_firmware[] = "\x1\x0\x0\x0\x0\x0";
|
||||
static char list_all_photo[]= "\x04\x0\x08\x0\x0\x0\x40\x0\x0\x0\xff\xff\xff\xff";
|
||||
static char get_photo_cmd[]="\x0b\x0\x8a\x0\x0\x0\x40\x0\x0\x0";
|
||||
|
||||
int lg_gsm_init (GPPort *port, Model *model, Info *info)
|
||||
int lg_gsm_init (GPPort *port, Model *model, Info *info)
|
||||
{
|
||||
char firmware[54];
|
||||
char oknok[6];
|
||||
@@ -75,7 +75,7 @@ int lg_gsm_init (GPPort *port, Model *model, Info *info)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
unsigned int lg_gsm_get_picture_size (GPPort *port, int pic)
|
||||
unsigned int lg_gsm_get_picture_size (GPPort *port, int pic)
|
||||
{
|
||||
|
||||
unsigned int size;
|
||||
@@ -108,7 +108,7 @@ unsigned int lg_gsm_get_picture_size (GPPort *port, int pic)
|
||||
size = (unsigned int)photodesc[138] + (unsigned int)photodesc[139]*0x100 + (unsigned int)photodesc[140]*0x10000+(unsigned int)photodesc[141]*0x1000000;
|
||||
GP_DEBUG(" size of picture %i is 0x%x\n", pic, size);
|
||||
/* max. 1280x960x24bits ? */
|
||||
if ( (size >= 0x384000 ) ) {return GP_ERROR;}
|
||||
if ( (size >= 0x384000 ) ) {return GP_ERROR;}
|
||||
MSGWRITE(port, 0x13, 0x6, 0x0, "", 0);
|
||||
WRITE(port, sync_stop, 6);
|
||||
READ(port, oknok, 6);
|
||||
@@ -116,7 +116,7 @@ unsigned int lg_gsm_get_picture_size (GPPort *port, int pic)
|
||||
return size;
|
||||
}
|
||||
|
||||
int lg_gsm_read_picture_data (GPPort *port, char *data, unsigned int datasize, unsigned int n)
|
||||
int lg_gsm_read_picture_data (GPPort *port, char *data, unsigned int datasize, unsigned int n)
|
||||
{
|
||||
char listphotos[] = "\x04\x0\x08\x0\x0\x0\x40\x0\x0\x0\x0\x0\x0\x0";
|
||||
|
||||
@@ -197,7 +197,7 @@ int lg_gsm_read_picture_data (GPPort *port, char *data, unsigned int datasize, u
|
||||
memcpy(data+pos,&block[header_size],remain);
|
||||
pos=pos+remain;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*port->timeout=5000;*/
|
||||
/* syncstop */
|
||||
@@ -209,10 +209,10 @@ int lg_gsm_read_picture_data (GPPort *port, char *data, unsigned int datasize, u
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int lg_gsm_list_files (GPPort *port, CameraList *list)
|
||||
int lg_gsm_list_files (GPPort *port, CameraList *list)
|
||||
{
|
||||
unsigned int num_pics;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
char oknok[6];
|
||||
unsigned char photonumber[22];
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -135,7 +135,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile *file, void *user_data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
Camera *camera = user_data;
|
||||
|
||||
int k;
|
||||
char *data;
|
||||
@@ -196,11 +196,11 @@ camera_init(Camera *camera, GPContext *context)
|
||||
camera->functions->summary = camera_summary;
|
||||
camera->functions->about = camera_about;
|
||||
camera->functions->exit = camera_exit;
|
||||
|
||||
|
||||
GP_DEBUG ("Initializing the camera\n");
|
||||
ret = gp_port_get_settings(camera->port,&settings);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
switch (camera->port->type) {
|
||||
case GP_PORT_SERIAL:
|
||||
@@ -217,18 +217,18 @@ camera_init(Camera *camera, GPContext *context)
|
||||
}
|
||||
|
||||
ret = gp_port_set_settings(camera->port,settings);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
GP_DEBUG("interface = %i\n", settings.usb.interface);
|
||||
GP_DEBUG("inep = %x\n", settings.usb.inep);
|
||||
GP_DEBUG("inep = %x\n", settings.usb.inep);
|
||||
GP_DEBUG("outep = %x\n", settings.usb.outep);
|
||||
|
||||
/* Tell the CameraFilesystem where to get lists from */
|
||||
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
|
||||
|
||||
camera->pl = malloc (sizeof (CameraPrivateLibrary));
|
||||
if (!camera->pl)
|
||||
if (!camera->pl)
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
memset (camera->pl, 0, sizeof (CameraPrivateLibrary));
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* \par
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* \par
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
@@ -87,7 +87,7 @@
|
||||
char* CDS_Control = ":60606/Server0/CDS_control";
|
||||
int ReadoutMode = 2; // this should be picked up from the settings.... 0-> JPG; 1->RAW; 2 -> Thumbnails
|
||||
char* cameraShutterSpeed = "B"; // //placeholder to store the value of the shutterspeed set in camera; "B" is for bulb.
|
||||
int captureDuration = 10; //placeholder to store the value of the bulb shot this should be taken as input. note that my primary goal is in fact to perform bulb captures. but this should be extended for sure to take Shutter Speed capture as set in camera
|
||||
int captureDuration = 10; //placeholder to store the value of the bulb shot this should be taken as input. note that my primary goal is in fact to perform bulb captures. but this should be extended for sure to take Shutter Speed capture as set in camera
|
||||
|
||||
static int NumberPix(Camera *camera);
|
||||
static char* loadCmd (Camera *camera,char* cmd);
|
||||
@@ -120,7 +120,7 @@ struct _CameraPrivateLibrary {
|
||||
|
||||
|
||||
static int
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
camera_exit (Camera *camera, GPContext *context)
|
||||
{
|
||||
if (camera->pl->udpsocket > 0) {
|
||||
close (camera->pl->udpsocket);
|
||||
@@ -265,7 +265,7 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
|
||||
/**
|
||||
* Get the file info here and write it to space provided by caller.
|
||||
*
|
||||
*
|
||||
* \param info Space provided by caller in which file info is written.
|
||||
*
|
||||
* This function is a CameraFilesystem method.
|
||||
@@ -351,7 +351,7 @@ int
|
||||
storage_info_func (CameraFilesystem *fs,
|
||||
CameraStorageInformation **storageinformations,
|
||||
int *nrofstorageinformations, void *data,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
/*Camera *camera = data;*/
|
||||
|
||||
@@ -419,7 +419,7 @@ loadCmd (Camera *camera,char* cmd) {
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
|
||||
return NULL;
|
||||
} else {
|
||||
/* read the XML that is now in Buffer*/
|
||||
/* read the XML that is now in Buffer*/
|
||||
GP_LOG_D("result %s\n", lmb.data);
|
||||
|
||||
/* <?xml version="1.0" encoding="UTF-8"?> <camrply><result>ok</result></camrply> */
|
||||
@@ -657,7 +657,7 @@ static void focusOut(Camera *camera) {
|
||||
|
||||
/*
|
||||
|
||||
this is the XML sample to be parsed by the function below NumberPix()
|
||||
this is the XML sample to be parsed by the function below NumberPix()
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<camrply><result>ok</result><current_position>341</current_position><total_content_number>372</total_content_number><content_number>342</content_number></camrply>
|
||||
|
||||
@@ -682,9 +682,9 @@ NumberPix(Camera *camera) {
|
||||
int numpics = 0;
|
||||
char *temp = loadCmd(camera,"cam.cgi?mode=get_content_info");
|
||||
xmlDocPtr doc = xmlParseDoc((unsigned char*) temp);
|
||||
xmlNodePtr cur = NULL;
|
||||
xmlNodePtr cur = NULL;
|
||||
|
||||
cur = xmlDocGetRootElement(doc);
|
||||
cur = xmlDocGetRootElement(doc);
|
||||
|
||||
if (cur == NULL) {
|
||||
GP_LOG_E("empty xml result document");
|
||||
@@ -724,7 +724,7 @@ NumberPix(Camera *camera) {
|
||||
return numpics;
|
||||
}
|
||||
|
||||
/*utility function to creat a SOAP envelope for the lumix cam */
|
||||
/*utility function to creat a SOAP envelope for the lumix cam */
|
||||
static char*
|
||||
SoapEnvelop(int start, int num){
|
||||
static char Envelop[1000];
|
||||
@@ -833,7 +833,7 @@ GetPixRange(Camera *camera, int start, int num) {
|
||||
}
|
||||
xchar = xmlNodeGetContent (output);
|
||||
GP_LOG_D("content of %s is %s", output->name, xchar);
|
||||
/*
|
||||
/*
|
||||
|
||||
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
|
||||
<item id="1030822" parentID="0" restricted="0">
|
||||
@@ -1103,7 +1103,7 @@ static struct aperturemap {
|
||||
};
|
||||
|
||||
static int
|
||||
camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
{
|
||||
CameraWidget *widget,*section;
|
||||
int ret, i, valset;
|
||||
@@ -1266,7 +1266,7 @@ camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
}
|
||||
|
||||
static int
|
||||
camera_config_set (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
camera_config_set (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
{
|
||||
CameraWidget *widget;
|
||||
char *val;
|
||||
@@ -1380,13 +1380,13 @@ camera_config_set (Camera *camera, CameraWidget *window, GPContext *context)
|
||||
|
||||
static char*
|
||||
processNode(xmlTextReaderPtr reader) {
|
||||
char* ret ="";
|
||||
char* ret ="";
|
||||
char* lookupImgtag="";
|
||||
|
||||
switch (ReadoutMode) {
|
||||
case 0 : //'jpg
|
||||
lookupImgtag = "CAM_RAW_JPG";
|
||||
break;
|
||||
break;
|
||||
case 1 :// 'raw
|
||||
lookupImgtag = "CAM_RAW";
|
||||
break;
|
||||
@@ -1540,16 +1540,16 @@ ReadImageFromCamera(Camera *camera, CameraFilePath *path, GPContext *context) {
|
||||
|
||||
switchToPlayMode (camera);
|
||||
|
||||
reader = xmlReaderForDoc((xmlChar*)GetPixRange(camera,NumberPix(camera)-1,1), NULL,"noname.xml", XML_PARSE_DTDATTR | /* default DTD attributes */ XML_PARSE_NOENT);
|
||||
reader = xmlReaderForDoc((xmlChar*)GetPixRange(camera,NumberPix(camera)-1,1), NULL,"noname.xml", XML_PARSE_DTDATTR | /* default DTD attributes */ XML_PARSE_NOENT);
|
||||
ret = xmlTextReaderRead(reader);
|
||||
while (ret == 1) {
|
||||
imageURL = processNode(reader);
|
||||
imageURL = processNode(reader);
|
||||
if (strlen(imageURL))
|
||||
break;
|
||||
break;
|
||||
ret = xmlTextReaderRead(reader);
|
||||
}
|
||||
|
||||
GP_DEBUG("the image URL is %s\n",imageURL);
|
||||
GP_DEBUG("the image URL is %s\n",imageURL);
|
||||
image = strdup(imageURL);
|
||||
nRead = 0;
|
||||
CURL* imageUrl;
|
||||
@@ -1635,8 +1635,8 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GP
|
||||
return ret;
|
||||
|
||||
|
||||
if (strcmp(cameraShutterSpeed, "B")!=0) {
|
||||
sleep(captureDuration); // Sleep for the duration to simulate exposure, if this is in Bulb mode
|
||||
if (strcmp(cameraShutterSpeed, "B")!=0) {
|
||||
sleep(captureDuration); // Sleep for the duration to simulate exposure, if this is in Bulb mode
|
||||
} else {
|
||||
sleep(3);
|
||||
}
|
||||
@@ -1668,7 +1668,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GP
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill out the summary with textual information about the current
|
||||
* Fill out the summary with textual information about the current
|
||||
* state of the camera (like pictures taken, etc.).
|
||||
*
|
||||
* This function is a method of the Camera object.
|
||||
@@ -1682,7 +1682,7 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
|
||||
/**
|
||||
* Return the camera drivers manual.
|
||||
* If you would like to tell the user some information about how
|
||||
* If you would like to tell the user some information about how
|
||||
* to use the camera or the driver, this is the place to do.
|
||||
*
|
||||
* This function is a method of the Camera object.
|
||||
@@ -1829,8 +1829,8 @@ int camera_abilities (CameraAbilitiesList *list) {
|
||||
a.status = GP_DRIVER_STATUS_EXPERIMENTAL;
|
||||
a.port = GP_PORT_IP;
|
||||
a.operations = GP_CAPTURE_IMAGE| GP_OPERATION_CAPTURE_VIDEO | GP_OPERATION_CONFIG;
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW ;
|
||||
/* it should be possible to browse and DL images the files using the ReadImageFromCamera() function but for now lets keep it simple*/
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW ;
|
||||
/* it should be possible to browse and DL images the files using the ReadImageFromCamera() function but for now lets keep it simple*/
|
||||
a.folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
return gp_abilities_list_append(list, a);
|
||||
}
|
||||
@@ -1865,7 +1865,7 @@ CameraFilesystemFuncs fsfuncs = {
|
||||
* This is a camlib API function.
|
||||
*/
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
GPPortInfo info;
|
||||
int ret;
|
||||
@@ -1920,7 +1920,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
|
||||
|
||||
int
|
||||
camera_id (CameraText *id)
|
||||
camera_id (CameraText *id)
|
||||
{
|
||||
strcpy(id->text, "Lumix Wifi");
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -68,11 +68,11 @@ static const struct {
|
||||
{"Precision Mini, Model HA513A", GP_DRIVER_STATUS_EXPERIMENTAL, 0x093a, 0x010f},
|
||||
{"Digital camera, CD302N", GP_DRIVER_STATUS_EXPERIMENTAL, 0x093a, 0x010e},
|
||||
{"INNOVAGE Mini Digital, CD302N", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010e},
|
||||
{"Argus DC-1610", GP_DRIVER_STATUS_EXPERIMENTAL, 0x093a, 0x010f},
|
||||
{"Argus DC-1620", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010f},
|
||||
{"Argus DC-1610", GP_DRIVER_STATUS_EXPERIMENTAL, 0x093a, 0x010f},
|
||||
{"Argus DC-1620", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010f},
|
||||
{"Philips P44417B keychain camera", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010e},
|
||||
{"Sakar Digital no. 77379", GP_DRIVER_STATUS_EXPERIMENTAL, 0x093a, 0x010f},
|
||||
{"ION digital camera", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010f},
|
||||
{"ION digital camera", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010f},
|
||||
{"Argus QuickClix", GP_DRIVER_STATUS_DEPRECATED, 0x093a, 0x010f},
|
||||
{"Pixart Gemini Keychain Camera", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010e},
|
||||
{"Sakar Digital no. 56379 Spyshot", GP_DRIVER_STATUS_TESTING, 0x093a, 0x010e},
|
||||
@@ -92,7 +92,7 @@ camera_id (CameraText *id)
|
||||
int
|
||||
camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
CameraAbilities a;
|
||||
|
||||
for (i = 0; models[i].name; i++) {
|
||||
@@ -108,8 +108,8 @@ camera_abilities (CameraAbilitiesList *list)
|
||||
else
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_NONE;
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW
|
||||
| GP_FILE_OPERATION_RAW;
|
||||
a.file_operations = GP_FILE_OPERATION_PREVIEW
|
||||
| GP_FILE_OPERATION_RAW;
|
||||
gp_abilities_list_append (list, a);
|
||||
}
|
||||
return GP_OK;
|
||||
@@ -124,25 +124,25 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
"Mars MR97310 camera.\nThere is %i photo in it.\n",
|
||||
"Mars MR97310 camera.\nThere are %i photos in it.\n",
|
||||
num_pics), num_pics
|
||||
);
|
||||
);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
|
||||
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
|
||||
{
|
||||
strcpy(manual->text,
|
||||
strcpy(manual->text,
|
||||
_(
|
||||
"This driver supports cameras with Mars MR97310 chip (and direct\n"
|
||||
"equivalents ??Pixart PACx07?\?).\n"
|
||||
"These cameras do not support deletion of photos, nor uploading\n"
|
||||
"of data.\n"
|
||||
"Decoding of compressed photos may or may not work well\n"
|
||||
"Decoding of compressed photos may or may not work well\n"
|
||||
"and does not work equally well for all supported cameras.\n"
|
||||
"Photo data processing for Argus QuickClix is NOT SUPPORTED.\n"
|
||||
"If present on the camera, video clip frames are downloaded \n"
|
||||
"as consecutive still photos.\n"
|
||||
"For further details please consult libgphoto2/camlibs/README.\n"
|
||||
));
|
||||
));
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ static int
|
||||
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
Camera *camera = data;
|
||||
int i = 0, n;
|
||||
char name[30];
|
||||
|
||||
@@ -169,7 +169,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
for (i=0; i < n; i++) {
|
||||
if ((camera->pl->info[8*i]&0x0f) == 1) {
|
||||
sprintf (name, "mr%03isnd.wav", i+1);
|
||||
} else
|
||||
} else
|
||||
sprintf (name, "mr%03ipic.ppm", i+1);
|
||||
gp_list_append (list, name, NULL);
|
||||
}
|
||||
@@ -191,9 +191,9 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFileType type, CameraFile *file, void *user_data,
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
Camera *camera = user_data;
|
||||
int w=0, h = 0, b = 0, k;
|
||||
unsigned char *data;
|
||||
unsigned char *data;
|
||||
unsigned char *ppm;
|
||||
unsigned char *p_data = NULL;
|
||||
unsigned char gtable[256], photo_code, res_code, compressed;
|
||||
@@ -209,11 +209,11 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
|
||||
/* Get the number of the photo on the camera */
|
||||
k = gp_filesystem_number (camera->fs, "/", filename, context);
|
||||
k = gp_filesystem_number (camera->fs, "/", filename, context);
|
||||
/* Determine the resolution setting from the PAT table */
|
||||
photo_code = camera->pl->info[8*k];
|
||||
res_code = photo_code & 0x0f;
|
||||
/* Compression presence or absence is seen here, and is given again
|
||||
/* Compression presence or absence is seen here, and is given again
|
||||
* by the camera, in the header of raw data for each photo.
|
||||
*/
|
||||
compressed = (photo_code >> 4) & 2;
|
||||
@@ -223,31 +223,31 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
case 2: w = 352; h = 288; break;
|
||||
case 6: w = 320; h = 240; break;
|
||||
case 8: w = 640; h = 480; break;
|
||||
default: w = 640; h = 480;
|
||||
default: w = 640; h = 480;
|
||||
}
|
||||
|
||||
GP_DEBUG ("height is %i\n", h);
|
||||
|
||||
|
||||
GP_DEBUG ("height is %i\n", h);
|
||||
|
||||
b = mars_get_pic_data_size(camera->pl->info, k);
|
||||
raw_size = b;
|
||||
/* Now increase b from "actual size" to _downloaded_ size. */
|
||||
b = ((b+ 0x1b0)/0x2000 + 1) * 0x2000;
|
||||
|
||||
if (w*h > b) {
|
||||
GP_DEBUG ("w=%d, h=%d, w*h=%d, bytes read=%d\n", w,h,w*h,b);
|
||||
GP_DEBUG ("w=%d, h=%d, w*h=%d, bytes read=%d\n", w,h,w*h,b);
|
||||
return GP_ERROR_CORRUPTED_DATA;
|
||||
}
|
||||
|
||||
data = calloc (b,1);
|
||||
if (!data) return GP_ERROR_NO_MEMORY;
|
||||
|
||||
GP_DEBUG ("buffersize= %i = 0x%x bytes\n", b,b);
|
||||
GP_DEBUG ("buffersize= %i = 0x%x bytes\n", b,b);
|
||||
|
||||
mars_read_picture_data (camera, camera->pl->info,
|
||||
mars_read_picture_data (camera, camera->pl->info,
|
||||
camera->port, (char *)data, b, k);
|
||||
/* The first 128 bytes are junk, so we toss them.*/
|
||||
memmove(data, data+128, b - 128);
|
||||
if (audio) {
|
||||
if (audio) {
|
||||
p_data = malloc (raw_size+256);
|
||||
if (!p_data) {free (data); return GP_ERROR_NO_MEMORY;}
|
||||
memset (p_data, 0, raw_size+256);
|
||||
@@ -271,7 +271,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
p_data[40] = (raw_size)&0xff;
|
||||
p_data[41] = ((raw_size)>>8)&0xff;
|
||||
p_data[42] = ((raw_size)>>16)&0xff;
|
||||
p_data[43] = ((raw_size)>>24)&0xff;
|
||||
p_data[43] = ((raw_size)>>24)&0xff;
|
||||
memcpy (p_data+44, data, raw_size);
|
||||
gp_file_set_mime_type(file, GP_MIME_WAV);
|
||||
gp_file_set_data_and_size(file, (char *)p_data , raw_size+44);
|
||||
@@ -281,14 +281,14 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
if (GP_FILE_TYPE_RAW == type) {
|
||||
|
||||
/* We keep the SOF marker. Actual data starts at byte 12.
|
||||
* Byte 6, upper nibble, is a code for compression mode. We
|
||||
* Byte 6, upper nibble, is a code for compression mode. We
|
||||
* use the lower nibble to store the resolution code.
|
||||
* Then it is possible to know "everything" from a raw file.
|
||||
* Purpose of the info in bytes 7 thru 11 is currently unknown.
|
||||
* Purpose of the info in bytes 7 thru 11 is currently unknown.
|
||||
* A "raw" audio file will also have the WAV header prepended.
|
||||
* So do nothing to an audio file.
|
||||
* So do nothing to an audio file.
|
||||
*/
|
||||
if (!audio)
|
||||
if (!audio)
|
||||
data[6] = (data[6] | res_code);
|
||||
gp_file_set_mime_type(file, GP_MIME_RAW);
|
||||
gp_file_set_data_and_size(file, (char *)data , raw_size );
|
||||
@@ -303,7 +303,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
mars_decompress (data + 12, p_data, w, h);
|
||||
}
|
||||
else memcpy (p_data, data + 12, w*h);
|
||||
gamma_factor = sqrt((float)data[7]/100.);
|
||||
gamma_factor = sqrt((float)data[7]/100.);
|
||||
if (gamma_factor <= .60)
|
||||
gamma_factor = .60;
|
||||
free(data);
|
||||
@@ -318,7 +318,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
"# CREATOR: gphoto2, Mars library\n"
|
||||
"%d %d\n"
|
||||
"255\n", w, h);
|
||||
ptr = ppm + strlen ((char *)ppm);
|
||||
ptr = ppm + strlen ((char *)ppm);
|
||||
size = strlen ((char *)ppm) + (w * h * 3);
|
||||
GP_DEBUG ("size = %i\n", size);
|
||||
gp_ahd_decode (p_data, w , h , ptr, BAYER_TILE_RGGB);
|
||||
@@ -364,10 +364,10 @@ camera_init(Camera *camera, GPContext *context)
|
||||
camera->functions->summary = camera_summary;
|
||||
camera->functions->about = camera_about;
|
||||
camera->functions->exit = camera_exit;
|
||||
|
||||
|
||||
GP_DEBUG ("Initializing the camera\n");
|
||||
ret = gp_port_get_settings(camera->port,&settings);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) return ret;
|
||||
|
||||
switch (camera->port->type) {
|
||||
case GP_PORT_SERIAL:
|
||||
@@ -386,10 +386,10 @@ camera_init(Camera *camera, GPContext *context)
|
||||
}
|
||||
|
||||
ret = gp_port_set_settings(camera->port,settings);
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0) return ret;
|
||||
|
||||
GP_DEBUG("interface = %i\n", settings.usb.interface);
|
||||
GP_DEBUG("inep = %x\n", settings.usb.inep);
|
||||
GP_DEBUG("inep = %x\n", settings.usb.inep);
|
||||
GP_DEBUG("outep = %x\n", settings.usb.outep);
|
||||
|
||||
/* Tell the CameraFilesystem where to get lists from */
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -37,13 +37,13 @@
|
||||
|
||||
#include "mars.h"
|
||||
|
||||
#define GP_MODULE "mars"
|
||||
#define GP_MODULE "mars"
|
||||
|
||||
#define INIT 0xb5
|
||||
#define GET_DATA 0x0f
|
||||
|
||||
static int
|
||||
m_read (GPPort *port, char *data, int size)
|
||||
static int
|
||||
m_read (GPPort *port, char *data, int size)
|
||||
{
|
||||
int ret;
|
||||
ret = gp_port_write(port, "\x21", 1);
|
||||
@@ -52,8 +52,8 @@ m_read (GPPort *port, char *data, int size)
|
||||
return gp_port_read(port, data, 16);
|
||||
}
|
||||
|
||||
static int
|
||||
m_command (GPPort *port, char *command, int size, char *response)
|
||||
static int
|
||||
m_command (GPPort *port, char *command, int size, char *response)
|
||||
{
|
||||
gp_port_write(port, command, size);
|
||||
return m_read(port, response, 16);
|
||||
@@ -61,34 +61,34 @@ m_command (GPPort *port, char *command, int size, char *response)
|
||||
|
||||
static int mars_routine (Info *info, GPPort *port, char param, int n);
|
||||
|
||||
int
|
||||
mars_init (Camera *camera, GPPort *port, Info *info)
|
||||
int
|
||||
mars_init (Camera *camera, GPPort *port, Info *info)
|
||||
{
|
||||
char c[16];
|
||||
unsigned char status = 0;
|
||||
memset(info,0, sizeof(*info));
|
||||
memset(info,0, sizeof(*info));
|
||||
memset(c,0,sizeof(c));
|
||||
GP_DEBUG("Running mars_init\n");
|
||||
|
||||
/* Init routine done twice, usually. First time is a dry run. But if
|
||||
/* Init routine done twice, usually. First time is a dry run. But if
|
||||
* camera reports 0x02 it is "jammed" and we must clear it.
|
||||
*/
|
||||
*/
|
||||
|
||||
m_read(port, c, 16);
|
||||
m_read(port, c, 16);
|
||||
if (c[0] == 0x02) {
|
||||
gp_port_write(port, "\x19", 1);
|
||||
gp_port_read(port, c, 16);
|
||||
}
|
||||
else {
|
||||
status = mars_routine (info, port, INIT, 0);
|
||||
status = mars_routine (info, port, INIT, 0);
|
||||
GP_DEBUG("status = 0x%x\n", status);
|
||||
}
|
||||
|
||||
/* Not a typo. This _will_ download the config data ;) */
|
||||
mars_read_picture_data (camera, info, port, (char *)info, 0x2000, 0);
|
||||
mars_read_picture_data (camera, info, port, (char *)info, 0x2000, 0);
|
||||
|
||||
/* Removing extraneous line(s) of data. See "protocol.txt" */
|
||||
|
||||
|
||||
if ((info[0] == 0xff)&& (info[1] == 0)&&(info[2]==0xff))
|
||||
memmove(info, info + 16, 0x1ff0); /* Saving config */
|
||||
else
|
||||
@@ -98,12 +98,12 @@ mars_init (Camera *camera, GPPort *port, Info *info)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int
|
||||
mars_get_num_pics (Info *info)
|
||||
int
|
||||
mars_get_num_pics (Info *info)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
for (i = 0; i < 0x3fe; i++)
|
||||
for (i = 0; i < 0x3fe; i++)
|
||||
if ( !(0xff - info[8*i]) ) {
|
||||
GP_DEBUG ( "i is %i\n", i);
|
||||
memcpy(info+0x1ff0, "i", 1);
|
||||
@@ -120,25 +120,25 @@ mars_get_pic_data_size (Info *info, int n)
|
||||
return (info[8*n+6]*0x100 + info[8*n+5])*0x100 + info[8*n+4];
|
||||
}
|
||||
|
||||
static int
|
||||
set_usb_in_endpoint (Camera *camera, int inep)
|
||||
static int
|
||||
set_usb_in_endpoint (Camera *camera, int inep)
|
||||
{
|
||||
GPPortSettings settings;
|
||||
gp_port_get_settings ( camera ->port, &settings);
|
||||
settings.usb.inep = inep;
|
||||
GP_DEBUG("inep reset to %02X\n", inep);
|
||||
return gp_port_set_settings ( camera ->port, settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mars_read_data (GPPort *port, char *data, int size)
|
||||
{
|
||||
static int
|
||||
mars_read_data (GPPort *port, char *data, int size)
|
||||
{
|
||||
int MAX_BULK = 0x2000;
|
||||
int len = 0;
|
||||
while(size > 0) {
|
||||
len = (size>MAX_BULK)?MAX_BULK:size;
|
||||
gp_port_read (port, data, len);
|
||||
gp_port_read (port, data, len);
|
||||
data += len;
|
||||
size -= len;
|
||||
}
|
||||
@@ -146,22 +146,22 @@ mars_read_data (GPPort *port, char *data, int size)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
mars_read_picture_data (Camera *camera, Info *info, GPPort *port,
|
||||
char *data, int size, int n)
|
||||
int
|
||||
mars_read_picture_data (Camera *camera, Info *info, GPPort *port,
|
||||
char *data, int size, int n)
|
||||
|
||||
{
|
||||
unsigned char c[16];
|
||||
|
||||
|
||||
memset(c,0,sizeof(c));
|
||||
/*Initialization routine for download. */
|
||||
mars_routine (info, port, GET_DATA, n);
|
||||
/*Data transfer begins*/
|
||||
set_usb_in_endpoint (camera, 0x82);
|
||||
mars_read_data (port, data, size);
|
||||
set_usb_in_endpoint (camera, 0x83);
|
||||
set_usb_in_endpoint (camera, 0x82);
|
||||
mars_read_data (port, data, size);
|
||||
set_usb_in_endpoint (camera, 0x83);
|
||||
return GP_OK;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
mars_reset (GPPort *port)
|
||||
@@ -286,7 +286,7 @@ int mars_decompress (unsigned char *inp, unsigned char *outp, int width,
|
||||
}else if (col < 2) {
|
||||
/* left column: relative to top pixel */
|
||||
/* initial estimate */
|
||||
val += (tp + trp)/2;
|
||||
val += (tp + trp)/2;
|
||||
}else if (col > width - 3) {
|
||||
/* left column: relative to top pixel */
|
||||
val += (tp + lp + tlp +1)/3;
|
||||
@@ -306,12 +306,12 @@ int mars_decompress (unsigned char *inp, unsigned char *outp, int width,
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
mars_routine (Info *info, GPPort *port, char param, int n)
|
||||
static int
|
||||
mars_routine (Info *info, GPPort *port, char param, int n)
|
||||
{
|
||||
char c[16];
|
||||
char start[2] = {0x19, 0x51};
|
||||
char do_something[2];
|
||||
char do_something[2];
|
||||
char address1[2];
|
||||
char address2[2];
|
||||
char address3[2];
|
||||
@@ -319,7 +319,7 @@ mars_routine (Info *info, GPPort *port, char param, int n)
|
||||
char address5[2];
|
||||
char address6[2];
|
||||
|
||||
do_something[0]= 0x19;
|
||||
do_something[0]= 0x19;
|
||||
do_something[1]=param;
|
||||
|
||||
/* See protocol.txt for my theories about what these mean. */
|
||||
@@ -340,19 +340,19 @@ mars_routine (Info *info, GPPort *port, char param, int n)
|
||||
memset(c,0,sizeof(c));
|
||||
|
||||
/*Routine used in initialization, photo download, and reset. */
|
||||
m_read(port, c, 16);
|
||||
m_read(port, c, 16);
|
||||
m_command(port, start, 2, c);
|
||||
m_command(port, do_something, 2, c);
|
||||
m_command(port, address1, 2, c);
|
||||
|
||||
c[0] = 0;
|
||||
gp_port_write(port, address2, 2);
|
||||
gp_port_write(port, address2, 2);
|
||||
/* Moving the memory cursor to the given address? */
|
||||
while (( c[0] != 0xa) ) {
|
||||
while (( c[0] != 0xa) ) {
|
||||
if (m_read(port, c, 16) < 16)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
m_command(port, address3, 2, c);
|
||||
m_command(port, address4, 2, c);
|
||||
m_command(port, address5, 2, c);
|
||||
@@ -360,7 +360,7 @@ mars_routine (Info *info, GPPort *port, char param, int n)
|
||||
gp_port_write(port, "\x19", 1);
|
||||
gp_port_read(port, c , 16);
|
||||
/* Next thing is to switch the inep. Some cameras need a pause here */
|
||||
usleep (MARS_SLEEP);
|
||||
usleep (MARS_SLEEP);
|
||||
|
||||
return(c[0]);
|
||||
}
|
||||
@@ -389,10 +389,10 @@ histogram (unsigned char *data, unsigned int size, int *htable_r, int *htable_g,
|
||||
{
|
||||
int x;
|
||||
/* Initializations */
|
||||
for (x = 0; x < 0x100; x++) {
|
||||
htable_r[x] = 0;
|
||||
htable_g[x] = 0;
|
||||
htable_b[x] = 0;
|
||||
for (x = 0; x < 0x100; x++) {
|
||||
htable_r[x] = 0;
|
||||
htable_g[x] = 0;
|
||||
htable_b[x] = 0;
|
||||
}
|
||||
/* Building the histograms */
|
||||
for (x = 0; x < (size * 3); x += 3)
|
||||
@@ -420,9 +420,9 @@ mars_white_balance (unsigned char *data, unsigned int size, float saturation,
|
||||
x = 1;
|
||||
for (r = 48; r < 208; r++)
|
||||
{
|
||||
x += htable_r[r];
|
||||
x += htable_r[r];
|
||||
x += htable_g[r];
|
||||
x += htable_r[r];
|
||||
x += htable_r[r];
|
||||
}
|
||||
new_gamma = sqrt((double) (x * 1.5) / (double) (size * 3));
|
||||
x=0;
|
||||
@@ -439,14 +439,14 @@ mars_white_balance (unsigned char *data, unsigned int size, float saturation,
|
||||
gp_gamma_fill_table(gtable, gamma);
|
||||
|
||||
/* ---------------- BRIGHT DOTS ------------------- */
|
||||
max = size / 200;
|
||||
max = size / 200;
|
||||
histogram(data, size, htable_r, htable_g, htable_b);
|
||||
|
||||
for (r=0xfe, x=0; (r > 32) && (x < max); r--)
|
||||
x += htable_r[r];
|
||||
for (g=0xfe, x=0; (g > 32) && (x < max); g--)
|
||||
for (r=0xfe, x=0; (r > 32) && (x < max); r--)
|
||||
x += htable_r[r];
|
||||
for (g=0xfe, x=0; (g > 32) && (x < max); g--)
|
||||
x += htable_g[g];
|
||||
for (b=0xfe, x=0; (b > 32) && (x < max); b--)
|
||||
for (b=0xfe, x=0; (b > 32) && (x < max); b--)
|
||||
x += htable_b[b];
|
||||
r_factor = (double) 0xfd / r;
|
||||
g_factor = (double) 0xfd / g;
|
||||
@@ -483,11 +483,11 @@ mars_white_balance (unsigned char *data, unsigned int size, float saturation,
|
||||
max = size / 200; /* 1/200 = 0.5% */
|
||||
histogram(data, size, htable_r, htable_g, htable_b);
|
||||
|
||||
for (r=0, x=0; (r < 96) && (x < max); r++)
|
||||
x += htable_r[r];
|
||||
for (g=0, x=0; (g < 96) && (x < max); g++)
|
||||
for (r=0, x=0; (r < 96) && (x < max); r++)
|
||||
x += htable_r[r];
|
||||
for (g=0, x=0; (g < 96) && (x < max); g++)
|
||||
x += htable_g[g];
|
||||
for (b=0, x=0; (b < 96) && (x < max); b++)
|
||||
for (b=0, x=0; (b < 96) && (x < max); b++)
|
||||
x += htable_b[b];
|
||||
|
||||
r_factor = (double) 0xfe / (0xff-r);
|
||||
@@ -504,7 +504,7 @@ mars_white_balance (unsigned char *data, unsigned int size, float saturation,
|
||||
b_factor = (b_factor / max_factor) * 1.15;
|
||||
}
|
||||
GP_DEBUG(
|
||||
"White balance (dark): r=%1d, g=%1d, b=%1d, fr=%1.3f, fg=%1.3f, fb=%1.3f\n",
|
||||
"White balance (dark): r=%1d, g=%1d, b=%1d, fr=%1.3f, fg=%1.3f, fb=%1.3f\n",
|
||||
r, g, b, r_factor, g_factor, b_factor);
|
||||
|
||||
for (x = 0; x < (size * 3); x += 3)
|
||||
@@ -532,15 +532,15 @@ mars_white_balance (unsigned char *data, unsigned int size, float saturation,
|
||||
d = (int) (r + g + b) /3.;
|
||||
if ( r > d )
|
||||
r = r + (int) ((r - d) * (0xff-r)/(0x100-d) * saturation);
|
||||
else
|
||||
else
|
||||
r = r + (int) ((r - d) * (0xff-d)/(0x100-r) * saturation);
|
||||
if (g > d)
|
||||
g = g + (int) ((g - d) * (0xff-g)/(0x100-d) * saturation);
|
||||
else
|
||||
else
|
||||
g = g + (int) ((g - d) * (0xff-d)/(0x100-g) * saturation);
|
||||
if (b > d)
|
||||
b = b + (int) ((b - d) * (0xff-b)/(0x100-d) * saturation);
|
||||
else
|
||||
else
|
||||
b = b + (int) ((b - d) * (0xff-d)/(0x100-b) * saturation);
|
||||
data[x+0] = CLAMP(r);
|
||||
data[x+1] = CLAMP(g);
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
@@ -46,7 +46,7 @@ int mars_read_picture_data (Camera *camera, Info *info,
|
||||
GPPort *port, char *data, int size, int n);
|
||||
|
||||
int mars_decompress (unsigned char *inp ,unsigned char *outp, int w, int h);
|
||||
int histogram (unsigned char *data, unsigned int size, int *htable_r,
|
||||
int histogram (unsigned char *data, unsigned int size, int *htable_r,
|
||||
int *htable_g, int *htable_b);
|
||||
int mars_white_balance (unsigned char *data, unsigned int size, float saturation,
|
||||
float image_gamma);
|
||||
|
||||
@@ -73,23 +73,23 @@ int dimagev_shutter(dimagev_t *dimagev) {
|
||||
|
||||
if ( gp_port_write(dimagev->dev, (char *)p->buffer, p->length) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_shutter::unable to write packet");
|
||||
|
||||
|
||||
if ( p != NULL ) {
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
if ( p != NULL ) {
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( sleep(1) != 0 ) {
|
||||
GP_DEBUG( "dimagev_shutter::sleep() returned non-zero value");
|
||||
}
|
||||
|
||||
|
||||
if ( gp_port_read(dimagev->dev, (char *)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_shutter::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
@@ -116,7 +116,7 @@ int dimagev_shutter(dimagev_t *dimagev) {
|
||||
if ( sleep(1) != 0 ) {
|
||||
GP_DEBUG( "dimagev_shutter::sleep() returned non-zero value");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( ( p = dimagev_read_packet(dimagev) ) == NULL ) {
|
||||
GP_DEBUG( "dimagev_shutter::unable to read packet");
|
||||
@@ -148,7 +148,7 @@ int dimagev_shutter(dimagev_t *dimagev) {
|
||||
GP_DEBUG( "dimagev_shutter::unable to send EOT");
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
if ( gp_port_read(dimagev->dev, (char *)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_shutter::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
|
||||
@@ -86,7 +86,7 @@ int dimagev_get_camera_data(dimagev_t *dimagev) {
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_get_camera_data::no response from camera");
|
||||
free(p);
|
||||
@@ -168,7 +168,7 @@ int dimagev_send_data(dimagev_t *dimagev) {
|
||||
free(export_data);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
switch ( char_buffer ) {
|
||||
@@ -203,7 +203,7 @@ int dimagev_send_data(dimagev_t *dimagev) {
|
||||
}
|
||||
|
||||
free(p);
|
||||
|
||||
|
||||
if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
@@ -229,7 +229,7 @@ int dimagev_send_data(dimagev_t *dimagev) {
|
||||
GP_DEBUG( "dimagev_send_data::unable to send EOT");
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
if ( gp_port_read(dimagev->dev, (char*)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_send_data::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
|
||||
@@ -73,7 +73,7 @@ int dimagev_delete_picture(dimagev_t *dimagev, int file_number) {
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
switch ( char_buffer ) {
|
||||
@@ -90,7 +90,7 @@ int dimagev_delete_picture(dimagev_t *dimagev, int file_number) {
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( ( p = dimagev_read_packet(dimagev) ) == NULL ) {
|
||||
GP_DEBUG( "dimagev_delete_picture::unable to read packet");
|
||||
return GP_ERROR_IO;
|
||||
@@ -101,7 +101,7 @@ int dimagev_delete_picture(dimagev_t *dimagev, int file_number) {
|
||||
free(p);
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
if ( raw->buffer[0] != (unsigned char) 0 ) {
|
||||
@@ -121,7 +121,7 @@ int dimagev_delete_picture(dimagev_t *dimagev, int file_number) {
|
||||
GP_DEBUG( "dimagev_delete_picture::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
switch ( char_buffer ) {
|
||||
case DIMAGEV_ACK:
|
||||
break;
|
||||
@@ -183,7 +183,7 @@ int dimagev_delete_all(dimagev_t *dimagev) {
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
switch ( char_buffer ) {
|
||||
@@ -200,7 +200,7 @@ int dimagev_delete_all(dimagev_t *dimagev) {
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( ( p = dimagev_read_packet(dimagev) ) == NULL ) {
|
||||
GP_DEBUG( "dimagev_delete_all::unable to read packet");
|
||||
return GP_ERROR_IO;
|
||||
@@ -211,7 +211,7 @@ int dimagev_delete_all(dimagev_t *dimagev) {
|
||||
free(p);
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
if ( raw->buffer[0] != (unsigned char) 0 ) {
|
||||
@@ -231,7 +231,7 @@ int dimagev_delete_all(dimagev_t *dimagev) {
|
||||
GP_DEBUG( "dimagev_delete_all::no response from camera");
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
switch ( char_buffer ) {
|
||||
case DIMAGEV_ACK:
|
||||
break;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#define GP_MODULE "dimagev"
|
||||
|
||||
int camera_id (CameraText *id)
|
||||
int camera_id (CameraText *id)
|
||||
{
|
||||
#if defined HAVE_STRNCPY
|
||||
strncpy(id->text, "minolta-dimagev", sizeof(id->text));
|
||||
@@ -55,7 +55,7 @@ int camera_id (CameraText *id)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int camera_abilities (CameraAbilitiesList *list)
|
||||
int camera_abilities (CameraAbilitiesList *list)
|
||||
{
|
||||
CameraAbilities a;
|
||||
|
||||
@@ -71,9 +71,9 @@ int camera_abilities (CameraAbilitiesList *list)
|
||||
a.speed[1] = 0;
|
||||
a.operations = GP_OPERATION_CAPTURE_IMAGE |
|
||||
GP_OPERATION_CAPTURE_PREVIEW;
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
a.file_operations = GP_FILE_OPERATION_DELETE |
|
||||
GP_FILE_OPERATION_PREVIEW;
|
||||
a.folder_operations = GP_FOLDER_OPERATION_PUT_FILE |
|
||||
a.folder_operations = GP_FOLDER_OPERATION_PUT_FILE |
|
||||
GP_FOLDER_OPERATION_DELETE_ALL;
|
||||
|
||||
gp_abilities_list_append(list, a);
|
||||
@@ -81,7 +81,7 @@ int camera_abilities (CameraAbilitiesList *list)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int camera_exit (Camera *camera, GPContext *context)
|
||||
static int camera_exit (Camera *camera, GPContext *context)
|
||||
{
|
||||
/* Set the camera back into a normal mode. */
|
||||
if (camera->pl) {
|
||||
@@ -114,8 +114,8 @@ static int camera_exit (Camera *camera, GPContext *context)
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
int ret;
|
||||
@@ -129,13 +129,13 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
GP_DEBUG( "camera_file_list::unable to populate list");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, CameraFileType type,
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
int file_number=0, result;
|
||||
@@ -166,9 +166,9 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, void *data,
|
||||
GPContext *context)
|
||||
GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
int file_number=0;
|
||||
@@ -180,7 +180,7 @@ static int delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
return dimagev_delete_picture(camera->pl, (file_number + 1 ));
|
||||
}
|
||||
|
||||
static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
|
||||
static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
|
||||
{
|
||||
if (type != GP_CAPTURE_IMAGE)
|
||||
return (GP_ERROR_NOT_SUPPORTED);
|
||||
@@ -211,7 +211,7 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
|
||||
}
|
||||
|
||||
static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
CameraFileType type, CameraFile *file, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
@@ -219,14 +219,14 @@ static int put_file_func (CameraFilesystem *fs, const char *folder, const char *
|
||||
}
|
||||
|
||||
static int delete_all_func (CameraFilesystem *fs, const char *folder,
|
||||
void *data, GPContext *context)
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
|
||||
return dimagev_delete_all(camera->pl);
|
||||
}
|
||||
|
||||
static int camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
static int camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
{
|
||||
int i = 0, count = 0;
|
||||
|
||||
@@ -408,7 +408,7 @@ static int camera_summary (Camera *camera, CameraText *summary, GPContext *conte
|
||||
i = snprintf(&(summary->text[count]), sizeof(summary->text) - count, _("Bad value for card status %d"), camera->pl->status->card_status);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( i > 0 ) {
|
||||
count += i;
|
||||
}
|
||||
@@ -417,7 +417,7 @@ static int camera_summary (Camera *camera, CameraText *summary, GPContext *conte
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
{
|
||||
#if defined HAVE_SNPRINTF
|
||||
snprintf(about->text, sizeof(about->text),
|
||||
@@ -437,7 +437,7 @@ static CameraFilesystemFuncs fsfuncs = {
|
||||
.delete_all_func = delete_all_func,
|
||||
};
|
||||
|
||||
int camera_init (Camera *camera, GPContext *context)
|
||||
int camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
GPPortSettings settings;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ int dimagev_get_picture(dimagev_t *dimagev, int file_number, CameraFile *file) {
|
||||
GP_DEBUG( "dimagev_get_picture::file_number is %d", file_number);
|
||||
|
||||
/* Maybe check if it exists? Check the file type? */
|
||||
|
||||
|
||||
/* First make the command packet. */
|
||||
command_buffer[0] = 0x04;
|
||||
command_buffer[1] = (unsigned char)( file_number / 256 );
|
||||
@@ -66,7 +66,7 @@ int dimagev_get_picture(dimagev_t *dimagev, int file_number, CameraFile *file) {
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
switch ( char_buffer ) {
|
||||
@@ -94,7 +94,7 @@ int dimagev_get_picture(dimagev_t *dimagev, int file_number, CameraFile *file) {
|
||||
free(p);
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
total_packets = (int) r->buffer[0];
|
||||
@@ -118,7 +118,7 @@ int dimagev_get_picture(dimagev_t *dimagev, int file_number, CameraFile *file) {
|
||||
free(data);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
if ( ( p = dimagev_read_packet(dimagev) ) == NULL ) {
|
||||
/*
|
||||
GP_DEBUG( "dimagev_get_picture::unable to read packet");
|
||||
@@ -146,7 +146,7 @@ int dimagev_get_picture(dimagev_t *dimagev, int file_number, CameraFile *file) {
|
||||
free(p);
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
memcpy(&( data[ ( size + 1) ] ), r->buffer, (size_t) r->length );
|
||||
@@ -169,7 +169,7 @@ int dimagev_get_picture(dimagev_t *dimagev, int file_number, CameraFile *file) {
|
||||
free(data);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
switch ( char_buffer ) {
|
||||
case DIMAGEV_ACK:
|
||||
break;
|
||||
@@ -226,7 +226,7 @@ int dimagev_get_thumbnail(dimagev_t *dimagev, int file_number, CameraFile *file)
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
switch ( char_buffer ) {
|
||||
@@ -254,7 +254,7 @@ int dimagev_get_thumbnail(dimagev_t *dimagev, int file_number, CameraFile *file)
|
||||
free(p);
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
/* Unlike normal images, we are guaranteed 9600 bytes *exactly*. */
|
||||
@@ -279,7 +279,7 @@ int dimagev_get_thumbnail(dimagev_t *dimagev, int file_number, CameraFile *file)
|
||||
free(ycrcb_data);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
if ( ( p = dimagev_read_packet(dimagev) ) == NULL ) {
|
||||
GP_DEBUG( "dimagev_get_thumbnail::unable to read packet");
|
||||
free(ycrcb_data);
|
||||
@@ -292,7 +292,7 @@ int dimagev_get_thumbnail(dimagev_t *dimagev, int file_number, CameraFile *file)
|
||||
free(ycrcb_data);
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
memcpy(&( ycrcb_data[ ( size + 1) ] ), r->buffer, (size_t) r->length );
|
||||
@@ -317,7 +317,7 @@ int dimagev_get_thumbnail(dimagev_t *dimagev, int file_number, CameraFile *file)
|
||||
free(ycrcb_data);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
switch ( char_buffer ) {
|
||||
case DIMAGEV_ACK:
|
||||
break;
|
||||
|
||||
@@ -93,7 +93,7 @@ int dimagev_get_camera_info(dimagev_t *dimagev) {
|
||||
free(p);
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
|
||||
if ( gp_port_read(dimagev->dev, (char *)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_get_camera_info::no response from camera");
|
||||
free(p);
|
||||
|
||||
@@ -50,14 +50,14 @@
|
||||
dimagev_packet *dimagev_make_packet(const unsigned char *const buffer, unsigned int length, unsigned int seq) {
|
||||
unsigned int i=0, checksum=0;
|
||||
dimagev_packet *p;
|
||||
|
||||
|
||||
if ( ( p = calloc(1, sizeof(dimagev_packet) ) ) == NULL ) {
|
||||
GP_DEBUG("dimagev_make_packet::unable to allocate packet");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p->length = length + 7;
|
||||
|
||||
|
||||
p->buffer[0] = DIMAGEV_STX;
|
||||
p->buffer[1] = seq & 0x000000ff;
|
||||
p->buffer[2] = ( p->length & 0x0000ff00) >> 8;
|
||||
@@ -73,7 +73,7 @@ dimagev_packet *dimagev_make_packet(const unsigned char *const buffer, unsigned
|
||||
p->buffer[(p->length - 3)] = (unsigned char) ((checksum & 0x0000ff00) >> 8 );
|
||||
p->buffer[(p->length - 2)] = (unsigned char) ( checksum & 0x000000ff );
|
||||
p->buffer[(p->length - 1)] = (unsigned char) DIMAGEV_ETX;
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -149,14 +149,14 @@ dimagev_packet *dimagev_read_packet(dimagev_t *dimagev) {
|
||||
if ( dimagev_verify_packet(p) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_read_packet::got an invalid packet - will try to send NAK");
|
||||
free(p);
|
||||
|
||||
|
||||
/* Send a NAK */
|
||||
char_buffer = DIMAGEV_NAK;
|
||||
if ( gp_port_write(dimagev->dev, (char *)&char_buffer, 1) < GP_OK ) {
|
||||
GP_DEBUG( "dimagev_read_packet::unable to send NAK");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Who likes recursion? */
|
||||
return dimagev_read_packet(dimagev);
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ int dimagev_get_camera_status(dimagev_t *dimagev) {
|
||||
free(p);
|
||||
return GP_ERROR;
|
||||
}
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
if ( ( dimagev->status = dimagev_import_camera_status(raw->buffer) ) == NULL ) {
|
||||
@@ -136,7 +136,7 @@ dimagev_status_t *dimagev_import_camera_status(unsigned char *raw_data) {
|
||||
if ( raw_data == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if ( ( processed_data = malloc(sizeof(dimagev_status_t)) ) == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user