fix white-space and indentation inconsistencies (second round)

This is basically a continuation of the work from #1002 but her for the
camlibs directory. The purpose was to replace spaces as a means for
indentation with tab characters.

Note: there are some files which are still offending the general
rule but are (mostly) consistent within themselves. I let them be for
the moment. Fixing them would basically replace the whole file.

Also: there are still a ton of whitespace related inconsistencies like
"x=10" vs "x = 10" or "func(10)" vs "func (10)".

This is a whitespace only change (if you include newlines as whitespace).
This commit is contained in:
axxel
2024-09-14 18:26:05 +02:00
committed by Marcus Meissner
parent e68b3ea37b
commit f41df32817
123 changed files with 5139 additions and 5244 deletions

View File

@@ -74,15 +74,15 @@ adc65_ping(Camera *camera) {
static int
adc65_file_count (Camera *camera) {
unsigned char cmd, resp[65538];
unsigned char cmd, resp[65538];
int ret;
GP_DEBUG("Getting the number of pictures.");
cmd = 0x00;
ret = adc65_exchange(camera, &cmd, 1, resp, 65538);
GP_DEBUG("Getting the number of pictures.");
cmd = 0x00;
ret = adc65_exchange(camera, &cmd, 1, resp, 65538);
if (ret < 2) /* must have at least a 2 byte reply */
return ret;
return resp[1] - 1;
return ret;
return resp[1] - 1;
}
static char *
@@ -102,7 +102,7 @@ adc65_read_data (Camera *camera, unsigned char *cmd, int cmd_size, int data_type
/* get the picture */
ret = adc65_exchange (camera, cmd, cmd_size, resp, 2);
if (ret < 2)
return NULL;
return NULL;
us = malloc (65536);
if (!us)
@@ -224,23 +224,23 @@ get_file_func ( CameraFilesystem *fs, const char *folder,
CameraFile *file, void *user_data, GPContext *context)
{
Camera *camera = user_data;
int size, num;
char *data;
int size, num;
char* data;
gp_file_set_mime_type (file, GP_MIME_PPM);
num = gp_filesystem_number (fs, folder, filename, context);
gp_file_set_mime_type (file, GP_MIME_PPM);
num = gp_filesystem_number (fs, folder, filename, context);
if (num < 0)
return num;
data = adc65_read_picture (camera, num, &size);
if (!data)
data = adc65_read_picture (camera, num, &size);
if (!data)
return GP_ERROR;
return gp_file_append (file,data,size);
return gp_file_append (file, data, size);
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context) {
strcpy (about->text, _("Adc65\nBenjamin Moos <benjamin@psnw.com>"));
return GP_OK;
strcpy (about->text, _("Adc65\nBenjamin Moos <benjamin@psnw.com>"));
return GP_OK;
}
static CameraFilesystemFuncs fsfuncs = {

View File

@@ -233,8 +233,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
result[19] = 0x00;
memmove(&result[20],
&result[app1len + 4],
(unsigned int)(size - app1len - 4));
&result[app1len + 4],
(unsigned int)(size - app1len - 4));
size = size - app1len + 20 + 4;
@@ -439,8 +439,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
result[19] = 0x00;
memmove(&result[20],
&result[app1len + 4],
(unsigned int)(size - app1len - 4));
&result[app1len + 4],
(unsigned int)(size - app1len - 4));
size = size - app1len + 24;
@@ -664,10 +664,10 @@ camera_init (Camera *camera, GPContext *context)
GP_DEBUG(" * camera_init()");
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* Now, tell the filesystem where to get lists, files and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);

View File

@@ -49,27 +49,27 @@ 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]);
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);
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.*/
memcpy (info + 1, &hi[0], 1);
READ(port, 0x04, 0x6, 0x1, c, 2); /* "Completion" flag.*/
GP_DEBUG("info[0] = 0x%x\n", info[0]);
GP_DEBUG("info[1] = 0x%x\n", info[1]);
GP_DEBUG("Leaving aox_init\n");
return GP_OK;
return GP_OK;
}
@@ -89,16 +89,16 @@ int aox_get_picture_size (GPPort *port, int lo, int hi, int n, int k)
{
unsigned char c[4];
unsigned int size;
unsigned int size;
memset (c,0,4);
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);
size = (int)c[0] + (int)c[1]*0x100 + (int)c[2]*0x10000;
@@ -113,21 +113,21 @@ static int aox_read_data (GPPort *port, char *data, int size)
{
int MAX_BULK = 0x1000;
while(size > 0) {
int len = (size>MAX_BULK)?MAX_BULK:size;
gp_port_read (port, data, len); /* 0x84 = EP IN NEEDED HERE.*/
data += len;
while (size > 0) {
int len = (size > MAX_BULK) ? MAX_BULK : size;
gp_port_read (port, data, len); /* 0x84 = EP IN NEEDED HERE.*/
data += len;
size -= len;
}
return 1;
return 1;
}
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);
aox_read_data (port, data , size);
READ(port, 0x06, n + 1, 0x1, c, 4);
aox_read_data (port, data, size);
return GP_OK;
return GP_OK;
}

View File

@@ -56,81 +56,81 @@ struct _CameraPrivateLibrary {
};
static struct {
char *name;
char *name;
CameraDriverStatus status;
unsigned short idVendor;
unsigned short idProduct;
unsigned short idVendor;
unsigned short idProduct;
} 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},
{"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},
{NULL,0,0,0}
};
int
camera_id (CameraText *id)
{
strcpy (id->text, "Aox chipset camera");
return GP_OK;
strcpy (id->text, "Aox chipset camera");
return GP_OK;
}
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
int i;
CameraAbilities a;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
if (a.status == GP_DRIVER_STATUS_EXPERIMENTAL)
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product = models[i].idProduct;
if (a.status == GP_DRIVER_STATUS_EXPERIMENTAL)
a.operations = GP_OPERATION_NONE;
else
a.operations = GP_OPERATION_CAPTURE_IMAGE;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW;
gp_abilities_list_append (list, a);
}
return GP_OK;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW;
gp_abilities_list_append (list, a);
}
return GP_OK;
}
static int
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_lo_pics = aox_get_num_lo_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 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;
return GP_OK;
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("Aox generic driver\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
return GP_OK;
strcpy (about->text, _("Aox generic driver\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
return GP_OK;
}
/*************** File and Downloading Functions *******************/
static int
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
void *data, GPContext *context)
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;
@@ -148,7 +148,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
snprintf( name, sizeof(name), "aox_pic%03i.ppm", i+1 );
gp_list_append(list, name, NULL);
}
return GP_OK;
return GP_OK;
}
static int
@@ -156,7 +156,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;
/* The camera will always download the low-resolution pictures first, if any.
* As those are compressed, they are not of fixed size. Unfortunately, the
@@ -166,7 +166,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
* 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;
@@ -204,7 +204,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
data = malloc(len);
if (!data) {
printf("Malloc failed\n"); return 0;}
aox_read_picture_data (camera->port, (char *)data, len, n);
aox_read_picture_data (camera->port, (char *)data, len, n);
switch (type) {
case GP_FILE_TYPE_EXIF:
@@ -229,19 +229,19 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
/* Stripping useless header */
p_data = data + 0x98;
/* Picture is mirror-imaged.*/
for (i = 0; i < h; ++i) {
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;
for (i = 0; i < h; ++i) {
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
* interchanged, too. */
for (i = 0; i < w*h/4; i++) {
temp = p_data[4*i +1];
p_data[4*i + 1] = p_data[4*i+2];
p_data[4*i+2] = temp;
temp = p_data[4 * i + 1];
p_data[4 * i + 1] = p_data[4 * i + 2];
p_data[4 * i + 2] = temp;
}
/* And now create a ppm file, with our own header */
header_len = snprintf(header, 127,
@@ -256,16 +256,14 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
return GP_ERROR_NO_MEMORY;
}
if (camera->pl->model == AOX_MODEL_DMAX)
gp_bayer_decode (p_data, w, h,
output, BAYER_TILE_RGGB);
gp_bayer_decode (p_data, w, h, output, BAYER_TILE_RGGB);
else
gp_bayer_decode (p_data, w, h,
output, BAYER_TILE_GRBG);
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);
gp_gamma_correct_single (gtable, output, w * h);
gp_file_set_mime_type (file, GP_MIME_PPM);
gp_file_append (file, header, header_len);
gp_file_set_mime_type (file, GP_MIME_PPM);
gp_file_append (file, header, header_len);
gp_file_append (file, (char *)output, 3*w*h);
}
free (data);
@@ -317,9 +315,9 @@ camera_init(Camera *camera, GPContext *context)
ret = gp_port_get_settings(camera->port,&settings);
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);
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) {
case GP_PORT_SERIAL:
@@ -342,7 +340,7 @@ camera_init(Camera *camera, GPContext *context)
GP_DEBUG("inep = %x\n", settings.usb.inep);
GP_DEBUG("outep = %x\n", settings.usb.outep);
/* Tell the CameraFilesystem where to get lists from */
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = malloc (sizeof (CameraPrivateLibrary));

View File

@@ -1264,7 +1264,7 @@ ax203_encode_image(Camera *camera, int **src, char *dest, unsigned int dest_size
free (jpeg_dest);
/* Round size up to a multiple of 256 because of ax3003
abfs size granularity. */
return (jpeg_size + 0xff) & ~0xff;
return (jpeg_size + 0xff) & ~0xff;
#else
return GP_ERROR_NOT_SUPPORTED;
#endif

View File

@@ -403,8 +403,8 @@ storage_info_func (CameraFilesystem *fs,
imagesize = ax203_filesize (camera);
if (imagesize) {
sinfo->fields |= GP_STORAGEINFO_FREESPACEIMAGES;
sinfo->freeimages = free / imagesize;
sinfo->fields |= GP_STORAGEINFO_FREESPACEIMAGES;
sinfo->freeimages = free / imagesize;
}
return GP_OK;

View File

@@ -108,17 +108,17 @@ barbie_ping(GPPort *port) {
static int
barbie_file_count (GPPort *port) {
unsigned char cmd[4], resp[4];
unsigned char cmd[4], resp[4];
GP_DEBUG ("Getting the number of pictures...");
GP_DEBUG ("Getting the number of pictures...");
memcpy(cmd, packet_1, 4);
cmd[COMMAND_BYTE] = 'I';
cmd[DATA1_BYTE] = 0;
memcpy(cmd, packet_1, 4);
cmd[COMMAND_BYTE] = 'I';
cmd[DATA1_BYTE] = 0;
if (barbie_exchange(port, cmd, 4, resp, 4) != 1)
return (0);
return (resp[DATA1_BYTE]);
if (barbie_exchange(port, cmd, 4, resp, 4) != 1)
return (0);
return (resp[DATA1_BYTE]);
}
static unsigned char *
@@ -240,53 +240,53 @@ barbie_read_picture(GPPort *port, int picture_number, int get_thumbnail, CameraF
/* GPhoto specific stuff */
static char *models[] = {
"Barbie",
"Nick Click",
"WWF",
"Hot Wheels",
NULL
"Barbie",
"Nick Click",
"WWF",
"Hot Wheels",
NULL
};
int
camera_id (CameraText *id)
{
strcpy(id->text, "barbie");
return (GP_OK);
strcpy(id->text, "barbie");
return (GP_OK);
}
int
camera_abilities (CameraAbilitiesList *list)
{
int x=0;
CameraAbilities a;
int x=0;
CameraAbilities a;
while (models[x]) {
/* Fill in the appropriate flags/data */
while (models[x]) {
/* Fill in the appropriate flags/data */
memset (&a, 0, sizeof(a));
strcpy(a.model, models[x]);
strcpy(a.model, models[x]);
a.status = GP_DRIVER_STATUS_PRODUCTION;
a.port = GP_PORT_SERIAL;
a.speed[0] = 57600;
a.speed[1] = 0;
a.operations = GP_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
a.port = GP_PORT_SERIAL;
a.speed[0] = 57600;
a.speed[1] = 0;
a.operations = GP_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
/* Append it to the list */
gp_abilities_list_append(list, a);
/* Append it to the list */
gp_abilities_list_append(list, a);
x++;
}
return (GP_OK);
x++;
}
return (GP_OK);
}
static int
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
void *data, GPContext *context)
{
Camera *camera = data;
Camera *camera = data;
return gp_list_populate (list, "mattel%02i.ppm", barbie_file_count (camera->port));
return gp_list_populate (list, "mattel%02i.ppm", barbie_file_count (camera->port));
}
static int
@@ -295,67 +295,67 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
GPContext *context)
{
Camera *camera = user_data;
int num;
int num;
/* Retrieve the number of the photo on the camera */
num = gp_filesystem_number (camera->fs, "/", filename, context);
/* Retrieve the number of the photo on the camera */
num = gp_filesystem_number (camera->fs, "/", filename, context);
if (num < GP_OK)
return num;
gp_file_set_mime_type (file, GP_MIME_PPM);
switch (type) {
case GP_FILE_TYPE_NORMAL:
return barbie_read_picture (camera->port, num, 0, file);
break;
case GP_FILE_TYPE_PREVIEW:
return barbie_read_picture (camera->port, num, 1, file);
break;
default:
return GP_ERROR_NOT_SUPPORTED;
}
return GP_ERROR_NOT_SUPPORTED;
gp_file_set_mime_type (file, GP_MIME_PPM);
switch (type) {
case GP_FILE_TYPE_NORMAL:
return barbie_read_picture (camera->port, num, 0, file);
break;
case GP_FILE_TYPE_PREVIEW:
return barbie_read_picture (camera->port, num, 1, file);
break;
default:
return GP_ERROR_NOT_SUPPORTED;
}
return GP_ERROR_NOT_SUPPORTED;
}
#if 0
int camera_capture (Camera *camera, int capture_type, CameraFilePath *path) {
char cmd[4], resp[4];
char cmd[4], resp[4];
memcpy(cmd, packet_1, 4);
memcpy(cmd, packet_1, 4);
cmd[COMMAND_BYTE] = 'G';
cmd[DATA1_BYTE] = 0x40;
if (barbie_exchange(cmd, 4, resp, 4) == 0)
return (0);
cmd[COMMAND_BYTE] = 'G';
cmd[DATA1_BYTE] = 0x40;
if (barbie_exchange(cmd, 4, resp, 4) == 0)
return (0);
cmd[COMMAND_BYTE] = 'Y';
cmd[DATA1_BYTE] = 0;
if (barbie_exchange(cmd, 4, resp, 4) == 0)
return (0);
cmd[COMMAND_BYTE] = 'Y';
cmd[DATA1_BYTE] = 0;
if (barbie_exchange(cmd, 4, resp, 4) == 0)
return (0);
return(resp[DATA1_BYTE] == 0? GP_OK: GP_ERROR);
return(resp[DATA1_BYTE] == 0 ? GP_OK : GP_ERROR);
return (GP_ERROR);
return (GP_ERROR);
}
#endif
static int
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
int num;
char *firm;
int num;
char *firm;
num = barbie_file_count (camera->port);
firm = (char*)barbie_read_firmware (camera->port);
sprintf(summary->text, _("Number of pictures: %i\nFirmware Version: %s"), num,firm);
free(firm);
return GP_OK;
num = barbie_file_count (camera->port);
firm = (char*)barbie_read_firmware (camera->port);
sprintf(summary->text, _("Number of pictures: %i\nFirmware Version: %s"), num, firm);
free(firm);
return GP_OK;
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text,_("Barbie/HotWheels/WWF\nScott Fritzinger <scottf@unr.edu>\nAndreas Meyer <ahm@spies.com>\nPete Zaitcev <zaitcev@metabyte.com>\n\nReverse engineering of image data by:\nJeff Laing <jeffl@SPATIALinfo.com>\n\nImplemented using documents found on\nthe web. Permission given by Vision."));
return GP_OK;
strcpy (about->text, _("Barbie/HotWheels/WWF\nScott Fritzinger <scottf@unr.edu>\nAndreas Meyer <ahm@spies.com>\nPete Zaitcev <zaitcev@metabyte.com>\n\nReverse engineering of image data by:\nJeff Laing <jeffl@SPATIALinfo.com>\n\nImplemented using documents found on\nthe web. Permission given by Vision."));
return GP_OK;
}
static CameraFilesystemFuncs fsfuncs = {
@@ -367,26 +367,26 @@ int
camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
int res;
int res;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* Set up the CameraFilesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* Set up the CameraFilesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* Set up the port */
gp_port_set_timeout (camera->port, 5000);
gp_port_set_timeout (camera->port, 5000);
gp_port_get_settings (camera->port, &settings);
settings.serial.speed = 57600;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits= 1;
gp_port_set_settings (camera->port, settings);
settings.serial.speed = 57600;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits= 1;
gp_port_set_settings (camera->port, settings);
res = barbie_ping (camera->port);
if (res)
return (GP_OK);
return (GP_ERROR);
res = barbie_ping (camera->port);
if (res)
return (GP_OK);
return (GP_ERROR);
}

View File

@@ -513,8 +513,7 @@ struct _CameraPrivateLibrary
int remote_control; /* is the camera currently under USB control? */
canonCaptureSizeClass capture_size; /* Size class for remote-
captured images */
canonCaptureSizeClass capture_size; /* Size class for remote-captured images */
unsigned int body_id; /* hardware serial number for some cameras */

View File

@@ -78,8 +78,8 @@ extern long int timezone;
static const struct canonCaptureSizeClassStruct captureSizeArray[] = {
{CAPTURE_COMPATIBILITY, N_("Compatibility Mode")},
{CAPTURE_THUMB, N_("Thumbnail")},
{CAPTURE_FULL_IMAGE, N_("Full Image")},
{CAPTURE_THUMB, N_("Thumbnail")},
{CAPTURE_FULL_IMAGE, N_("Full Image")},
{0, NULL}
};
@@ -103,62 +103,62 @@ static const struct canonIsoStateStruct isoStateArray[] = {
};
static const struct canonShutterSpeedStateStruct shutterSpeedStateArray[] = {
{SHUTTER_SPEED_BULB, N_("Bulb")},
{SHUTTER_SPEED_30_SEC,"30"},
{SHUTTER_SPEED_25_SEC,"25"},
{SHUTTER_SPEED_20_SEC,"20"},
{SHUTTER_SPEED_15_SEC,"15"},
{SHUTTER_SPEED_13_SEC,"13"},
{SHUTTER_SPEED_10_SEC,"10"},
{SHUTTER_SPEED_8_SEC,"8"},
{SHUTTER_SPEED_6_SEC,"6"},
{SHUTTER_SPEED_5_SEC,"5"},
{SHUTTER_SPEED_4_SEC,"4"},
{SHUTTER_SPEED_3_2_SEC,"3.2"},
{SHUTTER_SPEED_2_5_SEC,"2.5"},
{SHUTTER_SPEED_2_SEC,"2"},
{SHUTTER_SPEED_1_6_SEC,"1.6"},
{SHUTTER_SPEED_1_3_SEC,"1.3"},
{SHUTTER_SPEED_1_SEC,"1"},
{SHUTTER_SPEED_BULB, N_("Bulb")},
{SHUTTER_SPEED_30_SEC,"30"},
{SHUTTER_SPEED_25_SEC,"25"},
{SHUTTER_SPEED_20_SEC,"20"},
{SHUTTER_SPEED_15_SEC,"15"},
{SHUTTER_SPEED_13_SEC,"13"},
{SHUTTER_SPEED_10_SEC,"10"},
{SHUTTER_SPEED_8_SEC,"8"},
{SHUTTER_SPEED_6_SEC,"6"},
{SHUTTER_SPEED_5_SEC,"5"},
{SHUTTER_SPEED_4_SEC,"4"},
{SHUTTER_SPEED_3_2_SEC,"3.2"},
{SHUTTER_SPEED_2_5_SEC,"2.5"},
{SHUTTER_SPEED_2_SEC,"2"},
{SHUTTER_SPEED_1_6_SEC,"1.6"},
{SHUTTER_SPEED_1_3_SEC,"1.3"},
{SHUTTER_SPEED_1_SEC,"1"},
{SHUTTER_SPEED_0_8_SEC,"0.8"},
{SHUTTER_SPEED_0_6_SEC,"0.6"},
{SHUTTER_SPEED_0_5_SEC,"0.5"},
{SHUTTER_SPEED_0_4_SEC,"0.4"},
{SHUTTER_SPEED_0_3_SEC,"0.3"},
{SHUTTER_SPEED_1_4,"1/4"},
{SHUTTER_SPEED_1_5,"1/5"},
{SHUTTER_SPEED_1_6,"1/6"},
{SHUTTER_SPEED_1_8,"1/8"},
{SHUTTER_SPEED_1_10,"1/10"},
{SHUTTER_SPEED_1_13,"1/13"},
{SHUTTER_SPEED_1_15,"1/15"},
{SHUTTER_SPEED_1_20,"1/20"},
{SHUTTER_SPEED_1_25,"1/25"},
{SHUTTER_SPEED_1_30,"1/30"},
{SHUTTER_SPEED_1_40,"1/40"},
{SHUTTER_SPEED_1_50,"1/50"},
{SHUTTER_SPEED_1_60,"1/60"},
{SHUTTER_SPEED_1_80,"1/80"},
{SHUTTER_SPEED_1_100,"1/100"},
{SHUTTER_SPEED_1_125,"1/125"},
{SHUTTER_SPEED_1_160,"1/160"},
{SHUTTER_SPEED_1_200,"1/200"},
{SHUTTER_SPEED_1_250,"1/250"},
{SHUTTER_SPEED_1_320,"1/320"},
{SHUTTER_SPEED_1_400,"1/400"},
{SHUTTER_SPEED_1_500,"1/500"},
{SHUTTER_SPEED_1_640,"1/640"},
{SHUTTER_SPEED_1_800,"1/800"},
{SHUTTER_SPEED_1_1000,"1/1000"},
{SHUTTER_SPEED_1_1250,"1/1250"},
{SHUTTER_SPEED_1_1600,"1/1600"},
{SHUTTER_SPEED_1_2000,"1/2000"},
{SHUTTER_SPEED_1_2500,"1/2500"},
{SHUTTER_SPEED_1_3200,"1/3200"},
{SHUTTER_SPEED_1_4000,"1/4000"},
{SHUTTER_SPEED_1_5000,"1/5000"},
{SHUTTER_SPEED_1_6400,"1/6400"},
{SHUTTER_SPEED_1_8000,"1/8000"},
{SHUTTER_SPEED_1_4,"1/4"},
{SHUTTER_SPEED_1_5,"1/5"},
{SHUTTER_SPEED_1_6,"1/6"},
{SHUTTER_SPEED_1_8,"1/8"},
{SHUTTER_SPEED_1_10,"1/10"},
{SHUTTER_SPEED_1_13,"1/13"},
{SHUTTER_SPEED_1_15,"1/15"},
{SHUTTER_SPEED_1_20,"1/20"},
{SHUTTER_SPEED_1_25,"1/25"},
{SHUTTER_SPEED_1_30,"1/30"},
{SHUTTER_SPEED_1_40,"1/40"},
{SHUTTER_SPEED_1_50,"1/50"},
{SHUTTER_SPEED_1_60,"1/60"},
{SHUTTER_SPEED_1_80,"1/80"},
{SHUTTER_SPEED_1_100,"1/100"},
{SHUTTER_SPEED_1_125,"1/125"},
{SHUTTER_SPEED_1_160,"1/160"},
{SHUTTER_SPEED_1_200,"1/200"},
{SHUTTER_SPEED_1_250,"1/250"},
{SHUTTER_SPEED_1_320,"1/320"},
{SHUTTER_SPEED_1_400,"1/400"},
{SHUTTER_SPEED_1_500,"1/500"},
{SHUTTER_SPEED_1_640,"1/640"},
{SHUTTER_SPEED_1_800,"1/800"},
{SHUTTER_SPEED_1_1000,"1/1000"},
{SHUTTER_SPEED_1_1250,"1/1250"},
{SHUTTER_SPEED_1_1600,"1/1600"},
{SHUTTER_SPEED_1_2000,"1/2000"},
{SHUTTER_SPEED_1_2500,"1/2500"},
{SHUTTER_SPEED_1_3200,"1/3200"},
{SHUTTER_SPEED_1_4000,"1/4000"},
{SHUTTER_SPEED_1_5000,"1/5000"},
{SHUTTER_SPEED_1_6400,"1/6400"},
{SHUTTER_SPEED_1_8000,"1/8000"},
{0, NULL},
};
@@ -196,10 +196,10 @@ static const struct canonApertureStateStruct apertureStateArray[] = {
};
static const struct canonFocusModeStateStruct focusModeStateArray[] = {
{AUTO_FOCUS_ONE_SHOT, N_("Auto focus: one-shot")},
{AUTO_FOCUS_AI_SERVO, N_("Auto focus: AI servo")},
{AUTO_FOCUS_AI_FOCUS, N_("Auto focus: AI focus")},
{MANUAL_FOCUS, N_("Manual focus")},
{AUTO_FOCUS_ONE_SHOT, N_("Auto focus: one-shot")},
{AUTO_FOCUS_AI_SERVO, N_("Auto focus: AI servo")},
{AUTO_FOCUS_AI_FOCUS, N_("Auto focus: AI focus")},
{MANUAL_FOCUS, N_("Manual focus")},
{0, NULL},
};
@@ -1200,46 +1200,45 @@ get_last_file (Camera *camera, char *directory, char *destname,
int t;
GP_DEBUG ("get_last_file()");
if(directory[1] == ':') {
/* gp_file_list_folder() needs absolute filenames
starting with '/' */
GP_DEBUG ("get_last_file(): replacing '%c:%c' by '/'",
directory[0], directory[2]);
sprintf(dir2, "/%s", &directory[3]);
directory = dir2;
if (directory[1] == ':') {
/* gp_file_list_folder() needs absolute filenames
starting with '/' */
GP_DEBUG ("get_last_file(): replacing '%c:%c' by '/'",
directory[0], directory[2]);
sprintf(dir2, "/%s", &directory[3]);
directory = dir2;
}
gp_list_new(&list);
if(getdirectory) {
CHECK_RESULT (gp_filesystem_list_folders (fs, directory, list, context));
GP_DEBUG ("get_last_file(): %d folders", list->count);
if (getdirectory) {
CHECK_RESULT (gp_filesystem_list_folders (fs, directory, list, context));
GP_DEBUG ("get_last_file(): %d folders", list->count);
} else {
CHECK_RESULT (gp_filesystem_list_files (fs, directory, list, context));
GP_DEBUG ("get_last_file(): %d files", list->count);
}
else {
CHECK_RESULT (gp_filesystem_list_files (fs, directory, list, context));
GP_DEBUG ("get_last_file(): %d files", list->count);
}
for(t=0;t<list->count;t++)
for (t=0;t<list->count;t++)
{
char* name = list->entry[t].name;
if(getdirectory)
GP_DEBUG ("get_last_file(): folder: %s", name);
else
GP_DEBUG ("get_last_file(): file: %s", name);
char* name = list->entry[t].name;
if (getdirectory)
GP_DEBUG ("get_last_file(): folder: %s", name);
else
GP_DEBUG ("get_last_file(): file: %s", name);
/* we search only for directories of the form [0-9]{3}CANON... */
if(getdirectory && ((strlen (name)!=8) ||
(!isdigit(name[0]) ||
!isdigit(name[1]) ||
!isdigit(name[2])) || strcmp(&name[3],"CANON")))
continue;
/* we search only for directories of the form [0-9]{3}CANON... */
if (getdirectory && ((strlen (name)!=8) ||
(!isdigit(name[0]) ||
!isdigit(name[1]) ||
!isdigit(name[2])) || strcmp(&name[3], "CANON")))
continue;
/* ...and only for files similar to AUT_[0-9]{4} */
if(!getdirectory && (!isdigit(name[6]) ||
!isdigit(name[7])))
continue;
/* ...and only for files similar to AUT_[0-9]{4} */
if (!getdirectory && (!isdigit(name[6]) ||
!isdigit(name[7])))
continue;
if(!result[0] || strcmp((list->entry[t].name)+4, result+4) > 0)
strcpy(result, list->entry[t].name);
if (!result[0] || strcmp((list->entry[t].name)+4, result+4) > 0)
strcpy(result, list->entry[t].name);
}
gp_list_free(list);
@@ -1692,7 +1691,7 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
/* DSLRs have only "Manual" Zoom */
if ( camera->pl->md->id_str && !strstr(camera->pl->md->id_str,"EOS") && !strstr(camera->pl->md->id_str,"Rebel")) {
if (camera->pl->md->id_str && !strstr(camera->pl->md->id_str, "EOS") && !strstr(camera->pl->md->id_str, "Rebel")) {
/* Zoom level */
gp_widget_new (GP_WIDGET_RANGE, _("Zoom"), &t);
gp_widget_set_name (t, "zoom");
@@ -1902,7 +1901,7 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
res = canon_int_get_time (camera, &camtime, context);
if (res == GP_OK) {
strftime (formatted_camera_time, sizeof (formatted_camera_time),
"%Y-%m-%d %H:%M:%S", gmtime (&camtime));
"%Y-%m-%d %H:%M:%S", gmtime (&camtime));
gp_widget_set_value (t, formatted_camera_time);
} else {
gp_widget_set_value (t, _("Error"));
@@ -1974,7 +1973,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Owner Name"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -1988,7 +1987,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Capture Size Class"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
i = 0;
@@ -2006,7 +2005,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
}
/* Enable remote control, if not already enabled */
/* Enable remote control, if not already enabled */
if (!camera->pl->remote_control) {
res = canon_int_start_remote_control (camera, context);
if (res != GP_OK)
@@ -2015,7 +2014,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("ISO Speed"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2045,7 +2044,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Shooting mode"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2075,7 +2074,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Shutter Speed"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2104,7 +2103,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Aperture"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2134,7 +2133,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
if (gp_widget_changed (w)) {
unsigned char expbias;
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2163,7 +2162,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Image Format"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2192,7 +2191,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Focus Mode"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2222,7 +2221,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
/* Beep */
gp_widget_get_child_by_label (window, _("Beep"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2251,13 +2250,13 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
/* DSLRs have only "Manual" Zoom */
if ( camera->pl->md->id_str && !strstr(camera->pl->md->id_str,"EOS") && !strstr(camera->pl->md->id_str,"Rebel")) {
if (camera->pl->md->id_str && !strstr(camera->pl->md->id_str, "EOS") && !strstr(camera->pl->md->id_str, "Rebel")) {
/* Zoom */
gp_widget_get_child_by_label (window, _("Zoom"), &w);
if (gp_widget_changed (w)) {
float zoom;
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &zoom);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2273,7 +2272,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
/* Aperture */
gp_widget_get_child_by_label (window, _("Aperture"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2303,7 +2302,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
/* Flash mode */
gp_widget_get_child_by_label (window, _("Flash Mode"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2333,7 +2332,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Synchronize camera date and time with PC"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (!check_readiness (camera, context)) {
gp_context_status (context, _("Camera unavailable"));
@@ -2349,7 +2348,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("List all files"), &w);
if (gp_widget_changed (w)) {
/* XXXXX mark CameraFS as dirty */
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &val);
camera->pl->list_all_files = val;
sprintf (str, "%d", val);
@@ -2362,7 +2361,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
#ifdef CANON_EXPERIMENTAL_UPLOAD
gp_widget_get_child_by_label (window, _("Keep filename on upload"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &camera->pl->upload_keep_filename);
GP_DEBUG ("New config value for \"Keep filename on upload\": %i",
camera->pl->upload_keep_filename);

View File

@@ -269,8 +269,8 @@ QVpicattr (Camera *camera, int n, unsigned char *picattr)
cmd[0] = 'D';
cmd[1] = 'Y';
cmd[2] = STX;
cmd[3] = n+1;
cmd[2] = STX;
cmd[3] = n+1;
CR (QVsend (camera, cmd, 4, &b, 1));
*picattr = b;
@@ -386,33 +386,33 @@ QVcapture (Camera *camera)
int
QVstatus (Camera *camera, char *status)
{
unsigned char cmd[3];
unsigned char cmd[3];
cmd[0] = 'D';
cmd[1] = 'S';
cmd[2] = STX;
CR (QVsend (camera, cmd, 3, (unsigned char *)status, 2));
cmd[0] = 'D';
cmd[1] = 'S';
cmd[2] = STX;
CR (QVsend (camera, cmd, 3, (unsigned char *)status, 2));
return (GP_OK);
return (GP_OK);
}
int
QVreset (Camera *camera)
{
unsigned char cmd[2];
unsigned char cmd[2];
cmd[0] = 'Q';
cmd[1] = 'R';
CR (QVsend (camera, cmd, 2, NULL, 0));
return (GP_OK);
return (GP_OK);
}
int
QVsetspeed (Camera *camera, int speed)
{
unsigned char cmd[3];
gp_port_settings settings;
gp_port_settings settings;
cmd[0] = 'C';
cmd[1] = 'B';
@@ -426,9 +426,9 @@ QVsetspeed (Camera *camera, int speed)
}
CR (QVsend (camera, cmd, 3, NULL, 0));
CR (gp_port_get_settings (camera->port, &settings));
settings.serial.speed = speed;
CR (gp_port_set_settings (camera->port, settings));
CR (gp_port_get_settings (camera->port, &settings));
settings.serial.speed = speed;
CR (gp_port_set_settings (camera->port, settings));
CR (QVping (camera));

View File

@@ -111,8 +111,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
long int camSize = 0;
/* Get the number of the picture from the filesystem */
CHECK_RESULT (n = gp_filesystem_number (camera->fs, folder, filename,
context));
CHECK_RESULT (n = gp_filesystem_number (camera->fs, folder, filename, context));
/* Prepare the transaction */
CHECK_RESULT (QVpicattr (camera, n, &attr));
@@ -149,25 +148,24 @@ static int
delete_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, void *data, GPContext *context)
{
Camera *camera = data;
int nr ;
Camera *camera = data;
int nr ;
CameraFileInfo info;
nr = gp_filesystem_number(fs, folder, filename, context);
if (nr < 0)
return nr;
nr = gp_filesystem_number(fs, folder, filename, context);
if (nr < 0)
return nr;
CHECK_RESULT (get_info_func(fs, folder, filename, &info, data, context));
if (info.file.permissions == GP_FILE_PERM_READ) {
gp_context_error(context, _("Image %s is delete protected."),
filename);
return (GP_ERROR);
}
if (info.file.permissions == GP_FILE_PERM_READ) {
gp_context_error(context, _("Image %s is delete protected."), filename);
return (GP_ERROR);
}
CHECK_RESULT (QVdelete (camera, nr));
return GP_OK;
return GP_OK;
}
static int
@@ -234,10 +232,10 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
info->preview.size = size_thumb;
CHECK_RESULT (QVpicattr (camera, n, &attr));
if (attr&1)
info->file.permissions = GP_FILE_PERM_READ;
else
info->file.permissions = GP_FILE_PERM_ALL;
if (attr&1)
info->file.permissions = GP_FILE_PERM_READ;
else
info->file.permissions = GP_FILE_PERM_ALL;
return (GP_OK);
}
@@ -245,33 +243,33 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
static int
camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
{
CameraWidget *child;
float battery;
CameraWidget *child;
float battery;
char status[2];
char t[1024];
char t[1024];
gp_widget_new (GP_WIDGET_WINDOW, _("Camera Configuration"), window);
gp_widget_new (GP_WIDGET_WINDOW, _("Camera Configuration"), window);
CHECK_RESULT (QVbattery (camera, &battery));
CHECK_RESULT (QVbattery (camera, &battery));
gp_widget_new (GP_WIDGET_TEXT, _("Battery"), &child);
gp_widget_set_name (child, "battery");
snprintf(t,sizeof(t),"%.1f V",battery);
gp_widget_set_name (child, "battery");
snprintf(t,sizeof(t),"%.1f V",battery);
gp_widget_set_value (child, t);
gp_widget_append (*window, child);
gp_widget_append (*window, child);
CHECK_RESULT (QVstatus (camera, status));
gp_widget_new (GP_WIDGET_RADIO, _("Brightness"), &child);
gp_widget_set_name (child, "brightness");
gp_widget_add_choice (child, _("Too bright"));
gp_widget_add_choice (child, _("Too dark"));
gp_widget_add_choice (child, _("OK"));
if (status[0]&0x80) strcpy (t, _("Too bright"));
else if (status[0]&0x40) strcpy (t, _("Too dark"));
gp_widget_set_name (child, "brightness");
gp_widget_add_choice (child, _("Too bright"));
gp_widget_add_choice (child, _("Too dark"));
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"));
gp_widget_set_value (child, t);
gp_widget_append (*window, child);
gp_widget_set_value (child, t);
gp_widget_append (*window, child);
return (GP_OK);
return (GP_OK);
}
static int
@@ -321,12 +319,12 @@ camera_init (Camera *camera, GPContext *context)
gp_port_settings settings;
int selected_speed;
/* First, set up all the function pointers */
camera->functions->get_config = camera_config_get;
/* First, set up all the function pointers */
camera->functions->get_config = camera_config_get;
camera->functions->capture = camera_capture;
camera->functions->summary = camera_summary;
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
camera->functions->about = camera_about;
/* Now, tell the filesystem where to get lists and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);

View File

@@ -148,10 +148,10 @@ clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
gp_port_usb_msg_interface_write(port, 6, 0x1fff - n, 1, NULL, 0);
c = 0;
while (c != 1){
int r;
if ((r = CLICKSMART_READ_STATUS (port, &c)) < GP_OK)
return r;
while (c != 1) {
int r;
if ((r = CLICKSMART_READ_STATUS (port, &c)) < GP_OK)
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
@@ -160,9 +160,9 @@ clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
size=(priv->catalog[16*n + 12] * 0x100)+(priv->catalog[16*n + 11]);
if (size == 0) /* for lo-res photos the above calculation gives 0 */
size = (priv->catalog[16*n + 5] * 0x100);
size = (priv->catalog[16*n + 5] * 0x100);
if (size == 0) /* this means data corruption */
return GP_ERROR;
return GP_ERROR;
remainder = size%0x200;
@@ -171,10 +171,10 @@ clicksmart_read_pic_data (CameraPrivateLibrary *priv, GPPort *port,
if (!*data) return GP_ERROR;
/* Download the data */
while (offset < size-remainder) {
GP_DEBUG("offset: %x\n", offset);
if (gp_port_read(port, (char *)*data + offset, 0x200) < GP_OK)
break;
offset = offset + 0x200;
GP_DEBUG("offset: %x\n", offset);
if (gp_port_read(port, (char *)*data + offset, 0x200) < GP_OK)
break;
offset = offset + 0x200;
}
remainder=((remainder+0xff)/0x100)*0x100;
@@ -215,7 +215,7 @@ clicksmart_reset (GPPort *port)
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);
return GP_OK;
return GP_OK;
}
/* create_jpeg_from_data adapted from camlibs/spca50x */
@@ -223,7 +223,7 @@ 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 o_size, int *size,
int omit_huffman_table, int omit_escape)
int omit_huffman_table, int omit_escape)
{
int i = 0;
unsigned char *start;
@@ -241,9 +241,9 @@ int create_jpeg_from_data (unsigned char * dst, unsigned char * src,
/* copy Huffman table */
if (!omit_huffman_table) {
memcpy (dst, SPCA50xJPGDefaultHeaderPart2,
SPCA50X_JPG_DEFAULT_HEADER_PART2_LENGTH);
dst += SPCA50X_JPG_DEFAULT_HEADER_PART2_LENGTH;
memcpy (dst, SPCA50xJPGDefaultHeaderPart2,
SPCA50X_JPG_DEFAULT_HEADER_PART2_LENGTH);
dst += SPCA50X_JPG_DEFAULT_HEADER_PART2_LENGTH;
}
memcpy (dst, SPCA50xJPGDefaultHeaderPart3,
SPCA50X_JPG_DEFAULT_HEADER_PART3_LENGTH);

View File

@@ -48,59 +48,59 @@
#define GP_MODULE "clicksmart310"
static const struct {
char *name;
char *name;
CameraDriverStatus status;
unsigned short idVendor;
unsigned short idProduct;
unsigned short idVendor;
unsigned short idProduct;
} models[] = {
{"Logitech Clicksmart 310", GP_DRIVER_STATUS_TESTING, 0x46d, 0x0900},
{"Logitech Clicksmart 310", GP_DRIVER_STATUS_TESTING, 0x46d, 0x0900},
{NULL,0,0,0}
};
int
camera_id (CameraText *id)
{
strcpy (id->text, "Logitech Clicksmart 310");
strcpy (id->text, "Logitech Clicksmart 310");
return GP_OK;
return GP_OK;
}
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
int i;
CameraAbilities a;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
a.operations = GP_OPERATION_NONE;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
;
a.file_operations = GP_FILE_OPERATION_PREVIEW
+ GP_FILE_OPERATION_RAW;
gp_abilities_list_append (list, a);
}
+ GP_FILE_OPERATION_RAW;
gp_abilities_list_append (list, a);
}
return GP_OK;
return GP_OK;
}
static int
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
sprintf (summary->text,ngettext(
sprintf (summary->text, ngettext(
"Your Logitech Clicksmart 310 has %i picture in it.\n",
"Your Logitech Clicksmart 310 has %i pictures in it.\n",
camera->pl->num_pics
),
camera->pl->num_pics);
return GP_OK;
return GP_OK;
}
@@ -135,10 +135,10 @@ static int camera_manual (Camera *camera, CameraText *manual, GPContext *context
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("Logitech Clicksmart 310 driver\n"
strcpy (about->text, _("Logitech Clicksmart 310 driver\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
return GP_OK;
return GP_OK;
}
/*************** File and Downloading Functions *******************/
@@ -148,10 +148,10 @@ static int
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
void *data, GPContext *context)
{
Camera *camera = data;
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;
}
@@ -162,7 +162,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 w=0, h=0, b=0;
int k, res;
unsigned char *data;
@@ -171,7 +171,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
unsigned char jpeg_format;
/* Get the entry number of the photo on the camera */
k = gp_filesystem_number (camera->fs, "/", filename, context);
k = gp_filesystem_number (camera->fs, "/", filename, context);
if (GP_FILE_TYPE_EXIF==type) return GP_ERROR_FILE_EXISTS;
@@ -180,7 +180,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
res = clicksmart_get_res_setting (camera->pl, k);
switch (res) {
switch (res) {
case 0: w = 352;
h = 288;
jpeg_format = JPEG_CIF_FORMAT;
@@ -202,10 +202,10 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
if (GP_FILE_TYPE_RAW == type) { /* type is GP_FILE_TYPE_RAW */
gp_file_set_mime_type (file, GP_MIME_RAW);
gp_file_set_data_and_size (file, (char *)data, b);
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;
}
@@ -225,13 +225,13 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
GP_DEBUG("width: %d, height: %d, data size: %d\n", w, h, b);
create_jpeg_from_data (jpeg_out, data, 3, w, h, jpeg_format,
b, &file_size, 0, 0);
b, &file_size, 0, 0);
gp_file_set_mime_type (file, GP_MIME_JPEG);
gp_file_set_data_and_size (file, (char *)jpeg_out, file_size);
/* Reset camera when done, for more graceful exit. */
if (k +1 == camera->pl->num_pics) {
clicksmart_reset (camera->port);
clicksmart_reset (camera->port);
}
free(data);
return GP_OK;
@@ -276,10 +276,10 @@ camera_init(Camera *camera, GPContext *context)
int ret = 0;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
GP_DEBUG ("Initializing the camera\n");
@@ -303,7 +303,7 @@ camera_init(Camera *camera, GPContext *context)
ret = gp_port_set_settings(camera->port,settings);
if (ret < 0) return ret;
/* Tell the CameraFilesystem where to get lists from */
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl) return GP_ERROR_NO_MEMORY;

View File

@@ -53,18 +53,18 @@ digi_first_decompress (unsigned char *output, unsigned char *input,
unsigned int bit_counter = 8;
unsigned int cycles = 0;
int table[9] = { -1, 0, 2, 6, 0x0e, 0x0e, 0x0e, 0x0e, 0xfb};
unsigned char lookup_table[16]
={0, 2, 6, 0x0e, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4,
0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb};
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] =
{8, 7, 9, 6, 10, 11, 12, 13, 14, 15, 5, 4, 3, 2, 1, 0};
{8, 7, 9, 6, 10, 11, 12, 13, 14, 15, 5, 4, 3, 2, 1, 0};
GP_DEBUG ("Running first_decompress.\n");
nibble_to_keep[0] = 0;
nibble_to_keep[1] = 0;
while (bytes_done < outputsize) {
while (parity < 2 ) {
while (bytes_done < outputsize) {
while (parity < 2 ) {
while ( lookup > table[cycles]) {
if (bit_counter == 8) {
input_byte = input[bytes_used];

View File

@@ -357,8 +357,7 @@ camera_capture_preview(Camera *camera, CameraFile *file, GPContext *context)
gp_port_read(camera->port, (char *)get_size, 0x50);
GP_DEBUG("get_size[0x40] = 0x%x\n", get_size[0x40]);
lighting = get_size[0x48];
b = get_size[0x40] | get_size[0x41] << 8 | get_size[0x42] << 16
| get_size[0x43]<<24;
b = get_size[0x40] | get_size[0x41] << 8 | get_size[0x42] << 16 | get_size[0x43]<<24;
GP_DEBUG("b = 0x%x\n", b);
raw_data = malloc(b);
@@ -393,7 +392,7 @@ camera_capture_preview(Camera *camera, CameraFile *file, GPContext *context)
GP_DEBUG ("size = %i\n", size);
gp_ahd_decode (frame_data, w , h , ptr, BAYER_TILE_BGGR);
free(frame_data);
if (lighting < 0x40) {
if (lighting < 0x40) {
GP_DEBUG(
"Low light condition. Default gamma. No white balance.\n");
gp_gamma_fill_table (gtable, .65);
@@ -441,7 +440,7 @@ camera_init(Camera *camera, GPContext *context)
/* Now, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->capture_preview
= camera_capture_preview;

View File

@@ -313,7 +313,7 @@ static int get_file_func(CameraFilesystem *fs, const char *folder,
switch (type) {
case GP_FILE_TYPE_NORMAL:
GP_DEBUG("digita/get_file_func: Getting picture");
data = digita_file_get(camera, folder, filename, 0, &buflen, context);
data = digita_file_get(camera, folder, filename, 0, &buflen, context);
break;
case GP_FILE_TYPE_PREVIEW:
GP_DEBUG("digita/get_file_func: Getting thumbnail");
@@ -407,18 +407,18 @@ static int digita_file_delete(Camera *camera, const char *folder,
if (digita_get_file_list(camera->pl) < 0)
return 0;
return GP_OK;
return GP_OK;
}
static int delete_file_func(CameraFilesystem *fs, const char *folder,
const char *filename, void *user_data, GPContext *context)
{
Camera *camera = user_data;
Camera *camera = user_data;
if (folder[0] == '/')
folder++;
return digita_file_delete(camera, folder, filename, context);
return digita_file_delete(camera, folder, filename, context);
}
static CameraFilesystemFuncs fsfuncs = {

View File

@@ -82,17 +82,17 @@ 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;
};
static const char *models[] = {
"Mustek:VDC-3500",
"Relisys:Dimera 3500",
"Trust:DC-3500",
NULL
"Mustek:VDC-3500",
"Relisys:Dimera 3500",
"Trust:DC-3500",
NULL
};
@@ -376,14 +376,14 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
}
static int camera_capture_preview(Camera *camera, CameraFile *file, GPContext *context) {
long size;
long size;
uint8_t *data;
gp_file_set_mime_type (file, GP_MIME_PGM);
data = Dimera_Preview( &size, camera, context);
if (!data)
return GP_ERROR;
data = Dimera_Preview (&size, camera, context);
if (!data)
return GP_ERROR;
return gp_file_set_data_and_size (file, (char *)data, size);
}
@@ -860,7 +860,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Exposure level on preview"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
camera->pl->exposure = MAX(MIN_EXPOSURE,MIN(MAX_EXPOSURE,atoi(wvalue)));
gp_setting_set ("dimera3500", "exposure", wvalue);
@@ -869,7 +869,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Automatic exposure adjustment on preview"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &val);
camera->pl->auto_exposure = val;
sprintf(str, "%d", val);
@@ -879,7 +879,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Automatic flash on capture"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &val);
camera->pl->auto_flash = val;
sprintf(str, "%d", val);
@@ -901,18 +901,18 @@ static CameraFilesystemFuncs fsfuncs = {
int camera_init (Camera *camera, GPContext *context) {
GPPortSettings settings;
int ret, selected_speed;
char buf[1024];
int ret, selected_speed;
char buf[1024];
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->capture = camera_capture;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->get_config = camera_get_config;
camera->functions->set_config = camera_set_config;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->capture = camera_capture;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->get_config = camera_get_config;
camera->functions->set_config = camera_set_config;
/* Get the settings and remember the selected speed */
gp_port_get_settings (camera->port, &settings);
@@ -926,77 +926,77 @@ int camera_init (Camera *camera, GPContext *context) {
return (GP_ERROR_NO_MEMORY);
}
/* Set the default exposure */
if (gp_setting_get ("dimera3500", "exposure", buf) == GP_OK)
camera->pl->exposure = atoi(buf);
else
camera->pl->exposure = DEFAULT_EXPOSURE;
/* Set the default exposure */
if (gp_setting_get ("dimera3500", "exposure", buf) == GP_OK)
camera->pl->exposure = atoi(buf);
else
camera->pl->exposure = DEFAULT_EXPOSURE;
/* Set automatic exposure enable setting for capture preview mode */
if (gp_setting_get ("dimera3500", "auto_exposure", buf) == GP_OK)
camera->pl->auto_exposure = atoi(buf);
else
camera->pl->auto_exposure = 1;
/* Set automatic exposure enable setting for capture preview mode */
if (gp_setting_get ("dimera3500", "auto_exposure", buf) == GP_OK)
camera->pl->auto_exposure = atoi(buf);
else
camera->pl->auto_exposure = 1;
/* Set flag to use flash, if necessary, when capturing picture */
if (gp_setting_get ("dimera3500", "auto_flash", buf) == GP_OK)
camera->pl->auto_flash = atoi(buf);
else
camera->pl->auto_flash = 1;
/* Set flag to use flash, if necessary, when capturing picture */
if (gp_setting_get ("dimera3500", "auto_flash", buf) == GP_OK)
camera->pl->auto_flash = atoi(buf);
else
camera->pl->auto_flash = 1;
GP_DEBUG("Opening port");
if ( (ret = mesa_port_open(camera->port)) != GP_OK)
{
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Camera Open Failed");
GP_DEBUG("Opening port");
if ((ret = mesa_port_open(camera->port)) != GP_OK)
{
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Camera Open Failed");
free (camera->pl);
camera->pl = NULL;
gp_context_error (context, _("Problem opening port"));
return ret;
}
return ret;
}
GP_DEBUG("Resetting camera");
if ( (ret = mesa_reset(camera->port)) != GP_OK )
{
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Camera Reset Failed");
GP_DEBUG("Resetting camera");
if ((ret = mesa_reset(camera->port)) != GP_OK)
{
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Camera Reset Failed");
free (camera->pl);
camera->pl = NULL;
gp_context_error (context, _("Problem resetting camera"));
return ret;
}
return ret;
}
GP_DEBUG("Setting speed");
if ( (ret = mesa_set_speed(camera->port, selected_speed)) != GP_OK )
{
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Camera Speed Setting Failed");
GP_DEBUG("Setting speed");
if ((ret = mesa_set_speed(camera->port, selected_speed)) != GP_OK)
{
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Camera Speed Setting Failed");
free (camera->pl);
camera->pl = NULL;
gp_context_error (context, _("Problem setting camera communication speed"));
return ret;
}
return ret;
}
GP_DEBUG("Checking for modem");
switch ( ret = mesa_modem_check(camera->port) )
{
case GP_ERROR_IO:
case GP_ERROR_TIMEOUT:
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "No or Unknown Response");
GP_DEBUG("Checking for modem");
switch (ret = mesa_modem_check(camera->port))
{
case GP_ERROR_IO:
case GP_ERROR_TIMEOUT:
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "No or Unknown Response");
free (camera->pl);
camera->pl = NULL;
gp_context_error (context, _("No response from camera"));
return GP_ERROR_TIMEOUT;
case GP_ERROR_MODEL_NOT_FOUND:
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Probably a modem");
return GP_ERROR_TIMEOUT;
case GP_ERROR_MODEL_NOT_FOUND:
gp_log(GP_LOG_ERROR, "dimera/dimera3500", "Probably a modem");
free (camera->pl);
camera->pl = NULL;
gp_context_error (context, _("Looks like a modem, not a camera"));
return GP_ERROR_MODEL_NOT_FOUND;
case GP_OK:
break;
return GP_ERROR_MODEL_NOT_FOUND;
case GP_OK:
break;
default:
/* Hopefully, gp_camera_set_error was called for this error */
return ret;
}
}
/* Tell the filesystem where to get listings and info from */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
return (GP_OK);

View File

@@ -125,60 +125,60 @@ static const char *
get_mime_type (const char *filename)
{
char *dot;
int x=0;
char *dot;
int x=0;
dot = strrchr(filename, '.');
if (dot) {
dot = strrchr(filename, '.');
if (dot) {
for (x = 0; mime_table[x].extension; x++) {
if (!strcasecmp (mime_table[x].extension, dot+1))
return (mime_table[x].mime_type);
}
}
}
return (NULL);
return (NULL);
}
int camera_id (CameraText *id)
{
strcpy(id->text, "directory");
strcpy(id->text, "directory");
return (GP_OK);
return (GP_OK);
}
int camera_abilities (CameraAbilitiesList *list)
{
CameraAbilities a;
CameraAbilities a;
memset(&a, 0, sizeof(a));
strcpy(a.model, "Directory Browse");
strcpy(a.model, "Directory Browse");
a.status = GP_DRIVER_STATUS_PRODUCTION;
a.port = GP_PORT_DISK;
a.speed[0] = 0;
a.port = GP_PORT_DISK;
a.speed[0] = 0;
a.operations = GP_OPERATION_NONE;
a.operations = GP_OPERATION_NONE;
#ifdef DEBUG
a.file_operations = GP_FILE_OPERATION_PREVIEW |
a.file_operations = GP_FILE_OPERATION_PREVIEW |
GP_FILE_OPERATION_DELETE |
GP_FILE_OPERATION_EXIF;
#else
a.file_operations = GP_FILE_OPERATION_DELETE |
GP_FILE_OPERATION_EXIF;
#endif
a.folder_operations = GP_FOLDER_OPERATION_MAKE_DIR |
a.folder_operations = GP_FOLDER_OPERATION_MAKE_DIR |
GP_FOLDER_OPERATION_REMOVE_DIR |
GP_FOLDER_OPERATION_PUT_FILE;
gp_abilities_list_append(list, a);
gp_abilities_list_append(list, a);
/* Since "Directory Browse" is hardcoded in clients,
* better also add a new name here.
*/
strcpy(a.model, "Mass Storage Camera");
gp_abilities_list_append(list, a);
return (GP_OK);
strcpy(a.model, "Mass Storage Camera");
gp_abilities_list_append(list, a);
return (GP_OK);
}
static int
@@ -395,9 +395,9 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
return (GP_ERROR);
}
info->preview.fields = GP_FILE_INFO_NONE;
info->file.fields = GP_FILE_INFO_SIZE |
GP_FILE_INFO_TYPE | GP_FILE_INFO_PERMISSIONS |
info->preview.fields = GP_FILE_INFO_NONE;
info->file.fields = GP_FILE_INFO_SIZE |
GP_FILE_INFO_TYPE | GP_FILE_INFO_PERMISSIONS |
GP_FILE_INFO_MTIME;
info->file.mtime = st.st_mtime;
@@ -406,12 +406,12 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
info->file.permissions |= GP_FILE_PERM_READ;
if (st.st_mode & S_IWUSR)
info->file.permissions |= GP_FILE_PERM_DELETE;
info->file.size = st.st_size;
info->file.size = st.st_size;
mime_type = get_mime_type (file);
if (!mime_type)
mime_type = GP_MIME_UNKNOWN;
strcpy (info->file.type, mime_type);
return (GP_OK);
return (GP_OK);
}
static int
@@ -446,10 +446,10 @@ set_info_func (CameraFilesystem *fs, const char *folder, const char *file,
#if 0 /* implement this using new api -Marcus */
if (info.file.fields & GP_FILE_INFO_NAME) {
if (!strcasecmp (info.file.name, file))
return (GP_OK);
if (!strcasecmp (info.file.name, file))
return (GP_OK);
/* We really have to rename the poor file... */
/* We really have to rename the poor file... */
if (strlen (folder) == 1) {
snprintf (path_old, sizeof (path_old), "/%s",
file);
@@ -461,29 +461,29 @@ set_info_func (CameraFilesystem *fs, const char *folder, const char *file,
snprintf (path_new, sizeof (path_new), "%s/%s",
folder, info.file.name);
}
retval = rename (path_old, path_new);
retval = rename (path_old, path_new);
if (retval != 0) {
switch (errno) {
case EISDIR:
return (GP_ERROR_DIRECTORY_EXISTS);
case EEXIST:
return (GP_ERROR_FILE_EXISTS);
case EINVAL:
return (GP_ERROR_BAD_PARAMETERS);
case EIO:
return (GP_ERROR_IO);
case ENOMEM:
return (GP_ERROR_NO_MEMORY);
case ENOENT:
return (GP_ERROR_FILE_NOT_FOUND);
default:
return (GP_ERROR);
}
}
switch (errno) {
case EISDIR:
return (GP_ERROR_DIRECTORY_EXISTS);
case EEXIST:
return (GP_ERROR_FILE_EXISTS);
case EINVAL:
return (GP_ERROR_BAD_PARAMETERS);
case EIO:
return (GP_ERROR_IO);
case ENOMEM:
return (GP_ERROR_NO_MEMORY);
case ENOENT:
return (GP_ERROR_FILE_NOT_FOUND);
default:
return (GP_ERROR);
}
}
}
#endif
return (GP_OK);
return (GP_OK);
}
static int
@@ -491,7 +491,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileType type, CameraFile *file, void *user_data,
GPContext *context)
{
char path[1024];
char path[1024];
int result = GP_OK;
struct stat stbuf;
int fd, id;
@@ -589,19 +589,19 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
static int
camera_manual (Camera *camera, CameraText *manual, GPContext *context)
{
strcpy (manual->text, _("The Directory Browse \"camera\" lets "
strcpy (manual->text, _("The Directory Browse \"camera\" lets "
"you index photos on your hard drive."));
return (GP_OK);
return (GP_OK);
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("Directory Browse Mode - written "
strcpy (about->text, _("Directory Browse Mode - written "
"by Scott Fritzinger <scottf@unr.edu>."));
return (GP_OK);
return (GP_OK);
}
static int
@@ -783,8 +783,8 @@ static CameraFilesystemFuncs fsfuncs = {
int
camera_init (Camera *camera, GPContext *context)
{
/* First, set up all the function pointers */
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
return gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* First, set up all the function pointers */
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
return gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
}

View File

@@ -110,7 +110,7 @@ bool dp_init_calibration(Camera *camera, bool force)
int i, j;
if (camera->pl->lut)
return true;
return true;
lut_file = malloc(64 + strlen(getenv("HOME")));
if (!lut_file)

View File

@@ -157,90 +157,90 @@ camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
gp_widget_new (GP_WIDGET_SECTION, _("Mono mode"), &section);
gp_widget_append (*window, section);
gp_widget_new (GP_WIDGET_RADIO, _("Depth"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Mono (b/w)"));
gp_widget_add_choice (widget, _("Grey (4bpp)"));
gp_widget_add_choice (widget, _("Grey (8bpp)"));
switch(camera->pl->profile[0x80]) {
case 0x00: gp_widget_set_value (widget, _("Mono (b/w)")); break;
case 0x01: gp_widget_set_value (widget, _("Grey (4bpp)")); break;
case 0x02: gp_widget_set_value (widget, _("Grey (8bpp)")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Depth"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Mono (b/w)"));
gp_widget_add_choice (widget, _("Grey (4bpp)"));
gp_widget_add_choice (widget, _("Grey (8bpp)"));
switch (camera->pl->profile[0x80]) {
case 0x00: gp_widget_set_value (widget, _("Mono (b/w)")); break;
case 0x01: gp_widget_set_value (widget, _("Grey (4bpp)")); break;
case 0x02: gp_widget_set_value (widget, _("Grey (8bpp)")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Lo Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("100 DPI"));
gp_widget_add_choice (widget, _("200 DPI"));
switch(camera->pl->profile[0x81]) {
case RES_100DPI: gp_widget_set_value (widget, _("100 DPI")); break;
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Lo Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("100 DPI"));
gp_widget_add_choice (widget, _("200 DPI"));
switch (camera->pl->profile[0x81]) {
case RES_100DPI: gp_widget_set_value (widget, _("100 DPI")); break;
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Hi Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("200 DPI"));
gp_widget_add_choice (widget, _("400 DPI"));
switch(camera->pl->profile[0x82]) {
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
case RES_400DPI: gp_widget_set_value (widget, _("400 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Hi Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("200 DPI"));
gp_widget_add_choice (widget, _("400 DPI"));
switch (camera->pl->profile[0x82]) {
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
case RES_400DPI: gp_widget_set_value (widget, _("400 DPI")); break;
}
gp_widget_new (GP_WIDGET_SECTION, _("Color Document mode"), &section);
gp_widget_append (*window, section);
gp_widget_new (GP_WIDGET_RADIO, _("Depth"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("NQ (12bpp)"));
switch(camera->pl->profile[0x83]) {
case 0x04: gp_widget_set_value (widget, _("NQ (12bpp)")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Depth"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("NQ (12bpp)"));
switch (camera->pl->profile[0x83]) {
case 0x04: gp_widget_set_value (widget, _("NQ (12bpp)")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Lo Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("100 DPI"));
gp_widget_add_choice (widget, _("200 DPI"));
switch(camera->pl->profile[0x84]) {
case RES_100DPI: gp_widget_set_value (widget, _("100 DPI")); break;
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Lo Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("100 DPI"));
gp_widget_add_choice (widget, _("200 DPI"));
switch (camera->pl->profile[0x84]) {
case RES_100DPI: gp_widget_set_value (widget, _("100 DPI")); break;
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Hi Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("200 DPI"));
gp_widget_add_choice (widget, _("400 DPI"));
switch(camera->pl->profile[0x85]) {
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
case RES_400DPI: gp_widget_set_value (widget, _("400 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Hi Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("200 DPI"));
gp_widget_add_choice (widget, _("400 DPI"));
switch (camera->pl->profile[0x85]) {
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
case RES_400DPI: gp_widget_set_value (widget, _("400 DPI")); break;
}
gp_widget_new (GP_WIDGET_SECTION, _("Color Photo mode"), &section);
gp_widget_append (*window, section);
gp_widget_new (GP_WIDGET_RADIO, _("Depth"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("HQ (24bpp)"));
switch(camera->pl->profile[0x86]) {
case 0x08: gp_widget_set_value (widget, _("HQ (24bpp)")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Depth"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("HQ (24bpp)"));
switch (camera->pl->profile[0x86]) {
case 0x08: gp_widget_set_value (widget, _("HQ (24bpp)")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Lo Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("100 DPI"));
gp_widget_add_choice (widget, _("200 DPI"));
switch(camera->pl->profile[0x87]) {
case RES_100DPI: gp_widget_set_value (widget, _("100 DPI")); break;
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Lo Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("100 DPI"));
gp_widget_add_choice (widget, _("200 DPI"));
switch (camera->pl->profile[0x87]) {
case RES_100DPI: gp_widget_set_value (widget, _("100 DPI")); break;
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Hi Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("200 DPI"));
gp_widget_add_choice (widget, _("400 DPI"));
switch(camera->pl->profile[0x88]) {
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
case RES_400DPI: gp_widget_set_value (widget, _("400 DPI")); break;
}
gp_widget_new (GP_WIDGET_RADIO, _("Hi Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("200 DPI"));
gp_widget_add_choice (widget, _("400 DPI"));
switch (camera->pl->profile[0x88]) {
case RES_200DPI: gp_widget_set_value (widget, _("200 DPI")); break;
case RES_400DPI: gp_widget_set_value (widget, _("400 DPI")); break;
}
return GP_OK;
}
@@ -654,12 +654,12 @@ camera_init (Camera *camera, GPContext *context)
{
char buf[64];
camera->functions->exit = camera_exit;
camera->functions->get_config = camera_config_get;
camera->functions->set_config = camera_config_set;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
camera->functions->get_config = camera_config_get;
camera->functions->set_config = camera_config_set;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
gp_filesystem_set_funcs(camera->fs, &fsfuncs, camera);

View File

@@ -62,10 +62,10 @@ static char* enigma13_static_toc=NULL;
static int enigma13_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("Download program for Digital Dream Enigma 1.3. "
"by <olivier@aixmarseille.com>, and adapted from spca50x driver. "
"Thank you, spca50x team, it was easy to port your driver on this cam! "));
return (GP_OK);
strcpy (about->text, _("Download program for Digital Dream Enigma 1.3. "
"by <olivier@aixmarseille.com>, and adapted from spca50x driver. "
"Thank you, spca50x team, it was easy to port your driver on this cam! "));
return (GP_OK);
}
@@ -78,17 +78,16 @@ static int enigma13_about (Camera *camera, CameraText *about, GPContext *context
*/
static int enigma13_detect_storage_type (Camera *camera)
{
int i;
char buf[3];
int i;
char buf[3];
for (i=0;i<3;i++)
{
CHECK (gp_port_usb_msg_read (camera->port, 0x28, 0x0000,
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]);
return GP_OK;
for (i=0;i<3;i++)
{
CHECK (gp_port_usb_msg_read (camera->port, 0x28, 0x0000, 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]);
return GP_OK;
}
#endif
@@ -106,11 +105,11 @@ static int
enigma13_flash_delete_all(CameraFilesystem *fs, const char *folder, void *data,
GPContext *context)
{
Camera *cam;
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;
Camera *cam;
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;
}
@@ -124,17 +123,15 @@ enigma13_flash_delete_all(CameraFilesystem *fs, const char *folder, void *data,
*/
static int enigma13_wait_for_ready(Camera *camera)
{
int timeout = ENIGMA13_WAIT_FOR_READY_TIMEOUT_S;
char ready = 1;
while (timeout--) {
sleep(1);
CHECK (gp_port_usb_msg_read (camera->port,
0x21, 0x0000, 0x0000,
(char*)&ready, 0x01));
if (ready==0)
return GP_OK;
}
return GP_ERROR;
int timeout = ENIGMA13_WAIT_FOR_READY_TIMEOUT_S;
char ready = 1;
while (timeout--) {
sleep(1);
CHECK (gp_port_usb_msg_read (camera->port, 0x21, 0x0000, 0x0000, (char*)&ready, 0x01));
if (ready==0)
return GP_OK;
}
return GP_ERROR;
}
@@ -148,14 +145,12 @@ static int enigma13_wait_for_ready(Camera *camera)
*/
static int enigma13_get_filecount (Camera *camera, int *filecount)
{
uint16_t response = 0;
CHECK(enigma13_wait_for_ready(camera));
CHECK (gp_port_usb_msg_read (camera->port,
0x54, 0x0000, 0x0000,
(char*)&response, 0x02));
le16toh (response);
*filecount = response;
return GP_OK;
uint16_t response = 0;
CHECK(enigma13_wait_for_ready(camera));
CHECK (gp_port_usb_msg_read (camera->port, 0x54, 0x0000, 0x0000, (char*)&response, 0x02));
le16toh (response);
*filecount = response;
return GP_OK;
}
#endif
@@ -169,52 +164,44 @@ static int enigma13_get_filecount (Camera *camera, int *filecount)
*/
static int enigma13_get_toc(Camera *camera, int *filecount, char** toc)
{
char* flash_toc=NULL;
int toc_size = 0;
char buf[10];
uint16_t response = 0;
int ret=1;
char* flash_toc=NULL;
int toc_size = 0;
char buf[10];
uint16_t response = 0;
int ret=1;
CHECK(enigma13_wait_for_ready(camera));
CHECK (gp_port_usb_msg_read (camera->port,
0x54, 0x0000, 0x0000,
(char*)&response, 0x02));
le16toh (response);
*filecount = response;
CHECK(enigma13_wait_for_ready(camera));
CHECK (gp_port_usb_msg_read (camera->port, 0x54, 0x0000, 0x0000, (char*)&response, 0x02));
le16toh (response);
*filecount = response;
/* Calc toc size */
toc_size = (response) * 0x20;
/* Calc toc size */
toc_size = (response) * 0x20;
if (toc_size % 0x200 != 0)
toc_size = ((toc_size / 0x200) + 1) * 0x200;
if (toc_size % 0x200 != 0)
toc_size = ((toc_size / 0x200) + 1) * 0x200;
CHECK(enigma13_wait_for_ready(camera));
CHECK (gp_port_usb_msg_write (camera->port, 0x54,
response, 0x0001,
NULL, 0x0000));
/* Wait until cam is ready to send the T.O.C */
CHECK (gp_port_usb_msg_write (camera->port, 0x54, response, 0x0001, NULL, 0x0000));
/* Wait until cam is ready to send the T.O.C */
usleep(ENIGMA13_WAIT_TOC_DELAY_MS * 1000);
CHECK (gp_port_usb_msg_read (camera->port, 0x21,
0x0000, 0x0000,
buf, 0x01));
if (buf[0]!=0x41) return GP_ERROR;
CHECK (gp_port_usb_msg_read (camera->port, 0x21, 0x0000, 0x0000, buf, 0x01));
if (buf[0]!=0x41) return GP_ERROR;
CHECK (gp_port_usb_msg_read (camera->port, 0x21,
0x0000, 0x0002,
buf, 0x01));
if (buf[0]!=0x01) return GP_ERROR;
CHECK (gp_port_usb_msg_read (camera->port, 0x21, 0x0000, 0x0002, buf, 0x01));
if (buf[0]!=0x01) return GP_ERROR;
flash_toc = (char*)malloc(toc_size);
if (!flash_toc)
return GP_ERROR_NO_MEMORY;
flash_toc = (char*)malloc(toc_size);
if (!flash_toc)
return GP_ERROR_NO_MEMORY;
ret=gp_port_read (camera->port, flash_toc, toc_size);
*toc= flash_toc;
ret=gp_port_read (camera->port, flash_toc, toc_size);
*toc= flash_toc;
gp_log(GP_LOG_DEBUG, "enigma13","Byte transferred :%d ", ret);
return ret;
return ret;
}
@@ -313,12 +300,12 @@ static int file_list_func (CameraFilesystem *fs, const char *folder, CameraList
{
Camera *camera = data;
int i, numpics;
char tmp[20];
char tmp[20];
CHECK(enigma13_get_toc(camera,&numpics,&enigma13_static_toc));
CHECK(enigma13_get_toc(camera,&numpics,&enigma13_static_toc));
for ( i=0; i < numpics; i=i+2 ) {
sprintf(tmp,"sunp%04d.jpg",(i/2));
sprintf(tmp,"sunp%04d.jpg",(i/2));
gp_list_append( list, tmp, NULL);
}
return (GP_OK);
@@ -337,30 +324,30 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
Camera *camera = data;
int image_no, result;
int image_no, result;
char* img_data=NULL;
int img_size=-1;
int img_size=-1;
image_no = gp_filesystem_number(fs, folder, filename, context);
gp_log(GP_LOG_DEBUG, "enigma13","Index of image %d is %s",image_no, filename);
switch (type) {
case GP_FILE_TYPE_NORMAL:
{
gp_log(GP_LOG_DEBUG, "enigma13","Downloading raw image");
image_no = gp_filesystem_number(fs, folder, filename, context);
gp_log(GP_LOG_DEBUG, "enigma13","Index of image %d is %s",image_no, filename);
switch (type) {
case GP_FILE_TYPE_NORMAL:
{
gp_log(GP_LOG_DEBUG, "enigma13","Downloading raw image");
CHECK(enigma13_download_img(camera, enigma13_static_toc, image_no, &img_data, &img_size));
result = gp_file_append( file, img_data, img_size);
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:
result = GP_ERROR_NOT_SUPPORTED;
result = GP_ERROR_NOT_SUPPORTED;
break;
}
if (result < 0)
return result;
return (GP_OK);
}
if (result < 0)
return result;
return (GP_OK);
}
int
@@ -400,16 +387,16 @@ camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
camera->functions->about = enigma13_about;
camera->functions->about = enigma13_about;
CHECK(gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera));
CHECK(gp_port_get_settings( camera->port, &settings));
settings.usb.inep = 0x82;
settings.usb.outep = 0x03;
settings.usb.config = 1;
settings.usb.interface = 0;
settings.usb.altsetting = 0;
CHECK(gp_port_set_timeout (camera->port, ENIGMA13_USB_TIMEOUT_MS));
settings.usb.inep = 0x82;
settings.usb.outep = 0x03;
settings.usb.config = 1;
settings.usb.interface = 0;
settings.usb.altsetting = 0;
CHECK(gp_port_set_timeout (camera->port, ENIGMA13_USB_TIMEOUT_MS));
CHECK(gp_port_set_settings( camera->port, settings));
return GP_OK;

View File

@@ -121,38 +121,38 @@ static int
fuji_send (Camera *camera, unsigned char *cmd, unsigned int cmd_len,
unsigned char last, GPContext *context)
{
unsigned char b[1024], check;
unsigned int i;
unsigned char b[1024], check;
unsigned int i;
/* Send header */
b[0] = ESC;
b[1] = STX;
CR (gp_port_write (camera->port, (char *)b, 2));
/* Send header */
b[0] = ESC;
b[1] = STX;
CR (gp_port_write (camera->port, (char *)b, 2));
/*
/*
* Escape the data we are going to send.
* Calculate the checksum.
*/
check = (last ? ETX : ETB);
memcpy (b, cmd, cmd_len);
for (i = 0; i < cmd_len; i++) {
memcpy (b, cmd, cmd_len);
for (i = 0; i < cmd_len; i++) {
check ^= b[i];
if (b[i] == ESC) {
memmove (b + i + 1, b + i, cmd_len - i);
b[i] = ESC;
i++;
cmd_len++;
}
}
if (b[i] == ESC) {
memmove (b + i + 1, b + i, cmd_len - i);
b[i] = ESC;
i++;
cmd_len++;
}
}
/* Send data */
CR (gp_port_write (camera->port, (char *)b, cmd_len));
/* Send data */
CR (gp_port_write (camera->port, (char *)b, cmd_len));
/* Send footer */
b[0] = ESC;
b[1] = (last ? ETX : ETB);
b[2] = check;
CR (gp_port_write (camera->port, (char *)b, 3));
/* Send footer */
b[0] = ESC;
b[1] = (last ? ETX : ETB);
b[2] = check;
CR (gp_port_write (camera->port, (char *)b, 3));
return (GP_OK);
}
@@ -300,8 +300,7 @@ fuji_transmit (Camera *camera, unsigned char *cmd, unsigned int cmd_len,
*/
p = ((*buf_len > 1024) ? 1 : 0);
if (p)
id = gp_context_progress_start (context, *buf_len,
_("Downloading..."));
id = gp_context_progress_start (context, *buf_len, _("Downloading..."));
*buf_len = 0;
retries = 0;
while (!last) {
@@ -310,7 +309,7 @@ fuji_transmit (Camera *camera, unsigned char *cmd, unsigned int cmd_len,
retries++;
while (gp_port_read (camera->port, (char *)&c, 1) >= 0);
if (++retries > 2)
return (r);
return (r);
GP_DEBUG ("Retrying...");
c = NAK;
CR (gp_port_write (camera->port, (char *)&c, 1));
@@ -842,22 +841,22 @@ fuji_get_cmds (Camera *camera, unsigned char *cmds, GPContext *context)
static int get_picture_info(int num,char *name,CameraPrivateLibrary *camdata){
DBG("Getting name...");
DBG("Getting name...");
strncpy(name,fuji_picture_name(num),100);
strncpy(name, fuji_picture_name(num), 100);
DBG2("%s\n",name);
DBG2("%s\n", name);
/*
* To find the picture number, go to the first digit. According to
* recent Exif specs, n_off can be either 3 or 4.
*/
if (camdata->has_cmd[FUJI_SIZE]) fuji_size=fuji_picture_size(num);
else {
fuji_size=70000; /* this is an overestimation for DS7 */
DBG2("Image size not obtained, guessing %d",fuji_size);
};
return (fuji_size);
/*
* To find the picture number, go to the first digit. According to
* recent Exif specs, n_off can be either 3 or 4.
*/
if (camdata->has_cmd[FUJI_SIZE]) fuji_size=fuji_picture_size(num);
else {
fuji_size=70000; /* this is an overestimation for DS7 */
DBG2("Image size not obtained, guessing %d", fuji_size);
};
return (fuji_size);
};
static void get_picture_list (FujiData *fjd)
@@ -875,10 +874,10 @@ static void get_picture_list (FujiData *fjd)
};
for (i = 1; i <= pictures; i++) {
DBG("Getting name...");
DBG("Getting name...");
name = strdup(fuji_picture_name(i));
pinfo[i].name = name;
name = strdup(fuji_picture_name(i));
pinfo[i].name = name;
DBG2("%s\n",name);
@@ -905,7 +904,7 @@ static int download_picture(int n,int thumb,CameraFile *file,CameraPrivateLibrar
DBG3("download_picture: %d,%s",n,thumb?"thumb":"pic");
if (!thumb) {
fuji_size=get_picture_info(n,name,fjd);
fuji_size=get_picture_info(n,name,fjd);
DBG3("Info %3d %12s ", n, name);
}
else fuji_size=10500; /* Probably not same for all cams, better way ? */

View File

@@ -28,7 +28,7 @@ enum _FujiCmd {
FUJI_CMD_PIC_GET = 0x02,
FUJI_CMD_PIC_GET_THUMB = 0x00,
FUJI_CMD_SPEED = 0x07,
FUJI_CMD_VERSION = 0x09,
FUJI_CMD_VERSION = 0x09,
FUJI_CMD_PIC_NAME = 0x0a,
FUJI_CMD_PIC_COUNT = 0x0b,
@@ -40,30 +40,30 @@ enum _FujiCmd {
FUJI_CMD_UNKNOWN4 = 0x11, /* Figure this out! */
FUJI_CMD_UNKNOWN5 = 0x13, /* Figure this out! */
FUJI_CMD_PIC_SIZE = 0x17,
FUJI_CMD_PIC_DEL = 0x19,
FUJI_CMD_PIC_SIZE = 0x17,
FUJI_CMD_PIC_DEL = 0x19,
FUJI_CMD_AVAIL_MEM = 0x1b,
FUJI_CMD_UNKNOWN10 = 0x20, /* Figure this out! */
FUJI_CMD_UNKNOWN11 = 0x22, /* Figure this out! */
FUJI_CMD_TAKE = 0x27,
FUJI_CMD_TAKE = 0x27,
FUJI_CMD_MODEL = 0x29,
FUJI_CMD_UNKNOWN13 = 0x2a, /* Figure this out! */
FUJI_CMD_UNKNOWN13 = 0x2a, /* Figure this out! */
FUJI_CMD_UNKNOWN14 = 0x2b, /* Figure this out! */
FUJI_CMD_UNKNOWN15 = 0x2e, /* Figure this out! */
/* Flash related commands */
FUJI_CMD_FLASH_GET = 0x30,
FUJI_CMD_FLASH_SET = 0x32,
FUJI_CMD_FLASH_CHARGE = 0x34,
FUJI_CMD_FLASH_CHARGE = 0x34,
FUJI_CMD_CMDS_VALID = 0x4c,
FUJI_CMD_CMDS_VALID = 0x4c,
FUJI_CMD_UNKNOWN16 = 0x51, /* Figure this out! */
FUJI_CMD_PREVIEW = 0x64,
FUJI_CMD_PREVIEW = 0x64,
/* Configurable settings */
FUJI_CMD_ID_GET = 0x80,

View File

@@ -67,25 +67,25 @@ struct _CameraPrivateLibrary {
};
static const struct {
FujiCmd command;
const char *name;
FujiCmd command;
const char *name;
} Commands[] = {
{FUJI_CMD_PIC_GET, "get picture"},
{FUJI_CMD_PIC_GET_THUMB, "get thumbnail"},
{FUJI_CMD_SPEED, "change speed"},
{FUJI_CMD_VERSION, "get version"},
{FUJI_CMD_PIC_NAME, "get name of picture"},
{FUJI_CMD_PIC_COUNT, "get number of pictures"},
{FUJI_CMD_PIC_SIZE, "get size of picture"},
{FUJI_CMD_PIC_DEL, "delete picture"},
{FUJI_CMD_TAKE, "capture picture"},
{FUJI_CMD_FLASH_GET, "get flash mode"},
{FUJI_CMD_FLASH_SET, "set flash mode"},
{FUJI_CMD_PIC_GET, "get picture"},
{FUJI_CMD_PIC_GET_THUMB, "get thumbnail"},
{FUJI_CMD_SPEED, "change speed"},
{FUJI_CMD_VERSION, "get version"},
{FUJI_CMD_PIC_NAME, "get name of picture"},
{FUJI_CMD_PIC_COUNT, "get number of pictures"},
{FUJI_CMD_PIC_SIZE, "get size of picture"},
{FUJI_CMD_PIC_DEL, "delete picture"},
{FUJI_CMD_TAKE, "capture picture"},
{FUJI_CMD_FLASH_GET, "get flash mode"},
{FUJI_CMD_FLASH_SET, "set flash mode"},
{FUJI_CMD_FLASH_CHARGE, "charge flash"},
{FUJI_CMD_CMDS_VALID, "list valid commands"},
{FUJI_CMD_PREVIEW, "capture preview"},
{FUJI_CMD_CMDS_VALID, "list valid commands"},
{FUJI_CMD_PREVIEW, "capture preview"},
{FUJI_CMD_DATE_GET, "get date"},
{0, NULL}};
{0, NULL} };
static const char *
cmd_get_name (FujiCmd command)
@@ -384,10 +384,9 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
const char *id;
/* Date & Time */
if ((gp_widget_get_child_by_label (window, _("Date & Time"),
&widget) >= 0) &&
gp_widget_changed (widget)) {
gp_widget_set_changed (widget, 0);
if ((gp_widget_get_child_by_label (window, _("Date & Time"), &widget) >= 0) &&
gp_widget_changed (widget)) {
gp_widget_set_changed (widget, 0);
CR (gp_widget_get_value (widget, &t));
tm = localtime (&t);
date.year = tm->tm_year;
@@ -402,7 +401,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
/* ID */
if ((gp_widget_get_child_by_label (window, _("ID"), &widget) >= 0) &&
gp_widget_changed (widget)) {
gp_widget_set_changed (widget, 0);
gp_widget_set_changed (widget, 0);
CR (gp_widget_get_value (widget, &id));
CR (fuji_id_set (camera, id, context));
}

View File

@@ -161,8 +161,7 @@ gsmart300_request_file (CameraPrivateLibrary * lib, CameraFile *file,
if (!mybuf)
return GP_ERROR_NO_MEMORY;
ret = gsmart300_download_data (lib, __GS300_PIC, g_file->index,
flash_size, mybuf);
ret = gsmart300_download_data (lib, __GS300_PIC, g_file->index, flash_size, mybuf);
if (ret < GP_OK) {
free (mybuf);
return ret;
@@ -258,8 +257,7 @@ gsmart300_get_image_thumbnail (CameraPrivateLibrary * lib, CameraFile *file,
mybuf = malloc (size);
if (!mybuf)
return (GP_ERROR_NO_MEMORY);
ret = gsmart300_download_data (lib, __GS300_THUMB, g_file->index,
size, mybuf);
ret = gsmart300_download_data (lib, __GS300_THUMB, g_file->index, size, mybuf);
if (ret < GP_OK) {
free (mybuf);
return ret;
@@ -393,14 +391,12 @@ gsmart300_get_FATs (CameraPrivateLibrary * lib)
p = lib->fats;
while (index < lib->num_files) {
CHECK (gsmart300_download_data (lib, __GS300_FAT, index,
FLASH_PAGE_SIZE_300, p));
CHECK (gsmart300_download_data (lib, __GS300_FAT, index, FLASH_PAGE_SIZE_300, p));
if (p[0] == 0xFF)
break;
type = p[0];
if (type == 0x00) {
lib->files[file_index].mime_type =
GSMART_FILE_TYPE_IMAGE;
lib->files[file_index].mime_type = GSMART_FILE_TYPE_IMAGE;
lib->files[file_index].index = index;
lib->files[file_index].fat = p;
lib->files[file_index].width = (p[8] & 0xFF) * 16;

View File

@@ -260,15 +260,14 @@ get_file_func (CameraFilesystem *fs, const char *folder,
Camera *camera = user_data;
int number, filetype;
CHECK (number = gp_filesystem_number (camera->fs, folder, filename,
context));
CHECK (number = gp_filesystem_number (camera->fs, folder, filename, context));
switch (type) {
case GP_FILE_TYPE_NORMAL:
CHECK (gsmart300_request_file (camera->pl, file, number));
break;
case GP_FILE_TYPE_PREVIEW:
CHECK (gsmart300_request_thumbnail
(camera->pl, file, number, &filetype));
(camera->pl, file, number, &filetype));
if (filetype == GSMART_FILE_TYPE_IMAGE) {
CHECK (gp_file_set_mime_type (file, GP_MIME_BMP));
}
@@ -289,8 +288,7 @@ 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,
context));
CHECK (n = gp_filesystem_number (camera->fs, folder, filename, context));
CHECK (gsmart300_get_file_info (camera->pl, n, &file));
@@ -321,17 +319,16 @@ 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,
context));
CHECK (n = gp_filesystem_number (camera->fs, folder, filename, context));
CHECK (c = gp_filesystem_count (camera->fs, folder, context));
if (n + 1 != c) {
const char *name;
gp_filesystem_name (fs, "/", c - 1, &name, context);
gp_context_error (context,
_("Your camera only supports deleting "
"the last file on the camera. In this "
"case, this is file '%s'."), name);
_("Your camera only supports deleting "
"the last file on the camera. In this "
"case, this is file '%s'."), name);
return (GP_ERROR);
}
CHECK (gsmart300_delete_file (camera->pl, n));

View File

@@ -54,59 +54,58 @@
#define GP_MODULE "iclick"
static struct {
char *name;
char *name;
CameraDriverStatus status;
unsigned short idVendor;
unsigned short idProduct;
unsigned short idVendor;
unsigned short idProduct;
} models[] = {
{"iClick 5X", GP_DRIVER_STATUS_EXPERIMENTAL, 0x2770, 0x9153},
{"iClick 5X", GP_DRIVER_STATUS_EXPERIMENTAL, 0x2770, 0x9153},
{NULL,0,0,0}
};
int
camera_id (CameraText *id)
{
strcpy (id->text, "iClick 5X");
strcpy (id->text, "iClick 5X");
return GP_OK;
return GP_OK;
}
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
int i;
CameraAbilities a;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
if (a.status == GP_DRIVER_STATUS_EXPERIMENTAL)
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
if (a.status == GP_DRIVER_STATUS_EXPERIMENTAL)
a.operations = GP_OPERATION_NONE;
else
a.operations = GP_OPERATION_CAPTURE_PREVIEW;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
a.file_operations = GP_FILE_OPERATION_PREVIEW + GP_FILE_OPERATION_RAW;
gp_abilities_list_append (list, a);
}
gp_abilities_list_append (list, a);
}
return GP_OK;
return GP_OK;
}
static int
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
sprintf (summary->text,_("Your USB camera is an iClick 5X.\n"
"The total number of pictures taken is %i\n"),
sprintf (summary->text, _("Your USB camera is an iClick 5X.\n"
"The total number of pictures taken is %i\n"),
camera->pl->nb_entries);
camera->pl->nb_entries);
return GP_OK;
return GP_OK;
}
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
@@ -131,10 +130,10 @@ static int camera_manual (Camera *camera, CameraText *manual, GPContext *context
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("iClick 5X driver\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
strcpy (about->text, _("iClick 5X driver\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
return GP_OK;
return GP_OK;
}
/*************** File and Downloading Functions *******************/
@@ -144,7 +143,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;
unsigned char buf[1024];
GP_DEBUG ("List files in %s\n", folder);
@@ -166,7 +165,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 entry, w, h; /* frame; */
unsigned char *frame_data, *frame_ptr;
unsigned char *ppm, *ptr;
@@ -259,7 +258,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
case GP_FILE_TYPE_RAW:
gp_file_set_mime_type (file, GP_MIME_RAW);
gp_file_adjust_name_for_mime_type (file);
gp_file_set_data_and_size (file, (char *)frame_data, datasize);
gp_file_set_data_and_size (file, (char *)frame_data, datasize);
return (GP_OK);
default:
return GP_ERROR_NOT_SUPPORTED;
@@ -297,7 +296,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
gp_file_set_mime_type (file, GP_MIME_PPM);
gp_file_set_data_and_size (file, (char *)ppm, ppmsize);
free (frame_data);
return GP_OK;
return GP_OK;
}
@@ -333,10 +332,10 @@ camera_init(Camera *camera, GPContext *context)
int ret = 0;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
GP_DEBUG ("Initializing the camera\n");
@@ -346,7 +345,7 @@ camera_init(Camera *camera, GPContext *context)
ret = gp_port_set_settings(camera->port,settings);
if (ret < 0) return ret;
/* Tell the CameraFilesystem where to get lists from */
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = malloc (sizeof (CameraPrivateLibrary));

View File

@@ -273,25 +273,25 @@ static CameraFilesystemFuncs fsfuncs = {
int camera_init (Camera *camera, GPContext *context)
{
gp_port_settings settings;
gp_port_settings settings;
/* First, set up all the function pointers */
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->get_config = camera_config_get;
camera->functions->set_config = camera_config_set;
/* Configure port */
gp_port_set_timeout(camera->port, 1000);
/* Configure port */
gp_port_set_timeout(camera->port, 1000);
gp_port_get_settings(camera->port, &settings);
settings.serial.speed = 115200;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits= 1;
gp_port_set_settings(camera->port, settings);
settings.serial.speed = 115200;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits= 1;
gp_port_set_settings(camera->port, settings);
/* Set up the filesystem */
gp_filesystem_set_funcs(camera->fs, &fsfuncs, camera);
/* test camera */
return jd11_ping(camera->port);
/* test camera */
return jd11_ping(camera->port);
}

View File

@@ -41,42 +41,42 @@
#if 0
static int
dread(GPPort *port, caddr_t buf, int xsize) {
int i;
int ret = gp_port_read(port,buf,xsize);
int i;
int ret = gp_port_read(port, buf, xsize);
if (ret == -1) {
perror("dread");
return -1;
}
fprintf(stderr,"dread[%d]:",ret);
for (i=0;i<ret;i++) fprintf(stderr,"%02x,",buf[i]);
fprintf(stderr,"\n");
return ret;
if (ret == -1) {
perror("dread");
return -1;
}
fprintf(stderr, "dread[%d]:", ret);
for (i=0;i<ret;i++) fprintf(stderr, "%02x,", buf[i]);
fprintf(stderr, "\n");
return ret;
}
static int
dwrite(GPPort*port, caddr_t buf, int xsize) {
int i;
int ret = gp_port_write(port,buf,xsize);
int i;
int ret = gp_port_write(port, buf, xsize);
if (ret < GP_OK) {
perror("dwrite");
return -1;
}
fprintf(stderr,"dwrite[%d/%d]:",xsize,ret);
for (i=0;i<xsize;i++) fprintf(stderr,"%02x,",buf[i]);
fprintf(stderr,"\n");
return ret;
if (ret < GP_OK) {
perror("dwrite");
return -1;
}
fprintf(stderr, "dwrite[%d/%d]:", xsize, ret);
for (i=0;i<xsize;i++) fprintf(stderr, "%02x,", buf[i]);
fprintf(stderr, "\n");
return ret;
}
#endif
#define READ(port,buf,len) gp_port_read(port,(char*)(buf),len)
#define WRITE(port,buf,len) gp_port_write(port,(char*)(buf),len)
static int _send_cmd(GPPort *port,unsigned short cmd) {
unsigned char buf[2];
buf[0] = cmd>>8;
buf[1] = cmd&0xff;
return WRITE(port,buf,2);
static int _send_cmd(GPPort *port, unsigned short cmd) {
unsigned char buf[2];
buf[0] = cmd>>8;
buf[1] = cmd&0xff;
return WRITE(port, buf, 2);
}
static int _read_cmd(GPPort *port,unsigned short *xcmd) {
@@ -109,29 +109,29 @@ static void _dump_buf(unsigned char *buf,int size) {
#endif
static int _send_cmd_2(GPPort *port,unsigned short cmd, unsigned short *xcmd) {
unsigned char buf[2];
int ret, tries = 3;
*xcmd = 0x4242;
while (tries--) {
int i = 0;
buf[0] = cmd>>8;
buf[1] = cmd&0xff;
ret = WRITE(port,buf,2);
do {
if (1==(ret=READ(port,buf,1))) {
if (buf[0]==0xff) {
if (1==READ(port,buf+1,1)) {
*xcmd = (buf[0] << 8)| buf[1];
return GP_OK;
}
static int _send_cmd_2(GPPort *port, unsigned short cmd, unsigned short *xcmd) {
unsigned char buf[2];
int ret, tries = 3;
*xcmd = 0x4242;
while (tries--) {
int i = 0;
buf[0] = cmd>>8;
buf[1] = cmd&0xff;
ret = WRITE(port, buf, 2);
do {
if (1==(ret=READ(port, buf, 1))) {
if (buf[0]==0xff) {
if (1==READ(port, buf+1, 1)) {
*xcmd = (buf[0] << 8)| buf[1];
return GP_OK;
}
}
} else {
return ret;
}
} else {
return ret;
}
} while (i++<3);
}
return GP_ERROR_IO;
} while (i++<3);
}
return GP_ERROR_IO;
}
int jd11_ping(GPPort *port) {
@@ -140,12 +140,12 @@ int jd11_ping(GPPort *port) {
int ret,tries = 3;
while (tries--) {
ret = GP_ERROR_IO;
while (1==READ(port,buf,1))
/* drain input queue before PING */;
ret=_send_cmd_2(port,0xff08,&xcmd);
if ((ret>=GP_OK) && (xcmd==0xfff1))
return GP_OK;
ret = GP_ERROR_IO;
while (1==READ(port, buf, 1))
/* drain input queue before PING */;
ret=_send_cmd_2(port, 0xff08, &xcmd);
if ((ret>=GP_OK) && (xcmd==0xfff1))
return GP_OK;
}
return ret;
}
@@ -155,18 +155,18 @@ jd11_get_rgb(GPPort *port,float *red, float *green, float *blue) {
char buf[10];
int ret=GP_OK,tries=0,curread=0;
_send_cmd(port,0xffa7);
_send_cmd(port, 0xffa7);
while ((curread<10) && (tries++<30)) {
ret=READ(port,buf+curread,sizeof(buf)-curread);
if (ret < 0)
continue;
if (ret == 0)
break;
curread+=ret;
ret=READ(port, buf+curread, sizeof(buf)-curread);
if (ret < 0)
continue;
if (ret == 0)
break;
curread+=ret;
}
if(curread<10) {
fprintf(stderr,"%d returned bytes on float query.\n",ret);
return GP_ERROR_IO;
if (curread<10) {
fprintf(stderr, "%d returned bytes on float query.\n", ret);
return GP_ERROR_IO;
}
/*_dump_buf(buf,10);*/
*green = buf[1]+buf[2]*0.1+buf[3]*0.01;
@@ -201,9 +201,9 @@ jd11_select_index(GPPort *port) { /* select index */
ret = _send_cmd_2(port,0xffa4,&xcmd);
if (ret < GP_OK)
return ret;
return ret;
if (xcmd!=0xff01)
return GP_ERROR_IO;
return GP_ERROR_IO;
return GP_OK;
}
@@ -211,11 +211,11 @@ int
jd11_select_image(GPPort *port,int nr) { /* select image <nr> */
unsigned short xcmd;
_send_cmd(port,0xffa1);
_send_cmd(port,0xff00|nr);
_read_cmd(port,&xcmd);
_send_cmd(port, 0xffa1);
_send_cmd(port, 0xff00|nr);
_read_cmd(port, &xcmd);
if (xcmd != 0xff01)
return GP_ERROR_IO;
return GP_ERROR_IO;
return GP_OK;
}
@@ -224,7 +224,7 @@ jd11_set_bulb_exposure(GPPort *port,int i) {
unsigned short xcmd;
if ((i<1) || (i>9))
return GP_ERROR_BAD_PARAMETERS;
return GP_ERROR_BAD_PARAMETERS;
_send_cmd(port,0xffa9);
_send_cmd(port,0xff00|i);
@@ -275,26 +275,26 @@ jd11_imgsize(GPPort *port) {
int ret;
int i=0,curread=0;
_send_cmd(port,0xfff0);
_send_cmd(port, 0xfff0);
do {
ret=READ(port,&buf[curread],10-curread);
ret=READ(port, &buf[curread], 10-curread);
if (ret>0)
curread+=ret;
curread+=ret;
usleep(1000);
} while ((i++<20) && (curread<10));
/*_dump_buf(buf,curread);*/
if (!curread) /* We get 0 bytes return for 0 images. */
return 0;
ret=strtol(&buf[2],NULL,16);
return 0;
ret=strtol(&buf[2], NULL, 16);
return ret;
}
static int
getpacket(GPPort *port,unsigned char *buf, int expect) {
int curread = 0, csum = 0;
int curread = 0, csum = 0;
int tries = 0;
if (expect == 200)
expect++;
expect++;
while (tries++<5) {
int i=0,ret;
@@ -308,11 +308,11 @@ getpacket(GPPort *port,unsigned char *buf, int expect) {
usleep(100);
} while ((i++<2) && (curread<expect));
if (curread!=expect) {
if (!curread)
return 0;
_send_cmd(port,0xfff3);
curread = csum = 0;
continue;
if (!curread)
return 0;
_send_cmd(port, 0xfff3);
curread = csum = 0;
continue;
}
/*printf("curread is %d\n",curread);*/
/*printf("PACKET:");_dump_buf(buf,curread);*/
@@ -343,213 +343,212 @@ jd11_erase_all(GPPort *port) {
*/
int
jd11_index_reader(GPPort *port, CameraFilesystem *fs, GPContext *context) {
int i, id, count, xsize, curread=0, ret=0;
unsigned char *indexbuf;
int i, id, count, xsize, curread=0, ret=0;
unsigned char *indexbuf;
ret = jd11_select_index(port);
if (ret != GP_OK)
return ret;
xsize = jd11_imgsize(port);
if (!xsize) { /* shortcut, no reading needed */
ret = jd11_select_index(port);
if (ret != GP_OK)
return ret;
xsize = jd11_imgsize(port);
if (!xsize) { /* shortcut, no reading needed */
return GP_OK;
}
count = xsize/(64*48);
xsize = count * (64*48);
indexbuf = malloc(xsize);
if (!indexbuf) return GP_ERROR_NO_MEMORY;
id = gp_context_progress_start (context, xsize,
_("Downloading thumbnail..."));
_send_cmd(port, 0xfff1);
while (curread < xsize) {
int readsize = xsize-curread;
if (readsize>200) readsize = 200;
ret=getpacket(port, indexbuf+curread, readsize);
if (ret==0)
break;
curread+=ret;
if (ret<200)
break;
gp_context_progress_update (context, id, curread);
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL) {
/* What to do...Just free the stuff we allocated for now.*/
free(indexbuf);
return GP_ERROR_CANCEL;
}
_send_cmd(port, 0xfff1);
}
gp_context_progress_stop (context, id);
for (i=0;i<count;i++) {
CameraFile *file;
char fn[20];
unsigned char *src;
unsigned char thumb[64*48];
int y;
CameraFileInfo info;
ret = gp_file_new(&file);
if (ret!=GP_OK) {
free(indexbuf);
return ret;
}
sprintf(fn, "image%02i.pgm", i);
gp_file_set_mime_type(file, GP_MIME_PGM);
gp_file_append(file, THUMBHEADER, strlen(THUMBHEADER));
src = indexbuf+(i*64*48);
for (y=0;y<48;y++) {
int x, off = 64*y;
for (x=0;x<64;x++)
thumb[47*64-off+(63-x)] = src[off+x];
}
ret = gp_file_append(file, (char*)thumb, sizeof(thumb));
if (ret != GP_OK) {
free(indexbuf);
gp_file_free (file);
return ret;
}
ret = gp_filesystem_append(fs, "/", fn, context);
if (ret != GP_OK) {
/* should perhaps remove the entry again */
free(indexbuf);
gp_file_free (file);
return ret;
}
ret = gp_filesystem_set_file_noop(fs, "/", fn, GP_FILE_TYPE_PREVIEW, file, context);
if (ret != GP_OK) {
free(indexbuf);
return ret;
}
memset (&info, 0, sizeof (info));
/* 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_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_SIZE;
strcpy(info.preview.type, GP_MIME_PGM);
info.preview.width = 64;
info.preview.height = 48;
info.preview.size = 64*48+strlen(THUMBHEADER);
ret = gp_filesystem_set_info_noop(fs, "/", fn, info, context);
}
free(indexbuf);
return GP_OK;
}
count = xsize/(64*48);
xsize = count * (64*48);
indexbuf = malloc(xsize);
if (!indexbuf) return GP_ERROR_NO_MEMORY;
id = gp_context_progress_start (context, xsize,
_("Downloading thumbnail..."));
_send_cmd(port,0xfff1);
while (curread < xsize) {
int readsize = xsize-curread;
if (readsize>200) readsize = 200;
ret=getpacket(port,indexbuf+curread,readsize);
if (ret==0)
break;
curread+=ret;
if (ret<200)
break;
gp_context_progress_update (context, id, curread);
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL) {
/* What to do...Just free the stuff we allocated for now.*/
free(indexbuf);
return GP_ERROR_CANCEL;
}
_send_cmd(port,0xfff1);
}
gp_context_progress_stop (context, id);
for (i=0;i<count;i++) {
CameraFile *file;
char fn[20];
unsigned char *src;
unsigned char thumb[64*48];
int y;
CameraFileInfo info;
ret = gp_file_new(&file);
if (ret!=GP_OK) {
free(indexbuf);
return ret;
}
sprintf(fn,"image%02i.pgm",i);
gp_file_set_mime_type(file, GP_MIME_PGM);
gp_file_append(file, THUMBHEADER, strlen(THUMBHEADER));
src = indexbuf+(i*64*48);
for (y=0;y<48;y++) {
int x,off = 64*y;
for (x=0;x<64;x++)
thumb[47*64-off+(63-x)] = src[off+x];
}
ret = gp_file_append(file,(char*)thumb,sizeof(thumb));
if (ret != GP_OK) {
free(indexbuf);
gp_file_free (file);
return ret;
}
ret = gp_filesystem_append(fs, "/", fn, context);
if (ret != GP_OK) {
/* should perhaps remove the entry again */
free(indexbuf);
gp_file_free (file);
return ret;
}
ret = gp_filesystem_set_file_noop(fs, "/", fn, GP_FILE_TYPE_PREVIEW, file, context);
if (ret != GP_OK) {
free(indexbuf);
return ret;
}
memset (&info, 0, sizeof (info));
/* 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_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_SIZE;
strcpy(info.preview.type,GP_MIME_PGM);
info.preview.width = 64;
info.preview.height = 48;
info.preview.size = 64*48+strlen(THUMBHEADER);
ret = gp_filesystem_set_info_noop(fs, "/", fn, info, context);
}
free(indexbuf);
return GP_OK;
}
static int
serial_image_reader(Camera *camera,CameraFile *file,int nr,unsigned char ***imagebufs,int *sizes, GPContext *context) {
int picnum,curread,ret=0;
GPPort *port = camera->port;
unsigned int id;
serial_image_reader(Camera *camera, CameraFile *file, int nr, unsigned char ***imagebufs, int *sizes, GPContext *context) {
int picnum, curread, ret=0;
GPPort *port = camera->port;
unsigned int id;
jd11_select_image(port,nr);
*imagebufs = (unsigned char**)malloc(3*sizeof(unsigned char*));
for (picnum=0;picnum<3;picnum++) {
curread=0;
sizes[picnum] = jd11_imgsize(port);
(*imagebufs)[picnum]=(unsigned char*)malloc(sizes[picnum]+400);
_send_cmd(port,0xfff1);
id = gp_context_progress_start (context, sizes[picnum],
jd11_select_image(port, nr);
*imagebufs = (unsigned char**)malloc(3*sizeof(unsigned char*));
for (picnum=0;picnum<3;picnum++) {
curread=0;
sizes[picnum] = jd11_imgsize(port);
(*imagebufs)[picnum]=(unsigned char*)malloc(sizes[picnum]+400);
_send_cmd(port, 0xfff1);
id = gp_context_progress_start (context, sizes[picnum],
_("Downloading data..."));
while (curread<sizes[picnum]) {
int readsize = sizes[picnum]-curread;
if (readsize > 200) readsize = 200;
ret=getpacket(port,(*imagebufs)[picnum]+curread,readsize);
if (ret==0)
break;
curread+=ret;
if (ret<200)
break;
gp_context_progress_update (context, id, curread);
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL) {
int j;
/* What to do ... Just free the stuff we allocated for now. */
for (j=0;j<picnum;j++)
free((*imagebufs)[picnum]);
free(*imagebufs);
return GP_ERROR_CANCEL;
}
_send_cmd(port,0xfff1);
while (curread<sizes[picnum]) {
int readsize = sizes[picnum]-curread;
if (readsize > 200) readsize = 200;
ret=getpacket(port, (*imagebufs)[picnum]+curread, readsize);
if (ret==0)
break;
curread+=ret;
if (ret<200)
break;
gp_context_progress_update (context, id, curread);
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL) {
int j;
/* What to do ... Just free the stuff we allocated for now. */
for (j=0;j<picnum;j++)
free((*imagebufs)[picnum]);
free(*imagebufs);
return GP_ERROR_CANCEL;
}
_send_cmd(port, 0xfff1);
}
gp_context_progress_stop (context, id);
}
gp_context_progress_stop (context, id);
}
return GP_OK;
return GP_OK;
}
int
jd11_get_image_full(
Camera *camera, CameraFile*file, int nr, int raw, GPContext *context
) {
unsigned char *s,*uncomp[3],**imagebufs;
int ret,sizes[3];
unsigned char *data;
int h;
jd11_get_image_full(Camera *camera, CameraFile*file, int nr, int raw, GPContext *context)
{
unsigned char *s, *uncomp[3], **imagebufs;
int ret, sizes[3];
unsigned char *data;
int h;
ret = serial_image_reader(camera,file,nr,&imagebufs,sizes, context);
if (ret!=GP_OK)
return ret;
uncomp[0] = malloc(320*480);
uncomp[1] = malloc(320*480/2);
uncomp[2] = malloc(320*480/2);
if (sizes[0]!=115200) {
picture_decomp_v1(imagebufs[0],uncomp[0],320,480);
picture_decomp_v1(imagebufs[1],uncomp[1],320,480/2);
picture_decomp_v1(imagebufs[2],uncomp[2],320,480/2);
} else {
picture_decomp_v2(imagebufs[0],uncomp[0],320,480);
picture_decomp_v2(imagebufs[1],uncomp[1],320,480/2);
picture_decomp_v2(imagebufs[2],uncomp[2],320,480/2);
}
gp_file_append(file, IMGHEADER, strlen(IMGHEADER));
data = malloc(640*480*3);
if (!data) {
free(uncomp[0]);free(uncomp[1]);free(uncomp[2]);
free(imagebufs[0]);free(imagebufs[1]);free(imagebufs[2]);free(imagebufs);
return GP_ERROR_NO_MEMORY;
}
ret = serial_image_reader(camera, file, nr, &imagebufs, sizes, context);
if (ret!=GP_OK)
return ret;
uncomp[0] = malloc(320*480);
uncomp[1] = malloc(320*480/2);
uncomp[2] = malloc(320*480/2);
if (sizes[0]!=115200) {
picture_decomp_v1(imagebufs[0], uncomp[0], 320, 480);
picture_decomp_v1(imagebufs[1], uncomp[1], 320, 480/2);
picture_decomp_v1(imagebufs[2], uncomp[2], 320, 480/2);
} else {
picture_decomp_v2(imagebufs[0], uncomp[0], 320, 480);
picture_decomp_v2(imagebufs[1], uncomp[1], 320, 480/2);
picture_decomp_v2(imagebufs[2], uncomp[2], 320, 480/2);
}
gp_file_append(file, IMGHEADER, strlen(IMGHEADER));
data = malloc(640*480*3);
if (!data) {
free(uncomp[0]);free(uncomp[1]);free(uncomp[2]);
free(imagebufs[0]);free(imagebufs[1]);free(imagebufs[2]);free(imagebufs);
return GP_ERROR_NO_MEMORY;
}
if (!raw) {
unsigned char *bayerpre;
s = bayerpre = malloc(640*480);
/* note that picture is upside down and left<->right mirrored */
for (h=480;h--;) {
int w;
for (w=320;w--;) {
if (h&1) {
/* G B G B G B G B G */
*s++ = uncomp[0][h*320+w];
*s++ = uncomp[2][(h/2)*320+w];
} else {
/* R G R G R G R G R */
*s++ = uncomp[1][(h/2)*320+w];
*s++ = uncomp[0][h*320+w];
if (!raw) {
unsigned char *bayerpre;
s = bayerpre = malloc(640*480);
/* note that picture is upside down and left<->right mirrored */
for (h=480;h--;) {
int w;
for (w=320;w--;) {
if (h&1) {
/* G B G B G B G B G */
*s++ = uncomp[0][h*320+w];
*s++ = uncomp[2][(h/2)*320+w];
} else {
/* R G R G R G R G R */
*s++ = uncomp[1][(h/2)*320+w];
*s++ = uncomp[0][h*320+w];
}
}
}
/*gp_bayer_decode(bayerpre,640,480,data,BAYER_TILE_GRBG);*/
gp_ahd_decode(bayerpre, 640, 480, data, BAYER_TILE_GRBG);
free(bayerpre);
} else {
s=data;
for (h=480;h--;) { /* upside down */
int w;
for (w=640;w--;) { /* right to left */
/* and images are in green red blue */
*s++=uncomp[1][(h/2)*320+(w/2)];
*s++=uncomp[0][h*320+(w/2)];
*s++=uncomp[2][(h/2)*320+(w/2)];
}
}
}
}
/*gp_bayer_decode(bayerpre,640,480,data,BAYER_TILE_GRBG);*/
gp_ahd_decode(bayerpre,640,480,data,BAYER_TILE_GRBG);
free(bayerpre);
} else {
s=data;
for (h=480;h--;) { /* upside down */
int w;
for (w=640;w--;) { /* right to left */
/* and images are in green red blue */
*s++=uncomp[1][(h/2)*320+(w/2)];
*s++=uncomp[0][h*320+(w/2)];
*s++=uncomp[2][(h/2)*320+(w/2)];
}
}
}
free(uncomp[0]);free(uncomp[1]);free(uncomp[2]);
free(imagebufs[0]);free(imagebufs[1]);free(imagebufs[2]);free(imagebufs);
gp_file_append(file, (char*)data, 640*480*3);
free(data);
return GP_OK;
free(uncomp[0]);free(uncomp[1]);free(uncomp[2]);
free(imagebufs[0]);free(imagebufs[1]);free(imagebufs[2]);free(imagebufs);
gp_file_append(file, (char*)data, 640*480*3);
free(data);
return GP_OK;
}

View File

@@ -136,14 +136,14 @@ jl2005a_read_picture_data (Camera *camera, GPPort *port,
* downloading them. There is only a starting point and an indicator
* for each frame.
*/
gp_port_write (port, "\xab\x00", 2);
gp_port_write (port, "\xa1\x04", 2);
gp_port_write (port, "\xab\x00", 2);
gp_port_write (port, "\xa2\x08", 2);
gp_port_write (port, "\xab\x00", 2);
gp_port_write (port, "\xa1\x05", 2);
gp_port_write (port, "\xab\x00", 2);
gp_port_write (port, "\xa2\x08", 2);
gp_port_write (port, "\xab\x00", 2);
gp_port_write (port, "\xa1\x04", 2);
gp_port_write (port, "\xab\x00", 2);
gp_port_write (port, "\xa2\x08", 2);
gp_port_write (port, "\xab\x00", 2);
gp_port_write (port, "\xa1\x05", 2);
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);

View File

@@ -112,7 +112,7 @@ static int camera_manual (Camera *camera, CameraText *manual, GPContext *context
{
strcpy(manual->text,
_(
"This driver supports cameras with Jeilin jl2005a chip \n"
"This driver supports cameras with Jeilin jl2005a chip \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"
@@ -130,7 +130,7 @@ static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("jl2005a camera library\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
"Theodore Kilgore <kilgota@auburn.edu>\n"));
return GP_OK;
}

View File

@@ -453,7 +453,7 @@ camera_init (Camera *camera, GPContext *context)
int ret = 0;
/* First, set up all the function pointers */
camera->functions->manual = camera_manual;
camera->functions->manual = camera_manual;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;

View File

@@ -300,7 +300,7 @@ static int delete_file_func (CameraFilesystem *fs, const char *folder,
static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context) {
CameraList *list;
int count;
const char* name;
const char* name;
if (type != GP_CAPTURE_IMAGE)
return (GP_ERROR_NOT_SUPPORTED);
@@ -323,53 +323,51 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
CHECK_RESULT (gp_filesystem_append (camera->fs,
path->folder,
path->name, context));
return (GP_OK);
return (GP_OK);
}
static int camera_summary (Camera *camera, CameraText *summary,
GPContext *context)
static int camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
static char summary_string[2048] = "";
char buff[1024];
Kodak_dc120_status status;
static char summary_string[2048] = "";
char buff[1024];
Kodak_dc120_status status;
if (dc120_get_status (camera, &status, context))
{
strcpy(summary_string,"Kodak DC120\n");
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 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, "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, "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, "Battery Status: %d\n", status.batteryStatusId);
strcat(summary_string, buff);
snprintf(buff,1024,"AC Status: %d\n",status.acStatusId);
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);
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);
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);
strcpy(summary->text, summary_string);
return (GP_OK);
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,
_("The Kodak DC120 camera uses the KDC file format "
@@ -401,41 +399,41 @@ static CameraFilesystemFuncs fsfuncs = {
int camera_init (Camera *camera, GPContext *context) {
GPPortSettings settings;
GPPortSettings settings;
int speed;
/* First, set up all the function pointers */
/* First, set up all the function pointers */
camera->functions->capture = camera_capture;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* Configure the port (remember the speed) */
gp_port_get_settings (camera->port, &settings);
speed = settings.serial.speed;
settings.serial.speed = 9600;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
gp_port_set_settings (camera->port, settings);
gp_port_set_timeout (camera->port, TIMEOUT);
settings.serial.speed = 9600;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
gp_port_set_settings (camera->port, settings);
gp_port_set_timeout (camera->port, TIMEOUT);
/* Reset the camera to 9600 */
gp_port_send_break (camera->port, 2);
/* Reset the camera to 9600 */
gp_port_send_break (camera->port, 2);
/* Wait for it to update */
usleep(1500 * 1000);
/* Wait for it to update */
usleep(1500 * 1000);
if (dc120_set_speed (camera, speed) == GP_ERROR) {
return (GP_ERROR);
}
return (GP_ERROR);
}
/* Try to talk after speed change */
if (dc120_get_status(camera, NULL, context) == GP_ERROR) {
return (GP_ERROR);
}
/* Try to talk after speed change */
if (dc120_get_status(camera, NULL, context) == GP_ERROR) {
return (GP_ERROR);
}
return (GP_OK);
return (GP_OK);
}

View File

@@ -59,14 +59,14 @@ dc120_packet_new (int command_byte) {
*/
static int
dc120_response_ok (unsigned char response) {
/* This is stupid. how do you get a constant of type signed char?? (Ralf) */
if( response == 0x00 || /* Command completed */
response == 0x10 || /* Command ready */
response == 0xd1 || /* Command received (ACK) */
response == 0xd2 ) /* Correct packet */
return (GP_OK);
else
return (GP_ERROR);
/* This is stupid. how do you get a constant of type signed char?? (Ralf) */
if (response == 0x00 || /* Command completed */
response == 0x10 || /* Command ready */
response == 0xd1 || /* Command received (ACK) */
response == 0xd2 ) /* Correct packet */
return (GP_OK);
else
return (GP_ERROR);
}
/** Writes a packet to the port.
@@ -169,21 +169,21 @@ read_data_write_again:
/* Do some command-specific stuff */
switch (cmd_packet[0]) {
case 0x4A:
case 0x4A:
/* Set size and num_packets for camera filenames*/
if (packets_received==1)
*size = ((unsigned char)packet[0] * 256 +
(unsigned char)packet[1])* 20 + 2;
num_packets = (*size + block_size-1) / block_size;
break;
case 0x64:
case 0x54:
case 0x64:
case 0x54:
/* If thumbnail, cancel rest of image transfer */
if ((num_packets == 16)&&(packets_received==16))
p[0] = CANCL;
/* No break on purpose */
break;
default:
default:
/* Nada */
break;
}
@@ -194,10 +194,10 @@ read_data_write_again:
/* Copy in data */
if (packets_received == num_packets)
bytes_received = *size - ((num_packets-1) * block_size);
bytes_received = *size - ((num_packets-1) * block_size);
else
bytes_received = block_size;
gp_file_append(file, packet, bytes_received );
bytes_received = block_size;
gp_file_append(file, packet, bytes_received);
}
}
@@ -295,66 +295,66 @@ int dc120_get_status (Camera *camera, Kodak_dc120_status *status, GPContext *con
size = 256;
retval = dc120_packet_read_data(camera, file, p, &size, 256, context);
if( retval == (GP_OK) && status != NULL )
{
const char *data;
long unsigned int lsize;
if (retval == (GP_OK) && status != NULL)
{
const char *data;
long unsigned int lsize;
gp_file_get_data_and_size( file, &data, &lsize );
if( lsize<122 ) {
gp_file_free (file);
free (p);
return (GP_ERROR);
}
gp_file_get_data_and_size(file, &data, &lsize);
if (lsize<122) {
gp_file_free (file);
free (p);
return (GP_ERROR);
}
memset((char*)status,0,sizeof(*status));
memset((char*)status, 0, sizeof(*status));
status->camera_type_id = data[1];
status->firmware_major = data[2];
status->firmware_minor = data[3];
status->batteryStatusId = data[8];
status->acStatusId = data[9];
status->camera_type_id = data[1];
status->firmware_major = data[2];
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[15]) / 2;
/* seconds since unix epoc */
status->time = CAMERA_EPOC + (
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];
status->compression_mode_id = data[19];
status->flash_mode = data[20];
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 +
data[27]) / 2;
status->shutter_delay = data[29];
status->memory_card = data[30];
status->front_cover = data[31];
status->date_format = data[32];
status->time_format = data[33];
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 +
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 +
data[67+i*2];
}
strncpy( status->card_id, data + 77, 32 );
strncpy( status->camera_id, data + 90, 32 );
}
status->af_mode = data[16] & 0x0f;
status->zoom_mode = (data[16] & 0x30)>>4;
status->flash_charged = data[18];
status->compression_mode_id = data[19];
status->flash_mode = data[20];
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 +
data[27]) / 2;
status->shutter_delay = data[29];
status->memory_card = data[30];
status->front_cover = data[31];
status->date_format = data[32];
status->time_format = data[33];
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 +
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 +
data[67+i*2];
}
strncpy(status->card_id, data + 77, 32);
strncpy(status->camera_id, data + 90, 32);
}
gp_file_free(file);
@@ -431,11 +431,11 @@ int dc120_get_filenames (Camera *camera, int from_card, int album_number, Camera
gp_file_get_data_and_size (file, &file_data, &file_size);
x=2;
while (x < size) {
if( file_data[x] != '\0' ) {
strncpy(buf, (char*) &file_data[x], 11);
buf[7] = '.';
buf[11] = '\0';
gp_list_append(list, buf, NULL);
if (file_data[x] != '\0') {
strncpy(buf, (char*)&file_data[x], 11);
buf[7] = '.';
buf[11] = '\0';
gp_list_append(list, buf, NULL);
}
x += 20;
}
@@ -483,8 +483,8 @@ static int dc120_get_file_preview (Camera *camera, CameraFile *file, int file_nu
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;
CameraFile *size_file; /* file used to determine the filesize */
char *p;
const char *file_data;
long unsigned int file_size;
unsigned int offset;
@@ -508,12 +508,12 @@ static int dc120_get_file (Camera *camera, CameraFile *file, int file_number, ch
gp_file_get_data_and_size (size_file, &file_data, &file_size);
offset = 2 + (file_number-1) * 20;
if( file_size < (offset+19) )
{
gp_file_free(size_file);
free (p);
return (GP_ERROR);
}
if (file_size < (offset+19))
{
gp_file_free(size_file);
free (p);
return (GP_ERROR);
}
*size = (unsigned char)file_data[offset + 16] * 256*256*256 +
(unsigned char)file_data[offset + 17] * 256*256 +
@@ -525,7 +525,7 @@ static int dc120_get_file (Camera *camera, CameraFile *file, int file_number, ch
free (p);
if (dc120_packet_read_data(camera, file, cmd_packet, size, 1024, context)==GP_ERROR)
return (GP_ERROR);
return (GP_ERROR);
return (GP_OK);
@@ -544,12 +544,12 @@ static int dc120_wait_for_completion (Camera *camera, GPContext *context) {
retval = dc120_packet_read(camera, p, 1);
switch (retval) {
case GP_ERROR:
case GP_ERROR:
return (GP_ERROR);
break;
case GP_ERROR_TIMEOUT:
case GP_ERROR_TIMEOUT:
break;
default:
default:
done = 1;
}
gp_context_progress_update (context, id, x);
@@ -596,19 +596,19 @@ int dc120_file_action (Camera *camera, int action, int from_card, int album_numb
p[4] = album_number;
switch (action) {
case DC120_ACTION_PREVIEW:
p[0] = (from_card? 0x64 : 0x54);
case DC120_ACTION_PREVIEW:
p[0] = (from_card ? 0x64 : 0x54);
retval = dc120_get_file_preview(camera, file, file_number, p, &size, context);
break;
case DC120_ACTION_IMAGE:
p[0] = (from_card? 0x64 : 0x54);
case DC120_ACTION_IMAGE:
p[0] = (from_card ? 0x64 : 0x54);
retval = dc120_get_file(camera, file, file_number, p, &size, context);
break;
case DC120_ACTION_DELETE:
p[0] = (from_card? 0x7B : 0x7A);
case DC120_ACTION_DELETE:
p[0] = (from_card ? 0x7B : 0x7A);
retval = dc120_delete_file(camera, p, context);
break;
default:
default:
retval = GP_ERROR;
}
free(p);
@@ -617,20 +617,18 @@ int dc120_file_action (Camera *camera, int action, int from_card, int album_numb
int dc120_capture (Camera *camera, CameraFilePath *path, GPContext *context)
{
int retval;
char *p = dc120_packet_new(0x77);
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);
}
else if ( dc120_wait_for_completion(camera, context) == GP_ERROR ) {
retval = (GP_ERROR);
}
else {
retval = (GP_OK);
}
/* Take the picture to Flash memory */
if (dc120_packet_write(camera, p, 8, 1) == GP_ERROR) {
retval = (GP_ERROR);
} else if (dc120_wait_for_completion(camera, context) == GP_ERROR) {
retval = (GP_ERROR);
} else {
retval = (GP_OK);
}
free( p );
return retval;
free(p);
return retval;
}

View File

@@ -122,7 +122,7 @@ static int delete_file_func (CameraFilesystem *fs, const char *folder,
static int get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
CameraFileInfo *info, void *data, GPContext *context)
{
Camera *camera = data;
Camera *camera = data;
dc210_picture_info picinfo;
if (dc210_get_picture_info_by_name(camera, &picinfo, file) == GP_ERROR)
@@ -186,10 +186,10 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
gp_widget_new (GP_WIDGET_SECTION, _("File"), &section);
gp_widget_append (*window, section);
gp_widget_new (GP_WIDGET_RADIO, _("File type"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("JPEG"));
gp_widget_add_choice (widget, _("FlashPix"));
gp_widget_new (GP_WIDGET_RADIO, _("File type"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("JPEG"));
gp_widget_add_choice (widget, _("FlashPix"));
switch (status.file_type){
case DC210_FILE_TYPE_JPEG:
@@ -199,10 +199,10 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
};
gp_widget_get_value (widget, &wvalue);
gp_widget_new (GP_WIDGET_RADIO, _("File resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("640 x 480"));
gp_widget_add_choice (widget, _("1152 x 864"));
gp_widget_new (GP_WIDGET_RADIO, _("File resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("640 x 480"));
gp_widget_add_choice (widget, _("1152 x 864"));
switch (status.resolution){
case DC210_FILE_640:
@@ -214,11 +214,11 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
};
gp_widget_get_value (widget, &wvalue);
gp_widget_new (GP_WIDGET_MENU, _("File compression"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Low (best quality)"));
gp_widget_add_choice (widget, _("Medium (better quality)"));
gp_widget_add_choice (widget, _("High (good quality)"));
gp_widget_new (GP_WIDGET_MENU, _("File compression"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Low (best quality)"));
gp_widget_add_choice (widget, _("Medium (better quality)"));
gp_widget_add_choice (widget, _("High (good quality)"));
switch (status.compression_type){
case DC210_LOW_COMPRESSION:
@@ -233,14 +233,14 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
gp_widget_new (GP_WIDGET_SECTION, _("Capture"), &section);
gp_widget_append (*window, section);
gp_widget_new (GP_WIDGET_MENU, _("Zoom"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, "58 mm"); /* no need to translate strings with SI units! */
gp_widget_add_choice (widget, "51 mm");
gp_widget_add_choice (widget, "41 mm");
gp_widget_add_choice (widget, "34 mm");
gp_widget_add_choice (widget, "29 mm");
gp_widget_add_choice (widget, _("Macro"));
gp_widget_new (GP_WIDGET_MENU, _("Zoom"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, "58 mm"); /* no need to translate strings with SI units! */
gp_widget_add_choice (widget, "51 mm");
gp_widget_add_choice (widget, "41 mm");
gp_widget_add_choice (widget, "34 mm");
gp_widget_add_choice (widget, "29 mm");
gp_widget_add_choice (widget, _("Macro"));
switch (status.zoom){
case DC210_ZOOM_58:
@@ -258,19 +258,19 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
};
gp_widget_get_value (widget, &wvalue);
gp_widget_new (GP_WIDGET_MENU, _("Exposure compensation"), &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_MENU, _("Exposure compensation"), &widget);
gp_widget_append (section, widget);
for (i = 0; i < sizeof(exp_comp)/sizeof(*exp_comp); i++){
gp_widget_add_choice (widget, exp_comp[i]);
if ((unsigned int)(status.exp_compensation + 4) == i)
gp_widget_set_value (widget, exp_comp[i]);
};
gp_widget_new (GP_WIDGET_RADIO, _("Flash"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Auto"));
gp_widget_add_choice (widget, _("Force"));
gp_widget_add_choice (widget, _("None"));
gp_widget_new (GP_WIDGET_RADIO, _("Flash"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Auto"));
gp_widget_add_choice (widget, _("Force"));
gp_widget_add_choice (widget, _("None"));
switch (status.flash){
case DC210_FLASH_AUTO:
@@ -282,10 +282,10 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
};
gp_widget_get_value (widget, &wvalue);
gp_widget_new (GP_WIDGET_RADIO, _("Red eye flash"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
gp_widget_new (GP_WIDGET_RADIO, _("Red eye flash"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
if (status.preflash)
gp_widget_set_value (widget, _("On"));
@@ -296,15 +296,15 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
gp_widget_new (GP_WIDGET_SECTION, _("Other"), &section);
gp_widget_append (*window, section);
gp_widget_new (GP_WIDGET_BUTTON, "Set time to system time", &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_BUTTON, "Set time to system time", &widget);
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);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_MENU, _("Port speed"), &widget);
gp_widget_append (section, widget);
for (i = 0; i < sizeof(abilities.speed); i++){
if (abilities.speed[i] == 0) break;
snprintf(stringbuffer, 12, "%d", abilities.speed[i]);
@@ -313,13 +313,13 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
gp_widget_set_value (widget, stringbuffer);
};
gp_widget_new (GP_WIDGET_TEXT, _("Album name"), &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_TEXT, _("Album name"), &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, status.album_name);
gp_widget_set_info (widget, _("Name to set on card when formatting."));
gp_widget_new (GP_WIDGET_BUTTON, _("Format compact flash"), &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_BUTTON, _("Format compact flash"), &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, dc210_format_callback);
gp_widget_set_info (widget, _("Format card and set album name."));
@@ -327,20 +327,20 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context)
gp_widget_new (GP_WIDGET_SECTION, _("Debug"), &section);
gp_widget_append (*window, section);
gp_widget_new (GP_WIDGET_TEXT, "Parameter 1", &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_TEXT, "Parameter 1", &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, "0");
gp_widget_new (GP_WIDGET_TEXT, "Parameter 2", &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_TEXT, "Parameter 2", &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, "0");
gp_widget_new (GP_WIDGET_TEXT, "Parameter 3", &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_TEXT, "Parameter 3", &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, "0");
gp_widget_new (GP_WIDGET_BUTTON, "Execute debug command", &widget);
gp_widget_append (section, widget);
gp_widget_new (GP_WIDGET_BUTTON, "Execute debug command", &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, dc210_debug_callback);
gp_widget_set_info (widget, _("Execute predefined command\nwith parameter values."));
#endif
@@ -357,7 +357,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("File type"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
if (wvalue[0] == 'J')
dc210_set_file_type(camera, DC210_FILE_TYPE_JPEG);
@@ -367,7 +367,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("File resolution"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
switch(wvalue[0]){
case '6':
@@ -381,7 +381,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("File compression"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
switch(wvalue[0]){
case 'L':
@@ -397,7 +397,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Zoom"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
switch(wvalue[0]){
case '5':
@@ -423,7 +423,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Exposure compensation"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
for (i = 0; i < sizeof(exp_comp)/sizeof(*exp_comp); i++){
if (strncmp(wvalue, exp_comp[i], 4) == 0){
@@ -435,7 +435,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Port speed"), &w);
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &wvalue);
dc210_set_speed(camera, atoi(wvalue));
};
@@ -443,8 +443,8 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
gp_widget_get_child_by_label (window, _("Flash"), &w);
gp_widget_get_child_by_label (window, _("Red eye flash"), &w2);
if (gp_widget_changed (w) || gp_widget_changed(w2)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w2, 0);
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w2, 0);
gp_widget_get_value (w, &wvalue);
gp_widget_get_value (w2, &w2value);
switch(wvalue[0]){
@@ -479,7 +479,7 @@ static int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePat
}
static int camera_capture_preview (Camera* camera, CameraFile* file, GPContext *context){
/* this function is to slow; don't export it */
/* this function is to slow; don't export it */
int fatal_error = 0;
if (dc210_take_picture(camera, context) == GP_ERROR) return GP_ERROR;
@@ -492,150 +492,148 @@ static int camera_capture_preview (Camera* camera, CameraFile* file, GPContext *
};
static int camera_summary (Camera *camera, CameraText *summary,
GPContext *context)
static int camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
static char summary_string[2048] = "";
char buff[1024];
dc210_status status;
static char summary_string[2048] = "";
char buff[1024];
dc210_status status;
if (GP_OK == dc210_get_status (camera, &status))
{
strcpy(summary_string,"Kodak DC210\n");
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);
snprintf(buff, 1024, _("Pictures in camera: %d\n"),
status.numPicturesInCamera);
strcat(summary_string, buff);
snprintf(buff,1024,_("There is space for another\n %d low compressed\n %d medium compressed or\n %d high compressed pictures\n"),
status.remainingLow, status.remainingMedium, status.remainingHigh);
strcat(summary_string,buff);
snprintf(buff, 1024, _("There is space for another\n %d low compressed\n %d medium compressed or\n %d high compressed pictures\n"),
status.remainingLow, status.remainingMedium, status.remainingHigh);
strcat(summary_string, buff);
snprintf(buff,1024,_("Total pictures taken: %d\n"),
status.totalPicturesTaken);
strcat(summary_string,buff);
snprintf(buff, 1024, _("Total pictures taken: %d\n"),
status.totalPicturesTaken);
strcat(summary_string, buff);
snprintf(buff,1024,_("Total flashes fired: %d\n"),
status.totalFlashesFired);
strcat(summary_string,buff);
snprintf(buff, 1024, _("Total flashes fired: %d\n"),
status.totalFlashesFired);
strcat(summary_string, buff);
snprintf(buff,1024,_("Firmware: %d.%d\n"),status.firmwareMajor,status.firmwareMinor);
strcat(summary_string,buff);
snprintf(buff, 1024, _("Firmware: %d.%d\n"), status.firmwareMajor, status.firmwareMinor);
strcat(summary_string, buff);
switch (status.file_type){
case DC210_FILE_TYPE_JPEG:
snprintf(buff, 1024, _("Filetype: JPEG (")); break;
case DC210_FILE_TYPE_FPX:
snprintf(buff, 1024, _("Filetype: FlashPix (")); break;
};
strcat(summary_string, buff);
switch (status.file_type) {
case DC210_FILE_TYPE_JPEG:
snprintf(buff, 1024, _("Filetype: JPEG (")); break;
case DC210_FILE_TYPE_FPX:
snprintf(buff, 1024, _("Filetype: FlashPix (")); break;
};
strcat(summary_string, buff);
switch (status.compression_type){
case DC210_LOW_COMPRESSION:
snprintf(buff, 1024, _("low compression, ")); break;
case DC210_MEDIUM_COMPRESSION:
snprintf(buff, 1024, _("medium compression, ")); break;
case DC210_HIGH_COMPRESSION:
snprintf(buff, 1024, _("high compression, ")); break;
default:
snprintf(buff, 1024, _("unknown compression %d, "), status.compression_type); break;
};
strcat(summary_string, buff);
switch (status.compression_type) {
case DC210_LOW_COMPRESSION:
snprintf(buff, 1024, _("low compression, ")); break;
case DC210_MEDIUM_COMPRESSION:
snprintf(buff, 1024, _("medium compression, ")); break;
case DC210_HIGH_COMPRESSION:
snprintf(buff, 1024, _("high compression, ")); break;
default:
snprintf(buff, 1024, _("unknown compression %d, "), status.compression_type); break;
};
strcat(summary_string, buff);
switch (status.resolution){
case DC210_FILE_640:
snprintf(buff, 1024, "640x480 pixel)\n"); break;
case DC210_FILE_1152:
snprintf(buff, 1024, "1152x864 pixel)\n"); break;
default:
snprintf(buff, 1024, _("unknown resolution %d)\n"), status.resolution); break;
};
strcat(summary_string, buff);
switch (status.resolution) {
case DC210_FILE_640:
snprintf(buff, 1024, "640x480 pixel)\n"); break;
case DC210_FILE_1152:
snprintf(buff, 1024, "1152x864 pixel)\n"); break;
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;
case 1: snprintf(buff,1024,"Battery charge is low\n"); break;
case 2: snprintf(buff,1024,"Battery is not charged\n"); 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;
case 1: snprintf(buff,1024,"Battery charge is low\n"); break;
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:
snprintf(buff, 1024, _("Zoom: 58 mm\n")); break;
case DC210_ZOOM_51:
snprintf(buff, 1024, _("Zoom: 51 mm\n")); break;
case DC210_ZOOM_41:
snprintf(buff, 1024, _("Zoom: 41 mm\n")); break;
case DC210_ZOOM_34:
snprintf(buff, 1024, _("Zoom: 34 mm\n")); break;
case DC210_ZOOM_29:
snprintf(buff, 1024, _("Zoom: 29 mm\n")); break;
case DC210_ZOOM_MACRO:
snprintf(buff, 1024, _("Zoom: macro\n")); break;
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
snprintf(buff, 1024, _("Exposure compensation: %d\n"), status.exp_compensation);
strcat(summary_string,buff);
switch (status.flash){
case DC210_FLASH_AUTO:
snprintf(buff, 1024, _("Flash mode: auto, ")); break;
case DC210_FLASH_FORCE:
snprintf(buff, 1024, _("Flash mode: force, ")); break;
case DC210_FLASH_NONE:
snprintf(buff, 1024, _("Flash mode: off\n")); break;
default:
snprintf(buff, 1024, _("Unknown flash mode %d, "),
status.flash); break;
};
strcat(summary_string,buff);
if (status.flash != DC210_FLASH_NONE){
if (status.preflash)
/* trans: continuation of "Flash mode:" line */
snprintf(buff,1024,_("red eye flash on.\n"));
if (status.acstatus)
snprintf(buff, 1024, _("AC adapter is connected.\n"));
else
/* trans: continuation of "Flash mode:" line */
snprintf(buff,1024,_("red eye flash off.\n"));
strcat(summary_string,buff);
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:
snprintf(buff, 1024, _("Zoom: 58 mm\n")); break;
case DC210_ZOOM_51:
snprintf(buff, 1024, _("Zoom: 51 mm\n")); break;
case DC210_ZOOM_41:
snprintf(buff, 1024, _("Zoom: 41 mm\n")); break;
case DC210_ZOOM_34:
snprintf(buff, 1024, _("Zoom: 34 mm\n")); break;
case DC210_ZOOM_29:
snprintf(buff, 1024, _("Zoom: 29 mm\n")); break;
case DC210_ZOOM_MACRO:
snprintf(buff, 1024, _("Zoom: macro\n")); break;
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
snprintf(buff, 1024, _("Exposure compensation: %d\n"), status.exp_compensation);
strcat(summary_string, buff);
switch (status.flash) {
case DC210_FLASH_AUTO:
snprintf(buff, 1024, _("Flash mode: auto, ")); break;
case DC210_FLASH_FORCE:
snprintf(buff, 1024, _("Flash mode: force, ")); break;
case DC210_FLASH_NONE:
snprintf(buff, 1024, _("Flash mode: off\n")); break;
default:
snprintf(buff, 1024, _("Unknown flash mode %d, "),
status.flash); break;
};
strcat(summary_string, buff);
if (status.flash != DC210_FLASH_NONE) {
if (status.preflash)
/* trans: continuation of "Flash mode:" line */
snprintf(buff, 1024, _("red eye flash on.\n"));
else
/* trans: continuation of "Flash mode:" line */
snprintf(buff, 1024, _("red eye flash off.\n"));
strcat(summary_string, buff);
};
if (status.card_status.open == 0)
snprintf(buff, 1024, _("No card in camera.\n"));
else
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");
};
if (status.card_status.open == 0)
snprintf(buff, 1024, _("No card in camera.\n"));
else
snprintf(buff,1024, _("Card name: %s\nFree space on card: %d kB\n"),
status.album_name,
status.card_status.space);
strcpy(summary->text, summary_string);
strcat(summary_string,buff);
}
else{
DC210_DEBUG("Couldn't get summary for camera\n");
};
strcpy(summary->text, summary_string);
return (GP_OK);
return (GP_OK);
}
@@ -671,20 +669,20 @@ int camera_init (Camera *camera, GPContext *context) {
DC210_DEBUG("Initializing camera.\n");
/* First, set up all the function pointers */
/* First, set up all the function pointers */
camera->functions->get_config = camera_get_config;
camera->functions->set_config = camera_set_config;
camera->functions->capture = camera_capture;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
if (dc210_init_port (camera) == GP_ERROR) return GP_ERROR;
if (dc210_open_card (camera) == GP_ERROR) return GP_ERROR;
return (GP_OK);
return (GP_OK);
}
/****************************************************************************/

View File

@@ -82,11 +82,11 @@ typedef struct {
dc210_zoom_type zoom;
char flash_charged;
dc210_compression_type compression_type;
signed char exp_compensation;
signed char exp_compensation;
dc210_flash_type flash;
char preflash;
dc210_resolution_type resolution;
dc210_file_type_type file_type;
dc210_file_type_type file_type;
int totalPicturesTaken;
int totalFlashesFired;
int numPicturesInCamera;

View File

@@ -47,9 +47,8 @@ static char oldstatus[DC210_STATUS_SIZE];
****************************************************************************/
static void cfa2ppm
(CameraFile * file)
{
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 rgb[THUMBHEIGHT][THUMBWIDTH][3];
@@ -138,9 +137,8 @@ static void cfa2ppm
/* Utility procedures for command execution */
static void dc210_cmd_init
(char * cmd, unsigned char command_byte)
{
static void dc210_cmd_init (char * cmd, unsigned char command_byte) {
/* utility procedure to initialize a command string */
memset (cmd, 0, 8);
@@ -150,9 +148,8 @@ static void dc210_cmd_init
};
static void dc210_cmd_packet_init
(char * cmd_packet, const char * filename)
{
static void dc210_cmd_packet_init (char * cmd_packet, const char * filename) {
/* prepare command packet */
memset (cmd_packet, 0x00, DC210_CMD_DATA_SIZE);
memset (cmd_packet + 48, 0xFF, 8);
@@ -163,9 +160,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 */
int i;
@@ -179,9 +175,7 @@ static int dc210_write_single_char
};
static int dc210_read_single_char
(Camera *camera, unsigned char * response)
{
static int dc210_read_single_char (Camera *camera, unsigned char * response) {
/* utility procedure to read a single character */
@@ -211,9 +205,7 @@ static int dc210_read_single_char
/* Command execution */
static int dc210_execute_command
(Camera *camera, char *cmd)
{
static int dc210_execute_command (Camera *camera, char *cmd) {
/* This procedure sends a command to the camera and
waits for acknowledgement. Calling procedures have
@@ -221,7 +213,7 @@ static int dc210_execute_command
there are three possible follow ups:
- Read a DC210_COMMAND_COMPLETE in case of
simple commands
- Send an additional command package in case of
- Send an additional command package in case of
sophisticated commands
- Read data from the camera
But all this depends on the command and should not
@@ -285,9 +277,7 @@ static int dc210_execute_command
/* appropriate actions to a command */
static int dc210_write_command_packet
(Camera * camera, char * data)
{
static int dc210_write_command_packet (Camera * camera, char * data) {
unsigned char checksum;
int i, error;
@@ -331,9 +321,8 @@ static int dc210_write_command_packet
};
static int dc210_wait_for_response
(Camera *camera, int expect_busy, GPContext *context)
{
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,
a DC210_COMMAND_COMPLETE or a
@@ -346,155 +335,151 @@ static int dc210_wait_for_response
int progress_id = 0;
if (context)
progress_id = gp_context_progress_start (context, expect_busy, _("Waiting..."));
progress_id = gp_context_progress_start (context, expect_busy, _("Waiting..."));
while (1){
while (1) {
error = dc210_read_single_char(camera, &response);
if (error < 0){
if (context)
gp_context_progress_stop (context, progress_id);
return error;
};
error = dc210_read_single_char(camera, &response);
if (error < 0) {
if (context)
gp_context_progress_stop (context, progress_id);
return error;
};
switch (response){
case DC210_BUSY:
/* wait a little bit longer */
if (context && counter <= expect_busy)
gp_context_progress_update (context, progress_id, counter++);
break;
case DC210_COMMAND_COMPLETE:
case DC210_PACKET_FOLLOWING:
if (context)
gp_context_progress_stop (context, progress_id);
return response;
break;
default:
if (context)
gp_context_progress_stop (context, progress_id);
DC210_DEBUG("Command terminated with errorcode 0x%02X.\n", response);
return GP_ERROR;
};
switch (response) {
case DC210_BUSY:
/* wait a little bit longer */
if (context && counter <= expect_busy)
gp_context_progress_update (context, progress_id, counter++);
break;
case DC210_COMMAND_COMPLETE:
case DC210_PACKET_FOLLOWING:
if (context)
gp_context_progress_stop (context, progress_id);
return response;
break;
default:
if (context)
gp_context_progress_stop (context, progress_id);
DC210_DEBUG("Command terminated with errorcode 0x%02X.\n", response);
return GP_ERROR;
};
};
};
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;
char cs_read, cs_computed;
int i, k, error;
char cs_read, cs_computed;
for (i = 0; i < RETRIES; i++){
for (i = 0; i < RETRIES; i++) {
if (dc210_wait_for_response(camera, 0, NULL) != DC210_PACKET_FOLLOWING)
return GP_ERROR;
if (dc210_wait_for_response(camera, 0, NULL) != DC210_PACKET_FOLLOWING)
return GP_ERROR;
error = 1;
for (k = 0; k < RETRIES; k++){
if (gp_port_read(camera->port, (char *)b, blocksize) < 0){
continue;
};
error = 0;
break;
};
error = 1;
for (k = 0; k < RETRIES; k++) {
if (gp_port_read(camera->port, (char *)b, blocksize) < 0) {
continue;
};
error = 0;
break;
};
if (error) return GP_ERROR;
if (error) return GP_ERROR;
if (dc210_read_single_char(camera, (unsigned char *)&cs_read) < 0)
return GP_ERROR;
if (dc210_read_single_char(camera, (unsigned char *)&cs_read) < 0)
return GP_ERROR;
cs_computed = 0;
for (k = 0 ; k < blocksize; k++)
cs_computed ^= b[k];
if (cs_computed == cs_read){
dc210_write_single_char(camera, DC210_CORRECT_PACKET);
return GP_OK;
};
cs_computed = 0;
for (k = 0; k < blocksize; k++)
cs_computed ^= b[k];
if (cs_computed == cs_read) {
dc210_write_single_char(camera, DC210_CORRECT_PACKET);
return GP_OK;
};
dc210_write_single_char(camera, DC210_ILLEGAL_PACKET);
dc210_write_single_char(camera, DC210_ILLEGAL_PACKET);
};
};
return GP_ERROR;
return GP_ERROR;
};
static int dc210_read_to_file
(Camera *camera, CameraFile * f, int blocksize, long int expectsize, GPContext *context)
{
static int dc210_read_to_file (Camera *camera, CameraFile * f, int blocksize, long int expectsize, GPContext *context) {
int packets, k, l, fatal_error, packet_following;
unsigned int progress_id = 0;
unsigned char cs_read, cs_computed;
unsigned char * b;
int packets, k, l, fatal_error, packet_following;
unsigned int progress_id = 0;
unsigned char cs_read, cs_computed;
unsigned char * b;
int blocks = expectsize / blocksize;
int remaining = expectsize % blocksize;
int blocks = expectsize / blocksize;
int remaining = expectsize % blocksize;
if (NULL == (b = malloc(blocksize))) return GP_ERROR;
if (NULL == (b = malloc(blocksize))) return GP_ERROR;
if (remaining) blocks++;
if (remaining) blocks++;
if (context)
progress_id = gp_context_progress_start (context, blocks, _("Getting data..."));
if (context)
progress_id = gp_context_progress_start (context, blocks, _("Getting data..."));
fatal_error = 0;
packets = 0;
fatal_error = 0;
packets = 0;
packet_following = dc210_wait_for_response(camera, 0, NULL);
while (DC210_PACKET_FOLLOWING == packet_following){
fatal_error = 1;
for (k = 0; k < RETRIES; k++){
/* read packet */
if (gp_port_read(camera->port, (char *)b, blocksize) < 0){
dc210_write_single_char(camera, DC210_ILLEGAL_PACKET);
packet_following = dc210_wait_for_response(camera, 0, NULL);
continue;
};
/* read checksum */
if (dc210_read_single_char(camera, &cs_read) == GP_ERROR){
free(b);
return GP_ERROR;
};
/* test checksum */
cs_computed = 0;
for (l = 0 ; l < blocksize; l++)
cs_computed ^= b[l];
if (cs_computed != cs_read){
dc210_write_single_char(camera, DC210_ILLEGAL_PACKET);
packet_following = dc210_wait_for_response(camera, 0, NULL);
continue;
};
/* append to file */
if (packets == blocks - 1 && remaining)
gp_file_append(f, (char *)b, remaining);
else
gp_file_append(f, (char *)b, blocksize);
/* request next packet */
dc210_write_single_char(camera, DC210_CORRECT_PACKET);
packet_following = dc210_wait_for_response(camera, 0, NULL);
fatal_error = 0;
if (context)
gp_context_progress_update (context, progress_id, packets);
packets++;
break;
};
if (fatal_error) break;
};
packet_following = dc210_wait_for_response(camera, 0, NULL);
while (DC210_PACKET_FOLLOWING == packet_following) {
fatal_error = 1;
for (k = 0; k < RETRIES; k++) {
/* read packet */
if (gp_port_read(camera->port, (char *)b, blocksize) < 0) {
dc210_write_single_char(camera, DC210_ILLEGAL_PACKET);
packet_following = dc210_wait_for_response(camera, 0, NULL);
continue;
};
/* read checksum */
if (dc210_read_single_char(camera, &cs_read) == GP_ERROR) {
free(b);
return GP_ERROR;
};
/* test checksum */
cs_computed = 0;
for (l = 0; l < blocksize; l++)
cs_computed ^= b[l];
if (cs_computed != cs_read) {
dc210_write_single_char(camera, DC210_ILLEGAL_PACKET);
packet_following = dc210_wait_for_response(camera, 0, NULL);
continue;
};
/* append to file */
if (packets == blocks - 1 && remaining)
gp_file_append(f, (char *)b, remaining);
else
gp_file_append(f, (char *)b, blocksize);
/* request next packet */
dc210_write_single_char(camera, DC210_CORRECT_PACKET);
packet_following = dc210_wait_for_response(camera, 0, NULL);
fatal_error = 0;
if (context)
gp_context_progress_update (context, progress_id, packets);
packets++;
break;
};
if (fatal_error) break;
};
if (packet_following < 0)
fatal_error = 1;
if (packet_following < 0)
fatal_error = 1;
if (context)
gp_context_progress_stop (context, progress_id);
if (context)
gp_context_progress_stop (context, progress_id);
free(b);
free(b);
if (fatal_error) return GP_ERROR;
if (fatal_error) return GP_ERROR;
return GP_OK;
return GP_OK;
};
@@ -506,7 +491,7 @@ static int dc210_read_to_file
/***** Set procedures *****/
static int dc210_set_option (Camera * camera, char command, unsigned int value, int valuesize){
static int dc210_set_option (Camera * camera, char command, unsigned int value, int valuesize) {
char cmd[8];
dc210_cmd_init(cmd, command);
@@ -539,15 +524,15 @@ static int dc210_set_option (Camera * camera, char command, unsigned int value,
};
int dc210_set_compression (Camera * camera, dc210_compression_type compression){
int dc210_set_compression (Camera * camera, dc210_compression_type compression) {
return dc210_set_option(camera, DC210_SET_QUALITY, compression, 1);
};
int dc210_set_flash (Camera * camera, dc210_flash_type flash, char preflash){
int dc210_set_flash (Camera * camera, dc210_flash_type flash, char preflash) {
if (flash != DC210_FLASH_NONE && preflash){
if (flash != DC210_FLASH_NONE && preflash) {
return dc210_set_option(camera, DC210_SET_FLASH, flash + 3, 1);
}
else
@@ -555,25 +540,25 @@ int dc210_set_flash (Camera * camera, dc210_flash_type flash, char preflash){
};
int dc210_set_zoom (Camera * camera, dc210_zoom_type zoom){
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){
int dc210_set_file_type (Camera * camera, dc210_file_type_type file_type) {
return dc210_set_option(camera, DC210_SET_FILE_TYPE, file_type, 1);
};
int dc210_set_resolution (Camera * camera, dc210_resolution_type res){
int dc210_set_resolution (Camera * camera, dc210_resolution_type res) {
return dc210_set_option(camera, DC210_SET_RESOLUTION, res, 1);
};
int dc210_set_delay (Camera * camera){
int dc210_set_delay (Camera * camera) {
/* This function works, but I do no have the slightest idea,
what the effect is / should be.
@@ -584,7 +569,7 @@ int dc210_set_delay (Camera * camera){
};
int dc210_set_exp_compensation (Camera * camera, signed int compensation){
int dc210_set_exp_compensation (Camera * camera, signed int compensation) {
unsigned char param = abs(compensation);
@@ -594,100 +579,100 @@ int dc210_set_exp_compensation (Camera * camera, signed int compensation){
};
int dc210_system_time_callback (Camera * camera, CameraWidget * widget, GPContext * context){
int dc210_system_time_callback (Camera * camera, CameraWidget * widget, GPContext * context) {
return dc210_set_option(camera, DC210_SET_TIME, (time(NULL) - CAMERA_SET_EPOC) << 1, 4);
};
static int dc210_format_card (Camera * camera, char * album_name, GPContext * context){
static int dc210_format_card (Camera * camera, char * album_name, GPContext * context) {
char data[DC210_CMD_DATA_SIZE];
char cmd[8];
char * subst;
unsigned char answer[16];
unsigned char checksum_read, checksum;
int i;
char data[DC210_CMD_DATA_SIZE];
char cmd[8];
char * subst;
unsigned char answer[16];
unsigned char checksum_read, checksum;
int i;
memset (data, 0, DC210_CMD_DATA_SIZE);
memset (data, 0, DC210_CMD_DATA_SIZE);
/* Make the album name acceptable - we need at least 8 characters
which are not blank and there are no blanks allowed before the
last character.
*/
if (album_name != NULL && strlen(album_name) > 0){
strncpy(data, album_name, 11);
/* substitute blanks in the first 8 characters*/
while (NULL != (subst = strchr(data, ' '))) *subst = '_';
if (strlen(data) < 8) strncat(data, "________", 8 - strlen(data));
};
/* Make the album name acceptable - we need at least 8 characters
which are not blank and there are no blanks allowed before the
last character.
*/
if (album_name != NULL && strlen(album_name) > 0) {
strncpy(data, album_name, 11);
/* substitute blanks in the first 8 characters*/
while (NULL != (subst = strchr(data, ' '))) *subst = '_';
if (strlen(data) < 8) strncat(data, "________", 8 - strlen(data));
};
DC210_DEBUG("Album name is '%s'\n", data);
DC210_DEBUG("Album name is '%s'\n", data);
dc210_cmd_init(cmd, DC210_CARD_FORMAT);
dc210_cmd_init(cmd, DC210_CARD_FORMAT);
dc210_execute_command(camera, cmd);
dc210_write_command_packet(camera, data);
if (dc210_wait_for_response(camera, 3, context) != DC210_PACKET_FOLLOWING) return GP_ERROR;
dc210_execute_command(camera, cmd);
dc210_write_command_packet(camera, data);
if (dc210_wait_for_response(camera, 3, context) != DC210_PACKET_FOLLOWING) return GP_ERROR;
gp_port_read(camera->port, (char *)answer, 16);
gp_port_read(camera->port, (char *)&checksum_read, 1);
checksum = 0;
gp_port_read(camera->port, (char *)answer, 16);
gp_port_read(camera->port, (char *)&checksum_read, 1);
checksum = 0;
for (i = 0; i < 16; i++) checksum ^= answer[i];
if (checksum_read != checksum) return GP_ERROR;
for (i = 0; i < 16; i++) checksum ^= answer[i];
if (checksum_read != checksum) return GP_ERROR;
DC210_DEBUG("Flash card formatted.\n");
DC210_DEBUG("Flash card formatted.\n");
if (dc210_write_single_char(camera, DC210_CORRECT_PACKET) == GP_ERROR) return GP_ERROR;
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
if (dc210_write_single_char(camera, DC210_CORRECT_PACKET) == GP_ERROR) return GP_ERROR;
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
gp_filesystem_reset(camera->fs);
gp_filesystem_reset(camera->fs);
return GP_OK;
return GP_OK;
};
static int dc210_get_card_status (Camera * camera, dc210_card_status * card_status){
static int dc210_get_card_status (Camera * camera, dc210_card_status * card_status) {
char cmd[8];
unsigned char answer[16];
unsigned char checksum_read, checksum;
int i;
char cmd[8];
unsigned char answer[16];
unsigned char checksum_read, checksum;
int i;
card_status->open = 0;
card_status->program = 0;
card_status->space = 0;
card_status->open = 0;
card_status->program = 0;
card_status->space = 0;
dc210_cmd_init(cmd, DC210_CARD_STATUS);
dc210_execute_command(camera, cmd);
if (dc210_wait_for_response(camera, 0, NULL) != DC210_PACKET_FOLLOWING) return GP_ERROR;
dc210_cmd_init(cmd, DC210_CARD_STATUS);
dc210_execute_command(camera, cmd);
if (dc210_wait_for_response(camera, 0, NULL) != DC210_PACKET_FOLLOWING) return GP_ERROR;
gp_port_read(camera->port, (char *)answer, 16);
gp_port_read(camera->port, (char *)&checksum_read, 1);
gp_port_read(camera->port, (char *)answer, 16);
gp_port_read(camera->port, (char *)&checksum_read, 1);
checksum = 0;
for (i = 0; i < 16; i++) checksum ^= answer[i];
checksum = 0;
for (i = 0; i < 16; i++) checksum ^= answer[i];
if (checksum_read != checksum)
DC210_DEBUG("Error reading card status.\n");
else
DC210_DEBUG("Card status correctly read.\n");
if (checksum_read != checksum)
DC210_DEBUG("Error reading card status.\n");
else
DC210_DEBUG("Card status correctly read.\n");
if (answer[0] & 0x08) card_status->open = 1;
DC210_DEBUG("Card status open is %d\n", card_status->open);
card_status->program = answer[1] * 0x100 + answer[2];
/* set the space in kb */
card_status->space = (answer[3] * 0x1000000 + answer[4] * 0x10000 + answer[5] * 0x100 + answer[6]) / 1024;
if (answer[0] & 0x08) card_status->open = 1;
DC210_DEBUG("Card status open is %d\n", card_status->open);
card_status->program = answer[1] * 0x100 + answer[2];
/* set the space in kb */
card_status->space = (answer[3] * 0x1000000 + answer[4] * 0x10000 + answer[5] * 0x100 + answer[6]) / 1024;
if (dc210_write_single_char(camera, DC210_CORRECT_PACKET) == GP_ERROR) return GP_ERROR;
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
if (dc210_write_single_char(camera, DC210_CORRECT_PACKET) == GP_ERROR) return GP_ERROR;
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
return GP_OK;
return GP_OK;
};
int dc210_format_callback(Camera * camera, CameraWidget * widget, GPContext * context){
int dc210_format_callback(Camera * camera, CameraWidget * widget, GPContext * context) {
CameraWidget * window;
char * album_name;
@@ -701,19 +686,19 @@ int dc210_format_callback(Camera * camera, CameraWidget * widget, GPContext * co
};
static int dc210_check_battery (Camera *camera){
static int dc210_check_battery (Camera *camera) {
char cmd[8];
dc210_cmd_init(cmd, DC210_CHECK_BATTERY);
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;
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;
return GP_OK;
return GP_OK;
};
int dc210_init_port (Camera *camera){
int dc210_init_port (Camera *camera) {
/* sending a break command resets the
speed to 9600 */
@@ -820,27 +805,24 @@ int dc210_set_speed (Camera *camera, int speed) {
/****** Picture actions *****/
int dc210_take_picture
(Camera * camera, GPContext * context)
int dc210_take_picture (Camera * camera, GPContext * context)
{
char cmd[8];
dc210_cmd_init(cmd, DC210_TAKE_PICTURE);
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
switch (dc210_wait_for_response(camera, 5, context)){
/* we allow a timeout error here and check the result via status */
case DC210_COMMAND_COMPLETE:
case GP_ERROR_TIMEOUT: return GP_OK; break;
default: return GP_ERROR; break;
switch (dc210_wait_for_response(camera, 5, context)) {
/* we allow a timeout error here and check the result via status */
case DC210_COMMAND_COMPLETE:
case GP_ERROR_TIMEOUT: return GP_OK; break;
default: return GP_ERROR; break;
};
return GP_ERROR;
};
int dc210_delete_picture
(Camera * camera, unsigned int picno)
{
int dc210_delete_picture (Camera * camera, unsigned int picno) {
char cmd[8];
unsigned int pic_offset = picno - 1;
@@ -856,27 +838,23 @@ int dc210_delete_picture
};
int dc210_delete_last_picture
(Camera * camera )
{
int dc210_delete_last_picture (Camera * camera) {
dc210_status status;
dc210_status status;
if (dc210_get_status(camera, &status) == GP_ERROR)
return GP_ERROR;
if (dc210_get_status(camera, &status) == GP_ERROR)
return GP_ERROR;
if (0 == status.numPicturesInCamera)
return GP_ERROR;
if (0 == status.numPicturesInCamera)
return GP_ERROR;
return dc210_delete_picture(camera, status.numPicturesInCamera);
return dc210_delete_picture(camera, status.numPicturesInCamera);
};
int dc210_delete_picture_by_name
(Camera * camera, const char * filename )
{
int dc210_delete_picture_by_name (Camera * camera, const char * filename ) {
char cmd[8];
char cmd[8];
char cmd_packet[DC210_CMD_DATA_SIZE];
dc210_cmd_init(cmd, DC210_CARD_FILE_DEL);
@@ -887,12 +865,9 @@ int dc210_delete_picture_by_name
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
return GP_OK;
};
int dc210_download_last_picture
(Camera * camera, CameraFile *file, dc210_picture_type type, GPContext *context)
{
int dc210_download_last_picture (Camera * camera, CameraFile *file, dc210_picture_type type, GPContext *context) {
dc210_status status;
dc210_picture_info picinfo;
@@ -910,9 +885,7 @@ int dc210_download_last_picture
};
int dc210_open_card
(Camera * camera)
{
int dc210_open_card (Camera * camera) {
char cmd[8];
dc210_card_status card_status;
@@ -944,11 +917,9 @@ static int dc210_close_card
};
#endif
int dc210_download_picture_by_name
(Camera * camera, CameraFile *file, const char *filename, dc210_picture_type type, GPContext *context)
{
int dc210_download_picture_by_name (Camera * camera, CameraFile *file, const char *filename, dc210_picture_type type, GPContext *context) {
char cmd[8];
char cmd[8];
char cmd_packet[DC210_CMD_DATA_SIZE];
dc210_picture_info picinfo;

View File

@@ -57,7 +57,7 @@ static const struct camera_to_usb {
{ "Kodak:DC280", 0x040A, 0x0130 },
{ "Kodak:DC3400", 0x040A, 0x0132 },
{ "Kodak:DC5000", 0x040A, 0x0131 },
{ NULL, 0, 0 }
{ NULL, 0, 0 }
};
/*
@@ -69,29 +69,29 @@ int
camera_abilities (CameraAbilitiesList *list)
{
CameraAbilities a;
int i;
int i;
for (i = 0; camera_to_usb[i].name; i++)
{
memset (&a, 0, sizeof (a));
strcpy(a.model, camera_to_usb[i].name);
a.status = GP_DRIVER_STATUS_PRODUCTION;
a.port = GP_PORT_SERIAL | GP_PORT_USB;
a.speed[0] = 9600;
a.speed[1] = 19200;
a.speed[2] = 38400;
a.speed[3] = 57600;
a.speed[4] = 115200;
a.speed[5] = 0;
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 |
GP_FILE_OPERATION_PREVIEW;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
for (i = 0; camera_to_usb[i].name; i++)
{
memset (&a, 0, sizeof (a));
strcpy(a.model, camera_to_usb[i].name);
a.status = GP_DRIVER_STATUS_PRODUCTION;
a.port = GP_PORT_SERIAL | GP_PORT_USB;
a.speed[0] = 9600;
a.speed[1] = 19200;
a.speed[2] = 38400;
a.speed[3] = 57600;
a.speed[4] = 115200;
a.speed[5] = 0;
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 |
GP_FILE_OPERATION_PREVIEW;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
gp_abilities_list_append(list, a);
}
gp_abilities_list_append(list, a);
}
return (GP_OK);
}
@@ -148,7 +148,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
Camera *camera = data;
return (dc240_file_action (camera, DC240_ACTION_DELETE, NULL, folder,
filename, context));
filename, context));
}
static int
@@ -176,38 +176,38 @@ camera_capture (Camera *camera, CameraCaptureType type,
static int
camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
char buf [32 * 1024];
char temp [1024];
int retval;
DC240StatusTable table;
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),
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"),
table.remPictHigh, table.remPictMed, table.remPictLow);
strcat (buf, temp);
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),
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"),
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, _("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);
strcat (buf, temp);
sprintf (temp, _("Total pictures captured: %d, Flashes fired: %d\n"),
table.totalPictTaken, table.totalStrobeFired);
strcat (buf, temp);
strcpy(summary->text, buf);
}
return retval;
strcpy(summary->text, buf);
}
return retval;
}
static int

View File

@@ -478,23 +478,23 @@ int camera_init (Camera *camera, GPContext *context)
if (!camera->pl)
return (GP_ERROR_NO_MEMORY);
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* Set up the CameraFilesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* initialize the camera */
/* initialize the camera */
ret = init (camera);
if (ret < 0) {
free (camera->pl);
camera->pl = NULL;
return (ret);
}
return (ret);
}
ret = dc3200_keep_alive (camera);
ret = dc3200_keep_alive (camera);
if (ret < 0) {
free (camera->pl);
camera->pl = NULL;

View File

@@ -195,9 +195,9 @@ int dc3200_setup(Camera *camera)
*/
/* command to get the picture
unsigned char get_pkt[DEF_PACKET_LEN] = {0x01, calc_seqnum(), 0x80, 0x00, 0x20, 0x03, 26 + strlen(filename),
0xC1, 0x50, 0x00, 0x00, 0x00, 0x00, 19 + strlen(filename),
0x04, 0x01, 0x00, 0x01, 0x01, 0x04, 0x60, 0x10, 0x00, 0x01, 0x00, 0x05,
0x00, 0x00, 0x00, 2 + strlen(filename), 0x01};
0xC1, 0x50, 0x00, 0x00, 0x00, 0x00, 19 + strlen(filename),
0x04, 0x01, 0x00, 0x01, 0x01, 0x04, 0x60, 0x10, 0x00, 0x01, 0x00, 0x05,
0x00, 0x00, 0x00, 2 + strlen(filename), 0x01};
*/
int dc3200_get_data(Camera *camera, unsigned char **data, unsigned long *data_len, int command, const char *folder, const char *filename)

View File

@@ -75,7 +75,7 @@ ez200_init (GPPort *port, Model *model, Info *info) {
READ(port, PICTURE, 0, 0, &c, 1);
memcpy (info, &c, 1);
GP_DEBUG("number of pics : %i", c);
return GP_OK;
return GP_OK;
}
/* quit photo mode */
@@ -91,7 +91,7 @@ ez200_exit (GPPort *port) {
static int
ez200_get_picture_size (GPPort *port, int n) {
unsigned char c[4];
unsigned int size = 0;
unsigned int size = 0;
memset (c,0,sizeof(c));
GP_DEBUG("Running ez200_get_picture_size");
@@ -112,12 +112,12 @@ ez200_read_data (GPPort *port, char *data, int size) {
/* Read Data by blocks */
while(size > 0) {
int len = (size>MAX_BULK)?MAX_BULK:size;
ret = gp_port_read (port, data, len);
ret = gp_port_read (port, data, len);
if (ret < GP_OK) return ret;
data += len;
size -= len;
}
return GP_OK;
return GP_OK;
}
static int
@@ -126,8 +126,8 @@ ez200_read_picture_data (GPPort *port, char *data, int size, int n) {
memset(c,0,sizeof(c));
/* ask picture n transfert */
READ(port, PICTURE, n, 1, c, 3);
return ez200_read_data (port, data, size);
READ(port, PICTURE, n, 1, c, 3);
return ez200_read_data (port, data, size);
}
@@ -145,55 +145,55 @@ struct _CameraPrivateLibrary {
};
static const struct {
char *name;
char *name;
CameraDriverStatus status;
unsigned short idVendor;
unsigned short idProduct;
unsigned short idVendor;
unsigned short idProduct;
} models[] = {
{"Kodak EZ200", GP_DRIVER_STATUS_PRODUCTION, 0x040a, 0x0300},
{"Kodak EZ200", GP_DRIVER_STATUS_PRODUCTION, 0x040a, 0x0300},
{NULL,0,0,0}
};
int
camera_id (CameraText *id)
{
strcpy (id->text, "Kodak EZ200 camera");
return GP_OK;
strcpy (id->text, "Kodak EZ200 camera");
return GP_OK;
}
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
int i;
CameraAbilities a;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
a.operations = GP_OPERATION_NONE;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
a.file_operations = GP_FILE_OPERATION_NONE;
gp_abilities_list_append (list, a);
}
return GP_OK;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
a.file_operations = GP_FILE_OPERATION_NONE;
gp_abilities_list_append (list, a);
}
return GP_OK;
}
static int
camera_summary (Camera *camera, CameraText *summary, GPContext *context) {
sprintf (summary->text,_("Your USB camera is a Kodak EZ200.\n"
"Number of PICs = %i\n"
), ez200_get_num_pics(camera->pl->info));
sprintf (summary->text, _("Your USB camera is a Kodak EZ200.\n"
"Number of PICs = %i\n"
), ez200_get_num_pics(camera->pl->info));
return GP_OK;
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context) {
strcpy (about->text, _("Kodak EZ200 driver\nBucas Jean-Francois <jfbucas@tuxfamily.org>\n"));
return GP_OK;
strcpy (about->text, _("Kodak EZ200 driver\nBucas Jean-Francois <jfbucas@tuxfamily.org>\n"));
return GP_OK;
}
/*
@@ -207,19 +207,18 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
WRITE(camera->port,0,0x8003,0,NULL,0);
WRITE(camera->port,5,0x0000,0,NULL,0);
return GP_OK;
return GP_OK;
}
*/
static int
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
GPContext *context) {
Camera *camera = data;
delete_all_func (CameraFilesystem *fs, const char *folder, void *data, GPContext *context) {
Camera *camera = data;
WRITE (camera->port, ERASE, 0, 1, NULL, 0);
ez200_wait_status_ok(camera->port);
return GP_OK;
return GP_OK;
}
static int
@@ -235,8 +234,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileType type, CameraFile *file, void *user_data,
GPContext *context)
{
Camera *camera = user_data;
int n, len, ret;
Camera *camera = user_data;
int n, len, ret;
char *data, *data_start;
n = gp_filesystem_number(camera->fs, "/", filename, context);
@@ -253,7 +252,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
data_start = data + (HEADER_SIZE - DATA_HEADER_SIZE);
GP_DEBUG("data - data_start : %p %p : %lx",data, data_start, (long) (data_start - data));
ret = ez200_read_picture_data (camera->port, data_start, len, n);
ret = ez200_read_picture_data (camera->port, data_start, len, n);
if (ret < GP_OK) return ret;
ret = ez200_read_picture_header (camera->port, data);
if (ret < GP_OK) return ret;
@@ -326,7 +325,7 @@ camera_init(Camera *camera, GPContext *context)
GP_DEBUG("inep = %x", settings.usb.inep);
GP_DEBUG("outep = %x", settings.usb.outep);
/* Tell the CameraFilesystem where to get lists from */
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = calloc (1, sizeof (CameraPrivateLibrary));

File diff suppressed because it is too large Load Diff

View File

@@ -429,11 +429,11 @@ while (read < rbs_internal) {
* these, it now downloads images etc.
*/
#ifndef LESSER_ESCAPES
if ((*buf == STX) || (*buf == ETX) || (*buf == ENQ ) ||
if ((*buf == STX) || (*buf == ETX) || (*buf == ENQ) ||
(*buf == ACK) || (*buf == XOFF) || (*buf == XON) ||
(*buf == NACK) || (*buf == ETB)) {
#else /* LESSER_ESCAPES */
if ((*buf == STX) || (*buf == XOFF) || (*buf == XON)) {
if ((*buf == STX) || (*buf == XOFF) || (*buf == XON)) {
#endif /* LESSER_ESCAPES */
GP_DEBUG ("Wrong ESC masking!");
error_flag = 1;
@@ -610,7 +610,7 @@ l_send_receive (
/* Send data. */
CHECK (l_send (p, c, send_buffer, send_buffer_size));
/* Receive data. */
/* Receive data. */
if (image_buffer_size)
*receive_buffer_size = *image_buffer_size;
CHECK (l_receive (p, c, receive_buffer, receive_buffer_size,
@@ -620,7 +620,7 @@ l_send_receive (
if ((*receive_buffer_size > 1) &&
(((*receive_buffer)[0] == send_buffer[0]) &&
((*receive_buffer)[1] == send_buffer[1])))
return (GP_OK);
return (GP_OK);
/* We didn't receive control data yet. */
*image_buffer = *receive_buffer;

View File

@@ -337,7 +337,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
GP_DEBUG ("*** ENTER: get_file_func ***");
image_no = gp_filesystem_number(fs, folder, filename, context);
image_no = gp_filesystem_number(fs, folder, filename, context);
if (image_no < 0) return image_no;
/* Search the image informations */
@@ -425,7 +425,7 @@ delete_file_func (CameraFilesystem *fs, const char *folder,
GP_DEBUG ("*** ENTER: delete_file_func ***");
image_no = gp_filesystem_number(fs, folder, filename, context);
image_no = gp_filesystem_number(fs, folder, filename, context);
if (image_no < 0) return image_no;
image_no++;
@@ -676,7 +676,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
GP_DEBUG ("*** ENTER: get_info_func ***");
image_no = gp_filesystem_number(fs, folder, filename, context);
image_no = gp_filesystem_number(fs, folder, filename, context);
if (image_no < 0)
return image_no;
image_no++;
@@ -723,8 +723,8 @@ camera_get_config (Camera* camera, CameraWidget** window, GPContext *context)
{
unsigned char cmd[2], buf[INFO_BUFFER];
int ret;
CameraWidget *widget;
CameraWidget *section;
CameraWidget *widget;
CameraWidget *section;
time_t timestamp=0;
float value_float;
@@ -753,357 +753,354 @@ camera_get_config (Camera* camera, CameraWidget** window, GPContext *context)
/* Window creation */
gp_widget_new (GP_WIDGET_WINDOW, _("Konica Configuration"), window);
/************************/
/* Persistent Settings */
/************************/
gp_widget_new (GP_WIDGET_SECTION, _("Persistent Settings"), &section);
gp_widget_append (*window, section);
/************************/
/* Persistent Settings */
/************************/
gp_widget_new (GP_WIDGET_SECTION, _("Persistent Settings"), &section);
gp_widget_append (*window, section);
/* Date */
gp_widget_new (GP_WIDGET_DATE, _("Date and Time"), &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, &timestamp);
/* Date */
gp_widget_new (GP_WIDGET_DATE, _("Date and Time"), &widget);
gp_widget_append (section, widget);
gp_widget_set_value (widget, &timestamp);
/* Auto Off Time */
gp_widget_new (GP_WIDGET_RANGE, _("Auto Off Time"), &widget);
gp_widget_append (section, widget);
gp_widget_set_range (widget, 1, 255, 1);
value_float = ((buf[AUTO_OFF_PTR] << 8) + buf[AUTO_OFF_PTR+1]) / 60;
gp_widget_set_value (widget, &value_float);
/* Auto Off Time */
gp_widget_new (GP_WIDGET_RANGE, _("Auto Off Time"), &widget);
gp_widget_append (section, widget);
gp_widget_set_range (widget, 1, 255, 1);
value_float = ((buf[AUTO_OFF_PTR] << 8) + buf[AUTO_OFF_PTR+1]) / 60;
gp_widget_set_value (widget, &value_float);
/* Resolution */
gp_widget_new (GP_WIDGET_RADIO, _("Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Low"));
gp_widget_add_choice (widget, _("Medium"));
gp_widget_add_choice (widget, _("High"));
switch (buf[RESOLUTION_PTR]) {
case 1:
gp_widget_set_value (widget, _("High"));
break;
case 2:
gp_widget_set_value (widget, _("Low"));
break;
case 0:
gp_widget_set_value (widget, _("Medium"));
break;
}
/* Resolution */
gp_widget_new (GP_WIDGET_RADIO, _("Resolution"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Low"));
gp_widget_add_choice (widget, _("Medium"));
gp_widget_add_choice (widget, _("High"));
switch (buf[RESOLUTION_PTR]) {
case 1:
gp_widget_set_value (widget, _("High"));
break;
case 2:
gp_widget_set_value (widget, _("Low"));
break;
case 0:
gp_widget_set_value (widget, _("Medium"));
break;
}
/* LCD */
gp_widget_new (GP_WIDGET_RADIO, _("LCD"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
switch (buf[LCD_STATE_PTR]) {
case 0:
gp_widget_set_value (widget, _("On"));
break;
case 1:
gp_widget_set_value (widget, _("Off"));
break;
}
/* LCD */
gp_widget_new (GP_WIDGET_RADIO, _("LCD"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
switch (buf[LCD_STATE_PTR]) {
case 0:
gp_widget_set_value (widget, _("On"));
break;
case 1:
gp_widget_set_value (widget, _("Off"));
break;
}
/* Icons */
gp_widget_new (GP_WIDGET_RADIO, _("Icons"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
switch (buf[ICON_STATE_PTR]) {
case 0:
gp_widget_set_value (widget, _("On"));
break;
case 1:
gp_widget_set_value (widget, _("Off"));
break;
}
/* Icons */
gp_widget_new (GP_WIDGET_RADIO, _("Icons"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
switch (buf[ICON_STATE_PTR]) {
case 0:
gp_widget_set_value (widget, _("On"));
break;
case 1:
gp_widget_set_value (widget, _("Off"));
break;
}
/****************/
/* Localization */
/****************/
gp_widget_new (GP_WIDGET_SECTION, _("Localization"), &section);
gp_widget_append (*window, section);
/****************/
/* Localization */
/****************/
gp_widget_new (GP_WIDGET_SECTION, _("Localization"), &section);
gp_widget_append (*window, section);
/* Date format */
gp_widget_new (GP_WIDGET_MENU, _("Date Format"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Month/Day/Year"));
gp_widget_add_choice (widget, _("Day/Month/Year"));
gp_widget_add_choice (widget, _("Year/Month/Day"));
/* Date format */
gp_widget_new (GP_WIDGET_MENU, _("Date Format"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Month/Day/Year"));
gp_widget_add_choice (widget, _("Day/Month/Year"));
gp_widget_add_choice (widget, _("Year/Month/Day"));
switch (buf[DATE_FORMAT_PTR]) {
case 0:
gp_widget_set_value (widget, _("Month/Day/Year"));
break;
case 1:
gp_widget_set_value (widget, _("Day/Month/Year"));
break;
case 2:
gp_widget_set_value (widget, _("Year/Month/Day"));
break;
case 0:
gp_widget_set_value (widget, _("Month/Day/Year"));
break;
case 1:
gp_widget_set_value (widget, _("Day/Month/Year"));
break;
case 2:
gp_widget_set_value (widget, _("Year/Month/Day"));
break;
}
/********************************/
/* Session-persistent Settings */
/********************************/
gp_widget_new (GP_WIDGET_SECTION, _("Session-persistent Settings"),
&section);
gp_widget_append (*window, section);
/* Session-persistent Settings */
/********************************/
gp_widget_new (GP_WIDGET_SECTION, _("Session-persistent Settings"),
&section);
gp_widget_append (*window, section);
/* Flash */
gp_widget_new (GP_WIDGET_RADIO, _("Flash"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Off"));
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("On, red-eye reduction"));
gp_widget_add_choice (widget, _("Auto"));
gp_widget_add_choice (widget, _("Auto, red-eye reduction"));
switch (buf[FLASH_STATE_PTR]) {
case 2:
gp_widget_set_value (widget, _("Off"));
break;
case 1:
if (buf[RED_EYE_STATE_PTR] == 1)
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,
_("Auto, red-eye reduction"));
else
gp_widget_set_value (widget, _("Auto"));
break;
}
/* Exposure */
gp_widget_new (GP_WIDGET_RANGE, _("Exposure"), &widget);
gp_widget_append (section, widget);
gp_widget_set_range (widget, -2, 2, 0.1);
switch(buf[EXPOSURE_TIME_PTR]) {
case 0:
value_float = 0;
break;
case 1:
value_float = 0.3;
break;
case 2:
value_float = 0.5;
break;
case 3:
value_float = 0.8;
break;
case 4:
value_float = 1.0;
break;
case 5:
value_float = 1.3;
break;
case 6:
value_float = 1.5;
break;
case 7:
value_float = 1.8;
break;
case 8:
value_float = 2.0;
break;
case 0xF8:
value_float = -2.0;
break;
case 0xF9:
value_float = -1.8;
break;
case 0xFA:
value_float = -1.5;
break;
case 0xFB:
value_float = -1.3;
break;
case 0xFC:
value_float = -1.0;
break;
case 0xFD:
value_float = -0.8;
break;
case 0xFE:
value_float = -0.5;
break;
case 0xFF:
value_float = -0.3;
break;
/* Flash */
gp_widget_new (GP_WIDGET_RADIO, _("Flash"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Off"));
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("On, red-eye reduction"));
gp_widget_add_choice (widget, _("Auto"));
gp_widget_add_choice (widget, _("Auto, red-eye reduction"));
switch (buf[FLASH_STATE_PTR]) {
case 2:
gp_widget_set_value (widget, _("Off"));
break;
case 1:
if (buf[RED_EYE_STATE_PTR] == 1)
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, _("Auto, red-eye reduction"));
else
gp_widget_set_value (widget, _("Auto"));
break;
}
gp_widget_set_value (widget, &value_float);
/* Focus */
gp_widget_new (GP_WIDGET_RADIO, _("Focus"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("2.0 m"));
/* Exposure */
gp_widget_new (GP_WIDGET_RANGE, _("Exposure"), &widget);
gp_widget_append (section, widget);
gp_widget_set_range (widget, -2, 2, 0.1);
switch (buf[EXPOSURE_TIME_PTR]) {
case 0:
value_float = 0;
break;
case 1:
value_float = 0.3;
break;
case 2:
value_float = 0.5;
break;
case 3:
value_float = 0.8;
break;
case 4:
value_float = 1.0;
break;
case 5:
value_float = 1.3;
break;
case 6:
value_float = 1.5;
break;
case 7:
value_float = 1.8;
break;
case 8:
value_float = 2.0;
break;
case 0xF8:
value_float = -2.0;
break;
case 0xF9:
value_float = -1.8;
break;
case 0xFA:
value_float = -1.5;
break;
case 0xFB:
value_float = -1.3;
break;
case 0xFC:
value_float = -1.0;
break;
case 0xFD:
value_float = -0.8;
break;
case 0xFE:
value_float = -0.5;
break;
case 0xFF:
value_float = -0.3;
break;
}
gp_widget_set_value (widget, &value_float);
/* Focus */
gp_widget_new (GP_WIDGET_RADIO, _("Focus"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("2.0 m"));
gp_widget_add_choice (widget, _("0.5 m"));
gp_widget_add_choice (widget, _("0.1 m"));
gp_widget_add_choice (widget, _("Auto"));
switch (buf[FOCUS_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("2.0 m"));
break;
case 2:
gp_widget_set_value (widget, _("0.5 m"));
break;
case 3:
gp_widget_set_value (widget, _("0.1 m"));
break;
}
gp_widget_add_choice (widget, _("Auto"));
switch (buf[FOCUS_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("2.0 m"));
break;
case 2:
gp_widget_set_value (widget, _("0.5 m"));
break;
case 3:
gp_widget_set_value (widget, _("0.1 m"));
break;
}
/* white balance */
gp_widget_new (GP_WIDGET_RADIO, _("White balance"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Office"));
/* white balance */
gp_widget_new (GP_WIDGET_RADIO, _("White balance"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Office"));
gp_widget_add_choice (widget, _("Daylight"));
gp_widget_add_choice (widget, _("Auto"));
switch (buf[WHITE_BALANCE_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("Daylight"));
break;
case 2:
gp_widget_set_value (widget, _("Office"));
break;
switch (buf[WHITE_BALANCE_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("Daylight"));
break;
case 2:
gp_widget_set_value (widget, _("Office"));
break;
}
/* Sharpness */
gp_widget_new (GP_WIDGET_RADIO, _("Sharpness"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Sharp"));
/* Sharpness */
gp_widget_new (GP_WIDGET_RADIO, _("Sharpness"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Sharp"));
gp_widget_add_choice (widget, _("Soft"));
gp_widget_add_choice (widget, _("Auto"));
switch (buf[SHARPNESS_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("Sharp"));
break;
case 2:
gp_widget_set_value (widget, _("Soft"));
break;
switch (buf[SHARPNESS_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("Sharp"));
break;
case 2:
gp_widget_set_value (widget, _("Soft"));
break;
}
/* Color */
gp_widget_new (GP_WIDGET_RADIO, _("Color"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Light"));
/* Color */
gp_widget_new (GP_WIDGET_RADIO, _("Color"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Light"));
gp_widget_add_choice (widget, _("Deep"));
gp_widget_add_choice (widget, _("Black and White"));
gp_widget_add_choice (widget, _("Sepia"));
gp_widget_add_choice (widget, _("Auto"));
switch (buf[COLOR_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("Light"));
break;
case 2:
gp_widget_set_value (widget, _("Deep"));
break;
case 3:
gp_widget_set_value (widget, _("Black and White"));
break;
case 4:
gp_widget_set_value (widget, _("Sepia"));
break;
switch (buf[COLOR_PTR]) {
case 0:
gp_widget_set_value (widget, _("Auto"));
break;
case 1:
gp_widget_set_value (widget, _("Light"));
break;
case 2:
gp_widget_set_value (widget, _("Deep"));
break;
case 3:
gp_widget_set_value (widget, _("Black and White"));
break;
case 4:
gp_widget_set_value (widget, _("Sepia"));
break;
}
/* Macro */
gp_widget_new (GP_WIDGET_RADIO, _("Macro"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
/* Macro */
gp_widget_new (GP_WIDGET_RADIO, _("Macro"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
switch (buf[MACRO_PTR]) {
case 0:
gp_widget_set_value (widget, _("Off"));
break;
case 1:
gp_widget_set_value (widget, _("On"));
break;
switch (buf[MACRO_PTR]) {
case 0:
gp_widget_set_value (widget, _("Off"));
break;
case 1:
gp_widget_set_value (widget, _("On"));
break;
}
/* Zoom */
gp_widget_new (GP_WIDGET_RADIO, _("Zoom"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
/* Zoom */
gp_widget_new (GP_WIDGET_RADIO, _("Zoom"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("On"));
gp_widget_add_choice (widget, _("Off"));
switch (buf[ZOOM_PTR]) {
case 0:
gp_widget_set_value (widget, _("Off"));
break;
case 1:
gp_widget_set_value (widget, _("On"));
break;
switch (buf[ZOOM_PTR]) {
case 0:
gp_widget_set_value (widget, _("Off"));
break;
case 1:
gp_widget_set_value (widget, _("On"));
break;
}
/* Capture */
gp_widget_new (GP_WIDGET_RADIO, _("Capture"), &widget);
gp_widget_append (section, widget);
/* Capture */
gp_widget_new (GP_WIDGET_RADIO, _("Capture"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Single"));
gp_widget_add_choice (widget, _("Sequence 9"));
switch (buf[CAPTURE_TYPE_PTR]) {
case 0:
gp_widget_set_value (widget, _("Single"));
break;
case 1:
gp_widget_set_value (widget, _("Sequence 9"));
break;
switch (buf[CAPTURE_TYPE_PTR]) {
case 0:
gp_widget_set_value (widget, _("Single"));
break;
case 1:
gp_widget_set_value (widget, _("Sequence 9"));
break;
}
/* Date display */
gp_widget_new (GP_WIDGET_RADIO, _("Date display"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Anywhere"));
/* Date display */
gp_widget_new (GP_WIDGET_RADIO, _("Date display"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Anywhere"));
gp_widget_add_choice (widget, _("Play mode"));
gp_widget_add_choice (widget, _("Record mode"));
gp_widget_add_choice (widget, _("Everywhere"));
switch (buf[REC_DATE_DISP_PTR]) {
case 0:
if (buf[PLAY_DATE_DISP_PTR] == 0)
gp_widget_set_value (widget, _("Play mode"));
else
gp_widget_set_value (widget, _("Anywhere"));
break;
case 1:
if (buf[PLAY_DATE_DISP_PTR] == 0)
gp_widget_set_value (widget, _("Everywhere"));
else
gp_widget_set_value (widget, _("Record mode"));
break;
switch (buf[REC_DATE_DISP_PTR]) {
case 0:
if (buf[PLAY_DATE_DISP_PTR] == 0)
gp_widget_set_value (widget, _("Play mode"));
else
gp_widget_set_value (widget, _("Anywhere"));
break;
case 1:
if (buf[PLAY_DATE_DISP_PTR] == 0)
gp_widget_set_value (widget, _("Everywhere"));
else
gp_widget_set_value (widget, _("Record mode"));
break;
}
/************************/
/* Volatile Settings */
/************************/
gp_widget_new (GP_WIDGET_SECTION, _("Volatile Settings"), &section);
gp_widget_append (*window, section);
/************************/
/* Volatile Settings */
/************************/
gp_widget_new (GP_WIDGET_SECTION, _("Volatile Settings"), &section);
gp_widget_append (*window, section);
/* Self Timer */
gp_widget_new (GP_WIDGET_RADIO, _("Self Timer"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Self Timer (next picture only)"));
gp_widget_add_choice (widget, _("Normal"));
switch (buf[TIMER_PTR]) {
case 1:
gp_widget_set_value (widget, _("Self Timer ("
"next picture only)"));
break;
case 0:
gp_widget_set_value (widget, _("Normal"));
break;
}
/* Self Timer */
gp_widget_new (GP_WIDGET_RADIO, _("Self Timer"), &widget);
gp_widget_append (section, widget);
gp_widget_add_choice (widget, _("Self Timer (next picture only)"));
gp_widget_add_choice (widget, _("Normal"));
switch (buf[TIMER_PTR]) {
case 1:
gp_widget_set_value (widget, _("Self Timer (next picture only)"));
break;
case 0:
gp_widget_set_value (widget, _("Normal"));
break;
}
return (GP_OK);
}
@@ -1153,18 +1150,18 @@ camera_summary (Camera *camera, CameraText *text, GPContext *context)
timestamp = (unsigned int)timestamp + (8*365 + 2*366)*24*3600-3600;
tmp = *localtime(&timestamp);
switch (buf[DATE_FORMAT_PTR]) {
case 1:
snprintf(date_disp,sizeof(date_disp),_("DD/MM/YYYY"));
strftime(date,sizeof(date),"%d/%m/%Y %H:%M",&tmp);
break;
case 2:
strftime(date,sizeof(date),"%Y/%m/%d %H:%M",&tmp);
snprintf(date_disp,sizeof(date_disp),_("YYYY/MM/DD"));
break;
default:
strftime(date,sizeof(date),"%m/%d/%Y %H:%M",&tmp);
snprintf(date_disp,sizeof(date_disp),_("MM/DD/YYYY"));
break;
case 1:
snprintf(date_disp, sizeof(date_disp), _("DD/MM/YYYY"));
strftime(date, sizeof(date), "%d/%m/%Y %H:%M", &tmp);
break;
case 2:
strftime(date, sizeof(date), "%Y/%m/%d %H:%M", &tmp);
snprintf(date_disp, sizeof(date_disp), _("YYYY/MM/DD"));
break;
default:
strftime(date, sizeof(date), "%m/%d/%Y %H:%M", &tmp);
snprintf(date_disp, sizeof(date_disp), _("MM/DD/YYYY"));
break;
}
snprintf(text->text, sizeof(text->text),
_("Model: %s\n"
@@ -1272,12 +1269,12 @@ camera_init (Camera *camera, GPContext *context)
char cmd[3], buf[1];
/* First, set up all the function pointers. */
camera->functions->capture = camera_capture;
camera->functions->about = camera_about;
camera->functions->get_config = camera_get_config;
camera->functions->set_config = camera_set_config;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->capture = camera_capture;
camera->functions->about = camera_about;
camera->functions->get_config = camera_get_config;
camera->functions->set_config = camera_set_config;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
/* Now, tell the filesystem where to get lists, files and info */

View File

@@ -255,10 +255,10 @@ camera_init (Camera *camera, GPContext *context)
int ret;
GPPortSettings settings;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->capture = camera_capture;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->capture = camera_capture;
camera->functions->about = camera_about;
/* Now, tell the filesystem where to get lists, files and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);

View File

@@ -109,15 +109,15 @@ int largan_open (Camera * camera)
{
int ret;
ret = largan_get_num_pict (camera);
if (ret < 0){
ret = purge_camera (camera);
if (ret == GP_ERROR) {
return ret;
}
ret = wakeup_camera (camera);
ret = largan_get_num_pict (camera);
if (ret < 0) {
ret = purge_camera (camera);
if (ret == GP_ERROR) {
return ret;
}
ret = wakeup_camera (camera);
}
return ret; /* here: number of pictures */
return ret; /* here: number of pictures */
}
/*
@@ -160,21 +160,21 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
uint32_t pict_size; /* size of the picture as returned by the camera */
switch (type) {
case LARGAN_PICT:
param = 0x01;
break;
case LARGAN_THUMBNAIL:
param = 0x00;
break;
default:
GP_DEBUG ("largan_get_pict(): wrong picture type requested !\n");
return GP_ERROR;
case LARGAN_PICT:
param = 0x01;
break;
case LARGAN_THUMBNAIL:
param = 0x00;
break;
default:
GP_DEBUG ("largan_get_pict(): wrong picture type requested !\n");
return GP_ERROR;
}
ret = largan_send_command (camera, LARGAN_GET_PICT_CMD, param, index);
if (ret < 0) {
return ret;
}
ret = largan_recv_reply (camera, &reply, &code, NULL);
ret = largan_recv_reply (camera, &reply, &code, NULL);
/* 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
@@ -183,26 +183,26 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
bytes 4 5 6 7 contain the number of byte coming in the datastream */
/* the 1st and the 2nd byte are read here */
if (ret < 0) {
/* clean up and give it a 2nd chance */
wakeup_camera (camera);
largan_send_command (camera, LARGAN_GET_PICT_CMD, param, index);
GP_DEBUG ("largan_get_pict(): command sent 2nd time\n");
ret = largan_recv_reply (camera, &reply, &code, NULL);
if (ret < 0) {
/* clean up and give it even a 3rd chance */
wakeup_camera (camera);
sleep (5);
largan_send_command (camera, LARGAN_GET_PICT_CMD, param, index);
GP_DEBUG ("largan_get_pict(): command sent 3rd time\n");
ret = largan_recv_reply (camera, &reply, &code, NULL);
if (ret < 0) {
GP_DEBUG ("largan_get_pict(): timeout after command sent 3rd time\n");
return ret; /* timeout after 3rd trial */
}
}
}
if ((reply != LARGAN_GET_PICT_CMD) || ((code != 0x01) && (code != 0x00))) {
GP_DEBUG ("largan_get_pict(): code != 0x01 && 0x00\n");
/* clean up and give it a 2nd chance */
wakeup_camera (camera);
largan_send_command (camera, LARGAN_GET_PICT_CMD, param, index);
GP_DEBUG ("largan_get_pict(): command sent 2nd time\n");
ret = largan_recv_reply (camera, &reply, &code, NULL);
if (ret < 0) {
/* clean up and give it even a 3rd chance */
wakeup_camera (camera);
sleep (5);
largan_send_command (camera, LARGAN_GET_PICT_CMD, param, index);
GP_DEBUG ("largan_get_pict(): command sent 3rd time\n");
ret = largan_recv_reply (camera, &reply, &code, NULL);
if (ret < 0) {
GP_DEBUG ("largan_get_pict(): timeout after command sent 3rd time\n");
return ret; /* timeout after 3rd trial */
}
}
}
if ((reply != LARGAN_GET_PICT_CMD) || ((code != 0x01) && (code != 0x00))) {
GP_DEBUG ("largan_get_pict(): code != 0x01 && 0x00\n");
return GP_ERROR;
}
@@ -265,7 +265,7 @@ int largan_get_pict (Camera * camera, largan_pict_type type,
}
default:
GP_DEBUG ("largan_get_pict(): type not LARGAN_PICT nor LARGAN_THUMBNAIL\n");
return GP_ERROR;
return GP_ERROR;
}
return GP_OK;
}

View File

@@ -72,13 +72,13 @@ int lg_gsm_init (GPPort *port, Model *model, Info *info)
/*GP_DEBUG("info[20] = 0x%x\n", firmware[26]);*/
GP_DEBUG("Leaving lg_gsm_init\n");
return GP_OK;
return GP_OK;
}
unsigned int lg_gsm_get_picture_size (GPPort *port, int pic)
{
unsigned int size;
unsigned int size;
/* example : list photos 2 & 3: 0x04000800000040000000
+ 0100 : from
+ 0200 : to
@@ -206,7 +206,7 @@ int lg_gsm_read_picture_data (GPPort *port, char *data, unsigned int datasize, u
READ(port, oknok, 6);
GP_DEBUG("Leaving lg_gsm_read_picture_data\n");
return GP_OK;
return GP_OK;
}
int lg_gsm_list_files (GPPort *port, CameraList *list)
@@ -270,5 +270,5 @@ int lg_gsm_list_files (GPPort *port, CameraList *list)
GP_DEBUG("Leaving lg_gsm_list_files\n");
return GP_OK;
return GP_OK;
}

View File

@@ -51,20 +51,20 @@ struct _CameraPrivateLibrary {
};
static struct {
char *name;
char *name;
CameraDriverStatus status;
unsigned short idVendor;
unsigned short idProduct;
unsigned short idVendor;
unsigned short idProduct;
} models[] = {
{"LG T5100", GP_DRIVER_STATUS_EXPERIMENTAL, 0x1004, 0x6005},
{"LG T5100", GP_DRIVER_STATUS_EXPERIMENTAL, 0x1004, 0x6005},
{NULL,0,0,0}
};
int
camera_id (CameraText *id)
{
strcpy (id->text, "LG GSM camera");
return GP_OK;
strcpy (id->text, "LG GSM camera");
return GP_OK;
}
int
@@ -113,9 +113,9 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("LG GSM generic driver\n"
"Guillaume Bedot <littletux@zarb.org>\n"));
return GP_OK;
strcpy (about->text, _("LG GSM generic driver\n"
"Guillaume Bedot <littletux@zarb.org>\n"));
return GP_OK;
}
/*************** File and Downloading Functions *******************/
@@ -137,7 +137,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
{
Camera *camera = user_data;
int k;
int k;
char *data;
unsigned int len;
@@ -191,9 +191,9 @@ camera_init(Camera *camera, GPContext *context)
int ret = 0;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
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);
@@ -201,17 +201,17 @@ camera_init(Camera *camera, GPContext *context)
return ret;
switch (camera->port->type) {
case GP_PORT_SERIAL:
return GP_ERROR;
case GP_PORT_USB:
settings.usb.config = 1;
settings.usb.altsetting = 0;
settings.usb.interface = 1;
settings.usb.inep = 0x81;
settings.usb.outep =0x02;
break;
default:
return GP_ERROR;
case GP_PORT_SERIAL:
return GP_ERROR;
case GP_PORT_USB:
settings.usb.config = 1;
settings.usb.altsetting = 0;
settings.usb.interface = 1;
settings.usb.inep = 0x81;
settings.usb.outep =0x02;
break;
default:
return GP_ERROR;
}
ret = gp_port_set_settings(camera->port,settings);
@@ -222,7 +222,7 @@ camera_init(Camera *camera, GPContext *context)
GP_DEBUG("inep = %x\n", settings.usb.inep);
GP_DEBUG("outep = %x\n", settings.usb.outep);
/* Tell the CameraFilesystem where to get lists from */
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = malloc (sizeof (CameraPrivateLibrary));

View File

@@ -430,8 +430,8 @@ static void Set_ISO(Camera *camera,const char * ISOValue) {
static char*
generic_setting_getter(Camera *camera, char *type) {
char *result, *s;
xmlDocPtr docin;
xmlNodePtr docroot, output;
xmlDocPtr docin;
xmlNodePtr docroot, output;
xmlAttr *attr;
char url[50];
@@ -725,8 +725,8 @@ static char*
GetPixRange(Camera *camera, int start, int num) {
long NumPix;
int numreadint;
xmlDocPtr docin, docin2;
xmlNodePtr docroot, docroot2, output, output2, next;
xmlDocPtr docin, docin2;
xmlNodePtr docroot, docroot2, output, output2, next;
xmlChar *xchar, *numread;
char* SoapMsg;
CURL *curl;
@@ -1089,15 +1089,15 @@ static struct aperturemap {
static int
camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
{
CameraWidget *widget,*section;
int valset;
unsigned int i;
CameraWidget *widget,*section;
int valset;
unsigned int i;
char *val;
switchToRecMode (camera);
gp_widget_new (GP_WIDGET_WINDOW, _("Lumix Configuration"), window);
gp_widget_set_name (*window, "config");
gp_widget_new (GP_WIDGET_WINDOW, _("Lumix Configuration"), window);
gp_widget_set_name (*window, "config");
gp_widget_new (GP_WIDGET_SECTION, _("Camera Settings"), &section);
gp_widget_set_name (section, "settings");
@@ -1367,14 +1367,14 @@ camera_config_set (Camera *camera, CameraWidget *window, GPContext *context)
static int
strend(const char *s, const char *t)
{
size_t ls = strlen(s); // find length of s
size_t lt = strlen(t); // find length of t
if (ls >= lt) // check if t can fit in s
{
// point s to where t should start and compare the strings from there
return (0 == memcmp(t, s + (ls - lt), lt));
}
return 0; // t was longer than s
size_t ls = strlen(s); // find length of s
size_t lt = strlen(t); // find length of t
if (ls >= lt) // check if t can fit in s
{
// point s to where t should start and compare the strings from there
return (0 == memcmp(t, s + (ls - lt), lt));
}
return 0; // t was longer than s
}
static char*
@@ -1383,33 +1383,33 @@ processNode(xmlTextReaderPtr reader) {
char* lookupImgtag="";
switch (ReadoutMode) {
case 0 : //'jpg
case 0: //'jpg
lookupImgtag = "CAM_RAW_JPG";
break;
case 1 :// 'raw
break;
case 1:// 'raw
lookupImgtag = "CAM_RAW";
break;
case 2 ://'thumb
break;
case 2://'thumb
lookupImgtag = "CAM_LRGTN";
break;
break;
}
const xmlChar *name;
const xmlChar *name;
name = xmlTextReaderConstName(reader);
if (name == NULL)
name = BAD_CAST "--";
name = xmlTextReaderConstName(reader);
if (name == NULL)
name = BAD_CAST "--";
if (xmlTextReaderNodeType(reader) == 1) { // Element
while (xmlTextReaderMoveToNextAttribute(reader)) {
if (strend((char*)xmlTextReaderConstValue(reader),lookupImgtag)) {
xmlTextReaderRead(reader);
ret = (char*)xmlTextReaderConstValue(reader);
printf("the image file is %s\n" ,ret);
if (xmlTextReaderNodeType(reader) == 1) { // Element
while (xmlTextReaderMoveToNextAttribute(reader)) {
if (strend((char*)xmlTextReaderConstValue(reader), lookupImgtag)) {
xmlTextReaderRead(reader);
ret = (char*)xmlTextReaderConstValue(reader);
printf("the image file is %s\n", ret);
}
}
}
}
return ret;
return ret;
}
/*
@@ -1469,61 +1469,61 @@ case RAW:
*/
static int
add_objectid_and_upload (Camera *camera, CameraFilePath *path, GPContext *context, char *ximage, size_t size) {
int ret;
CameraFile *file = NULL;
CameraFileInfo info;
int ret;
CameraFile *file = NULL;
CameraFileInfo info;
ret = gp_file_new(&file);
if (ret!=GP_OK) return ret;
gp_file_set_mtime (file, time(NULL));
strcpy(info.file.type, GP_MIME_JPEG);
ret = gp_file_new(&file);
if (ret!=GP_OK) return ret;
gp_file_set_mtime (file, time(NULL));
strcpy(info.file.type, GP_MIME_JPEG);
GP_LOG_D ("setting size");
ret = gp_file_set_data_and_size(file, ximage, size);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
}
GP_LOG_D ("append to fs");
ret = gp_filesystem_append(camera->fs, path->folder, path->name, context);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
}
GP_LOG_D ("adding filedata to fs");
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
}
GP_LOG_D ("setting size");
ret = gp_file_set_data_and_size(file, ximage, size);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
}
GP_LOG_D ("append to fs");
ret = gp_filesystem_append(camera->fs, path->folder, path->name, context);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
}
GP_LOG_D ("adding filedata to fs");
ret = gp_filesystem_set_file_noop(camera->fs, path->folder, path->name, GP_FILE_TYPE_NORMAL, file, context);
if (ret != GP_OK) {
gp_file_free (file);
return ret;
}
/* We have now handed over the file, disclaim responsibility by unref. */
gp_file_unref (file);
/* We have now handed over the file, disclaim responsibility by unref. */
gp_file_unref (file);
/* 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_SIZE /*| GP_FILE_INFO_MTIME */ ;
strcpy(info.file.type, GP_MIME_JPEG);
/* 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_SIZE /*| GP_FILE_INFO_MTIME */;
strcpy(info.file.type, GP_MIME_JPEG);
info.preview.fields = 0; /* so far none */
/*
info.file.width = oi->ImagePixWidth;
info.file.height = oi->ImagePixHeight;
info.file.size = oi->ObjectCompressedSize;
info.file.mtime = time(NULL);
info.preview.fields = 0; /* so far none */
/*
info.file.width = oi->ImagePixWidth;
info.file.height = oi->ImagePixHeight;
info.file.size = oi->ObjectCompressedSize;
info.file.mtime = time(NULL);
info.preview.fields = GP_FILE_INFO_TYPE |
GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT |
GP_FILE_INFO_SIZE;
strcpy_mime (info.preview.type, params->deviceinfo.VendorExtensionID, oi->ThumbFormat);
info.preview.width = oi->ThumbPixWidth;
info.preview.height = oi->ThumbPixHeight;
info.preview.size = oi->ThumbCompressedSize;
*/
info.preview.fields = GP_FILE_INFO_TYPE |
GP_FILE_INFO_WIDTH | GP_FILE_INFO_HEIGHT |
GP_FILE_INFO_SIZE;
strcpy_mime (info.preview.type, params->deviceinfo.VendorExtensionID, oi->ThumbFormat);
info.preview.width = oi->ThumbPixWidth;
info.preview.height = oi->ThumbPixHeight;
info.preview.size = oi->ThumbCompressedSize;
*/
GP_LOG_D ("setting fileinfo in fs");
return gp_filesystem_set_info_noop(camera->fs, path->folder, path->name, info, context);
GP_LOG_D ("setting fileinfo in fs");
return gp_filesystem_set_info_noop(camera->fs, path->folder, path->name, info, context);
}
static int
@@ -1540,10 +1540,10 @@ ReadImageFromCamera(Camera *camera, CameraFilePath *path, GPContext *context) {
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);
if (strlen(imageURL))
break;
ret = xmlTextReaderRead(reader);
imageURL = processNode(reader);
if (strlen(imageURL))
break;
ret = xmlTextReaderRead(reader);
}
GP_DEBUG("the image URL is %s\n",imageURL);

View File

@@ -55,12 +55,12 @@ struct _CameraPrivateLibrary {
};
static const struct {
char *name;
char *name;
CameraDriverStatus status;
unsigned short idVendor;
unsigned short idProduct;
unsigned short idVendor;
unsigned short idProduct;
} models[] = {
{"Aiptek PenCam VGA+", GP_DRIVER_STATUS_TESTING, 0x08ca, 0x0111},
{"Aiptek PenCam VGA+", GP_DRIVER_STATUS_TESTING, 0x08ca, 0x0111},
{"Trust Spyc@m 100", GP_DRIVER_STATUS_TESTING, 0x08ca, 0x0110},
{"Emprex PCD3600", GP_DRIVER_STATUS_EXPERIMENTAL, 0x093a, 0x010f},
{"Vivitar Vivicam 55", GP_DRIVER_STATUS_EXPERIMENTAL, 0x093a, 0x010f},
@@ -86,34 +86,34 @@ static const struct {
int
camera_id (CameraText *id)
{
strcpy (id->text, "Aiptek PenCam VGA+");
return GP_OK;
strcpy (id->text, "Aiptek PenCam VGA+");
return GP_OK;
}
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
int i;
CameraAbilities a;
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
if (a.status == GP_DRIVER_STATUS_EXPERIMENTAL)
for (i = 0; models[i].name; i++) {
memset (&a, 0, sizeof(a));
strcpy (a.model, models[i].name);
a.status = models[i].status;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.usb_vendor = models[i].idVendor;
a.usb_product= models[i].idProduct;
if (a.status == GP_DRIVER_STATUS_EXPERIMENTAL)
a.operations = GP_OPERATION_NONE;
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;
gp_abilities_list_append (list, a);
}
return GP_OK;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW
| GP_FILE_OPERATION_RAW;
gp_abilities_list_append (list, a);
}
return GP_OK;
}
static int
@@ -121,20 +121,20 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
{
int num_pics = mars_get_num_pics(camera->pl->info);
sprintf (summary->text,ngettext(
sprintf (summary->text, ngettext(
"Mars MR97310 camera.\nThere is %i photo in it.\n",
"Mars MR97310 camera.\nThere are %i photos in it.\n",
"Mars MR97310 camera.\nThere are %i photos in it.\n",
num_pics), num_pics
);
return GP_OK;
return GP_OK;
}
static int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
{
strcpy(manual->text,
_(
"This driver supports cameras with Mars MR97310 chip (and direct\n"
"equivalents ??Pixart PACx07?\?).\n"
"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"
@@ -151,9 +151,9 @@ static int camera_manual (Camera *camera, CameraText *manual, GPContext *context
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("Mars MR97310 camera library\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
return GP_OK;
strcpy (about->text, _("Mars MR97310 camera library\n"
"Theodore Kilgore <kilgota@auburn.edu>\n"));
return GP_OK;
}
/*************** File and Downloading Functions *******************/
@@ -162,7 +162,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];
@@ -172,9 +172,9 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
sprintf (name, "mr%03isnd.wav", i+1);
} else
sprintf (name, "mr%03ipic.ppm", i+1);
gp_list_append (list, name, NULL);
}
return GP_OK;
gp_list_append (list, name, NULL);
}
return GP_OK;
}
static int
@@ -192,10 +192,10 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileType type, CameraFile *file, void *user_data,
GPContext *context)
{
Camera *camera = user_data;
int w=0, h = 0, b = 0, k;
unsigned char *data;
unsigned char *ppm;
Camera *camera = user_data;
int w=0, h = 0, b = 0, k;
unsigned char *data;
unsigned char *ppm;
unsigned char *p_data = NULL;
unsigned char gtable[256], photo_code, res_code, compressed;
unsigned char audio = 0;
@@ -203,21 +203,21 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
int size = 0, raw_size = 0;
float gamma_factor;
GP_DEBUG ("Downloading pictures!\n");
GP_DEBUG ("Downloading pictures!\n");
/* These are cheap cameras. There ain't no EXIF data. */
if (GP_FILE_TYPE_EXIF == type) return GP_ERROR_FILE_EXISTS;
/* Get the number of the photo on the camera */
/* Get the number of the photo on the camera */
k = gp_filesystem_number (camera->fs, "/", filename, context);
/* Determine the resolution setting from the PAT table */
/* 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
* by the camera, in the header of raw data for each photo.
*/
compressed = (photo_code >> 4) & 2;
compressed = (photo_code >> 4) & 2;
switch (res_code) {
case 0: w = 176; h = 144; break;
case 1: audio = 1; break;
@@ -235,30 +235,30 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
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);
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,
camera->port, (char *)data, b, k);
camera->port, (char *)data, b, k);
/* The first 128 bytes are junk, so we toss them.*/
memmove(data, data+128, b - 128);
if (audio) {
p_data = malloc (raw_size+256);
if (!p_data) {free (data); return GP_ERROR_NO_MEMORY;}
if (!p_data) { free (data); return GP_ERROR_NO_MEMORY; }
memset (p_data, 0, raw_size+256);
sprintf ((char *)p_data, "RIFF");
sprintf ((char *)p_data, "RIFF");
p_data[4] = (raw_size+36)&0xff;
p_data[5] = ((raw_size+36)>>8)&0xff;
p_data[6] = ((raw_size+36)>>16)&0xff;
p_data[7] = ((raw_size+36)>>24)&0xff;
sprintf ((char *)p_data+8, "WAVE");\
sprintf ((char *)p_data+12, "fmt ");
sprintf ((char *)p_data+8, "WAVE");
sprintf ((char *)p_data+12, "fmt ");
p_data[16] = 0x10;
p_data[20] = 1;
p_data[22] = 1;
@@ -268,14 +268,14 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
p_data[29] = 0x1F;
p_data[32] = 1;
p_data[34] = 8;
sprintf ((char *)p_data+36, "data");
sprintf ((char *)p_data+36, "data");
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;
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);
gp_file_set_data_and_size(file, (char *)p_data, raw_size+44);
return GP_OK;
}
@@ -314,7 +314,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
ppm = malloc (w * h * 3 + 256); /* Data + header */
if (!ppm) {free (p_data); return GP_ERROR_NO_MEMORY;}
memset (ppm, 0, w * h * 3 + 256);
sprintf ((char *)ppm,
sprintf ((char *)ppm,
"P6\n"
"# CREATOR: gphoto2, Mars library\n"
"%d %d\n"
@@ -326,11 +326,11 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
gp_gamma_fill_table (gtable, gamma_factor );
gp_gamma_correct_single (gtable, ptr, w * h);
mars_white_balance (ptr, w*h, 1.4, gamma_factor);
gp_file_set_mime_type (file, GP_MIME_PPM);
gp_file_set_mime_type (file, GP_MIME_PPM);
gp_file_set_data_and_size (file, (char *)ppm, size);
free (p_data);
return GP_OK;
return GP_OK;
}
/*************** Exit and Initialization Functions ******************/
@@ -360,7 +360,7 @@ camera_init(Camera *camera, GPContext *context)
int ret = 0;
/* First, set up all the function pointers */
camera->functions->manual = camera_manual;
camera->functions->manual = camera_manual;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
@@ -370,19 +370,19 @@ camera_init(Camera *camera, GPContext *context)
if (ret < 0) return ret;
switch (camera->port->type) {
case GP_PORT_SERIAL:
return ( GP_ERROR );
case GP_PORT_USB:
settings.usb.config = 1;
settings.usb.altsetting = 0;
settings.usb.interface = 0;
case GP_PORT_SERIAL:
return (GP_ERROR);
case GP_PORT_USB:
settings.usb.config = 1;
settings.usb.altsetting = 0;
settings.usb.interface = 0;
/* settings.usb.inep = 0x82; */
/* inep 0x83 used for commands. Switch to 0x82 for data! */
settings.usb.inep = 0x83;
settings.usb.outep = 0x04;
break;
default:
return ( GP_ERROR );
settings.usb.inep = 0x83;
settings.usb.outep = 0x04;
break;
default:
return (GP_ERROR);
}
ret = gp_port_set_settings(camera->port,settings);
@@ -392,7 +392,7 @@ camera_init(Camera *camera, GPContext *context)
GP_DEBUG("inep = %x\n", settings.usb.inep);
GP_DEBUG("outep = %x\n", settings.usb.outep);
/* Tell the CameraFilesystem where to get lists from */
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = malloc (sizeof (CameraPrivateLibrary));

View File

@@ -76,7 +76,7 @@ mars_init (Camera *camera, GPPort *port, Info *info)
* 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);
@@ -97,7 +97,7 @@ mars_init (Camera *camera, GPPort *port, Info *info)
memmove(info, info + 144, 0x1f70); /* Saving config */
GP_DEBUG("Leaving mars_init\n");
return GP_OK;
return GP_OK;
}
int
@@ -123,7 +123,7 @@ mars_get_pic_data_size (Info *info, int n)
}
static int
set_usb_in_endpoint (Camera *camera, int inep)
set_usb_in_endpoint (Camera *camera, int inep)
{
GPPortSettings settings;
gp_port_get_settings ( camera ->port, &settings);
@@ -134,18 +134,18 @@ set_usb_in_endpoint (Camera *camera, int inep)
static int
mars_read_data (GPPort *port, char *data, int size)
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;
}
return 1;
return 1;
}
int
@@ -247,63 +247,63 @@ int mars_decompress (unsigned char *inp, unsigned char *outp, int width,
/* first two pixels in first two rows are stored as raw 8-bit */
if (row < 2) {
GET_CODE;
bitpos += 8;
*outp++ = code;
GET_CODE;
bitpos += 8;
*outp++ = code;
GET_CODE;
bitpos += 8;
*outp++ = code;
GET_CODE;
bitpos += 8;
*outp++ = code;
col += 2;
col += 2;
}
while (col < width) {
/* get bitcode */
GET_CODE;
/* update bit position */
bitpos += table[code].len;
/* get bitcode */
GET_CODE;
/* update bit position */
bitpos += table[code].len;
/* calculate pixel value */
if (table[code].is_abs) {
/* get 5 more bits and use them as absolute value */
GET_CODE;
val = (code & 0xF8);
bitpos += 5;
/* calculate pixel value */
if (table[code].is_abs) {
/* get 5 more bits and use them as absolute value */
GET_CODE;
val = (code & 0xF8);
bitpos += 5;
}else {
/* value is relative to top or left pixel */
val = table[code].val;
lp = outp[-2];
if (row > 1) {
if (col > 1)
tlp = outp[-2*width-2];
tp = outp[-2*width];
if (col < width-2)
trp = outp[-2*width+2];
}
if (row < 2) {
/* top row: relative to left pixel */
val += lp;
}else if (col < 2) {
/* left column: relative to top pixel */
/* initial estimate */
val += (tp + trp)/2;
}else if (col > width - 3) {
/* left column: relative to top pixel */
val += (tp + lp + tlp +1)/3;
/* main area: average of left and top pixel */
}else {
/* initial estimate for predictor */
tlp>>=1;
trp>>=1;
val += (lp + tp + tlp + trp +1)/3;
}
}
/* store pixel */
*outp++ = CLAMP(val);
col++;
} else {
/* value is relative to top or left pixel */
val = table[code].val;
lp = outp[-2];
if (row > 1) {
if (col > 1)
tlp = outp[-2*width-2];
tp = outp[-2*width];
if (col < width-2)
trp = outp[-2*width+2];
}
if (row < 2) {
/* top row: relative to left pixel */
val += lp;
} else if (col < 2) {
/* left column: relative to top pixel */
/* initial estimate */
val += (tp + trp)/2;
} else if (col > width - 3) {
/* left column: relative to top pixel */
val += (tp + lp + tlp +1)/3;
/* main area: average of left and top pixel */
} else {
/* initial estimate for predictor */
tlp>>=1;
trp>>=1;
val += (lp + tp + tlp + trp +1)/3;
}
}
/* store pixel */
*outp++ = CLAMP(val);
col++;
}
}
return GP_OK;
}
@@ -342,7 +342,7 @@ 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);
@@ -350,8 +350,8 @@ mars_routine (Info *info, GPPort *port, char param, int n)
c[0] = 0;
gp_port_write(port, address2, 2);
/* Moving the memory cursor to the given address? */
while (( c[0] != 0xa) ) {
if (m_read(port, c, 16) < 16)
while ((c[0] != 0xa)) {
if (m_read(port, c, 16) < 16)
break;
}

View File

@@ -429,13 +429,13 @@ int camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->capture = camera_capture;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->capture = camera_capture;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
GP_DEBUG( "initializing the camera");
GP_DEBUG ("initializing the camera");
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl)
@@ -444,35 +444,35 @@ int camera_init (Camera *camera, GPContext *context)
camera->pl->dev = camera->port;
/* Configure the port */
gp_port_set_timeout(camera->port, 5000);
gp_port_set_timeout(camera->port, 5000);
gp_port_get_settings(camera->port, &settings);
settings.serial.speed = 38400;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
gp_port_set_settings(camera->port, settings);
settings.serial.speed = 38400;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
gp_port_set_settings(camera->port, settings);
if ( dimagev_get_camera_data(camera->pl) < GP_OK ) {
GP_DEBUG( "camera_init::unable to get current camera data");
if (dimagev_get_camera_data(camera->pl) < GP_OK) {
GP_DEBUG("camera_init::unable to get current camera data");
free (camera->pl);
camera->pl = NULL;
return GP_ERROR_IO;
}
return GP_ERROR_IO;
}
if ( dimagev_get_camera_status(camera->pl) < GP_OK ) {
GP_DEBUG( "camera_init::unable to get current camera status");
if (dimagev_get_camera_status(camera->pl) < GP_OK) {
GP_DEBUG("camera_init::unable to get current camera status");
free (camera->pl);
camera->pl = NULL;
return GP_ERROR_IO;
}
return GP_ERROR_IO;
}
/* Apparently, trying to set the clock now leaves the camera in an
unstable state. Skipping it for now. */
/* if ( dimagev_set_date(camera->pl) < GP_OK ) {
GP_DEBUG( "camera_init::unable to set camera to system time");
} */
/* if ( dimagev_set_date(camera->pl) < GP_OK ) {
GP_DEBUG( "camera_init::unable to set camera to system time");
} */
/* Set up the filesystem */
/* Set up the filesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
return GP_OK;
return GP_OK;
}

View File

@@ -57,7 +57,7 @@ int mdc800_io_sendCommand_with_retry (GPPort *port,unsigned char* command, unsig
while (try < maxtries)
{
usleep(MDC800_DEFAULT_COMMAND_RETRY_DELAY*1000);
usleep(MDC800_DEFAULT_COMMAND_RETRY_DELAY*1000);
if (port->type == GP_PORT_USB)
ret=mdc800_usb_sendCommand(port,command, buffer, length );
else

View File

@@ -304,14 +304,14 @@ static CameraFilesystemFuncs fsfuncs = {
int
camera_init (Camera *camera, GPContext *context)
{
/* First, set up all the function pointers */
/* camera->functions->exit = camera_exit; */
camera->functions->get_config = camera_config_get;
camera->functions->set_config = camera_config_set;
camera->functions->capture = camera_capture;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
/* camera->functions->exit = camera_exit; */
camera->functions->get_config = camera_config_get;
camera->functions->set_config = camera_config_set;
camera->functions->capture = camera_capture;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* Now, tell the filesystem where to get lists, files and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
@@ -319,13 +319,13 @@ camera_init (Camera *camera, GPContext *context)
/* Configure port */
gp_port_set_timeout(camera->port,MDC800_DEFAULT_COMMAND_RETRY_DELAY);
if (camera->port->type == GP_PORT_SERIAL) {
GPPortSettings settings;
gp_port_get_settings(camera->port, &settings);
settings.serial.speed = 57600;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits= 1;
gp_port_set_settings(camera->port, settings);
GPPortSettings settings;
gp_port_get_settings(camera->port, &settings);
settings.serial.speed = 57600;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits= 1;
gp_port_set_settings(camera->port, settings);
}
return mdc800_openCamera(camera);
}

View File

@@ -263,11 +263,11 @@ void mdc800_createDialog (void )
/* done with the widgets */
toggle = gtk_toggle_button_new();
toggle = gtk_toggle_button_new();
gtk_widget_show(toggle);
gtk_widget_hide(toggle);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mdc800_dialog.dialog)->action_area),
toggle, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mdc800_dialog.dialog)->action_area),
toggle, TRUE, TRUE, 0);
mdc800_dialog.save_button = gtk_button_new_with_label("Save");
gtk_widget_show(mdc800_dialog.save_button);
@@ -359,7 +359,7 @@ int mdc800_setupDialog (void)
/* Baudrate */
if (!mdc800_io_using_usb) {
int speed;
mdc800_getSpeed(camera,&speed);
mdc800_getSpeed (camera, &speed);
mdc800_ComboBox_SetEntry (mdc800_dialog.baud, mdc800_baud_rate_string, speed);
}
@@ -408,12 +408,12 @@ int mdc800_setupConfig (void)
value = mdc800_ComboBox_GetEntry (mdc800_dialog.light, mdc800_wb_string,4);
switch (value)
{
case 0: value=1; break;
case 1: value=2; break;
case 2: value=4; break;
case 3: value=8; break;
default:
return -1;
case 0: value=1; break;
case 1: value=2; break;
case 2: value=4; break;
case 3: value=8; break;
default:
return -1;
}
if (!mdc800_setWB (value))
return -1;
@@ -422,9 +422,9 @@ int mdc800_setupConfig (void)
/* Set LCD ON/OFF... */
if (GTK_WIDGET_STATE(mdc800_dialog.lcd_on) == GTK_STATE_ACTIVE)
mdc800_enableLCD (1);
mdc800_enableLCD (1);
else
mdc800_enableLCD (0);
mdc800_enableLCD (0);
update_progress(62);

View File

@@ -49,193 +49,193 @@ static const char
int dsc1_sendcmd(Camera *camera, uint8_t cmd, void *data, int size) {
int i;
int i;
DEBUG_PRINT_MEDIUM(("Sending command: 0x%02x, data size: %i.", cmd, size));
DEBUG_PRINT_MEDIUM(("Sending command: 0x%02x, data size: %i.", cmd, size));
memset(camera->pl->buf, 0, DSC_BUFSIZE);
memset(camera->pl->buf, 0, DSC_BUFSIZE);
memcpy(camera->pl->buf, c_prefix, 12);
memcpy(camera->pl->buf, c_prefix, 12);
for (i = 0; i < 4; i++)
camera->pl->buf[DSC1_BUF_SIZE + i] = (uint8_t)(size >> 8*(3 - i));
for (i = 0; i < 4; i++)
camera->pl->buf[DSC1_BUF_SIZE + i] = (uint8_t)(size >> 8*(3 - i));
camera->pl->buf[DSC1_BUF_CMD] = cmd;
camera->pl->buf[DSC1_BUF_CMD] = cmd;
if (DSC_BUFSIZE - DSC1_BUF_DATA <= size) {
RETURN_ERROR(EDSCOVERFL)
/* overflow */
}
if (DSC_BUFSIZE - DSC1_BUF_DATA <= size) {
RETURN_ERROR(EDSCOVERFL)
/* overflow */
}
if (data && 0 < size)
memcpy(&camera->pl->buf[DSC1_BUF_DATA], data, size);
if (data && 0 < size)
memcpy(&camera->pl->buf[DSC1_BUF_DATA], data, size);
return gp_port_write(camera->port, camera->pl->buf, 17 + size);
return gp_port_write(camera->port, camera->pl->buf, 17 + size);
}
int dsc1_retrcmd(Camera *camera) {
int result = GP_ERROR;
int s;
int result = GP_ERROR;
int s;
if ((s = gp_port_read(camera->port, camera->pl->buf, 17)) == GP_ERROR)
return GP_ERROR;
if ((s = gp_port_read(camera->port, camera->pl->buf, 17)) == GP_ERROR)
return GP_ERROR;
/* Make sense in debug only. Done on gp_port level.
if (0 < s)
dsc_dumpmem(camera->pl->buf, s);
if (0 < s)
dsc_dumpmem(camera->pl->buf, s);
*/
if (s != 17 || memcmp(camera->pl->buf, r_prefix, 12) != 0 )
RETURN_ERROR(EDSCBADRSP)
/* bad response */
else
result = camera->pl->buf[DSC1_BUF_CMD];
if (s != 17 || memcmp(camera->pl->buf, r_prefix, 12) != 0 )
RETURN_ERROR(EDSCBADRSP)
/* bad response */
else
result = camera->pl->buf[DSC1_BUF_CMD];
camera->pl->size =
(uint32_t)camera->pl->buf[DSC1_BUF_SIZE + 3] |
((uint8_t)camera->pl->buf[DSC1_BUF_SIZE + 2] << 8) |
((uint8_t)camera->pl->buf[DSC1_BUF_SIZE + 1] << 16) |
((uint8_t)camera->pl->buf[DSC1_BUF_SIZE] << 24);
camera->pl->size =
(uint32_t)camera->pl->buf[DSC1_BUF_SIZE + 3] |
((uint8_t)camera->pl->buf[DSC1_BUF_SIZE + 2] << 8) |
((uint8_t)camera->pl->buf[DSC1_BUF_SIZE + 1] << 16) |
((uint8_t)camera->pl->buf[DSC1_BUF_SIZE] << 24);
if (DSC_BUFSIZE < camera->pl->size) {
RETURN_ERROR(EDSCOVERFL);
/* overflow */
}
if (DSC_BUFSIZE < camera->pl->size) {
RETURN_ERROR(EDSCOVERFL);
/* overflow */
}
if (gp_port_read(camera->port, camera->pl->buf, camera->pl->size) != camera->pl->size)
return GP_ERROR;
if (gp_port_read(camera->port, camera->pl->buf, camera->pl->size) != camera->pl->size)
return GP_ERROR;
DEBUG_PRINT_MEDIUM(("Retrieved command: %i.", result));
DEBUG_PRINT_MEDIUM(("Retrieved command: %i.", result));
return result;
return result;
}
int dsc1_setbaudrate(Camera *camera, int speed) {
GPPortSettings settings;
uint8_t s_bps;
int result;
uint8_t s_bps;
int result;
DEBUG_PRINT_MEDIUM(("Setting baud rate to: %i.", speed));
DEBUG_PRINT_MEDIUM(("Setting baud rate to: %i.", speed));
switch (speed) {
switch (speed) {
case 9600:
s_bps = 0x02;
break;
case 9600:
s_bps = 0x02;
break;
case 19200:
s_bps = 0x0d;
break;
case 19200:
s_bps = 0x0d;
break;
case 38400:
s_bps = 0x01;
break;
case 38400:
s_bps = 0x01;
break;
case 57600:
s_bps = 0x03;
break;
case 57600:
s_bps = 0x03;
break;
case 115200:
s_bps = 0x00;
break;
case 115200:
s_bps = 0x00;
break;
default:
RETURN_ERROR(EDSCBPSRNG);
}
default:
RETURN_ERROR(EDSCBPSRNG);
}
if (dsc1_sendcmd(camera, DSC1_CMD_SET_BAUD, &s_bps, 1) != GP_OK)
return GP_ERROR;
if (dsc1_sendcmd(camera, DSC1_CMD_SET_BAUD, &s_bps, 1) != GP_OK)
return GP_ERROR;
if (dsc1_retrcmd(camera) != DSC1_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc1_retrcmd(camera) != DSC1_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
sleep(DSC_PAUSE/2);
sleep(DSC_PAUSE/2);
CHECK (gp_port_get_settings(camera->port, &settings));
settings.serial.speed = speed;
CHECK (gp_port_set_settings(camera->port, settings));
CHECK (gp_port_set_settings(camera->port, settings));
DEBUG_PRINT_MEDIUM(("Baudrate set to: %i.", speed));
DEBUG_PRINT_MEDIUM(("Baudrate set to: %i.", speed));
return GP_OK;
return GP_OK;
}
int dsc1_getmodel(Camera *camera) {
static const char response[3] = { 'D', 'S', 'C' };
static const char response[3] = { 'D', 'S', 'C' };
DEBUG_PRINT_MEDIUM(("Getting camera model."));
DEBUG_PRINT_MEDIUM(("Getting camera model."));
if (dsc1_sendcmd(camera, DSC1_CMD_GET_MODEL, NULL, 0) != GP_OK)
return GP_ERROR;
if (dsc1_sendcmd(camera, DSC1_CMD_GET_MODEL, NULL, 0) != GP_OK)
return GP_ERROR;
if (dsc1_retrcmd(camera) != DSC1_RSP_MODEL ||
memcmp(camera->pl->buf, response, 3) != 0)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc1_retrcmd(camera) != DSC1_RSP_MODEL ||
memcmp(camera->pl->buf, response, 3) != 0)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
DEBUG_PRINT_MEDIUM(("Camera model is: %c.", camera->pl->buf[3]));
DEBUG_PRINT_MEDIUM(("Camera model is: %c.", camera->pl->buf[3]));
switch (camera->pl->buf[3]) {
case '1':
return DSC1;
switch (camera->pl->buf[3]) {
case '1':
return DSC1;
case '2':
return DSC2;
case '2':
return DSC2;
default:
return 0;
}
return GP_ERROR;
default:
return 0;
}
return GP_ERROR;
}
void dsc_dumpmem(void *buf, int size) {
int i;
int i;
fprintf(stderr, "\nMemory dump: size: %i, contents:\n", size);
for (i = 0; i < size; i ++)
fprintf(
stderr,
*((char*)buf + i) >= 32 &&
*((char*)buf + i) < 127 ? "%c" : "\\x%02x",
(uint8_t)*((char*)buf + i)
);
fprintf(stderr, "\n\n");
fprintf(stderr, "\nMemory dump: size: %i, contents:\n", size);
for (i = 0; i < size; i++)
fprintf(
stderr,
*((char*)buf + i) >= 32 &&
*((char*)buf + i) < 127 ? "%c" : "\\x%02x",
(uint8_t)*((char*)buf + i)
);
fprintf(stderr, "\n\n");
}
const char *dsc_strerror(int error) {
static const char * const errorlist[] = {
"Unknown error code",
"Baud rate out of range",
"Bad image number",
"Bad response",
"Bad camera model",
"Overflow"
};
static const char * const errorlist[] = {
"Unknown error code",
"Baud rate out of range",
"Bad image number",
"Bad response",
"Bad camera model",
"Overflow"
};
if (error == EDSCSERRNO)
return strerror(errno);
if (error == EDSCSERRNO)
return strerror(errno);
if (error < 1 || EDSCMAXERR < error)
return errorlist[EDSCUNKNWN];
if (error < 1 || EDSCMAXERR < error)
return errorlist[EDSCUNKNWN];
return errorlist[error];
return errorlist[error];
}
char *dsc_msgprintf(char *format, ...) {
va_list pvar;
static char msg[512];
va_list pvar;
static char msg[512];
va_start(pvar, format);
vsprintf(msg, format, pvar);
va_end(pvar);
return msg;
va_start(pvar, format);
vsprintf(msg, format, pvar);
va_end(pvar);
return msg;
}
void dsc_errorprint(int error, char *file, int line) {

View File

@@ -95,24 +95,24 @@ void dsc_errorprint(int error, char *file, int line);
/* Pre-procesor macros for verbose messaging and debugging */
#define DEBUG_PRINT_LOW(ARGS) \
GP_DEBUG( "%s: %s", __FILE__, dsc_msgprintf ARGS );
GP_DEBUG( "%s: %s", __FILE__, dsc_msgprintf ARGS );
#define DEBUG_PRINT_MEDIUM(ARGS) \
GP_DEBUG( "%s: %s", __FILE__, dsc_msgprintf ARGS );
GP_DEBUG( "%s: %s", __FILE__, dsc_msgprintf ARGS );
#define DEBUG_PRINT_HIGH(ARGS) \
GP_DEBUG( "%s: %s", __FILE__, dsc_msgprintf ARGS );
GP_DEBUG( "%s: %s", __FILE__, dsc_msgprintf ARGS );
#define RETURN_ERROR(ERROR) { \
dsc_errorprint(ERROR, __FILE__, __LINE__); \
return GP_ERROR; \
}
dsc_errorprint(ERROR, __FILE__, __LINE__); \
return GP_ERROR; \
}
#define CHECK(OPERATION) \
if ((result = OPERATION) < 0) { \
dsc_errorprint(EDSCSERRNO, __FILE__, __LINE__); \
return result; \
}
if ((result = OPERATION) < 0) { \
dsc_errorprint(EDSCSERRNO, __FILE__, __LINE__); \
return result; \
}
/* End of dc.h */

View File

@@ -138,7 +138,7 @@ static int dsc1_delete(Camera *camera, uint8_t index) {
static int dsc1_selectimage(Camera *camera, uint8_t index)
{
int size = 0;
int size = 0;
DEBUG_PRINT_MEDIUM(("Selecting image: %i.", index));
@@ -332,7 +332,7 @@ int camera_id (CameraText *id) {
int camera_abilities (CameraAbilitiesList *list) {
CameraAbilities a;
int result;
int result;
memset (&a, 0, sizeof(a));
strcpy(a.model, "Panasonic:DC1000");
@@ -486,7 +486,7 @@ static int delete_file_func (CameraFilesystem *fs, const char *folder,
/* index is the 0-based image number on the camera */
CHECK (index = gp_filesystem_number (camera->fs, folder, filename,
context));
index++;
index++;
return dsc1_delete(camera, index);
}
@@ -511,12 +511,12 @@ static CameraFilesystemFuncs fsfuncs = {
int camera_init (Camera *camera, GPContext *context) {
int ret, selected_speed;
int ret, selected_speed;
GPPortSettings settings;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl)
@@ -529,14 +529,14 @@ int camera_init (Camera *camera, GPContext *context) {
}
/* Configure the port (remember the selected speed) */
gp_port_set_timeout(camera->port, 5000);
gp_port_set_timeout(camera->port, 5000);
gp_port_get_settings(camera->port, &settings);
selected_speed = settings.serial.speed;
settings.serial.speed = 9600; /* hand shake speed */
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
gp_port_set_settings(camera->port, settings);
settings.serial.speed = 9600; /* hand shake speed */
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
gp_port_set_settings(camera->port, settings);
/* Set up the filesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);

View File

@@ -50,221 +50,221 @@
static uint8_t dsc2_checksum(char *buffer, int size) {
int checksum = 0;
int i;
int checksum = 0;
int i;
for (i = 1; i < size - 2; i++) {
checksum += buffer[i];
checksum %= 0x100;
}
for (i = 1; i < size - 2; i++) {
checksum += buffer[i];
checksum %= 0x100;
}
return checksum;
return checksum;
}
/* dsc2_sendcmd - send command with data to DSC */
static int dsc2_sendcmd(Camera *camera, uint8_t cmd, long int data, uint8_t sequence) {
unsigned int i;
unsigned int i;
DEBUG_PRINT_MEDIUM(("Sending command: 0x%02x, data: %i, sequence: %i.", cmd, data, sequence));
DEBUG_PRINT_MEDIUM(("Sending command: 0x%02x, data: %i, sequence: %i.", cmd, data, sequence));
memset(camera->pl->buf, 0, 16);
memset(camera->pl->buf, 0, 16);
camera->pl->buf[0] = 0x08;
camera->pl->buf[1] = sequence;
camera->pl->buf[2] = 0xff - sequence;
camera->pl->buf[3] = cmd;
camera->pl->buf[0] = 0x08;
camera->pl->buf[1] = sequence;
camera->pl->buf[2] = 0xff - sequence;
camera->pl->buf[3] = cmd;
for (i = 0; i < sizeof(data); i++)
camera->pl->buf[4 + i] = (uint8_t)(data >> 8*i);
for (i = 0; i < sizeof(data); i++)
camera->pl->buf[4 + i] = (uint8_t)(data >> 8*i);
camera->pl->buf[14] = dsc2_checksum(camera->pl->buf, 16);
camera->pl->buf[14] = dsc2_checksum(camera->pl->buf, 16);
return gp_port_write(camera->port, camera->pl->buf, 16);
return gp_port_write(camera->port, camera->pl->buf, 16);
}
/* dsc2_retrcmd - retrieve command and its data from DSC */
static int dsc2_retrcmd(Camera *camera) {
int result = GP_ERROR;
int s;
int result = GP_ERROR;
int s;
if ((s = gp_port_read(camera->port, camera->pl->buf, 16)) == GP_ERROR)
return GP_ERROR;
if ((s = gp_port_read(camera->port, camera->pl->buf, 16)) == GP_ERROR)
return GP_ERROR;
/* Make sense in debug only. Done on gp_port level.
if (0 < s)
dsc_dumpmem(camera->pl->buf, s);
if (0 < s)
dsc_dumpmem(camera->pl->buf, s);
*/
if (s != 16 || camera->pl->buf[DSC2_BUF_BASE] != 0x08 ||
camera->pl->buf[DSC2_BUF_SEQ] != 0xff - (uint8_t)camera->pl->buf[DSC2_BUF_SEQC]) {
RETURN_ERROR(EDSCBADRSP);
/* bad response */
}
else
result = camera->pl->buf[DSC2_BUF_CMD];
if (s != 16 || camera->pl->buf[DSC2_BUF_BASE] != 0x08 ||
camera->pl->buf[DSC2_BUF_SEQ] != 0xff - (uint8_t)camera->pl->buf[DSC2_BUF_SEQC]) {
RETURN_ERROR(EDSCBADRSP);
/* bad response */
}
else
result = camera->pl->buf[DSC2_BUF_CMD];
DEBUG_PRINT_MEDIUM(("Retrieved command: %i.", result));
DEBUG_PRINT_MEDIUM(("Retrieved command: %i.", result));
return result;
return result;
}
/* dsc2_connect - try hand shake with camera and establish connection */
static int dsc2_connect(Camera *camera, int speed) {
DEBUG_PRINT_MEDIUM(("Connecting camera with speed: %i.", speed));
DEBUG_PRINT_MEDIUM(("Connecting camera with speed: %i.", speed));
if (dsc1_setbaudrate(camera, speed) != GP_OK)
return GP_ERROR;
if (dsc1_setbaudrate(camera, speed) != GP_OK)
return GP_ERROR;
if (dsc1_getmodel(camera) != DSC2)
RETURN_ERROR(EDSCBADDSC);
/* bad camera model */
if (dsc1_getmodel(camera) != DSC2)
RETURN_ERROR(EDSCBADDSC);
/* bad camera model */
if (dsc2_sendcmd(camera, DSC2_CMD_CONNECT, 0, 0) != GP_OK)
return GP_ERROR;
if (dsc2_sendcmd(camera, DSC2_CMD_CONNECT, 0, 0) != GP_OK)
return GP_ERROR;
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
DEBUG_PRINT_MEDIUM(("Camera connected successfully."));
DEBUG_PRINT_MEDIUM(("Camera connected successfully."));
return GP_OK;
return GP_OK;
}
/* dsc2_disconnect - reset camera, free buffers and close files */
static int dsc2_disconnect(Camera *camera) {
DEBUG_PRINT_MEDIUM(("Disconnecting the camera."));
DEBUG_PRINT_MEDIUM(("Disconnecting the camera."));
if (dsc2_sendcmd(camera, DSC2_CMD_RESET, 0, 0) != GP_OK)
return GP_ERROR;
if (dsc2_sendcmd(camera, DSC2_CMD_RESET, 0, 0) != GP_OK)
return GP_ERROR;
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP)
/* bad response */
else
sleep(DSC_PAUSE); /* let camera to redraw its screen */
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP)
/* bad response */
else
sleep(DSC_PAUSE); /* let camera to redraw its screen */
DEBUG_PRINT_MEDIUM(("Camera disconnected."));
DEBUG_PRINT_MEDIUM(("Camera disconnected."));
return GP_OK;
return GP_OK;
}
/* dsc2_getindex - retrieve the number of images stored in camera memory */
static int dsc2_getindex(Camera *camera) {
int result = GP_ERROR;
int result = GP_ERROR;
DEBUG_PRINT_MEDIUM(("Retrieving the number of images."));
DEBUG_PRINT_MEDIUM(("Retrieving the number of images."));
if (dsc2_sendcmd(camera, DSC2_CMD_GET_INDEX, 0, 0) != GP_OK)
return GP_ERROR;
if (dsc2_sendcmd(camera, DSC2_CMD_GET_INDEX, 0, 0) != GP_OK)
return GP_ERROR;
if (dsc2_retrcmd(camera) == DSC2_RSP_INDEX)
result =
((uint32_t)camera->pl->buf[DSC2_BUF_DATA]) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 1] << 8) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 2] << 16) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 3] << 24);
else
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc2_retrcmd(camera) == DSC2_RSP_INDEX)
result =
((uint32_t)camera->pl->buf[DSC2_BUF_DATA]) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 1] << 8) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 2] << 16) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 3] << 24);
else
RETURN_ERROR(EDSCBADRSP);
/* bad response */
DEBUG_PRINT_MEDIUM(("Number of images: %i", result));
DEBUG_PRINT_MEDIUM(("Number of images: %i", result));
return result;
return result;
}
/* dsc2_delete - delete image #index from camera memory */
static int dsc2_delete(Camera *camera, int index) {
DEBUG_PRINT_MEDIUM(("Deleting image: %i.", index));
DEBUG_PRINT_MEDIUM(("Deleting image: %i.", index));
if (index < 1)
RETURN_ERROR(EDSCBADNUM);
/* bad image number */
if (index < 1)
RETURN_ERROR(EDSCBADNUM);
/* bad image number */
if (dsc2_sendcmd(camera, DSC2_CMD_DELETE, index, 0) != GP_OK)
return GP_ERROR;
if (dsc2_sendcmd(camera, DSC2_CMD_DELETE, index, 0) != GP_OK)
return GP_ERROR;
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
DEBUG_PRINT_MEDIUM(("Image: %i deleted.", index));
return GP_OK;
DEBUG_PRINT_MEDIUM(("Image: %i deleted.", index));
return GP_OK;
}
/* dsc2_selectimage - select image to download, return its size */
static int dsc2_selectimage(Camera *camera, int index, int thumbnail) {
int size = 0;
int size = 0;
DEBUG_PRINT_MEDIUM(("Selecting image: %i, thumbnail: %i.", index, thumbnail));
DEBUG_PRINT_MEDIUM(("Selecting image: %i, thumbnail: %i.", index, thumbnail));
if (index < 1)
RETURN_ERROR(EDSCBADNUM);
/* bad image number */
if (index < 1)
RETURN_ERROR(EDSCBADNUM);
/* bad image number */
if (thumbnail == DSC_THUMBNAIL) {
if (dsc2_sendcmd(camera, DSC2_CMD_THUMB, index, 0) != GP_OK)
return GP_ERROR;
} else {
if (dsc2_sendcmd(camera, DSC2_CMD_SELECT, index, 0) != GP_OK)
return GP_ERROR;
}
if (thumbnail == DSC_THUMBNAIL) {
if (dsc2_sendcmd(camera, DSC2_CMD_THUMB, index, 0) != GP_OK)
return GP_ERROR;
} else {
if (dsc2_sendcmd(camera, DSC2_CMD_SELECT, index, 0) != GP_OK)
return GP_ERROR;
}
if (dsc2_retrcmd(camera) != DSC2_RSP_IMGSIZE)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc2_retrcmd(camera) != DSC2_RSP_IMGSIZE)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
size = ((uint32_t)camera->pl->buf[DSC2_BUF_DATA]) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 1] << 8) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 2] << 16) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 3] << 24);
size = ((uint32_t)camera->pl->buf[DSC2_BUF_DATA]) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 1] << 8) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 2] << 16) |
((uint8_t)camera->pl->buf[DSC2_BUF_DATA + 3] << 24);
DEBUG_PRINT_MEDIUM(("Selected image: %i, thumbnail: %i, size: %i.", index, thumbnail, size));
DEBUG_PRINT_MEDIUM(("Selected image: %i, thumbnail: %i, size: %i.", index, thumbnail, size));
return size;
return size;
}
/* gp_port_readimageblock - read #block block (1024 bytes) of an image into buf */
static int dsc2_readimageblock(Camera *camera, int block, char *buffer) {
DEBUG_PRINT_MEDIUM(("Reading image block: %i.", block));
DEBUG_PRINT_MEDIUM(("Reading image block: %i.", block));
if (dsc2_sendcmd(camera, DSC2_CMD_GET_DATA, block, block) != GP_OK)
return GP_ERROR;
if (dsc2_sendcmd(camera, DSC2_CMD_GET_DATA, block, block) != GP_OK)
return GP_ERROR;
if (gp_port_read(camera->port, camera->pl->buf, DSC_BUFSIZE) != DSC_BUFSIZE)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (gp_port_read(camera->port, camera->pl->buf, DSC_BUFSIZE) != DSC_BUFSIZE)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if ((uint8_t)camera->pl->buf[0] != 1 ||
(uint8_t)camera->pl->buf[1] != block ||
(uint8_t)camera->pl->buf[2] != 0xff - block ||
(uint8_t)camera->pl->buf[3] != DSC2_RSP_DATA ||
(uint8_t)camera->pl->buf[DSC_BUFSIZE - 2] != dsc2_checksum(camera->pl->buf, DSC_BUFSIZE))
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if ((uint8_t)camera->pl->buf[0] != 1 ||
(uint8_t)camera->pl->buf[1] != block ||
(uint8_t)camera->pl->buf[2] != 0xff - block ||
(uint8_t)camera->pl->buf[3] != DSC2_RSP_DATA ||
(uint8_t)camera->pl->buf[DSC_BUFSIZE - 2] != dsc2_checksum(camera->pl->buf, DSC_BUFSIZE))
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (buffer)
memcpy(buffer, &camera->pl->buf[4], DSC_BLOCKSIZE);
if (buffer)
memcpy(buffer, &camera->pl->buf[4], DSC_BLOCKSIZE);
DEBUG_PRINT_MEDIUM(("Block: %i read in.", block));
DEBUG_PRINT_MEDIUM(("Block: %i read in.", block));
return DSC_BLOCKSIZE;
return DSC_BLOCKSIZE;
}
/* dsc2_readimage - read #index image or thumbnail and return its contents */
@@ -272,38 +272,38 @@ static int dsc2_readimageblock(Camera *camera, int block, char *buffer) {
#if 0
static char *dsc2_readimage(Camera *camera, int index, int thumbnail, int *size) {
char kind[16];
int blocks, i;
char *buffer = NULL;
char kind[16];
int blocks, i;
char *buffer = NULL;
DEBUG_PRINT_MEDIUM(("Reading image: %i, thumbnail: %i.", index, thumbnail));
DEBUG_PRINT_MEDIUM(("Reading image: %i, thumbnail: %i.", index, thumbnail));
if ((*size = dsc2_selectimage(camera, index, thumbnail)) < 0)
return NULL;
if ((*size = dsc2_selectimage(camera, index, thumbnail)) < 0)
return NULL;
if (thumbnail == DSC_THUMBNAIL)
strcpy(kind, "thumbnail");
else
strcpy(kind, "image");
if (thumbnail == DSC_THUMBNAIL)
strcpy(kind, "thumbnail");
else
strcpy(kind, "image");
if (!(buffer = (char*)malloc(*size))) {
DEBUG_PRINT_MEDIUM(("Failed to allocate memory for %s data.", kind));
return NULL;
}
if (!(buffer = (char*)malloc(*size))) {
DEBUG_PRINT_MEDIUM(("Failed to allocate memory for %s data.", kind));
return NULL;
}
blocks = (*size - 1)/DSC_BLOCKSIZE + 1;
blocks = (*size - 1)/DSC_BLOCKSIZE + 1;
for (i = 0; i < blocks; i++) {
if (dsc2_readimageblock(camera, i, &buffer[i*DSC_BLOCKSIZE]) == GP_ERROR) {
DEBUG_PRINT_MEDIUM(("Error during %s transfer.", kind));
free(buffer);
return NULL;
}
}
for (i = 0; i < blocks; i++) {
if (dsc2_readimageblock(camera, i, &buffer[i*DSC_BLOCKSIZE]) == GP_ERROR) {
DEBUG_PRINT_MEDIUM(("Error during %s transfer.", kind));
free(buffer);
return NULL;
}
}
DEBUG_PRINT_MEDIUM(("Image: %i read in.", index));
DEBUG_PRINT_MEDIUM(("Image: %i read in.", index));
return buffer;
return buffer;
}
#endif
@@ -311,50 +311,50 @@ static char *dsc2_readimage(Camera *camera, int index, int thumbnail, int *size)
static int dsc2_setimagesize(Camera *camera, int size) {
DEBUG_PRINT_MEDIUM(("Setting image size to: %i.", size));
DEBUG_PRINT_MEDIUM(("Setting image size to: %i.", size));
if (dsc2_sendcmd(camera, DSC2_CMD_SET_SIZE, size, 0) != GP_OK)
return GP_ERROR;
if (dsc2_sendcmd(camera, DSC2_CMD_SET_SIZE, size, 0) != GP_OK)
return GP_ERROR;
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
DEBUG_PRINT_MEDIUM(("Image size set to: %i.", size));
DEBUG_PRINT_MEDIUM(("Image size set to: %i.", size));
return GP_OK;
return GP_OK;
}
/* gp_port_writeimageblock - write size bytes from buffer rounded to 1024 bytes to camera */
static int dsc2_writeimageblock(Camera *camera, int block, char *buffer, int size) {
DEBUG_PRINT_MEDIUM(("Writing image block: %i.", block));
DEBUG_PRINT_MEDIUM(("Writing image block: %i.", block));
memset(camera->pl->buf, 0, DSC_BUFSIZE);
memset(camera->pl->buf, 0, DSC_BUFSIZE);
camera->pl->buf[0] = 0x01;
camera->pl->buf[1] = block;
camera->pl->buf[2] = 0xff - block;
camera->pl->buf[3] = DSC2_CMD_SEND_DATA;
camera->pl->buf[0] = 0x01;
camera->pl->buf[1] = block;
camera->pl->buf[2] = 0xff - block;
camera->pl->buf[3] = DSC2_CMD_SEND_DATA;
if (DSC_BLOCKSIZE < size)
size = DSC_BLOCKSIZE;
if (DSC_BLOCKSIZE < size)
size = DSC_BLOCKSIZE;
memcpy(&camera->pl->buf[4], buffer, size);
memcpy(&camera->pl->buf[4], buffer, size);
camera->pl->buf[DSC_BUFSIZE - 2] = dsc2_checksum(camera->pl->buf, DSC_BUFSIZE);
camera->pl->buf[DSC_BUFSIZE - 2] = dsc2_checksum(camera->pl->buf, DSC_BUFSIZE);
if (gp_port_write(camera->port, camera->pl->buf, DSC_BUFSIZE) != GP_OK)
return GP_ERROR;
if (gp_port_write(camera->port, camera->pl->buf, DSC_BUFSIZE) != GP_OK)
return GP_ERROR;
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
DEBUG_PRINT_MEDIUM(("Block: %i of size: %i written.", block, size));
DEBUG_PRINT_MEDIUM(("Block: %i of size: %i written.", block, size));
return GP_OK;
return GP_OK;
}
/* dsc2_writeimage - write an image to camera memory, size bytes at buffer */
@@ -362,28 +362,28 @@ static int dsc2_writeimageblock(Camera *camera, int block, char *buffer, int siz
#if 0
static int dsc2_writeimage(Camera *camera, char *buffer, int size) {
int blocks, blocksize, i;
int blocks, blocksize, i;
DEBUG_PRINT_MEDIUM(("Writing an image of size: %i.", size));
DEBUG_PRINT_MEDIUM(("Writing an image of size: %i.", size));
if ((dsc2_setimagesize(camera, size)) != GP_OK)
return GP_ERROR;
if ((dsc2_setimagesize(camera, size)) != GP_OK)
return GP_ERROR;
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
for (i = 0; i < blocks; i++) {
blocksize = size - i*DSC_BLOCKSIZE;
if (DSC_BLOCKSIZE < blocksize)
blocksize = DSC_BLOCKSIZE;
if (dsc2_writeimageblock(camera, i, &buffer[i*DSC_BLOCKSIZE], blocksize) != GP_OK) {
DEBUG_PRINT_MEDIUM(("Error during image transfer."));
return GP_ERROR;
}
}
for (i = 0; i < blocks; i++) {
blocksize = size - i*DSC_BLOCKSIZE;
if (DSC_BLOCKSIZE < blocksize)
blocksize = DSC_BLOCKSIZE;
if (dsc2_writeimageblock(camera, i, &buffer[i*DSC_BLOCKSIZE], blocksize) != GP_OK) {
DEBUG_PRINT_MEDIUM(("Error during image transfer."));
return GP_ERROR;
}
}
DEBUG_PRINT_MEDIUM(("Image written successfully."));
DEBUG_PRINT_MEDIUM(("Image written successfully."));
return GP_OK;
return GP_OK;
}
#endif
@@ -392,18 +392,18 @@ static int dsc2_writeimage(Camera *camera, char *buffer, int size) {
#if 0
static int dsc2_preview(Camera *camera, int index) {
if (index < 1)
RETURN_ERROR(EDSCBADNUM);
/* bad image number */
if (index < 1)
RETURN_ERROR(EDSCBADNUM);
/* bad image number */
if (dsc2_sendcmd(camera, DSC2_CMD_PREVIEW, index, 0) != GP_OK)
return GP_ERROR;
if (dsc2_sendcmd(camera, DSC2_CMD_PREVIEW, index, 0) != GP_OK)
return GP_ERROR;
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
if (dsc2_retrcmd(camera) != DSC2_RSP_OK)
RETURN_ERROR(EDSCBADRSP);
/* bad response */
return GP_OK;
return GP_OK;
}
#endif
@@ -413,86 +413,86 @@ static int dsc2_preview(Camera *camera, int index) {
int camera_id (CameraText *id) {
strcpy(id->text, "panasonic-dc1580");
strcpy(id->text, "panasonic-dc1580");
return (GP_OK);
return (GP_OK);
}
int camera_abilities (CameraAbilitiesList *list) {
CameraAbilities a;
char *models[] = {
"Panasonic:DC1580",
"Nikon:CoolPix 600",
NULL };
int i = 0, result;
CameraAbilities a;
char *models[] = {
"Panasonic:DC1580",
"Nikon:CoolPix 600",
NULL };
int i = 0, result;
while (models[i]) {
while (models[i]) {
memset(&a, 0, sizeof(a));
a.status = GP_DRIVER_STATUS_PRODUCTION;
strcpy(a.model, models[i]);
a.port = GP_PORT_SERIAL;
a.speed[0] = 9600;
a.speed[1] = 19200;
a.speed[2] = 38400;
a.speed[3] = 57600;
a.speed[4] = 115200;
a.speed[5] = 0;
a.operations = GP_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_DELETE |
strcpy(a.model, models[i]);
a.port = GP_PORT_SERIAL;
a.speed[0] = 9600;
a.speed[1] = 19200;
a.speed[2] = 38400;
a.speed[3] = 57600;
a.speed[4] = 115200;
a.speed[5] = 0;
a.operations = GP_OPERATION_NONE;
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;
CHECK (gp_abilities_list_append(list, a));
i++;
}
CHECK (gp_abilities_list_append(list, a));
i++;
}
return GP_OK;
return GP_OK;
}
static int camera_exit (Camera *camera, GPContext *context) {
gp_context_status(context, _("Disconnecting camera."));
dsc2_disconnect(camera);
free (camera->pl->buf);
camera->pl->buf = NULL;
gp_context_status(context, _("Disconnecting camera."));
dsc2_disconnect(camera);
free (camera->pl->buf);
camera->pl->buf = NULL;
free (camera->pl);
camera->pl = NULL;
return (GP_OK);
return (GP_OK);
}
static int file_list_func (CameraFilesystem *fs, const char *folder,
CameraList *list, void *data, GPContext *context) {
Camera *camera = data;
int count, result;
Camera *camera = data;
int count, result;
CHECK (count = dsc2_getindex(camera));
CHECK (gp_list_populate(list, DSC_FILENAMEFMT, count));
CHECK (gp_list_populate(list, DSC_FILENAMEFMT, count));
return GP_OK;
return GP_OK;
}
static int get_info_func (CameraFilesystem *fs, const char *folder,
const char *filename, CameraFileInfo *info,
void *data, GPContext *context) {
Camera *camera = data;
Camera *camera = data;
int index, result;
/* index is the 0-based image number on the camera */
CHECK (index = gp_filesystem_number(camera->fs, folder, filename, context));
index++;
/* index is the 0-based image number on the camera */
CHECK (index = gp_filesystem_number(camera->fs, folder, filename, context));
index++;
info->file.fields = GP_FILE_INFO_TYPE | GP_FILE_INFO_SIZE;
strcpy(info->file.type, GP_MIME_JPEG);
info->file.size = dsc2_selectimage(camera, index, DSC_FULLIMAGE);
info->file.size = dsc2_selectimage(camera, index, DSC_FULLIMAGE);
info->preview.fields = GP_FILE_INFO_TYPE | GP_FILE_INFO_SIZE;
strcpy(info->preview.type, GP_MIME_JPEG);
info->preview.size = dsc2_selectimage(camera, index, DSC_THUMBNAIL);
info->preview.size = dsc2_selectimage(camera, index, DSC_THUMBNAIL);
return GP_OK;
return GP_OK;
}
static int get_file_func (CameraFilesystem *fs, const char *folder,
@@ -500,14 +500,14 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
CameraFile *file, void *data, GPContext *context) {
Camera *camera = data;
int index, i, size, blocks, result;
int index, i, size, blocks, result;
unsigned int id;
gp_context_status(context, _("Downloading %s."), filename);
gp_context_status(context, _("Downloading %s."), filename);
/* index is the 0-based image number on the camera */
CHECK (index = gp_filesystem_number(camera->fs, folder, filename, context));
index++;
/* index is the 0-based image number on the camera */
CHECK (index = gp_filesystem_number(camera->fs, folder, filename, context));
index++;
switch (type) {
case GP_FILE_TYPE_PREVIEW:
@@ -524,19 +524,19 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
CHECK (gp_file_set_mime_type(file, GP_MIME_JPEG));
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
id = gp_context_progress_start (context, blocks, _("Getting data..."));
for (i = 0; i < blocks; i++) {
for (i = 0; i < blocks; i++) {
CHECK (dsc2_readimageblock(camera, i, NULL));
CHECK (gp_file_append(file, &camera->pl->buf[4], DSC_BLOCKSIZE));
CHECK (gp_file_append(file, &camera->pl->buf[4], DSC_BLOCKSIZE));
gp_context_progress_update (context, id, i + 1);
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL)
return (GP_ERROR_CANCEL);
}
}
gp_context_progress_stop (context, id);
return GP_OK;
return GP_OK;
}
static int put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
@@ -544,38 +544,38 @@ static int put_file_func (CameraFilesystem *fs, const char *folder, const char *
GPContext *context) {
Camera *camera = user_data;
int blocks, blocksize, i, result;
int blocks, blocksize, i, result;
const char *data;
long unsigned int size;
unsigned int id;
gp_context_status(context, _("Uploading image: %s."), name);
gp_context_status(context, _("Uploading image: %s."), name);
/* We can not figure out file type, at least by now. (? curious, mime type -Marcus)
if (strcmp(file->type, "image/jpg") != 0) {
dsc_print_message(camera, "JPEG image format allowed only.");
return GP_ERROR;
}
if (strcmp(file->type, "image/jpg") != 0) {
dsc_print_message(camera, "JPEG image format allowed only.");
return GP_ERROR;
}
*/
gp_file_get_data_and_size (file, &data, &size);
if (size > DSC_MAXIMAGESIZE) {
gp_context_message (context, _("File size is %ld bytes. "
if (size > DSC_MAXIMAGESIZE) {
gp_context_message (context, _("File size is %ld bytes. "
"The size of the largest file possible to "
"upload is: %i bytes."), size,
DSC_MAXIMAGESIZE);
return GP_ERROR;
}
return GP_ERROR;
}
if ((result = dsc2_setimagesize(camera, size)) != GP_OK) return result;
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
blocks = (size - 1)/DSC_BLOCKSIZE + 1;
id = gp_context_progress_start (context, blocks, _("Uploading..."));
for (i = 0; i < blocks; i++) {
blocksize = size - i*DSC_BLOCKSIZE;
if (DSC_BLOCKSIZE < blocksize)
blocksize = DSC_BLOCKSIZE;
for (i = 0; i < blocks; i++) {
blocksize = size - i*DSC_BLOCKSIZE;
if (DSC_BLOCKSIZE < blocksize)
blocksize = DSC_BLOCKSIZE;
result = dsc2_writeimageblock(camera, i,
(char*)&data[i*DSC_BLOCKSIZE],
blocksize);
@@ -584,10 +584,10 @@ static int put_file_func (CameraFilesystem *fs, const char *folder, const char *
gp_context_progress_update (context, id, i + 1);
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL)
return (GP_ERROR_CANCEL);
}
}
gp_context_progress_stop (context, id);
return GP_OK;
return GP_OK;
}
static int delete_file_func (CameraFilesystem *fs, const char *folder,
@@ -595,26 +595,26 @@ static int delete_file_func (CameraFilesystem *fs, const char *folder,
GPContext *context) {
Camera *camera = data;
int index, result;
int index, result;
gp_context_status(context, _("Deleting image %s."), filename);
gp_context_status(context, _("Deleting image %s."), filename);
/* index is the 0-based image number on the camera */
/* index is the 0-based image number on the camera */
CHECK (index = gp_filesystem_number (camera->fs, folder, filename, context));
index++;
index++;
return dsc2_delete(camera, index);
return dsc2_delete(camera, index);
}
static int camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy(about->text,
_("Panasonic DC1580 gPhoto2 library\n"
"Mariusz Zynel <mariusz@mizar.org>\n\n"
"Based on dc1000 program written by\n"
"Fredrik Roubert <roubert@df.lth.se> and\n"
"Galen Brooks <galen@nine.com>."));
return (GP_OK);
strcpy(about->text,
_("Panasonic DC1580 gPhoto2 library\n"
"Mariusz Zynel <mariusz@mizar.org>\n\n"
"Based on dc1000 program written by\n"
"Fredrik Roubert <roubert@df.lth.se> and\n"
"Galen Brooks <galen@nine.com>."));
return (GP_OK);
}
static CameraFilesystemFuncs fsfuncs = {
@@ -627,12 +627,12 @@ static CameraFilesystemFuncs fsfuncs = {
int camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
int result, selected_speed;
GPPortSettings settings;
int result, selected_speed;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl)
@@ -649,15 +649,15 @@ int camera_init (Camera *camera, GPContext *context)
/* Configure the port (and remember the speed) */
CHECK (gp_port_get_settings (camera->port, &settings));
selected_speed = settings.serial.speed;
settings.serial.speed = 9600; /* hand shake speed */
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
CHECK (gp_port_set_settings (camera->port, settings));
settings.serial.speed = 9600; /* hand shake speed */
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
CHECK (gp_port_set_settings (camera->port, settings));
CHECK (gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera));
CHECK (gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera));
/* Connect with the selected speed */
return dsc2_connect(camera, selected_speed);
return dsc2_connect(camera, selected_speed);
}
/* End of dc1580.c */

View File

@@ -142,7 +142,7 @@ static int l859_disconnect(Camera *camera) {
if (l859_sendcmd(camera, L859_CMD_RESET) != GP_OK)
return GP_ERROR;
if (gp_port_read(camera->port, camera->pl->buf, 1) == GP_ERROR)
return GP_ERROR;
return GP_ERROR;
GP_DEBUG ("Camera disconnected.");
@@ -614,13 +614,13 @@ static CameraFilesystemFuncs fsfuncs = {
int camera_init (Camera *camera, GPContext *context) {
int ret;
int ret;
GPPortSettings settings;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* Allocate memory for a read/write buffer */
@@ -628,19 +628,19 @@ int camera_init (Camera *camera, GPContext *context) {
if (!camera->pl)
return (GP_ERROR_NO_MEMORY);
gp_port_set_timeout (camera->port, 2000);
gp_port_set_timeout (camera->port, 2000);
gp_port_get_settings(camera->port, &settings);
camera->pl->speed = settings.serial.speed;
settings.serial.speed = 9600; /* hand shake speed */
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
gp_port_set_settings(camera->port, settings);
gp_port_set_settings(camera->port, settings);
/* Set up the filesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
ret = l859_connect (camera);
ret = l859_connect (camera);
if (ret < 0) {
free (camera->pl);
camera->pl = NULL;

View File

@@ -115,53 +115,53 @@ camera_abilities (CameraAbilitiesList *list)
strcpy (a.model, "Pentax:K30");
a.usb_vendor = 0x25fb;
a.usb_product = 0x0132;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x0132;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
strcpy (a.model, "Pentax:K5II");
strcpy (a.model, "Pentax:K5II");
a.usb_vendor = 0x25fb;
a.usb_product = 0x0148;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x0148;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
/* TommyLimKW @ Twitter */
strcpy (a.model, "Pentax:K5IIs");
strcpy (a.model, "Pentax:K5IIs");
a.usb_vendor = 0x25fb;
a.usb_product = 0x014a;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x014a;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
strcpy (a.model, "Pentax:K3");
strcpy (a.model, "Pentax:K3");
a.usb_vendor = 0x25fb;
a.usb_product = 0x0164;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x0164;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
strcpy (a.model, "Pentax:K1");
strcpy (a.model, "Pentax:K1");
a.usb_vendor = 0x25fb;
a.usb_product = 0x0178;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x0178;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
strcpy (a.model, "Pentax:K3II");
strcpy (a.model, "Pentax:K3II");
a.usb_vendor = 0x25fb;
a.usb_product = 0x017a;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x017a;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
/* Keld Henningsen <drawsacircle@hotmail.com> */
strcpy (a.model, "Pentax:K70");
strcpy (a.model, "Pentax:K70");
a.usb_vendor = 0x25fb;
a.usb_product = 0x017c;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x017c;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
/* fifu7fi@gmail.com */
strcpy (a.model, "Pentax:KP");
strcpy (a.model, "Pentax:KP");
a.usb_vendor = 0x25fb;
a.usb_product = 0x017e;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
a.usb_product = 0x017e;
if (GP_OK != (ret = gp_abilities_list_append (list, a)))
return ret;
/* https://github.com/asalamon74/pktriggercord/issues/21 */
strcpy (a.model, "Pentax:K1II");
@@ -181,25 +181,25 @@ camera_abilities (CameraAbilitiesList *list)
int scsi_write(GPPort *port, uint8_t *cmd, uint32_t cmdLen,
uint8_t *buf, uint32_t bufLen) {
int ret;
char sense_buffer[32];
int ret;
char sense_buffer[32];
ret = gp_port_send_scsi_cmd (port, 1, (char*)cmd, cmdLen,
sense_buffer, sizeof(sense_buffer), (char*)buf, bufLen);
if (ret == GP_OK) return PSLR_OK;
return PSLR_SCSI_ERROR;
ret = gp_port_send_scsi_cmd (port, 1, (char*)cmd, cmdLen,
sense_buffer, sizeof(sense_buffer), (char*)buf, bufLen);
if (ret == GP_OK) return PSLR_OK;
return PSLR_SCSI_ERROR;
}
int scsi_read(GPPort *port, uint8_t *cmd, uint32_t cmdLen,
uint8_t *buf, uint32_t bufLen)
{
int ret;
char sense_buffer[32];
int ret;
char sense_buffer[32];
ret = gp_port_send_scsi_cmd (port, 0, (char*)cmd, cmdLen,
sense_buffer, sizeof(sense_buffer), (char*)buf, bufLen);
if (ret == GP_OK) return bufLen;
return -PSLR_SCSI_ERROR;
ret = gp_port_send_scsi_cmd (port, 0, (char*)cmd, cmdLen,
sense_buffer, sizeof(sense_buffer), (char*)buf, bufLen);
if (ret == GP_OK) return bufLen;
return -PSLR_SCSI_ERROR;
}
void close_drive(GPPort **port) {
@@ -328,7 +328,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
const char *mimes[2];
int buftypes[2], jpegres[2], nrofdownloads = 1;
char *fns[2], *lastfn = NULL;
struct timeval event_start;
struct timeval event_start;
gp_log (GP_LOG_DEBUG, "pentax", "camera_capture");
@@ -471,7 +471,7 @@ static int
camera_wait_for_event (Camera *camera, int timeout,
CameraEventType *eventtype, void **eventdata,
GPContext *context) {
struct timeval event_start;
struct timeval event_start;
CameraFilePath *path;
pslr_handle_t p = &camera->pl->pslr;
int ret, length;
@@ -829,12 +829,12 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
int i, resolution = -1;
int *valid_resolutions;
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
valid_resolutions = pslr_get_model_jpeg_resolutions (&camera->pl->pslr);
gp_widget_get_value (w, &sval);
for (i = 0; i < MAX_RESOLUTION_SIZE; i++)
{
{
int foo;
sscanf(sval, "%d", &foo);
@@ -854,7 +854,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
if ((ret == GP_OK) && gp_widget_changed (w)) {
pslr_exposure_mode_t exposuremode;
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &sval);
exposuremode = PSLR_EXPOSURE_MODE_MAX;
@@ -879,7 +879,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
if ((ret == GP_OK) && gp_widget_changed (w)) {
int iso;
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &sval);
if (sscanf(sval, "%d", &iso)) {
/* pslr_set_iso(&camera->pl->pslr, iso); */
@@ -910,7 +910,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
/* FIXME: decoding is strange. the UI shows number of stars
* on k20d: 4 stars = 3, 3 stars = 0, 2 stars = 1, 1 star = 2
*/
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &sval);
if (sscanf(sval, "%d", &qual)) {
pslr_set_jpeg_stars (&camera->pl->pslr, qual);
@@ -923,7 +923,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
if ((ret == GP_OK) && gp_widget_changed (w)) {
pslr_rational_t speed;
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &sval);
if (sscanf(sval, "%d/%d", &speed.nom, &speed.denom)) {
pslr_set_shutter(&camera->pl->pslr, speed);
@@ -946,7 +946,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
pslr_rational_t aperture;
int apt1,apt2;
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &sval);
if (sscanf(sval, "%d.%d", &apt1, &apt2)) {
if (apt1<11) {
@@ -983,7 +983,7 @@ camera_set_config (Camera *camera, CameraWidget *window, GPContext *context)
return GP_ERROR;
}
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
gp_widget_get_value (w, &bulb);
pslr_bulb (&camera->pl->pslr, bulb);

View File

@@ -504,9 +504,9 @@ camera_init (Camera *camera, GPContext *context)
CameraAbilities abilities;
int result;
/* First, set up all the function pointers */
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
camera->functions->about = camera_about;
camera->functions->summary = camera_summary;
/* Now, tell the filesystem where to get lists and info */

View File

@@ -912,13 +912,13 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
return (GP_ERROR);
/* Set the filename */
sprintf (path->name, camera->pl->filespec, num);
strcpy (path->folder, "/");
sprintf (path->name, camera->pl->filespec, num);
strcpy (path->folder, "/");
CHECK_RESULT (gp_filesystem_append (camera->fs, "/", path->name,
context));
context));
return (GP_OK);
return (GP_OK);
}
static int

View File

@@ -636,16 +636,16 @@ pdc700_set_date (Camera *camera, time_t time, GPContext *context)
static int
pdc700_capture (Camera *camera, GPContext *context)
{
unsigned char cmd[5], buf[1024];
unsigned int buf_len = 0;
unsigned char cmd[5], buf[1024];
unsigned int buf_len = 0;
int r = 0;
int try;
PDCInfo info;
cmd[3] = PDC700_CAPTURE;
cmd[3] = PDC700_CAPTURE;
cmd[4] = 0;
CR (pdc700_transmit (camera, cmd, 5, buf, &buf_len, context));
CR (pdc700_transmit (camera, cmd, 5, buf, &buf_len, context));
/*
* This is rather hackish. The camera needs a little time to recover
@@ -654,10 +654,10 @@ pdc700_capture (Camera *camera, GPContext *context)
* I'm leaving this ugly-but-works junk here for now.
*/
for (try = 0; try < 10; try++)
if ((r = pdc700_info(camera, &info, context)) == GP_OK)
break;
if ((r = pdc700_info(camera, &info, context)) == GP_OK)
break;
return r;
return r;
};
static int
@@ -746,7 +746,7 @@ camera_abilities (CameraAbilitiesList *list)
a.speed[3] = 57600;
a.speed[4] = 115200;
a.operations = GP_OPERATION_CAPTURE_IMAGE |
GP_OPERATION_CONFIG;
GP_OPERATION_CONFIG;
a.file_operations = GP_FILE_OPERATION_DELETE |
GP_FILE_OPERATION_PREVIEW;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
@@ -1182,10 +1182,10 @@ camera_init (Camera *camera, GPContext *context)
GPPortSettings settings;
int speeds[] = {115200, 9600, 57600, 19200, 38400};
/* First, set up all the function pointers */
/* First, set up all the function pointers */
camera->functions->capture = camera_capture;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->about = camera_about;
camera->functions->get_config = camera_get_config;
camera->functions->set_config = camera_set_config;

View File

@@ -10678,7 +10678,7 @@ _put_nikon_create_wifi_profile (CONFIG_PUT_ARGS)
if (!gp_widget_changed (subwidget))
continue;
gp_widget_set_changed (subwidget, FALSE);
gp_widget_set_changed (subwidget, FALSE);
ret = cursub->putfunc (camera, subwidget, NULL, NULL, NULL);
}

View File

@@ -1451,7 +1451,7 @@ ptp_pack_OPL (PTPParams *params, MTPProperties *props, int nrofprops, unsigned c
packedpropstypes[noitems]= propitr->datatype;
totalsize += sizeof(uint16_t);
/* Add each property to be sent. */
packedpropslens[noitems] = ptp_pack_DPV (params, &propitr->propval, &packedprops[noitems], propitr->datatype);
packedpropslens[noitems] = ptp_pack_DPV (params, &propitr->propval, &packedprops[noitems], propitr->datatype);
totalsize += packedpropslens[noitems];
noitems ++;
propitr ++;

View File

@@ -3706,11 +3706,11 @@ typedef struct _PTPParams PTPParams;
typedef uint16_t (* PTPDataGetFunc) (PTPParams* params, void*priv,
unsigned long wantlen,
unsigned char *data, unsigned long *gotlen);
unsigned char *data, unsigned long *gotlen);
typedef uint16_t (* PTPDataPutFunc) (PTPParams* params, void*priv,
unsigned long sendlen,
unsigned char *data);
unsigned char *data);
typedef struct _PTPDataHandler {
PTPDataGetFunc getfunc;
PTPDataPutFunc putfunc;
@@ -3727,7 +3727,7 @@ typedef uint16_t (* PTPIOSendData) (PTPParams* params, PTPContainer* ptp,
typedef uint16_t (* PTPIOGetResp) (PTPParams* params, PTPContainer* resp);
typedef uint16_t (* PTPIOGetData) (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *putter);
PTPDataHandler *putter);
typedef uint16_t (* PTPIOCancelReq) (PTPParams* params, uint32_t transaction_id);
typedef uint16_t (* PTPIODevStatReq) (PTPParams* params);
@@ -3923,7 +3923,7 @@ uint16_t ptp_usb_senddata (PTPParams* params, PTPContainer* ptp,
uint64_t size, PTPDataHandler *handler);
uint16_t ptp_usb_getresp (PTPParams* params, PTPContainer* resp);
uint16_t ptp_usb_getdata (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *handler);
PTPDataHandler *handler);
uint16_t ptp_usb_event_async (PTPParams *params, PTPEventCbFn cb, void *user_data);
uint16_t ptp_usb_event_wait (PTPParams* params, PTPContainer* event);
uint16_t ptp_usb_event_check (PTPParams* params, PTPContainer* event);
@@ -3943,7 +3943,7 @@ uint16_t ptp_ptpip_senddata (PTPParams* params, PTPContainer* ptp,
uint64_t size, PTPDataHandler *handler);
uint16_t ptp_ptpip_getresp (PTPParams* params, PTPContainer* resp);
uint16_t ptp_ptpip_getdata (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *handler);
PTPDataHandler *handler);
uint16_t ptp_ptpip_event_wait (PTPParams* params, PTPContainer* event);
uint16_t ptp_ptpip_event_check (PTPParams* params, PTPContainer* event);
uint16_t ptp_ptpip_event_check_queue (PTPParams* params, PTPContainer* event);
@@ -3955,7 +3955,7 @@ uint16_t ptp_fujiptpip_senddata (PTPParams* params, PTPContainer* ptp,
uint64_t size, PTPDataHandler *handler);
uint16_t ptp_fujiptpip_getresp (PTPParams* params, PTPContainer* resp);
uint16_t ptp_fujiptpip_getdata (PTPParams* params, PTPContainer* ptp,
PTPDataHandler *handler);
PTPDataHandler *handler);
uint16_t ptp_fujiptpip_event_wait (PTPParams* params, PTPContainer* event);
uint16_t ptp_fujiptpip_event_check (PTPParams* params, PTPContainer* event);
uint16_t ptp_fujiptpip_event_check_queue(PTPParams* params, PTPContainer* event);

View File

@@ -378,10 +378,10 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
break;
case GP_FILE_TYPE_EXIF:
msg = _("Downloading EXIF data...");
if (!strstr(filename,".JPG") && !strstr(filename,".jpg")) {
gp_context_error (context,_("No EXIF data available for %s."),
filename);
ret = GP_ERROR_FILE_NOT_FOUND;
if (!strstr(filename, ".JPG") && !strstr(filename, ".jpg")) {
gp_context_error (context, _("No EXIF data available for %s."),
filename);
ret = GP_ERROR_FILE_NOT_FOUND;
goto out;
}
cmd = aprintf("-SRET %s", filename);
@@ -397,9 +397,9 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
if (seek == -2) {
/* FIXME: pretty bad, the camera has some time out problems
* if this happens */
gp_context_error (context,_("No EXIF data available for %s."),
filename);
ret = GP_ERROR_FILE_NOT_FOUND;
gp_context_error (context, _("No EXIF data available for %s."),
filename);
ret = GP_ERROR_FILE_NOT_FOUND;
g3_channel_read(camera->port, &channel, &reply, &len); /* reply */
goto out;
}
@@ -844,7 +844,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
time = (ubuf[n*32+14]) | (ubuf[n*32+15]<<8);
/* from kernel fs/fat/, time_dos2unix. */
month = ((date >> 5) - 1) & 15;
month = ((date >> 5) - 1) & 15;
year = date >> 9;
info.file.mtime =
(time & 31)*2+60*((time >> 5) & 63)+
@@ -885,18 +885,18 @@ camera_init (Camera *camera, GPContext *context)
/*char *buf;*/
GPPortSettings settings;
/* First, set up all the needed function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* First, set up all the needed function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* Now, tell the filesystem where to get lists, files and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
gp_port_get_settings(camera->port, &settings);
gp_port_get_settings(camera->port, &settings);
settings.usb.inep = 0x81;
settings.usb.outep = 0x02;
settings.usb.intep = 0x83;
gp_port_set_settings(camera->port, settings);
gp_port_set_settings(camera->port, settings);
/*
* The port is already provided with camera->port (and
* already open). You just have to use functions like

View File

@@ -117,7 +117,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
static int
get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileInfo *info, void *data, GPContext *context)
CameraFileInfo *info, void *data, GPContext *context)
{
Camera *camera = data;
int n;
@@ -234,7 +234,7 @@ camera_summary (Camera *camera, CameraText *about, GPContext *context)
camera->pl->model);
sprintf (about->text, _("Model: %s\n"
"Memory: %d byte(s) of %d available"),
"Memory: %d byte(s) of %d available"),
model, avail_mem, total_mem);
return (GP_OK);
@@ -392,9 +392,9 @@ static struct {
const char *__v = NULL; \
unsigned int __i; \
\
CR (gp_widget_get_child_by_name (wi, Name, &__w)); \
CR (gp_widget_get_child_by_name (wi, Name, &__w)); \
if (gp_widget_changed (__w)) { \
gp_widget_set_changed (__w, 0); \
gp_widget_set_changed (__w, 0); \
CR (gp_widget_get_value (__w, &__v)); \
for (__i = 0; __i < N_ELEMENTS (ricoh_##n##s); __i++) \
if (!strcmp (__v, _(ricoh_##n##s[__i].name))) { \
@@ -465,7 +465,7 @@ camera_set_config (Camera *c, CameraWidget *window, GPContext *co)
/* Copyright */
CR (gp_widget_get_child_by_name (window, "copyright", &w));
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
CR (gp_widget_get_value (w, &v_char));
CR (ricoh_set_copyright (c, co, v_char));
}
@@ -473,7 +473,7 @@ camera_set_config (Camera *c, CameraWidget *window, GPContext *co)
/* Date */
CR (gp_widget_get_child_by_name (window, "date", &w));
if (gp_widget_changed (w)) {
gp_widget_set_changed (w, 0);
gp_widget_set_changed (w, 0);
CR (gp_widget_get_value (w, &time));
CR (ricoh_set_date (c, co, time));
}

View File

@@ -147,7 +147,7 @@ static int
ricoh_recv (Camera *camera, GPContext *context, unsigned char *cmd,
unsigned char *number, unsigned char *data, unsigned char *len)
{
unsigned char buf[6];
unsigned char buf[6];
unsigned char r, i, ii, last_dle;
unsigned int crc = 0;
@@ -269,13 +269,13 @@ ricoh_transmit (Camera *camera, GPContext *context, unsigned char cmd,
const unsigned char *data, unsigned char len,
unsigned char *ret_data, unsigned char *ret_len)
{
unsigned char ret_cmd;
unsigned char ret_cmd;
unsigned int r = 0;
int result;
while (1) {
CR (ricoh_send (camera, context, cmd, 0, data, len));
result = ricoh_recv (camera, context, &ret_cmd, NULL,
while (1) {
CR (ricoh_send (camera, context, cmd, 0, data, len));
result = ricoh_recv (camera, context, &ret_cmd, NULL,
ret_data, ret_len);
switch (result) {
case GP_ERROR_TIMEOUT:
@@ -352,14 +352,14 @@ ricoh_transmit (Camera *camera, GPContext *context, unsigned char cmd,
gp_context_error (context, _("An unknown error occurred. "
"Please contact %s."), MAIL_GPHOTO_DEVEL);
return (GP_ERROR);
}
}
/* Success! We don't need the first two bytes any more. */
*ret_len -= 2;
if (*ret_len > 0)
memmove (ret_data, ret_data + 2, *ret_len);
return (GP_OK);
return (GP_OK);
}
int

View File

@@ -99,7 +99,7 @@ int ricoh_get_cam_mem (Camera *camera, GPContext *context, int *mem);
int ricoh_get_cam_amem (Camera *camera, GPContext *context, int *mem);
int ricoh_get_copyright (Camera *camera, GPContext *context,
const char **copyright);
const char **copyright);
int ricoh_set_copyright (Camera *camera, GPContext *context,
const char *copyright);

View File

@@ -177,18 +177,18 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
CHECK_RESULT (SDSC_send (camera->port, SDSC_NEXT));
CHECK_RESULT (SDSC_send (camera->port, SDSC_START));
CHECK_RESULT (SDSC_receive (camera->port, buffer, SDSC_INFOSIZE));
if (!strcmp((char*)buffer,filename))
break;
if (!strcmp((char*)buffer, filename))
break;
if (is_null(buffer)) { /* skipped to the end of the camera? */
/* Since we start at a random position, we wrap around. */
continue;
}
/* Since we start at a random position, we wrap around. */
continue;
}
/* We are at the first item again, so break. */
if (havefirst && !strcmp((char*)first,(char*)buffer))
if (havefirst && !strcmp((char*)first, (char*)buffer))
return GP_ERROR_BAD_PARAMETERS;
if (!havefirst) {
havefirst = 1;
strcpy((char*)first,(char*)buffer);
strcpy((char*)first, (char*)buffer);
}
}
/* The buffer header has
@@ -214,9 +214,9 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
return result;
gp_file_append(file,(char *)buffer,SDSC_BLOCKSIZE);
curread += SDSC_BLOCKSIZE;
gp_context_progress_update(context, pid, curread);
gp_context_progress_update(context, pid, curread);
if (gp_context_cancel(context) == GP_CONTEXT_FEEDBACK_CANCEL)
return GP_ERROR_CANCEL;
return GP_ERROR_CANCEL;
CHECK_RESULT (SDSC_send (camera->port, SDSC_BINARY));
}
gp_context_progress_stop(context, pid);
@@ -289,7 +289,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
strcpy(info->file.type,GP_MIME_JPEG);
sscanf((char *)buffer+12,"%lld",(long long int *)&info->file.size);
return GP_OK;
}
}
/* We are at the first item again */
if (havefirst && !strcmp((char*)first,(char*)buffer))
break;
@@ -312,8 +312,8 @@ camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
/* First, set up all the function pointers */
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->about = camera_about;
/* Now, tell the filesystem where to get lists and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);

View File

@@ -459,26 +459,25 @@ sierra_write_packet (Camera *camera, char *packet, GPContext *context)
static int
sierra_clear_usb_halt(Camera *camera)
{
if ( (camera->port->type == GP_PORT_USB) &&
!(camera->pl->flags & SIERRA_WRAP_USB_MASK) &&
!(camera->pl->flags & SIERRA_NO_USB_CLEAR) )
if ((camera->port->type == GP_PORT_USB) &&
!(camera->pl->flags & SIERRA_WRAP_USB_MASK) &&
!(camera->pl->flags & SIERRA_NO_USB_CLEAR))
gp_port_usb_clear_halt(camera->port, GP_PORT_USB_ENDPOINT_IN);
return (GP_OK);
return (GP_OK);
}
static int
sierra_write_nak (Camera *camera, GPContext *context)
{
char buf[4096];
int ret;
char buf[4096];
int ret;
GP_DEBUG ("* sierra_write_nack");
GP_DEBUG ("* sierra_write_nack");
buf[0] = SIERRA_PACKET_NAK;
ret = sierra_write_packet (camera, buf, context);
buf[0] = SIERRA_PACKET_NAK;
ret = sierra_write_packet (camera, buf, context);
sierra_clear_usb_halt(camera);
return (ret);
return (ret);
}
/**
@@ -798,10 +797,10 @@ sierra_transmit_ack (Camera *camera, char *packet, GPContext *context)
}
/*
* The camera has ended this session and
* reverted the speed back to 19200. Reinitialize
* The camera has ended this session and
* reverted the speed back to 19200. Reinitialize
* the connection.
*/
*/
CHECK (sierra_init (camera, context));
CHECK (sierra_set_speed (camera, SIERRA_SPEED_19200,
context));
@@ -931,15 +930,15 @@ sierra_init (Camera *camera, GPContext *context)
}
static struct {
SierraSpeed speed;
int bit_rate;
SierraSpeed speed;
int bit_rate;
} SierraSpeeds[] = {
{SIERRA_SPEED_9600 , 9600},
{SIERRA_SPEED_19200 , 19200},
{SIERRA_SPEED_38400 , 38400},
{SIERRA_SPEED_57600 , 57600},
{SIERRA_SPEED_115200, 115200},
{0, 0}
{SIERRA_SPEED_9600 , 9600},
{SIERRA_SPEED_19200 , 19200},
{SIERRA_SPEED_38400 , 38400},
{SIERRA_SPEED_57600 , 57600},
{SIERRA_SPEED_115200, 115200},
{0, 0}
};
int
@@ -1204,7 +1203,7 @@ sierra_set_string_register (Camera *camera, int reg, const char *s,
}
int sierra_get_string_register (Camera *camera, int reg, int fnumber,
CameraFile *file, unsigned char *b,
CameraFile *file, unsigned char *b,
unsigned int *b_len, GPContext *context)
{
unsigned char p[34816];

View File

@@ -137,7 +137,7 @@ camera_cam_desc_get_widget (Camera *camera, CameraRegisterType *reg_p,
return (GP_ERROR);
}
GP_DEBUG ("... '%s'.", gp_result_as_string (ret));
if (ret < 0) {
if (ret < 0) {
return (ret);
}
@@ -170,7 +170,7 @@ camera_cam_desc_get_widget (Camera *camera, CameraRegisterType *reg_p,
if (((reg_desc_p->reg_widget_type == GP_WIDGET_RADIO) ||
(reg_desc_p->reg_widget_type == GP_WIDGET_MENU)) &&
!gp_widget_changed (child)) {
gp_widget_set_changed (child, FALSE);
gp_widget_set_changed (child, FALSE);
sprintf (buff, _("%lld (unknown)"), (long long)reg_p->reg_value);
gp_widget_add_choice (child, buff);
gp_widget_set_value (child, buff);
@@ -366,10 +366,9 @@ camera_cam_desc_set_widget (Camera *camera, CameraRegisterType *reg_p,
if ((gp_widget_get_child_by_label (window,
_(reg_desc_p->regs_long_name), &child) >= 0) &&
gp_widget_changed (child)) {
gp_widget_set_changed (child, FALSE);
gp_widget_set_changed (child, FALSE);
gp_widget_get_value (child, &value_in);
for (vind = 0; vind < reg_desc_p->reg_val_name_cnt;
vind++) {
for (vind = 0; vind < reg_desc_p->reg_val_name_cnt; vind++) {
ret = camera_cam_desc_set_value (camera, reg_p,
reg_desc_p,
&reg_desc_p->regs_value_names[vind],
@@ -422,8 +421,8 @@ camera_set_config_cam_desc (Camera *camera, CameraWidget *window,
GP_DEBUG ("%s registers", cam_desc->regset[wind].window_name);
for (rind = 0; rind < cam_desc->regset[wind].reg_cnt; rind++) {
camera_cam_desc_set_widget (camera,
&cam_desc->regset[wind].regs[rind], window,
context);
&cam_desc->regset[wind].regs[rind], window,
context);
}
}
return (GP_OK);

File diff suppressed because it is too large Load Diff

View File

@@ -738,18 +738,18 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
unsigned char *xdata, *ydata;
if (strcmp(folder,"/"))
return GP_ERROR_BAD_PARAMETERS;
image_no = gp_filesystem_number(fs, folder, filename, context);
if (strcmp(folder, "/"))
return GP_ERROR_BAD_PARAMETERS;
image_no = gp_filesystem_number(fs, folder, filename, context);
/* size */
/* size */
do {
gp_port_usb_msg_read (camera->port, 1, image_no , 1, reply, 8);
} while(reply[0]!=0);
picsize = reply[1] | (reply[2] << 8) | ( reply[3] << 16);
/* Setup bulk transfer */
do {
do {
gp_port_usb_msg_read (camera->port, 2, image_no , 0, reply, 6);
} while(reply[0]!=0);

View File

@@ -45,19 +45,17 @@
#define BLINK2_GET_FIRMWARE_ID 0x18
static int
blink2_getnumpics(
GPPort *port, GPContext *context, unsigned int *numpics
) {
unsigned char buf[2];
int ret;
blink2_getnumpics (GPPort *port, GPContext *context, unsigned int *numpics) {
unsigned char buf[2];
int ret;
ret = gp_port_usb_msg_read(port, BLINK2_GET_NUMPICS, 0x03, 0, (char*)buf, 2);
if (ret < GP_OK)
return ret;
gp_log(GP_LOG_DEBUG, "blink2","ret is %d", ret);
if (ret < 2) return GP_ERROR_IO_READ;
*numpics = (buf[0]<<8) | buf[1];
return GP_OK;
ret = gp_port_usb_msg_read(port, BLINK2_GET_NUMPICS, 0x03, 0, (char*)buf, 2);
if (ret < GP_OK)
return ret;
gp_log(GP_LOG_DEBUG, "blink2", "ret is %d", ret);
if (ret < 2) return GP_ERROR_IO_READ;
*numpics = (buf[0]<<8) | buf[1];
return GP_OK;
}
#ifdef HAVE_LIBJPEG
@@ -65,17 +63,17 @@ blink2_getnumpics(
static void _jpeg_init_source(j_decompress_ptr cinfo) { }
static boolean _jpeg_fill_input_buffer(j_decompress_ptr cinfo) {
fprintf(stderr,"(), should not get here.\n");
return FALSE;
fprintf(stderr, "(), should not get here.\n");
return FALSE;
}
static void _jpeg_skip_input_data(j_decompress_ptr cinfo,long num_bytes) {
fprintf(stderr,"(%ld), should not get here.\n",num_bytes);
static void _jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
fprintf(stderr, "(%ld), should not get here.\n", num_bytes);
}
static boolean _jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired) {
fprintf(stderr,"(desired=%d), should not get here.\n",desired);
return FALSE;
fprintf(stderr, "(desired=%d), should not get here.\n", desired);
return FALSE;
}
static void _jpeg_term_source(j_decompress_ptr cinfo) { }
#endif
@@ -182,18 +180,18 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
}
free(xbuf);
image_no = gp_filesystem_number(fs, folder, filename, context);
if(image_no < 0) {
image_no = gp_filesystem_number(fs, folder, filename, context);
if(image_no < 0) {
free(addrs);
return image_no;
return image_no;
}
if (image_no < 0 || (unsigned int)image_no >= numpics) {
free(addrs);
gp_log(GP_LOG_DEBUG, "blink2","image %d requested, but only %d pics on camera?", image_no, numpics);
return GP_ERROR;
return GP_ERROR;
}
switch (type) {
case GP_FILE_TYPE_NORMAL:
switch (type) {
case GP_FILE_TYPE_NORMAL:
#ifdef HAVE_LIBJPEG
{
char *convline,*convline2,*rawline;
@@ -205,9 +203,9 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
memset( buf, 0, sizeof(buf));
if (addrs[image_no].type)
gp_file_set_mime_type (file, GP_MIME_AVI);
gp_file_set_mime_type (file, GP_MIME_AVI);
else
gp_file_set_mime_type (file, GP_MIME_JPEG);
gp_file_set_mime_type (file, GP_MIME_JPEG);
start = addrs[image_no].start;
len = addrs[image_no].len;
@@ -302,23 +300,23 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
free(convline);
free(rawline);
free(jpegdata);
gp_file_set_mime_type (file, GP_MIME_PPM);
gp_file_set_mime_type (file, GP_MIME_PPM);
jpeg_destroy_decompress(&dinfo);
break;
}
#else
/* fall through to raw mode if no libjpeg */
#endif
case GP_FILE_TYPE_RAW: {
case GP_FILE_TYPE_RAW: {
char buf2[4096];
unsigned int start, len;
unsigned int curread;
memset( buf, 0, sizeof(buf));
if (addrs[image_no].type)
gp_file_set_mime_type (file, GP_MIME_AVI);
gp_file_set_mime_type (file, GP_MIME_AVI);
else
gp_file_set_mime_type (file, GP_MIME_JPEG);
gp_file_set_mime_type (file, GP_MIME_JPEG);
start = addrs[image_no].start;
len = addrs[image_no].len;
@@ -329,7 +327,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
buf[4] = (len >> 24) & 0xff;
buf[5] = (len >> 16) & 0xff;
buf[6] = (len >> 8) & 0xff;
buf[7] = len & 0xff;
buf[7] = len & 0xff;
result = gp_port_usb_msg_write(camera->port,BLINK2_GET_MEMORY,0x03,0,(char*)buf,8);
if (result < GP_OK)
break;
@@ -349,21 +347,20 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
if (result < GP_OK)
break;
} while (len>0);
break;
}
default:
result = GP_ERROR_NOT_SUPPORTED;
break;
}
}
default:
result = GP_ERROR_NOT_SUPPORTED;
break;
}
free(addrs);
if (result < 0)
return result;
return (GP_OK);
if (result < 0)
return result;
return (GP_OK);
}
static int
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
GPContext *context)
delete_all_func (CameraFilesystem *fs, const char *folder, void *data, GPContext *context)
{
Camera *camera = data;
int ret;
@@ -373,12 +370,11 @@ delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
if (ret < GP_OK)
return ret;
if (ret < 1) return GP_ERROR_IO_READ;
return GP_OK;
return GP_OK;
}
static int
camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
GPContext *context)
camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
{
int ret;
unsigned int oldnumpics, numpics;
@@ -405,9 +401,9 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
return ret;
if (numpics == oldnumpics)
return (GP_ERROR);
strcpy (path->folder,"/");
sprintf (path->name,"image%04d.pnm",numpics-1);
return (GP_OK);
strcpy (path->folder, "/");
sprintf (path->name, "image%04d.pnm", numpics-1);
return (GP_OK);
}
@@ -459,7 +455,7 @@ camera_init (Camera *camera, GPContext *context)
int ret;
GPPortSettings settings;
camera->functions->capture = camera_capture;
camera->functions->capture = camera_capture;
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
gp_port_get_settings( camera->port, &settings);

View File

@@ -678,8 +678,8 @@ static CameraFilesystemFuncs fsfuncs = {
int
camera_init (Camera *camera, GPContext *context)
{
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
return web2_init(camera->port, context);
}

View File

@@ -61,7 +61,7 @@ static const struct smal_cameras {
{ "Fuji:Axia Eyeplate", USB_VENDOR_ID_SMAL, USB_DEVICE_ID_ULTRAPOCKET },
{ "Logitech:Pocket Digital", USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_POCKETDIGITAL },
{ "SMaL:Ultra-Pocket", USB_VENDOR_ID_SMAL, USB_DEVICE_ID_ULTRAPOCKET },
{ "Radioshack:Flatfoto", USB_VENDOR_ID_SMAL, USB_DEVICE_ID_FLATFOTO },
{ "Radioshack:Flatfoto", USB_VENDOR_ID_SMAL, USB_DEVICE_ID_FLATFOTO },
{ "Creative:CardCam", USB_VENDOR_ID_CREATIVE, USB_DEVICE_ID_CARDCAM },
{ NULL, 0, 0 }
};
@@ -69,118 +69,117 @@ static const struct smal_cameras {
int
camera_abilities (CameraAbilitiesList *list)
{
CameraAbilities a;
int i;
CameraAbilities a;
int i;
memset(&a, 0, sizeof(a));
a.status = GP_DRIVER_STATUS_EXPERIMENTAL; /* highly! */
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.operations = GP_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_DELETE;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
for (i = 0; smal_cameras[i].name; i++) {
strcpy(a.model, smal_cameras[i].name);
a.usb_vendor = smal_cameras[i].idVendor;
a.usb_product = smal_cameras[i].idProduct;
gp_abilities_list_append(list, a);
}
return (GP_OK);
memset(&a, 0, sizeof(a));
a.status = GP_DRIVER_STATUS_EXPERIMENTAL; /* highly! */
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.operations = GP_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_DELETE;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
for (i = 0; smal_cameras[i].name; i++) {
strcpy(a.model, smal_cameras[i].name);
a.usb_vendor = smal_cameras[i].idVendor;
a.usb_product = smal_cameras[i].idProduct;
gp_abilities_list_append(list, a);
}
return (GP_OK);
}
static int
camera_exit (Camera *camera, GPContext *context)
{
if (camera->pl) {
free(camera->pl);
camera->pl = NULL;
}
return ultrapocket_exit(camera->port, context);
if (camera->pl) {
free(camera->pl);
camera->pl = NULL;
}
return ultrapocket_exit(camera->port, context);
}
static int
get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
CameraFileType type, CameraFile *file, void *user_data,
GPContext *context)
CameraFileType type, CameraFile *file, void *user_data,
GPContext *context)
{
Camera *camera = user_data;
int size,image_no,result;
unsigned char *data;
Camera *camera = user_data;
int size, image_no, result;
unsigned char *data;
image_no = gp_filesystem_number(fs, folder, filename, context);
if (image_no < GP_OK)
return image_no;
image_no = gp_filesystem_number(fs, folder, filename, context);
if (image_no < GP_OK)
return image_no;
switch (type) {
case GP_FILE_TYPE_NORMAL:
result = ultrapocket_getpicture(camera,context,&data,&size,filename);
gp_file_set_mime_type (file, GP_MIME_PPM);
break;
case GP_FILE_TYPE_RAW:
result = ultrapocket_getrawpicture(camera, context,
&data, &size, filename);
gp_file_set_mime_type (file, GP_MIME_PPM);
break;
case GP_FILE_TYPE_PREVIEW:
default:
return (GP_ERROR_NOT_SUPPORTED);
}
if (result < 0)
return result;
switch (type) {
case GP_FILE_TYPE_NORMAL:
result = ultrapocket_getpicture(camera, context, &data, &size, filename);
gp_file_set_mime_type (file, GP_MIME_PPM);
break;
case GP_FILE_TYPE_RAW:
result = ultrapocket_getrawpicture(camera, context,
&data, &size, filename);
gp_file_set_mime_type (file, GP_MIME_PPM);
break;
case GP_FILE_TYPE_PREVIEW:
default:
return (GP_ERROR_NOT_SUPPORTED);
}
if (result < 0)
return result;
CHECK_RESULT(gp_file_set_data_and_size (file, (char *)data, size));
CHECK_RESULT(gp_file_set_data_and_size (file, (char *)data, size));
return (GP_OK);
return (GP_OK);
}
static int
delete_file_func (CameraFilesystem *fs, const char *folder,
const char *filename, void *data, GPContext *context)
{
Camera *camera = data;
int image_no;
Camera *camera = data;
int image_no;
image_no = gp_filesystem_number(fs, folder, filename, context);
if (image_no < GP_OK)
return image_no;
image_no = gp_filesystem_number(fs, folder, filename, context);
if (image_no < GP_OK)
return image_no;
CHECK_RESULT(ultrapocket_deletefile(camera, filename));
CHECK_RESULT(ultrapocket_deletefile(camera, filename));
return (GP_OK);
return (GP_OK);
}
static int
delete_all_func (CameraFilesystem *fs, const char* folder, void *data,
GPContext *context)
delete_all_func (CameraFilesystem *fs, const char* folder, void *data, GPContext *context)
{
Camera *camera = data;
if (strcmp (folder, "/"))
return (GP_ERROR_DIRECTORY_NOT_FOUND);
return ultrapocket_deleteall(camera);
Camera *camera = data;
if (strcmp (folder, "/"))
return (GP_ERROR_DIRECTORY_NOT_FOUND);
return ultrapocket_deleteall(camera);
}
static int
camera_about (Camera *camera, CameraText *about, GPContext *context)
{
strcpy (about->text, _("Smal Ultrapocket\n"
strcpy (about->text, _("Smal Ultrapocket\n"
"Lee Benfield <lee@benf.org>\n"
"Driver for accessing the Smal Ultrapocket camera, and OEM versions (slimshot)"));
return (GP_OK);
return (GP_OK);
}
static int
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
void *data, GPContext *context)
{
Camera *camera = data;
int count, result;
Camera *camera = data;
int count, result;
result = ultrapocket_getpicsoverview(camera, context, &count, list);
if (result != GP_OK)
return result;
result = ultrapocket_getpicsoverview(camera, context, &count, list);
if (result != GP_OK)
return result;
return (GP_OK);
return (GP_OK);
}
static CameraFilesystemFuncs fsfuncs = {
@@ -193,55 +192,55 @@ static CameraFilesystemFuncs fsfuncs = {
int
camera_init (Camera *camera, GPContext *context)
{
CameraAbilities cab;
up_badge_type badge;
CameraAbilities cab;
up_badge_type badge;
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
badge = BADGE_UNKNOWN;
gp_camera_get_abilities(camera, &cab);
switch (cab.usb_vendor) {
case USB_VENDOR_ID_SMAL:
case USB_VENDOR_ID_CREATIVE:
switch (cab.usb_product) {
case USB_DEVICE_ID_ULTRAPOCKET:
/* could be an axia eyeplate or a slimshot
* figure it out later, when we get the image
* catalogue.
*/
badge = BADGE_GENERIC;
break;
case USB_DEVICE_ID_FLATFOTO:
badge = BADGE_FLATFOTO;
break;
case USB_DEVICE_ID_CARDCAM:
badge = BADGE_CARDCAM;
break;
default:
break;
camera->functions->exit = camera_exit;
camera->functions->about = camera_about;
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
badge = BADGE_UNKNOWN;
gp_camera_get_abilities(camera, &cab);
switch (cab.usb_vendor) {
case USB_VENDOR_ID_SMAL:
case USB_VENDOR_ID_CREATIVE:
switch (cab.usb_product) {
case USB_DEVICE_ID_ULTRAPOCKET:
/* could be an axia eyeplate or a slimshot
* figure it out later, when we get the image
* catalogue.
*/
badge = BADGE_GENERIC;
break;
case USB_DEVICE_ID_FLATFOTO:
badge = BADGE_FLATFOTO;
break;
case USB_DEVICE_ID_CARDCAM:
badge = BADGE_CARDCAM;
break;
default:
break;
}
break;
case USB_VENDOR_ID_LOGITECH:
switch (cab.usb_product) {
case USB_DEVICE_ID_POCKETDIGITAL:
badge = BADGE_LOGITECH_PD;
break;
default:
break;
}
break;
default:
break;
}
break;
case USB_VENDOR_ID_LOGITECH:
switch (cab.usb_product) {
case USB_DEVICE_ID_POCKETDIGITAL:
badge = BADGE_LOGITECH_PD;
break;
default:
break;
if (badge == BADGE_UNKNOWN) {
/* can't happen. Otherwise, how'd we get to camera_init, neh? */
return GP_ERROR;
}
break;
default:
break;
}
if (badge == BADGE_UNKNOWN) {
/* can't happen. Otherwise, how'd we get to camera_init, neh? */
return GP_ERROR;
}
camera->pl = malloc (sizeof (CameraPrivateLibrary));
camera->pl->up_type = badge;
/* don't need to do any exciting init stuff until we get pic numbers */
return GP_OK;
camera->pl = malloc (sizeof (CameraPrivateLibrary));
camera->pl->up_type = badge;
/* don't need to do any exciting init stuff until we get pic numbers */
return GP_OK;
}

View File

@@ -160,7 +160,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;
char name[16];
int(avitype);
@@ -366,25 +366,25 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
sonix_decode (frame_data,
data+offset+CAM_OFFSET, w, h);
sonix_cols_reverse(frame_data, w, h);
gp_ahd_decode(frame_data, w, h, ptr+
SAKAR_AVI_FRAME_HEADER_LENGTH,
BAYER_TILE_GBRG);
gp_ahd_decode(frame_data, w, h, ptr+
SAKAR_AVI_FRAME_HEADER_LENGTH,
BAYER_TILE_GBRG);
break;
case DECOMP:
sonix_decode (frame_data,
data+offset+CAM_OFFSET, w, h);
data+offset+CAM_OFFSET, w, h);
sonix_rows_reverse(frame_data, w, h);
gp_ahd_decode(frame_data, w, h, ptr+
SAKAR_AVI_FRAME_HEADER_LENGTH,
BAYER_TILE_GRBG);
gp_ahd_decode(frame_data, w, h, ptr+
SAKAR_AVI_FRAME_HEADER_LENGTH,
BAYER_TILE_GRBG);
break;
default:
memcpy(frame_data, data + offset
+CAM_OFFSET, frame_size);
+CAM_OFFSET, frame_size);
sonix_rows_reverse(frame_data, w, h);
gp_ahd_decode(frame_data, w, h, ptr+
SAKAR_AVI_FRAME_HEADER_LENGTH,
BAYER_TILE_GRBG);
gp_ahd_decode(frame_data, w, h, ptr+
SAKAR_AVI_FRAME_HEADER_LENGTH,
BAYER_TILE_GRBG);
}
white_balance(ptr+SAKAR_AVI_FRAME_HEADER_LENGTH,
w * h, 1.2);
@@ -431,15 +431,15 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
if (camera->pl->post&REVERSE) {
sonix_decode (p_data, data+CAM_OFFSET, w, h);
sonix_byte_reverse(p_data, w*h);
gp_ahd_decode(p_data, w, h, ptr, BAYER_TILE_BGGR);
gp_ahd_decode(p_data, w, h, ptr, BAYER_TILE_BGGR);
break;
case DECOMP:
sonix_decode (p_data, data+CAM_OFFSET, w, h);
gp_ahd_decode(p_data, w, h, ptr, BAYER_TILE_RGGB);
gp_ahd_decode(p_data, w, h, ptr, BAYER_TILE_RGGB);
break;
default:
memcpy (p_data, data+CAM_OFFSET, w*h);
gp_ahd_decode(p_data, w, h, ptr, BAYER_TILE_RGGB);
gp_ahd_decode(p_data, w, h, ptr, BAYER_TILE_RGGB);
}
free (p_data);
white_balance(ptr, w * h, 1.2);
@@ -458,7 +458,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
free(data);
return GP_ERROR_NOT_SUPPORTED;
}
return GP_OK;
return GP_OK;
}
static int
@@ -567,8 +567,8 @@ camera_init(Camera *camera, GPContext *context)
GP_DEBUG("product number is 0x%x\n", abilities.usb_product);
/* First, set up all the function pointers */
camera->functions->capture = camera_capture;
camera->functions->manual = camera_manual;
camera->functions->capture = camera_capture;
camera->functions->manual = camera_manual;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->exit = camera_exit;

View File

@@ -515,8 +515,8 @@ white_balance (unsigned char *data, unsigned int size, float saturation)
x += htable_g[r];
x += htable_b[r];
}
gamma = sqrt((double) (x ) / (double) (size * 2));
GP_DEBUG("Provisional gamma correction = %1.2f\n", gamma);
gamma = sqrt((double) (x ) / (double) (size * 2));
GP_DEBUG("Provisional gamma correction = %1.2f\n", gamma);
if(gamma < .1) {
new_gamma = .50;
@@ -526,8 +526,8 @@ white_balance (unsigned char *data, unsigned int size, float saturation)
new_gamma = 0.60;
else
new_gamma = gamma;
if (new_gamma > 1.2) new_gamma = 1.2;
GP_DEBUG("Gamma correction = %1.2f\n", new_gamma);
if (new_gamma > 1.2) new_gamma = 1.2;
GP_DEBUG("Gamma correction = %1.2f\n", new_gamma);
gp_gamma_fill_table(gtable, new_gamma);
gp_gamma_correct_single(gtable,data,size);

View File

@@ -202,7 +202,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
case GP_FILE_TYPE_NORMAL:
if (file_type == SONY_FILE_MPEG) {
rc = sony_mpeg_get(camera, num, file, context);
}
}
else {
rc = sony_image_get(camera, num, file, context);
}

View File

@@ -308,7 +308,7 @@ sony_packet_write(Camera * camera, Packet * p)
GP_DEBUG(
"sony_packet_write()");
/**
/**
* This usleep is necessary when using (relatively) fast CPUs,
* as P4 2Ghz. Without it gphoto2 stops with a segmentation fault
* and the --debug message sony_packet_validate: invalid sequence

View File

@@ -20,11 +20,9 @@
#define CAMLIBS_SOUNDVISION_COMMANDS_H
int32_t soundvision_send_command(uint32_t command, uint32_t argument,
CameraPrivateLibrary *dev);
int32_t soundvision_send_command(uint32_t command, uint32_t argument, CameraPrivateLibrary *dev);
int32_t soundvision_send_file_command(const char *filename,
CameraPrivateLibrary *dev);
int32_t soundvision_send_file_command(const char *filename, CameraPrivateLibrary *dev);
int32_t soundvision_read(CameraPrivateLibrary *dev, void *buffer, int len);

View File

@@ -57,16 +57,15 @@
struct _CameraPrivateLibrary {
GPPort *gpdev;
int device_type;
int reset_times,odd_command;
int device_type;
int reset_times, odd_command;
int num_pictures;
char *file_list;
};
/* commands.c */
int32_t soundvision_send_command(uint32_t command, uint32_t argument,
CameraPrivateLibrary *dev);
int32_t soundvision_send_command(uint32_t command, uint32_t argument, CameraPrivateLibrary *dev);
int soundvision_reset(CameraPrivateLibrary *dev, char *revision, char *status);
int soundvision_get_revision(CameraPrivateLibrary *dev,char *revision);
@@ -93,10 +92,10 @@ int agfa_capture(CameraPrivateLibrary *dev, CameraFilePath *path);
int agfa_delete_picture(CameraPrivateLibrary *dev, const char *filename);
int agfa_get_file_list(CameraPrivateLibrary *dev);
int agfa_get_pic(CameraPrivateLibrary *dev, const char *filename,
unsigned char *data,int size);
unsigned char *data,int size);
int agfa_get_pic_size(CameraPrivateLibrary *dev, const char *filename);
int agfa_get_thumb(CameraPrivateLibrary *dev, const char *filename,
unsigned char *data,int size);
unsigned char *data,int size);
int agfa_get_thumb_size(CameraPrivateLibrary *dev, const char *filename);
@@ -113,10 +112,10 @@ int tiger_capture(CameraPrivateLibrary *dev, CameraFilePath *path);
int tiger_get_mem(CameraPrivateLibrary *dev, int *num_pics, int *mem_total, int *mem_free);
int tiger_get_file_list(CameraPrivateLibrary *dev);
int tiger_get_pic(CameraPrivateLibrary *dev, const char *filename,
unsigned char *data,int size);
unsigned char *data,int size);
int tiger_get_pic_size(CameraPrivateLibrary *dev, const char *filename);
int tiger_get_thumb(CameraPrivateLibrary *dev, const char *filename,
unsigned char *data,int size);
unsigned char *data,int size);
int tiger_get_thumb_size(CameraPrivateLibrary *dev, const char *filename);
#endif /* !defined(CAMLIBS_SOUNDVISION_SOUNDVISION_H) */

View File

@@ -105,14 +105,14 @@ models[] =
{"Aiptek:Smart Megacam", 0x04fc, 0x504b,
BRIDGE_SPCA504, 0 },
{"Benq:DC1300", 0x04a5, 0x3003,
BRIDGE_SPCA504, 0 },
BRIDGE_SPCA504, 0 },
/* Some other 500a cams with flash */
{"Trust:Familycam 300", 0x084d, 0x0003,
BRIDGE_SPCA500, SPCA50X_FLASH},
{"D-Link:DSC 350+", 0x084d, 0x0003,
BRIDGE_SPCA500, SPCA50X_FLASH},
{"Minton:S-Cam F5", 0x084d, 0x0003,
BRIDGE_SPCA500, SPCA50X_FLASH},
{"Minton:S-Cam F5", 0x084d, 0x0003,
BRIDGE_SPCA500, SPCA50X_FLASH},
{"PureDigital:Ritz Disposable", 0x04fc, 0xffff,
BRIDGE_SPCA504B_PD, SPCA50X_FLASH},
{NULL, 0, 0, 0, 0}
@@ -141,7 +141,7 @@ camera_abilities (CameraAbilitiesList *list)
a.status = GP_DRIVER_STATUS_TESTING;
a.file_operations = GP_FILE_OPERATION_PREVIEW
| GP_FILE_OPERATION_DELETE;
| GP_FILE_OPERATION_DELETE;
a.folder_operations = GP_FOLDER_OPERATION_DELETE_ALL;
@@ -155,8 +155,8 @@ camera_abilities (CameraAbilitiesList *list)
a.operations = GP_OPERATION_CAPTURE_IMAGE;
}
if (models[x].bridge == BRIDGE_SPCA504B_PD) {
a.operations = GP_OPERATION_CAPTURE_IMAGE;
}
a.operations = GP_OPERATION_CAPTURE_IMAGE;
}
if (models[x].bridge == BRIDGE_SPCA500) {
/* TEST enable capture for the DSC-350 style cams */
if (a.usb_vendor == 0x084d) {

View File

@@ -345,7 +345,7 @@ spca50x_flash_get_file_name (CameraPrivateLibrary *pl, int index, char *name)
memset (p, 0, sizeof(p));
/* dsc350 - get the file info, so we can set the file type
correctly */
correctly */
spca500_flash_84D_get_file_info (pl, index, &w, &h, &type, &size);
if (type < 3){ /* for single images */
snprintf (p, sizeof(p), "Img%03d.jpg", (index + 1));

View File

@@ -50,8 +50,8 @@ static int spca50x_mode_set_download (CameraPrivateLibrary * lib);
static int spca50x_download_data (CameraPrivateLibrary * lib, uint32_t start,
unsigned int size, uint8_t * buf);
static int spca50x_get_FATs (CameraPrivateLibrary * lib, int dramtype);
static int spca50x_sdram_get_file_count_and_fat_count
(CameraPrivateLibrary * lib, int dramtype);
static int spca50x_sdram_get_file_count_and_fat_count (
CameraPrivateLibrary * lib, int dramtype);
static int spca50x_get_avi_thumbnail (CameraPrivateLibrary * lib,
uint8_t ** buf, unsigned int *len,
struct SPCA50xFile *g_file);
@@ -67,7 +67,7 @@ static inline uint8_t *put_dword (uint8_t * ptr, uint32_t value);
static int
spca50x_sdram_get_fat_page (CameraPrivateLibrary * lib, int index,
int dramtype, uint8_t *p)
int dramtype, uint8_t *p)
{
switch (dramtype) {
case 4: /* 128 Mbit */
@@ -92,7 +92,7 @@ spca50x_sdram_get_fat_page (CameraPrivateLibrary * lib, int index,
static int
spca50x_sdram_get_file_count_and_fat_count (CameraPrivateLibrary * lib,
int dramtype)
int dramtype)
{
uint8_t theFat[256];
@@ -128,7 +128,7 @@ spca50x_sdram_get_file_count_and_fat_count (CameraPrivateLibrary * lib,
} else {
while (1) {
CHECK (spca50x_sdram_get_fat_page (lib, lib->num_fats,
dramtype, theFat));
dramtype, theFat));
if (theFat[0] == 0xFF)
break;

View File

@@ -180,7 +180,7 @@ spca50x_capture (CameraPrivateLibrary * lib)
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
sleep (2);
#endif
CHECK (gp_port_usb_msg_write
CHECK (gp_port_usb_msg_write
(lib->gpdev, 0x06, 0x0000, 0x0003, NULL, 0));
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
sleep (3);

View File

@@ -73,9 +73,9 @@ static const struct {
{"Precision Mini Digital Camera",
GP_DRIVER_STATUS_PRODUCTION , 0x2770 , 0x9120},
{"iConcepts digital camera" ,
GP_DRIVER_STATUS_PRODUCTION , 0x2770 , 0x9120},
{"Sakar Kidz Cam 86379", GP_DRIVER_STATUS_EXPERIMENTAL, 0x2770,
0x9120},
GP_DRIVER_STATUS_PRODUCTION , 0x2770 , 0x9120},
{"Sakar Kidz Cam 86379",
GP_DRIVER_STATUS_EXPERIMENTAL, 0x2770, 0x9120},
{"ViviCam3350", GP_DRIVER_STATUS_EXPERIMENTAL, 0x2770, 0x9120},
{"ViviCam5B", GP_DRIVER_STATUS_EXPERIMENTAL, 0x2770, 0x9120},
{"DC-N130ta", GP_DRIVER_STATUS_EXPERIMENTAL, 0x2770, 0x9120},
@@ -140,8 +140,8 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
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,
_(
@@ -184,7 +184,7 @@ camera_about (Camera *camera, CameraText *about, GPContext *context)
static int
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
void *data, GPContext *context)
void *data, GPContext *context)
{
Camera *camera = data;
int i,n;
@@ -212,7 +212,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
static int
folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
void *data, GPContext *context)
void *data, GPContext *context)
{
Camera *camera = data;
int i,n;
@@ -229,7 +229,7 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
static int
get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
CameraFileInfo *info, void *data, GPContext *context)
CameraFileInfo *info, void *data, GPContext *context)
{
memset (info, 0, sizeof(CameraFileInfo));
/* FIXME: fill in some stuff? */
@@ -413,7 +413,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
memcpy (rawdata, frame_data, size);
memcpy (rawdata+size,camera->pl->catalog+16*entry,16);
gp_file_set_mime_type (file, GP_MIME_RAW);
gp_file_set_data_and_size (file, (char *)rawdata, size+16);
gp_file_set_data_and_size (file, (char *)rawdata, size+16);
}
/* Reset camera when done, for more graceful exit. */
if ((!(is_in_clip)&&(entry +1 == camera->pl->nb_entries))
@@ -424,8 +424,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
}
static int
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
GPContext *context)
delete_all_func (CameraFilesystem *fs, const char *folder, void *data, GPContext *context)
{
Camera *camera = data;
@@ -452,7 +451,7 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
return GP_ERROR_NO_MEMORY;
}
sq_access_reg(camera->port, CAPTURE);
sq_access_reg(camera->port, CAPTURE);
sq_read_picture_data (camera->port, camera->pl->last_fetched_data, b);
frame_data = camera->pl->last_fetched_data + 0x40;
sq_preprocess(camera->pl->model, 1, 0, frame_data, w, h);
@@ -490,7 +489,7 @@ camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
gp_file_set_data_and_size (file, (char *)ppm, size);
sq_reset(camera->port);
sq_access_reg(camera->port, CAPTURE);
sq_access_reg(camera->port, CAPTURE);
sq_reset(camera->port);
return (GP_OK);

View File

@@ -44,7 +44,7 @@
static int
decode_panel (unsigned char *panel_out, unsigned char *panel,
int panelwidth, int height, int color);
int panelwidth, int height, int color);
int
sq_decompress (SQModel model, unsigned char *output, unsigned char *data,
@@ -107,13 +107,13 @@ sq_decompress (SQModel model, unsigned char *output, unsigned char *data,
switch(model) {
case(SQ_MODEL_MAGPIX):
case(SQ_MODEL_POCK_CAM):
for (i = 0; i < h; i++) {
for (m = 0 ; m < w/2; m++) {
temp = output[w*i +m];
output[w*i + m] = output[w*i + w -1 -m];
output[w*i + w - 1 - m] = temp;
}
}
for (i = 0; i < h; i++) {
for (m = 0; m < w/2; m++) {
temp = output[w*i +m];
output[w*i + m] = output[w*i + w -1 -m];
output[w*i + w - 1 - m] = temp;
}
}
break;
default: ; /* default is "do nothing" */
}
@@ -163,7 +163,7 @@ int decode_panel (unsigned char *panel_out, unsigned char *panel,
tempval = (temp_line[2*i]) + diff;
else
tempval = (temp_line[2*i]
+ panel_out[m*panelwidth+2*i-1])/2 + diff;
+ panel_out[m*panelwidth+2*i-1])/2 + diff;
tempval = MIN(tempval, 0xff);
tempval = MAX(tempval, 0);
panel_out[m*panelwidth+2*i] = tempval;
@@ -193,7 +193,7 @@ int decode_panel (unsigned char *panel_out, unsigned char *panel,
tempval = (temp_line[0]+temp_line[1])/2 + diff;
else
tempval = (temp_line[2*i+1]
+ panel_out[2*m*panelwidth+2*i-1])/2 + diff;
+ panel_out[2*m*panelwidth+2*i-1])/2 + diff;
tempval = MIN(tempval, 0xff);
tempval = MAX(tempval, 0);
panel_out[2*m*panelwidth+2*i] = tempval;

View File

@@ -254,25 +254,25 @@ sq_preprocess (SQModel model, int comp_ratio, unsigned char is_in_clip,
if (!is_in_clip) {
/* Turning the picture right-side up. */
for (i = 0; i < b/2; ++i) {
temp = data[i];
data[i] = data[b -1 -i];
data[b - 1 - i] = temp;
}
for (i = 0; i < b/2; ++i) {
temp = data[i];
data[i] = data[b -1 -i];
data[b - 1 - i] = temp;
}
/* But clip frames are already right-side-up */
}
}
/*
* POCK_CAM needs de-mirror-imaging, too. But if a photo is
* compressed we de-mirror after decompression, so not here.
*/
if ((model == SQ_MODEL_POCK_CAM) && (comp_ratio == 1)) {
for (i = 0; i < h; i++) {
for (m = 0 ; m < w/2; m++) {
temp = data[w*i +m];
for (i = 0; i < h; i++) {
for (m = 0; m < w/2; m++) {
temp = data[w*i +m];
data[w*i + m] = data[w*i + w -1 -m];
data[w*i + w - 1 - m] = temp;
}
}
}
}
return GP_OK;
}

View File

@@ -830,9 +830,9 @@ st2205_init(Camera *camera)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, }
};
const int uncompressed_firmware_checksums[] = {
0x00ab02fc, /* Frame 96x64 from blokker (Netherlands) */
0x00aa8060, /* Blokker frame with picframe hacked firmware */
0 };
0x00ab02fc, /* Frame 96x64 from blokker (Netherlands) */
0x00aa8060, /* Blokker frame with picframe hacked firmware */
0 };
GP_DEBUG ("st2205_init called");

View File

@@ -200,7 +200,7 @@ static int
delete_all_func (CameraFilesystem *fs, const char* folder, void *data,
GPContext *context)
{
Camera *camera = data;
Camera *camera = data;
if (strcmp (folder, "/"))
return (GP_ERROR_DIRECTORY_NOT_FOUND);
return stv0674_delete_all(camera->port);
@@ -214,38 +214,38 @@ static CameraFilesystemFuncs fsfuncs = {
int camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
int ret;
GPPortSettings settings;
int ret;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->capture = camera_capture;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->capture = camera_capture;
gp_port_get_settings(camera->port, &settings);
switch(camera->port->type) {
case GP_PORT_USB:
/* Modify the default settings the core parsed */
settings.usb.altsetting=1;/* we need to use interface 0 setting 1 */
settings.usb.inep=2;
settings.usb.intep=3;
settings.usb.outep=5;
gp_port_get_settings(camera->port, &settings);
switch (camera->port->type) {
case GP_PORT_USB:
/* Modify the default settings the core parsed */
settings.usb.altsetting=1;/* we need to use interface 0 setting 1 */
settings.usb.inep=2;
settings.usb.intep=3;
settings.usb.outep=5;
/* Use the defaults the core parsed */
break;
default:
return (GP_ERROR_UNKNOWN_PORT);
break;
}
/* Use the defaults the core parsed */
break;
default:
return (GP_ERROR_UNKNOWN_PORT);
break;
}
ret = gp_port_set_settings (camera->port, settings);
if (ret != GP_OK) {
gp_context_error (context, _("Could not apply USB settings"));
return ret;
}
/* Set up the filesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* test camera */
return stv0674_ping(camera->port);
ret = gp_port_set_settings (camera->port, settings);
if (ret != GP_OK) {
gp_context_error (context, _("Could not apply USB settings"));
return ret;
}
/* Set up the filesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* test camera */
return stv0674_ping(camera->port);
}

View File

@@ -38,84 +38,84 @@
#define new(ctype, ccount) calloc(ccount, sizeof(ctype))
static void
compute_luts (int sharpen_percent, int *pos_lut, int *neg_lut )
compute_luts (int sharpen_percent, int *pos_lut, int *neg_lut)
{
int i; /* Looping var */
int fact; /* 1 - sharpness */
int i; /* Looping var */
int fact; /* 1 - sharpness */
fact = 100 - sharpen_percent;
if (fact < 1)
fact = 1;
fact = 100 - sharpen_percent;
if (fact < 1)
fact = 1;
for (i = 0; i < 256; i ++)
{
pos_lut[i] = (800 * i) / fact;
neg_lut[i] = (4 + pos_lut[i] - (i << 3)) >> 3;
};
for (i = 0; i < 256; i++)
{
pos_lut[i] = (800 * i) / fact;
neg_lut[i] = (4 + pos_lut[i] - (i << 3)) >> 3;
};
}
/** 'rgb_filter()' - Sharpen RGB pixels. **/
static void rgb_filter (int width, /* I - Width of line in pixels */
int *pos_lut,
int *neg_lut,
unsigned char *src, /* I - Source line */
unsigned char *dst, /* O - Destination line */
long int *neg0, /* I - Top negative coefficient line */
long int *neg1, /* I - Middle negative coefficient line */
long int *neg2) /* I - Bottom negative coefficient line */
int *pos_lut,
int *neg_lut,
unsigned char *src, /* I - Source line */
unsigned char *dst, /* O - Destination line */
long int *neg0, /* I - Top negative coefficient line */
long int *neg1, /* I - Middle negative coefficient line */
long int *neg2) /* I - Bottom negative coefficient line */
{
long int pixel; /* New pixel value */
long int pixel; /* New pixel value */
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
width -= 2;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
width -= 2;
while (width > 0)
{
pixel = (pos_lut[*src++] - neg0[-3] - neg0[0] - neg0[3] -
neg1[-3] - neg1[3] -
neg2[-3] - neg2[0] - neg2[3]);
pixel = (pixel + 4) >> 3;
if (pixel < 0)
*dst++ = 0;
else if (pixel < 255)
*dst++ = pixel;
else
*dst++ = 255;
while (width > 0)
{
pixel = (pos_lut[*src++] - neg0[-3] - neg0[0] - neg0[3] -
neg1[-3] - neg1[3] -
neg2[-3] - neg2[0] - neg2[3]);
pixel = (pixel + 4) >> 3;
if (pixel < 0)
*dst++ = 0;
else if (pixel < 255)
*dst++ = pixel;
else
*dst++ = 255;
pixel = (pos_lut[*src++] - neg0[-2] - neg0[1] - neg0[4] -
neg1[-2] - neg1[4] -
neg2[-2] - neg2[1] - neg2[4]);
pixel = (pixel + 4) >> 3;
if (pixel < 0)
*dst++ = 0;
else if (pixel < 255)
*dst++ = pixel;
else
*dst++ = 255;
pixel = (pos_lut[*src++] - neg0[-2] - neg0[1] - neg0[4] -
neg1[-2] - neg1[4] -
neg2[-2] - neg2[1] - neg2[4]);
pixel = (pixel + 4) >> 3;
if (pixel < 0)
*dst++ = 0;
else if (pixel < 255)
*dst++ = pixel;
else
*dst++ = 255;
pixel = (pos_lut[*src++] - neg0[-1] - neg0[2] - neg0[5] -
neg1[-1] - neg1[5] -
neg2[-1] - neg2[2] - neg2[5]);
pixel = (pixel + 4) >> 3;
if (pixel < 0)
*dst++ = 0;
else if (pixel < 255)
*dst++ = pixel;
else
*dst++ = 255;
pixel = (pos_lut[*src++] - neg0[-1] - neg0[2] - neg0[5] -
neg1[-1] - neg1[5] -
neg2[-1] - neg2[2] - neg2[5]);
pixel = (pixel + 4) >> 3;
if (pixel < 0)
*dst++ = 0;
else if (pixel < 255)
*dst++ = pixel;
else
*dst++ = 255;
neg0 += 3;
neg1 += 3;
neg2 += 3;
width --;
};
neg0 += 3;
neg1 += 3;
neg2 += 3;
width--;
};
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
}
/** 'sharpen()' - Sharpen an image using a convolution filter. **/
@@ -123,94 +123,92 @@ void sharpen(int width, int height,
unsigned char *src_region, unsigned char *dest_region,
int sharpen_percent
) {
unsigned char *src_rows[4], /* Source pixel rows */
*src_ptr, /* Current source pixel */
*dst_row; /* Destination pixel row */
long int *neg_rows[4], /* Negative coefficient rows */
unsigned char *src_rows[4], /* Source pixel rows */
*src_ptr, /* Current source pixel */
*dst_row; /* Destination pixel row */
long int *neg_rows[4], /* Negative coefficient rows */
*neg_ptr; /* Current negative coefficient */
int i, /* Looping vars */
int i, /* Looping vars */
y, /* Current location in image */
row, /* Current row in src_rows */
count, /* Current number of filled src_rows */
pitch; /* Byte width of the image */
int img_bpp=3; /* Bytes-per-pixel in image */
int neg_lut[256]; /* Negative coefficient LUT */
int pos_lut[256]; /* Positive coefficient LUT */
int img_bpp=3; /* Bytes-per-pixel in image */
int neg_lut[256]; /* Negative coefficient LUT */
int pos_lut[256]; /* Positive coefficient LUT */
compute_luts (sharpen_percent,pos_lut,neg_lut);
pitch = width * img_bpp;
compute_luts (sharpen_percent, pos_lut, neg_lut);
pitch = width * img_bpp;
for (row = 0; row < 4; row ++)
{
src_rows[row] = new (unsigned char, pitch);
neg_rows[row] = new (long int, pitch);
}
dst_row = new (unsigned char, pitch);
/** Pre-load the first row for the filter... **/
memcpy(src_rows[0], src_region, pitch);
for (i = pitch, src_ptr = src_rows[0], neg_ptr = neg_rows[0];
i > 0; i --, src_ptr ++, neg_ptr ++)
*neg_ptr = neg_lut[*src_ptr];
row = 1;
count = 1;
/** Sharpen... **/
for (y = 0; y < height; y ++)
{
/** Load the next pixel row... **/
if ((y + 1) < height)
for (row = 0; row < 4; row++)
{
/** Check to see if our src_rows[] array is overflowing yet... **/
if (count >= 3)
count --;
/** Grab the next row... **/
memcpy(src_rows[row], (src_region + pitch*(y+1)), pitch);
for (i = pitch, src_ptr = src_rows[row], neg_ptr = neg_rows[row];
i > 0; i --, src_ptr ++, neg_ptr ++)
*neg_ptr = neg_lut[*src_ptr];
count ++;
row = (row + 1) & 3;
}
else
{
/** No more pixels at the bottom... Drop the oldest samples... **/
count --;
src_rows[row] = new (unsigned char, pitch);
neg_rows[row] = new (long int, pitch);
}
/** Now sharpen pixels and save the results... **/
dst_row = new (unsigned char, pitch);
if (count == 3)
/** Pre-load the first row for the filter... **/
memcpy(src_rows[0], src_region, pitch);
for (i = pitch, src_ptr = src_rows[0], neg_ptr = neg_rows[0];
i > 0; i--, src_ptr++, neg_ptr++)
*neg_ptr = neg_lut[*src_ptr];
row = 1;
count = 1;
/** Sharpen... **/
for (y = 0; y < height; y++)
{
rgb_filter(width, pos_lut, neg_lut,
src_rows[(row + 2) & 3], dst_row,
neg_rows[(row + 1) & 3] + img_bpp,
neg_rows[(row + 2) & 3] + img_bpp,
neg_rows[(row + 3) & 3] + img_bpp);
/** Load the next pixel row... **/
if ((y + 1) < height)
{
/** Check to see if our src_rows[] array is overflowing yet... **/
if (count >= 3)
count--;
/** Set the row... **/
memcpy((dest_region + pitch*y), dst_row, pitch);
}
else if (count == 2)
/** Grab the next row... **/
memcpy(src_rows[row], (src_region + pitch*(y+1)), pitch);
for (i = pitch, src_ptr = src_rows[row], neg_ptr = neg_rows[row];
i > 0; i--, src_ptr++, neg_ptr++)
*neg_ptr = neg_lut[*src_ptr];
count++;
row = (row + 1) & 3;
} else
{
/** No more pixels at the bottom... Drop the oldest samples... **/
count--;
}
/** Now sharpen pixels and save the results... **/
if (count == 3)
{
rgb_filter(width, pos_lut, neg_lut,
src_rows[(row + 2) & 3], dst_row,
neg_rows[(row + 1) & 3] + img_bpp,
neg_rows[(row + 2) & 3] + img_bpp,
neg_rows[(row + 3) & 3] + img_bpp);
/** Set the row... **/
memcpy((dest_region + pitch*y), dst_row, pitch);
} else if (count == 2)
{
if (y == 0) /* first row */
memcpy((dest_region), src_rows[0], pitch);
else /* last row */
memcpy((dest_region + pitch*(y)), src_rows[(height-1)&3], pitch);
}
} /* for */
/** OK, we're done. Free all memory used... **/
for (row = 0; row < 4; row++)
{
if (y == 0) /* first row */
memcpy((dest_region), src_rows[0], pitch);
else /* last row */
memcpy((dest_region + pitch*(y)), src_rows[(height-1)&3], pitch);
free (src_rows[row]);
free (neg_rows[row]);
}
} /* for */
/** OK, we're done. Free all memory used... **/
for (row = 0; row < 4; row ++)
{
free (src_rows[row]);
free (neg_rows[row]);
}
free (dst_row);
free (dst_row);
}

View File

@@ -28,26 +28,26 @@
void bayer_unshuffle_preview(unsigned int w, unsigned int h, unsigned int scale, unsigned char *raw, unsigned char *output)
{
int x, y, nx, ny;
int colour; int rgb[3];
int nw = w >> scale;
int nh = h >> scale;
int incr = 1<<scale;
int x, y, nx, ny;
int colour; int rgb[3];
int nw = w >> scale;
int nh = h >> scale;
int incr = 1<<scale;
for (ny = 0; ny < nh; ++ny, raw += w<<scale) {
for (nx = 0; nx < nw; ++nx, output += 3) {
rgb[0] = 0; rgb[1] = 0; rgb[2] = 0;
for (y = 0; y < incr; ++y) {
for (x = 0; x < incr; ++x) {
colour = 1 - (x&1) + (y&1);
rgb[colour] += raw[y*w + (nx<<(scale-1))+(x>>1) + ((x&1)? 0: (w>>1))];
for (ny = 0; ny < nh; ++ny, raw += w<<scale) {
for (nx = 0; nx < nw; ++nx, output += 3) {
rgb[0] = 0; rgb[1] = 0; rgb[2] = 0;
for (y = 0; y < incr; ++y) {
for (x = 0; x < incr; ++x) {
colour = 1 - (x&1) + (y&1);
rgb[colour] += raw[y*w + (nx<<(scale-1))+(x>>1) + ((x&1) ? 0 : (w>>1))];
}
}
output[0] = rgb[0]>>(2*scale-2);
output[1] = rgb[1]>>(2*scale-1);
output[2] = rgb[2]>>(2*scale-2);
}
}
output[0] = rgb[0]>>(2*scale-2);
output[1] = rgb[1]>>(2*scale-1);
output[2] = rgb[2]>>(2*scale-2);
}
}
}
/****** gamma correction from trans[], plus hardcoded white balance */
@@ -100,100 +100,100 @@ static const rgbgamma gampar[6][3] = {
void light_enhance(unsigned int vw, unsigned int vh, unsigned int coarse, unsigned int fine,
unsigned char avg_pix, unsigned char *output)
{
unsigned long int i;
int lt=3; /* 3 is auto */
/* float wb[3][3]; */
unsigned char trans[3][256];
unsigned char col;
/* int tmp1, tmp2, tmp3, whitex=20, whitey=20, j, k; */
unsigned long int i;
int lt=3; /* 3 is auto */
/* float wb[3][3]; */
unsigned char trans[3][256];
unsigned char col;
/* int tmp1, tmp2, tmp3, whitex=20, whitey=20, j, k; */
double brightness = 1.00; /* FIXME: configurable? */
double brightness = 1.00; /* FIXME: configurable? */
/* fprintf(stderr, "(FineExp=%i CoarseExp=%i => filter=", fine, coarse); */
/* fprintf(stderr, "(FineExp=%i CoarseExp=%i => filter=", fine, coarse); */
#if 0
if (fine >= (coarse<<1)) {
lt = 0;
/* fprintf(stderr, "natural)\n"); */
} else if (((fine<<1) < coarse) && (coarse < 400)) {
lt = 2;
/* fprintf(stderr, "incandescent)\n"); */
} else {
lt = 1;
/* fprintf(stderr, "fluorescent)\n"); */
}
wb[0][0] = 1.08 * x; wb[0][1] = 1.00 * x; wb[0][2] = 0.95 * x; /* natural */
wb[1][0] = 1.00 * x; wb[1][1] = 1.00 * x; wb[1][2] = 1.00 * x; /* fluorescent */
wb[2][0] = 0.90 * x; wb[2][1] = 1.00 * x; wb[2][2] = 1.11 * x; /* incandescent */
if (fine >= (coarse<<1)) {
lt = 0;
/* fprintf(stderr, "natural)\n"); */
} else if (((fine<<1) < coarse) && (coarse < 400)) {
lt = 2;
/* fprintf(stderr, "incandescent)\n"); */
} else {
lt = 1;
/* fprintf(stderr, "fluorescent)\n"); */
}
wb[0][0] = 1.08 * x; wb[0][1] = 1.00 * x; wb[0][2] = 0.95 * x; /* natural */
wb[1][0] = 1.00 * x; wb[1][1] = 1.00 * x; wb[1][2] = 1.00 * x; /* fluorescent */
wb[2][0] = 0.90 * x; wb[2][1] = 1.00 * x; wb[2][2] = 1.11 * x; /* incandescent */
#else
if (fine > coarse) {
lt = 0; /* fprintf (stderr, "cold)\n"); */
} else if (coarse < 100) {
lt = 1; /* fprintf (stderr, "coldish)\n"); */
} else if (coarse < 200) {
lt = 2; /* fprintf (stderr, "mid)\n"); */
} else if (coarse < 400) {
lt = 3; /* fprintf (stderr, "warmish)\n"); */
} else if (avg_pix < 94) {
lt = 4; /* fprintf (stderr, "warm)\n"); */
} else {
lt = 5; /* fprintf (stderr, "warm, bright)\n"); */
}
if (fine > coarse) {
lt = 0; /* fprintf (stderr, "cold)\n"); */
} else if (coarse < 100) {
lt = 1; /* fprintf (stderr, "coldish)\n"); */
} else if (coarse < 200) {
lt = 2; /* fprintf (stderr, "mid)\n"); */
} else if (coarse < 400) {
lt = 3; /* fprintf (stderr, "warmish)\n"); */
} else if (avg_pix < 94) {
lt = 4; /* fprintf (stderr, "warm)\n"); */
} else {
lt = 5; /* fprintf (stderr, "warm, bright)\n"); */
}
#endif
#if 0
/* find white pixel */
for (j=0;j<vh;j++)
{
for (k=0; k<vw; k++)
/* find white pixel */
for (j=0;j<vh;j++)
{
i = (j*vw + k)*3;
tmp1 = abs(*(output+i) - *(output+i+1));
tmp2 = abs(*(output+i) - *(output+i+2));
tmp3 = abs(*(output+i+1) - *(output+i+2));
if ((tmp1<16) && (tmp2<16) && (tmp3<16) && (*(output+i)>=160)) {
whitex = k; whitey = j;
break;
}
for (k=0; k<vw; k++)
{
i = (j*vw + k)*3;
tmp1 = abs(*(output+i) - *(output+i+1));
tmp2 = abs(*(output+i) - *(output+i+2));
tmp3 = abs(*(output+i+1) - *(output+i+2));
if ((tmp1<16) && (tmp2<16) && (tmp3<16) && (*(output+i)>=160)) {
whitex = k; whitey = j;
break;
}
}
}
}
#endif
for (col = 0; col < 3; col++) {
double y;
const rgbgamma *gp = gampar[lt] + col;
for(i=0; i<256; ++i) {
if (i < ZERO0)
y = 0;
else if (i < ZERO1)
y = 1;
else
y = brightness * gp->ampl * (2 + pow((i-ZERO1)/((double)254-ZERO1),gp->gamma) * 253.5);
if (y > 255.0)
y = 255.0;
trans[col][i] = (unsigned char) y;
for (col = 0; col < 3; col++) {
double y;
const rgbgamma *gp = gampar[lt] + col;
for (i=0; i<256; ++i) {
if (i < ZERO0)
y = 0;
else if (i < ZERO1)
y = 1;
else
y = brightness * gp->ampl * (2 + pow((i-ZERO1)/((double)254-ZERO1), gp->gamma) * 253.5);
if (y > 255.0)
y = 255.0;
trans[col][i] = (unsigned char)y;
}
}
}
for (i=0;i<(vw*vh*3);i+=3)
{
int r,g,b;
r = *(output+i);
g = *(output+i+1);
b = *(output+i+2);
/* this (adjusting white) isn't quite right yet, so I turned it off */
if ( 0 && (abs(r-g) < 8) &&
(abs(r-b) < 8) &&
(abs(b-g) < 8)) {
int v = trans[1][(r+b+g+1)/3];
*(output+i) = (unsigned char) (v);
*(output+i+1) = (unsigned char) (v);
*(output+i+2) = (unsigned char) (v);
fprintf(stderr,"Adjusting white\n");
} else { /* this is OK */
*(output+i) = trans[0][r];
*(output+i+1) = trans[1][g];
*(output+i+2) = trans[2][b];
}
} /* for */
for (i=0;i<(vw*vh*3);i+=3)
{
int r, g, b;
r = *(output+i);
g = *(output+i+1);
b = *(output+i+2);
/* this (adjusting white) isn't quite right yet, so I turned it off */
if (0 && (abs(r-g) < 8) &&
(abs(r-b) < 8) &&
(abs(b-g) < 8)) {
int v = trans[1][(r+b+g+1)/3];
*(output+i) = (unsigned char)(v);
*(output+i+1) = (unsigned char)(v);
*(output+i+2) = (unsigned char)(v);
fprintf(stderr, "Adjusting white\n");
} else { /* this is OK */
*(output+i) = trans[0][r];
*(output+i+1) = trans[1][g];
*(output+i+2) = trans[2][b];
}
} /* for */
} /* light_enhance */

View File

@@ -41,7 +41,7 @@ static const struct camera_to_usb {
unsigned short idProduct;
int serial;
} camera_to_usb[] = {
/* http://www.vvl.co.uk/products/co-processors/680/680.htm */
/* http://www.vvl.co.uk/products/co-processors/680/680.htm */
{ "STM:USB Dual-mode camera", 0x0553, 0x0202, 1 },
{ "STV0680", 0x0553, 0x0202, 1 },
@@ -270,61 +270,59 @@ static int
delete_all_func (CameraFilesystem *fs, const char* folder, void *data,
GPContext *context)
{
Camera *camera = data;
Camera *camera = data;
if (strcmp (folder, "/"))
return (GP_ERROR_DIRECTORY_NOT_FOUND);
return stv0680_delete_all(camera->port);
}
static int
storage_info_func (CameraFilesystem *fs,
CameraStorageInformation **sinfos,
int *nrofsinfos,
void *data, GPContext *context
) {
Camera *camera = (Camera*)data;
GPPort *port = camera->port;
struct stv680_camera_info caminfo;
struct stv680_image_info imginfo;
int ret;
CameraStorageInformation *sinfo;
storage_info_func (CameraFilesystem *fs, CameraStorageInformation **sinfos,
int *nrofsinfos, void *data, GPContext *context)
{
Camera *camera = (Camera*)data;
GPPort *port = camera->port;
struct stv680_camera_info caminfo;
struct stv680_image_info imginfo;
int ret;
CameraStorageInformation *sinfo;
/* Get Camera Information */
if ((ret = stv0680_try_cmd(port, CMDID_GET_CAMERA_INFO,
0, (void*)&caminfo, sizeof(caminfo)) < 0))
return ret;
/* Get Camera Information */
if ((ret = stv0680_try_cmd(port, CMDID_GET_CAMERA_INFO,
0, (void*)&caminfo, sizeof(caminfo)) < 0))
return ret;
sinfo = malloc(sizeof(CameraStorageInformation));
if (!sinfo) return GP_ERROR_NO_MEMORY;
sinfo = malloc(sizeof(CameraStorageInformation));
if (!sinfo) return GP_ERROR_NO_MEMORY;
*sinfos = sinfo;
*nrofsinfos = 1;
*sinfos = sinfo;
*nrofsinfos = 1;
sinfo->fields = GP_STORAGEINFO_BASE;
strcpy(sinfo->basedir, "/");
sinfo->fields = GP_STORAGEINFO_BASE;
strcpy(sinfo->basedir, "/");
sinfo->fields |= GP_STORAGEINFO_ACCESS;
sinfo->access = GP_STORAGEINFO_AC_READONLY_WITH_DELETE;
sinfo->fields |= GP_STORAGEINFO_STORAGETYPE;
sinfo->type = GP_STORAGEINFO_ST_FIXED_RAM;
sinfo->fields |= GP_STORAGEINFO_FILESYSTEMTYPE;
sinfo->fstype = GP_STORAGEINFO_FST_GENERICFLAT;
sinfo->fields |= GP_STORAGEINFO_ACCESS;
sinfo->access = GP_STORAGEINFO_AC_READONLY_WITH_DELETE;
sinfo->fields |= GP_STORAGEINFO_STORAGETYPE;
sinfo->type = GP_STORAGEINFO_ST_FIXED_RAM;
sinfo->fields |= GP_STORAGEINFO_FILESYSTEMTYPE;
sinfo->fstype = GP_STORAGEINFO_FST_GENERICFLAT;
sinfo->fields |= GP_STORAGEINFO_MAXCAPACITY;
if (caminfo.hardware_config & HWCONFIG_MEMSIZE_16MBIT)
sinfo->capacitykbytes = 16*1024/8;
else
sinfo->capacitykbytes = 64*1024/8;
sinfo->fields |= GP_STORAGEINFO_MAXCAPACITY;
if (caminfo.hardware_config & HWCONFIG_MEMSIZE_16MBIT)
sinfo->capacitykbytes = 16*1024/8;
else
sinfo->capacitykbytes = 64*1024/8;
if ((ret = stv0680_try_cmd(port, CMDID_GET_IMAGE_INFO, 0,
(void*)&imginfo, sizeof(imginfo))!=GP_OK))
return ret;
if ((ret = stv0680_try_cmd(port, CMDID_GET_IMAGE_INFO, 0,
(void*)&imginfo, sizeof(imginfo))!=GP_OK))
return ret;
sinfo->fields |= GP_STORAGEINFO_FREESPACEIMAGES;
sinfo->freeimages =
((imginfo.maximages[0]<<8)|imginfo.maximages[1]) -
((imginfo.index[0]<<8)|imginfo.index[1]);
return GP_OK;
sinfo->fields |= GP_STORAGEINFO_FREESPACEIMAGES;
sinfo->freeimages =
((imginfo.maximages[0]<<8)|imginfo.maximages[1]) -
((imginfo.index[0]<<8)|imginfo.index[1]);
return GP_OK;
}
@@ -339,20 +337,20 @@ int camera_init (Camera *camera, GPContext *context)
{
GPPortSettings settings;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->capture = camera_capture;
gp_port_get_settings(camera->port, &settings);
switch(camera->port->type) {
case GP_PORT_SERIAL:
gp_port_set_timeout(camera->port, 1000);
gp_port_set_timeout(camera->port, 1000);
settings.serial.speed = 115200;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
settings.serial.bits = 8;
settings.serial.parity = 0;
settings.serial.stopbits = 1;
break;
case GP_PORT_USB:
/* Use the defaults the core parsed */
@@ -366,6 +364,6 @@ int camera_init (Camera *camera, GPContext *context)
/* Set up the filesystem */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
/* test camera */
return stv0680_ping(camera->port);
/* test camera */
return stv0680_ping(camera->port);
}

View File

@@ -167,8 +167,8 @@ struct stv680_user_info {
#define STV0680_VGA_HEIGHT 484
int stv0680_try_cmd(GPPort *port, unsigned char cmd,
unsigned short data,
unsigned char *response, unsigned char response_len);
unsigned short data,
unsigned char *response, unsigned char response_len);
#endif /* !defined(CAMLIBS_STV0680_STV0680_H) */

View File

@@ -50,23 +50,23 @@
static const struct
{
char *model;
int usb_vendor;
int usb_product;
char *model;
int usb_vendor;
int usb_product;
} models[]= {
{"Traveler:SX330z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Maginon:SX330z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Skanhex:SX-330z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Medion:MD 9700",USB_VENDOR_TRAVELER,USB_PRODUCT_MD9700},
{"Jenoptik:JD-3300z3",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Traveler:SX330z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Maginon:SX330z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Skanhex:SX-330z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Medion:MD 9700",USB_VENDOR_TRAVELER,USB_PRODUCT_MD9700},
{"Jenoptik:JD-3300z3",USB_VENDOR_TRAVELER,USB_PRODUCT_SX330Z},
{"Traveler:SX410z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Concord:EyeQ 4330",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Jenoptik:JD-4100z3",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Medion:MD 6000",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Maginon SX-410z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Lifetec:LT 5995",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{NULL,0,0}
{"Traveler:SX410z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Concord:EyeQ 4330",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Jenoptik:JD-4100z3",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Medion:MD 6000",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Maginon SX-410z",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{"Lifetec:LT 5995",USB_VENDOR_TRAVELER,USB_PRODUCT_SX410Z},
{NULL,0,0}
};
@@ -76,25 +76,25 @@ static const struct
int
camera_abilities (CameraAbilitiesList *list)
{
int i;
CameraAbilities a;
for(i=0;models[i].model;i++)
{
memset(&a,0,sizeof(CameraAbilities));
strcpy(a.model,models[i].model);
a.usb_vendor = models[i].usb_vendor;
a.usb_product = models[i].usb_product;
a.status = GP_DRIVER_STATUS_EXPERIMENTAL;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.operations = GP_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW|
GP_FILE_OPERATION_DELETE|
GP_FILE_OPERATION_EXIF;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
CR(gp_abilities_list_append(list,a));
} /* all models... */
return(GP_OK);
int i;
CameraAbilities a;
for (i=0;models[i].model;i++)
{
memset(&a, 0, sizeof(CameraAbilities));
strcpy(a.model, models[i].model);
a.usb_vendor = models[i].usb_vendor;
a.usb_product = models[i].usb_product;
a.status = GP_DRIVER_STATUS_EXPERIMENTAL;
a.port = GP_PORT_USB;
a.speed[0] = 0;
a.operations = GP_OPERATION_NONE;
a.file_operations = GP_FILE_OPERATION_PREVIEW|
GP_FILE_OPERATION_DELETE|
GP_FILE_OPERATION_EXIF;
a.folder_operations = GP_FOLDER_OPERATION_NONE;
CR(gp_abilities_list_append(list, a));
} /* all models... */
return(GP_OK);
} /* camera_abilities */
@@ -190,14 +190,14 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
* Delete file function (working ..)
*/
static int
del_file_func(CameraFilesystem *fs,const char *folder,const char *filename,
void *user_data,GPContext *context)
del_file_func(CameraFilesystem *fs, const char *folder, const char *filename,
void *user_data, GPContext *context)
{
Camera *camera=user_data;
/*int id;*/
if (strcmp(folder,"/")) return(GP_ERROR_DIRECTORY_NOT_FOUND);
GP_DEBUG("Deleting : %s",filename);
return(sx330z_delete_file(camera,context,filename));
Camera *camera=user_data;
/*int id;*/
if (strcmp(folder, "/")) return(GP_ERROR_DIRECTORY_NOT_FOUND);
GP_DEBUG("Deleting : %s", filename);
return(sx330z_delete_file(camera, context, filename));
} /* delete file func */
@@ -207,24 +207,21 @@ del_file_func(CameraFilesystem *fs,const char *folder,const char *filename,
int
camera_id(CameraText *id)
{
strcpy(id->text,"Traveler SX330z");
return (GP_OK);
strcpy(id->text, "Traveler SX330z");
return (GP_OK);
} /* camera id */
/*
* Camera about
*/
static int
camera_about(Camera *camera,CameraText *about,GPContext *context)
camera_about(Camera *camera, CameraText *about, GPContext *context)
{
strcpy(about->text,_("(Traveler) SX330z Library (And other Aldi-cams).\n"
"Even other Vendors like Jenoptik, Skanhex, Maginon should work.\n"
"Please send bugreports and comments.\n"
"Dominik Kuhlen <kinimod@users.sourceforge.net>\n"));
return(GP_OK);
strcpy(about->text, _("(Traveler) SX330z Library (And other Aldi-cams).\n"
"Even other Vendors like Jenoptik, Skanhex, Maginon should work.\n"
"Please send bugreports and comments.\n"
"Dominik Kuhlen <kinimod@users.sourceforge.net>\n"));
return(GP_OK);
} /* camera about */
@@ -235,9 +232,9 @@ camera_about(Camera *camera,CameraText *about,GPContext *context)
int
camera_exit(Camera *camera, GPContext *context)
{
if (camera->pl)
free(camera->pl);
return(GP_OK);
if (camera->pl)
free(camera->pl);
return(GP_OK);
}
@@ -251,35 +248,35 @@ static CameraFilesystemFuncs fsfuncs = {
* OK, lets get serious !
*/
int
camera_init(Camera *camera,GPContext *context)
camera_init(Camera *camera, GPContext *context)
{
GPPortSettings settings;
CameraAbilities abilities;
/* try to contact the camera ...*/
/*CR(gp_port_get_settings(camera->port,&settings));*/
GPPortSettings settings;
CameraAbilities abilities;
/* try to contact the camera ...*/
/*CR(gp_port_get_settings(camera->port,&settings));*/
camera->functions->about=camera_about;
camera->functions->exit=camera_exit;
gp_port_get_settings(camera->port,&settings);
if (camera->port->type!=GP_PORT_USB)
{
gp_context_error(context,_("sx330z is USB only"));
return(GP_ERROR_UNKNOWN_PORT);
}
/* GP_DEBUG("camera_init : in = %x",camera->port->settings.usb.inep);*/
CR(gp_port_set_settings(camera->port,settings));
CR(gp_port_set_timeout(camera->port,TIMEOUT));
camera->functions->about=camera_about;
camera->functions->exit=camera_exit;
gp_port_get_settings(camera->port, &settings);
if (camera->port->type!=GP_PORT_USB)
{
gp_context_error(context, _("sx330z is USB only"));
return(GP_ERROR_UNKNOWN_PORT);
}
/* GP_DEBUG("camera_init : in = %x",camera->port->settings.usb.inep);*/
CR(gp_port_set_settings(camera->port, settings));
CR(gp_port_set_timeout(camera->port, TIMEOUT));
CR(gp_filesystem_set_funcs(camera->fs, &fsfuncs, camera));
CR(gp_filesystem_set_funcs(camera->fs, &fsfuncs, camera));
camera->pl=malloc(sizeof(CameraPrivateLibrary));
if (!camera->pl)
return(GP_ERROR_NO_MEMORY);
camera->pl=malloc(sizeof(CameraPrivateLibrary));
if (!camera->pl)
return(GP_ERROR_NO_MEMORY);
CR(gp_camera_get_abilities(camera, &abilities));
camera->pl->usb_product=abilities.usb_product; /* some models differ in Thumbnail size */
/* GP_DEBUG("sx330z Camera_init : sx init %04x",camera->pl->usb_product); */
return(sx330z_init(camera,context));
CR(gp_camera_get_abilities(camera, &abilities));
camera->pl->usb_product=abilities.usb_product; /* some models differ in Thumbnail size */
/* GP_DEBUG("sx330z Camera_init : sx init %04x",camera->pl->usb_product); */
return(sx330z_init(camera, context));
} /* camera init */

View File

@@ -503,15 +503,15 @@ CameraFilesystemFuncs fsfuncs = {
int
camera_init (Camera *camera, GPContext *context)
{
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->get_config = camera_config_get;
camera->functions->set_config = camera_config_set;
camera->functions->capture = camera_capture;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->get_config = camera_config_get;
camera->functions->set_config = camera_config_set;
camera->functions->capture = camera_capture;
camera->functions->capture_preview = camera_capture_preview;
camera->functions->summary = camera_summary;
camera->functions->manual = camera_manual;
camera->functions->about = camera_about;
/* Now, tell the filesystem where to get lists, files and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);

Some files were not shown because too many files have changed in this diff Show More