backend/canon-sane.c, backend/canon-scsi.c, backend/canon.c,

backend/canon.h, doc/sane-canon.man,
doc/descriptions/canon.desc: added support for FB620S and
and FS2700, by Mitsuru Okaniwa <m-okaniwa@bea.hi-ho.ne.jp>
and Ulrich Deiters <ukd@xenon.pc.Uni-Koeln.DE>

Abel
DEVEL_2_0_BRANCH-1
Abel Deuring 2002-04-21 10:29:18 +00:00
rodzic 95c4c5ce82
commit 33846a6c94
6 zmienionych plików z 3256 dodań i 2105 usunięć

Plik diff jest za duży Load Diff

Wyświetl plik

@ -52,7 +52,7 @@ test_unit_ready (int fd)
DBG (31, ">> test_unit_ready\n");
memset (cmd, 0, sizeof (cmd));
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< test_unit_ready\n");
return (status);
@ -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;
@ -69,7 +69,7 @@ request_sense (int fd, void *buf, size_t *buf_size)
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x03;
cmd[4] = 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, "<< request_sense\n");
return (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;
@ -112,7 +112,7 @@ mode_select (int fd)
cmd[6 + 5] = 6;
cmd[6 + 8] = 0x02;
cmd[6 + 9] = 0x58;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< mode_select\n");
return (status);
@ -129,7 +129,7 @@ reserve_unit (int fd)
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x16;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< reserve_unit\n");
return (status);
@ -146,7 +146,7 @@ release_unit (int fd)
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x17;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< release_unit\n");
return (status);
@ -154,7 +154,7 @@ 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];
@ -181,13 +181,13 @@ scan (int fd)
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x1b;
cmd[4] = 1;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< scan\n");
return (status);
}
#ifdef IMPLEMENT_ALL_SCANNER_SCSI_COMMANDS
/* #ifdef IMPLEMENT_ALL_SCANNER_SCSI_COMMANDS */
static SANE_Status
send_diagnostic (int fd)
{
@ -198,32 +198,32 @@ send_diagnostic (int fd)
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x1d;
cmd[1] = 4;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< send_diagnostic\n");
return (status);
}
#endif
/* #endif */
static SANE_Status
set_window (int fd, void *data)
{
static u_char cmd[10 + 72];
static u_char cmd[10];
int status;
DBG (31, ">> set_window\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x24;
cmd[8] = 72;
memcpy (cmd + 10, data, 72);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), data, 72, NULL, NULL);
DBG (31, "<< set_window\n");
return (status);
}
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;
@ -233,14 +233,14 @@ get_window (int fd, void *buf, size_t *buf_size)
cmd[0] = 0x25;
cmd[1] = 1;
cmd[8] = 72;
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_window\n");
return (status);
}
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;
@ -251,7 +251,7 @@ read_data (int fd, void *buf, size_t *buf_size)
cmd[6] = *buf_size >> 16;
cmd[7] = *buf_size >> 8;
cmd[8] = *buf_size;
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, "<< read_data\n");
return (status);
@ -266,7 +266,7 @@ medium_position (int fd)
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x31;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< medium_position\n");
return (status);
@ -282,7 +282,7 @@ execute_shading (int fd)
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0xe2;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), NULL, NULL);
DBG (31, "<< execute shading\n");
return (status);
@ -290,8 +290,7 @@ execute_shading (int fd)
#endif
static SANE_Status
execute_auto_focus (int fd, int mode, int speed, int AE, int count,
void *buf, size_t *buf_size)
execute_auto_focus (int fd, int mode, int speed, int AE, int count)
{
static u_char cmd[10];
int status;
@ -304,7 +303,7 @@ execute_auto_focus (int fd, int mode, int speed, int AE, int count,
cmd[1] = mode;
cmd[2] = (speed << 6) | AE;
cmd[4] = count;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, buf_size);
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
DBG (7, "<< execute auto focus\n");
return (status);
@ -320,16 +319,13 @@ set_adf_mode (int fd, u_char priority)
cmd[0] = 0xd4;
cmd[4] = 0x01;
status = sanei_scsi_cmd2 (fd, cmd, 6, 0, 0, 0, 0);
if (status == SANE_STATUS_GOOD)
{
status = sanei_scsi_cmd (fd, &priority, 1, 0, 0);
}
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), &priority, 1, NULL, NULL);
return (status);
}
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;
@ -340,23 +336,23 @@ get_scan_mode (int fd, u_char page, void *buf, size_t *buf_size)
cmd[2] = page;
switch (page)
{
{
case AUTO_DOC_FEEDER_UNIT:
case TRANSPARENCY_UNIT:
cmd[4] = 0x0C + PageLen;
break;
break;
case SCAN_CONTROL_CONDITIONS :
case SCAN_CONTROL_CONDITIONS:
cmd[4] = 0x14 + PageLen;
break;
break;
default:
cmd[4] = 0x24 + PageLen;
break;
}
break;
}
DBG (31, "get scan mode: cmd[4]='0x%0X'\n", cmd[4]);
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), 0, 0, buf, buf_size);
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
DBG (31, "<< get scan mode\n");
return (status);
@ -366,53 +362,58 @@ get_scan_mode (int fd, u_char page, void *buf, size_t *buf_size)
static SANE_Status
define_scan_mode (int fd, u_char page, void *data)
{
static u_char cmd[6+20];
int status, i, cmdlen;
static u_char cmd[6];
u_char pdata[20];
size_t i;
int status, pdatalen;
DBG (31, ">> define scan mode\n");
memset (cmd, 0, sizeof (cmd));
memset (pdata, 0, sizeof (data));
cmd[0] = 0xd6;
cmd[1] = 0x10;
cmd[4] = (page == TRANSPARENCY_UNIT) ? 0x0c :
(page == SCAN_CONTROL_CONDITIONS) ? 0x14 : 0x24;
(page == SCAN_CONTROL_CONDITIONS) ? 0x14 : 0x24;
memcpy (cmd + 10, data, (page == TRANSPARENCY_UNIT) ? 8 :
(page == SCAN_CONTROL_CONDITIONS) ? 16 : 24);
memcpy (pdata + 4, data, (page == TRANSPARENCY_UNIT) ? 8 :
(page == SCAN_CONTROL_CONDITIONS) ? 16 : 24);
for(i = 0; i < sizeof(cmd); i++)
{
DBG (31, "define scan mode: cmd[%d]='0x%0X'\n", i, cmd[i]);
}
cmdlen = (page == TRANSPARENCY_UNIT) ? 18 :
(page == SCAN_CONTROL_CONDITIONS) ? 26 : 34;
for (i = 0; i < sizeof (cmd); i++)
{
DBG (31, "define scan mode: cmd[%d]='0x%0X'\n", i, cmd[i]);
}
status = sanei_scsi_cmd2 (fd, cmd, 6, &cmd[10], cmdlen-6, 0, 0);
for (i = 0; i < sizeof (pdata); i++)
{
DBG (31, "define scan mode: pdata[%d]='0x%0X'\n", i, pdata[i]);
}
pdatalen = (page == TRANSPARENCY_UNIT) ? 12 :
(page == SCAN_CONTROL_CONDITIONS) ? 20 : 28;
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];
static u_char tbuf[256];
int status, i;
int status;
DBG (31, ">> get_density_curve\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x28;
cmd[2] = 0x03;
cmd[2] = transfer_data_type;
cmd[4] = component;
cmd[5] = 0;
cmd[6] = 0;
cmd[7] = 1;
cmd[8] = 0;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), tbuf, buf_size);
for (i=0; i<256; i++)
{
((u_char *)buf)[i] = tbuf[i];
}
cmd[6] = ((*buf_size) >> 16) & 0xff;
cmd[7] = ((*buf_size) >> 8) & 0xff;
cmd[8] = (*buf_size) & 0xff;
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
DBG (31, "<< get_density_curve\n");
return (status);
@ -420,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;
@ -442,26 +443,24 @@ 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+256];
int status, i;
static u_char cmd[10];
int status;
DBG (31, ">> set_density_curve\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0x2a;
cmd[2] = 0x03;
cmd[2] = transfer_data_type;
cmd[4] = component;
cmd[5] = 0;
cmd[6] = 0;
cmd[7] = 1;
cmd[8] = 0;
cmd[6] = ((*buf_size) >> 16) & 0xff;
cmd[7] = ((*buf_size) >> 8) & 0xff;
cmd[8] = (*buf_size) & 0xff;
for (i=0; i<256; i++)
{
cmd[i+10] = ((u_char *)buf)[i];
}
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
status =
sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), buf, *buf_size, NULL, NULL);
DBG (31, "<< set_density_curve\n");
return (status);
@ -491,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;
@ -510,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;
@ -521,14 +520,14 @@ get_film_status (int fd, void *buf, size_t *buf_size)
cmd[6] = 0;
cmd[7] = 0;
cmd[8] = 4;
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 film status\n");
return (status);
}
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;
@ -543,3 +542,177 @@ get_data_status (int fd, void *buf, size_t *buf_size)
return (status);
}
/*************** modification for FB620S ***************/
static SANE_Status
reset_scanner (int fd)
{
static u_char cmd[6];
int status;
DBG (31, ">> reset_scanner\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0xc1;
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, NULL, NULL);
DBG (31, "<< reset_scanner \n");
return (status);
}
static SANE_Status
execute_calibration (int fd)
{
static u_char cmd[6];
u_char data[2];
int status;
DBG (31, ">> execute_calibration\n");
memset (cmd, 0, sizeof (cmd));
memset (data, 0, sizeof (data));
cmd[0] = 0xc2;
cmd[4] = 2;
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), data, sizeof (data),
NULL, NULL);
DBG (31, "<< execute_calibration\n");
return (status);
}
static SANE_Status
get_calibration_status (int fd, void *buf, size_t * buf_size)
{
static u_char cmd[6];
int status;
DBG (31, ">> get_calibration_status\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0xc3;
cmd[4] = *buf_size;
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
DBG (31, "<< get_calibration_status\n");
return (status);
}
/* static SANE_Status
get_switch_status (int fd, void *buf, size_t *buf_size)
{
static u_char cmd[6];
int status;
DBG (31, ">> get_switch_status\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0xc4;
cmd[4] = 2;
status = sanei_scsi_cmd2 (fd, cmd, sizeof (cmd), NULL, 0, buf, buf_size);
DBG (31, "<< get_switch_status\n");
return (status);
} */
/* static SANE_Status
wait_ready(int fd)
{
SANE_Status status;
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;
}
sleep(3);
}
return(status);
} */
/**************************************************************************/
/* As long as we do not know how this scanner stores its density curves,
we do the gamma correction with a 8 <--> 12 bit translation table
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)
{
CANON_Scanner *s = handle;
int i;
for (i = 0; i < 256; i++)
*buf++ = s->gamma_map[component][i << 4];
*buf_size = 256;
return (SANE_STATUS_GOOD);
}
static SANE_Status
set_density_curve_fs2710 (SANE_Handle handle, int component, u_char * buf)
{
CANON_Scanner *s = handle;
int i, j, hi, lo;
u_char *p;
for (i = 1, hi = *buf++, p = &s->gamma_map[component][0]; i <= 256; i++)
{
lo = hi;
hi = (i < 256) ? *buf++ : 2 * *(buf - 1) - *(buf - 2);
if (hi > 255)
hi = 255;
for (j = 0; j < 16; j++) /* do a linear interpolation */
*p++ = (u_char) (lo + ((double) ((hi - lo) * j)) / 16.0 + 0.5);
}
return (SANE_STATUS_GOOD);
}
static SANE_Status
set_parameters_fs2710 (SANE_Handle handle)
{
CANON_Scanner *s = handle;
int i, j, invert, shadow[4], hilite[4];
double x, b, c;
shadow[1] = s->ShadowR << 4;
shadow[2] = s->ShadowG << 4;
shadow[3] = s->ShadowB << 4;
hilite[1] = s->HiliteR << 4;
hilite[2] = s->HiliteG << 4;
hilite[3] = s->HiliteB << 4;
c = ((double) s->contrast) / 128.0;
b = ((double) (s->brightness - 128)) / 128.0;
invert = strcmp (filmtype_list[1], s->val[OPT_NEGATIVE].s);
for (i = 1; i < 4; i++)
{
for (j = 0; j < 4096; j++)
{
if (j <= shadow[i])
s->gamma_map[i][j] = (u_char) ((s->brightness >= 128) ?
2 * s->brightness - 256 : 0);
else if (j < hilite[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)));
}
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];
}
}
return (SANE_STATUS_GOOD);
}
/**************************************************************************/

