kopia lustrzana https://gitlab.com/sane-project/backends
Removed, support is now in fujitsu-backend.
Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
1982eec1dd
commit
9fa809f7f6
|
@ -1,720 +0,0 @@
|
|||
#ifndef M3096G_SCSI_H
|
||||
#define M3096G_SCSI_H
|
||||
|
||||
static const char RCSid_sh[] = "$Header$";
|
||||
/* 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.
|
||||
|
||||
This file implements a SANE backend for Fujitsu M3096G
|
||||
flatbed/ADF scanners. It was derived from the COOLSCAN driver.
|
||||
Written by Randolph Bentson <bentson@holmsjoen.com> */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.4 2001/10/10 21:50:21 hmg
|
||||
* Update (from Oliver Schirrmeister <oschirr@abm.de>). Added: Support for ipc2/3
|
||||
* and cmp2 options; support for duplex-scanners m3093DG, m4097DG; constraint checking
|
||||
* for m3093; support EVPD (virtual product data); support ADF paper size spezification.
|
||||
* Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||
*
|
||||
* Revision 1.3 2000/08/12 15:09:17 pere
|
||||
* Merge devel (v1.0.3) into head branch.
|
||||
*
|
||||
* Revision 1.1.2.4 2000/03/14 17:47:07 abel
|
||||
* new version of the Sharp backend added.
|
||||
*
|
||||
* Revision 1.1.2.3 2000/02/14 14:20:18 pere
|
||||
* Make lint_catcher static to avoid link problems with duplicate symbols.
|
||||
*
|
||||
* Revision 1.1.2.2 2000/01/26 03:51:45 pere
|
||||
* Updated backends sp15c (v1.12) and m3096g (v1.11).
|
||||
*
|
||||
* Revision 1.6 2000/01/05 05:27:19 bentson
|
||||
* indent to barfin' GNU style
|
||||
*
|
||||
* Revision 1.5 1999/11/24 20:07:10 bentson
|
||||
* add license verbiage
|
||||
*
|
||||
* Revision 1.4 1999/11/23 18:53:15 bentson
|
||||
* spelling change
|
||||
*
|
||||
* Revision 1.3 1999/11/18 18:13:36 bentson
|
||||
* basic grayscale scanning works
|
||||
*
|
||||
* Revision 1.2 1999/11/17 00:36:28 bentson
|
||||
* basic lineart scanning works
|
||||
*
|
||||
* Revision 1.1 1999/11/12 05:42:08 bentson
|
||||
* can move paper, but not yet scan
|
||||
*
|
||||
*/
|
||||
|
||||
/****************************************************/
|
||||
|
||||
static inline void
|
||||
setbitfield (unsigned char *pageaddr, int mask, int shift, int val) \
|
||||
{
|
||||
*pageaddr = (*pageaddr & ~(mask << shift)) | ((val & mask) << shift);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static inline void
|
||||
resetbitfield (unsigned char *pageaddr, int mask, int shift, int val) \
|
||||
{
|
||||
*pageaddr = (*pageaddr & ~(mask << shift)) | (((!val) & mask) << shift);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static inline int
|
||||
getbitfield (unsigned char *pageaddr, int mask, int shift) \
|
||||
{
|
||||
return ((*pageaddr >> shift) & mask);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static inline int
|
||||
getnbyte (unsigned char *pnt, int nbytes) \
|
||||
{
|
||||
unsigned int result = 0;
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
assert (nbytes < 5);
|
||||
#endif
|
||||
for (i = 0; i < nbytes; i++)
|
||||
result = (result << 8) | (pnt[i] & 0xff);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static inline void
|
||||
putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes) \
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
assert (nbytes < 5);
|
||||
#endif
|
||||
for (i = nbytes - 1; i >= 0; i--)
|
||||
\
|
||||
{
|
||||
pnt[i] = value & 0xff;
|
||||
value = value >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ==================================================================== */
|
||||
/* SCSI commands */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *cmd;
|
||||
int size;
|
||||
}
|
||||
scsiblk;
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
#define RESERVE_UNIT 0x16
|
||||
#define RELEASE_UNIT 0x17
|
||||
#define INQUIRY 0x12
|
||||
#define REQUEST_SENSE 0x03
|
||||
#define SEND_DIAGNOSTIC 0x1d
|
||||
#define TEST_UNIT_READY 0x00
|
||||
#define SET_WINDOW 0x24
|
||||
#define SET_SUBWINDOW 0xc0
|
||||
#define OBJECT_POSITION 0x31
|
||||
#define SEND 0x2a
|
||||
#define READ 0x28
|
||||
#define MODE_SELECT 0x15
|
||||
#define MODE_SENSE 0x1a
|
||||
#define SCAN 0x1b
|
||||
#define HW_STATUS 0xc2
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char reserve_unitC[] =
|
||||
{RESERVE_UNIT, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk reserve_unitB =
|
||||
{reserve_unitC, sizeof (reserve_unitC)};
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char release_unitC[] =
|
||||
{RELEASE_UNIT, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk release_unitB =
|
||||
{release_unitC, sizeof (release_unitC)};
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char inquiryC[] =
|
||||
{INQUIRY, 0x00, 0x00, 0x00, 0x1f, 0x00};
|
||||
static scsiblk inquiryB =
|
||||
{inquiryC, sizeof (inquiryC)};
|
||||
|
||||
#define set_IN_evpd(icb, val) setbitfield(icb + 1, 1, 0, val)
|
||||
#define set_IN_page_code(icb, val) icb[0x02]=val
|
||||
#define set_IN_return_size(icb,val) icb[0x04]=val
|
||||
#define set_IN_length(out,n) out[0x04]=n-5
|
||||
|
||||
#define get_IN_periph_qual(in) getbitfield(in, 0x07, 5)
|
||||
#define IN_periph_qual_lun 0x00
|
||||
#define IN_periph_qual_nolun 0x03
|
||||
#define get_IN_periph_devtype(in) getbitfield(in, 0x1f, 0)
|
||||
#define IN_periph_devtype_scanner 0x06
|
||||
#define IN_periph_devtype_unknown 0x1f
|
||||
#define get_IN_response_format(in) getbitfield(in + 0x03, 0x07, 0)
|
||||
#define IN_recognized 0x02
|
||||
#define get_IN_additional_length(in) in[0x04]
|
||||
#define get_IN_vendor(in, buf) strncpy(buf, in + 0x08, 0x08)
|
||||
#define get_IN_product(in, buf) strncpy(buf, in + 0x10, 0x010)
|
||||
#define get_IN_version(in, buf) strncpy(buf, in + 0x20, 0x04)
|
||||
|
||||
#define get_IN_page_length(in) getnbyte(in + 0x04, 1)
|
||||
#define get_IN_basic_x_res(in) getnbyte(in + 0x05, 2)
|
||||
#define get_IN_basic_y_res(in) getnbyte(in + 0x07, 2)
|
||||
#define get_IN_step_x_res(in) getbitfield(in+0x09, 1, 0)
|
||||
#define get_IN_step_y_res(in) getbitfield(in+0x09, 1, 4)
|
||||
#define get_IN_max_x_res(in) getnbyte(in + 0x0a, 2)
|
||||
#define get_IN_max_y_res(in) getnbyte(in + 0x0c, 2)
|
||||
#define get_IN_min_x_res(in) getnbyte(in + 0x0e, 2)
|
||||
#define get_IN_min_y_res(in) getnbyte(in + 0x10, 2)
|
||||
#define get_IN_std_res_200(in) getbitfield(in+ 0x12, 1, 0)
|
||||
#define get_IN_std_res_180(in) getbitfield(in+ 0x12, 1, 1)
|
||||
#define get_IN_std_res_160(in) getbitfield(in+ 0x12, 1, 2)
|
||||
#define get_IN_std_res_150(in) getbitfield(in+ 0x12, 1, 3)
|
||||
#define get_IN_std_res_120(in) getbitfield(in+ 0x12, 1, 4)
|
||||
#define get_IN_std_res_100(in) getbitfield(in+ 0x12, 1, 5)
|
||||
#define get_IN_std_res_75(in) getbitfield(in+ 0x12, 1, 6)
|
||||
#define get_IN_std_res_60(in) getbitfield(in+ 0x12, 1, 7)
|
||||
#define get_IN_std_res_1200(in) getbitfield(in+ 0x13, 1, 0)
|
||||
#define get_IN_std_res_800(in) getbitfield(in+ 0x13, 1, 1)
|
||||
#define get_IN_std_res_600(in) getbitfield(in+ 0x13, 1, 2)
|
||||
#define get_IN_std_res_480(in) getbitfield(in+ 0x13, 1, 3)
|
||||
#define get_IN_std_res_400(in) getbitfield(in+ 0x13, 1, 4)
|
||||
#define get_IN_std_res_320(in) getbitfield(in+ 0x13, 1, 5)
|
||||
#define get_IN_std_res_300(in) getbitfield(in+ 0x13, 1, 6)
|
||||
#define get_IN_std_res_240(in) getbitfield(in+ 0x13, 1, 7)
|
||||
#define get_IN_window_width(in) getnbyte(in + 0x14, 4)
|
||||
#define get_IN_window_length(in) getnbyte(in + 0x18, 4)
|
||||
#define get_IN_overflow(in) getbitfield(in+0x1c, 1, 0)
|
||||
#define get_IN_monochrome(in) getbitfield(in+0x1c, 1, 1)
|
||||
#define get_IN_half_tone(in) getbitfield(in+0x1c, 1, 2)
|
||||
#define get_IN_multilevel(in) getbitfield(in+0x1c, 1, 3)
|
||||
#define get_IN_monochrome_rgb(in) getbitfield(in+0x1c, 1, 5)
|
||||
#define get_IN_half_tone_rgb(in) getbitfield(in+0x1c, 1, 6)
|
||||
#define get_IN_multilevel_rgb(in) getbitfield(in+0x1c, 1, 7)
|
||||
#define get_IN_operator_panel(in) getbitfield(in+0x20, 1, 1)
|
||||
#define get_IN_barcode(in) getbitfield(in+0x20, 1, 2)
|
||||
#define get_IN_endorser(in) getbitfield(in+0x20, 1, 3)
|
||||
#define get_IN_duplex(in) getbitfield(in+0x20, 1, 4)
|
||||
#define get_IN_trancepareny(in) getbitfield(in+0x20, 1, 5)
|
||||
#define get_IN_flatbed(in) getbitfield(in+0x20, 1, 6)
|
||||
#define get_IN_adf(in) getbitfield(in+0x20, 1, 7)
|
||||
#define get_IN_has_set_subwindow(in) (getnbyte(in+0x2a, 2)) & 1
|
||||
#define get_IN_has_imprinter(in) (getnbyte(in+0x2a, 2)) & 2
|
||||
#define get_IN_has_hw_status(in) (getnbyte(in+0x2a, 2)) & 4
|
||||
#define get_IN_ipc_outline_extraction(in) getbitfield(in+0x58, 1, 4)
|
||||
#define get_IN_ipc_image_emphasis(in) getbitfield(in+0x58, 1, 3)
|
||||
#define get_IN_ipc_auto_separation(in) getbitfield(in+0x58, 1, 2)
|
||||
#define get_IN_ipc_mirroring(in) getbitfield(in+0x58, 1, 1)
|
||||
#define get_IN_ipc_white_level_follow(in) getbitfield(in+0x58, 1, 0)
|
||||
#define get_IN_ipc_subwindow(in) getbitfield(in+0x59, 1, 7)
|
||||
#define get_IN_ipc_error_diffusion(in) getbitfield(in+0x59, 1, 6)
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char request_senseC[] =
|
||||
{REQUEST_SENSE, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk request_senseB =
|
||||
{request_senseC, sizeof (request_senseC)};
|
||||
|
||||
#define set_RS_allocation_length(sb,val) sb[0x04] = (unsigned char)val
|
||||
/* defines for request sense return block */
|
||||
#define get_RS_information_valid(b) getbitfield(b + 0x00, 1, 7)
|
||||
#define get_RS_error_code(b) getbitfield(b + 0x00, 0x7f, 0)
|
||||
#define get_RS_filemark(b) getbitfield(b + 0x02, 1, 7)
|
||||
#define get_RS_EOM(b) getbitfield(b + 0x02, 1, 6)
|
||||
#define get_RS_ILI(b) getbitfield(b + 0x02, 1, 5)
|
||||
#define get_RS_sense_key(b) getbitfield(b + 0x02, 0x0f, 0)
|
||||
#define get_RS_information(b) getnbyte(b+0x03, 4) /* normally 0 */
|
||||
#define get_RS_additional_length(b) b[0x07] /* always 10 */
|
||||
#define get_RS_ASC(b) b[0x0c]
|
||||
#define get_RS_ASCQ(b) b[0x0d]
|
||||
#define get_RS_SKSV(b) getbitfield(b+0x0f,1,7) /* valid, always 0 */
|
||||
|
||||
#define rs_return_block_size 18 /* Says Nikon */
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char send_diagnosticC[] =
|
||||
{SEND_DIAGNOSTIC, 0x04, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk send_diagnosticB =
|
||||
{send_diagnosticC, sizeof (send_diagnosticC)};
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char test_unit_readyC[] =
|
||||
{TEST_UNIT_READY, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk test_unit_readyB =
|
||||
{test_unit_readyC, sizeof (test_unit_readyC)};
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char set_windowC[] =
|
||||
{SET_WINDOW, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,};
|
||||
/* opcode, lun, _____4 X reserved____, transfer length, control byte */
|
||||
static scsiblk set_windowB =
|
||||
{set_windowC, sizeof (set_windowC)};
|
||||
#define set_SW_xferlen(sb, len) putnbyte(sb + 0x06, len, 3)
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char set_subwindowC[] =
|
||||
{SET_SUBWINDOW};
|
||||
static scsiblk set_subwindowB =
|
||||
{set_subwindowC, sizeof (set_subwindowC)};
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char object_positionC[] =
|
||||
{OBJECT_POSITION, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
/* ADF, _____Count_____, ________Reserved______, Ctl */
|
||||
static scsiblk object_positionB =
|
||||
{object_positionC, sizeof (object_positionC)};
|
||||
|
||||
#define set_OP_autofeed(b,val) setbitfield(b+0x01, 0x07, 0, val)
|
||||
#define OP_Discharge 0x00
|
||||
#define OP_Feed 0x01
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char sendC[] =
|
||||
{SEND, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk sendB =
|
||||
{sendC, sizeof (sendC)};
|
||||
|
||||
#define set_S_datatype_code(sb, val) sb[0x02] = (unsigned char)val
|
||||
#define S_datatype_imagedatai 0x00
|
||||
#define S_EX_datatype_LUT 0x01 /* Experiment code */
|
||||
#define S_EX_datatype_shading_data 0xa0 /* Experiment code */
|
||||
#define S_user_reg_gamma 0xc0
|
||||
#define S_device_internal_info 0x03
|
||||
#define set_S_datatype_qual_upper(sb, val) sb[0x04] = (unsigned char)val
|
||||
#define S_DQ_none 0x00
|
||||
#define S_DQ_Rcomp 0x06
|
||||
#define S_DQ_Gcomp 0x07
|
||||
#define S_DQ_Bcomp 0x08
|
||||
#define S_DQ_Reg1 0x01
|
||||
#define S_DQ_Reg2 0x02
|
||||
#define S_DQ_Reg3 0x03
|
||||
#define set_S_xfer_length(sb, val) putnbyte(sb + 0x06, val, 3)
|
||||
|
||||
/*
|
||||
static unsigned char gamma_user_LUT_LS1K[512] = { 0x00 };
|
||||
static scsiblk gamma_user_LUT_LS1K_LS1K = {
|
||||
gamma_user_LUT_LS1K, sizeof(gamma_user_LUT_LS1K)
|
||||
};
|
||||
*/
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char readC[] =
|
||||
{READ, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
/* Type, rsvd, type qual, __xfer length__, Ctl */
|
||||
static scsiblk readB =
|
||||
{readC, sizeof (readC)};
|
||||
|
||||
#define set_R_datatype_code(sb, val) sb[0x02] = val
|
||||
#define R_datatype_imagedata 0x00
|
||||
#define R_pixel_size 0x80
|
||||
#define R_paper_information 0x81
|
||||
#define set_R_window_id(sb, val) sb[0x05] = val
|
||||
#define set_R_xfer_length(sb, val) putnbyte(sb + 0x06, val, 3)
|
||||
#define get_PSIZE_num_x(in) getnbyte(in + 0x00, 4)
|
||||
#define get_PSIZE_num_y(in) getnbyte(in + 0x04, 4)
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char mode_selectC[] =
|
||||
{MODE_SELECT, 0x10, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk mode_selectB =
|
||||
{mode_selectC, sizeof (mode_selectC)};
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char mode_senseC[] =
|
||||
{MODE_SENSE, 0x18, 0x03, 0x00, 0x00, 0x00, /* PF set, page type 03 */ };
|
||||
static scsiblk mode_senseB =
|
||||
{mode_senseC, sizeof (mode_senseC)};
|
||||
|
||||
#define set_MS_DBD(b, val) setbitfield(b, 0x01, 3, (val?1:0))
|
||||
#define set_MS_len(b, val) putnbyte(b+0x04, val, 1)
|
||||
#define get_MS_MUD(b) getnbyte(b+(0x04+((int)*(b+0x3)))+0x4,2)
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char scanC[] =
|
||||
{SCAN, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk scanB =
|
||||
{scanC, sizeof (scanC)};
|
||||
|
||||
#define set_SC_xfer_length(sb, val) sb[0x04] = (unsigned char)val
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char hw_statusC[] =
|
||||
{HW_STATUS, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static scsiblk hw_statusB =
|
||||
{hw_statusC, sizeof (hw_statusC)};
|
||||
|
||||
#define set_HW_allocation_length(sb, len) putnbyte(sb + 0x06, len, 2)
|
||||
|
||||
#define get_HW_B5_present(in) getbitfield(in+0x02, 1, 0)
|
||||
#define get_HW_A4_present(in) getbitfield(in+0x02, 1, 1)
|
||||
#define get_HW_B4_present(in) getbitfield(in+0x02, 1, 2)
|
||||
#define get_HW_A3_present(in) getbitfield(in+0x02, 1, 3)
|
||||
#define get_HW_adf_empty(in) getbitfield(in+0x03, 1, 7)
|
||||
#define get_HW_omr(in) getbitfield(in+0x03, 1, 6)
|
||||
#define get_HW_adfc_open(in) getbitfield(in+0x03, 1, 5)
|
||||
#define get_HW_sleep(in) getbitfield(in+0x04, 1, 7)
|
||||
#define get_HW_manual_feed(in) getbitfield(in+0x04, 1, 1)
|
||||
#define get_HW_start_button(in) getbitfield(in+0x04, 1, 0)
|
||||
#define get_HW_ink_empty(in) getbitfield(in+0x06, 1, 7)
|
||||
#define get_HW_dfeed_detected(in) getbitfield(in+0x06, 1, 0)
|
||||
#define get_HW_skew_angle(in) getnbyte(in+0x08, 2)
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
/* We use the same structure for both SET WINDOW and GET WINDOW. */
|
||||
static unsigned char window_parameter_data_blockC[] =
|
||||
{
|
||||
0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, /* reserved */
|
||||
0x00, 0x00, /* Window Descriptor Length */
|
||||
};
|
||||
static scsiblk window_parameter_data_blockB =
|
||||
{window_parameter_data_blockC, sizeof (window_parameter_data_blockC)};
|
||||
|
||||
#define set_WPDB_wdblen(sb, len) putnbyte(sb + 0x06, len, 2)
|
||||
|
||||
#define STD_WDB_LEN 0x28 /* wdb_len if nothing is set by inquiry */
|
||||
#define used_WDB_size 0x40
|
||||
/*#define used_WDB_size 0x28*/
|
||||
#define max_WDB_size 0xff
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
static unsigned char window_descriptor_blockC[] =
|
||||
{
|
||||
0x00, /* 0x00 *//* Window Identifier */
|
||||
#define set_WD_wid(sb, val) sb[0] = val
|
||||
#define WD_wid_front 0x00
|
||||
#define WD_wid_back 0x80
|
||||
0x00, /* 0x01 *//* reserved, AUTO */
|
||||
#define set_WD_auto(sb, val) setbitfield(sb + 0x01, 1, 0, val)
|
||||
#define get_WD_auto(sb) getbitfield(sb + 0x01, 1, 0)
|
||||
0x00, 0x00, /* 0x02 *//* X resolution in dpi, 0 => 400 */
|
||||
#define set_WD_Xres(sb, val) putnbyte(sb + 0x02, val, 2)
|
||||
#define get_WD_Xres(sb) getnbyte(sb + 0x02, 2)
|
||||
0x00, 0x00, /* 0x04 *//* Y resolution in dpi, 0 => 400 */
|
||||
#define set_WD_Yres(sb, val) putnbyte(sb + 0x04, val, 2)
|
||||
#define get_WD_Yres(sb) getnbyte(sb + 0x04, 2)
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, /* 0x06 *//* Upper Left X in inch/1200 */
|
||||
#define set_WD_ULX(sb, val) putnbyte(sb + 0x06, val, 4)
|
||||
#define get_WD_ULX(sb) getnbyte(sb + 0x06, 4)
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, /* 0x0a *//* Upper Left Y in inch/1200 */
|
||||
#define set_WD_ULY(sb, val) putnbyte(sb + 0x0a, val, 4)
|
||||
#define get_WD_ULY(sb) getnbyte(sb + 0x0a, 4)
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, /* 0x0e *//* Width */
|
||||
#define set_WD_width(sb, val) putnbyte(sb + 0x0e, val, 4)
|
||||
#define get_WD_width(sb) getnbyte(sb + 0x0e, 4)
|
||||
#define WD_width 10200
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, /* 0x12 *//* Length */
|
||||
#define set_WD_length(sb, val) putnbyte(sb + 0x12, val, 4)
|
||||
#define get_WD_length(sb) getnbyte(sb + 0x12, 4)
|
||||
#define WD_length 13200
|
||||
0x00, /* 0x16 *//* Brightness */
|
||||
#define set_WD_brightness(sb, val) sb[0x16] = val
|
||||
#define get_WD_brightness(sb) sb[0x16]
|
||||
#define WD_brightness 0x80
|
||||
0x00, /* 0x17 *//* Threshold */
|
||||
#define set_WD_threshold(sb, val) sb[0x17] = val
|
||||
#define get_WD_threshold(sb) sb[0x17]
|
||||
#define WD_threshold 0x80
|
||||
0x00, /* 0x18 *//* Contrast */
|
||||
#define set_WD_contrast(sb, val) sb[0x18] = val
|
||||
#define get_WD_contrast(sb) sb[0x18]
|
||||
0x05, /* 0x19 *//* Image composition */
|
||||
#define set_WD_composition(sb, val) sb[0x19] = val
|
||||
#define get_WD_composition(sb) sb[0x19]
|
||||
#define WD_comp_LA 0
|
||||
#define WD_comp_HT 1
|
||||
#define WD_comp_GS 2
|
||||
0x08, /* 0x1a *//* Bits/Pixel */
|
||||
#define set_WD_bitsperpixel(sb, val) sb[0x1a] = val
|
||||
#define get_WD_bitsperpixel(sb) sb[0x1a]
|
||||
0x00, 0x00, /* 0x1b *//* Halftone pattern */
|
||||
#define set_WD_halftone(sb, val) putnbyte(sb + 0x1b, val, 2)
|
||||
#define get_WD_halftone(sb) getnbyte(sb + 0x1b, 2)
|
||||
0x00,
|
||||
/* 0x1d *//*************** STUFF ***************/
|
||||
#define set_WD_rif(sb, val) setbitfield(sb + 0x1d, 1, 7, val)
|
||||
#define get_WD_rif(sb) getbitfield(sb + 0x1d, 1, 7)
|
||||
0x00, 0x00, /* 0x1e *//* bit ordering */
|
||||
#define set_WD_bitorder(sb, val) putnbyte(sb + 0x1e, val, 2)
|
||||
#define get_WD_bitorder(sb) getnbyte(sb + 0x1e, 2)
|
||||
0x00, /* 0x20 *//* compression type */
|
||||
#define set_WD_compress_type(sb, val) sb[0x20] = val
|
||||
#define get_WD_compress_type(sb) sb[0x20]
|
||||
#define WD_cmp_NONE 0
|
||||
#define WD_cmp_MH 1
|
||||
#define WD_cmp_MR 2
|
||||
#define WD_cmp_MMR 3
|
||||
0x00, /* 0x21 *//* compression argument */
|
||||
#define set_WD_compress_arg(sb, val) sb[0x21] = val
|
||||
#define get_WD_compress_arg(sb) sb[0x21]
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, /* 0x22 *//* reserved */
|
||||
0x00, /* 0x28 *//* vendor id code */
|
||||
#define set_WD_vendor_id_code(sb, val) sb[0x28] = val
|
||||
#define get_WD_vendor_id_code(sb) sb[0x28]
|
||||
0x00, /* 0x29 *//* reserved */
|
||||
#define set_WD_gamma(sb, val) sb[0x29] = val
|
||||
#define get_WD_gamma(sb) sb[0x29]
|
||||
#define WD_gamma_DEFAULT 0
|
||||
#define WD_gamma_NORMAL 1
|
||||
#define WD_gamma_SOFT 2
|
||||
#define WD_gamma_SHARP 3
|
||||
|
||||
0x00, /* 0x2a *//* Outline */
|
||||
#define set_WD_outline(sb, val) setbitfield(sb + 0x2a, 1, 7, val)
|
||||
#define get_WD_outline(sb) getbitfield(sb + 0x2a, 1, 7)
|
||||
0x00, /* 0x2b *//* Emphasis */
|
||||
#define set_WD_emphasis(sb, val) sb[0x2b] = val
|
||||
#define get_WD_emphasis(sb) sb[0x2b]
|
||||
#define WD_emphasis_NONE 0x00
|
||||
#define WD_emphasis_LOW 0x01
|
||||
#define WD_emphasis_MEDIUM 0x30
|
||||
#define WD_emphasis_HIGH 0x50
|
||||
#define WD_emphasis_SMOOTH 0x80
|
||||
|
||||
0x00, /* 0x2c *//* Automatic separation */
|
||||
#define set_WD_auto_sep(sb, val) setbitfield(sb + 0x2c, 1, 7, val)
|
||||
#define get_WD_auto_sep(sb) getbitfield(sb + 0x2c, 1, 7)
|
||||
0x00, /* 0x2d *//* Mirroring */
|
||||
#define set_WD_mirroring(sb, val) setbitfield(sb + 0x2d, 1, 7, val)
|
||||
#define get_WD_mirroring(sb) getbitfield(sb + 0x2d, 1, 7)
|
||||
0x00, /* 0x2e *//* Variance rate for dynamic threshold */
|
||||
#define set_WD_var_rate_dyn_thresh(sb, val) sb[0x2e] = val
|
||||
#define get_WD_var_rate_dyn_thresh(sb) sb[0x2e]
|
||||
0x00, /* 0x2f *//* DTC mode */
|
||||
#define set_WD_dtc_threshold_curve(sb, val) setbitfield(sb + 0x2f, 7, 0, val)
|
||||
#define get_WD_dtc_threshold_curve(sb) getbitfield(sb + 0x2f, 7, 0)
|
||||
#define set_WD_gradiation(sb, val) setbitfield(sb + 0x2f, 3, 3, val)
|
||||
#define get_WD_gradiation(sb) getbitfield(sb + 0x2f, 3, 3)
|
||||
#define WD_gradiation_ORDINARY 0
|
||||
#define WD_gradiation_HIGH 2
|
||||
#define set_WD_smoothing_mode(sb, val) setbitfield(sb + 0x2f, 3, 5, val)
|
||||
#define get_WD_smoothing_mode(sb) getbitfield(sb + 0x2f, 3, 5)
|
||||
#define WD_smoothing_OCR 0
|
||||
#define WD_smoothing_IMAGE 1
|
||||
#define set_WD_filtering(sb, val) setbitfield(sb + 0x2f, 1, 7, val)
|
||||
#define get_WD_filtering(sb) getbitfield(sb + 0x2f, 1, 7)
|
||||
#define WD_filtering_BALLPOINT 0
|
||||
#define WD_filtering_ORDINARY 1
|
||||
|
||||
0x00, /* 0x30 *//* DTC mode 2 */
|
||||
#define set_WD_background(sb, val) setbitfield(sb + 0x30, 1, 0, val)
|
||||
#define get_WD_background(sb) getbitfield(sb + 0x30, 1, 0)
|
||||
#define WD_background_WHITE 0
|
||||
#define WD_background_BLACK 1
|
||||
#define set_WD_matrix2x2(sb, val) setbitfield(sb + 0x30, 1, 1, val)
|
||||
#define get_WD_matrix2x2(sb) getbitfield(sb + 0x30, 1, 1)
|
||||
#define set_WD_matrix3x3(sb, val) setbitfield(sb + 0x30, 1, 2, val)
|
||||
#define get_WD_matrix3x3(sb) getbitfield(sb + 0x30, 1, 2)
|
||||
#define set_WD_matrix4x4(sb, val) setbitfield(sb + 0x30, 1, 3, val)
|
||||
#define get_WD_matrix4x4(sb) getbitfield(sb + 0x30, 1, 3)
|
||||
#define set_WD_matrix5x5(sb, val) setbitfield(sb + 0x30, 1, 4, val)
|
||||
#define get_WD_matrix5x5(sb) getbitfield(sb + 0x30, 1, 4)
|
||||
#define set_WD_noise_removal(sb, val) setbitfield(sb + 0x30, 1, 5, !val)
|
||||
#define get_WD_noise_removal(sb) !getbitfield(sb + 0x30, 1, 5)
|
||||
|
||||
0x00, /* 0x31 *//* reserved */
|
||||
0x00, /* 0x32 *//* white level follower */
|
||||
#define set_WD_white_level_follow(sb, val) sb[0x32] = val
|
||||
#define get_WD_white_level_follow(sb) sb[0x32]
|
||||
#define WD_white_level_follow_DEFAULT 0x00
|
||||
#define WD_white_level_follow_ENABLED 0x80
|
||||
#define WD_white_level_follow_DISABLED 0xC0
|
||||
|
||||
0x00, 0x00, /* 0x33 *//* subwindow list */
|
||||
#define set_WD_subwindow_list(sb, val) putnbyte(sb + 0x33, val, 2)
|
||||
#define get_WD_subwindow_list(sb) getnbyte(sb + 0x33, 2)
|
||||
0x00, /* 0x35 *//* paper size */
|
||||
#define set_WD_paper_size(sb, val) setbitfield(sb + 0x35, 0x0f, 0, val)
|
||||
#define get_WD_paper_size(sb) getbitfield(sb + 0x35, 0x0f, 0)
|
||||
#define WD_paper_UNDEFINED 0
|
||||
#define WD_paper_A3 3
|
||||
#define WD_paper_A4 4
|
||||
#define WD_paper_A5 5
|
||||
#define WD_paper_DOUBLE 6
|
||||
#define WD_paper_LETTER 7
|
||||
#define WD_paper_B4 12
|
||||
#define WD_paper_B5 13
|
||||
#define WD_paper_LEGAL 15
|
||||
#define WD_paper_CUSTOM 14
|
||||
#define set_WD_paper_orientation(sb, val) setbitfield(sb + 0x35, 1, 4, val)
|
||||
#define get_WD_paper_orientation(sb) getbitfield(sb + 0x35, 1, 4)
|
||||
#define WD_paper_PORTRAIT 0
|
||||
#define WD_paper_LANDSCAPE 1
|
||||
#define set_WD_paper_selection(sb, val) setbitfield(sb + 0x35, 3, 6, val)
|
||||
#define get_WD_paper_selection(sb) getbitfield(sb + 0x35, 3, 6)
|
||||
#define WD_paper_SEL_UNDEFINED 0
|
||||
#define WD_paper_SEL_STANDARD 2
|
||||
#define WD_paper_SEL_NON_STANDARD 3
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, /* 0x36 *//* paper width X */
|
||||
#define set_WD_paper_width_X(sb, val) putnbyte(sb + 0x36, val, 4)
|
||||
#define get_WD_paper_width_X(sb) getnbyte(sb + 0x36, 4)
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, /* 0x3a *//* paper length Y */
|
||||
#define set_WD_paper_length_Y(sb, val) putnbyte(sb+0x3a, val, 4)
|
||||
#define get_WD_paper_length_Y(sb) getnbyte(sb+0x3a, 4)
|
||||
0x00, /* 0x3e *//* DTC selection */
|
||||
#define set_WD_dtc_selection(sb, val) setbitfield(sb + 0x3e, 3, 6, val)
|
||||
#define get_WD_dtc_selection(sb) getbitfield(sb + 0x3e, 3, 6)
|
||||
#define WD_dtc_selection_DEFAULT 0
|
||||
#define WD_dtc_selection_DYNAMIC 1
|
||||
#define WD_dtc_selection_SIMPLIFIED 2
|
||||
|
||||
0x00, /* 0x3f *//* reserved */
|
||||
/* 0x40 (last) */
|
||||
};
|
||||
|
||||
static scsiblk window_descriptor_blockB =
|
||||
{window_descriptor_blockC, sizeof (window_descriptor_blockC)};
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
/*#define set_WDB_length(length) (window_descriptor_block.size = (length)) */
|
||||
#define WPDB_OFF(b) (b + set_window.size)
|
||||
#define WDB_OFF(b, n) (b + set_window.size + \
|
||||
window_parameter_data_block.size + \
|
||||
( window_descriptor_block.size * (n - 1) ) )
|
||||
#define set_WPDB_wdbnum(sb,n) set_WPDB_wdblen(sb,window_descriptor_block.size*n)
|
||||
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
/* Length of internal info structure */
|
||||
#define DI_length 256
|
||||
/* Functions for picking out data from the internal info structure */
|
||||
#define get_DI_ADbits(b) getnbyte(b + 0x00, 1)
|
||||
#define get_DI_Outputbits(b) getnbyte(b + 0x01, 1)
|
||||
#define get_DI_MaxResolution(b) getnbyte(b + 0x02, 2)
|
||||
#define get_DI_Xmax(b) getnbyte(b + 0x04, 2)
|
||||
#define get_DI_Ymax(b) getnbyte(b + 0x06, 2)
|
||||
#define get_DI_Xmaxpixel(b) getnbyte(b + 0x08, 2)
|
||||
#define get_DI_Ymaxpixel(b) getnbyte(b + 0x0a, 2)
|
||||
#define get_DI_currentY(b) getnbyte(b + 0x10, 2)
|
||||
#define get_DI_currentFocus(b) getnbyte(b + 0x12, 2)
|
||||
#define get_DI_currentscanpitch(b) getnbyte(b + 0x14, 1)
|
||||
#define get_DI_autofeeder(b) getnbyte(b + 0x1e, 1)
|
||||
#define get_DI_analoggamma(b) getnbyte(b + 0x1f, 1)
|
||||
#define get_DI_deviceerror0(b) getnbyte(b + 0x40, 1)
|
||||
#define get_DI_deviceerror1(b) getnbyte(b + 0x41, 1)
|
||||
#define get_DI_deviceerror2(b) getnbyte(b + 0x42, 1)
|
||||
#define get_DI_deviceerror3(b) getnbyte(b + 0x43, 1)
|
||||
#define get_DI_deviceerror4(b) getnbyte(b + 0x44, 1)
|
||||
#define get_DI_deviceerror5(b) getnbyte(b + 0x45, 1)
|
||||
#define get_DI_deviceerror6(b) getnbyte(b + 0x46, 1)
|
||||
#define get_DI_deviceerror7(b) getnbyte(b + 0x47, 1)
|
||||
#define get_DI_WBETR_R(b) getnbyte(b + 0x80, 2) /* White balance exposure time variable R */
|
||||
#define get_DI_WBETR_G(b) getnbyte(b + 0x82, 2)
|
||||
#define get_DI_WBETR_B(b) getnbyte(b + 0x84, 2)
|
||||
#define get_DI_PRETV_R(b) getnbyte(b + 0x88, 2) /* Prescan result exposure tim4e variable R */
|
||||
#define get_DI_PRETV_G(b) getnbyte(b + 0x8a, 2)
|
||||
#define get_DI_PRETV_B(b) getnbyte(b + 0x8c, 2)
|
||||
#define get_DI_CETV_R(b) getnbyte(b + 0x90, 2) /* Current exposure time variable R */
|
||||
#define get_DI_CETV_G(b) getnbyte(b + 0x92, 2)
|
||||
#define get_DI_CETV_B(b) getnbyte(b + 0x94, 2)
|
||||
#define get_DI_IETU_R(b) getnbyte(b + 0x98, 1) /* Internal exposure time unit R */
|
||||
#define get_DI_IETU_G(b) getnbyte(b + 0x99, 1)
|
||||
#define get_DI_IETU_B(b) getnbyte(b + 0x9a, 1)
|
||||
#define get_DI_limitcondition(b) getnbyte(b + 0xa0, 1)
|
||||
#define get_DI_offsetdata_R(b) getnbyte(b + 0xa1, 1)
|
||||
#define get_DI_offsetdata_G(b) getnbyte(b + 0xa2, 1)
|
||||
#define get_DI_offsetdata_B(b) getnbyte(b + 0xa3, 1)
|
||||
#define get_DI_poweron_errors(b,to) memcpy(to, (b + 0xa8), 8)
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
|
||||
static scsiblk *lint_catcher[] =
|
||||
{&reserve_unitB,
|
||||
&release_unitB,
|
||||
&inquiryB,
|
||||
&request_senseB,
|
||||
&send_diagnosticB,
|
||||
&test_unit_readyB,
|
||||
&set_windowB,
|
||||
&set_subwindowB,
|
||||
&object_positionB,
|
||||
&sendB,
|
||||
&readB,
|
||||
&mode_selectB,
|
||||
&mode_senseB,
|
||||
&scanB,
|
||||
&window_parameter_data_blockB,
|
||||
&window_descriptor_blockB};
|
||||
|
||||
#endif /* M3096G_SCSI_H */
|
3786
backend/m3096g.c
3786
backend/m3096g.c
Plik diff jest za duży
Load Diff
|
@ -1 +0,0 @@
|
|||
scsi FUJITSU
|
448
backend/m3096g.h
448
backend/m3096g.h
|
@ -1,448 +0,0 @@
|
|||
#ifndef M3096G_H
|
||||
#define M3096G_H
|
||||
|
||||
static const char RCSid_h[] = "$Header$";
|
||||
/* 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.
|
||||
|
||||
This file implements a SANE backend for Fujitsu M3096G
|
||||
flatbed/ADF scanners. It was derived from the COOLSCAN driver.
|
||||
Written by Randolph Bentson <bentson@holmsjoen.com> */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.4 2001/10/10 21:50:24 hmg
|
||||
* Update (from Oliver Schirrmeister <oschirr@abm.de>). Added: Support for ipc2/3
|
||||
* and cmp2 options; support for duplex-scanners m3093DG, m4097DG; constraint checking
|
||||
* for m3093; support EVPD (virtual product data); support ADF paper size spezification.
|
||||
* Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||
*
|
||||
* Revision 1.3 2000/08/12 15:09:18 pere
|
||||
* Merge devel (v1.0.3) into head branch.
|
||||
*
|
||||
* Revision 1.1.2.3 2000/03/14 17:47:09 abel
|
||||
* new version of the Sharp backend added.
|
||||
*
|
||||
* Revision 1.1.2.2 2000/01/26 03:51:47 pere
|
||||
* Updated backends sp15c (v1.12) and m3096g (v1.11).
|
||||
*
|
||||
* Revision 1.8 2000/01/25 16:25:34 bentson
|
||||
* clean-up compiler warnings
|
||||
*
|
||||
* Revision 1.7 2000/01/05 05:26:00 bentson
|
||||
* indent to barfin' GNU style
|
||||
*
|
||||
* Revision 1.6 1999/11/24 20:06:58 bentson
|
||||
* add license verbiage
|
||||
*
|
||||
* Revision 1.5 1999/11/23 18:47:43 bentson
|
||||
* add some constraint checking
|
||||
*
|
||||
* Revision 1.4 1999/11/19 17:30:07 bentson
|
||||
* enhance control of device; remove unused cruft
|
||||
*
|
||||
* Revision 1.3 1999/11/18 18:13:36 bentson
|
||||
* basic grayscale scanning works
|
||||
*
|
||||
* Revision 1.2 1999/11/17 00:36:22 bentson
|
||||
* basic lineart scanning works
|
||||
*
|
||||
* Revision 1.1 1999/11/12 05:41:45 bentson
|
||||
* can move paper, but not yet scan
|
||||
*
|
||||
*/
|
||||
|
||||
static int num_devices;
|
||||
static struct m3096g *first_dev;
|
||||
|
||||
enum m3096g_Option
|
||||
{
|
||||
OPT_NUM_OPTS = 0,
|
||||
|
||||
OPT_MODE_GROUP,
|
||||
OPT_SOURCE,
|
||||
OPT_MODE,
|
||||
OPT_TYPE,
|
||||
OPT_X_RES,
|
||||
OPT_Y_RES,
|
||||
OPT_PRESCAN,
|
||||
OPT_PREVIEW_RES,
|
||||
|
||||
OPT_GEOMETRY_GROUP,
|
||||
OPT_TL_X, /* in mm/2^16 */
|
||||
OPT_TL_Y, /* in mm/2^16 */
|
||||
OPT_BR_X, /* in mm/2^16 */
|
||||
OPT_BR_Y, /* in mm/2^16 */
|
||||
|
||||
OPT_ENHANCEMENT_GROUP,
|
||||
OPT_AVERAGING,
|
||||
OPT_BRIGHTNESS,
|
||||
OPT_THRESHOLD,
|
||||
OPT_CONTRAST,
|
||||
|
||||
OPT_RIF,
|
||||
OPT_COMPRESSION,
|
||||
|
||||
OPT_DTC_SELECTION,
|
||||
OPT_GAMMA,
|
||||
OPT_OUTLINE_EXTRACTION,
|
||||
OPT_EMPHASIS,
|
||||
OPT_AUTOSEP,
|
||||
OPT_MIRROR_IMAGE,
|
||||
OPT_VARIANCE_RATE,
|
||||
OPT_THRESHOLD_CURVE,
|
||||
OPT_GRADIATION,
|
||||
OPT_SMOOTHING_MODE,
|
||||
OPT_FILTERING,
|
||||
OPT_BACKGROUND,
|
||||
OPT_NOISE_REMOVAL,
|
||||
OPT_MATRIX2X2,
|
||||
OPT_MATRIX3X3,
|
||||
OPT_MATRIX4X4,
|
||||
OPT_MATRIX5X5,
|
||||
OPT_WHITE_LEVEL_FOLLOW,
|
||||
|
||||
OPT_DUPLEX,
|
||||
|
||||
OPT_PAPER_SIZE,
|
||||
OPT_PAPER_ORIENTATION,
|
||||
OPT_PAPER_WIDTH,
|
||||
OPT_PAPER_HEIGHT,
|
||||
|
||||
OPT_START_BUTTON,
|
||||
|
||||
OPT_ADVANCED_GROUP,
|
||||
OPT_PREVIEW,
|
||||
|
||||
/* must come last: */
|
||||
NUM_OPTIONS
|
||||
};
|
||||
|
||||
struct m3096g
|
||||
{
|
||||
struct m3096g *next;
|
||||
|
||||
SANE_Option_Descriptor opt[NUM_OPTIONS];
|
||||
SANE_Device sane;
|
||||
|
||||
char vendor[9];
|
||||
char product[17];
|
||||
char version[5];
|
||||
|
||||
char *devicename; /* name of the scanner device */
|
||||
int sfd; /* output file descriptor, scanner device */
|
||||
int pipe;
|
||||
|
||||
int scanning; /* "in progress" flag */
|
||||
|
||||
/* detected features of the scanner */
|
||||
|
||||
int autofeeder; /* detected */
|
||||
int flatbed; /* detected */
|
||||
int ipc; /* detected (ipc2/3 option) */
|
||||
int cmp2; /* detected (cmp2 option) */
|
||||
int is_duplex; /* detected */
|
||||
int has_hw_status; /* true for M409X series */
|
||||
int has_outline;
|
||||
int has_emphasis;
|
||||
int has_autosep;
|
||||
int has_mirroring;
|
||||
int has_white_level_follow;
|
||||
int has_subwindow;
|
||||
SANE_Range adf_width_range;
|
||||
SANE_Range adf_height_range;
|
||||
SANE_Range x_range;
|
||||
SANE_Range y_range;
|
||||
|
||||
SANE_Range x_res_range; /* ranges are only valid if step != 0 */
|
||||
SANE_Range y_res_range;
|
||||
SANE_Range x_grey_res_range;
|
||||
SANE_Range y_grey_res_range;
|
||||
|
||||
int x_res_min; /* minimum and maximum resolution */
|
||||
int x_res_max; /* are only valid if ?_res_step != 0 */
|
||||
int x_res_step;
|
||||
int y_res_min;
|
||||
int y_res_max;
|
||||
int y_res_step;
|
||||
int x_res_min_grey;
|
||||
int x_res_max_grey;
|
||||
int x_res_step_grey;
|
||||
int y_res_min_grey;
|
||||
int y_res_max_grey;
|
||||
int y_res_step_grey;
|
||||
|
||||
SANE_Int x_res_list[17]; /* range of x and y resolution */
|
||||
SANE_Int y_res_list[17]; /* if scanner has only fixed resolutions */
|
||||
SANE_Int x_res_list_grey[17];
|
||||
SANE_Int y_res_list_grey[17];
|
||||
|
||||
|
||||
/*******************************/
|
||||
|
||||
int i_num_frames; /* used for duplex scanning */
|
||||
int i_transfer_length; /* needed when the scanner returns compressed data */
|
||||
/* and size of return data is unknown in advance */
|
||||
|
||||
int use_adf; /* requested */
|
||||
int reader_pid; /* child is running */
|
||||
int prescan; /* ??? */
|
||||
|
||||
/***** terms for "set window" command *****/
|
||||
int x_res; /* resolution in */
|
||||
int y_res; /* pixels/inch */
|
||||
int tl_x; /* top left position, */
|
||||
int tl_y; /* in inch/1200 units */
|
||||
int br_x; /* bottom right position, */
|
||||
int br_y; /* in inch/1200 units */
|
||||
|
||||
int brightness;
|
||||
int threshold;
|
||||
int contrast;
|
||||
int composition;
|
||||
int bitsperpixel;
|
||||
int halftone;
|
||||
int rif;
|
||||
int bitorder;
|
||||
int compress_type;
|
||||
int compress_arg;
|
||||
int vendor_id_code;
|
||||
int gamma;
|
||||
int outline;
|
||||
int emphasis;
|
||||
int auto_sep;
|
||||
int mirroring;
|
||||
int var_rate_dyn_thresh;
|
||||
int dtc_threshold_curve;
|
||||
int gradiation;
|
||||
int smoothing_mode;
|
||||
int filtering;
|
||||
int background;
|
||||
int matrix2x2;
|
||||
int matrix3x3;
|
||||
int matrix4x4;
|
||||
int matrix5x5;
|
||||
int noise_removal;
|
||||
int white_level_follow;
|
||||
int subwindow_list;
|
||||
int paper_size;
|
||||
int paper_orientation;
|
||||
int paper_selection;
|
||||
int paper_width_X;
|
||||
int paper_length_Y;
|
||||
int dtc_selection;
|
||||
int duplex;
|
||||
|
||||
/***** end of "set window" terms *****/
|
||||
|
||||
/* buffer used for scsi-transfer */
|
||||
unsigned char *buffer;
|
||||
unsigned int row_bufsize;
|
||||
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#define MM_PER_INCH 25.4
|
||||
#define length_quant SANE_UNFIX(SANE_FIX(MM_PER_INCH / 1200.0))
|
||||
#define mmToIlu(mm) ((mm) / length_quant)
|
||||
#define iluToMm(ilu) ((ilu) * length_quant)
|
||||
#define M3096G_CONFIG_FILE "m3096g.conf"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
m3096g_do_inquiry (struct m3096g *s);
|
||||
|
||||
static SANE_Status
|
||||
m3096g_get_vital_product_data(struct m3096g *s);
|
||||
|
||||
static SANE_Status
|
||||
m3096g_get_hardware_status(struct m3096g *s);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
SANE_Status
|
||||
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize);
|
||||
|
||||
SANE_Status
|
||||
sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only);
|
||||
|
||||
SANE_Status
|
||||
sane_open (SANE_String_Const name, SANE_Handle * handle);
|
||||
|
||||
SANE_Status
|
||||
sane_set_io_mode (SANE_Handle h, SANE_Bool non_blocking);
|
||||
|
||||
SANE_Status
|
||||
sane_get_select_fd (SANE_Handle h, SANE_Int * fdp);
|
||||
|
||||
const SANE_Option_Descriptor *
|
||||
sane_get_option_descriptor (SANE_Handle handle, SANE_Int option);
|
||||
|
||||
SANE_Status
|
||||
sane_control_option (SANE_Handle handle, SANE_Int option,
|
||||
SANE_Action action, void *val, SANE_Int * info);
|
||||
|
||||
SANE_Status
|
||||
sane_start (SANE_Handle handle);
|
||||
|
||||
SANE_Status
|
||||
sane_get_parameters (SANE_Handle handle, SANE_Parameters * params);
|
||||
|
||||
SANE_Status
|
||||
sane_read (SANE_Handle handle, SANE_Byte * buf,
|
||||
SANE_Int max_len, SANE_Int * len);
|
||||
|
||||
void
|
||||
sane_cancel (SANE_Handle h);
|
||||
|
||||
void
|
||||
sane_close (SANE_Handle h);
|
||||
|
||||
void
|
||||
sane_exit (void);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static SANE_Status
|
||||
attach_scanner (const char *devicename, struct m3096g **devp);
|
||||
|
||||
static SANE_Status
|
||||
sense_handler (int scsi_fd, u_char * result, void *arg);
|
||||
|
||||
static int
|
||||
request_sense_parse (u_char * sensed_data);
|
||||
|
||||
static void
|
||||
m3096g_set_standard_size(SANE_Handle handle);
|
||||
|
||||
#if 0
|
||||
static void
|
||||
m3096g_set_binary_res(SANE_Handle handle);
|
||||
|
||||
static int
|
||||
m3096g_valid_x_resolution(SANE_Handle handle);
|
||||
|
||||
static int
|
||||
m3096g_valid_y_resolution(SANE_Handle handle);
|
||||
#endif
|
||||
|
||||
static int
|
||||
m3096g_identify_scanner (struct m3096g *s);
|
||||
|
||||
static void
|
||||
m3096g_do_inquiry (struct m3096g *s);
|
||||
|
||||
static SANE_Status
|
||||
do_scsi_cmd (int fd, char *cmd, int cmd_len, char *out, size_t out_len);
|
||||
|
||||
static void
|
||||
hexdump (int level, char *comment, unsigned char *p, int l);
|
||||
|
||||
static SANE_Status
|
||||
init_options (struct m3096g *scanner);
|
||||
|
||||
static int
|
||||
m3096g_check_values (struct m3096g *s);
|
||||
|
||||
static int
|
||||
m3096g_grab_scanner (struct m3096g *s);
|
||||
|
||||
static int
|
||||
m3096g_free_scanner (struct m3096g *s);
|
||||
|
||||
static int
|
||||
wait_scanner (struct m3096g *s);
|
||||
|
||||
static int
|
||||
m3096g_object_position (struct m3096g *s);
|
||||
|
||||
static SANE_Status
|
||||
do_cancel (struct m3096g *scanner);
|
||||
|
||||
static void
|
||||
swap_res (struct m3096g *s);
|
||||
|
||||
static int
|
||||
m3096g_object_discharge (struct m3096g *s);
|
||||
|
||||
static int
|
||||
m3096g_set_window_param (struct m3096g *s, int prescan);
|
||||
|
||||
static size_t
|
||||
max_string_size (const SANE_String_Const strings[]);
|
||||
|
||||
static int
|
||||
m3096g_start_scan (struct m3096g *s);
|
||||
|
||||
static int
|
||||
reader_process (struct m3096g *scanner, int pipe_fd, int i_window_id);
|
||||
|
||||
static SANE_Status
|
||||
do_eof (struct m3096g *scanner);
|
||||
|
||||
static int
|
||||
pixels_per_line (struct m3096g *s);
|
||||
|
||||
static int
|
||||
lines_per_scan (struct m3096g *s);
|
||||
|
||||
static int
|
||||
bytes_per_line (struct m3096g *s);
|
||||
|
||||
static void
|
||||
m3096g_trim_rowbufsize (struct m3096g *s);
|
||||
|
||||
static SANE_Status
|
||||
m3096g_read_pixel_size (struct m3096g *s, unsigned int length, int i_window_id);
|
||||
|
||||
static SANE_Status
|
||||
m3096g_read_data_block (struct m3096g *s, unsigned int length, int i_window_id);
|
||||
|
||||
static SANE_Status
|
||||
attach_one (const char *name);
|
||||
|
||||
static int
|
||||
m3096g_valid_number (int value, const int *acceptable);
|
||||
|
||||
|
||||
#endif /* M3096G_H */
|
Ładowanie…
Reference in New Issue