Added IBM backend for the IBM 2456, the Ricoh IS-420 and maybe the IS-410 and

IS-430 from mf <massifr@tiscalinet.it>. Added manual page, fixed some
warnings, Added detection for IS-410 and IS-430.
merge-requests/1/head
Henning Geinitz 2003-04-15 09:54:00 +00:00
rodzic b05d98e145
commit 87387511b0
12 zmienionych plików z 2158 dodań i 4 usunięć

Wyświetl plik

@ -36,6 +36,7 @@ Backends:
hp: Peter Kirchgessner (*)
Geoffrey Dairiki
hpsj5s: Max Vorobiev (*)
ibm: mf, Henning Meier-Geinitz (*)
leo: Frank Zago (*)
ma1509: Henning Meier-Geinitz (*)
matsushita: Frank Zago (*)
@ -152,6 +153,7 @@ Matthew Duggan <stauff1@users.sourceforge.net>
Matthew Marjanovic <maddog@mir.com>
Max Vorobiev <pcwizard@yandex.ru>
Meino Christian Cramer <mccramer@s.netic.de>
mf <massifr@tiscalinet.it>
Michael Herder <crapsite@gmx.net>
Michael K. Johnson <johnsonm@redhat.com>
Michel Roelofs <michelr@stack.nl>

Wyświetl plik

@ -1,3 +1,13 @@
2003-04-15 Henning Meier-Geinitz <henning@meier-geinitz.de>
* AUTHORS backend/Makefile.in backend/dll.conf backend/ibm-scsi.c
backend/ibm.c backend/ibm.conf backend/ibm.h doc/Makefile.in
doc/sane.man doc/sane-ibm.man doc/.cvsignore
doc/descriptions/ibm.desc: Added IBM backend for the
IBM 2456, the Ricoh IS-420 and maybe the IS-410 and IS-430 from
mf <massifr@tiscalinet.it>. Added manual page, fixed some
warnings, Added detection for IS-410 and IS-430.
2003-04-14 Henning Meier-Geinitz <henning@meier-geinitz.de>
* tools/sane-desc.c: Fixed some HTML bugs.

Wyświetl plik

@ -66,7 +66,7 @@ PRELOADABLE_BACKENDS = abaton agfafocus apple artec as6e avision bh canon \
microtek2 mustek mustek_pp mustek_usb nec @NET@ pie @PINT@ plustek \
@PNM@ @QCAM@ ricoh s9036 sceptre sharp @SM3600@ @SNAPSCAN@ \
sp15c st400 tamarack test teco1 teco2 teco3 umax umax_pp umax1220u \
@V4L@ artec_eplus48u ma1509
@V4L@ artec_eplus48u ma1509 ibm
ifneq (@SELECTED_BACKENDS@,)
PRELOADABLE_BACKENDS = @SELECTED_BACKENDS@
endif
@ -111,6 +111,7 @@ DISTFILES = abaton.c abaton.conf abaton.h agfafocus.c agfafocus.conf \
hp-device.c hp-device.h hp.h hp-handle.c hp-handle.h hp-hpmem.c hp-option.c \
hp-option.h hp.README hp-scl.c hp-scl.h hp-scsi.h hp.TODO \
hpsj5s.c hpsj5s.conf hpsj5s.h \
ibm.c ibm.conf ibm.h ibm-scsi.c \
jinclude.h \
leo.c leo.h leo.conf \
lm9830.h \
@ -314,6 +315,9 @@ libsane-hp.la: ../sanei/sanei_scsi.lo
libsane-hp.la: ../sanei/sanei_usb.lo
libsane-hp.la: $(addsuffix .lo,$(EXTRA_hp))
libsane-hp.la: ../sanei/sanei_pio.lo
libsane-ibm.la: ../sanei/sanei_scsi.lo
libsane-ibm.la: ../sanei/sanei_config2.lo
libsane-ibm.la: ../sanei/sanei_constrain_value.lo
libsane-leo.la: ../sanei/sanei_config2.lo
libsane-leo.la: ../sanei/sanei_constrain_value.lo
libsane-leo.la: ../sanei/sanei_scsi.lo

