kopia lustrzana https://gitlab.com/sane-project/backends
Cosmetic cleanup, and support for cameras that don't support image
capture or file deletion.DEVEL_2_0_BRANCH-1
rodzic
9be08d236c
commit
6a924e4c1d
|
@ -1,8 +1,8 @@
|
|||
/* Please note! This is extremely alpha code, and is really intended as
|
||||
* a "proof of concept" since I don't yet know whether it's going to
|
||||
* to be practical and/or possible to implement a the complete backend.
|
||||
* It's also been tested with only one camera model, the Kodak DC240,
|
||||
* which happens to be the only camera I have. I'm very interested
|
||||
* It's also been tested with only cameras I have access to: the Kodak DC240
|
||||
* and the Directory Browse "camera." I'm very interested
|
||||
* in learning what it would take to support more cameras. In
|
||||
* particular, the current incarnation will only support cameras
|
||||
* that directly generate jpeg files.
|
||||
|
@ -429,7 +429,8 @@ init_gphoto2 (void)
|
|||
* the port, and that seems to confuse the camera. Holding
|
||||
* the port open seems to fix it.
|
||||
*/
|
||||
if ( (hack_fd=open(Cam_data.port+7,O_RDONLY)) < 0 ) {
|
||||
if ((hack_fd = open (Cam_data.port + 7, O_RDONLY)) < 0)
|
||||
{
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
|
@ -449,6 +450,18 @@ init_gphoto2 (void)
|
|||
sod[GPHOTO2_OPT_SNAP].cap |= SANE_CAP_INACTIVE;
|
||||
}
|
||||
|
||||
if (!(abilities.operations & GP_OPERATION_CAPTURE_PREVIEW))
|
||||
{
|
||||
DBG (20, "Camera does not support image preview\n");
|
||||
sod[GPHOTO2_OPT_THUMBS].cap |= SANE_CAP_INACTIVE;
|
||||
}
|
||||
|
||||
if (!(abilities.file_operations & GP_FILE_OPERATION_DELETE))
|
||||
{
|
||||
DBG (20, "Camera does not support image deletion\n");
|
||||
sod[GPHOTO2_OPT_ERASE].cap |= SANE_CAP_INACTIVE;
|
||||
}
|
||||
|
||||
for (n = 0; abilities.speed[n]; n++)
|
||||
{
|
||||
if (abilities.speed[n] == Cam_data.speed)
|
||||
|
@ -524,7 +537,8 @@ get_info (void)
|
|||
{
|
||||
n = read_dir (TopFolder, 0);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
n = 1;
|
||||
}
|
||||
|
||||
|
@ -587,8 +601,16 @@ erase (void)
|
|||
{
|
||||
SANE_String_Const filename;
|
||||
|
||||
if (SubDirs)
|
||||
{
|
||||
sprintf (cmdbuf, "%s/%s", (char *) TopFolder,
|
||||
(const char *) folder_list[current_folder]);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (cmdbuf, TopFolder);
|
||||
}
|
||||
|
||||
CHECK_RET (gp_list_get_name
|
||||
(dir_list, Cam_data.current_picture_number - 1, &filename));
|
||||
|
||||
|
@ -627,7 +649,8 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback UNUSEDARG authorize)
|
|||
|
||||
DBG_INIT ();
|
||||
|
||||
DBG (1, "GPHOTO2 Backend $Id$\n");
|
||||
DBG (1,
|
||||
"GPHOTO2 Backend $Id$\n");
|
||||
|
||||
if (getenv ("GP_DEBUG"))
|
||||
{
|
||||
|
@ -1356,7 +1379,8 @@ sane_start (SANE_Handle handle)
|
|||
{
|
||||
linebuffer = malloc (parms.bytes_per_line);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
free (linebuffer);
|
||||
linebuffer = malloc (parms.bytes_per_line);
|
||||
}
|
||||
|
@ -1690,8 +1714,16 @@ converter_do_scan_complete_cleanup (void)
|
|||
}
|
||||
|
||||
|
||||
if (SubDirs)
|
||||
{
|
||||
sprintf (cmdbuf, "%s/%s", (char *) TopFolder,
|
||||
(const char *) folder_list[current_folder]);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (cmdbuf, TopFolder);
|
||||
}
|
||||
|
||||
CHECK_RET (gp_list_get_name
|
||||
(dir_list, Cam_data.current_picture_number - 1, &filename));
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue