kopia lustrzana https://gitlab.com/sane-project/backends
restored actual version of the Canon-SCSI backend
rodzic
8f102afe79
commit
20aff8e022
|
@ -1,3 +1,8 @@
|
|||
2005-07-01 Ulrich Deiters <ulrich.deiters@uni-koeln.de>
|
||||
|
||||
* restored the actual version of the Canon-SCSI backend
|
||||
(backend/canon.c, canon-sane.c canon-scsi.c canon.h)
|
||||
|
||||
2005-06-30 Stéphane Voltz <stefdev@modulonet.fr>
|
||||
|
||||
* configure.in AUTHORS backend/dll.conf doc/sane.man doc/Makefile.in
|
||||
|
|
Plik diff jest za duży
Load Diff
|
@ -60,7 +60,7 @@ test_unit_ready (int fd)
|
|||
|
||||
#ifdef IMPLEMENT_ALL_SCANNER_SCSI_COMMANDS
|
||||
static SANE_Status
|
||||
request_sense (int fd, void *buf, size_t * buf_size)
|
||||
request_sense (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[6];
|
||||
int status;
|
||||
|
@ -77,7 +77,7 @@ request_sense (int fd, void *buf, size_t * buf_size)
|
|||
#endif
|
||||
|
||||
static SANE_Status
|
||||
inquiry (int fd, int evpd, void *buf, size_t * buf_size)
|
||||
inquiry (int fd, int evpd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[6];
|
||||
int status;
|
||||
|
@ -88,18 +88,15 @@ inquiry (int fd, int evpd, void *buf, size_t * buf_size)
|
|||
cmd[1] = evpd;
|
||||
cmd[2] = evpd ? 0xf0 : 0;
|
||||
cmd[4] = evpd ? 74 : 36;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, buf_size);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
|
||||
|
||||
DBG (31, "<< inquiry\n");
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static SANE_Status
|
||||
mode_select (int fd)
|
||||
{
|
||||
|
||||
static u_char cmd[6 + 12];
|
||||
int status;
|
||||
DBG (31, ">> mode_select\n");
|
||||
|
@ -117,12 +114,10 @@ mode_select (int fd)
|
|||
DBG (31, "<< mode_select\n");
|
||||
return (status);
|
||||
}
|
||||
#endif
|
||||
|
||||
static SANE_Status
|
||||
reserve_unit (int fd)
|
||||
{
|
||||
|
||||
static u_char cmd[6];
|
||||
int status;
|
||||
DBG (31, ">> reserve_unit\n");
|
||||
|
@ -139,14 +134,13 @@ reserve_unit (int fd)
|
|||
static SANE_Status
|
||||
release_unit (int fd)
|
||||
{
|
||||
|
||||
static u_char cmd[6];
|
||||
int status;
|
||||
DBG (31, ">> release_unit\n");
|
||||
|
||||
memset (cmd, 0, sizeof (cmd));
|
||||
cmd[0] = 0x17;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
|
||||
|
||||
DBG (31, "<< release_unit\n");
|
||||
return (status);
|
||||
|
@ -154,9 +148,8 @@ release_unit (int fd)
|
|||
#endif
|
||||
|
||||
static SANE_Status
|
||||
mode_sense (int fd, void *buf, size_t * buf_size)
|
||||
mode_sense (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
|
||||
static u_char cmd[6];
|
||||
int status;
|
||||
DBG (31, ">> mode_sense\n");
|
||||
|
@ -165,7 +158,7 @@ mode_sense (int fd, void *buf, size_t * buf_size)
|
|||
cmd[0] = 0x1a;
|
||||
cmd[2] = 3;
|
||||
cmd[4] = 12;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, buf_size);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
|
||||
|
||||
DBG (31, "<< mode_sense\n");
|
||||
return (status);
|
||||
|
@ -187,7 +180,6 @@ scan (int fd)
|
|||
return (status);
|
||||
}
|
||||
|
||||
/* #ifdef IMPLEMENT_ALL_SCANNER_SCSI_COMMANDS */
|
||||
static SANE_Status
|
||||
send_diagnostic (int fd)
|
||||
{
|
||||
|
@ -198,14 +190,12 @@ send_diagnostic (int fd)
|
|||
memset (cmd, 0, sizeof (cmd));
|
||||
cmd[0] = 0x1d;
|
||||
cmd[1] = 4;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
|
||||
|
||||
DBG (31, "<< send_diagnostic\n");
|
||||
return (status);
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
static SANE_Status
|
||||
set_window (int fd, void *data)
|
||||
{
|
||||
|
@ -223,7 +213,7 @@ set_window (int fd, void *data)
|
|||
}
|
||||
|
||||
static SANE_Status
|
||||
get_window (int fd, void *buf, size_t * buf_size)
|
||||
get_window (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
|
@ -240,7 +230,7 @@ get_window (int fd, void *buf, size_t * buf_size)
|
|||
}
|
||||
|
||||
static SANE_Status
|
||||
read_data (int fd, void *buf, size_t * buf_size)
|
||||
read_data (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
|
@ -266,7 +256,7 @@ medium_position (int fd)
|
|||
|
||||
memset (cmd, 0, sizeof (cmd));
|
||||
cmd[0] = 0x31;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
|
||||
|
||||
DBG (31, "<< medium_position\n");
|
||||
return (status);
|
||||
|
@ -282,7 +272,7 @@ execute_shading (int fd)
|
|||
|
||||
memset (cmd, 0, sizeof (cmd));
|
||||
cmd[0] = 0xe2;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
|
||||
|
||||
DBG (31, "<< execute shading\n");
|
||||
return (status);
|
||||
|
@ -290,45 +280,26 @@ execute_shading (int fd)
|
|||
#endif
|
||||
|
||||
static SANE_Status
|
||||
execute_auto_focus (int fd, int mode, int speed, int AE, int count)
|
||||
execute_auto_focus (int fd, int AF, int speed, int AE, int count)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
DBG (7, ">> execute_auto_focus\n");
|
||||
DBG (7, ">> focus: mode='%d', speed='%d', AE='%d', count='%d'\n",
|
||||
mode, speed, AE, count);
|
||||
AF, speed, AE, count);
|
||||
|
||||
memset (cmd, 0, sizeof (cmd));
|
||||
cmd[0] = 0xe0;
|
||||
cmd[1] = mode;
|
||||
cmd[2] = (speed << 6) | AE;
|
||||
cmd[4] = count;
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
|
||||
|
||||
DBG (7, "<< execute_auto_focus\n");
|
||||
return (status);
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
execute_auto_focus_FS2710 (int fd, int mode, int AE, int count)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
DBG (7, ">> execute_auto_focus_FS2710\n");
|
||||
DBG (7, ">> focus: mode='%d', count='%d'\n", mode, count);
|
||||
|
||||
memset (cmd, 0, sizeof (cmd));
|
||||
cmd[0] = 0xe0;
|
||||
cmd[1] = mode;
|
||||
cmd[2] = AE;
|
||||
#if 0
|
||||
cmd[4] = (char) count; /* seems to work, but may be unsafe */
|
||||
cmd[1] = (u_char) AF;
|
||||
cmd[2] = (u_char) ((speed << 7) | AE);
|
||||
#if 1
|
||||
cmd[4] = (u_char) count; /* seems to work, but may be unsafe */
|
||||
#else /* The Canon software uses this: */
|
||||
cmd[4] = (char) (28 * ((int) (count/28.5)) + 16);
|
||||
cmd[4] = (u_char) (28 * ((int) (count / 28.5)) + 16);
|
||||
#endif
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
|
||||
|
||||
DBG (7, "<< execute_auto_focus_FS2710\n");
|
||||
DBG (7, "<< execute_auto_focus\n");
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
@ -348,7 +319,7 @@ set_adf_mode (int fd, u_char priority)
|
|||
}
|
||||
|
||||
static SANE_Status
|
||||
get_scan_mode (int fd, u_char page, void *buf, size_t * buf_size)
|
||||
get_scan_mode (int fd, u_char page, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[6];
|
||||
int status;
|
||||
|
@ -362,16 +333,17 @@ get_scan_mode (int fd, u_char page, void *buf, size_t * buf_size)
|
|||
{
|
||||
case AUTO_DOC_FEEDER_UNIT:
|
||||
case TRANSPARENCY_UNIT:
|
||||
cmd[4] = 0x0C + PageLen;
|
||||
cmd[4] = 0x0c + PageLen;
|
||||
break;
|
||||
|
||||
case SCAN_CONTROL_CONDITIONS:
|
||||
cmd[4] = 0x14 + PageLen;
|
||||
break;
|
||||
|
||||
/* case SCAN_CONTROL_CON_FB1200:
|
||||
case SCAN_CONTROL_CON_FB1200:
|
||||
cmd[2] = 0x20;
|
||||
cmd[4] = 0x17 + PageLen;
|
||||
break;*/
|
||||
break;
|
||||
|
||||
default:
|
||||
cmd[4] = 0x24 + PageLen;
|
||||
|
@ -385,12 +357,11 @@ get_scan_mode (int fd, u_char page, void *buf, size_t * buf_size)
|
|||
return (status);
|
||||
}
|
||||
|
||||
|
||||
static SANE_Status
|
||||
define_scan_mode (int fd, u_char page, void *data)
|
||||
{
|
||||
static u_char cmd[6];
|
||||
u_char pdata[23];
|
||||
u_char pdata[36];
|
||||
size_t i;
|
||||
int status, pdatalen;
|
||||
DBG (31, ">> define scan mode\n");
|
||||
|
@ -399,39 +370,35 @@ define_scan_mode (int fd, u_char page, void *data)
|
|||
memset (pdata, 0, sizeof (pdata));
|
||||
cmd[0] = 0xd6;
|
||||
cmd[1] = 0x10;
|
||||
cmd[4] = (page == TRANSPARENCY_UNIT) ? 0x0c :
|
||||
(page == TRANSPARENCY_UNIT_FB1200) ? 0x0c :
|
||||
(page == SCAN_CONTROL_CONDITIONS) ? 0x14 :
|
||||
(page == SCAN_CONTROL_CON_FB1200) ? 0x17 : 0x24;
|
||||
cmd[4] = (page == TRANSPARENCY_UNIT) ? 0x0c
|
||||
: (page == TRANSPARENCY_UNIT_FB1200) ? 0x0c
|
||||
: (page == SCAN_CONTROL_CONDITIONS) ? 0x14
|
||||
: (page == SCAN_CONTROL_CON_FB1200) ? 0x17 : 0x24;
|
||||
|
||||
memcpy (pdata + 4, data, (page == TRANSPARENCY_UNIT) ? 8 :
|
||||
(page == TRANSPARENCY_UNIT_FB1200) ? 10 :
|
||||
(page == SCAN_CONTROL_CONDITIONS) ? 16 :
|
||||
(page == SCAN_CONTROL_CON_FB1200) ? 19 : 32);
|
||||
memcpy (pdata + 4, data, (page == TRANSPARENCY_UNIT) ? 8
|
||||
: (page == TRANSPARENCY_UNIT_FB1200) ? 10
|
||||
: (page == SCAN_CONTROL_CONDITIONS) ? 16
|
||||
: (page == SCAN_CONTROL_CON_FB1200) ? 19 : 32);
|
||||
|
||||
for (i = 0; i < sizeof (cmd); i++)
|
||||
{
|
||||
DBG (31, "define scan mode: cmd[%lu]='0x%0X'\n", (u_long) i, cmd[i]);
|
||||
}
|
||||
DBG (31, "define scan mode: cmd[%d]='0x%0X'\n", i, cmd[i]);
|
||||
|
||||
for (i = 0; i < sizeof (pdata); i++)
|
||||
{
|
||||
DBG (31, "define scan mode: pdata[%lu]='0x%0X'\n", (u_long) i, pdata[i]);
|
||||
}
|
||||
DBG (31, "define scan mode: pdata[%d]='0x%0X'\n", i, pdata[i]);
|
||||
|
||||
pdatalen = (page == TRANSPARENCY_UNIT) ? 12 :
|
||||
(page == TRANSPARENCY_UNIT_FB1200) ? 14 :
|
||||
(page == SCAN_CONTROL_CONDITIONS) ? 20 :
|
||||
(page == SCAN_CONTROL_CON_FB1200) ? 23 : 36;
|
||||
pdatalen = (page == TRANSPARENCY_UNIT) ? 12
|
||||
: (page == TRANSPARENCY_UNIT_FB1200) ? 14
|
||||
: (page == SCAN_CONTROL_CONDITIONS) ? 20
|
||||
: (page == SCAN_CONTROL_CON_FB1200) ? 23 : 36;
|
||||
|
||||
status =
|
||||
sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), pdata, pdatalen, NULL, NULL);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), pdata, pdatalen, NULL,
|
||||
NULL);
|
||||
DBG (31, "<< define scan mode\n");
|
||||
return (status);
|
||||
}
|
||||
|
||||
static SANE_Status
|
||||
get_density_curve (int fd, int component, void *buf, size_t * buf_size,
|
||||
get_density_curve (int fd, int component, void *buf, size_t *buf_size,
|
||||
int transfer_data_type)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
|
@ -454,7 +421,7 @@ get_density_curve (int fd, int component, void *buf, size_t * buf_size,
|
|||
|
||||
#ifdef IMPLEMENT_ALL_SCANNER_SCSI_COMMANDS
|
||||
static SANE_Status
|
||||
get_density_curve_data_format (int fd, void *buf, size_t * buf_size)
|
||||
get_density_curve_data_format (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
|
@ -468,7 +435,7 @@ get_density_curve_data_format (int fd, void *buf, size_t * buf_size)
|
|||
cmd[6] = 0;
|
||||
cmd[7] = 0;
|
||||
cmd[8] = 14;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, buf_size);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
|
||||
|
||||
DBG (31, "<< get_density_curve_data_format\n");
|
||||
return (status);
|
||||
|
@ -476,7 +443,7 @@ get_density_curve_data_format (int fd, void *buf, size_t * buf_size)
|
|||
#endif
|
||||
|
||||
static SANE_Status
|
||||
set_density_curve (int fd, int component, void *buf, size_t * buf_size,
|
||||
set_density_curve (int fd, int component, void *buf, size_t *buf_size,
|
||||
int transfer_data_type)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
|
@ -523,7 +490,7 @@ set_density_curve (int fd, int component, void *buf, size_t * buf_size,
|
|||
|
||||
#ifdef IMPLEMENT_ALL_SCANNER_SCSI_COMMANDS
|
||||
static SANE_Status
|
||||
get_power_on_timer (int fd, void *buf, size_t * buf_size)
|
||||
get_power_on_timer (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
|
@ -534,7 +501,7 @@ get_power_on_timer (int fd, void *buf, size_t * buf_size)
|
|||
cmd[6] = 1;
|
||||
cmd[7] = 0;
|
||||
cmd[8] = 0;
|
||||
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, buf_size);
|
||||
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
|
||||
|
||||
DBG (31, "<< get power on timer\n");
|
||||
return (status);
|
||||
|
@ -542,7 +509,7 @@ get_power_on_timer (int fd, void *buf, size_t * buf_size)
|
|||
#endif
|
||||
|
||||
static SANE_Status
|
||||
get_film_status (int fd, void *buf, size_t * buf_size)
|
||||
get_film_status (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
|
@ -560,7 +527,7 @@ get_film_status (int fd, void *buf, size_t * buf_size)
|
|||
}
|
||||
|
||||
static SANE_Status
|
||||
get_data_status (int fd, void *buf, size_t * buf_size)
|
||||
get_data_status (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[10];
|
||||
int status;
|
||||
|
@ -611,7 +578,7 @@ execute_calibration (int fd)
|
|||
}
|
||||
|
||||
static SANE_Status
|
||||
get_calibration_status (int fd, void *buf, size_t * buf_size)
|
||||
get_calibration_status (int fd, void *buf, size_t *buf_size)
|
||||
{
|
||||
static u_char cmd[6];
|
||||
int status;
|
||||
|
@ -650,14 +617,12 @@ wait_ready(int fd)
|
|||
int retry = 0;
|
||||
|
||||
while ((status = test_unit_ready (fd)) != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(5, "wait_ready failed (%d)\n", retry);
|
||||
if(retry++ > 15)
|
||||
{
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
DBG(5, "wait_ready failed (%d)\n", retry);
|
||||
if (retry++ > 15)
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
sleep(3);
|
||||
}
|
||||
sleep(3);
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
#endif
|
||||
|
@ -684,8 +649,8 @@ cancel (int fd)
|
|||
stored in the CANON_Scanner structure. */
|
||||
|
||||
static SANE_Status
|
||||
get_density_curve_fs2710 (SANE_Handle handle, int component, u_char * buf,
|
||||
size_t * buf_size)
|
||||
get_density_curve_fs2710 (SANE_Handle handle, int component, u_char *buf,
|
||||
size_t *buf_size)
|
||||
{
|
||||
CANON_Scanner *s = handle;
|
||||
int i;
|
||||
|
@ -697,7 +662,7 @@ get_density_curve_fs2710 (SANE_Handle handle, int component, u_char * buf,
|
|||
}
|
||||
|
||||
static SANE_Status
|
||||
set_density_curve_fs2710 (SANE_Handle handle, int component, u_char * buf)
|
||||
set_density_curve_fs2710 (SANE_Handle handle, int component, u_char *buf)
|
||||
{
|
||||
CANON_Scanner *s = handle;
|
||||
int i, j, hi, lo;
|
||||
|
@ -739,27 +704,22 @@ set_parameters_fs2710 (SANE_Handle handle)
|
|||
{
|
||||
if (j <= shadow[i])
|
||||
s->gamma_map[i][j] = (u_char) ((s->brightness >= 128) ?
|
||||
2 * s->brightness - 256 : 0);
|
||||
2 * s->brightness - 256 : 0);
|
||||
else if (j < hilite[i])
|
||||
{
|
||||
x =
|
||||
((double) (j - shadow[i])) /
|
||||
((double) (hilite[i] - shadow[i]));
|
||||
x = ((double) (j - shadow[i]))
|
||||
/ ((double) (hilite[i] - shadow[i]));
|
||||
/* first do the contrast correction */
|
||||
x =
|
||||
(x <= 0.5) ? 0.5 * pow (2 * x,
|
||||
c) : 1.0 - 0.5 * pow (2 * (1.0 - x),
|
||||
c);
|
||||
x = pow (x, 0.4); /* default gamma correction */
|
||||
x += b; /* brightness correction */
|
||||
s->gamma_map[i][j] =
|
||||
(u_char) MAX (0, MIN (255, (int) (255.0 * x)));
|
||||
x = (x <= 0.5) ? 0.5 * pow (2 * x, c)
|
||||
: 1.0 - 0.5 * pow (2 * (1.0 - x), c);
|
||||
x = pow (x, 0.5); /* default gamma correction */
|
||||
x += b; /* brightness correction */
|
||||
s->gamma_map[i][j] = (u_char) MAX (0, MIN (255,
|
||||
(int) (255.0 * x)));
|
||||
}
|
||||
else
|
||||
s->gamma_map[i][j] = (u_char) ((s->brightness >= 128) ?
|
||||
255 : 2 * s->brightness);
|
||||
if (invert)
|
||||
s->gamma_map[i][j] = 255 - s->gamma_map[i][j];
|
||||
255 : 2 * s->brightness);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
136
backend/canon.c
136
backend/canon.c
|
@ -4,9 +4,9 @@
|
|||
Modified by Manuel Panea <Manuel.Panea@rzg.mpg.de>
|
||||
and Markus Mertinat <Markus.Mertinat@Physik.Uni-Augsburg.DE>
|
||||
FB620 and FB1200 support by Mitsuru Okaniwa <m-okaniwa@bea.hi-ho.ne.jp>
|
||||
FS2710 support by Ulrich Deiters <ukd@xenon.pc.uni-koeln.de>
|
||||
FS2710 support by Ulrich Deiters <ulrich.deiters@uni-koeln.de>
|
||||
|
||||
backend version: 1.12
|
||||
backend version: 1.13e
|
||||
|
||||
This file is part of the SANE package.
|
||||
|
||||
|
@ -166,13 +166,12 @@ static const SANE_String_Const page_list[] = {
|
|||
};
|
||||
|
||||
static const SANE_String_Const filmtype_list[] = {
|
||||
"Negatives",
|
||||
"Slides",
|
||||
"Negatives", "Slides",
|
||||
0
|
||||
};
|
||||
|
||||
static const SANE_String_Const negative_filmtype_list[] = {
|
||||
"Film type 0", "Film type 1", "Film type 2", "Film type 3",
|
||||
"Kodak", "Fuji", "Agfa", "Konica",
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -242,9 +241,7 @@ get_tpu_stat (int fd, CANON_Device * dev)
|
|||
}
|
||||
|
||||
for (i = 0; i < buf_size; i++)
|
||||
{
|
||||
DBG (3, "scan mode control byte[%lu] = %d\n", (u_long) i, tbuf[i]);
|
||||
}
|
||||
DBG (3, "scan mode control byte[%d] = %d\n", i, tbuf[i]);
|
||||
dev->tpu.Status = (tbuf[2 + 4 + 5] >> 7) ?
|
||||
TPU_STAT_INACTIVE : TPU_STAT_NONE;
|
||||
if (dev->tpu.Status == SANE_TRUE) /* TPU available */
|
||||
|
@ -289,9 +286,7 @@ get_adf_stat (int fd, CANON_Device * dev)
|
|||
}
|
||||
|
||||
for (i = 0; i < buf_size; i++)
|
||||
{
|
||||
DBG (3, "scan mode control byte[%lu] = %d\n", (u_long) i, abuf[i]);
|
||||
}
|
||||
DBG (3, "scan mode control byte[%d] = %d\n", i, abuf[i]);
|
||||
|
||||
dev->adf.Status = (abuf[ADF_Status] & ADF_NOT_PRESENT) ?
|
||||
ADF_STAT_NONE : ADF_STAT_INACTIVE;
|
||||
|
@ -327,12 +322,13 @@ sense_handler (int scsi_fd, u_char * result, void *arg)
|
|||
SANE_Status status;
|
||||
|
||||
DBG (1, ">> sense_handler\n");
|
||||
DBG (11, "%s(%ld, %p, %p)\n", me, (long) scsi_fd,
|
||||
(void *) result, (void *) arg);
|
||||
DBG (11, "sense buffer: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x \
|
||||
%02x %02x %02x %02x %02x %02x\n", result[0], result[1], result[2], result[3],
|
||||
result[4], result[5], result[6], result[7], result[8], result[9], result[10],
|
||||
result[11], result[12], result[13], result[14], result[15]);
|
||||
DBG (11, "%s(%ld, %p, %p)\n", me, (long) scsi_fd, (void *) result,
|
||||
(void *) arg);
|
||||
DBG (11, "sense buffer: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x "
|
||||
"%02x %02x %02x %02x %02x %02x\n", result[0], result[1], result[2],
|
||||
result[3], result[4], result[5], result[6], result[7], result[8],
|
||||
result[9], result[10], result[11], result[12], result[13], result[14],
|
||||
result[15]);
|
||||
|
||||
if (dev && dev->info.is_scsi2)
|
||||
{
|
||||
|
@ -565,7 +561,7 @@ do_gamma (CANON_Scanner * s)
|
|||
scanner's monochrome gamma component */
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
if (neg == SANE_FALSE)
|
||||
if (!neg)
|
||||
{
|
||||
gbuf[j] = (u_char) s->gamma_table[0][j];
|
||||
DBG (22, "set_density %d: gbuf[%d] = [%d]\n", 0, j, gbuf[j]);
|
||||
|
@ -578,8 +574,7 @@ do_gamma (CANON_Scanner * s)
|
|||
}
|
||||
}
|
||||
if ((status = set_density_curve (s->fd, 0, gbuf, &buf_size,
|
||||
transfer_data_type)) !=
|
||||
SANE_STATUS_GOOD)
|
||||
transfer_data_type)) != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (7, "SET_DENSITY_CURVE\n");
|
||||
sanei_scsi_close (s->fd);
|
||||
|
@ -593,14 +588,13 @@ do_gamma (CANON_Scanner * s)
|
|||
for all 3 colors red, green, blue */
|
||||
for (i = 1; i < 4; i++)
|
||||
{
|
||||
from = (s->val[OPT_CUSTOM_GAMMA_BIND].w == SANE_TRUE) ? 0 : i;
|
||||
from = (s->val[OPT_CUSTOM_GAMMA_BIND].w) ? 0 : i;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
if (neg == SANE_FALSE)
|
||||
if (!neg)
|
||||
{
|
||||
gbuf[j] = (u_char) s->gamma_table[from][j];
|
||||
DBG (22, "set_density %d: gbuf[%d] = [%d]\n", i, j,
|
||||
gbuf[j]);
|
||||
DBG (22, "set_density %d: gbuf[%d] = [%d]\n", i, j, gbuf[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -614,8 +608,7 @@ do_gamma (CANON_Scanner * s)
|
|||
else
|
||||
{
|
||||
if ((status = set_density_curve (s->fd, i, gbuf, &buf_size,
|
||||
transfer_data_type)) !=
|
||||
SANE_STATUS_GOOD)
|
||||
transfer_data_type)) != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (7, "SET_DENSITY_CURVE\n");
|
||||
sanei_scsi_close (s->fd);
|
||||
|
@ -646,10 +639,9 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
|
||||
for (dev = first_dev; dev; dev = dev->next)
|
||||
{
|
||||
if (strcmp (dev->sane.name, devnam) == 0)
|
||||
if (!strcmp (dev->sane.name, devnam))
|
||||
{
|
||||
if (devp)
|
||||
*devp = dev;
|
||||
if (devp) *devp = dev;
|
||||
return (SANE_STATUS_GOOD);
|
||||
}
|
||||
}
|
||||
|
@ -742,10 +734,8 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
sanei_scsi_close (fd);
|
||||
return (SANE_STATUS_INVAL);
|
||||
}
|
||||
for (i=0; i<buf_size; i++)
|
||||
{
|
||||
DBG(3, "scan mode trans byte[%d] = %d\n", i, ebuf[i]);
|
||||
}
|
||||
for (i = 0; i < buf_size; i++)
|
||||
DBG(3, "scan mode trans byte[%d] = %d\n", i, ebuf[i]);
|
||||
#endif
|
||||
|
||||
DBG (3, "attach: sending GET SCAN MODE for scan control conditions\n");
|
||||
|
@ -760,7 +750,7 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
}
|
||||
for (i = 0; i < buf_size; i++)
|
||||
{
|
||||
DBG (3, "scan mode byte[%lu] = %d\n", (u_long) i, ebuf[i]);
|
||||
DBG (3, "scan mode byte[%d] = %d\n", i, ebuf[i]);
|
||||
}
|
||||
|
||||
DBG (3, "attach: sending (extended) INQUIRY\n");
|
||||
|
@ -788,9 +778,7 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
return (SANE_STATUS_INVAL);
|
||||
}
|
||||
for (i = 0; i < buf_size; i++)
|
||||
{
|
||||
DBG (3, "scan mode control byte[%d] = %d\n", i, ebuf[i]);
|
||||
}
|
||||
DBG (3, "scan mode control byte[%d] = %d\n", i, ebuf[i]);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
@ -804,13 +792,10 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
sanei_scsi_close (fd);
|
||||
return (SANE_STATUS_INVAL);
|
||||
}
|
||||
for (i=0; i<buf_size; i++)
|
||||
{
|
||||
for (i = 0; i < buf_size; i++)
|
||||
DBG(3, "scan mode control byte[%d] = %d\n", i, ebuf[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
DBG (3, "attach: sending MODE SENSE\n");
|
||||
memset (mbuf, 0, sizeof (mbuf));
|
||||
buf_size = sizeof (mbuf);
|
||||
|
@ -863,7 +848,7 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
dev->adf.Status = ADF_STAT_NONE;
|
||||
dev->tpu.Status = TPU_STAT_NONE;
|
||||
dev->info.can_focus = SANE_TRUE;
|
||||
dev->info.can_autoexpose = SANE_FALSE;
|
||||
dev->info.can_autoexpose = SANE_TRUE;
|
||||
dev->info.can_calibrate = SANE_FALSE;
|
||||
dev->info.can_eject = SANE_TRUE;
|
||||
dev->info.can_mirror = SANE_TRUE;
|
||||
|
@ -878,7 +863,7 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
dev->adf.Status = ADF_STAT_NONE;
|
||||
dev->tpu.Status = TPU_STAT_NONE;
|
||||
dev->info.can_focus = SANE_TRUE;
|
||||
dev->info.can_autoexpose = SANE_FALSE;
|
||||
dev->info.can_autoexpose = SANE_TRUE;
|
||||
dev->info.can_calibrate = SANE_FALSE;
|
||||
dev->info.can_eject = SANE_TRUE;
|
||||
dev->info.can_mirror = SANE_TRUE;
|
||||
|
@ -905,8 +890,8 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
{
|
||||
dev->info.model = FB1200;
|
||||
dev->sane.type = "flatbed scanner";
|
||||
dev->adf.Status = ADF_STAT_ACTIVE;
|
||||
dev->tpu.Status = TPU_STAT_NONE;
|
||||
dev->adf.Status = ADF_STAT_INACTIVE;
|
||||
dev->tpu.Status = TPU_STAT_INACTIVE;
|
||||
dev->info.can_focus = SANE_FALSE;
|
||||
dev->info.can_autoexpose = SANE_FALSE;
|
||||
dev->info.can_calibrate = SANE_FALSE;
|
||||
|
@ -920,8 +905,8 @@ attach (const char *devnam, CANON_Device ** devp)
|
|||
{
|
||||
dev->info.model = CS3_600;
|
||||
dev->sane.type = "flatbed scanner";
|
||||
dev->adf.Status = ADF_STAT_ACTIVE;
|
||||
dev->tpu.Status = TPU_STAT_ACTIVE;
|
||||
dev->adf.Status = ADF_STAT_INACTIVE;
|
||||
dev->tpu.Status = TPU_STAT_INACTIVE;
|
||||
dev->info.can_focus = SANE_FALSE;
|
||||
dev->info.can_autoexpose = SANE_FALSE;
|
||||
dev->info.can_calibrate = SANE_FALSE;
|
||||
|
@ -1059,8 +1044,8 @@ do_cancel (CANON_Scanner * s)
|
|||
|
||||
if (s->fd >= 0)
|
||||
{
|
||||
if (s->val[OPT_EJECT_AFTERSCAN].w && ! (s->val[OPT_PREVIEW].w
|
||||
&& s->hw->info.is_filmscanner))
|
||||
if (s->val[OPT_EJECT_AFTERSCAN].w && !(s->val[OPT_PREVIEW].w
|
||||
&& s->hw->info.is_filmscanner))
|
||||
{
|
||||
DBG (3, "do_cancel: sending MEDIUM POSITION\n");
|
||||
status = medium_position (s->fd);
|
||||
|
@ -1088,7 +1073,7 @@ do_cancel (CANON_Scanner * s)
|
|||
s->reset_flag = 0;
|
||||
DBG (21, "do_cancel: reset_flag = %d\n", s->reset_flag);
|
||||
s->time0 = -1;
|
||||
DBG (21, "time0 = %ld\n", (u_long) s->time0);
|
||||
DBG (21, "time0 = %ld\n", s->time0);
|
||||
}
|
||||
|
||||
if (s->hw->info.model == FB1200)
|
||||
|
@ -1193,8 +1178,7 @@ init_options (CANON_Scanner * s)
|
|||
s->opt[OPT_NEGATIVE_TYPE].size = max_string_size (negative_filmtype_list);
|
||||
s->opt[OPT_NEGATIVE_TYPE].constraint_type = SANE_CONSTRAINT_STRING_LIST;
|
||||
s->opt[OPT_NEGATIVE_TYPE].constraint.string_list = negative_filmtype_list;
|
||||
s->opt[OPT_NEGATIVE_TYPE].cap |=
|
||||
(s->hw->info.is_filmscanner) ? 0 : SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_NEGATIVE_TYPE].cap |= SANE_CAP_INACTIVE;
|
||||
s->val[OPT_NEGATIVE_TYPE].s = strdup (negative_filmtype_list[0]);
|
||||
|
||||
/* Scanning speed */
|
||||
|
@ -1211,6 +1195,7 @@ init_options (CANON_Scanner * s)
|
|||
s->opt[OPT_SCANNING_SPEED].cap &= ~SANE_CAP_SOFT_SELECT;
|
||||
s->val[OPT_SCANNING_SPEED].s = strdup (scanning_speed_list[0]);
|
||||
|
||||
|
||||
/* "Resolution" group: */
|
||||
s->opt[OPT_RESOLUTION_GROUP].title = "Scan Resolution";
|
||||
s->opt[OPT_RESOLUTION_GROUP].desc = "";
|
||||
|
@ -1253,10 +1238,8 @@ init_options (CANON_Scanner * s)
|
|||
|
||||
/* go to minimum resolution by dividing by 2 */
|
||||
while (iRes >= s->hw->info.xres_range.min)
|
||||
{
|
||||
iRes /= 2;
|
||||
}
|
||||
/* fill array upto maximum resolution */
|
||||
iRes /= 2;
|
||||
/* fill array up to maximum resolution */
|
||||
while (iRes < s->hw->info.xres_range.max)
|
||||
{
|
||||
iRes *= 2;
|
||||
|
@ -1264,7 +1247,6 @@ init_options (CANON_Scanner * s)
|
|||
}
|
||||
s->xres_word_list[0] = iCnt;
|
||||
s->val[OPT_X_RESOLUTION].w = s->xres_word_list[2];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1293,10 +1275,8 @@ init_options (CANON_Scanner * s)
|
|||
|
||||
/* go to minimum resolution by dividing by 2 */
|
||||
while (iRes >= s->hw->info.yres_range.min)
|
||||
{
|
||||
iRes /= 2;
|
||||
}
|
||||
/* fill array upto maximum resolution */
|
||||
iRes /= 2;
|
||||
/* fill array up to maximum resolution */
|
||||
while (iRes < s->hw->info.yres_range.max)
|
||||
{
|
||||
iRes *= 2;
|
||||
|
@ -1341,7 +1321,7 @@ init_options (CANON_Scanner * s)
|
|||
s->opt[OPT_FOCUS].name = "focus";
|
||||
s->opt[OPT_FOCUS].title = "Manual focus position";
|
||||
s->opt[OPT_FOCUS].desc =
|
||||
"Set the optical system's focus position by hand. The default position is 128.";
|
||||
"Set the optical system's focus position by hand (default: 128).";
|
||||
s->opt[OPT_FOCUS].type = SANE_TYPE_INT;
|
||||
s->opt[OPT_FOCUS].unit = SANE_UNIT_NONE;
|
||||
s->opt[OPT_FOCUS].constraint_type = SANE_CONSTRAINT_RANGE;
|
||||
|
@ -1433,7 +1413,7 @@ init_options (CANON_Scanner * s)
|
|||
s->opt[OPT_HILITE_R].cap |= SANE_CAP_INACTIVE;
|
||||
s->val[OPT_HILITE_R].w = 255;
|
||||
|
||||
/* shadow point for red */
|
||||
/* shadow point for red */
|
||||
s->opt[OPT_SHADOW_R].name = SANE_NAME_SHADOW_R;
|
||||
s->opt[OPT_SHADOW_R].title = SANE_TITLE_SHADOW_R;
|
||||
s->opt[OPT_SHADOW_R].desc = SANE_DESC_SHADOW_R;
|
||||
|
@ -1454,7 +1434,7 @@ init_options (CANON_Scanner * s)
|
|||
s->opt[OPT_HILITE_G].constraint.range = &s->hw->info.HiliteG_range;
|
||||
s->val[OPT_HILITE_G].w = 255;
|
||||
|
||||
/* shadow point for green */
|
||||
/* shadow point for green */
|
||||
s->opt[OPT_SHADOW_G].name = SANE_NAME_SHADOW;
|
||||
s->opt[OPT_SHADOW_G].title = SANE_TITLE_SHADOW;
|
||||
s->opt[OPT_SHADOW_G].desc = SANE_DESC_SHADOW;
|
||||
|
@ -1475,7 +1455,7 @@ init_options (CANON_Scanner * s)
|
|||
s->opt[OPT_HILITE_B].cap |= SANE_CAP_INACTIVE;
|
||||
s->val[OPT_HILITE_B].w = 255;
|
||||
|
||||
/* shadow point for blue */
|
||||
/* shadow point for blue */
|
||||
s->opt[OPT_SHADOW_B].name = SANE_NAME_SHADOW_B;
|
||||
s->opt[OPT_SHADOW_B].title = SANE_TITLE_SHADOW_B;
|
||||
s->opt[OPT_SHADOW_B].desc = SANE_DESC_SHADOW_B;
|
||||
|
@ -1828,29 +1808,9 @@ do_focus (CANON_Scanner * s)
|
|||
}
|
||||
DBG (3, "focus point before autofocus : %d\n", ebuf[3]);
|
||||
|
||||
if (s->val[OPT_AF].w == SANE_TRUE) /* autofocus */
|
||||
{
|
||||
if (s->hw->info.model == FS2710)
|
||||
status = execute_auto_focus_FS2710 (s->fd, AUTO_FOCUS,
|
||||
NO_AUTO_EXPOSURE, 128);
|
||||
else
|
||||
status = execute_auto_focus (s->fd, AUTO_FOCUS,
|
||||
(s->scanning_speed == 0) ? AUTO_SCAN_SPEED
|
||||
: NO_AUTO_SCAN_SPEED,
|
||||
(s->AE == 0) ? NO_AUTO_EXPOSURE : AUTO_EXPOSURE, 0);
|
||||
}
|
||||
else /* manual focus */
|
||||
{
|
||||
if (s->hw->info.model == FS2710)
|
||||
status = execute_auto_focus_FS2710 (s->fd, MANUAL_FOCUS,
|
||||
NO_AUTO_EXPOSURE, s->val[OPT_FOCUS].w);
|
||||
else
|
||||
status = execute_auto_focus (s->fd, MANUAL_FOCUS,
|
||||
(s->scanning_speed == 0) ? AUTO_SCAN_SPEED
|
||||
: NO_AUTO_SCAN_SPEED,
|
||||
(s->AE == 0) ? NO_AUTO_EXPOSURE : AUTO_EXPOSURE,
|
||||
s->val[OPT_FOCUS].w);
|
||||
}
|
||||
status = execute_auto_focus (s->fd, s->val[OPT_AF].w,
|
||||
(s->scanning_speed == 0 && !s->RIF && s->hw->info.model == CS2700),
|
||||
(int) s->AE, s->val[OPT_FOCUS].w);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (7, "execute_auto_focus failed\n");
|
||||
|
|
|
@ -57,16 +57,6 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define NO_FOCUS 0
|
||||
#define AUTO_FOCUS 1
|
||||
#define MANUAL_FOCUS 2
|
||||
|
||||
#define NO_AUTO_SCAN_SPEED 0
|
||||
#define AUTO_SCAN_SPEED 1
|
||||
|
||||
#define NO_AUTO_EXPOSURE 0
|
||||
#define AUTO_EXPOSURE 1
|
||||
|
||||
#define AUTO_DOC_FEEDER_UNIT 0x01
|
||||
#define TRANSPARENCY_UNIT 0x02
|
||||
#define TRANSPARENCY_UNIT_FB1200 0x03
|
||||
|
|
Ładowanie…
Reference in New Issue