piuspatch
v0.1
USB addition to PIE backend
|
#include "../include/sane/config.h"
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdint.h>
#include <math.h>
#include "../include/byteorder.h"
#include "../include/sane/sane.h"
#include "../include/sane/sanei.h"
#include "../include/sane/saneopts.h"
#include "../include/sane/sanei_scsi.h"
#include "../include/sane/sanei_usb.h"
#include "../include/sane/sanei_debug.h"
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_config.h"
#include "../include/sane/sanei_thread.h"
#include "../include/sane/sanei_ir.h"
#include "../include/sane/sanei_magic.h"
#include "pie-scsidef.h"
#include "pie_usb.h"
Go to the source code of this file.
Data Structures | |
struct | Pie_cal_info |
This defines the information needed during calibration of SCSI scanners. More... | |
struct | Pie_Device |
This structure holds the information about a physical scanner. More... | |
struct | Pie_Scanner |
This structure holds information about an instance of an 'opened' scanner. More... | |
Defines | |
#define | BACKEND_NAME pie |
#define | DBG_error0 0 |
#define | DBG_error 1 |
#define | DBG_sense 2 |
#define | DBG_warning 3 |
#define | DBG_inquiry 4 |
#define | DBG_info 5 |
#define | DBG_info2 6 |
#define | DBG_proc 7 |
#define | DBG_read 8 |
#define | DBG_sane_init 10 |
#define | DBG_sane_proc 11 |
#define | DBG_sane_info 12 |
#define | DBG_sane_option 13 |
#define | DBG_dump 14 |
#define | DBG_image 15 |
#define | DBG_poke 16 |
#define | BUILD 10 |
#define | PIE_CONFIG_FILE "pie.conf" |
#define | LINEART_STR SANE_VALUE_SCAN_MODE_LINEART |
#define | HALFTONE_STR SANE_VALUE_SCAN_MODE_HALFTONE |
#define | GRAY_STR SANE_VALUE_SCAN_MODE_GRAY |
#define | COLOR_STR SANE_VALUE_SCAN_MODE_COLOR |
#define | COLOR_IR_STR "RGBI" |
#define | IR_NAME_STR "swired" |
#define | IR_TITLE_STR "Infrared processing" |
#define | IR_DESC_STR "What to do with infrared plane"; |
#define | IR_SPECT_STR "Reduce red overlap" |
#define | IR_CLEAN_STR "Remove dirt" |
#define | THE_NONE_STR "None" |
#define | CROP_NAME_STR "swcrop" |
#define | CROP_TITLE_STR "Cropping" |
#define | CROP_DESC_STR "How to crop the image"; |
#define | CROP_OUTER_STR "Outside" |
#define | CROP_INNER_STR "Inside" |
#define | LINEART 1 |
#define | HALFTONE 2 |
#define | GRAYSCALE 3 |
#define | RGB 4 |
#define | RGBI 8 |
#define | POST_SW_COLORS (1 << 0) /* gain, negatives, ..., can be done at any time */ |
#define | POST_SW_IRED (1 << 1) /* remove spectral overlap, needs complete scan */ |
#define | POST_SW_DIRT (1 << 2) /* our digital lavabo, needs complete scan */ |
#define | POST_SW_GRAIN (1 << 3) /* smoothen a bit */ |
#define | POST_SW_CROP |
#define | POST_SW_IRED_MASK (POST_SW_IRED | POST_SW_DIRT) |
#define | POST_SW_ACCUM_MASK (POST_SW_IRED_MASK | POST_SW_GRAIN | POST_SW_CROP) |
#define | CAL_MODE_PREVIEW (INQ_CAP_FAST_PREVIEW) |
#define | CAL_MODE_FLATBED 0x00 |
#define | CAL_MODE_ADF (INQ_OPT_DEV_ADF) |
#define | CAL_MODE_TRANPSARENCY (INQ_OPT_DEV_TP) |
#define | CAL_MODE_TRANPSARENCY1 (INQ_OPT_DEV_TP1) |
#define | min(a, b) (((a)<(b))?(a):(b)) |
#define | max(a, b) (((a)>(b))?(a):(b)) |
#define | DOWNLOAD_GAMMA_WAIT_TIME (1000000) |
#define | SCAN_WAIT_TIME (1000000) |
#define | SCAN_WARMUP_WAIT_TIME (500000) |
#define | TUR_WAIT_TIME (500000) |
#define | NO_PID -1 |
#define | DBG_DUMP(level, buf, n) { if (DBG_LEVEL >= (level)) pie_dump_buffer(level,buf,n); } |
Typedefs | |
typedef struct Pie_Device | Pie_Device |
This structure holds the information about a physical scanner. | |
typedef struct Pie_Scanner | Pie_Scanner |
This structure holds information about an instance of an 'opened' scanner. | |
Enumerations | |
enum | Pie_Option { OPT_NUM_OPTS = 0, OPT_MODE_GROUP, OPT_MODE, OPT_BIT_DEPTH, OPT_RESOLUTION, OPT_GEOMETRY_GROUP, OPT_TL_X, OPT_TL_Y, OPT_BR_X, OPT_BR_Y, OPT_ENHANCEMENT_GROUP, OPT_HALFTONE_PATTERN, OPT_SPEED, OPT_THRESHOLD, OPT_SW_CROP, OPT_SW_IRED, OPT_SW_GRAIN, OPT_SW_SRGB, OPT_SW_NEGA, OPT_GAMMA_VECTOR, OPT_GAMMA_VECTOR_R, OPT_GAMMA_VECTOR_G, OPT_GAMMA_VECTOR_B, OPT_ADVANCED_GROUP, OPT_PREVIEW, NUM_OPTIONS } |
Functions | |
static SANE_Status | pie_usb_read_status (int dn, unsigned char *buf) |
SANE_Status | pie_usb_scsi_wrapper (int fd, const void *src, size_t src_size, void *dst, size_t *dst_size) |
The one and only entry for SCSI over USB command wrapping. | |
static SANE_Status | pie_sense_handler (int scsi_fd, unsigned char *result, void *arg) |
static SANE_Status | pie_wait_scanner (Pie_Scanner *scanner) |
static SANE_Status | pie_send_exposure (Pie_Scanner *scanner) |
static SANE_Status | pie_send_highlight_shadow (Pie_Scanner *scanner) |
static SANE_Status | pie_power_save (Pie_Scanner *scanner, int time) |
static SANE_Status | pie_attach_one (const char *name) |
static void | pie_dump_buffer (int level, unsigned char *buf, int n) |
Debug output dumping hexadecimal bytes. | |
static SANE_Status | pie_usb_poke_ints (char *filename, int *nums, int *len) |
Read white space separated integers from a text file. | |
static SANE_Status | pie_usb_poke_bytes (char *filename, unsigned char *nums, int *len) |
Read white space separated bytes from a text file. | |
static SANE_Status | pie_usb_write_pnm_file (char *filename, uint8_t *data, int depth, int channels, int pixels_per_line, int lines) |
Write RGB or grey scale image to a pnm file , with big endian byte order. | |
static SANE_Status | pie_usb_shades_to_pnm (Pie_Scanner *scanner, char *name, int lines) |
Write a set of gray scale pnm files from shading data. | |
static SANE_Status | pie_usb_write_control_sequence (SANE_Int dn, PIE_USB_Value_Data sequ[]) |
Write a control sequence of value-data pairs to the scanner. | |
static SANE_Status | pie_usb_ready_state (SANE_Int dn) |
Query the scanners state after the last USB transaction. | |
static SANE_Status | pie_usb_write_scsi_cmd (SANE_Int dn, const SANE_Byte cmnd[6]) |
Send 6 byte SCSI command to scanner. | |
static SANE_Status | pie_usb_bulk_read (SANE_Int dn, SANE_Byte *data, size_t len) |
Read a lot of data. | |
static SANE_Status | pie_usb_read (int dn, const SANE_Byte *cmnd, void *buf, size_t *buf_len) |
Do a SCSI read transaction over USB. | |
static SANE_Status | pie_usb_write (int dn, const SANE_Byte *cmnd, size_t length) |
Do a SCSI write transaction over USB. | |
static SANE_Status | pie_usb_command (int dn, const SANE_Byte *cmnd) |
Send a simple SCSI command without data transfer. | |
static SANE_Status | pie_usb_request_sense (int dn, uint32_t *kascq) |
Send a Request Sense SCSI command to the scanner. | |
static SANE_Status | pie_sense_handler (__sane_unused__ int scsi_fd, unsigned char *result, __sane_unused__ void *arg) |
Called by sanei_scsi_cmd or pie_usb_request_sense. | |
static void | pie_init (Pie_Device *dev, SANE_Int is_USB) |
static void | pie_print_inquiry (Pie_Device *dev) |
static void | pie_get_inquiry_values (Pie_Device *dev, unsigned char *buffer) |
static void | pie_do_inquiry (Pie_Device *dev, int sfd, unsigned char *buffer) |
static int | pie_identify_scanner (Pie_Device *dev, int sfd, int is_USB) |
static void | pie_get_speeds (Pie_Device *dev) |
static void | pie_get_halftones (Pie_Device *dev, int sfd) |
static void | pie_get_cal_info (Pie_Device *dev, int sfd) |
static SANE_Status | pie_usb_attach_open (SANE_String_Const devname, SANE_Int *dn) |
Try to open and identify an USB scanner class. | |
static SANE_Status | pie_usb_try_attach (const char *name) |
Callback function for sanei_config_attach_matching_devices. | |
static SANE_Status | pie_attach_scanner (const char *devicename, Pie_Device **devp) |
static size_t | max_string_size (SANE_String_Const strings[]) |
static SANE_Status | pie_init_options (Pie_Scanner *scanner) |
static SANE_Status | pie_usb_wait_scanner (Pie_Scanner *scanner, int secs) |
TEST_UNIT_READY until ready or timed out. | |
static int | pie_usb_release_scanner (void *passed) |
Release scanner after image aquisition. | |
static SANE_Status | pie_usb_is_scanner_released (Pie_Scanner *scanner) |
Waits until a pie_usb_release_scanner has finished. | |
static SANE_Status | pie_usb_is_scanner_initialized (int dn) |
Wait for internal initialization of scanner. | |
static SANE_Status | pie_usb_copy_sensors (Pie_Scanner *scanner) |
Read a vector indicating which sensor elements are used. | |
static SANE_Status | pie_usb_scan (Pie_Scanner *scanner, int start) |
Perform SCAN command. | |
static SANE_Status | pie_usb_set_window (Pie_Scanner *scanner) |
Issue SET_SCAN_FRAME via a SCSI WRITE command. | |
static SANE_Status | pie_usb_mode_select (Pie_Scanner *scanner) |
Setup and send MODE command. | |
static SANE_Status | pie_usb_get_params (Pie_Scanner *scanner) |
Send SCSI PARAM command. | |
static void | pie_usb_calicalc_hiqual (Pie_Scanner *scanner, PIE_USB_Calibration_Read *d7cal) |
Calculate gain and exposure for quality mode. | |
static void | pie_usb_calicalc_normal (Pie_Scanner *scanner, PIE_USB_Calibration_Read *d7cal) |
static unsigned char | pie_usb_calicalc_slow_down (Pie_Scanner *scanner) |
Calculate coefficient for slowing down the scan. | |
static SANE_Status | pie_usb_calibration_send (Pie_Scanner *scanner, int calc_cal) |
Read first and then send calibration. | |
static SANE_Status | pie_usb_calibrate (Pie_Scanner *scanner) |
Do a full calibration of the scanner. | |
static void | pie_usb_correct_shading (Pie_Scanner *scanner, unsigned char *in_buf[4], SANEI_IR_bufptr out_buf[4], int pixels, int bits, int start_plane, int end_plane) |
Do shading and mirror correction on an image line. | |
static void | pie_usb_reader_reorder (Pie_Scanner *scanner, SANEI_IR_bufptr *in_img, SANEI_IR_bufptr out_img, int planes, int pixels) |
Interleave RGB(I) and do color lookup. | |
static SANE_Status | pie_usb_sw_store (Pie_Scanner *scanner, SANEI_IR_bufptr *in_img, int planes) |
Interleave RGB(I), do color lookup and store data. | |
static SANE_Status | pie_usb_reader_write (Pie_Scanner *scanner, FILE *fp, SANEI_IR_bufptr *in_img, int planes, int lines) |
Interleave RGB(I), do color lookup and write data to pipe. | |
static SANE_Status | pie_usb_smoothen_rgb (const SANE_Parameters *params, SANEI_IR_bufptr *the_img, int win_size) |
Apply triangular blur to R, G, B image data. | |
static SANE_Status | pie_usb_sw_crop_planes (SANE_Parameters *parameters, Pie_Scanner *scanner, SANEI_IR_bufptr *in_img, int top, int bot, int left, int right, int planes) |
Crop separate color planes of an image. | |
static SANE_Status | pie_usb_sw_final_crop (Pie_Scanner *scanner) |
Crop the final complete RGB image. | |
static SANE_Status | pie_usb_sw_post (Pie_Scanner *scanner, SANEI_IR_bufptr *in_img, int planes, int out_planes) |
Postprocess a scanned R, G, B(, I) image. | |
static SANE_Status | pie_usb_reader_indexed (Pie_Scanner *scanner, FILE *fp) |
Read indexed image data from scanner. | |
static SANE_Status | pie_usb_do_cancel (Pie_Scanner *scanner, int park) |
Perform actions necessary to abort scan. | |
static RETSIGTYPE | pie_usb_reader_process_sigterm_handler (__sane_unused__ int signal) |
Set a variable to indicate cancel request. | |
static SANE_Status | pie_usb_reader_unthreaded (Pie_Scanner *scanner) |
Read and store whole image. | |
static int | pie_usb_reader_process (void *data) |
Setup child process / thread for reading and piping out an image. | |
static SANE_Status | pie_usb_sane_control_option (SANE_Handle handle, SANE_Int option, SANE_Action action, void *val, SANE_Int *info) |
Set or inquire the current value of an option. | |
static SANE_Status | pie_usb_sane_start (Pie_Scanner *scanner) |
Initiates aquisition of an image. | |
static SANE_Status | pie_usb_sane_read (Pie_Scanner *scanner, SANE_Byte *buf, SANE_Int max_len, SANE_Int *len) |
Read image data out of buffer or from the device. | |
static SANE_Status | pie_usb_sane_open (Pie_Scanner *scanner, SANE_Handle *handle) |
Establish a connection to a scanner. | |
static void | pie_usb_sane_close (Pie_Scanner *scanner) |
Terminate the association between scanner and scanner structure. | |
static SANE_Status | pie_send_exposure_one (Pie_Scanner *scanner, int filter, int value) |
static SANE_Status | pie_send_highlight_shadow_one (Pie_Scanner *scanner, int filter, int highlight, int shadow) |
static SANE_Status | pie_perform_cal (Pie_Scanner *scanner, int cal_index) |
static SANE_Status | pie_do_cal (Pie_Scanner *scanner) |
static SANE_Status | pie_dwnld_gamma_one (Pie_Scanner *scanner, int filter, SANE_Int *table) |
static SANE_Status | pie_dwnld_gamma (Pie_Scanner *scanner) |
static SANE_Status | pie_set_window (Pie_Scanner *scanner) |
static SANE_Status | pie_mode_select (Pie_Scanner *scanner) |
static SANE_Status | pie_scan (Pie_Scanner *scanner, int start) |
static SANE_Status | pie_get_params (Pie_Scanner *scanner) |
static SANE_Status | pie_grab_scanner (Pie_Scanner *scanner) |
static SANE_Status | pie_give_scanner (Pie_Scanner *scanner) |
static int | pie_reader_process_indexed (Pie_Scanner *scanner, FILE *fp) |
static int | pie_reader_process_fmtline (Pie_Scanner *scanner, FILE *fp) |
static RETSIGTYPE | pie_reader_process_sigterm_handler (int signal) |
static int | pie_reader_process (void *data) |
static SANE_Status | pie_close_pipe (Pie_Scanner *scanner) |
static SANE_Status | pie_do_cancel (Pie_Scanner *scanner) |
SANE_Status | sane_init (SANE_Int *version_code, SANE_Auth_Callback __sane_unused__ authorize) |
void | sane_exit (void) |
SANE_Status | sane_get_devices (const SANE_Device ***device_list, SANE_Bool __sane_unused__ local_only) |
SANE_Status | sane_open (SANE_String_Const devicename, SANE_Handle *handle) |
void | sane_close (SANE_Handle handle) |
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_get_parameters (SANE_Handle handle, SANE_Parameters *params) |
SANE_Status | sane_start (SANE_Handle handle) |
SANE_Status | sane_read (SANE_Handle handle, SANE_Byte *buf, SANE_Int max_len, SANE_Int *len) |
void | sane_cancel (SANE_Handle handle) |
SANE_Status | sane_set_io_mode (SANE_Handle handle, SANE_Bool non_blocking) |
SANE_Status | sane_get_select_fd (SANE_Handle handle, SANE_Int *fd) |
Variables | |
static char * | scanner_str [] |
static volatile sig_atomic_t | cancel_requ |
static const SANE_Range | percentage_range_100 |
static Pie_Device * | first_dev = NULL |
static Pie_Scanner * | first_handle = NULL |
static const SANE_Device ** | devlist = NULL |
static PIE_USB_Model | crystalscan_7200_model |
static PIE_USB_Model | proscan_7200_model |
static PIE_USB_Device_Entry | pie_usb_device_list [] |
Copyright (C) 2000 Simon Munton, based on the umax backend by Oliver Rauch
Copyright (C) 2012 Michael Rickmann <mrickma@gwdg.de> for initial SCSI over USB additions
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.
19-8-2012 add PIE "SF Scanner" USB film scanner support
19-8-2012 the names of all internal functions start with pie_ now
22-2-2003 set devlist to NULL in sane_exit() set first_dev to NULL in sane_exit() eliminated num_devices
23-7-2002 added TL_X > BR_X, TL_Y > BR_Y check in sane_start
17-9-2001 changed ADLIB to AdLib as the comparison is case sensitive and the scanner returns AdLib
7-5-2001 removed removal of '
' after sanei_config_read() free devlist allocated in sane_get_devices() on sane_exit()
2-3-2001 improved the reordering of RGB data in pie_reader_process()
11-11-2000 eliminated some warnings about signed/unsigned comparisons removed #undef NDEBUG and C++ style comments
1-10-2000 force gamma table to one to one mappping if lineart or halftone selected
30-9-2000 added ADLIB devices to scanner_str[]
29-9-2000 wasn't setting 'background is halftone bit' (BGHT) in halftone mode
27-9-2000 went public with build 4
Definition in file pie.c.
#define BACKEND_NAME pie |
#define CAL_MODE_ADF (INQ_OPT_DEV_ADF) |
#define CAL_MODE_FLATBED 0x00 |
#define CAL_MODE_PREVIEW (INQ_CAP_FAST_PREVIEW) |
#define CAL_MODE_TRANPSARENCY (INQ_OPT_DEV_TP) |
#define CAL_MODE_TRANPSARENCY1 (INQ_OPT_DEV_TP1) |
#define COLOR_IR_STR "RGBI" |
#define CROP_DESC_STR "How to crop the image"; |
#define CROP_INNER_STR "Inside" |
#define CROP_NAME_STR "swcrop" |
#define CROP_OUTER_STR "Outside" |
#define CROP_TITLE_STR "Cropping" |
#define DBG_DUMP | ( | level, | |
buf, | |||
n | |||
) | { if (DBG_LEVEL >= (level)) pie_dump_buffer(level,buf,n); } |
#define DBG_error0 0 |
#define DBG_inquiry 4 |
#define DBG_sane_info 12 |
#define DBG_sane_init 10 |
#define DBG_sane_option 13 |
#define DBG_sane_proc 11 |
#define DBG_warning 3 |
#define DOWNLOAD_GAMMA_WAIT_TIME (1000000) |
#define HALFTONE_STR SANE_VALUE_SCAN_MODE_HALFTONE |
#define IR_CLEAN_STR "Remove dirt" |
#define IR_DESC_STR "What to do with infrared plane"; |
#define IR_NAME_STR "swired" |
#define IR_SPECT_STR "Reduce red overlap" |
#define IR_TITLE_STR "Infrared processing" |
#define LINEART_STR SANE_VALUE_SCAN_MODE_LINEART |
#define PIE_CONFIG_FILE "pie.conf" |
#define POST_SW_ACCUM_MASK (POST_SW_IRED_MASK | POST_SW_GRAIN | POST_SW_CROP) |
#define POST_SW_COLORS (1 << 0) /* gain, negatives, ..., can be done at any time */ |
#define POST_SW_CROP |
#define POST_SW_DIRT (1 << 2) /* our digital lavabo, needs complete scan */ |
#define POST_SW_GRAIN (1 << 3) /* smoothen a bit */ |
#define POST_SW_IRED (1 << 1) /* remove spectral overlap, needs complete scan */ |
#define POST_SW_IRED_MASK (POST_SW_IRED | POST_SW_DIRT) |
#define SCAN_WAIT_TIME (1000000) |
#define SCAN_WARMUP_WAIT_TIME (500000) |
#define THE_NONE_STR "None" |
#define TUR_WAIT_TIME (500000) |
typedef struct Pie_Device Pie_Device |
This structure holds the information about a physical scanner.
typedef struct Pie_Scanner Pie_Scanner |
This structure holds information about an instance of an 'opened' scanner.
enum Pie_Option |
This option list has to contain all options for all SCSI and USB scanners supported by this driver. If a certain scanner cannot handle a certain option, there's the possibility to say so, later.
static size_t max_string_size | ( | SANE_String_Const | strings[] | ) | [static] |
static SANE_Status pie_attach_one | ( | const char * | name | ) | [static] |
static SANE_Status pie_attach_scanner | ( | const char * | devicename, |
Pie_Device ** | devp | ||
) | [static] |
static SANE_Status pie_close_pipe | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_do_cal | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_do_cancel | ( | Pie_Scanner * | scanner | ) | [static] |
static void pie_do_inquiry | ( | Pie_Device * | dev, |
int | sfd, | ||
unsigned char * | buffer | ||
) | [static] |
static void pie_dump_buffer | ( | int | level, |
unsigned char * | buf, | ||
int | n | ||
) | [static] |
static SANE_Status pie_dwnld_gamma | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_dwnld_gamma_one | ( | Pie_Scanner * | scanner, |
int | filter, | ||
SANE_Int * | table | ||
) | [static] |
static void pie_get_cal_info | ( | Pie_Device * | dev, |
int | sfd | ||
) | [static] |
static void pie_get_halftones | ( | Pie_Device * | dev, |
int | sfd | ||
) | [static] |
static void pie_get_inquiry_values | ( | Pie_Device * | dev, |
unsigned char * | buffer | ||
) | [static] |
static SANE_Status pie_get_params | ( | Pie_Scanner * | scanner | ) | [static] |
static void pie_get_speeds | ( | Pie_Device * | dev | ) | [static] |
static SANE_Status pie_give_scanner | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_grab_scanner | ( | Pie_Scanner * | scanner | ) | [static] |
static int pie_identify_scanner | ( | Pie_Device * | dev, |
int | sfd, | ||
int | is_USB | ||
) | [static] |
static void pie_init | ( | Pie_Device * | dev, |
SANE_Int | is_USB | ||
) | [static] |
static SANE_Status pie_init_options | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_mode_select | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_perform_cal | ( | Pie_Scanner * | scanner, |
int | cal_index | ||
) | [static] |
static SANE_Status pie_power_save | ( | Pie_Scanner * | scanner, |
int | time | ||
) | [static] |
static void pie_print_inquiry | ( | Pie_Device * | dev | ) | [static] |
static int pie_reader_process | ( | void * | data | ) | [static] |
static int pie_reader_process_fmtline | ( | Pie_Scanner * | scanner, |
FILE * | fp | ||
) | [static] |
static int pie_reader_process_indexed | ( | Pie_Scanner * | scanner, |
FILE * | fp | ||
) | [static] |
static RETSIGTYPE pie_reader_process_sigterm_handler | ( | int | signal | ) | [static] |
static SANE_Status pie_scan | ( | Pie_Scanner * | scanner, |
int | start | ||
) | [static] |
static SANE_Status pie_send_exposure | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_send_exposure_one | ( | Pie_Scanner * | scanner, |
int | filter, | ||
int | value | ||
) | [static] |
static SANE_Status pie_send_highlight_shadow | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_send_highlight_shadow_one | ( | Pie_Scanner * | scanner, |
int | filter, | ||
int | highlight, | ||
int | shadow | ||
) | [static] |
static SANE_Status pie_sense_handler | ( | int | scsi_fd, |
unsigned char * | result, | ||
void * | arg | ||
) | [static] |
static SANE_Status pie_sense_handler | ( | __sane_unused__ int | scsi_fd, |
unsigned char * | result, | ||
__sane_unused__ void * | arg | ||
) | [static] |
Called by sanei_scsi_cmd or pie_usb_request_sense.
[in] | result | points to data returned by a request sense command |
Except for debug output and the return value no major action.
static SANE_Status pie_set_window | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_usb_attach_open | ( | SANE_String_Const | devname, |
SANE_Int * | dn | ||
) | [static] |
Try to open and identify an USB scanner class.
[in] | devname | name of the device to open |
[out] | dn | USB device number |
static SANE_Status pie_usb_bulk_read | ( | SANE_Int | dn, |
SANE_Byte * | data, | ||
size_t | len | ||
) | [static] |
Read a lot of data.
[in] | dn | USB device number |
[out] | data | points to buffer receiving data |
len | Requested / received number of bytes |
static SANE_Status pie_usb_calibrate | ( | Pie_Scanner * | scanner | ) | [static] |
Do a full calibration of the scanner.
[in] | scanner | points to structure of opened scanner |
static SANE_Status pie_usb_calibration_send | ( | Pie_Scanner * | scanner, |
int | calc_cal | ||
) | [static] |
Read first and then send calibration.
[in] | scanner | Pointer to structure of opened scanner |
[in] | calc_cal | If !=0, calculate parameters in between |
static void pie_usb_calicalc_hiqual | ( | Pie_Scanner * | scanner, |
PIE_USB_Calibration_Read * | d7cal | ||
) | [static] |
Calculate gain and exposure for quality mode.
[in] | scanner | points to structure of opened scanner |
[in] | d7cal | points to calibration data read by a PIE_READ_CALIBRATION command |
static void pie_usb_calicalc_normal | ( | Pie_Scanner * | scanner, |
PIE_USB_Calibration_Read * | d7cal | ||
) | [static] |
static unsigned char pie_usb_calicalc_slow_down | ( | Pie_Scanner * | scanner | ) | [static] |
Calculate coefficient for slowing down the scan.
[in] | scanner | points to structure of opened scanner |
static SANE_Status pie_usb_command | ( | int | dn, |
const SANE_Byte * | cmnd | ||
) | [static] |
Send a simple SCSI command without data transfer.
[in] | dn | USB device number |
[in] | cmnd | points to SCSI command bytes |
static SANE_Status pie_usb_copy_sensors | ( | Pie_Scanner * | scanner | ) | [static] |
Read a vector indicating which sensor elements are used.
[in] | scanner | points to structure of opened scanner |
static void pie_usb_correct_shading | ( | Pie_Scanner * | scanner, |
unsigned char * | in_buf[4], | ||
SANEI_IR_bufptr | out_buf[4], | ||
int | pixels, | ||
int | bits, | ||
int | start_plane, | ||
int | end_plane | ||
) | [static] |
Do shading and mirror correction on an image line.
[in] | scanner | points to structure of opened scanner |
[in] | in_buf | Array of pointers to separate R, G, B, I input data |
[out] | out_buf | Array of pointers to corrected data |
[in] | pixels | Line width |
[in] | bits | bit depth of data |
[in] | start_plane | color plane to start with |
[in] | end_plane | color plane to end with |
static SANE_Status pie_usb_do_cancel | ( | Pie_Scanner * | scanner, |
int | park | ||
) | [static] |
static SANE_Status pie_usb_get_params | ( | Pie_Scanner * | scanner | ) | [static] |
Send SCSI PARAM command.
[in] | scanner | points to structure of opened scanner |
static SANE_Status pie_usb_is_scanner_initialized | ( | int | dn | ) | [static] |
Wait for internal initialization of scanner.
[in] | dn | USB device number |
static SANE_Status pie_usb_is_scanner_released | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_usb_mode_select | ( | Pie_Scanner * | scanner | ) | [static] |
Setup and send MODE command.
[in] | scanner | points to structure of opened scanner |
static SANE_Status pie_usb_poke_bytes | ( | char * | filename, |
unsigned char * | nums, | ||
int * | len | ||
) | [static] |
Read white space separated bytes from a text file.
[in] | filename | name of file to read from |
[out] | nums | Pointer to buffer to store the data |
[in] | len | number of integers to read |
Use this function to override and test calibration.
static SANE_Status pie_usb_poke_ints | ( | char * | filename, |
int * | nums, | ||
int * | len | ||
) | [static] |
Read white space separated integers from a text file.
[in] | filename | name of file to read from |
[out] | nums | Pointer to buffer to store the data |
[in] | len | number of integers to read |
Use this function to override and test calibration.
static SANE_Status pie_usb_read | ( | int | dn, |
const SANE_Byte * | cmnd, | ||
void * | buf, | ||
size_t * | buf_len | ||
) | [static] |
Do a SCSI read transaction over USB.
[in] | dn | USB device number |
[in] | cmnd | SCSI command used for transaction |
[out] | buf | points to buffer receiving |
[in] | buf_len | requested number of bytes |
static SANE_Status pie_usb_read_status | ( | int | dn, |
unsigned char * | buf | ||
) | [static] |
Issue PIE vendor specific 0xdd PIE_READ_STATUS command
[in] | dn | USB device number |
[out] | buffer | Pointer to buffer receiving 11 bytes |
static SANE_Status pie_usb_reader_indexed | ( | Pie_Scanner * | scanner, |
FILE * | fp | ||
) | [static] |
Read indexed image data from scanner.
[in] | scanner | points to structure of opened scanner |
[in] | fp | pipe to write output |
static int pie_usb_reader_process | ( | void * | data | ) | [static] |
Setup child process / thread for reading and piping out an image.
[in] | data | Pointer to structure of opened scanner |
@ return
static RETSIGTYPE pie_usb_reader_process_sigterm_handler | ( | __sane_unused__ int | signal | ) | [static] |
static void pie_usb_reader_reorder | ( | Pie_Scanner * | scanner, |
SANEI_IR_bufptr * | in_img, | ||
SANEI_IR_bufptr | out_img, | ||
int | planes, | ||
int | pixels | ||
) | [static] |
static SANE_Status pie_usb_reader_unthreaded | ( | Pie_Scanner * | scanner | ) | [static] |
Read and store whole image.
[in] | scanner | points to structure of opened scanner |
static SANE_Status pie_usb_reader_write | ( | Pie_Scanner * | scanner, |
FILE * | fp, | ||
SANEI_IR_bufptr * | in_img, | ||
int | planes, | ||
int | lines | ||
) | [static] |
Interleave RGB(I), do color lookup and write data to pipe.
[in] | scanner | Pointer to structure of opened scanner |
[in] | fp | Pipe to write to |
[in] | in_img | Pointer to separate R, G, B, (I) color planes |
[in] | planes | Number of color planes |
[in] | lines | Number of lines to work on |
static SANE_Status pie_usb_ready_state | ( | SANE_Int | dn | ) | [static] |
Query the scanners state after the last USB transaction.
[in] | dn | Device number |
Actually, there are two answers, a simple one where 1 byte with 0 or 1 is ok, and a more elaborate one in two bytes starting with 3. The second byte signals some condition, 0 is ready.
static int pie_usb_release_scanner | ( | void * | passed | ) | [static] |
Release scanner after image aquisition.
[in] | data | points to structure of opened scanner |
static SANE_Status pie_usb_request_sense | ( | int | dn, |
uint32_t * | kascq | ||
) | [static] |
Send a Request Sense SCSI command to the scanner.
[in] | dn | USB device number |
[out] | kascq | amalgam single Integer returning result |
static void pie_usb_sane_close | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_usb_sane_control_option | ( | SANE_Handle | handle, |
SANE_Int | option, | ||
SANE_Action | action, | ||
void * | val, | ||
SANE_Int * | info | ||
) | [static] |
static SANE_Status pie_usb_sane_open | ( | Pie_Scanner * | scanner, |
SANE_Handle * | handle | ||
) | [static] |
Establish a connection to a scanner.
[in] | scanner | points to structure of to be opened scanner |
[out] | handle | points to structure of opened scanner |
static SANE_Status pie_usb_sane_read | ( | Pie_Scanner * | scanner, |
SANE_Byte * | buf, | ||
SANE_Int | max_len, | ||
SANE_Int * | len | ||
) | [static] |
static SANE_Status pie_usb_sane_start | ( | Pie_Scanner * | scanner | ) | [static] |
static SANE_Status pie_usb_scan | ( | Pie_Scanner * | scanner, |
int | start | ||
) | [static] |
Perform SCAN command.
[in] | scanner | points to structure of opened scanner |
SANE_Status pie_usb_scsi_wrapper | ( | int | fd, |
const void * | src, | ||
size_t | src_size, | ||
void * | dst, | ||
size_t * | dst_size | ||
) |
The one and only entry for SCSI over USB command wrapping.
[in] | fd | file descriptor holds USB device number |
[in] | src | points to the SCSI command and appended write data (if any) |
[in] | src_size | length of the command and data |
[out] | dst | points to buffer receiving data, NULL if no data is returned |
dst_size | requested / received number of bytes |
Currently all communication with the scanners is done via this function. Arguments are the same as for sanei_scsi_cmd.
static SANE_Status pie_usb_set_window | ( | Pie_Scanner * | scanner | ) | [static] |
Issue SET_SCAN_FRAME via a SCSI WRITE command.
[in] | scanner | Pointer to structure of opened scanner |
static SANE_Status pie_usb_shades_to_pnm | ( | Pie_Scanner * | scanner, |
char * | name, | ||
int | lines | ||
) | [static] |
Write a set of gray scale pnm files from shading data.
[in] | scanner | points to structure holding the data |
[in] | name | first part of file name |
[in] | lines | height of image |
static SANE_Status pie_usb_smoothen_rgb | ( | const SANE_Parameters * | params, |
SANEI_IR_bufptr * | the_img, | ||
int | win_size | ||
) | [static] |
Apply triangular blur to R, G, B image data.
[in] | params | describes image |
the_img | points to R, G, B color planes | |
[in] | win_size | window size for mean filtering |
static SANE_Status pie_usb_sw_crop_planes | ( | SANE_Parameters * | parameters, |
Pie_Scanner * | scanner, | ||
SANEI_IR_bufptr * | in_img, | ||
int | top, | ||
int | bot, | ||
int | left, | ||
int | right, | ||
int | planes | ||
) | [static] |
Crop separate color planes of an image.
[in] | parameters | describes one color plane of the image |
[in] | scanner | Pointer to structure of opened scanner |
[in] | in_img | Pointer to R, G, B(, I) color planes |
[in] | top | cropping position |
[in] | bot | cropping position |
[in] | left | cropping position |
[in] | right | cropping position |
[in] | planes | how many planes to crop |
static SANE_Status pie_usb_sw_final_crop | ( | Pie_Scanner * | scanner | ) | [static] |
Crop the final complete RGB image.
[in] | scanner | Pointer to structure of opened scanner |
static SANE_Status pie_usb_sw_post | ( | Pie_Scanner * | scanner, |
SANEI_IR_bufptr * | in_img, | ||
int | planes, | ||
int | out_planes | ||
) | [static] |
Postprocess a scanned R, G, B(, I) image.
[in] | scanner | Pointer to structure of opened scanner |
[in] | in_img | Pointer to R, G, B(, I) color planes |
[in] | planes | number planes to work on |
[in] | out_planes | number of allowed output planes |
static SANE_Status pie_usb_sw_store | ( | Pie_Scanner * | scanner, |
SANEI_IR_bufptr * | in_img, | ||
int | planes | ||
) | [static] |
Interleave RGB(I), do color lookup and store data.
[in] | scanner | Pointer to structure of opened scanner |
[in] | in_img | Pointer to separate R, G, B, (I) color planes |
[in] | planes | Number of color planes |
static SANE_Status pie_usb_try_attach | ( | const char * | name | ) | [static] |
static SANE_Status pie_usb_wait_scanner | ( | Pie_Scanner * | scanner, |
int | secs | ||
) | [static] |
TEST_UNIT_READY until ready or timed out.
[in] | scanner | points to structure of opened scanner |
[in] | secs | seconds to wait maximally |
static SANE_Status pie_usb_write | ( | int | dn, |
const SANE_Byte * | cmnd, | ||
size_t | length | ||
) | [static] |
Do a SCSI write transaction over USB.
[in] | dn | USB device number |
[in] | cmnd | SCSI command appended with the data to be written |
[in] | length | total length, i.e. command + data |
static SANE_Status pie_usb_write_control_sequence | ( | SANE_Int | dn, |
PIE_USB_Value_Data | sequ[] | ||
) | [static] |
Write a control sequence of value-data pairs to the scanner.
[in] | dn | USB device number |
[in] | sequ | list of value-data pairs terminated by a 0-0 pair |
static SANE_Status pie_usb_write_pnm_file | ( | char * | filename, |
uint8_t * | data, | ||
int | depth, | ||
int | channels, | ||
int | pixels_per_line, | ||
int | lines | ||
) | [static] |
Write RGB or grey scale image to a pnm file , with big endian byte order.
[in] | filename | Name of file |
[in] | data | Pointer to image data |
[in] | channels | Number of interleaved color planes |
[in] | pixels_per_line | Dimension in x |
[in] | lines | Dimension in y |
static SANE_Status pie_usb_write_scsi_cmd | ( | SANE_Int | dn, |
const SANE_Byte | cmnd[6] | ||
) | [static] |
Send 6 byte SCSI command to scanner.
[in] | dn | USB device number |
[in] | cmnd | array holding the six bytes |
static SANE_Status pie_wait_scanner | ( | Pie_Scanner * | scanner | ) | [static] |
void sane_cancel | ( | SANE_Handle | handle | ) |
void sane_close | ( | SANE_Handle | handle | ) |
SANE_Status sane_control_option | ( | SANE_Handle | handle, |
SANE_Int | option, | ||
SANE_Action | action, | ||
void * | val, | ||
SANE_Int * | info | ||
) |
SANE_Status sane_get_devices | ( | const SANE_Device *** | device_list, |
SANE_Bool __sane_unused__ | local_only | ||
) |
const SANE_Option_Descriptor* sane_get_option_descriptor | ( | SANE_Handle | handle, |
SANE_Int | option | ||
) |
SANE_Status sane_get_parameters | ( | SANE_Handle | handle, |
SANE_Parameters * | params | ||
) |
SANE_Status sane_get_select_fd | ( | SANE_Handle | handle, |
SANE_Int * | fd | ||
) |
SANE_Status sane_init | ( | SANE_Int * | version_code, |
SANE_Auth_Callback __sane_unused__ | authorize | ||
) |
SANE_Status sane_open | ( | SANE_String_Const | devicename, |
SANE_Handle * | handle | ||
) |
SANE_Status sane_read | ( | SANE_Handle | handle, |
SANE_Byte * | buf, | ||
SANE_Int | max_len, | ||
SANE_Int * | len | ||
) |
SANE_Status sane_set_io_mode | ( | SANE_Handle | handle, |
SANE_Bool | non_blocking | ||
) |
SANE_Status sane_start | ( | SANE_Handle | handle | ) |
volatile sig_atomic_t cancel_requ [static] |
PIE_USB_Model crystalscan_7200_model [static] |
{ "PIE/Reflecta", "CrystalScan 7200", 0x30, PIE_USB_FLAG_MIRROR_IMAGE | PIE_USB_FLAG_XRES_FAKE, {0x00, 0x08, 0x0a}, 75000, {4.19682524E-04, 3.92060196E-04, 3.89647803E-04}, {1.05, 1.05, 1.05}, 16, 42, 0x0f00, 10, {{0x16e6, 0x0ff2, 0x0ff2}, 0x16e6, {0x21, 0x21, 0x19}}, {{0x0be2, 0x0bcf, 0x0b88}, 0x0be2, {0x35, 0x2c, 0x27}} }
Pie_Device* first_dev = NULL [static] |
Pie_Scanner* first_handle = NULL [static] |
const SANE_Range percentage_range_100 [static] |
PIE_USB_Device_Entry pie_usb_device_list[] [static] |
{ {0x05e3, 0x0145, &crystalscan_7200_model}, {0x05e3, 0x0145, &proscan_7200_model}, {0, 0, 0} }
PIE_USB_Model proscan_7200_model [static] |
{ "PIE/Reflecta", "ProScan 7200", 0x36, PIE_USB_FLAG_MIRROR_IMAGE, {0x00, 0x08, 0x02}, 75000, {4.19682524E-04, 3.92060196E-04, 3.89647803E-04}, {1.2229896394, 1.0447735936, 0.9805181615}, 16, 42, 0x0f00, 10, {{0x2c89, 0x1eb7, 0x17ca}, 0x2c89, {0x25, 0x25, 0x28}}, {{0x0e79, 0x0bff, 0x0c6c}, 0x0e79, {0x3f, 0x3d, 0x39}} }
char* scanner_str[] [static] |
{ "DEVCOM", "9636PRO", "DEVCOM", "9636S", "DEVCOM", "9630S", "PIE", "ScanAce 1236S", "PIE", "ScanAce 1230S", "PIE", "ScanAce II", "PIE", "ScanAce III", "PIE", "ScanAce Plus", "PIE", "ScanAce II Plus", "PIE", "ScanAce III Plus", "PIE", "ScanAce V", "PIE", "ScanMedia", "PIE", "ScanMedia II", "PIE", "ScanAce 630S", "PIE", "ScanAce 636S", "AdLib", "JetScan 630", "AdLib", "JetScan 636PRO", "PIE", "SF Scanner", "END_OF_LIST" }