1141cc406Sopenharmony_ci/* sane - Scanner Access Now Easy. 2141cc406Sopenharmony_ci Copyright (C) 2001-2012 Stéphane Voltz <stef.dev@free.fr> 3141cc406Sopenharmony_ci This file is part of the SANE package. 4141cc406Sopenharmony_ci 5141cc406Sopenharmony_ci This program is free software; you can redistribute it and/or 6141cc406Sopenharmony_ci modify it under the terms of the GNU General Public License as 7141cc406Sopenharmony_ci published by the Free Software Foundation; either version 2 of the 8141cc406Sopenharmony_ci License, or (at your option) any later version. 9141cc406Sopenharmony_ci 10141cc406Sopenharmony_ci This program is distributed in the hope that it will be useful, but 11141cc406Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 12141cc406Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13141cc406Sopenharmony_ci General Public License for more details. 14141cc406Sopenharmony_ci 15141cc406Sopenharmony_ci You should have received a copy of the GNU General Public License 16141cc406Sopenharmony_ci along with this program. If not, see <https://www.gnu.org/licenses/>. 17141cc406Sopenharmony_ci 18141cc406Sopenharmony_ci As a special exception, the authors of SANE give permission for 19141cc406Sopenharmony_ci additional uses of the libraries contained in this release of SANE. 20141cc406Sopenharmony_ci 21141cc406Sopenharmony_ci The exception is that, if you link a SANE library with other files 22141cc406Sopenharmony_ci to produce an executable, this does not by itself cause the 23141cc406Sopenharmony_ci resulting executable to be covered by the GNU General Public 24141cc406Sopenharmony_ci License. Your use of that executable is in no way restricted on 25141cc406Sopenharmony_ci account of linking the SANE library code into it. 26141cc406Sopenharmony_ci 27141cc406Sopenharmony_ci This exception does not, however, invalidate any other reasons why 28141cc406Sopenharmony_ci the executable file might be covered by the GNU General Public 29141cc406Sopenharmony_ci License. 30141cc406Sopenharmony_ci 31141cc406Sopenharmony_ci If you submit changes to SANE to the maintainers to be included in 32141cc406Sopenharmony_ci a subsequent release, you agree by submitting the changes that 33141cc406Sopenharmony_ci those changes may be distributed with this exception intact. 34141cc406Sopenharmony_ci 35141cc406Sopenharmony_ci If you write modifications of your own for SANE, it is your choice 36141cc406Sopenharmony_ci whether to permit this exception to apply to your modifications. 37141cc406Sopenharmony_ci If you do not wish that, delete this exception notice. 38141cc406Sopenharmony_ci 39141cc406Sopenharmony_ci This file implements a SANE backend for Umax PP flatbed scanners. */ 40141cc406Sopenharmony_ci 41141cc406Sopenharmony_ci#include <stdio.h> 42141cc406Sopenharmony_ci#include "../include/sane/config.h" 43141cc406Sopenharmony_ci 44141cc406Sopenharmony_ci/*****************************************************************************/ 45141cc406Sopenharmony_ci/* set port to 'idle state' and get iopl */ 46141cc406Sopenharmony_ci/*****************************************************************************/ 47141cc406Sopenharmony_ciextern int sanei_umax_pp_initPort (int port, const char *name); 48141cc406Sopenharmony_ciextern int sanei_umax_pp_initScanner (int recover); 49141cc406Sopenharmony_ciextern int sanei_umax_pp_initTransport (int recover); 50141cc406Sopenharmony_ciextern int sanei_umax_pp_endSession (void); 51141cc406Sopenharmony_ciextern int sanei_umax_pp_initCancel (void); 52141cc406Sopenharmony_ciextern int sanei_umax_pp_cancel (void); 53141cc406Sopenharmony_ciextern int sanei_umax_pp_checkModel (void); 54141cc406Sopenharmony_ciextern int sanei_umax_pp_getauto (void); 55141cc406Sopenharmony_ciextern int sanei_umax_pp_UTA (void); 56141cc406Sopenharmony_ciextern void sanei_umax_pp_setauto (int mode); 57141cc406Sopenharmony_ci 58141cc406Sopenharmony_ci#ifndef __GLOBALES__ 59141cc406Sopenharmony_ci 60141cc406Sopenharmony_ci#define RGB_MODE 0x10 61141cc406Sopenharmony_ci#define RGB12_MODE 0x11 62141cc406Sopenharmony_ci#define BW_MODE 0x08 63141cc406Sopenharmony_ci#define BW12_MODE 0x09 64141cc406Sopenharmony_ci#define BW2_MODE 0x04 65141cc406Sopenharmony_ci 66141cc406Sopenharmony_ci 67141cc406Sopenharmony_ci 68141cc406Sopenharmony_ci#define __GLOBALES__ 69141cc406Sopenharmony_ci#endif /* __GLOBALES__ */ 70141cc406Sopenharmony_ci 71141cc406Sopenharmony_ci 72141cc406Sopenharmony_ci 73141cc406Sopenharmony_ci#ifndef PRECISION_ON 74141cc406Sopenharmony_ci#define PRECISION_ON 1 75141cc406Sopenharmony_ci#define PRECISION_OFF 0 76141cc406Sopenharmony_ci 77141cc406Sopenharmony_ci#define LAMP_STATE 0x20 78141cc406Sopenharmony_ci#define MOTOR_BIT 0x40 79141cc406Sopenharmony_ci#define ASIC_BIT 0x100 80141cc406Sopenharmony_ci 81141cc406Sopenharmony_ci#define UMAX_PP_PARPORT_PS2 0x01 82141cc406Sopenharmony_ci#define UMAX_PP_PARPORT_BYTE 0x02 83141cc406Sopenharmony_ci#define UMAX_PP_PARPORT_EPP 0x04 84141cc406Sopenharmony_ci#define UMAX_PP_PARPORT_ECP 0x08 85141cc406Sopenharmony_ci 86141cc406Sopenharmony_ci#endif 87141cc406Sopenharmony_ci 88141cc406Sopenharmony_ciextern int sanei_umax_pp_scan (int x, int y, int width, int height, int dpi, 89141cc406Sopenharmony_ci int color, int gain, int offset); 90141cc406Sopenharmony_ciextern int sanei_umax_pp_move (int distance, int precision, 91141cc406Sopenharmony_ci unsigned char *buffer); 92141cc406Sopenharmony_ciextern int sanei_umax_pp_setLamp (int on); 93141cc406Sopenharmony_ciextern int sanei_umax_pp_completionWait (void); 94141cc406Sopenharmony_ciextern int sanei_umax_pp_commitScan (void); 95141cc406Sopenharmony_ciextern int sanei_umax_pp_park (void); 96141cc406Sopenharmony_ciextern int sanei_umax_pp_parkWait (void); 97141cc406Sopenharmony_ciextern int sanei_umax_pp_readBlock (long len, int window, int dpi, int last, 98141cc406Sopenharmony_ci unsigned char *buffer); 99141cc406Sopenharmony_ciextern int sanei_umax_pp_startScan (int x, int y, int width, int height, 100141cc406Sopenharmony_ci int dpi, int color, int gain, 101141cc406Sopenharmony_ci int offset, int *rbpp, int *rtw, 102141cc406Sopenharmony_ci int *rth); 103141cc406Sopenharmony_ci 104141cc406Sopenharmony_ciextern void sanei_umax_pp_setport (int port); 105141cc406Sopenharmony_ciextern int sanei_umax_pp_getport (void); 106141cc406Sopenharmony_ciextern void sanei_umax_pp_setparport (int fd); 107141cc406Sopenharmony_ciextern int sanei_umax_pp_getparport (void); 108141cc406Sopenharmony_ciextern void sanei_umax_pp_setastra (int mod); 109141cc406Sopenharmony_ciextern int sanei_umax_pp_getastra (void); 110141cc406Sopenharmony_ciextern void sanei_umax_pp_setLeft (int mod); 111141cc406Sopenharmony_ciextern int sanei_umax_pp_getLeft (void); 112141cc406Sopenharmony_ciextern void sanei_umax_pp_setfull (int mod); 113141cc406Sopenharmony_ciextern int sanei_umax_pp_getfull (void); 114141cc406Sopenharmony_ciextern int sanei_umax_pp_scannerStatus (void); 115141cc406Sopenharmony_ciextern int sanei_umax_pp_probeScanner (int recover); 116141cc406Sopenharmony_ci 117141cc406Sopenharmony_ciextern char **sanei_parport_find_port (void); 118141cc406Sopenharmony_ciextern char **sanei_parport_find_device (void); 119141cc406Sopenharmony_ci 120141cc406Sopenharmony_ciextern int sanei_umax_pp_cmdSync (int cmd); 121141cc406Sopenharmony_ciextern void sanei_umax_pp_gamma (int *red, int *green, int *blue); 122