Wyświetl plik

@ -23,6 +23,7 @@ fujitsu
gt68xx
hp
hpsj5s
ibm
leo
ma1509
matsushita

433
backend/ibm-scsi.c 100644
Wyświetl plik

@ -0,0 +1,433 @@
/* sane - Scanner Access Now Easy.
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. */
/*
*/
#include <time.h>
/* SCSI commands that the Ibm scanners understand: */
#define IBM_SCSI_TEST_UNIT_READY 0x00
#define IBM_SCSI_SET_WINDOW 0x24
#define IBM_SCSI_GET_WINDOW 0x25
#define IBM_SCSI_READ_SCANNED_DATA 0x28
#define IBM_SCSI_INQUIRY 0x12
#define IBM_SCSI_MODE_SELECT 0x15
#define IBM_SCSI_START_SCAN 0x1b
#define IBM_SCSI_MODE_SENSE 0x1a
#define IBM_SCSI_GET_BUFFER_STATUS 0x34
#define IBM_SCSI_OBJECT_POSITION 0x31
/* How long do we wait for scanner to have data for us */
#define MAX_WAITING_TIME 15
/* for object_position command */
#define OBJECT_POSITION_UNLOAD 0
#define OBJECT_POSITION_LOAD 1
struct scsi_window_cmd {
SANE_Byte opcode;
SANE_Byte byte2;
SANE_Byte reserved[4];
SANE_Byte len[3];
SANE_Byte control;
};
struct scsi_mode_select_cmd {
SANE_Byte opcode;
SANE_Byte byte2;
#define SMS_SP 0x01
#define SMS_PF 0x10
SANE_Byte page_code; /* for mode_sense, reserved for mode_select */
SANE_Byte unused[1];
SANE_Byte len;
SANE_Byte control;
};
struct scsi_mode_header {
SANE_Byte data_length; /* Sense data length */
SANE_Byte medium_type;
SANE_Byte dev_spec;
SANE_Byte blk_desc_len;
};
/* next struct introduced by mf */
struct scsi_object_position_cmd {
SANE_Byte opcode;
SANE_Byte position_func;
SANE_Byte count[3];
SANE_Byte res[3];
SANE_Byte control;
SANE_Byte res2;
};
struct scsi_get_buffer_status_cmd {
SANE_Byte opcode;
SANE_Byte byte2;
SANE_Byte res[5];
SANE_Byte len[2];
SANE_Byte control;
};
struct scsi_status_desc {
SANE_Byte window_id;
SANE_Byte byte2;
SANE_Byte available[3];
SANE_Byte filled[3];
};
struct scsi_status_data {
SANE_Byte len[3];
SANE_Byte byte4;
struct scsi_status_desc desc;
};
struct scsi_start_scan_cmd {
SANE_Byte opcode;
SANE_Byte byte2;
SANE_Byte unused[2];
SANE_Byte len;
SANE_Byte control;
};
struct scsi_read_scanner_cmd {
SANE_Byte opcode;
SANE_Byte byte2;
SANE_Byte data_type;
SANE_Byte byte3;
SANE_Byte data_type_qualifier[2];
SANE_Byte len[3];
SANE_Byte control;
};
static SANE_Status
test_unit_ready (int fd)
{
static SANE_Byte cmd[6];
SANE_Status status;
DBG (11, ">> test_unit_ready\n");
cmd[0] = IBM_SCSI_TEST_UNIT_READY;
memset (cmd, 0, sizeof (cmd));
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), 0, 0);
DBG (11, "<< test_unit_ready\n");
return (status);
}
static SANE_Status
inquiry (int fd, void *buf, size_t * buf_size)
{
static SANE_Byte cmd[6];
SANE_Status status;
DBG (11, ">> inquiry\n");
memset (cmd, 0, sizeof (cmd));
cmd[0] = IBM_SCSI_INQUIRY;
cmd[4] = *buf_size;
status = sanei_scsi_cmd (fd, cmd, sizeof (cmd), buf, buf_size);
DBG (11, "<< inquiry\n");
return (status);
}
static SANE_Status
mode_select (int fd, struct mode_pages *mp)
{
static struct {
struct scsi_mode_select_cmd cmd;
struct scsi_mode_header smh;
struct mode_pages mp;
} select_cmd;
SANE_Status status;
DBG (11, ">> mode_select\n");
memset (&select_cmd, 0, sizeof (select_cmd));
select_cmd.cmd.opcode = IBM_SCSI_MODE_SELECT;
select_cmd.cmd.byte2 |= SMS_PF;
select_cmd.cmd.len = sizeof(select_cmd.smh) + sizeof(select_cmd.mp);
/* next line by mf */
/* select_cmd.cmd.page_code= 20; */
memcpy (&select_cmd.mp, mp, sizeof(*mp));
status = sanei_scsi_cmd (fd, &select_cmd, sizeof (select_cmd), 0, 0);
DBG (11, "<< mode_select\n");
return (status);
}
#if 0
static SANE_Status
mode_sense (int fd, struct mode_pages *mp, SANE_Byte page_code)
{
static struct scsi_mode_select_cmd cmd; /* no type, we can reuse it for sensing */
static struct {
struct scsi_mode_header smh;
struct mode_pages mp;
} select_data;
static size_t select_size = sizeof(select_data);
SANE_Status status;
DBG (11, ">> mode_sense\n");
memset (&cmd, 0, sizeof (cmd));
cmd.opcode = IBM_SCSI_MODE_SENSE;
cmd.page_code = page_code;
cmd.len = sizeof(select_data);
status = sanei_scsi_cmd (fd, &cmd, sizeof (cmd), &select_data, &select_size);
memcpy (mp, &select_data.mp, sizeof(*mp));
DBG (11, "<< mode_sense\n");
return (status);
}
#endif
static SANE_Status
trigger_scan (int fd)
{
static struct scsi_start_scan_cmd cmd;
static char window_id_list[1] = { '\0' }; /* scan start data out */
static size_t wl_size = 1;
SANE_Status status;
DBG (11, ">> trigger scan\n");
memset (&cmd, 0, sizeof (cmd));
cmd.opcode = IBM_SCSI_START_SCAN;
cmd.len = wl_size;
/* next line by mf */
/* cmd.unused[0] = 1; */
if (wl_size)
status = sanei_scsi_cmd (fd, &cmd, sizeof (cmd), &window_id_list, &wl_size);
else
status = sanei_scsi_cmd (fd, &cmd, sizeof (cmd), 0, 0);
DBG (11, "<< trigger scan\n");
return (status);
}
static SANE_Status
set_window (int fd, struct ibm_window_data *iwd)
{
static struct {
struct scsi_window_cmd cmd;
struct ibm_window_data iwd;
} win;
SANE_Status status;
DBG (11, ">> set_window\n");
memset (&win, 0, sizeof (win));
win.cmd.opcode = IBM_SCSI_SET_WINDOW;
_lto3b(sizeof(*iwd), win.cmd.len);
memcpy (&win.iwd, iwd, sizeof(*iwd));
status = sanei_scsi_cmd (fd, &win, sizeof (win), 0, 0);
DBG (11, "<< set_window\n");
return (status);
}
static SANE_Status
get_window (int fd, struct ibm_window_data *iwd)
{
static struct scsi_window_cmd cmd;
static size_t iwd_size;
SANE_Status status;
iwd_size = sizeof(*iwd);
DBG (11, ">> get_window datalen = %lu\n", (unsigned long) iwd_size);
memset (&cmd, 0, sizeof (cmd));
cmd.opcode = IBM_SCSI_GET_WINDOW;
#if 1 /* it was if 0 */
cmd.byte2 |= (SANE_Byte)0x01; /* set Single bit to get one window desc. */
#endif
_lto3b(iwd_size, cmd.len);
status = sanei_scsi_cmd (fd, &cmd, sizeof (cmd), iwd, &iwd_size);
DBG (11, "<< get_window, datalen = %lu\n", (unsigned long) iwd_size);
return (status);
}
static SANE_Status
read_data (int fd, void *buf, size_t * buf_size)
{
static struct scsi_read_scanner_cmd cmd;
SANE_Status status;
DBG (11, ">> read_data %lu\n", (unsigned long) *buf_size);
memset (&cmd, 0, sizeof (cmd));
cmd.opcode = IBM_SCSI_READ_SCANNED_DATA;
_lto3b(*buf_size, cmd.len);
status = sanei_scsi_cmd (fd, &cmd, sizeof (cmd), buf, buf_size);
DBG (11, "<< read_data %lu\n", (unsigned long) *buf_size);
return (status);
}
static SANE_Status
object_position (int fd, int load)
{
static struct scsi_object_position_cmd cmd;
SANE_Status status;
DBG (11, ">> object_position\n");
memset (&cmd, 0, sizeof (cmd));
cmd.opcode = IBM_SCSI_OBJECT_POSITION;
if (load)
cmd.position_func = OBJECT_POSITION_LOAD;
else
cmd.position_func = OBJECT_POSITION_UNLOAD;
_lto3b(1, cmd.count);
status = sanei_scsi_cmd (fd, &cmd, sizeof (cmd), 0, 0);
DBG (11, "<< object_position\n");
return (status);
}
static SANE_Status
get_data_status (int fd, struct scsi_status_desc *dbs)
{
static struct scsi_get_buffer_status_cmd cmd;
static struct scsi_status_data ssd;
size_t ssd_size = sizeof(ssd);
SANE_Status status;
DBG (11, ">> get_data_status %lu\n", (unsigned long) ssd_size);
memset (&cmd, 0, sizeof (cmd));
cmd.opcode = IBM_SCSI_GET_BUFFER_STATUS;
_lto2b(ssd_size, cmd.len);
status = sanei_scsi_cmd (fd, &cmd, sizeof (cmd), &ssd, &ssd_size);
memcpy (dbs, &ssd.desc, sizeof(*dbs));
if (status == SANE_STATUS_GOOD &&
((unsigned int) _3btol(ssd.len) <= sizeof(*dbs) || _3btol(ssd.desc.filled) == 0)) {
DBG (11, "get_data_status: busy\n");
status = SANE_STATUS_DEVICE_BUSY;
}
DBG (11, "<< get_data_status %lu\n", (unsigned long) ssd_size);
return (status);
}
#if 0
static SANE_Status
ibm_wait_ready_tur (int fd)
{
struct timeval now, start;
SANE_Status status;
gettimeofday (&start, 0);
while (1)
{
DBG(3, "scsi_wait_ready: sending TEST_UNIT_READY\n");
status = sanei_scsi_cmd (fd, test_unit_ready, sizeof (test_unit_ready),
0, 0);
switch (status)
{
default:
/* Ignore errors while waiting for scanner to become ready.
Some SCSI drivers return EIO while the scanner is
returning to the home position. */
DBG(1, "scsi_wait_ready: test unit ready failed (%s)\n",
sane_strstatus (status));
/* fall through */
case SANE_STATUS_DEVICE_BUSY:
gettimeofday (&now, 0);
if (now.tv_sec - start.tv_sec >= MAX_WAITING_TIME)
{
DBG(1, "ibm_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 */
break;
case SANE_STATUS_GOOD:
return status;
}
}
return SANE_STATUS_INVAL;
}
#endif
static SANE_Status
ibm_wait_ready (Ibm_Scanner * s)
{
struct scsi_status_desc dbs;
time_t now, start;
SANE_Status status;
start = time(NULL);
while (1)
{
status = get_data_status (s->fd, &dbs);
switch (status)
{
default:
/* Ignore errors while waiting for scanner to become ready.
Some SCSI drivers return EIO while the scanner is
returning to the home position. */
DBG(1, "scsi_wait_ready: get datat status failed (%s)\n",
sane_strstatus (status));
/* fall through */
case SANE_STATUS_DEVICE_BUSY:
now = time(NULL);
if (now - start >= MAX_WAITING_TIME)
{
DBG(1, "ibm_wait_ready: timed out after %lu seconds\n",
(u_long) (now - start));
return SANE_STATUS_INVAL;
}
break;
case SANE_STATUS_GOOD:
DBG(11, "ibm_wait_ready: %d bytes ready\n", _3btol(dbs.filled));
return status;
break;
}
usleep (1000000); /* retry after 100ms */
}
return SANE_STATUS_INVAL;
}

1172
backend/ibm.c 100644

Plik diff jest za duży Load Diff

3
backend/ibm.conf 100644
Wyświetl plik

@ -0,0 +1,3 @@
scsi IBM 2456
scsi RICOH
/dev/scanner

393
backend/ibm.h 100644
Wyświetl plik

@ -0,0 +1,393 @@
/* sane - Scanner Access Now Easy.
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. */
#ifndef ibm_h
#define ibm_h 1
#include <sys/types.h>
#include <sane/config.h>
/* defines for scan_image_mode field */
#define IBM_BINARY_MONOCHROME 0
#define IBM_DITHERED_MONOCHROME 1
#define IBM_GRAYSCALE 2
/* defines for paper field */
#define IBM_PAPER_USER_DEFINED 0
#define IBM_PAPER_A3 1
#define IBM_PAPER_A4 2
#define IBM_PAPER_A4L 3
#define IBM_PAPER_A5 4
#define IBM_PAPER_A5L 5
#define IBM_PAPER_A6 6
#define IBM_PAPER_B4 7
#define IBM_PAPER_B5 8
#define IBM_PAPER_LEGAL 9
#define IBM_PAPER_LETTER 10
/* sizes for mode parameter's base_measurement_unit */
#define INCHES 0
#define MILLIMETERS 1
#define POINTS 2
#define DEFAULT_MUD 1200
#define MEASUREMENTS_PAGE (SANE_Byte)(0x03)
/* Mode Page Control */
#define PC_CURRENT 0x00
#define PC_CHANGE 0x40
#define PC_DEFAULT 0x80
#define PC_SAVED 0xc0
static const SANE_String_Const mode_list[] =
{
"Lineart", "Halftone", "Gray",
0
};
static const SANE_String_Const paper_list[] =
{
"User",
"A3",
"A4", "A4R",
"A5", "A5R",
"A6",
"B4", "B5",
"Legal", "Letter",
0
};
#define PAPER_A3_W 14032
#define PAPER_A3_H 19842
#define PAPER_A4_W 9921
#define PAPER_A4_H 14032
#define PAPER_A4R_W 14032
#define PAPER_A4R_H 9921
#define PAPER_A5_W 7016
#define PAPER_A5_H 9921
#define PAPER_A5R_W 9921
#define PAPER_A5R_H 7016
#define PAPER_A6_W 4960
#define PAPER_A6_H 7016
#define PAPER_B4_W 11811
#define PAPER_B4_H 16677
#define PAPER_B5_W 8598
#define PAPER_B5_H 12142
#define PAPER_LEGAL_W 10200
#define PAPER_LEGAL_H 16800
#define PAPER_LETTER_W 10200
#define PAPER_LETTER_H 13200
static const SANE_Range u8_range =
{
0, /* minimum */
255, /* maximum */
0 /* quantization */
};
static const SANE_Range ibm2456_res_range =
{
100, /* minimum */
600, /* maximum */
0 /* quantization */
};
static const SANE_Range default_x_range =
{
0, /* minimum */
/* (SANE_Word) ( * DEFAULT_MUD), maximum */
14032, /* maximum (found empirically for Gray mode) */
/* in Lineart mode it works till 14062 */
2 /* quantization */
};
static const SANE_Range default_y_range =
{
0, /* minimum */
/* (SANE_Word) (14 * DEFAULT_MUD), maximum */
20410, /* maximum (found empirically) */
2 /* quantization */
};
static inline void
_lto2b(SANE_Int val, SANE_Byte *bytes)
{
bytes[0] = (val >> 8) & 0xff;
bytes[1] = val & 0xff;
}
static inline void
_lto3b(SANE_Int val, SANE_Byte *bytes)
{
bytes[0] = (val >> 16) & 0xff;
bytes[1] = (val >> 8) & 0xff;
bytes[2] = val & 0xff;
}
static inline void
_lto4b(SANE_Int val, SANE_Byte *bytes)
{
bytes[0] = (val >> 24) & 0xff;
bytes[1] = (val >> 16) & 0xff;
bytes[2] = (val >> 8) & 0xff;
bytes[3] = val & 0xff;
}
static inline SANE_Int
_2btol(SANE_Byte *bytes)
{
SANE_Int rv;
rv = (bytes[0] << 8) |
bytes[1];
return (rv);
}
static inline SANE_Int
_3btol(SANE_Byte *bytes)
{
SANE_Int rv;
rv = (bytes[0] << 16) |
(bytes[1] << 8) |
bytes[2];
return (rv);
}
static inline SANE_Int
_4btol(SANE_Byte *bytes)
{
SANE_Int rv;
rv = (bytes[0] << 24) |
(bytes[1] << 16) |
(bytes[2] << 8) |
bytes[3];
return (rv);
}
typedef enum
{
OPT_NUM_OPTS = 0,
OPT_MODE_GROUP,
OPT_MODE,
OPT_X_RESOLUTION,
OPT_Y_RESOLUTION,
OPT_ADF,
OPT_GEOMETRY_GROUP,
OPT_PAPER, /* predefined formats */
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_ENHANCEMENT_GROUP,
OPT_BRIGHTNESS,
OPT_CONTRAST,
/* must come last: */
NUM_OPTIONS
}
Ibm_Option;
typedef union
{
SANE_Bool b;
SANE_Word w;
SANE_Word *wa; /* word array */
SANE_String s;
}
Option_Value;
typedef struct Ibm_Info
{
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_Int xres_default;
SANE_Int yres_default;
SANE_Int image_mode_default;
SANE_Int paper_default;
SANE_Int brightness_default;
SANE_Int contrast_default;
SANE_Int adf_default;
SANE_Int bmu;
SANE_Int mud;
}
Ibm_Info;
typedef struct Ibm_Device
{
struct Ibm_Device *next;
SANE_Device sane;
Ibm_Info info;
}
Ibm_Device;
typedef struct Ibm_Scanner
{
/* all the state needed to define a scan request: */
struct Ibm_Scanner *next;
int fd; /* SCSI filedescriptor */
SANE_Option_Descriptor opt[NUM_OPTIONS];
Option_Value val[NUM_OPTIONS];
SANE_Parameters params;
/* scanner dependent/low-level state: */
Ibm_Device *hw;
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 image_composition;
SANE_Int bpp;
SANE_Bool reverse;
/* next lines by mf */
SANE_Int adf_state;
#define ADF_UNUSED 0 /* scan from flatbed, not ADF */
#define ADF_ARMED 1 /* scan from ADF, everything's set up */
#define ADF_CLEANUP 2 /* eject paper from ADF on close */
/* end lines by mf */
size_t bytes_to_read;
int scanning;
}
Ibm_Scanner;
struct inquiry_data {
SANE_Byte devtype;
SANE_Byte byte2;
SANE_Byte byte3;
SANE_Byte byte4;
SANE_Byte byte5;
SANE_Byte res1[2];
SANE_Byte flags;
SANE_Byte vendor[8];
SANE_Byte product[8];
SANE_Byte revision[4];
SANE_Byte byte[60];
};
#define IBM_WINDOW_DATA_SIZE 320
struct ibm_window_data {
/* header */
SANE_Byte reserved[6];
SANE_Byte len[2];
/* data */
SANE_Byte window_id; /* must be zero */
SANE_Byte reserved0;
SANE_Byte x_res[2];
SANE_Byte y_res[2];
SANE_Byte x_org[4];
SANE_Byte y_org[4];
SANE_Byte width[4];
SANE_Byte length[4];
SANE_Byte brightness;
SANE_Byte threshold;
SANE_Byte contrast;
SANE_Byte image_comp; /* image composition (data type) */
SANE_Byte bits_per_pixel;
SANE_Byte halftone_code; /* halftone_pattern[0] in ricoh.h */
SANE_Byte halftone_id; /* halftone_pattern[1] in ricoh.h */
SANE_Byte pad_type;
SANE_Byte bit_ordering[2];
SANE_Byte compression_type;
SANE_Byte compression_arg;
SANE_Byte res3[6];
/* Vendor Specific parameter byte(s) */
/* Ricoh specific, follow the scsi2 standard ones */
SANE_Byte byte1;
SANE_Byte byte2;
SANE_Byte mrif_filtering_gamma_id;
SANE_Byte byte3;
SANE_Byte byte4;
SANE_Byte binary_filter;
SANE_Byte reserved2[18];
SANE_Byte reserved3[256];
};
struct measurements_units_page {
SANE_Byte page_code; /* 0x03 */
SANE_Byte parameter_length; /* 0x06 */
SANE_Byte bmu;
SANE_Byte res1;
SANE_Byte mud[2];
SANE_Byte res2[2]; /* anybody know what `COH' may mean ??? */
/* next 4 lines by mf */
SANE_Byte adf_page_code;
SANE_Byte adf_parameter_length;
SANE_Byte adf_control;
SANE_Byte res3[5];
};
struct mode_pages {
SANE_Byte page_code;
SANE_Byte parameter_length;
SANE_Byte rest[14]; /* modified by mf; it was 6; see above */
#if 0
SANE_Byte more_pages[243]; /* maximum size 255 bytes (incl header) */
#endif
};
#endif /* ibm_h */

Wyświetl plik

@ -51,7 +51,7 @@ SECT5 = sane-abaton.5 sane-agfafocus.5 sane-apple.5 sane-as6e.5 sane-dll.5 \
sane-mustek_usb.5 sane-sceptre.5 sane-canon_pp.5 sane-canon630u.5 \
sane-teco1.5 sane-teco2.5 sane-teco3.5 sane-test.5 sane-sp15c.5 \
sane-coolscan2.5 sane-hpsj5s.5 sane-gt68xx.5 sane-artec_eplus48u.5 \
sane-ma1509.5
sane-ma1509.5 sane-ibm.5
SECT7 = sane.7
MANPAGES = $(SECT1) $(SECT5) $(SECT7)
READMES = README AUTHORS COPYING ChangeLog LICENSE NEWS PROBLEMS \
@ -90,7 +90,7 @@ DISTFILES = Makefile.in backend-writing.txt descriptions.txt \
sane.tex saned.man scanimage.man sane-sceptre.man sane-canon_pp.man \
sane-teco1.man sane-teco2.man sane-teco3.man sane-test.man sane-sp15c.man \
sane-hpsj5s.man gamma4scanimage.man sane-gt68xx.man sane-artec_eplus48u.man \
sane-ma1509.man
sane-ma1509.man sane-ibm.man
.PHONY: all clean depend dist distclean html html-man install \
install-mostang sane-html uninstall

Wyświetl plik

@ -0,0 +1,42 @@
; SANE Backend specification file
;
; It's basically emacs-lisp --- so ";" indicates comment to end of line.
; All syntactic elements are keyword tokens, followed by a string or
; keyword argument, as specified.
;
; ":backend" *must* be specified.
; All other information is optional (but what good is the file without it?).
;
:backend "ibm" ; name of backend
:url "http://www.meier-geinitz.de/sane/ibm-backend/"
:version "1.0-3" ; version of backend
:status :alpha ; :alpha, :beta, :stable, :new
;
:manpage "sane-ibm" ; name of manpage (if it exists)
:devicetype :scanner
:mfg "IBM" ; name a manufacturer
:url "http://www.ibm.com/"
:model "2456" ; name models for above-specified mfg.
:interface "SCSI"
:status :alpha
;:comment "?"
:mfg "Ricoh" ; name a manufacturer
:model "IS-410"
:interface "SCSI"
:status :untested
:comment "Untested, please report!"
:model "IS-420"
:interface "SCSI"
:status :alpha
:comment "Flatbed works."
:model "IS-430"
:interface "SCSI"
:status :untested
:comment "Untested, please report!"

88
doc/sane-ibm.man 100644
Wyświetl plik

@ -0,0 +1,88 @@
.TH sane-ibm 5 "14 Apr 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane-ibm
.SH NAME
sane-ibm \- SANE backend for IBM and Ricoh SCSI flatbed scanners
.SH DESCRIPTION
The
.B sane-ibm
library implements a SANE (Scanner Access Now Easy) backend that provides
access to the IBM 2456 and the Ricoh IS-410, IS-420, and IS-430 flatbed
scanners. Support for the IS-410 and IS-430 is untested. Please contact the
sane-devel mailing list if you own such a scanner.
.PP
This backend is alpha-quality. It may have bugs and some scanners haven't been
tested at all. Be careful and pull the plug if the scanner causes unusual
noise.
.SH "DEVICE NAMES"
This backend expects device names of the form:
.PP
.RS
.I special
.RE
.PP
Where
.I special
is either the path-name for the special device that corresponds to a SCSI
scanner. The program
.I sane-find-scanner
helps to find out the correct device. Under Linux, such a device name could be
.I /dev/sg0
or
.IR /dev/sga ,
for example. See
.BR sane-scsi (5)
for details.
.SH CONFIGURATION
The contents of the
.I ibm.conf
file is a list of device names that correspond to SCSI
scanners. Empty lines and lines starting with a hash mark (#) are
ignored. See
.BR sane-scsi (5)
on details of what constitutes a valid device name.
.SH FILES
.TP
.I @CONFIGDIR@/ibm.conf
The backend configuration file (see also description of
.B SANE_CONFIG_DIR
below).
.TP
.I @LIBDIR@/libsane-ibm.a
The static library implementing this backend.
.TP
.I @LIBDIR@/libsane-ibm.so
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_IBM
If the library was compiled with debug support enabled, this
environment variable controls the debug level for this backend. Higher
debug levels increase the verbosity of the output.
.SH "SEE ALSO"
.BR sane (7),
.BR sane\-find\-scanner (1),
.BR sane\-scsi (5),
.SH AUTHOR
mf <massifr@tiscalinet.it>
.br
Manual page and some fixes by Henning Meier-Geinitz <henning@meier-geinitz.de>

Wyświetl plik

@ -1,4 +1,4 @@
.TH sane 7 "13 Apr 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.TH sane 7 "14 Apr 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane
.SH NAME
@ -260,6 +260,11 @@ The SANE backend for the Hewlett-Packard ScanJet 5S scanner. See
.BR sane\-hpsj5s (5)
for details.
.TP
.B ibm
The SANE backend for some IBM and Ricoh SCSI scanners. See
.BR sane\-ibm (5)
for details.
.TP
.B leo
This backend supports the Leo S3 and the Across FS-1130, which is a re-badged
LEO FS-1130 scanner. See
@ -793,6 +798,7 @@ you can also contact the author of this manual page:
.BR sane\-gt68xx (5),
.BR sane\-hp (5),
.BR sane\-hpsj5s (5),
.BR sane\-ibm (5),
.BR sane\-leo (5),
.BR sane\-ma1509 (5),
.BR sane\-matsushita (5),