Plik diff jest za duży Load Diff

Wyświetl plik

@ -81,286 +81,325 @@
#define ADF_STAT_ACTIVE 2
#define ADF_STAT_DISABLED 3
#define ADF_Status (4+2) /* byte positioning */
#define ADF_Settings (4+3) /* in data block */
#define ADF_Status (4+2) /* byte positioning */
#define ADF_Settings (4+3) /* in data block */
#define ADF_NOT_PRESENT 0x01 /* bit selection */
#define ADF_PROBLEM 0x0E /* from bytes in */
#define ADF_PRIORITY 0x03 /* data block. */
#define ADF_FEEDER 0x04 /* */
#define ADF_NOT_PRESENT 0x01 /* bit selection */
#define ADF_PROBLEM 0x0E /* from bytes in */
#define ADF_PRIORITY 0x03 /* data block. */
#define ADF_FEEDER 0x04 /* */
#define TPU_STAT_NONE 0
#define TPU_STAT_INACTIVE 1
#define TPU_STAT_ACTIVE 2
#define CS3_600 0 /* CanoScan 300/600 */
#define CS2700 1 /* CanoScan 2700F */
#define CS3_600 0 /* CanoScan 300/600 */
#define CS2700 1 /* CanoScan 2700F */
#define FB620 2 /* CanoScan FB620S */
#define FS2710 3 /* CanoScan FS2710 */
#ifndef MAX
#define MAX(A,B) (((A) > (B))? (A) : (B))
#endif
#ifndef MIN
#define MIN(A,B) (((A) < (B))? (A) : (B))
#endif
typedef struct
{
SANE_Int Status; /* Auto Document Feeder Unit Status */
SANE_Int Problem; /* ADF Problems list */
SANE_Int Priority; /* ADF Priority setting */
SANE_Int Feeder; /* ADF Feeder setting */
SANE_Int Status; /* Auto Document Feeder Unit Status */
SANE_Int Problem; /* ADF Problems list */
SANE_Int Priority; /* ADF Priority setting */
SANE_Int Feeder; /* ADF Feeder setting */
} CANON_ADF;
}
CANON_ADF;
typedef struct
{
SANE_Int Status; /* Transparency Unit Status */
SANE_Bool PosNeg; /* Negative/Positive Film */
SANE_Int Transparency; /* TPU Transparency */
SANE_Int ControlMode; /* TPU Density Control Mode */
SANE_Int FilmType; /* TPU Film Type */
SANE_Int Status; /* Transparency Unit Status */
SANE_Bool PosNeg; /* Negative/Positive Film */
SANE_Int Transparency; /* TPU Transparency */
SANE_Int ControlMode; /* TPU Density Control Mode */
SANE_Int FilmType; /* TPU Film Type */
} CANON_TPU;
}
CANON_TPU;
typedef enum
{
OPT_NUM_OPTS = 0,
{
OPT_NUM_OPTS = 0,
OPT_PAGE,
OPT_PAGE,
OPT_MODE_GROUP,
OPT_MODE,
OPT_NEGATIVE, /* Reverse image format */
OPT_NEGATIVE_TYPE, /* Negative film type */
OPT_SCANNING_SPEED,
OPT_RESOLUTION_GROUP,
OPT_RESOLUTION_BIND,
OPT_HW_RESOLUTION_ONLY,
OPT_X_RESOLUTION,
OPT_Y_RESOLUTION,
OPT_MODE_GROUP,
OPT_MODE,
OPT_NEGATIVE, /* Reverse image format */
OPT_NEGATIVE_TYPE, /* Negative film type */
OPT_SCANNING_SPEED,
OPT_ENHANCEMENT_GROUP,
OPT_BRIGHTNESS,
OPT_CONTRAST,
OPT_THRESHOLD,
OPT_RESOLUTION_GROUP,
OPT_RESOLUTION_BIND,
OPT_HW_RESOLUTION_ONLY,
OPT_X_RESOLUTION,
OPT_Y_RESOLUTION,
OPT_MIRROR,
OPT_ENHANCEMENT_GROUP,
OPT_BRIGHTNESS,
OPT_CONTRAST,
OPT_THRESHOLD,
OPT_CUSTOM_GAMMA, /* use custom gamma tables? */
OPT_CUSTOM_GAMMA_BIND,
/* The gamma vectors MUST appear in the order gray, red, green, blue. */
OPT_GAMMA_VECTOR,
OPT_GAMMA_VECTOR_R,
OPT_GAMMA_VECTOR_G,
OPT_GAMMA_VECTOR_B,
OPT_AE, /* Auto Exposure */
OPT_MIRROR,
OPT_EJECT_GROUP,
OPT_EJECT_AFTERSCAN,
OPT_EJECT_BEFOREEXIT,
OPT_EJECT_NOW,
OPT_CUSTOM_GAMMA, /* use custom gamma tables? */
OPT_CUSTOM_GAMMA_BIND,
/* The gamma vectors MUST appear in the order gray, red, green, blue. */
OPT_GAMMA_VECTOR,
OPT_GAMMA_VECTOR_R,
OPT_GAMMA_VECTOR_G,
OPT_GAMMA_VECTOR_B,
OPT_AE, /* Auto Exposure */
OPT_FOCUS_GROUP,
OPT_AF, /* Auto Focus */
OPT_AF_ONCE, /* Auto Focus only once between ejects*/
OPT_FOCUS, /* Manual focus position */
OPT_CALIBRATION_GROUP, /* Calibration for FB620S */
OPT_CALIBRATION_NOW, /* Execute Calibration now for FB620S */
OPT_SCANNER_SELF_DIAGNOSTIC, /* Self diagnostic for FB620S */
OPT_RESET_SCANNER, /* Reset scanner for FB620S */
OPT_MARGINS_GROUP, /* scan margins */
OPT_TL_X, /* top-left x */
OPT_TL_Y, /* top-left y */
OPT_BR_X, /* bottom-right x */
OPT_BR_Y, /* bottom-right y */
OPT_EJECT_GROUP,
OPT_EJECT_AFTERSCAN,
OPT_EJECT_BEFOREEXIT,
OPT_EJECT_NOW,
OPT_COLORS_GROUP,
OPT_HNEGATIVE, /* Reverse image format */
OPT_BIND_HILO, /* Same values vor highlight and shadow
points for red, green, blue */
OPT_HILITE_R, /* highlight point for red */
OPT_SHADOW_R, /* shadow point for red */
OPT_HILITE_G, /* highlight point for green */
OPT_SHADOW_G, /* shadow point for green */
OPT_HILITE_B, /* highlight point for blue */
OPT_SHADOW_B, /* shadow point for blue */
OPT_FOCUS_GROUP,
OPT_AF, /* Auto Focus */
OPT_AF_ONCE, /* Auto Focus only once between ejects */
OPT_FOCUS, /* Manual focus position */
OPT_ADF_GROUP, /* to allow display of options. */
OPT_FLATBED_ONLY, /* in case you have a sheetfeeder
OPT_MARGINS_GROUP, /* scan margins */
OPT_TL_X, /* top-left x */
OPT_TL_Y, /* top-left y */
OPT_BR_X, /* bottom-right x */
OPT_BR_Y, /* bottom-right y */
OPT_COLORS_GROUP,
OPT_HNEGATIVE, /* Reverse image format */
OPT_BIND_HILO, /* Same values vor highlight and shadow
points for red, green, blue */
OPT_HILITE_R, /* highlight point for red */
OPT_SHADOW_R, /* shadow point for red */
OPT_HILITE_G, /* highlight point for green */
OPT_SHADOW_G, /* shadow point for green */
OPT_HILITE_B, /* highlight point for blue */
OPT_SHADOW_B, /* shadow point for blue */
OPT_ADF_GROUP, /* to allow display of options. */
OPT_FLATBED_ONLY, /* in case you have a sheetfeeder
but don't want to use it. */
OPT_TPU_GROUP,
OPT_TPU_ON,
OPT_TPU_PN,
OPT_TPU_DCM,
OPT_TPU_TRANSPARENCY,
OPT_TPU_FILMTYPE,
OPT_TPU_GROUP,
OPT_TPU_ON,
OPT_TPU_PN,
OPT_TPU_DCM,
OPT_TPU_TRANSPARENCY,
OPT_TPU_FILMTYPE,
OPT_PREVIEW,
OPT_PREVIEW,
/* must come last: */
NUM_OPTIONS
}
/* must come last: */
NUM_OPTIONS
}
CANON_Option;
typedef union
{
SANE_Word w;
SANE_Word *wa; /* word array */
SANE_String s;
}
{
SANE_Word w;
SANE_Word *wa; /* word array */
SANE_String s;
}
Option_Value;
typedef struct CANON_Info
{
int model;
{
int model;
SANE_Range xres_range;
SANE_Range yres_range;
SANE_Range x_range;
SANE_Range y_range;
SANE_Range brightness_range;
SANE_Range contrast_range;
SANE_Range threshold_range;
SANE_Range HiliteR_range;
SANE_Range ShadowR_range;
SANE_Range HiliteG_range;
SANE_Range ShadowG_range;
SANE_Range HiliteB_range;
SANE_Range ShadowB_range;
SANE_Range focus_range;
SANE_Range xres_range;
SANE_Range yres_range;
SANE_Range x_range;
SANE_Range y_range;
SANE_Range brightness_range;
SANE_Range contrast_range;
SANE_Range threshold_range;
SANE_Range HiliteR_range;
SANE_Range ShadowR_range;
SANE_Range HiliteG_range;
SANE_Range ShadowG_range;
SANE_Range HiliteB_range;
SANE_Range ShadowB_range;
SANE_Range focus_range;
SANE_Range x_adf_range;
SANE_Range y_adf_range;
SANE_Int xres_default;
SANE_Int yres_default;
SANE_Int bmu;
SANE_Int mud;
SANE_Range TPU_Transparency_range;
SANE_Int TPU_Stat;
SANE_Range x_adf_range;
SANE_Range y_adf_range;
SANE_Int xres_default;
SANE_Int yres_default;
SANE_Int bmu;
SANE_Int mud;
SANE_Range TPU_Transparency_range;
SANE_Int TPU_Stat;
}
}
CANON_Info;
typedef struct CANON_Device
{
struct CANON_Device *next;
SANE_Device sane;
CANON_Info info;
CANON_ADF adf;
CANON_TPU tpu;
}
{
struct CANON_Device *next;
SANE_Device sane;
CANON_Info info;
CANON_ADF adf;
CANON_TPU tpu;
}
CANON_Device;
typedef struct CANON_Scanner
{
struct CANON_Scanner *next;
int fd;
CANON_Device *hw;
SANE_Option_Descriptor opt[NUM_OPTIONS];
Option_Value val[NUM_OPTIONS];
char *sense_str; /* sense string */
SANE_Int gamma_table[4][256];
SANE_Parameters params;
SANE_Bool AF_NOW; /* To keep track of when to do AF */
{
struct CANON_Scanner *next;
int fd;
CANON_Device *hw;
SANE_Option_Descriptor opt[NUM_OPTIONS];
Option_Value val[NUM_OPTIONS];
char *sense_str; /* sense string */
SANE_Int gamma_table[4][256];
SANE_Parameters params;
SANE_Bool AF_NOW; /* To keep track of when to do AF */
SANE_Int xres;
SANE_Int yres;
SANE_Int ulx;
SANE_Int uly;
SANE_Int width;
SANE_Int length;
SANE_Int brightness;
SANE_Int contrast;
SANE_Int threshold;
SANE_Int image_composition;
SANE_Int bpp;
SANE_Bool RIF; /* Reverse Image Format */
SANE_Int negative_filmtype;
SANE_Int scanning_speed;
SANE_Bool GRC; /* Gray Response Curve */
SANE_Bool Mirror;
SANE_Bool AE; /* Auto Exposure */
SANE_Int HiliteR;
SANE_Int ShadowR;
SANE_Int HiliteG;
SANE_Int ShadowG;
SANE_Int HiliteB;
SANE_Int ShadowB;
SANE_Int xres;
SANE_Int yres;
SANE_Int ulx;
SANE_Int uly;
SANE_Int width;
SANE_Int length;
SANE_Int brightness;
SANE_Int contrast;
SANE_Int threshold;
SANE_Int image_composition;
SANE_Int bpp;
SANE_Bool RIF; /* Reverse Image Format */
SANE_Int negative_filmtype;
SANE_Int scanning_speed;
SANE_Bool GRC; /* Gray Response Curve */
SANE_Bool Mirror;
SANE_Bool AE; /* Auto Exposure */
SANE_Int HiliteR;
SANE_Int ShadowR;
SANE_Int HiliteG;
SANE_Int ShadowG;
SANE_Int HiliteB;
SANE_Int ShadowB;
/* 990320, ss: array for fixed resolutions */
SANE_Word xres_word_list [8];
SANE_Word yres_word_list [8];
/* 990320, ss: array for fixed resolutions */
SANE_Word xres_word_list[8];
SANE_Word yres_word_list[8];
size_t bytes_to_read;
int scanning;
}
SANE_Byte *inbuffer; /* modification for FB620S */
SANE_Byte *outbuffer; /* modification for FB620S */
SANE_Int buf_used; /* modification for FB620S */
SANE_Int buf_pos; /* modification for FB620S */
time_t time0; /* modification for FB620S */
time_t time1; /* modification for FB620S */
int switch_preview; /* modification for FB620S */
int reset_flag; /* modification for FB620S */
size_t bytes_to_read;
int scanning;
u_char gamma_map[4][4096]; /* for FS2710: */
int colour; /* index to gamma_map */
int auxbuf_len; /* size of auxiliary buffer */
u_char *auxbuf;
}
CANON_Scanner;
char *option_name[]=
{
"OPT_NUM_OPTS",
char *option_name[] = {
"OPT_NUM_OPTS",
"OPT_PAGE",
"OPT_PAGE",
"OPT_MODE_GROUP",
"OPT_MODE",
"OPT_NEGATIVE",
"OPT_NEGATIVE_TYPE",
"OPT_SCANNING_SPEED",
"OPT_MODE_GROUP",
"OPT_MODE",
"OPT_NEGATIVE",
"OPT_NEGATIVE_TYPE",
"OPT_SCANNING_SPEED",
"OPT_RESOLUTION_GROUP",
"OPT_RESOLUTION_BIND",
"OPT_HW_RESOLUTION_ONLY",
"OPT_X_RESOLUTION",
"OPT_Y_RESOLUTION",
"OPT_RESOLUTION_GROUP",
"OPT_RESOLUTION_BIND",
"OPT_HW_RESOLUTION_ONLY",
"OPT_X_RESOLUTION",
"OPT_Y_RESOLUTION",
"OPT_ENHANCEMENT_GROUP",
"OPT_BRIGHTNESS",
"OPT_CONTRAST",
"OPT_THRESHOLD",
"OPT_ENHANCEMENT_GROUP",
"OPT_BRIGHTNESS",
"OPT_CONTRAST",
"OPT_THRESHOLD",
"OPT_MIRROR",
"OPT_MIRROR",
"OPT_CUSTOM_GAMMA",
"OPT_CUSTOM_GAMMA_BIND",
"OPT_GAMMA_VECTOR",
"OPT_GAMMA_VECTOR_R",
"OPT_GAMMA_VECTOR_G",
"OPT_GAMMA_VECTOR_B",
"OPT_AE",
"OPT_CUSTOM_GAMMA",
"OPT_CUSTOM_GAMMA_BIND",
"OPT_GAMMA_VECTOR",
"OPT_GAMMA_VECTOR_R",
"OPT_GAMMA_VECTOR_G",
"OPT_GAMMA_VECTOR_B",
"OPT_AE",
"OPT_EJECT_GROUP",
"OPT_EJECT_AFTERSCAN",
"OPT_EJECT_BEFOREEXIT",
"OPT_EJECT_NOW",
"OPT_CALIBRATION_GROUP",
"OPT_CALIBRATION_NOW",
"OPT_SCANNER_SELF_DIAGNOSTIC",
"OPT_RESET_SCANNER",
"OPT_FOCUS_GROUP",
"OPT_AF",
"OPT_AF_ONCE",
"OPT_FOCUS",
"OPT_EJECT_GROUP",
"OPT_EJECT_AFTERSCAN",
"OPT_EJECT_BEFOREEXIT",
"OPT_EJECT_NOW",
"OPT_MARGINS_GROUP",
"OPT_TL_X",
"OPT_TL_Y",
"OPT_BR_X",
"OPT_BR_Y",
"OPT_FOCUS_GROUP",
"OPT_AF",
"OPT_AF_ONCE",
"OPT_FOCUS",
"OPT_COLORS_GROUP",
"OPT_HNEGATIVE",
"OPT_BIND_HILO",
"OPT_MARGINS_GROUP",
"OPT_TL_X",
"OPT_TL_Y",
"OPT_BR_X",
"OPT_BR_Y",
"OPT_HILITE_R",
"OPT_SHADOW_R",
"OPT_HILITE_G",
"OPT_SHADOW_G",
"OPT_HILITE_B",
"OPT_SHADOW_B",
"OPT_COLORS_GROUP",
"OPT_HNEGATIVE",
"OPT_BIND_HILO",
"OPT_TPU_GROUP",
"OPT_TPU_ON",
"OPT_TPU_PN",
"OPT_TPU_DCM",
"OPT_TPU_TRANSPARENCY",
"OPT_TPU_FILMTYPE",
"OPT_HILITE_R",
"OPT_SHADOW_R",
"OPT_HILITE_G",
"OPT_SHADOW_G",
"OPT_HILITE_B",
"OPT_SHADOW_B",
"OPT_PREVIEW",
"OPT_ADF_GROUP",
"OPT_FLATBED_ONLY",
"NUM_OPTIONS"
};
"OPT_TPU_GROUP",
"OPT_TPU_ON",
"OPT_TPU_PN",
"OPT_TPU_DCM",
"OPT_TPU_TRANSPARENCY",
"OPT_TPU_FILMTYPE",
"OPT_PREVIEW",
"NUM_OPTIONS"
};

