SnapScan backend 1.4.15

DEVEL_2_0_BRANCH-1
Oliver Schwartz 2002-07-12 23:29:11 +00:00
rodzic 09ac7f1e3b
commit 1d1c4d1d8d
7 zmienionych plików z 182 dodań i 115 usunięć

Wyświetl plik

@ -58,6 +58,10 @@ static const SANE_Range y_range_fb =
{
SANE_FIX (0.0), SANE_FIX (297.0), 0
}; /* mm */
/* default TPO range (shortest y_range
to avoid tray collision.
*/
static const SANE_Range x_range_tpo_default =
{
SANE_FIX (0.0), SANE_FIX (129.0), 0
@ -66,6 +70,8 @@ static const SANE_Range y_range_tpo_default =
{
SANE_FIX (0.0), SANE_FIX (180.0), 0
}; /* mm */
/* TPO range for the Agfa 1236 */
static const SANE_Range x_range_tpo_1236 =
{
SANE_FIX (0.0), SANE_FIX (203.0), 0
@ -74,6 +80,17 @@ static const SANE_Range y_range_tpo_1236 =
{
SANE_FIX (0.0), SANE_FIX (254.0), 0
}; /* mm */
/* TPO range for the Agfa e50 */
static const SANE_Range x_range_tpo_e50 =
{
SANE_FIX (0.0), SANE_FIX (40.0), 0
}; /* mm */
static const SANE_Range y_range_tpo_e50 =
{
SANE_FIX (0.0), SANE_FIX (240.0), 0
}; /* mm */
static SANE_Range x_range_tpo;
static SANE_Range y_range_tpo;
static const SANE_Range gamma_range =
@ -135,6 +152,26 @@ static void init_options (SnapScan_Scanner * ps)
{md_auto, md_colour, md_greyscale, md_lineart, NULL};
SANE_Option_Descriptor *po = ps->options;
/* Initialize TPO range */
switch (ps->pdev->model)
{
case SNAPSCAN1236:
x_range_tpo = x_range_tpo_1236;
y_range_tpo = y_range_tpo_1236;
break;
case SNAPSCANE20:
case SNAPSCANE50:
case SNAPSCANE52:
x_range_tpo = x_range_tpo_e50;
y_range_tpo = y_range_tpo_e50;
break;
default:
x_range_tpo = x_range_tpo_default;
y_range_tpo = y_range_tpo_default;
break;
}
/* Initialize option descriptors */
po[OPT_COUNT].name = SANE_NAME_NUM_OPTIONS;
po[OPT_COUNT].title = SANE_TITLE_NUM_OPTIONS;
po[OPT_COUNT].desc = SANE_DESC_NUM_OPTIONS;
@ -377,10 +414,11 @@ static void init_options (SnapScan_Scanner * ps)
po[OPT_QUALITY_CAL].cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT;
ps->val[OPT_QUALITY_CAL].b = DEFAULT_QUALITY;
/* Disable quality calibration option if not supported
Note: Snapscan e52 does not support quality calibration,
Note: Snapscan e52 and Prisa5300 do not support quality calibration,
although HCFG_CAL_ALLOWED is set. */
if ((!(ps->hconfig & HCFG_CAL_ALLOWED))
|| (ps->pdev->model == SNAPSCANE52)) {
|| (ps->pdev->model == SNAPSCANE52)
|| (ps->pdev->model == PRISA5300)) {
po[OPT_QUALITY_CAL].cap |= SANE_CAP_INACTIVE;
ps->val[OPT_QUALITY_CAL].b = SANE_FALSE;
}
@ -847,7 +885,7 @@ SANE_Status sane_control_option (SANE_Handle h,
return SANE_STATUS_INVAL;
}
/* prevent setting of options during a scan */
if (pss->state!=ST_IDLE) {
if ((pss->state==ST_SCAN_INIT) || (pss->state==ST_SCANNING)) {
DBG(DL_INFO,
"set value for option %s ignored: scanner is still scanning (status %d)\n",
pss->options[n].name,
@ -1348,11 +1386,17 @@ SANE_Status sane_control_option (SANE_Handle h,
/*
* $Log$
* Revision 1.4 2002/05/02 17:19:14 oliverschwartz
* SnapScan backend 1.4.13: Support for ADF
* Revision 1.5 2002/07/12 23:29:05 oliverschwartz
* SnapScan backend 1.4.15
*
* Revision 1.3 2002/04/27 15:35:16 oliverschwartz
* SnapScan backend 1.4.12: Fix option handling
* Revision 1.6 2002/07/12 23:23:06 oliverschwartz
* Disable quality calibration for 5300
*
* Revision 1.5 2002/06/06 20:40:00 oliverschwartz
* Changed default scan area for transparancy unit of SnapScan e50
*
* Revision 1.4 2002/05/02 18:28:44 oliverschwartz
* Added ADF support
*
* Revision 1.3 2002/04/27 14:43:59 oliverschwartz
* - Remove SCSI debug options

Wyświetl plik

@ -1124,7 +1124,8 @@ static SANE_Status download_firmware(SnapScan_Scanner * pss)
fd = fopen(firmware,"r");
if(fd == NULL)
{
DBG (0, "Cannot open firmware file %s\n", firmware);
DBG (0, "Cannot open firmware file %s.\n", firmware);
DBG (0, "Edit the firmware file entry in %s.\n", SNAPSCAN_CONFIG_FILE);
status = SANE_STATUS_INVAL;
}
else
@ -1184,11 +1185,14 @@ static SANE_Status download_firmware(SnapScan_Scanner * pss)
/*
* $Log$
* Revision 1.17 2002/05/02 17:19:15 oliverschwartz
* SnapScan backend 1.4.13: Support for ADF
* Revision 1.18 2002/07/12 23:29:06 oliverschwartz
* SnapScan backend 1.4.15
*
* Revision 1.16 2002/04/27 15:35:17 oliverschwartz
* SnapScan backend 1.4.12: Fix option handling
* Revision 1.32 2002/06/06 20:40:01 oliverschwartz
* Changed default scan area for transparancy unit of SnapScan e50
*
* Revision 1.31 2002/05/02 18:28:44 oliverschwartz
* Added ADF support
*
* Revision 1.30 2002/04/27 14:41:22 oliverschwartz
* Print number of open handles in close_scanner()

Wyświetl plik

@ -153,7 +153,6 @@ static SANE_Status snapscani_usb_open(const char *dev, int *fdp,
return SANE_STATUS_INVAL;
}
semop(sem_id, &sem_signal, 1);
sanei_usb_init();
usb_sense_handler=sense_handler;
usb_pss = pss;
return sanei_usb_open(dev, fdp);
@ -208,52 +207,36 @@ static char *usb_debug_data(char *str,const char *data, int len) {
#define RETURN_ON_FAILURE(x) if((status = x) != SANE_STATUS_GOOD) return status;
static SANE_Status usb_write(int fd, const void *buf, int n) {
static SANE_Status usb_write(int fd, const void *buf, size_t n) {
char dbgmsg[16384];
int r;
SANE_Status status;
size_t bytes_written = n;
static const char me[] = "usb_write";
DBG(DL_DATA_TRACE, "%s: writing: %s\n",me,usb_debug_data(dbgmsg,buf,n));
if((r=write(fd,buf,n)) != n) {
DBG (DL_MAJOR_ERROR, "%s Only %d bytes written\n",me,r);
return SANE_STATUS_IO_ERROR;
status = sanei_usb_write_bulk(fd, (const SANE_Byte*)buf, &bytes_written);
if(bytes_written != n) {
DBG (DL_MAJOR_ERROR, "%s Only %d bytes written\n",me,bytes_written);
status = SANE_STATUS_IO_ERROR;
}
return SANE_STATUS_GOOD;
return status;
}
static SANE_Status usb_read(int fd, void *buf, int n) {
static SANE_Status usb_read(SANE_Int fd, void *buf, size_t n) {
char dbgmsg[16384];
int r;
static const char me[] = "usb_read";
SANE_Status status;
size_t bytes_read = n;
/* USB driver appears to block in all cases when asking for data
* except if the device says its not ready. In this case, we
* attempt to block ourselves to act like the sane SCSI driver.
* This relies on the USB driver to eventually report something
* besides EAGAIN if there is a serious problem.
*/
do
{
if((r=read(fd,buf,n)) != n && !(r == -1 && errno == EAGAIN)) {
if (r == -1) {
DBG (DL_MAJOR_ERROR, "%s Error returned from read: %s (%d)\n",
me,strerror(errno),errno);
} else {
DBG (DL_MAJOR_ERROR, "%s Only %d bytes read\n",me,r);
}
return SANE_STATUS_IO_ERROR;
}
if (r == -1 && errno == EAGAIN)
{
DBG (DL_MAJOR_ERROR, "%s: Got an EAGAIN\n",me);
usleep(10000);
}
} while (r == -1 && errno == EAGAIN);
status = sanei_usb_read_bulk(fd, (SANE_Byte*)buf, &bytes_read);
if (bytes_read != n) {
DBG (DL_MAJOR_ERROR, "%s Only %d bytes read\n",me,bytes_read);
status = SANE_STATUS_IO_ERROR;
}
DBG(DL_DATA_TRACE, "%s: reading: %s\n",me,usb_debug_data(dbgmsg,buf,n));
return SANE_STATUS_GOOD;
return status;
}
static SANE_Status usb_read_status(int fd, int *scsistatus, int *transaction_status)
@ -452,8 +435,11 @@ static SANE_Status usb_request_sense(SnapScan_Scanner *pss) {
/*
* $Log$
* Revision 1.10 2002/04/27 15:35:17 oliverschwartz
* SnapScan backend 1.4.12: Fix option handling
* Revision 1.11 2002/07/12 23:29:06 oliverschwartz
* SnapScan backend 1.4.15
*
* Revision 1.21 2002/07/12 22:52:42 oliverschwartz
* use sanei_usb_read_bulk() and sanei_usb_write_bulk()
*
* Revision 1.20 2002/04/27 14:36:25 oliverschwartz
* Pass a char as 'proj' argument for ftok()

Wyświetl plik

@ -78,7 +78,7 @@
#define EXPECTED_MAJOR 1
#define MINOR_VERSION 4
#define BUILD 13
#define BUILD 15
#include "snapscan.h"
@ -718,6 +718,8 @@ SANE_Status sane_init (SANE_Int *version_code,
first_device = NULL;
n_devices = 0;
sanei_usb_init();
/* build a device structure */
fp = sanei_config_open (SNAPSCAN_CONFIG_FILE);
if (!fp)
@ -976,17 +978,6 @@ SANE_Status sane_open (SANE_String_Const name, SANE_Handle * h)
free (pss);
return status;
}
switch (pss->pdev->model)
{
case SNAPSCAN1236:
x_range_tpo = x_range_tpo_1236;
y_range_tpo = y_range_tpo_1236;
break;
default:
x_range_tpo = x_range_tpo_default;
y_range_tpo = y_range_tpo_default;
break;
}
init_options (pss);
pss->state = ST_IDLE;
@ -1567,11 +1558,11 @@ SANE_Status sane_start (SANE_Handle h)
release_unit (pss);
return status;
}
/* Wait for scanner ready again (e.g. until paper is loaded from an ADF) */
status = wait_scanner_ready (pss);
if (status != SANE_STATUS_GOOD)
{
DBG (DL_MAJOR_ERROR, "%s: scan command failed: %s.\n", me, sane_strstatus(status));
DBG (DL_MAJOR_ERROR, "%s: scan command failed while waiting for scanner: %s.\n", me, sane_strstatus(status));
release_unit (pss);
return status;
}
@ -1762,11 +1753,24 @@ SANE_Status sane_get_select_fd (SANE_Handle h, SANE_Int * fd)
/*
* $Log$
* Revision 1.23 2002/05/02 17:19:16 oliverschwartz
* SnapScan backend 1.4.13: Support for ADF
* Revision 1.24 2002/07/12 23:29:07 oliverschwartz
* SnapScan backend 1.4.15
*
* Revision 1.22 2002/04/27 15:35:18 oliverschwartz
* SnapScan backend 1.4.12: Fix option handling
* Revision 1.49 2002/07/12 22:53:54 oliverschwartz
* Version 1.4.15
*
* Revision 1.48 2002/07/12 22:53:16 oliverschwartz
* call sanei_usb_init() before sanei_usb_attach_matching_devices()
*
* Revision 1.47 2002/06/06 21:16:23 oliverschwartz
* Set backend version to 1.4.14
*
* Revision 1.46 2002/06/06 20:40:01 oliverschwartz
* Changed default scan area for transparancy unit of SnapScan e50
*
* Revision 1.45 2002/05/02 18:29:34 oliverschwartz
* - Added ADF support
* - Fixed status handling after cancel
*
* Revision 1.44 2002/04/27 14:42:30 oliverschwartz
* Cleanup of debug logging

Wyświetl plik

@ -29,36 +29,54 @@ scsi ACERPERI * Scanner
# Benq/Acer/Vuego 320U
usb 0x04a5 0x2022
# Benq/Acer/Vuego 620U / 620UT
usb 0x04a5 0x1a2a
usb 0x04a5 0x2040
# Benq/Acer/Vuego 640U
usb 0x04a5 0x2060
# Benq/Acer/Vuego 640BU
usb 0x04a5 0x207e
# Benq/Acer/Vuego 1240U
usb 0x04a5 0x20c0
# Benq/Acer/Vuego 3300 / 4300
usb 0x04a5 0x20b0
# Benq/Acer/Vuego 4300
usb 0x04a5 0x20de
# Benq/Acer/Vuego 5300
usb 0x04a5 0x20fe
# Agfa 1236U
usb 0x06bd 0x0002
# Agfa 1212U
usb 0x06bd 0x0001
usb 0x06bd 0x2061
# Agfa Snapscan e20
usb 0x06bd 0x2091
# Agfa Snapscan e25
usb 0x06bd 0x2095
# Agfa Snapscan e26
usb 0x06bd 0x2097
# Agfa Snapscan e40
usb 0x06bd 0x208d
# Agfa Snapscan e42
usb 0x06bd 0x20ff
# Agfa Snapscan e50
usb 0x06bd 0x208f
# Agfa Snapscan e52
usb 0x06bd 0x20fd

Wyświetl plik

@ -120,7 +120,7 @@ static struct SnapScan_Driver_desc drivers[] =
{PRISA620S, "Acer620"},
{PRISA640, "Acer640"},
{PRISA4300, "Acer4300"},
{PRISA4300, "Acer4300 (42 bit)"},
{PRISA4300_2, "Acer4300 (42 bit)"},
{PRISA1240, "Acer1240"},
{PRISA5300, "Acer5300"}
};
@ -362,8 +362,11 @@ struct snapscan_scanner
/*
* $Log$
* Revision 1.15 2002/04/27 15:35:19 oliverschwartz
* SnapScan backend 1.4.12: Fix option handling
* Revision 1.16 2002/07/12 23:29:08 oliverschwartz
* SnapScan backend 1.4.15
*
* Revision 1.32 2002/07/12 22:22:47 oliverschwartz
* Correct driver description for 4300_2
*
* Revision 1.31 2002/04/27 14:44:27 oliverschwartz
* - Remove SCSI debug options

Wyświetl plik

@ -12,9 +12,10 @@
:backend "SnapScan" ; name of backend
:version "1.4" ; version of backend
:status :beta ; :alpha, :beta, :stable, :new
:status :stable ; :alpha, :beta, :stable, :new
:manpage "sane-snapscan" ; name of manpage (if it exists)
:url "http://snapscan.sourceforge.net/" ; backend's web page
:comment "Supported bit depths: 24 bit (color), 8 bit (gray)"
:devicetype :scanner ; start of a list of devices....
; other types: :stillcam, :vidcam,
@ -26,131 +27,138 @@
:model "SnapScan 300" ; name models for above-specified mfg.
:interface "SCSI"
:comment "Only 8 bits/sample at present."
:status :beta
:model "SnapScan 310"
:interface "SCSI"
:comment "Ditto"
:status :beta
:model "SnapScan 600"
:interface "SCSI"
:comment "Ditto"
:status :stable
:comment "Optional ADF supported."
:model "SnapScan 1236s"
:interface "SCSI"
:comment "Ditto. Have no specific programming info yet."
:status :stable
:comment "Optional ADF and transparency unit supported."
:model "SnapScan 1236u"
:interface "USB"
:comment "Ditto. Have no specific programming info yet."
:status :stable
:comment "Optional ADF and transparency unit supported."
:model "SnapScan 1212u"
:interface "USB"
:comment "Ditto. Have no specific programming info yet."
:status :stable
:model "SnapScan e20"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:model "SnapScan e25"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:model "SnapScan e26"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:model "SnapScan e40"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:model "SnapScan e42"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:model "SnapScan e50"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:comment "Optional tranparency unit supported"
:model "SnapScan e52"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:comment "Optional tranparency unit supported"
:model "SnapScan e60"
:interface "USB"
:comment "Have no specific programming info yet."
:status :untested
:mfg "Acer Peripherals"
:comment "Company was renamed to <a href=\"#BENQ\">Benq</a>."
:mfg "Vuego"
;------------------------------------------------------------------------------
:comment "Company was renamed to <a href=\"#BENQ\">Benq</a>."
:model "310s"
:interface "SCSI"
:comment "Close SnapScan 310 compatible."
:mfg "Acer / Benq"
:url "www.benq.com"
:mfg "Benq"
:url "http://www.benq.com"
:comment "Formerly Acer Peripherals"
;------------------------------------------------------------------------------
:model "300f"
:interface "SCSI"
:status :stable
:model "310s"
:interface "SCSI"
:comment "Same thing as the Vuego 310s."
:status :stable
:model "610s"
:interface "SCSI"
:status :stable
:model "610plus"
:interface "SCSI"
:comment "Seems to be a close SnapScan 310/600 compatible."
:status :stable
:model "Prisa 620s"
:model "620s"
:interface "SCSI"
:comment "Seems to be a close SnapScan 310/600 compatible."
:status :stable
:model "Prisa 620u"
:model "620u"
:interface "USB"
:comment "Seems to be a close SnapScan 310/600 compatible."
:status :stable
:comment "Optional tranparency unit supported"
:model "Prisa 620ut"
:model "640u"
:interface "USB"
:comment "Seems to be a close SnapScan 310/600 compatible."
:status :stable
:model "Prisa 640u"
:model "640bu"
:interface "USB"
:comment "Seems to be a close SnapScan 310/600 compatible."
:status :stable
:model "Prisa 640bu"
:model "1240"
:interface "USB"
:comment "Seems to be a close SnapScan 310/600 compatible."
:status :stable
:comment "Optional tranparency unit supported"
:model "Prisa 1240"
:model "3300"
:interface "USB"
:comment "Seems to be a close SnapScan 310/600 compatible."
:status :stable
:model "Prisa 3300"
:model "4300"
:interface "USB"
:comment "Have no specific programming info yet."
:status :stable
:model "Prisa 4300"
:model "5300"
:interface "USB"
:comment "Have no specific programming info yet, untested."
:model "Prisa 5300"
:interface "USB"
:comment "Have no specific programming info yet, untested."
:status :alpha
:mfg "Guillemot / Hercules"
:url "www.guillemot.com"
:url "http://www.guillemot.com"
;------------------------------------------------------------------------------
:model "Maxi Scan A4 Deluxe (SCSI)"
:interface "SCSI"
:comment "May be a repackaged Vuego 310s or SnapScan 310s."
:status :stable
:comment "Seems to be a repackaged SnapScan 310s."
:model "Scan@home Touch 1248 (USB)"
:interface "USB"
:status :stable
:comment "Seems to be a repackaged Acer 3300."
; :comment and :url specifiers are optional after :mfg, :model, :desc,