Hi
I tried to write the Calibration function as follows.
Are they correct ?
And I have to put them in the canon.c, canon-sane.c, canon-scsi.c and so on.
But I don't know where I should put them in the canon backend files.
Would anybody teach me about this ?
for canon-scsi.c
===================================================================
static SANE_Status
reset_scanner (int fd)
{
static u_char cmd[10];
int status;
DBG (31, ">> reset_scanner\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0xc1;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
DBG (31, "<< reset_scanner\n");
return (status);
}
static SANE_Status
execute_calibration (int fd)
{
static u_char cmd[6 + 2];
int status;
DBG (31, ">> execute_calibration\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = 0xc2;
cmd[4] = 2;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
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] = 2;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 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_cmd (fd, cmd, sizeof (cmd), buf, buf_size);
DBG (31, "<< get_switch_status\n");
return (status);
}
===================================================================
for canon.c or canon-sane.c
===================================================================
status = reset_scanner(s->fd);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "attach: RESET SCANNER failed\n");
sanei_scsi_close (s->fd);
s->fd = -1;
}
status = execute_calibration(s->fd);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "attach: EXECUTE CALIBRATION failed\n");
sanei_scsi_close (s->fd);
s->fd = -1;
}
DBG (3, "sane_start: sending GET CALIBRATION STATUS\n");
memset (ebuf, 0, sizeof (ebuf));
buf_size = sizeof (ebuf);
status = get_calibration_status (s->fd, ebuf, &buf_size);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "sane_start: GET CALIBRATION STATUS failed\n");
sanei_scsi_close (s->fd);
return (SANE_STATUS_INVAL);
}
DBG (3, "sane_start: sending GET SWITCH STATUS\n");
memset (ebuf, 0, sizeof (ebuf));
buf_size = sizeof (ebuf);
status = get_switch_status (s->fd, ebuf, &buf_size);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "sane_start: GET SWITCH STATUS failed\n");
sanei_scsi_close (s->fd);
return (SANE_STATUS_INVAL);
}
===================================================================
Should I write the other code in anywhere ?
And how would I write the code to make the button of calibration in the
xscanimage and to show the message "running calibration" during the
calibration in xscanimage ?
regards,
-----------------------------
Mitsuru Okaniwa
email : m-okaniwa@bea.hi-ho.ne.jp
tel : (Japan)0566-26-6105
-----------------------------
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
This archive was generated by hypermail 2b29 : Thu Dec 07 2000 - 19:58:14 PST