Wyświetl plik

@ -10,7 +10,7 @@
:backend "canon" ; name of backend
:manpage "sane-canon"
:version "0.1" ; version of backend
:version "0.2" ; version of backend
:status :alpha ; :alpha, :beta, :stable, :new
:url "http://www.rzg.mpg.de/~mpd/sane/" ; backend home page
@ -24,10 +24,15 @@
:comment "1 pass; flatbed scanner"
:model "CanoScan 600" ; name models for above-specified mfg.
:interface "SCSI"
:model "CanoScan 620S" ; name models for above-specified mfg.
:interface "SCSI"
:comment "1 pass; flatbed scanner"
:model "CanoScan 2700F" ; name models for above-specified mfg.
:interface "SCSI"
:comment "1 pass; film scanner"
:model "CanoScan 2710" ; name models for above-specified mfg.
:interface "SCSI"
:comment "1 pass; 36bit film scanner"
; :comment and :url specifiers are optional after :mfg, :model, :desc,
; and at the top-level.

Wyświetl plik

@ -1,19 +1,23 @@
.TH sane-canon 5 "29 May 2001"
.TH sane-canon 5 "03 May 2001"
.IX sane-canon
.SH NAME
sane-canon - SANE backend for Canon flatbed scanners
sane-canon - SANE backend for Canon SCSI scanners
.SH DESCRIPTION
The
.B sane-canon
library implements a SANE (Scanner Access Now Easy) backend that
provides access to the following Canon flatbed scanners:
provides access to the following Canon flatbed and film scanners:
.PP
.RS
CanoScan 300
.br
CanoScan 600
.br
CanoScan 2700F
CanoScan FB620S
.br
CanoScan FS2700F
.br
CanoScan FS2710
.br
.RE
.PP
@ -27,42 +31,16 @@ I consider it extremely unprobable) that your scanner will be
damaged.
.PP
That said, TESTERS ARE WELCOME. Send your bug reports and comments to
Manuel Panea <mpd@rzg.mpg.de>.
Manuel Panea <mpd@rzg.mpg.de>; for questions concerning the FB620
contact Mitsuru Okaniwa <m-okaniwa@bea.hi-ho.ne.jp>, for the FS2710
Ulrich Deiters <ukd@xenon.pc.uni-koeln.de>.
.PP
.SH "DEVICE NAMES"
This backend expects device names of the form:
.PP
.RS
.I special
.RE
.PP
Where
.I special
is the path-name for the special device that corresponds to a
SCSI scanner. The special device name must be a generic SCSI device or a
symlink to such a device. The program
.IR sane-find-scanner
helps to find out the correct device. Under Linux, such a device name
could be
.I /dev/sga
or
.IR /dev/sge ,
for example. See sane-scsi(5) for details.
.SH CONFIGURATION
The contents of the
.I canon.conf
file is a list of device names that correspond to Canon
scanners. Empty lines and lines starting with a hash mark (#) are
ignored. Only one device name can be listed in
.IR canon.conf .
.SH TIPS
.SH TIPS (FS2700)
.PP
When scanning either slides or negatives, I found that I must set the
gamma value to something about 2.2 to 2.4 (I set the same value for all
three red, green, blue). Also, for slides, using "Auto Exposure" helps
a lot.
Scanning either slides or negatives has been found to require rather
large gamma corrections of about 2.2 to 2.4 (same value for red, green,
and blue). Also, for slides, using "Auto Exposure" helps a lot.
.PP
The "Auto Exposure" function for slides makes the scanner do a first
pass on the film to determine the Highlight and Shadow point
@ -70,25 +48,32 @@ values. The "Auto Focus" function triggers yet another pass to
determine the focus value. After that, the real scanning pass takes
place. The "Auto Exposure" function is not available for negatives yet.
.PP
Even after "Auto Focus", the image I get is often a bit too
blurred. I found that using the GIMP to do a
"Filter->Enhance->Sharpen" at about 40 to 60 improves the image
quite a bit. In fact, I find it so good that I might implement a
sharpen filter into the backend in the future.
Even with "Auto Focus" turned on, the scanned image is often a bit too
blurred. Using the GIMP to do a "Filter->Enhance->Sharpen" at about 40
to 60 improves the image considerably. It is likely that a sharpen filter
will be included in a future version of this backend.
.PP
The "native" scanner resolutions of the 2700F are the integer
sub-multiples of 2720 dpi, i.e. 1360, 680, 340 and 170. You can scan
at any other resolution, but you will notice that the image has
noticeably more jaggies that when using one of the "native"
resolutions.
sub-multiples of 2720 dpi, i.e. 1360, 680, 340 and 170. Scanning at
other resolutions is possible, but there will be noticeably more jaggies
in the image than when using one of the "native" resolutions.
.PP
.SH TIPS (FS2710)
.PP
Gamma corrections are done not by the scanner, but by the backend.
The scanner is always run in 12-bit mode. In "color" mode the image
data are corrected for gamma, shadow point, etc., and then truncated
to 8-bit intensities; the default gamma value is 2.5. In "raw" mode the
image data are exported without corrections as 16-bit intensities; this
mode can be recommended if extensive adjustments have to be made to a
picture (and if the frontend can handle 16-bit intensities).
.PP
Negatives are handled by simple color inversion and may require manual
removal of blue discoloration.
.PP
.SH FILES
.TP
.I @CONFIGDIR@/canon.conf
The backend configuration file (see also description of
.B SANE_CONFIG_DIR
below).
.TP
.I @LIBDIR@/libsane-canon.a
The static library implementing this backend.
.TP
@ -97,20 +82,6 @@ The shared library implementing this backend (present on systems that
support dynamic loading).
.SH ENVIRONMENT
.TP
.B SANE_CONFIG_DIR
This environment variable specifies the list of directories that may
contain the configuration file. Under UNIX, the directories are
separated by a colon (`:'), under OS/2, they are separated by a
semi-colon (`;'). If this variable is not set, the configuration file
is searched in two default directories: first, the current working
directory (".") and then in @CONFIGDIR@. If the value of the
environment variable ends with the directory separator character, then
the default directories are searched after the explicitly specified
directories. For example, setting
.B SANE_CONFIG_DIR
to "/tmp/config:" would result in directories "tmp/config", ".", and
"@CONFIGDIR@" being searched (in this order).
.TP
.B SANE_DEBUG_CANON
If the library was compiled with debug support enabled, this
environment variable controls the debug level for this backend. Higher
@ -120,13 +91,14 @@ Example:
export SANE_DEBUG_CANON=4
.SH "SEE ALSO"
sane(7), sane\-scsi(5), sane\-find\-scanner(1)
sane\-scsi(5)
.br
http://www.rzg.mpg.de/~mpd/sane/
.br
@DOCDIR@/canon/canon.install2700F.txt (installation of a CanoScan 2700F)
doc/canon.install2700F.txt (installation of a CanoScan 2700F
.br
.SH AUTHOR
Helmut Koeberle, Manuel Panea, and Markus Mertinat
Helmut Koeberle, Manuel Panea, and Markus Mertinat; FB620S support
by Mitsuru Okaniwa; FS2710 support by Ulrich Deiters
.br
Man page by Henning Meier-Geinitz (mostly based on canon.README)