kopia lustrzana https://gitlab.com/sane-project/backends
changed functions prefix (esci_ for device commands,
e2_ for driver's functions), better handling of tpu area, fixed tpu detection, changed freeing of line buffers, fixed some XXXs.merge-requests/1/head
rodzic
522ec3b895
commit
f31871bd6d
|
@ -1,3 +1,9 @@
|
|||
2008-01-09 Alessandro Zummo <a.zummo@towertech.it>
|
||||
* changed functions prefix (esci_ for device commands,
|
||||
e2_ for driver's functions), better handling of tpu area,
|
||||
fixed tpu detection, changed freeing of line buffers,
|
||||
fixed some XXXs.
|
||||
|
||||
2008-01-09 Alessandro Zummo <a.zummo@towertech.it>
|
||||
* sanei_tcp.c, fix compilation with cygwin.
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
/* ESC H, set zoom */
|
||||
SANE_Status
|
||||
set_zoom(Epson_Scanner * s, unsigned char x, unsigned char y)
|
||||
esci_set_zoom(Epson_Scanner * s, unsigned char x, unsigned char y)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char params[2];
|
||||
|
@ -47,19 +47,19 @@ set_zoom(Epson_Scanner * s, unsigned char x, unsigned char y)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->set_zoom;
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
params[0] = x;
|
||||
params[1] = y;
|
||||
|
||||
return epson2_cmd_simple(s, params, 2);
|
||||
return e2_cmd_simple(s, params, 2);
|
||||
}
|
||||
|
||||
/* ESC R */
|
||||
SANE_Status
|
||||
set_resolution(Epson_Scanner * s, int x, int y)
|
||||
esci_set_resolution(Epson_Scanner * s, int x, int y)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char params[4];
|
||||
|
@ -74,7 +74,7 @@ set_resolution(Epson_Scanner * s, int x, int y)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->set_resolution;
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -83,7 +83,7 @@ set_resolution(Epson_Scanner * s, int x, int y)
|
|||
params[2] = y;
|
||||
params[3] = y >> 8;
|
||||
|
||||
return epson2_cmd_simple(s, params, 4);
|
||||
return e2_cmd_simple(s, params, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -93,7 +93,7 @@ set_resolution(Epson_Scanner * s, int x, int y)
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
set_scan_area(Epson_Scanner * s, int x, int y, int width, int height)
|
||||
esci_set_scan_area(Epson_Scanner * s, int x, int y, int width, int height)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char params[8];
|
||||
|
@ -113,7 +113,7 @@ set_scan_area(Epson_Scanner * s, int x, int y, int width, int height)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->set_scan_area;
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -126,7 +126,7 @@ set_scan_area(Epson_Scanner * s, int x, int y, int width, int height)
|
|||
params[6] = height;
|
||||
params[7] = height >> 8;
|
||||
|
||||
return epson2_cmd_simple(s, params, 8);
|
||||
return e2_cmd_simple(s, params, 8);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -135,7 +135,7 @@ set_scan_area(Epson_Scanner * s, int x, int y, int width, int height)
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
set_color_correction_coefficients(Epson_Scanner * s)
|
||||
esci_set_color_correction_coefficients(Epson_Scanner * s)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char params[2];
|
||||
|
@ -150,7 +150,7 @@ set_color_correction_coefficients(Epson_Scanner * s)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->set_color_correction_coefficients;
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -164,15 +164,15 @@ set_color_correction_coefficients(Epson_Scanner * s)
|
|||
cct[7] = s->val[OPT_CCT_8].w;
|
||||
cct[8] = s->val[OPT_CCT_9].w;
|
||||
|
||||
DBG(10, "%s: %d,%d,%d %d,%d,%d %d,%d,%d\n", __func__,
|
||||
DBG(11, "%s: %d,%d,%d %d,%d,%d %d,%d,%d\n", __func__,
|
||||
cct[0], cct[1], cct[2], cct[3],
|
||||
cct[4], cct[5], cct[6], cct[7], cct[8]);
|
||||
|
||||
return epson2_cmd_simple(s, params, 9);
|
||||
return e2_cmd_simple(s, params, 9);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
set_gamma_table(Epson_Scanner * s)
|
||||
esci_set_gamma_table(Epson_Scanner * s)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char params[2];
|
||||
|
@ -206,7 +206,7 @@ set_gamma_table(Epson_Scanner * s)
|
|||
s->gamma_table[c][i + j]);
|
||||
strcat(gammaValues, newValue);
|
||||
}
|
||||
DBG(10, "gamma table[%d][%d] %s\n", c, i,
|
||||
DBG(11, "gamma table[%d][%d] %s\n", c, i,
|
||||
gammaValues);
|
||||
}
|
||||
}
|
||||
|
@ -232,11 +232,11 @@ set_gamma_table(Epson_Scanner * s)
|
|||
}
|
||||
}
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
status = epson2_cmd_simple(s, gamma, 257);
|
||||
status = e2_cmd_simple(s, gamma, 257);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ set_gamma_table(Epson_Scanner * s)
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
request_status(SANE_Handle handle, unsigned char *scanner_status)
|
||||
esci_request_status(SANE_Handle handle, unsigned char *scanner_status)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
SANE_Status status;
|
||||
|
@ -264,18 +264,18 @@ request_status(SANE_Handle handle, unsigned char *scanner_status)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->request_status;
|
||||
|
||||
epson2_send(s, params, 2, 4, &status);
|
||||
e2_send(s, params, 2, 4, &status);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
status = epson2_recv_info_block(s, params, 4, NULL);
|
||||
status = e2_recv_info_block(s, params, 4, NULL);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
if (scanner_status)
|
||||
*scanner_status = params[0];
|
||||
|
||||
DBG(1, "status:\n");
|
||||
DBG(1, "status: %02x\n", params[0]);
|
||||
|
||||
if (params[0] & STATUS_NOT_READY)
|
||||
DBG(1, " scanner in use on another interface\n");
|
||||
|
@ -312,7 +312,7 @@ request_status(SANE_Handle handle, unsigned char *scanner_status)
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
request_extended_identity(SANE_Handle handle, unsigned char *buf)
|
||||
esci_request_extended_identity(SANE_Handle handle, unsigned char *buf)
|
||||
{
|
||||
unsigned char model[17];
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
|
@ -330,7 +330,7 @@ request_extended_identity(SANE_Handle handle, unsigned char *buf)
|
|||
params[0] = FS;
|
||||
params[1] = s->hw->cmd->request_extended_identity;
|
||||
|
||||
status = epson2_txrx(s, params, 2, buf, 80);
|
||||
status = e2_txrx(s, params, 2, buf, 80);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -397,7 +397,7 @@ request_extended_identity(SANE_Handle handle, unsigned char *buf)
|
|||
|
||||
/* FS F, request scanner status */
|
||||
SANE_Status
|
||||
request_scanner_status(SANE_Handle handle, unsigned char *buf)
|
||||
esci_request_scanner_status(SANE_Handle handle, unsigned char *buf)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
SANE_Status status;
|
||||
|
@ -414,11 +414,11 @@ request_scanner_status(SANE_Handle handle, unsigned char *buf)
|
|||
params[0] = FS;
|
||||
params[1] = 'F';
|
||||
|
||||
status = epson2_txrx(s, params, 2, buf, 16);
|
||||
status = e2_txrx(s, params, 2, buf, 16);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
DBG(1, "global status : %02x\n", buf[0]);
|
||||
DBG(1, "global status : 0x%02x\n", buf[0]);
|
||||
|
||||
if (buf[0] & FSF_STATUS_MAIN_FER)
|
||||
DBG(1, " system error\n");
|
||||
|
@ -430,17 +430,17 @@ request_scanner_status(SANE_Handle handle, unsigned char *buf)
|
|||
DBG(1, " scanner is warming up\n");
|
||||
|
||||
|
||||
DBG(1, "adf status : %02x\n", buf[1]);
|
||||
DBG(1, "adf status : 0x%02x\n", buf[1]);
|
||||
|
||||
if (buf[1] & FSF_STATUS_ADF_IST)
|
||||
DBG(1, " installed\n");
|
||||
DBG(11, " installed\n");
|
||||
else
|
||||
DBG(1, " not installed\n");
|
||||
DBG(11, " not installed\n");
|
||||
|
||||
if (buf[1] & FSF_STATUS_ADF_EN)
|
||||
DBG(1, " enabled\n");
|
||||
DBG(11, " enabled\n");
|
||||
else
|
||||
DBG(1, " not enabled\n");
|
||||
DBG(11, " not enabled\n");
|
||||
|
||||
if (buf[1] & FSF_STATUS_ADF_ERR)
|
||||
DBG(1, " error\n");
|
||||
|
@ -458,17 +458,17 @@ request_scanner_status(SANE_Handle handle, unsigned char *buf)
|
|||
DBG(1, " duplex capable\n");
|
||||
|
||||
|
||||
DBG(1, "tpu status : %02x\n", buf[2]);
|
||||
DBG(1, "tpu status : 0x%02x\n", buf[2]);
|
||||
|
||||
if (buf[2] & FSF_STATUS_TPU_IST)
|
||||
DBG(1, " installed\n");
|
||||
DBG(11, " installed\n");
|
||||
else
|
||||
DBG(1, " not installed\n");
|
||||
DBG(11, " not installed\n");
|
||||
|
||||
if (buf[2] & FSF_STATUS_TPU_EN)
|
||||
DBG(1, " enabled\n");
|
||||
DBG(11, " enabled\n");
|
||||
else
|
||||
DBG(1, " not enabled\n");
|
||||
DBG(11, " not enabled\n");
|
||||
|
||||
if (buf[2] & FSF_STATUS_TPU_ERR)
|
||||
DBG(1, " error\n");
|
||||
|
@ -477,7 +477,8 @@ request_scanner_status(SANE_Handle handle, unsigned char *buf)
|
|||
DBG(1, " cover open\n");
|
||||
|
||||
|
||||
DBG(1, "main body status: %02x\n", buf[3]);
|
||||
DBG(1, "device type : 0x%02x\n", buf[3] & 0xC0);
|
||||
DBG(1, "main body status: 0x%02x\n", buf[3] & 0x3F);
|
||||
|
||||
if (buf[3] & FSF_STATUS_MAIN2_PE)
|
||||
DBG(1, " paper empty\n");
|
||||
|
@ -492,7 +493,7 @@ request_scanner_status(SANE_Handle handle, unsigned char *buf)
|
|||
}
|
||||
|
||||
SANE_Status
|
||||
set_scanning_parameter(SANE_Handle handle, unsigned char *buf)
|
||||
esci_set_scanning_parameter(SANE_Handle handle, unsigned char *buf)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
SANE_Status status;
|
||||
|
@ -506,33 +507,33 @@ set_scanning_parameter(SANE_Handle handle, unsigned char *buf)
|
|||
params[0] = FS;
|
||||
params[1] = 'W';
|
||||
|
||||
DBG(9, "resolution of main scan : %d\n", le32atoh(&buf[0]));
|
||||
DBG(9, "resolution of sub scan : %d\n", le32atoh(&buf[4]));
|
||||
DBG(9, "offset length of main scan : %d\n", le32atoh(&buf[8]));
|
||||
DBG(9, "offset length of sub scan : %d\n", le32atoh(&buf[12]));
|
||||
DBG(9, "scanning length of main scan: %d\n", le32atoh(&buf[16]));
|
||||
DBG(9, "scanning length of sub scan : %d\n", le32atoh(&buf[20]));
|
||||
DBG(9, "scanning color : %d\n", buf[24]);
|
||||
DBG(9, "data format : %d\n", buf[25]);
|
||||
DBG(9, "option control : %d\n", buf[26]);
|
||||
DBG(9, "scanning mode : %d\n", buf[27]);
|
||||
DBG(9, "block line number : %d\n", buf[28]);
|
||||
DBG(9, "gamma correction : %d\n", buf[29]);
|
||||
DBG(9, "brightness : %d\n", buf[30]);
|
||||
DBG(9, "color correction : %d\n", buf[31]);
|
||||
DBG(9, "halftone processing : %d\n", buf[32]);
|
||||
DBG(9, "threshold : %d\n", buf[33]);
|
||||
DBG(9, "auto area segmentation : %d\n", buf[34]);
|
||||
DBG(9, "sharpness control : %d\n", buf[35]);
|
||||
DBG(9, "mirroring : %d\n", buf[36]);
|
||||
DBG(9, "film type : %d\n", buf[37]);
|
||||
DBG(9, "main lamp lighting mode : %d\n", buf[38]);
|
||||
DBG(10, "resolution of main scan : %d\n", le32atoh(&buf[0]));
|
||||
DBG(10, "resolution of sub scan : %d\n", le32atoh(&buf[4]));
|
||||
DBG(10, "offset length of main scan : %d\n", le32atoh(&buf[8]));
|
||||
DBG(10, "offset length of sub scan : %d\n", le32atoh(&buf[12]));
|
||||
DBG(10, "scanning length of main scan: %d\n", le32atoh(&buf[16]));
|
||||
DBG(10, "scanning length of sub scan : %d\n", le32atoh(&buf[20]));
|
||||
DBG(10, "scanning color : %d\n", buf[24]);
|
||||
DBG(10, "data format : %d\n", buf[25]);
|
||||
DBG(10, "option control : %d\n", buf[26]);
|
||||
DBG(10, "scanning mode : %d\n", buf[27]);
|
||||
DBG(10, "block line number : %d\n", buf[28]);
|
||||
DBG(10, "gamma correction : %d\n", buf[29]);
|
||||
DBG(10, "brightness : %d\n", buf[30]);
|
||||
DBG(10, "color correction : %d\n", buf[31]);
|
||||
DBG(10, "halftone processing : %d\n", buf[32]);
|
||||
DBG(10, "threshold : %d\n", buf[33]);
|
||||
DBG(10, "auto area segmentation : %d\n", buf[34]);
|
||||
DBG(10, "sharpness control : %d\n", buf[35]);
|
||||
DBG(10, "mirroring : %d\n", buf[36]);
|
||||
DBG(10, "film type : %d\n", buf[37]);
|
||||
DBG(10, "main lamp lighting mode : %d\n", buf[38]);
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
status = epson2_cmd_simple(s, buf, 64);
|
||||
status = e2_cmd_simple(s, buf, 64);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -540,7 +541,7 @@ set_scanning_parameter(SANE_Handle handle, unsigned char *buf)
|
|||
}
|
||||
|
||||
SANE_Status
|
||||
request_command_parameter(SANE_Handle handle, unsigned char *buf)
|
||||
esci_request_command_parameter(SANE_Handle handle, unsigned char *buf)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
SANE_Status status;
|
||||
|
@ -554,7 +555,7 @@ request_command_parameter(SANE_Handle handle, unsigned char *buf)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->request_condition;
|
||||
|
||||
status = epson2_cmd_info_block(s, params, 2, 45, &buf, NULL);
|
||||
status = e2_cmd_info_block(s, params, 2, 45, &buf, NULL);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -591,7 +592,7 @@ request_command_parameter(SANE_Handle handle, unsigned char *buf)
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
request_focus_position(SANE_Handle handle, unsigned char *position)
|
||||
esci_request_focus_position(SANE_Handle handle, unsigned char *position)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char *buf;
|
||||
|
@ -607,7 +608,7 @@ request_focus_position(SANE_Handle handle, unsigned char *position)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->request_focus_position;
|
||||
|
||||
status = epson2_cmd_info_block(s, params, 2, 2, &buf, NULL);
|
||||
status = e2_cmd_info_block(s, params, 2, 2, &buf, NULL);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -629,7 +630,7 @@ request_focus_position(SANE_Handle handle, unsigned char *position)
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
request_push_button_status(SANE_Handle handle, unsigned char *bstatus)
|
||||
esci_request_push_button_status(SANE_Handle handle, unsigned char *bstatus)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
SANE_Status status;
|
||||
|
@ -646,7 +647,7 @@ request_push_button_status(SANE_Handle handle, unsigned char *bstatus)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->request_push_button_status;
|
||||
|
||||
status = epson2_cmd_info_block(s, params, 2, 1, &buf, NULL);
|
||||
status = e2_cmd_info_block(s, params, 2, 1, &buf, NULL);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -665,12 +666,12 @@ request_push_button_status(SANE_Handle handle, unsigned char *bstatus)
|
|||
* XXX information should be parsed separately.
|
||||
*/
|
||||
SANE_Status
|
||||
request_identity(SANE_Handle handle, unsigned char **buf, size_t *len)
|
||||
esci_request_identity(SANE_Handle handle, unsigned char **buf, size_t *len)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
unsigned char params[2];
|
||||
|
||||
DBG(1, "%s\n", __func__);
|
||||
DBG(8, "%s\n", __func__);
|
||||
|
||||
if (!s->hw->cmd->request_identity)
|
||||
return SANE_STATUS_INVAL;
|
||||
|
@ -678,7 +679,7 @@ request_identity(SANE_Handle handle, unsigned char **buf, size_t *len)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->request_identity;
|
||||
|
||||
return epson2_cmd_info_block(s, params, 2, 0, buf, len);
|
||||
return e2_cmd_info_block(s, params, 2, 0, buf, len);
|
||||
}
|
||||
|
||||
|
||||
|
@ -686,14 +687,14 @@ request_identity(SANE_Handle handle, unsigned char **buf, size_t *len)
|
|||
* Request information from scanner
|
||||
*/
|
||||
SANE_Status
|
||||
request_identity2(SANE_Handle handle, unsigned char **buf)
|
||||
esci_request_identity2(SANE_Handle handle, unsigned char **buf)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
SANE_Status status;
|
||||
size_t len;
|
||||
unsigned char params[2];
|
||||
|
||||
DBG(5, "%s\n", __func__);
|
||||
DBG(8, "%s\n", __func__);
|
||||
|
||||
if (s->hw->cmd->request_identity2 == 0)
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
|
@ -701,7 +702,7 @@ request_identity2(SANE_Handle handle, unsigned char **buf)
|
|||
params[0] = ESC;
|
||||
params[1] = s->hw->cmd->request_identity2;
|
||||
|
||||
status = epson2_cmd_info_block(s, params, 2, 0, buf, &len);
|
||||
status = e2_cmd_info_block(s, params, 2, 0, buf, &len);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
|
@ -711,7 +712,7 @@ request_identity2(SANE_Handle handle, unsigned char **buf)
|
|||
/* Send the "initialize scanner" command to the device and reset it */
|
||||
|
||||
SANE_Status
|
||||
reset(Epson_Scanner * s)
|
||||
esci_reset(Epson_Scanner * s)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char params[2];
|
||||
|
@ -727,26 +728,24 @@ reset(Epson_Scanner * s)
|
|||
if (s->fd == -1)
|
||||
return SANE_STATUS_GOOD;
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
feed(Epson_Scanner * s)
|
||||
esci_feed(Epson_Scanner * s)
|
||||
{
|
||||
unsigned char params[1];
|
||||
|
||||
DBG(8, "%s\n", __func__);
|
||||
|
||||
if (!s->hw->cmd->feed) {
|
||||
DBG(5, "feed is not supported\n");
|
||||
if (!s->hw->cmd->feed)
|
||||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
params[0] = s->hw->cmd->feed;
|
||||
|
||||
return epson2_cmd_simple(s, params, 1);
|
||||
return e2_cmd_simple(s, params, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -756,7 +755,7 @@ feed(Epson_Scanner * s)
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
eject(Epson_Scanner * s)
|
||||
esci_eject(Epson_Scanner * s)
|
||||
{
|
||||
unsigned char params[1];
|
||||
|
||||
|
@ -770,11 +769,11 @@ eject(Epson_Scanner * s)
|
|||
|
||||
params[0] = s->hw->cmd->eject;
|
||||
|
||||
return epson2_cmd_simple(s, params, 1);
|
||||
return e2_cmd_simple(s, params, 1);
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
request_extended_status(SANE_Handle handle, unsigned char **data,
|
||||
esci_request_extended_status(SANE_Handle handle, unsigned char **data,
|
||||
size_t * data_len)
|
||||
{
|
||||
Epson_Scanner *s = (Epson_Scanner *) handle;
|
||||
|
@ -794,7 +793,7 @@ request_extended_status(SANE_Handle handle, unsigned char **data,
|
|||
/* This command returns 33 bytes of data on old scanners
|
||||
* and 42 (CMD_SIZE_EXT_STATUS) on new ones.
|
||||
*/
|
||||
status = epson2_cmd_info_block(s, params, 2, CMD_SIZE_EXT_STATUS,
|
||||
status = e2_cmd_info_block(s, params, 2, CMD_SIZE_EXT_STATUS,
|
||||
&buf, &buf_len);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
|
|
@ -17,45 +17,45 @@
|
|||
|
||||
/* simple scanner commands, ESC <x> */
|
||||
|
||||
#define set_focus_position(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_focus_position, v)
|
||||
#define set_color_mode(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_color_mode, v)
|
||||
#define set_data_format(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_data_format, v)
|
||||
#define set_halftoning(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_halftoning, v)
|
||||
#define set_gamma(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_gamma, v)
|
||||
#define set_color_correction(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_color_correction, v)
|
||||
#define set_lcount(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_lcount, v)
|
||||
#define set_bright(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_bright, v)
|
||||
#define mirror_image(s,v) epson2_esc_cmd( s,(s)->hw->cmd->mirror_image, v)
|
||||
#define set_speed(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_speed, v)
|
||||
#define set_sharpness(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_outline_emphasis, v)
|
||||
#define set_auto_area_segmentation(s,v) epson2_esc_cmd( s,(s)->hw->cmd->control_auto_area_segmentation, v)
|
||||
#define set_film_type(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_film_type, v)
|
||||
#define set_exposure_time(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_exposure_time, v)
|
||||
#define set_bay(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_bay, v)
|
||||
#define set_threshold(s,v) epson2_esc_cmd( s,(s)->hw->cmd->set_threshold, v)
|
||||
#define control_extension(s,v) epson2_esc_cmd( s,(s)->hw->cmd->control_an_extension, v)
|
||||
#define esci_set_focus_position(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_focus_position, v)
|
||||
#define esci_set_color_mode(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_color_mode, v)
|
||||
#define esci_set_data_format(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_data_format, v)
|
||||
#define esci_set_halftoning(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_halftoning, v)
|
||||
#define esci_set_gamma(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_gamma, v)
|
||||
#define esci_set_color_correction(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_color_correction, v)
|
||||
#define esci_set_lcount(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_lcount, v)
|
||||
#define esci_set_bright(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_bright, v)
|
||||
#define esci_mirror_image(s,v) e2_esc_cmd( s,(s)->hw->cmd->mirror_image, v)
|
||||
#define esci_set_speed(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_speed, v)
|
||||
#define esci_set_sharpness(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_outline_emphasis, v)
|
||||
#define esci_set_auto_area_segmentation(s,v) e2_esc_cmd( s,(s)->hw->cmd->control_auto_area_segmentation, v)
|
||||
#define esci_set_film_type(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_film_type, v)
|
||||
#define esci_set_exposure_time(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_exposure_time, v)
|
||||
#define esci_set_bay(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_bay, v)
|
||||
#define esci_set_threshold(s,v) e2_esc_cmd( s,(s)->hw->cmd->set_threshold, v)
|
||||
#define esci_control_extension(s,v) e2_esc_cmd( s,(s)->hw->cmd->control_an_extension, v)
|
||||
|
||||
SANE_Status set_zoom(Epson_Scanner * s, unsigned char x, unsigned char y);
|
||||
SANE_Status set_resolution(Epson_Scanner * s, int x, int y);
|
||||
SANE_Status set_scan_area(Epson_Scanner * s, int x, int y, int width,
|
||||
SANE_Status esci_set_zoom(Epson_Scanner * s, unsigned char x, unsigned char y);
|
||||
SANE_Status esci_set_resolution(Epson_Scanner * s, int x, int y);
|
||||
SANE_Status esci_set_scan_area(Epson_Scanner * s, int x, int y, int width,
|
||||
int height);
|
||||
SANE_Status set_color_correction_coefficients(Epson_Scanner * s);
|
||||
SANE_Status set_gamma_table(Epson_Scanner * s);
|
||||
SANE_Status esci_set_color_correction_coefficients(Epson_Scanner * s);
|
||||
SANE_Status esci_set_gamma_table(Epson_Scanner * s);
|
||||
|
||||
SANE_Status request_status(SANE_Handle handle, unsigned char *scanner_status);
|
||||
SANE_Status request_extended_identity(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status request_scanner_status(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status set_scanning_parameter(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status request_command_parameter(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status request_focus_position(SANE_Handle handle,
|
||||
SANE_Status esci_request_status(SANE_Handle handle, unsigned char *scanner_status);
|
||||
SANE_Status esci_request_extended_identity(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status esci_request_scanner_status(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status esci_set_scanning_parameter(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status esci_request_command_parameter(SANE_Handle handle, unsigned char *buf);
|
||||
SANE_Status esci_request_focus_position(SANE_Handle handle,
|
||||
unsigned char *position);
|
||||
SANE_Status request_push_button_status(SANE_Handle handle,
|
||||
SANE_Status esci_request_push_button_status(SANE_Handle handle,
|
||||
unsigned char *bstatus);
|
||||
SANE_Status request_identity(SANE_Handle handle, unsigned char **buf, size_t *len);
|
||||
SANE_Status esci_request_identity(SANE_Handle handle, unsigned char **buf, size_t *len);
|
||||
|
||||
SANE_Status request_identity2(SANE_Handle handle, unsigned char **buf);
|
||||
SANE_Status reset(Epson_Scanner * s);
|
||||
SANE_Status feed(Epson_Scanner * s);
|
||||
SANE_Status eject(Epson_Scanner * s);
|
||||
SANE_Status request_extended_status(SANE_Handle handle, unsigned char **data,
|
||||
SANE_Status esci_request_identity2(SANE_Handle handle, unsigned char **buf);
|
||||
SANE_Status esci_reset(Epson_Scanner * s);
|
||||
SANE_Status esci_feed(Epson_Scanner * s);
|
||||
SANE_Status esci_eject(Epson_Scanner * s);
|
||||
SANE_Status esci_request_extended_status(SANE_Handle handle, unsigned char **data,
|
||||
size_t * data_len);
|
||||
|
|
|
@ -45,7 +45,7 @@ unsigned int r_cmd_count = 0;
|
|||
unsigned int w_cmd_count = 0;
|
||||
|
||||
int
|
||||
epson2_send(Epson_Scanner * s, void *buf, size_t buf_size, size_t reply_len,
|
||||
e2_send(Epson_Scanner * s, void *buf, size_t buf_size, size_t reply_len,
|
||||
SANE_Status * status)
|
||||
{
|
||||
DBG(15, "%s: size = %lu, reply = %lu\n",
|
||||
|
@ -112,7 +112,7 @@ epson2_send(Epson_Scanner * s, void *buf, size_t buf_size, size_t reply_len,
|
|||
}
|
||||
|
||||
ssize_t
|
||||
epson2_recv(Epson_Scanner * s, void *buf, ssize_t buf_size,
|
||||
e2_recv(Epson_Scanner * s, void *buf, ssize_t buf_size,
|
||||
SANE_Status * status)
|
||||
{
|
||||
ssize_t n = 0;
|
||||
|
@ -167,18 +167,18 @@ epson2_recv(Epson_Scanner * s, void *buf, ssize_t buf_size,
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
epson2_txrx(Epson_Scanner * s, unsigned char *txbuf, size_t txlen,
|
||||
e2_txrx(Epson_Scanner * s, unsigned char *txbuf, size_t txlen,
|
||||
unsigned char *rxbuf, size_t rxlen)
|
||||
{
|
||||
SANE_Status status;
|
||||
|
||||
epson2_send(s, txbuf, txlen, rxlen, &status);
|
||||
e2_send(s, txbuf, txlen, rxlen, &status);
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
DBG(1, "%s: tx err, %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
|
||||
epson2_recv(s, rxbuf, rxlen, &status);
|
||||
e2_recv(s, rxbuf, rxlen, &status);
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
DBG(1, "%s: rx err, %s\n", __func__, sane_strstatus(status));
|
||||
}
|
||||
|
@ -190,14 +190,14 @@ epson2_txrx(Epson_Scanner * s, unsigned char *txbuf, size_t txlen,
|
|||
* to give back an ACK or a NAK.
|
||||
*/
|
||||
SANE_Status
|
||||
epson2_cmd_simple(Epson_Scanner * s, void *buf, size_t buf_size)
|
||||
e2_cmd_simple(Epson_Scanner * s, void *buf, size_t buf_size)
|
||||
{
|
||||
unsigned char result;
|
||||
SANE_Status status;
|
||||
|
||||
DBG(12, "%s: size = %d\n", __func__, buf_size);
|
||||
|
||||
status = epson2_txrx(s, buf, buf_size, &result, 1);
|
||||
status = e2_txrx(s, buf, buf_size, &result, 1);
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
DBG(1, "%s: failed, %s\n", __func__, sane_strstatus(status));
|
||||
return status;
|
||||
|
@ -219,16 +219,16 @@ epson2_cmd_simple(Epson_Scanner * s, void *buf, size_t buf_size)
|
|||
|
||||
/* receives a 4 or 6 bytes information block from the scanner*/
|
||||
SANE_Status
|
||||
epson2_recv_info_block(Epson_Scanner * s, unsigned char *scanner_status,
|
||||
e2_recv_info_block(Epson_Scanner * s, unsigned char *scanner_status,
|
||||
size_t info_size, size_t * payload_size)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char info[6];
|
||||
|
||||
if (s->hw->connection == SANE_EPSON_PIO)
|
||||
epson2_recv(s, info, 1, &status);
|
||||
e2_recv(s, info, 1, &status);
|
||||
else
|
||||
epson2_recv(s, info, info_size, &status);
|
||||
e2_recv(s, info, info_size, &status);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
@ -247,7 +247,7 @@ epson2_recv_info_block(Epson_Scanner * s, unsigned char *scanner_status,
|
|||
|
||||
/* if connection is PIO read the remaining bytes. */
|
||||
if (s->hw->connection == SANE_EPSON_PIO) {
|
||||
epson2_recv(s, &info[1], info_size - 1, &status);
|
||||
e2_recv(s, &info[1], info_size - 1, &status);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ epson2_recv_info_block(Epson_Scanner * s, unsigned char *scanner_status,
|
|||
*/
|
||||
|
||||
SANE_Status
|
||||
epson2_cmd_info_block(SANE_Handle handle, unsigned char *params,
|
||||
e2_cmd_info_block(SANE_Handle handle, unsigned char *params,
|
||||
unsigned char params_len, size_t reply_len,
|
||||
unsigned char **buf, size_t * buf_len)
|
||||
{
|
||||
|
@ -293,13 +293,13 @@ epson2_cmd_info_block(SANE_Handle handle, unsigned char *params,
|
|||
*buf = NULL;
|
||||
|
||||
/* send command, we expect the info block + reply_len back */
|
||||
epson2_send(s, params, params_len,
|
||||
e2_send(s, params, params_len,
|
||||
reply_len ? reply_len + 4 : 0, &status);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
goto end;
|
||||
|
||||
status = epson2_recv_info_block(s, NULL, 4, &len);
|
||||
status = e2_recv_info_block(s, NULL, 4, &len);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
goto end;
|
||||
|
||||
|
@ -324,7 +324,7 @@ epson2_cmd_info_block(SANE_Handle handle, unsigned char *params,
|
|||
|
||||
if (*buf) {
|
||||
memset(*buf, 0x00, len);
|
||||
epson2_recv(s, *buf, len, &status); /* receive actual data */
|
||||
e2_recv(s, *buf, len, &status); /* receive actual data */
|
||||
} else
|
||||
status = SANE_STATUS_NO_MEM;
|
||||
end:
|
||||
|
@ -346,7 +346,7 @@ epson2_cmd_info_block(SANE_Handle handle, unsigned char *params,
|
|||
* will answer with ACK/NAK.
|
||||
*/
|
||||
SANE_Status
|
||||
epson2_esc_cmd(Epson_Scanner * s, unsigned char cmd, unsigned char val)
|
||||
e2_esc_cmd(Epson_Scanner * s, unsigned char cmd, unsigned char val)
|
||||
{
|
||||
SANE_Status status;
|
||||
unsigned char params[2];
|
||||
|
@ -358,29 +358,29 @@ epson2_esc_cmd(Epson_Scanner * s, unsigned char cmd, unsigned char val)
|
|||
params[0] = ESC;
|
||||
params[1] = cmd;
|
||||
|
||||
status = epson2_cmd_simple(s, params, 2);
|
||||
status = e2_cmd_simple(s, params, 2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
||||
params[0] = val;
|
||||
|
||||
return epson2_cmd_simple(s, params, 1);
|
||||
return e2_cmd_simple(s, params, 1);
|
||||
}
|
||||
|
||||
/* Send an ACK to the scanner */
|
||||
|
||||
SANE_Status
|
||||
epson2_ack(Epson_Scanner * s)
|
||||
e2_ack(Epson_Scanner * s)
|
||||
{
|
||||
SANE_Status status;
|
||||
epson2_send(s, S_ACK, 1, 0, &status);
|
||||
e2_send(s, S_ACK, 1, 0, &status);
|
||||
return status;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
epson2_ack_next(Epson_Scanner * s, size_t reply_len)
|
||||
e2_ack_next(Epson_Scanner * s, size_t reply_len)
|
||||
{
|
||||
SANE_Status status;
|
||||
epson2_send(s, S_ACK, 1, reply_len, &status);
|
||||
e2_send(s, S_ACK, 1, reply_len, &status);
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -22,28 +22,28 @@ extern unsigned int r_cmd_count;
|
|||
extern unsigned int w_cmd_count;
|
||||
|
||||
|
||||
SANE_Status epson2_cmd_simple(Epson_Scanner * s, void *buf, size_t buf_size);
|
||||
int epson2_send(Epson_Scanner * s, void *buf, size_t buf_size,
|
||||
SANE_Status e2_cmd_simple(Epson_Scanner * s, void *buf, size_t buf_size);
|
||||
int e2_send(Epson_Scanner * s, void *buf, size_t buf_size,
|
||||
size_t reply_len, SANE_Status * status);
|
||||
ssize_t epson2_recv(Epson_Scanner * s, void *buf, ssize_t buf_size,
|
||||
ssize_t e2_recv(Epson_Scanner * s, void *buf, ssize_t buf_size,
|
||||
SANE_Status * status);
|
||||
|
||||
SANE_Status
|
||||
epson2_txrx(Epson_Scanner * s, unsigned char *txbuf, size_t txlen,
|
||||
e2_txrx(Epson_Scanner * s, unsigned char *txbuf, size_t txlen,
|
||||
unsigned char *rxbuf, size_t rxlen);
|
||||
|
||||
SANE_Status
|
||||
epson2_recv_info_block(Epson_Scanner * s, unsigned char *scanner_status,
|
||||
e2_recv_info_block(Epson_Scanner * s, unsigned char *scanner_status,
|
||||
size_t info_size, size_t * payload_size);
|
||||
|
||||
SANE_Status
|
||||
epson2_cmd_info_block(SANE_Handle handle, unsigned char *params,
|
||||
e2_cmd_info_block(SANE_Handle handle, unsigned char *params,
|
||||
unsigned char params_len, size_t reply_len,
|
||||
unsigned char **buf, size_t * buf_len);
|
||||
|
||||
SANE_Status epson2_ack(Epson_Scanner * s);
|
||||
SANE_Status epson2_ack_next(Epson_Scanner * s, size_t reply_len);
|
||||
SANE_Status e2_ack(Epson_Scanner * s);
|
||||
SANE_Status e2_ack_next(Epson_Scanner * s, size_t reply_len);
|
||||
|
||||
SANE_Status
|
||||
epson2_esc_cmd(Epson_Scanner * s, unsigned char cmd, unsigned char val);
|
||||
e2_esc_cmd(Epson_Scanner * s, unsigned char cmd, unsigned char val);
|
||||
#endif /* epson2_io_h */
|
||||
|
|
1499
backend/epson2.c
1499
backend/epson2.c
Plik diff jest za duży
Load Diff
|
@ -238,6 +238,11 @@ typedef enum
|
|||
struct Epson_Device
|
||||
{
|
||||
struct Epson_Device *next;
|
||||
|
||||
char *name;
|
||||
char *model;
|
||||
|
||||
|
||||
SANE_Device sane;
|
||||
SANE_Int level;
|
||||
SANE_Range dpi_range;
|
||||
|
|
Ładowanie…
Reference in New Issue