Added support for Mustek Paragon 600 II EP (SCSI-over-parallel port). This is

based on a patch from James Perry. Support for libiee1284 is missing until
now. Closes bug #300143.
merge-requests/1/head
Henning Geinitz 2003-12-25 20:27:49 +00:00
rodzic 234f24f694
commit 08486e6be4
12 zmienionych plików z 1676 dodań i 86 usunięć

Wyświetl plik

@ -3,6 +3,14 @@
* doc/descriptions-external/niash.desc: Added information that
this backend will be included soon. Fixed "Snapscan" to
"SnapScan" (bug #300394).
* backend/mustek_scsi_pp.c backend/mustek_scsi_pp.h
backend/Makefile.in backend/mustek.c
backend/mustek.conf backend/mustek.h doc/sane-mustek.man
doc/sane.man doc/descriptions/mustek.desc
include/sane/sanei_pa4s2.h sanei/sanei_pa4s2.c: Added support
for Mustek Paragon 600 II EP (SCSI-over-parallel port). This is
based on a patch from James Perry. Support for libiee1284 is
missing until now. Closes bug #300143.
2003-12-23 Henning Meier-Geinitz <henning@meier-geinitz.de>

Wyświetl plik

@ -115,7 +115,7 @@ DISTFILES = abaton.c abaton.conf abaton.h agfafocus.c agfafocus.conf \
microtek.c microtek.conf microtek.h mustek.c mustek.conf mustek.h \
mustek_pp.c mustek_pp.conf mustek_pp.h mustek_pp_cis.c mustek_pp_cis.h \
mustek_pp_decl.h mustek_pp_drivers.h mustek_pp_null.c mustek_pp_ccd300.c \
mustek_pp_ccd300.h mustek_usb.c mustek_usb.conf \
mustek_pp_ccd300.h mustek_scsi_pp.c mustek_scsi_pp.h mustek_usb.c mustek_usb.conf \
mustek_usb.h mustek_usb_high.c mustek_usb_high.h mustek_usb_low.c \
mustek_usb_low.h mustek_usb_mid.c mustek_usb_mid.h nec.c nec.conf nec.h \
net.c net.conf net.h pie.c pie.conf pie-scsidef.h pint.c pint.h plustek.c \
@ -346,6 +346,7 @@ libsane-mustek.la: ../sanei/sanei_constrain_value.lo
libsane-mustek.la: ../sanei/sanei_scsi.lo
libsane-mustek.la: ../sanei/sanei_ab306.lo
libsane-mustek.la: ../sanei/sanei_thread.lo
libsane-mustek.la: ../sanei/sanei_pa4s2.lo
libsane-mustek_pp.la: ../sanei/sanei_constrain_value.lo
libsane-mustek_pp.la: ../sanei/sanei_pa4s2.lo
libsane-mustek_usb.la: ../sanei/sanei_constrain_value.lo

Wyświetl plik

@ -1,7 +1,9 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 1996, 1997 David Mosberger-Tang and Andreas Czechanowski,
1998 Andreas Bolsch for extension to ScanExpress models version 0.6,
2000-2003 Henning Meier-Geinitz.
2000-2003 Henning Meier-Geinitz,
2003 James Perry (600 EP).
This file is part of the SANE package.
This program is free software; you can redistribute it and/or
@ -41,12 +43,12 @@
If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek and some Trust flatbed
scanners with SCSI or proprietary interface. */
scanners with SCSI, parallel port (600 EP) or proprietary interface. */
/**************************************************************************/
/* Mustek backend version */
#define BUILD 134
#define BUILD 135
/**************************************************************************/
#include "../include/sane/config.h"
@ -76,6 +78,7 @@
#include "../include/sane/sanei_config.h"
#include "mustek.h"
#include "mustek_scsi_pp.h"
#ifndef SANE_I18N
#define SANE_I18N(text) text
@ -441,11 +444,39 @@ n_wait_ready (Mustek_Scanner * s)
}
}
static SANE_Status
scsi_pp_wait_ready (Mustek_Scanner * s)
{
struct timeval now, start;
SANE_Status status;
gettimeofday (&start, 0);
DBG (5, "scsi_pp_wait_ready\n");
while (1)
{
status = mustek_scsi_pp_test_ready (s->fd);
if (status == SANE_STATUS_GOOD)
return SANE_STATUS_GOOD;
gettimeofday (&now, 0);
if (now.tv_sec - start.tv_sec >= MAX_WAITING_TIME)
{
DBG (1, "scsi_pp_wait_ready: timed out after %lu seconds\n",
(u_long) (now.tv_sec - start.tv_sec));
return SANE_STATUS_INVAL;
}
usleep (100000); /* retry after 100ms */
}
}
static SANE_Status
dev_wait_ready (Mustek_Scanner * s)
{
if (s->hw->flags & MUSTEK_FLAG_N)
return n_wait_ready (s);
else if (s->hw->flags & MUSTEK_FLAG_SCSI_PP)
return scsi_pp_wait_ready (s);
else if (s->hw->flags & MUSTEK_FLAG_THREE_PASS)
{
SANE_Status status;
@ -510,8 +541,22 @@ dev_open (SANE_String_Const devname, Mustek_Scanner * s,
{
DBG (3, "dev_open: %s: can't open %s as an AB306N device\n",
sane_strstatus (status), devname);
DBG (1, "dev_open: can't open %s\n", devname);
return SANE_STATUS_INVAL;
status = mustek_scsi_pp_open (devname, &s->fd);
if (status == SANE_STATUS_GOOD)
{
s->hw->flags |= MUSTEK_FLAG_SCSI_PP;
DBG (3, "dev_open: %s is a SCSI-over-parallel device\n",
devname);
}
else
{
DBG (3,
"dev_open: %s: can't open %s as a SCSI-over-parallel device\n",
sane_strstatus (status), devname);
DBG (1, "dev_open: can't open %s\n", devname);
return SANE_STATUS_INVAL;
}
}
}
return SANE_STATUS_GOOD;
@ -548,6 +593,8 @@ dev_cmd (Mustek_Scanner * s, const void *src, size_t src_size,
}
if (s->hw->flags & MUSTEK_FLAG_N)
status = sanei_ab306_cmd (s->fd, src, src_size, dst, dst_size);
else if (s->hw->flags & MUSTEK_FLAG_SCSI_PP)
status = mustek_scsi_pp_cmd (s->fd, src, src_size, dst, dst_size);
else
status = sanei_scsi_cmd (s->fd, src, src_size, dst, dst_size);
@ -598,6 +645,17 @@ dev_block_read_start (Mustek_Scanner * s, SANE_Int lines)
readlines[4] = (lines >> 0) & 0xff;
return sanei_ab306_cmd (s->fd, readlines, sizeof (readlines), 0, 0);
}
else if (s->hw->flags & MUSTEK_FLAG_SCSI_PP)
{
SANE_Byte readlines[6];
memset (readlines, 0, sizeof (readlines));
readlines[0] = MUSTEK_SCSI_READ_SCANNED_DATA;
readlines[2] = (lines >> 16) & 0xff;
readlines[3] = (lines >> 8) & 0xff;
readlines[4] = (lines >> 0) & 0xff;
return mustek_scsi_pp_cmd (s->fd, readlines, sizeof (readlines), 0, 0);
}
else if (s->hw->flags & MUSTEK_FLAG_PARAGON_2)
{
SANE_Byte buffer[6];
@ -652,6 +710,15 @@ dev_read_req_enter (Mustek_Scanner * s, SANE_Byte * buf, SANE_Int lines,
return sanei_ab306_rdata (s->fd, planes, buf, lines, bpl);
}
else if (s->hw->flags & MUSTEK_FLAG_SCSI_PP)
{
SANE_Int planes;
*idp = 0;
planes = (s->mode & MUSTEK_MODE_COLOR) ? 3 : 1;
return mustek_scsi_pp_rdata (s->fd, planes, buf, lines, bpl);
}
else
{
if (s->hw->flags & MUSTEK_FLAG_SE)
@ -693,6 +760,8 @@ dev_close (Mustek_Scanner * s)
{
if (s->hw->flags & MUSTEK_FLAG_N)
sanei_ab306_close (s->fd);
else if (s->hw->flags & MUSTEK_FLAG_SCSI_PP)
mustek_scsi_pp_close (s->fd);
else
sanei_scsi_close (s->fd);
}
@ -799,8 +868,8 @@ paragon_2_get_adf_status (Mustek_Scanner * s)
DBG (1, "paragon_2_get_adf_status: %s\n", sane_strstatus (status));
return status;
}
DBG (5, "paragon_2_get_adf_status: sense_buffer: %x %x %x %x\n", sense_buffer[0],
sense_buffer[1], sense_buffer[3], sense_buffer[3]);
DBG (5, "paragon_2_get_adf_status: sense_buffer: %x %x %x %x\n",
sense_buffer[0], sense_buffer[1], sense_buffer[3], sense_buffer[3]);
if (sense_buffer[0] == 0x00 && sense_buffer[1] == 0x00)
return SANE_STATUS_GOOD;
@ -1192,9 +1261,9 @@ attach (SANE_String_Const devname, Mustek_Device ** devp, SANE_Bool may_wait)
dev->y_trans_range.max = SANE_FIX (255.0);
dev->dpi_range.max = SANE_FIX (600);
/* Looks like at least some versions of this scanner produce black images
in gray and color mode if MUSTEK_FORCE_GAMMA is not set. At least
versions 2.01, 2.02 and 2.10 are reported as having this bug. 3.12
doesn't need this workaround but it doesn't harm either. */
in gray and color mode if MUSTEK_FORCE_GAMMA is not set. At least
versions 2.01, 2.02 and 2.10 are reported as having this bug. 3.12
doesn't need this workaround but it doesn't harm either. */
dev->flags |= MUSTEK_FLAG_FORCE_GAMMA;
dev->flags |= MUSTEK_FLAG_PARAGON_1;
dev->sane.model = "MFS-6000SP";
@ -1317,6 +1386,14 @@ attach (SANE_String_Const devname, Mustek_Device ** devp, SANE_Bool may_wait)
dev->max_block_buffer_size = 1024 * 1024 * 1024;
dev->sane.model = "600 II N";
}
else if (dev->flags & MUSTEK_FLAG_SCSI_PP)
{
/* FIXME; experiment with different line distance codes later */
dev->dpi_range.min = SANE_FIX (75.0);
dev->flags |= MUSTEK_FLAG_LD_NONE;
dev->max_block_buffer_size = 2 * 1024 * 1024;
dev->sane.model = "600 II EP";
}
else
{
dev->sane.model = "600S/600 II CD";
@ -1999,7 +2076,7 @@ set_window_pro (Mustek_Scanner * s)
STORE16L (cp, SANE_UNFIX (s->val[OPT_BR_Y].w) * pixels_per_mm + 0.5);
if (strcmp (s->hw->sane.model, "1200 SP PRO") != 0)
*cp++ = 0x3c; /* Only needed for A3 Pro, 60 minutes until lamp-off */
*cp++ = 0x3c; /* Only needed for A3 Pro, 60 minutes until lamp-off */
DBG (5, "set_window_pro\n");
return dev_cmd (s, cmd, (cp - cmd), 0, 0);
@ -2080,7 +2157,8 @@ send_calibration_lines_pro (Mustek_Scanner * s)
if (!cmd1 || !cmd2)
{
DBG (1, "send_calibration_lines_pro: failed to malloc %ld bytes for "
"sending lines\n", (long int) (buf_size + sizeof (scsi_send_data)));
"sending lines\n",
(long int) (buf_size + sizeof (scsi_send_data)));
return SANE_STATUS_NO_MEM;
}
memset (cmd1, 0, sizeof (scsi_send_data));
@ -2242,7 +2320,8 @@ send_calibration_lines_se (Mustek_Scanner * s, SANE_Word color)
if (!cmd)
{
DBG (1, "send_calibration_lines_se: failed to malloc %ld bytes for "
"sending lines\n", (long int) (buf_size + sizeof (scsi_send_data)));
"sending lines\n",
(long int) (buf_size + sizeof (scsi_send_data)));
return SANE_STATUS_NO_MEM;
}
memset (cmd, 0, sizeof (scsi_send_data));
@ -2717,7 +2796,7 @@ gamma_correction (Mustek_Scanner * s, SANE_Int color_code)
val = s->gamma_table[table][i * 256 / bytes_per_channel];
else
val = i * 256 / bytes_per_channel;
if ((s->mode & MUSTEK_MODE_COLOR)
if ((s->mode & MUSTEK_MODE_COLOR)
&& (s->val[OPT_CUSTOM_GAMMA].w == SANE_TRUE))
/* compose intensity gamma and color channel gamma: */
val = s->gamma_table[0][val];
@ -2869,14 +2948,15 @@ do_stop (Mustek_Scanner * s)
pid = sanei_thread_waitpid (s->reader_pid, &exit_status);
if (pid < 0)
{
DBG (1, "do_stop: sanei_thread_waitpid failed, already terminated? (%s)\n",
DBG (1,
"do_stop: sanei_thread_waitpid failed, already terminated? (%s)\n",
strerror (errno));
}
else
{
DBG (2, "do_stop: reader process terminated with status %s\n",
sane_strstatus (exit_status));
if (status != SANE_STATUS_CANCELLED
if (status != SANE_STATUS_CANCELLED
&& exit_status != SANE_STATUS_GOOD)
status = exit_status;
}
@ -2886,8 +2966,8 @@ do_stop (Mustek_Scanner * s)
if (s->fd >= 0)
{
if (!sanei_thread_is_forked())
sanei_scsi_req_flush_all (); /* flush SCSI queue */
if (!sanei_thread_is_forked ())
sanei_scsi_req_flush_all (); /* flush SCSI queue */
if (s->hw->flags & MUSTEK_FLAG_PRO)
{
@ -4691,17 +4771,20 @@ output_data (Mustek_Scanner * s, FILE * fp,
static RETSIGTYPE
sigterm_handler (int signal)
{
DBG (4, "sigterm_handler: started, signal is %d, starting sanei_scsi_req_flush_all()\n", signal);
sanei_scsi_req_flush_all (); /* flush SCSI queue */
DBG (4, "sigterm_handler: sanei_scsi_req_flush_all() finisheshed, _exiting()\n");
DBG (4,
"sigterm_handler: started, signal is %d, starting sanei_scsi_req_flush_all()\n",
signal);
sanei_scsi_req_flush_all (); /* flush SCSI queue */
DBG (4,
"sigterm_handler: sanei_scsi_req_flush_all() finisheshed, _exiting()\n");
_exit (SANE_STATUS_GOOD);
}
static SANE_Int
reader_process (void * data)
reader_process (void *data)
{
Mustek_Scanner * s = (Mustek_Scanner *) data;
Mustek_Scanner *s = (Mustek_Scanner *) data;
SANE_Int lines_per_buffer, bpl;
SANE_Byte *extra = 0, *ptr;
sigset_t sigterm_set;
@ -4725,7 +4808,7 @@ reader_process (void * data)
bstat[2];
DBG (3, "reader_process: started\n");
if (sanei_thread_is_forked())
if (sanei_thread_is_forked ())
{
DBG (4, "reader_process: using fork ()\n");
close (s->pipe);
@ -4736,7 +4819,7 @@ reader_process (void * data)
DBG (4, "reader_process: using threads\n");
}
if (sanei_thread_is_forked())
if (sanei_thread_is_forked ())
{
/* ignore SIGTERM while writing SCSI commands */
sigemptyset (&sigterm_set);
@ -5115,7 +5198,8 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
DBG (1,
"sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
@ -5127,7 +5211,8 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
DBG (1,
"sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
@ -5280,7 +5365,8 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
DBG (1,
"sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
@ -5334,7 +5420,8 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
DBG (1,
"sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
@ -5425,6 +5512,7 @@ sane_exit (void)
devlist = 0;
first_dev = 0;
sanei_ab306_exit (); /* may have to do some cleanup */
mustek_scsi_pp_exit ();
DBG (5, "sane_exit: finished\n");
}
@ -6194,12 +6282,16 @@ sane_start (SANE_Handle handle)
goto stop_scanner_and_return;
}
status = inquiry (s);
if (status != SANE_STATUS_GOOD)
if (!(s->hw->flags & MUSTEK_FLAG_SCSI_PP))
{
DBG (1, "sane_start: inquiry command failed: %s\n",
sane_strstatus (status));
goto stop_scanner_and_return;
/* SCSI-over-parallel port doesn't seem to like being inquired here */
status = inquiry (s);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "sane_start: inquiry command failed: %s\n",
sane_strstatus (status));
goto stop_scanner_and_return;
}
}
if ((strcmp (s->val[OPT_SOURCE].s, "Automatic Document Feeder") == 0) &&
@ -6338,9 +6430,13 @@ sane_start (SANE_Handle handle)
if (status != SANE_STATUS_GOOD)
goto stop_scanner_and_return;
status = send_gamma_table (s);
if (status != SANE_STATUS_GOOD)
goto stop_scanner_and_return;
if (!(s->hw->flags & MUSTEK_FLAG_SCSI_PP))
{
/* This second gamma table download upsets the SCSI-over-parallel models */
status = send_gamma_table (s);
if (status != SANE_STATUS_GOOD)
goto stop_scanner_and_return;
}
s->ld.max_value = 0;
if (!(s->hw->flags & MUSTEK_FLAG_THREE_PASS))
@ -6381,9 +6477,9 @@ sane_start (SANE_Handle handle)
/* don't call any SIGTERM or SIGCHLD handlers
this is to stop xsane and other frontends from calling
its quit handlers */
memset (&act, 0, sizeof (act));
sigaction (SIGTERM, &act, 0);
sigaction (SIGCHLD, &act, 0);
memset (&act, 0, sizeof (act));
sigaction (SIGTERM, &act, 0);
sigaction (SIGCHLD, &act, 0);
if (pipe (fds) < 0)
return SANE_STATUS_IO_ERROR;
@ -6395,7 +6491,8 @@ sane_start (SANE_Handle handle)
if (s->reader_pid < 0)
{
DBG (1, "sane_start: sanei_thread_begin failed (%s)\n", strerror(errno));
DBG (1, "sane_start: sanei_thread_begin failed (%s)\n",
strerror (errno));
return SANE_STATUS_NO_MEM;
}
@ -6599,3 +6696,5 @@ sane_get_select_fd (SANE_Handle handle, SANE_Int * fd)
*fd = s->pipe;
return SANE_STATUS_GOOD;
}
#include "mustek_scsi_pp.c"

Wyświetl plik

@ -34,3 +34,7 @@ scsi SCANNER
# For the 600 II N try one of 0x26b, 0x2ab,
# 0x2eb, 0x22b, 0x32b, 0x36b, 0x3ab, 0x3eb.
# option linedistance-fix # only neccessary with firmware 2.x
#-------------------------- 600 II EP ---------------------------------------
#0x378
# 0x378=lpt1, 0x278=lpt2, 0x3bc=lpt3

Wyświetl plik

@ -69,6 +69,7 @@
#define MUSTEK_FLAG_SE_PLUS (1 << 4) /* ScanExpress Plus scanner */
#define MUSTEK_FLAG_PRO (1 << 5) /* Professional series scanner */
#define MUSTEK_FLAG_N (1 << 6) /* N-type scanner (non SCSI) */
#define MUSTEK_FLAG_SCSI_PP (1 << 22) /* SCSI over parallel (e.g. 600 II EP) */
/* Additional equipment */
#define MUSTEK_FLAG_ADF (1 << 7) /* automatic document feeder */
#define MUSTEK_FLAG_ADF_READY (1 << 8) /* paper present */

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,123 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2003 James Perry
This file is part of the SANE package.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
The exception is that, if you link a SANE library with other files
to produce an executable, this does not by itself cause the
resulting executable to be covered by the GNU General Public
License. Your use of that executable is in no way restricted on
account of linking the SANE library code into it.
This exception does not, however, invalidate any other reasons why
the executable file might be covered by the GNU General Public
License.
If you submit changes to SANE to the maintainers to be included in
a subsequent release, you agree by submitting the changes that
those changes may be distributed with this exception intact.
If you write modifications of your own for SANE, it is your choice
whether to permit this exception to apply to your modifications.
If you do not wish that, delete this exception notice.
This file implements the SCSI-over-parallel port protocol used in,
for example, the Paragon 600 II EP
*/
#ifndef mustek_scsi_pp_h
#define mustek_scsi_pp_h
static int mustek_scsi_pp_get_time (void);
/**
* Open the connection to a Mustek SCSI-over-pp device.
*
* @param dev Port address as text.
* @param fd Information about port address and I/O method. fd is not a file
* descriptor. The name and type are used for compatibility reasons.
*
* @return
* - SANE_STATUS_GOOD - on success
* - SANE_STATUS_INVAL - if the port address can't be interpreted
* - SANE_STATUS_IO_ERROR - if the device file for a port couldn't be accessed
*/
static SANE_Status mustek_scsi_pp_open (const char *dev, int *fd);
/**
* Close the connection to a Mustek SCSI-over-PP device.
*
* @param fd Information about port address and I/O method.
*
*/
static void mustek_scsi_pp_close (int fd);
/**
* Exit Mustek SCSI-over-PP.
*/
static void mustek_scsi_pp_exit (void);
/**
* Find out if the device is ready to accept new commands.
*
* @param fd Information about port address and I/O method.
*
* @return
* - SANE_STATUS_GOOD - if the device is ready
* - SANE_STATUS_DEVICE_BUSY if the device is still busy (try again later)
*/
static SANE_Status mustek_scsi_pp_test_ready (int fd);
/**
* Send a command to the Mustek SCSI-over-pp device.
*
* @param fd Information about port address and I/O method.
* @param src Data to be sent to the device.
* @param src_size Size of data to be sent to the device.
* @param dst Data to be received from the device.
* @param dst_size Size of data to be received from the device
*
* @return
* - SANE_STATUS_GOOD - on success
* - SANE_STATUS_IO_ERROR - if an error occured during the dialog with the
* device
*/
static SANE_Status mustek_scsi_pp_cmd (int fd, const void *src, size_t src_size,
void *dst, size_t * dst_size);
/**
* Read scanned image data.
*
* @param fd Information about port address and I/O method.
* @param planes Bytes per pixel (3 for color, 1 for all other modes)
* @param buf Buffer for image data.
* @param lines Number of lines
* @param bpl Bytes per line
*
* @return
* - SANE_STATUS_GOOD - on success
* - SANE_STATUS_IO_ERROR - if an error occured during the dialog with the
* device
*/
static SANE_Status mustek_scsi_pp_rdata (int fd, int planes,
SANE_Byte * buf, int lines, int bpl);
#endif /* mustek_scsi_pp_h */

Wyświetl plik

@ -39,6 +39,16 @@
:interface "SCSI"
:status :complete
:model "Paragon 600 II ED"
:interface "Parport"
:status :untested
:comment "Completely untested. If it's the same as the 600 II EP, it may work. Please contact me if you own such a device."
:model "Paragon 600 II EP"
:interface "Parport"
:status :untested
:comment "Not tested yet but should work. Please contact me if you own such a device."
:model "ScanMagic 600 II SP"
:interface "SCSI"
:status :complete

Wyświetl plik

@ -1,14 +1,14 @@
.TH sane-mustek 5 "5 Dec 2002" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.TH sane-mustek 5 "25 Dec 2002" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane-mustek
.SH NAME
sane-mustek \- SANE backend for Mustek SCSI flatbed scanners
sane-mustek \- SANE backend for Mustek SCSI flatbed scanners (and some other devices)
.SH DESCRIPTION
The
.B sane-mustek
library implements a SANE (Scanner Access Now Easy) backend that provides
access to Mustek (and some relabeled Trust and Primax) SCSI flatbed scanners.
At present, the following scanners are known to work more or less with this
backend:
library implements a SANE (Scanner Access Now Easy) backend that provides access
to Mustek (and some relabeled Trust and Primax) SCSI and parport flatbed
scanners. At present, the following scanners are known to work more or less
with this backend:
.PP
.RS
Paragon MFS-6000CX
@ -37,6 +37,8 @@ Paragon 1200 SP Pro
.br
Paragon 1200 A3 Pro
.br
Paragon 600 II EP
.br
Paragon 600 II N
.br
Trust Imagery 1200
@ -57,19 +59,21 @@ More details can be found on the Mustek SCSI backend homepage
Don't mix up MFS (Paragon), Pro and ScanExpress models! They're
completely different. Check the exact model name!
.PP
Note that most of the above scanners come with a SCSI interface. The
only non-SCSI scanner that has some support at this point is the 600
II N scanner which comes with its own parallel port adapter (i.e., it
does
Note that most of the above scanners come with a SCSI interface. The only
non-SCSI scanners that have some support at this point is the 600 II N and 600
II EP scanners. The former one comes with its own parallel port adapter (i.e.,
it does
.I not
attach to the printer port). It uses the SCSI protocoll internally, too. More
info on how to use the 600 II N can be found below in section
.BR "PARAGON 600 II N" .
attach to the printer port). Both scanners use the SCSI protocoll internally,
too. More info on how to use these parallel port scanners can be found below in
section
.BR "PARALLEL PORT SCANNERS" .
Other parallel port scanners are not supported by this backend but you may be
successful using the Mustek parallel port backend mustek_pp, see
.BR sane-mustek_pp (5).
USB scanners are also not supported by this backend but the mustek_usb,
USB scanners are also not supported by this backend but the ma1509, mustek_usb,
gt68xx, and plustek backends include support for some of them, see
.BR sane-ma1509 (5),
.BR sane-mustek_usb (5),
.BR sane-gt68xx "(5), and"
.BR sane-plustek (5).
@ -107,17 +111,17 @@ This backend expects device names of the form:
Where
.I special
is either the path-name for the special device that corresponds to a
SCSI scanner or the port number at which the 600 II N can
SCSI scanner or the port number at which the parallel port scanners can
be found (see section
.B "PARAGON 600 II N"
.B "PARALLEL PORT SCANNERS"
below). For SCSI scanners, the special device name must be a generic SCSI
device or a symlink to such a device. The program
.I sane-find-scanner
helps to find out the correct device. Under Linux, such a device name
could be
.I /dev/sga
.I /dev/sg0
or
.IR /dev/sge ,
.IR /dev/sg3 ,
for example. See
.BR sane-scsi (5)
for details.
@ -281,16 +285,19 @@ Details on how to get the Mustek SCSI adapters and other cards running can be
found at
.IR http://www.meier-geinitz.de/sane/mustek-backend/#SCSI .
.SH "PARAGON 600 II N"
This backend has support for the Paragon 600 II N parallel port
scanner. Note that this scanner comes with its own ISA card that
implements a funky parallel port (in other words, the scanner does not
connected to the printer parallel port).
.SH "PARALLEL PORT SCANNERS"
This backend has support for the Paragon 600 II EP and Paragon 600 II N parallel
port scanners. Note that the latter scanner comes with its own ISA card that
implements a funky parallel port (in other words, the scanner does not connected
to the printer parallel port).
.PP
This scanner can be configured by listing the port number
of the adapter in the mustek.conf file. Valid port numbers are
These scanners can be configured by listing the port number
of the adapter or the parallel port in the mustek.conf file. Valid port numbers
for the 600 II N are
.IR 0x26b ", " 0x2ab ", " 0x2eb ", " 0x22b ", " 0x32b ", " 0x36b ", "
.IR 0x3ab ", " 0x3eb .
For the 600 II EP use one of these:
.IR 0x378 ", " 0x278 ", " 0x3bc .
Pick one that doesn't conflict with the other hardware in your computer. Put
only one number on a single line. Example:
.PP
@ -298,7 +305,7 @@ only one number on a single line. Example:
.I 0x3eb
.RE
.PP
Note that for this scanner root privileges are required to access the
Note that for these scanners usually root privileges are required to access the
I/O ports. Thus, either make frontends such as
.BR scanimage (1)
and
@ -306,18 +313,6 @@ and
setuid root (generally not recommended for safety reasons) or, alternatively,
access this backend through the network daemon
.BR saned (1).
On systems which support this feature, the scanner can be accessed through
.IR /dev/port .
Don't forget to adjust the permissions for
.IR /dev/port .
At least with recent Linux kernels root privileges are necessary for
.I /dev/port
access, even with full permissions set for all users..
.PP
If your images have horizontal stripes in color mode, check option
.B linedistance-fix
(see above). Apply this option for a scanner with firmware version 2.x and
disable it for version 1.x.
.PP
If the Mustek backend blocks while sending the inqiury command to the scanner,
add the option
@ -325,7 +320,7 @@ add the option
to
.IR mustek.conf .
.PP
Also note that after a while of no activity, some scanners themself (not
Also note that after a while of no activity, some scanners themselves (not
the SANE backend) turns off their CCFL lamps. This shutdown is not always
perfect with the result that the lamp sometimes continues to glow
dimly at one end. This doesn't appear to be dangerous since as soon as
@ -394,7 +389,7 @@ export SANE_DEBUG_MUSTEK=4
.SH AUTHOR
David Mosberger, Andreas Czechanowski, Andreas Bolsch (SE extensions),
Henning Meier-Geinitz
Henning Meier-Geinitz, James Perry (600 II EP).
.SH BUGS
Scanning with the SCSI adapters supplied by Mustek is very slow at

Wyświetl plik

@ -1,4 +1,4 @@
.TH sane 7 "3 Oct 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.TH sane 7 "25 Dec 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane
.SH NAME
@ -300,9 +300,9 @@ SCSI-2 command set. See
for details.
.TP
.B mustek
The SANE mustek backend supports most Mustek SCSI flatbed scanners including
the Paragon and ScanExpress series and the 600 II N (non-SCSI). Some Trust
scanners are also supported. See
The SANE mustek backend supports most Mustek SCSI flatbed scanners including the
Paragon and ScanExpress series and the 600 II N and 600 II EP (non-SCSI). Some
Trust scanners are also supported. See
.BR sane\-mustek (5)
for details.
.TP

Wyświetl plik

@ -87,6 +87,22 @@ extern char ** sanei_pa4s2_devices(void);
*/
extern SANE_Status sanei_pa4s2_open (const char *dev, int *fd);
/** Open pa4s2 SCSI-over-parallel device
*
* Opens *dev as pa4s2 SCSI-over-parallel device.
*
* @param dev IO port address ("0x378", "0x278", or "0x3BC")
* @param fd file descriptor
*
* @return
* - SANE_STATUS_GOOD - on success
* - SANE_STATUS_INVAL - if no scanner was found or the port number was wrong
* - SANE_STATUS_DEVICE_BUSY - if the device is already in use
* - SANE_STATUS_IO_ERROR - if the port couldn't be accessed
*
*/
extern SANE_Status sanei_pa4s2_scsi_pp_open (const char *dev, int *fd);
/** Close pa4s2 device
*
* @param fd file descriptor
@ -136,6 +152,27 @@ extern SANE_Status sanei_pa4s2_enable (int fd, int enable);
*/
extern SANE_Status sanei_pa4s2_readbegin (int fd, u_char reg);
/** Return port status information
*
* @param fd file descriptor
* @param status variable to receive status
*
* @return
* - SANE_STATUS_GOOD - on success
* - SANE_STATUS_INVAL - if fd is invalid or device not in use
*/
extern SANE_Status sanei_pa4s2_scsi_pp_get_status (int fd, u_char *status);
/** Selects a register number on a SCSI-over-parallel scanner
*
* @param fd file descriptor
* @param reg register number
*
* @return
* - SANE_STATUS_GOOD - on success
* - SANE_STATUS_INVAL - if fd is invalid
*/
extern SANE_Status sanei_pa4s2_scsi_pp_reg_select (int fd, int reg);
/** Read a register
*

Wyświetl plik

@ -1,5 +1,6 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2000-2003 Jochen Eisinger <jochen.eisinger@gmx.net>
Copyright (C) 2003 James Perry (scsi_pp functions)
This file is part of the SANE package.
This program is free software; you can redistribute it and/or
@ -957,6 +958,204 @@ sanei_pa4s2_devices()
return devices;
}
/*
* Needed for SCSI-over-parallel scanners (Paragon 600 II EP)
*/
SANE_Status
sanei_pa4s2_scsi_pp_get_status(int fd, u_char *status)
{
u_char stat;
TEST_DBG_INIT ();
DBG (6, "sanei_pa4s2_scsi_pp_get_status: called for fd %d\n",
fd);
#if defined (HAVE_LIBIEEE1284)
DBG (3, "sanei_pa4s2_scsi_pp_get_status: not implemented yet for libieee1284\n");
return SANE_STATUS_UNSUPPORTED;
#else
if ((fd < 0) || (fd >= NELEMS (port)))
{
DBG (2, "sanei_pa4s2_scsi_pp_get_status: invalid fd %d\n", fd);
DBG (6, "sanei_pa4s2_scsi_pp_get_status: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
if (port[fd].in_use == SANE_FALSE)
{
DBG (2, "sanei_pa4s2_scsi_pp_get_status: port is not in use\n");
DBG (6, "sanei_pa4s2_scsi_pp_get_status: port is 0x%03lx\n",
port[fd].base);
DBG (5, "sanei_pa4s2_scsi_pp_get_status: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
if (port[fd].enabled == SANE_FALSE)
{
DBG (2, "sanei_pa4s2_scsi_pp_get_status: port is not enabled\n");
DBG (6, "sanei_pa4s2_scsi_pp_get_status: port is 0x%03lx\n",
port[fd].base);
DBG (5, "sanei_pa4s2_scsi_pp_get_status: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
outb(0x4, port[fd].base+2);
stat=inb(port[fd].base+1)^0x80;
*status=(stat&0x2f)|((stat&0x10)<<2)|((stat&0x40)<<1)|((stat&0x80)>>3);
DBG (5, "sanei_pa4s2_scsi_pp_get_status: status=0x%02X\n", *status);
DBG (6, "sanei_pa4s2_scsi_pp_get_status: returning SANE_STATUS_GOOD\n");
#endif
return SANE_STATUS_GOOD;
}
/*
* SCSI-over-parallel scanners need this done when a register is
* selected
*/
SANE_Status
sanei_pa4s2_scsi_pp_reg_select (int fd, int reg)
{
int base;
TEST_DBG_INIT ();
#if defined (HAVE_LIBIEEE1284)
DBG (3, "sanei_pa4s2_scsi_pp_reg_select: not implemented yet for libieee1284\n");
return SANE_STATUS_UNSUPPORTED;
#else
if ((fd < 0) || (fd >= NELEMS (port)))
{
DBG (2, "sanei_pa4s2_scsi_pp_reg_select: invalid fd %d\n", fd);
DBG (6, "sanei_pa4s2_scsi_pp_reg_select: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
if (port[fd].in_use == SANE_FALSE)
{
DBG (2, "sanei_pa4s2_scsi_pp_reg_select: port is not in use\n");
DBG (6, "sanei_pa4s2_scsi_pp_reg_select: port is 0x%03lx\n",
port[fd].base);
DBG (5, "sanei_pa4s2_scsi_pp_reg_select: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
if (port[fd].enabled == SANE_FALSE)
{
DBG (2, "sanei_pa4s2_scsi_pp_reg_select: port is not enabled\n");
DBG (6, "sanei_pa4s2_scsi_pp_reg_select: port is 0x%03lx\n",
port[fd].base);
DBG (5, "sanei_pa4s2_scsi_pp_reg_select: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
base=port[fd].base;
DBG (6, "sanei_pa4s2_scsi_pp_reg_select: selecting register %u at 0x%03x\n",
(int) reg, base);
outb (reg | 0x58, base + 0);
outb (0x04, base + 2);
outb (0x06, base + 2);
outb (0x04, base + 2);
outb (0x04, base + 2);
return SANE_STATUS_GOOD;
#endif
}
/*
* The SCSI-over-parallel scanners need to be handled a bit differently
* when opened, as they don't return a valid ASIC ID, so this can't be
* used for detecting valid read modes
*/
SANE_Status
sanei_pa4s2_scsi_pp_open (const char *dev, int *fd)
{
u_char val;
SANE_Status status;
TEST_DBG_INIT ();
DBG(4, "sanei_pa4s2_scsi_pp_open: called for device '%s'\n", dev);
DBG(5, "sanei_pa4s2_scsi_pp_open: trying to connect to port\n");
#if defined (HAVE_LIBIEEE1284)
DBG (3, "sanei_pa4s2_scsi_pp_open: not implemented yet for libieee1284\n");
return SANE_STATUS_UNSUPPORTED;
#else
if ((*fd = pa4s2_open (dev, &status)) == -1)
{
DBG (5, "sanei_pa4s2_scsi_pp_open: connection failed\n");
return status;
}
DBG (6, "sanei_pa4s2_scsi_pp_open: connected to device using fd %u\n", *fd);
DBG (5, "sanei_pa4s2_scsi_pp_open: checking for scanner\n");
if (sanei_pa4s2_enable (*fd, SANE_TRUE)!=SANE_STATUS_GOOD)
{
DBG (3, "sanei_pa4s2_scsi_pp_open: error enabling device\n");
return SANE_STATUS_IO_ERROR;
}
/*
* Instead of checking ASIC ID, check device status
*/
if (sanei_pa4s2_scsi_pp_get_status(*fd, &val)!=SANE_STATUS_GOOD)
{
DBG (3, "sanei_pa4s2_scsi_pp_open: error getting device status\n");
sanei_pa4s2_enable (*fd, SANE_FALSE);
return SANE_STATUS_IO_ERROR;
}
val&=0xf0;
if ((val==0xf0)||(val&0x40)||(!(val&0x20)))
{
DBG (3, "sanei_pa4s2_scsi_pp_open: device returned status 0x%02X\n", val);
sanei_pa4s2_enable (*fd, SANE_FALSE);
return SANE_STATUS_DEVICE_BUSY;
}
if (sanei_pa4s2_enable (*fd, SANE_FALSE)!=SANE_STATUS_GOOD)
{
DBG (3, "sanei_pa4s2_scsi_pp_open: error disabling device\n");
return SANE_STATUS_IO_ERROR;
}
/* FIXME: it would be nice to try to use a better mode here, but how to
* know if it's going to work? */
DBG (4, "sanei_pa4s2_scsi_pp_open: returning SANE_STATUS_GOOD\n");
return SANE_STATUS_GOOD;
#endif
}
SANE_Status
sanei_pa4s2_open (const char *dev, int *fd)
@ -1850,4 +2049,34 @@ sanei_pa4s2_devices()
return calloc(1, sizeof(char *));
}
SANE_Status
sanei_pa4s2_scsi_pp_get_status(int fd, u_char *status)
{
TEST_DBG_INIT ();
DBG (4, "sanei_pa4s2_scsi_pp_get_status: fd=%d, status=%p\n",
fd, (void *) status);
DBG (3, "sanei_pa4s2_scsi_pp_get_status: A4S2 support not compiled\n");
return SANE_STATUS_UNSUPPORTED;
}
SANE_Status
sanei_pa4s2_scsi_pp_reg_select (int fd, int reg)
{
TEST_DBG_INIT ();
DBG (4, "sanei_pa4s2_scsi_pp_reg_select: fd=%d, reg=%d\n",
fd, reg);
DBG (3, "sanei_pa4s2_devices: A4S2 support not compiled\n");
return SANE_STATUS_UNSUPPORTED;
}
SANE_Status
sanei_pa4s2_scsi_pp_open (const char *dev, int *fd)
{
TEST_DBG_INIT ();
DBG (4, "sanei_pa4s2_scsi_pp_open: dev=%s, fd=%p\n",
dev, (void *) fd);
DBG (3, "sanei_pa4s2_scsi_pp_open: A4S2 support not compiled\n");
return SANE_STATUS_UNSUPPORTED;
}
#endif /* !HAVE_IOPERM */