kopia lustrzana https://gitlab.com/sane-project/backends
Initial check-in of the artec_eplus48u backend
rodzic
e2e68a06d1
commit
a5e84985fa
Plik diff jest za duży
Load Diff
|
|
@ -0,0 +1,116 @@
|
|||
# artec_eplus48u - SANE Backend configuration file
|
||||
# For use with the Artec E+ 48U scanner
|
||||
# This scanner is also sold as
|
||||
# Tevion MD 9693, Medion MD 9705, Medion MD 9693 or
|
||||
# Trust Easy Webscan 19200
|
||||
#
|
||||
# The USB section:
|
||||
# each device needs at least the following line:
|
||||
# usb vendor-ID and product-ID
|
||||
# Every device configuration in this file must begin with an usb entry.
|
||||
usb 0x05d8 0x4003
|
||||
|
||||
#
|
||||
# Path to the firmware file
|
||||
# This file comes with the Windows driver
|
||||
# The scanner won't work without it
|
||||
#
|
||||
|
||||
option artecFirmwareFile <path>/Artec48.usb
|
||||
|
||||
#
|
||||
# for adjusting the default gamma values
|
||||
#
|
||||
|
||||
option redGamma 1.0
|
||||
option greenGamma 1.0
|
||||
option blueGamma 1.0
|
||||
option masterGamma 1.9
|
||||
|
||||
#Use this options to set the default offset and exposure time values.
|
||||
|
||||
option redOffset 0x28
|
||||
option greenOffset 0x2f
|
||||
option blueOffset 0x2f
|
||||
option redExposure 0xa7
|
||||
option greenExposure 0x116
|
||||
option blueExposure 0xdc
|
||||
|
||||
# The vendor and model string
|
||||
# This string is displayed by the frontends. If you do not want to get your
|
||||
# scanner reported as "Artec E+ 48U", then change the option accordingly.
|
||||
|
||||
option vendorString "Artec"
|
||||
option modelString "E+ 48U"
|
||||
|
||||
#
|
||||
# device-name
|
||||
#
|
||||
# If autodetection does not work, then you can specify the device here
|
||||
# The device entry must be the last one in this config file (or the last one before a
|
||||
# new usb entry).
|
||||
|
||||
#If you are using libusb, a device looks like this:
|
||||
#device libusb:001:002
|
||||
|
||||
#If you are using the scanner module (kernel driver), a device looks like this:
|
||||
#device /dev/usbscanner
|
||||
|
||||
|
||||
# Another USB section:
|
||||
# each device needs at least the following line:
|
||||
# usb vendor-ID and product-ID
|
||||
# Every device configuration in this file must begin with an usb entry.
|
||||
# Since the Trust Easy Webscan 19200 uses a different product id, we add
|
||||
# another usb section here.
|
||||
|
||||
usb 0x05d8 0x4006
|
||||
|
||||
#
|
||||
# Path to the firmware file
|
||||
# This file comes with the Windows driver
|
||||
# The scanner won't work without it
|
||||
#
|
||||
|
||||
option artecFirmwareFile <path>/Artec48.usb
|
||||
|
||||
#
|
||||
# for adjusting the default gamma values
|
||||
#
|
||||
|
||||
option redGamma 3.0
|
||||
option greenGamma 3.0
|
||||
option blueGamma 3.0
|
||||
option masterGamma 3.9
|
||||
|
||||
#Use this options to set the default offset and exposure time values.
|
||||
#If calibrate device is set to 0, this values are used instead of the values
|
||||
#which were calculated during calibration.
|
||||
|
||||
option redOffset 0x28
|
||||
option greenOffset 0x2f
|
||||
option blueOffset 0x2f
|
||||
option redExposure 0xa7
|
||||
option greenExposure 0x116
|
||||
option blueExposure 0xdc
|
||||
|
||||
# The vendor and model string
|
||||
# This string is displayed by the frontends. The Trust Easy Webscan 19200
|
||||
# has a different product id, therefore we can overwrite the vendor and model
|
||||
# string here.
|
||||
|
||||
option vendorString "Trust"
|
||||
option modelString "Easy Webscan 19200"
|
||||
|
||||
#
|
||||
# device-name
|
||||
#
|
||||
# If autodetection does not work, then you can specify the device here
|
||||
# The device entry must be the last one in this config file (or the last one before a
|
||||
# new usb entry).
|
||||
|
||||
#If you are using libusb, a device looks like this:
|
||||
#device libusb:001:002
|
||||
|
||||
#If you are using the scanner module (kernel driver), a device looks like this:
|
||||
#device /dev/usbscanner
|
||||
|
|
@ -0,0 +1,589 @@
|
|||
#ifndef ARTEC48U_H
|
||||
#define ARTEC48U_H
|
||||
|
||||
#include "../include/sane/sane.h"
|
||||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "../include/sane/sanei_usb.h"
|
||||
|
||||
#define _MAX_ID_LEN 20
|
||||
|
||||
/*Uncomment next line for button support. This
|
||||
actually isn't supported by the frontends. */
|
||||
/*#define ARTEC48U_USE_BUTTONS 1*/
|
||||
|
||||
#define ARTEC48U_PACKET_SIZE 64
|
||||
#define DECLARE_FUNCTION_NAME(name) \
|
||||
IF_DBG ( static const char function_name[] = name; )
|
||||
|
||||
typedef SANE_Byte Artec48U_Packet[ARTEC48U_PACKET_SIZE];
|
||||
#define XDBG(args) do { IF_DBG ( DBG args ); } while (0)
|
||||
|
||||
/* calculate the minimum/maximum values */
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
/* return the lower/upper 8 bits of a 16 bit word */
|
||||
#define HIBYTE(w) ((SANE_Byte)(((SANE_Word)(w) >> 8) & 0xFF))
|
||||
#define LOBYTE(w) ((SANE_Byte)(w))
|
||||
|
||||
#define MM_PER_INCH 25.4
|
||||
|
||||
#define CHECK_DEV_NOT_NULL(dev, func_name) \
|
||||
do { \
|
||||
if (!(dev)) \
|
||||
{ \
|
||||
XDBG ((3, "%s: BUG: NULL device\n", (func_name))); \
|
||||
return SANE_STATUS_INVAL; \
|
||||
} \
|
||||
} while (SANE_FALSE)
|
||||
|
||||
/** Check that the device is open.
|
||||
*
|
||||
* @param dev Pointer to the device object (Artec48U_Device).
|
||||
* @param func_name Function name (for use in debug messages).
|
||||
*/
|
||||
#define CHECK_DEV_OPEN(dev, func_name) \
|
||||
do { \
|
||||
CHECK_DEV_NOT_NULL ((dev), (func_name)); \
|
||||
if ((dev)->fd == -1) \
|
||||
{ \
|
||||
XDBG ((3, "%s: BUG: device %p not open\n", (func_name), (void*)(dev)));\
|
||||
return SANE_STATUS_INVAL; \
|
||||
} \
|
||||
} while (SANE_FALSE)
|
||||
|
||||
#define CHECK_DEV_ACTIVE(dev,func_name) \
|
||||
do { \
|
||||
CHECK_DEV_OPEN ((dev), (func_name)); \
|
||||
if (!(dev)->active) \
|
||||
{ \
|
||||
XDBG ((3, "%s: BUG: device %p not active\n", \
|
||||
(func_name), (void*)(dev))); \
|
||||
return SANE_STATUS_INVAL; \
|
||||
} \
|
||||
} while (SANE_FALSE)
|
||||
|
||||
typedef struct Artec48U_Device Artec48U_Device;
|
||||
typedef struct Artec48U_Scan_Request Artec48U_Scan_Request;
|
||||
typedef struct Artec48U_Scanner Artec48U_Scanner;
|
||||
typedef struct Artec48U_Scan_Parameters Artec48U_Scan_Parameters;
|
||||
typedef struct Artec48U_AFE_Parameters Artec48U_AFE_Parameters;
|
||||
typedef struct Artec48U_Exposure_Parameters Artec48U_Exposure_Parameters;
|
||||
typedef struct Artec48U_Line_Reader Artec48U_Line_Reader;
|
||||
typedef struct Artec48U_Delay_Buffer Artec48U_Delay_Buffer;
|
||||
|
||||
enum artec_options
|
||||
{
|
||||
OPT_NUM_OPTS = 0,
|
||||
OPT_MODE_GROUP,
|
||||
OPT_SCAN_MODE,
|
||||
OPT_BIT_DEPTH,
|
||||
OPT_BLACK_LEVEL,
|
||||
OPT_RESOLUTION,
|
||||
OPT_ENHANCEMENT_GROUP,
|
||||
OPT_BRIGHTNESS,
|
||||
OPT_CONTRAST,
|
||||
OPT_GAMMA,
|
||||
OPT_GAMMA_R,
|
||||
OPT_GAMMA_G,
|
||||
OPT_GAMMA_B,
|
||||
OPT_DEFAULT_ENHANCEMENTS,
|
||||
OPT_GEOMETRY_GROUP,
|
||||
OPT_TL_X,
|
||||
OPT_TL_Y,
|
||||
OPT_BR_X,
|
||||
OPT_BR_Y,
|
||||
OPT_CALIBRATION_GROUP,
|
||||
OPT_CALIBRATE,
|
||||
OPT_CALIBRATE_SHADING,
|
||||
#ifdef ARTEC48U_USE_BUTTONS
|
||||
OPT_BUTTON_STATE,
|
||||
#endif
|
||||
/* must come last: */
|
||||
NUM_OPTIONS
|
||||
};
|
||||
|
||||
/** Artec48U analog front-end (AFE) parameters.
|
||||
*/
|
||||
struct Artec48U_AFE_Parameters
|
||||
{
|
||||
SANE_Byte r_offset; /**< Red channel offset */
|
||||
SANE_Byte r_pga; /**< Red channel PGA gain */
|
||||
SANE_Byte g_offset; /**< Green channel offset (also used for mono) */
|
||||
SANE_Byte g_pga; /**< Green channel PGA gain (also used for mono) */
|
||||
SANE_Byte b_offset; /**< Blue channel offset */
|
||||
SANE_Byte b_pga; /**< Blue channel PGA gain */
|
||||
};
|
||||
|
||||
/** TV9693 exposure time parameters.
|
||||
*/
|
||||
struct Artec48U_Exposure_Parameters
|
||||
{
|
||||
SANE_Int r_time; /**< Red exposure time */
|
||||
SANE_Int g_time; /**< Red exposure time */
|
||||
SANE_Int b_time; /**< Red exposure time */
|
||||
};
|
||||
|
||||
struct Artec48U_Device
|
||||
{
|
||||
Artec48U_Device *next;
|
||||
/** Device file descriptor. */
|
||||
int fd;
|
||||
/** Device activation flag. */
|
||||
SANE_Bool active;
|
||||
SANE_String_Const name;
|
||||
SANE_Device sane; /** Scanner model data. */
|
||||
SANE_String_Const firmware_path;
|
||||
double gamma_master;
|
||||
double gamma_r;
|
||||
double gamma_g;
|
||||
double gamma_b;
|
||||
Artec48U_Exposure_Parameters exp_params;
|
||||
Artec48U_AFE_Parameters afe_params;
|
||||
Artec48U_AFE_Parameters artec_48u_afe_params;
|
||||
Artec48U_Exposure_Parameters artec_48u_exposure_params;
|
||||
|
||||
SANE_Int optical_xdpi;
|
||||
SANE_Int optical_ydpi;
|
||||
SANE_Int base_ydpi;
|
||||
SANE_Int xdpi_offset; /* in optical_xdpi units */
|
||||
SANE_Int ydpi_offset; /* in optical_ydpi units */
|
||||
SANE_Int x_size; /* in optical_xdpi units */
|
||||
SANE_Int y_size; /* in optical_ydpi units */
|
||||
/* the number of lines, that we move forward before we start reading the
|
||||
shading lines */
|
||||
int shading_offset;
|
||||
/* the number of lines we read for the black shading buffer */
|
||||
int shading_lines_b;
|
||||
/* the number of lines we read for the white shading buffer */
|
||||
int shading_lines_w;
|
||||
|
||||
SANE_Fixed x_offset, y_offset;
|
||||
SANE_Bool read_active;
|
||||
SANE_Byte *read_buffer;
|
||||
size_t requested_buffer_size;
|
||||
size_t read_pos;
|
||||
size_t read_bytes_in_buffer;
|
||||
size_t read_bytes_left;
|
||||
};
|
||||
|
||||
/** Scan parameters for artec48u_device_setup_scan().
|
||||
*
|
||||
* These parameters describe a low-level scan request; many such requests are
|
||||
* executed during calibration, and they need to have parameters separate from
|
||||
* the main request (Artec48U_Scan_Request). E.g., on the BearPaw 2400 TA the
|
||||
* scan to find the home position is always done at 300dpi 8-bit mono with
|
||||
* fixed width and height, regardless of the high-level scan parameters.
|
||||
*/
|
||||
struct Artec48U_Scan_Parameters
|
||||
{
|
||||
SANE_Int xdpi; /**< Horizontal resolution */
|
||||
SANE_Int ydpi; /**< Vertical resolution */
|
||||
SANE_Int depth; /**< Number of bits per channel */
|
||||
SANE_Bool color; /**< Color mode flag */
|
||||
|
||||
SANE_Int pixel_xs; /**< Logical width in pixels */
|
||||
SANE_Int pixel_ys; /**< Logical height in pixels */
|
||||
SANE_Int scan_xs; /**< Physical width in pixels */
|
||||
SANE_Int scan_ys; /**< Physical height in pixels */
|
||||
SANE_Int scan_bpl; /**< Number of bytes per scan line */
|
||||
SANE_Bool lineart; /**<Lineart is not really supported by device*/
|
||||
};
|
||||
|
||||
|
||||
/** Parameters for the high-level scan request.
|
||||
*
|
||||
* These parameters describe the scan request sent by the SANE frontend.
|
||||
*/
|
||||
struct Artec48U_Scan_Request
|
||||
{
|
||||
SANE_Fixed x0; /**< Left boundary */
|
||||
SANE_Fixed y0; /**< Top boundary */
|
||||
SANE_Fixed xs; /**< Width */
|
||||
SANE_Fixed ys; /**< Height */
|
||||
SANE_Int xdpi; /**< Horizontal resolution */
|
||||
SANE_Int ydpi; /**< Vertical resolution */
|
||||
SANE_Int depth; /**< Number of bits per channel */
|
||||
SANE_Bool color; /**< Color mode flag */
|
||||
};
|
||||
/** Scan action code (purpose of the scan).
|
||||
*
|
||||
* The scan action code affects various scanning mode fields in the setup
|
||||
* command.
|
||||
*/
|
||||
typedef enum Artec48U_Scan_Action
|
||||
{
|
||||
SA_CALIBRATE_SCAN_WHITE, /**< Scan white shading buffer */
|
||||
SA_CALIBRATE_SCAN_BLACK, /**< Scan black shading buffer */
|
||||
SA_CALIBRATE_SCAN_OFFSET_1, /**< First scan to determin offset */
|
||||
SA_CALIBRATE_SCAN_OFFSET_2, /**< Second scan to determine offset */
|
||||
SA_CALIBRATE_SCAN_EXPOSURE_1, /**< First scan to determin offset */
|
||||
SA_CALIBRATE_SCAN_EXPOSURE_2, /**< Second scan to determine offset */
|
||||
SA_SCAN /**< Normal scan */
|
||||
}
|
||||
Artec48U_Scan_Action;
|
||||
|
||||
|
||||
struct Artec48U_Delay_Buffer
|
||||
{
|
||||
SANE_Int line_count;
|
||||
SANE_Int read_index;
|
||||
SANE_Int write_index;
|
||||
unsigned int **lines;
|
||||
SANE_Byte *mem_block;
|
||||
};
|
||||
|
||||
struct Artec48U_Line_Reader
|
||||
{
|
||||
Artec48U_Device *dev; /**< Low-level interface object */
|
||||
Artec48U_Scan_Parameters params; /**< Scan parameters */
|
||||
|
||||
/** Number of pixels in the returned scanlines */
|
||||
SANE_Int pixels_per_line;
|
||||
|
||||
SANE_Byte *pixel_buffer;
|
||||
|
||||
Artec48U_Delay_Buffer r_delay;
|
||||
Artec48U_Delay_Buffer g_delay;
|
||||
Artec48U_Delay_Buffer b_delay;
|
||||
SANE_Bool delays_initialized;
|
||||
|
||||
SANE_Status (*read) (Artec48U_Line_Reader * reader,
|
||||
unsigned int **buffer_pointers_return);
|
||||
};
|
||||
|
||||
typedef union
|
||||
{
|
||||
SANE_Word w;
|
||||
SANE_Word *wa; /* word array */
|
||||
SANE_String s;
|
||||
}
|
||||
Option_Value;
|
||||
|
||||
struct Artec48U_Scanner
|
||||
{
|
||||
Artec48U_Scanner *next;
|
||||
Artec48U_Scan_Parameters params;
|
||||
Artec48U_Scan_Request request;
|
||||
Artec48U_Device *dev;
|
||||
Artec48U_Line_Reader *reader;
|
||||
FILE *pipe_handle;
|
||||
int reader_pid;
|
||||
int pipe;
|
||||
SANE_Option_Descriptor opt[NUM_OPTIONS];
|
||||
Option_Value val[NUM_OPTIONS];
|
||||
SANE_Status exit_code;
|
||||
SANE_Parameters sane_params;
|
||||
SANE_Bool scanning;
|
||||
SANE_Bool eof;
|
||||
SANE_Bool calibrated;
|
||||
SANE_Word gamma_array[4][65536];
|
||||
SANE_Word contrast_array[65536];
|
||||
SANE_Word brightness_array[65536];
|
||||
SANE_Byte *line_buffer;
|
||||
SANE_Byte *lineart_buffer;
|
||||
SANE_Word lines_to_read;
|
||||
unsigned int temp_shading_buffer[3][5120];
|
||||
unsigned int *buffer_pointers[3];
|
||||
unsigned char *shading_buffer_w;
|
||||
unsigned char *shading_buffer_b;
|
||||
unsigned int *shading_buffer_white[3];
|
||||
unsigned int *shading_buffer_black[3];
|
||||
unsigned long byte_cnt;
|
||||
};
|
||||
|
||||
|
||||
/** Create a new Artec48U_Device object.
|
||||
*
|
||||
* The newly created device object is in the closed state.
|
||||
*
|
||||
* @param dev_return Returned pointer to the created device object.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - the device object was created.
|
||||
* - #SANE_STATUS_NO_MEM - not enough system resources to create the object.
|
||||
*/
|
||||
static SANE_Status artec48u_device_new (Artec48U_Device ** dev_return);
|
||||
|
||||
/** Destroy the device object and release all associated resources.
|
||||
*
|
||||
* If the device was active, it will be deactivated; if the device was open, it
|
||||
* will be closed.
|
||||
*
|
||||
* @param dev Device object.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - success.
|
||||
*/
|
||||
static SANE_Status artec48u_device_free (Artec48U_Device * dev);
|
||||
|
||||
/** Open the scanner device.
|
||||
*
|
||||
* This function opens the device special file @a dev_name and tries to detect
|
||||
* the device model by its USB ID.
|
||||
*
|
||||
* If the device is detected successfully (its USB ID is found in the supported
|
||||
* device list), this function sets the appropriate model parameters.
|
||||
*
|
||||
* If the USB ID is not recognized, the device remains unconfigured; an attempt
|
||||
* to activate it will fail unless artec48u_device_set_model() is used to force
|
||||
* the parameter set. Note that the open is considered to be successful in
|
||||
* this case.
|
||||
*
|
||||
* @param dev Device object.
|
||||
* @param dev_name Scanner device name.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - the device was opened successfully (it still may be
|
||||
* unconfigured).
|
||||
*/
|
||||
static SANE_Status artec48u_device_open (Artec48U_Device * dev);
|
||||
|
||||
/** Close the scanner device.
|
||||
*
|
||||
* @param dev Device object.
|
||||
*/
|
||||
static SANE_Status artec48u_device_close (Artec48U_Device * dev);
|
||||
|
||||
/** Activate the device.
|
||||
*
|
||||
* The device must be activated before performing any I/O operations with it.
|
||||
* All device model parameters must be configured before activation; it is
|
||||
* impossible to change them after the device is active.
|
||||
*
|
||||
* This function might need to acquire resources (it calls
|
||||
* Artec48U_Command_Set::activate). These resources will be released when
|
||||
* artec48u_device_deactivate() is called.
|
||||
*
|
||||
* @param dev Device object.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - device activated successfully.
|
||||
* - #SANE_STATUS_INVAL - invalid request (attempt to activate a closed or
|
||||
* unconfigured device).
|
||||
*/
|
||||
static SANE_Status artec48u_device_activate (Artec48U_Device * dev);
|
||||
|
||||
/** Deactivate the device.
|
||||
*
|
||||
* This function reverses the action of artec48u_device_activate().
|
||||
*
|
||||
* @param dev Device object.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - device deactivated successfully.
|
||||
* - #SANE_STATUS_INVAL - invalid request (the device was not activated).
|
||||
*/
|
||||
static SANE_Status artec48u_device_deactivate (Artec48U_Device * dev);
|
||||
|
||||
/** Write a data block to the TV9693 memory.
|
||||
*
|
||||
* @param dev Device object.
|
||||
* @param addr Start address in the TV9693 memory.
|
||||
* @param size Size of the data block in bytes.
|
||||
* @param data Data block to write.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - success.
|
||||
* - #SANE_STATUS_IO_ERROR - a communication error occured.
|
||||
*
|
||||
* @warning
|
||||
* @a size must be a multiple of 64 (at least with TV9693), otherwise the
|
||||
* scanner (and possibly the entire USB bus) will lock up.
|
||||
*/
|
||||
static SANE_Status
|
||||
artec48u_device_memory_write (Artec48U_Device * dev, SANE_Word addr,
|
||||
SANE_Word size, SANE_Byte * data);
|
||||
|
||||
/** Read a data block from the TV9693 memory.
|
||||
*
|
||||
* @param dev Device object.
|
||||
* @param addr Start address in the TV9693 memory.
|
||||
* @param size Size of the data block in bytes.
|
||||
* @param data Buffer for the read data.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - success.
|
||||
* - #SANE_STATUS_IO_ERROR - a communication error occured.
|
||||
*
|
||||
* @warning
|
||||
* @a size must be a multiple of 64 (at least with TV9693), otherwise the
|
||||
* scanner (and possibly the entire USB bus) will lock up.
|
||||
*/
|
||||
static SANE_Status
|
||||
artec48u_device_memory_read (Artec48U_Device * dev, SANE_Word addr,
|
||||
SANE_Word size, SANE_Byte * data);
|
||||
|
||||
/** Execute a control command.
|
||||
*
|
||||
* @param dev Device object.
|
||||
* @param cmd Command packet.
|
||||
* @param res Result packet (may point to the same buffer as @a cmd).
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - success.
|
||||
* - #SANE_STATUS_IO_ERROR - a communication error occured.
|
||||
*/
|
||||
static SANE_Status
|
||||
artec48u_device_req (Artec48U_Device * dev, Artec48U_Packet cmd,
|
||||
Artec48U_Packet res);
|
||||
|
||||
/** Execute a "small" control command.
|
||||
*
|
||||
* @param dev Device object.
|
||||
* @param cmd Command packet; only first 8 bytes are used.
|
||||
* @param res Result packet (may point to the same buffer as @a cmd).
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - success.
|
||||
* - #SANE_STATUS_IO_ERROR - a communication error occured.
|
||||
*/
|
||||
static SANE_Status
|
||||
artec48u_device_small_req (Artec48U_Device * dev, Artec48U_Packet cmd,
|
||||
Artec48U_Packet res);
|
||||
|
||||
/** Read raw data from the bulk-in scanner pipe.
|
||||
*
|
||||
* @param dev Device object.
|
||||
* @param buffer Buffer for the read data.
|
||||
* @param size Pointer to the variable which must be set to the requested data
|
||||
* size before call. After completion this variable will hold the number of
|
||||
* bytes actually read.
|
||||
*
|
||||
* @return
|
||||
* - #SANE_STATUS_GOOD - success.
|
||||
* - #SANE_STATUS_IO_ERROR - a communication error occured.
|
||||
*/
|
||||
static SANE_Status
|
||||
artec48u_device_read_raw (Artec48U_Device * dev, SANE_Byte * buffer,
|
||||
size_t * size);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_device_set_read_buffer_size (Artec48U_Device * dev,
|
||||
size_t buffer_size);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_device_read_prepare (Artec48U_Device * dev, size_t expected_count);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_device_read (Artec48U_Device * dev, SANE_Byte * buffer,
|
||||
size_t * size);
|
||||
|
||||
static SANE_Status artec48u_device_read_finish (Artec48U_Device * dev);
|
||||
|
||||
|
||||
/**
|
||||
* Create a new Artec48U_Line_Reader object.
|
||||
*
|
||||
* @param dev The low-level scanner interface object.
|
||||
* @param params Scan parameters prepared by artec48u_device_setup_scan().
|
||||
* @param reader_return Location for the returned object.
|
||||
*
|
||||
* @return
|
||||
* - SANE_STATUS_GOOD - on success
|
||||
* - SANE_STATUS_NO_MEM - cannot allocate memory for object or buffers
|
||||
* - other error values - failure of some internal functions
|
||||
*/
|
||||
static SANE_Status
|
||||
artec48u_line_reader_new (Artec48U_Device * dev,
|
||||
Artec48U_Scan_Parameters * params,
|
||||
Artec48U_Line_Reader ** reader_return);
|
||||
|
||||
/**
|
||||
* Destroy the Artec48U_Line_Reader object.
|
||||
*
|
||||
* @param reader The Artec48U_Line_Reader object to destroy.
|
||||
*/
|
||||
static SANE_Status artec48u_line_reader_free (Artec48U_Line_Reader * reader);
|
||||
|
||||
/**
|
||||
* Read a scanline from the Artec48U_Line_Reader object.
|
||||
*
|
||||
* @param reader The Artec48U_Line_Reader object.
|
||||
* @param buffer_pointers_return Array of pointers to image lines (1 or 3
|
||||
* elements)
|
||||
*
|
||||
* This function reads a full scanline from the device, unpacks it to internal
|
||||
* buffers and returns pointer to these buffers in @a
|
||||
* buffer_pointers_return[i]. For monochrome scan, only @a
|
||||
* buffer_pointers_return[0] is filled; for color scan, elements 0, 1, 2 are
|
||||
* filled with pointers to red, green, and blue data. The returned pointers
|
||||
* are valid until the next call to artec48u_line_reader_read(), or until @a
|
||||
* reader is destroyed.
|
||||
*
|
||||
* @return
|
||||
* - SANE_STATUS_GOOD - read completed successfully
|
||||
* - other error value - an error occured
|
||||
*/
|
||||
static SANE_Status
|
||||
artec48u_line_reader_read (Artec48U_Line_Reader * reader,
|
||||
unsigned int **buffer_pointers_return);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_download_firmware (Artec48U_Device * dev,
|
||||
SANE_Byte * data, SANE_Word size);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_is_moving (Artec48U_Device * dev, SANE_Bool * moving);
|
||||
|
||||
static SANE_Status artec48u_carriage_home (Artec48U_Device * dev);
|
||||
|
||||
static SANE_Status artec48u_stop_scan (Artec48U_Device * dev);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_setup_scan (Artec48U_Scanner * s,
|
||||
Artec48U_Scan_Request * request,
|
||||
Artec48U_Scan_Action action,
|
||||
SANE_Bool calculate_only,
|
||||
Artec48U_Scan_Parameters * params);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_scanner_new (Artec48U_Device * dev,
|
||||
Artec48U_Scanner ** scanner_return);
|
||||
|
||||
static SANE_Status artec48u_scanner_free (Artec48U_Scanner * scanner);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_scanner_start_scan (Artec48U_Scanner * scanner,
|
||||
Artec48U_Scan_Request * request,
|
||||
Artec48U_Scan_Parameters * params);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_scanner_read_line (Artec48U_Scanner * scanner,
|
||||
unsigned int **buffer_pointers,
|
||||
SANE_Bool shading);
|
||||
|
||||
static SANE_Status artec48u_scanner_stop_scan (Artec48U_Scanner * scanner);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_calculate_shading_buffer (Artec48U_Scanner * s, int start, int end,
|
||||
int resolution, SANE_Bool color);
|
||||
|
||||
static SANE_Status download_firmware_file (Artec48U_Device * chip);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_generic_set_exposure_time (Artec48U_Device * dev,
|
||||
Artec48U_Exposure_Parameters * params);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_generic_set_afe (Artec48U_Device * dev,
|
||||
Artec48U_AFE_Parameters * params);
|
||||
|
||||
static SANE_Status artec48u_generic_start_scan (Artec48U_Device * dev);
|
||||
|
||||
static SANE_Status
|
||||
artec48u_generic_read_scanned_data (Artec48U_Device * dev, SANE_Bool * ready);
|
||||
|
||||
static SANE_Status init_options (Artec48U_Scanner * s);
|
||||
|
||||
static SANE_Status load_calibration_data (Artec48U_Scanner * s);
|
||||
|
||||
static SANE_Status save_calibration_data (Artec48U_Scanner * s);
|
||||
#endif
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
.TH sane-artec_eplus48u 5 "19 Nov 2002" @PACKAGEVERSION@ "SANE"
|
||||
.SH NAME
|
||||
sane-artec_eplus48u \- SANE backend for the scanner Artec E+ 48U and re-badged models
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B sane-artec_eplus48u
|
||||
library implements a SANE (Scanner Access Now Easy) backend that at present provides
|
||||
access to the USB flatbed scanners
|
||||
.PP
|
||||
Artec E+ 48U,
|
||||
.br
|
||||
Tevion MD 9693,
|
||||
.br
|
||||
Medion MD 9693,
|
||||
.br
|
||||
Medion MD 9705 and
|
||||
.br
|
||||
Trust Easy Webscan 19200.
|
||||
.br
|
||||
.PP
|
||||
These scanners have a contact image sensor (CIS) and an USB interface.
|
||||
.PP
|
||||
VendorID: 0x05d8
|
||||
.br
|
||||
ProductID: 0x4003
|
||||
.PP
|
||||
The Trust Easy Webscan 19200 is an exception. It's ProductID is 0x4006 .
|
||||
.PP
|
||||
More details can be found on
|
||||
.IR http://www.angelfire.com/linux/crapsite/ .
|
||||
.PP
|
||||
This is ALPHA software. Especially if you test new or untested scanners, keep
|
||||
your hand at the scanner's plug and unplug it, if the head bumps at the end of
|
||||
the scan area.
|
||||
.PP
|
||||
If you own a scanner other than the ones listed above that works with this
|
||||
backend, please let me know this by sending the scanner's exact model name and
|
||||
the USB vendor and product ids (e.g. from /proc/bus/usb/devices,
|
||||
sane-find-scanner or syslog) to me. Even if the scanner's name is only
|
||||
slightly different from the models mentioned above, please let me know.
|
||||
.PP
|
||||
.SH KERNEL ISSUES
|
||||
If libusb-0.1.6 or later is installed, this section can be skipped. The
|
||||
scanner should be found by sane-find-scanner without further actions. For
|
||||
setting permissions and general USB information look at sane-usb(5).
|
||||
.PP
|
||||
When you are using the scanner module, a Linux kernel 2.4.12 or newer is
|
||||
required.
|
||||
|
||||
.SH FIRMWARE FILE
|
||||
You need a firmware file for your scanner. That's a small file containing
|
||||
software that will be uploaded to the scanner's memory. For the scanners
|
||||
mentioned above, it's usually named Artec48.usb. You can find it on the
|
||||
installation CD that was provided by the manufacturer, normally in the
|
||||
directory Win98, WinMe or similar. If the Windows-driver is installed on
|
||||
your computer, then you can also find the firmware file under
|
||||
c:\\windows\\system32\\drivers.
|
||||
.SH CONFIGURATION
|
||||
The contents of the
|
||||
.I artec_eplus48u.conf
|
||||
file is a list of usb lines containing vendor and product ids that correspond
|
||||
to USB scanners. The file can also contain option lines. Empty lines and
|
||||
lines starting with a hash mark (#) are ignored. The scanners are
|
||||
autodetected by
|
||||
.I usb vendor_id product_id
|
||||
statements which are already included into
|
||||
.I artec_eplus48u.conf .
|
||||
"vendor_id" and "product_id" are hexadecimal numbers that identify the
|
||||
.B scanner.
|
||||
.PP
|
||||
Every usb section can have additional options
|
||||
.TP
|
||||
.B artecFirmwareFile <path>/Artec48.usb
|
||||
The path to the firmware file. This option is required.
|
||||
.TP
|
||||
.B redGamma 1.0
|
||||
.TP
|
||||
.B greenGamma 1.0
|
||||
.TP
|
||||
.B blueGamma 1.0
|
||||
.TP
|
||||
.B masterGamma 1.9
|
||||
These are the default gamma values. If you set the "Defaults" option with a frontend,
|
||||
then the gamma options are reset to the values specified here.
|
||||
.TP
|
||||
.B redOffset 0x28
|
||||
.TP
|
||||
.B greenOffset 0x2f
|
||||
.TP
|
||||
.B blueOffset 0x2f
|
||||
.TP
|
||||
.B redExposure 0xa7
|
||||
.TP
|
||||
.B greenExposure 0x116
|
||||
.TP
|
||||
.B blueExposure 0xdc
|
||||
These are the default values for offset and exposure time. You can e.g. change them to speed up calibration,
|
||||
if you don't want to save the calibration data to disk.
|
||||
.TP
|
||||
.B vendorString "Artec"
|
||||
.TP
|
||||
.B modelString "E+ 48U"
|
||||
By default, the scanner is reported as "Artec E+ 48U". If you don't like this, e.g.
|
||||
because you have an Tevion MD 9693, then change the options accordingly.
|
||||
.SH FILES
|
||||
.TP
|
||||
.I /usr/local/etc/sane.d/artec_eplus48u.conf
|
||||
The backend configuration file (see also description of
|
||||
.B SANE_CONFIG_DIR
|
||||
below).
|
||||
.TP
|
||||
.I /usr/local/lib/sane/libsane-artec_eplus48u.a
|
||||
The static library implementing this backend.
|
||||
.TP
|
||||
.I /usr/local/lib/sane/libsane-artec_eplus48u.so
|
||||
The shared library implementing this backend (present on systems that
|
||||
support dynamic loading).
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B SANE_CONFIG_DIR
|
||||
This environment variable specifies the list of directories that may
|
||||
contain the configuration file. Under UNIX, the directories are
|
||||
separated by a colon (`:'), under OS/2, they are separated by a
|
||||
semi-colon (`;'). If this variable is not set, the configuration file
|
||||
is searched in two default directories: first, the current working
|
||||
directory (".") and then in /usr/local/etc/sane.d. If the value of the
|
||||
environment variable ends with the directory separator character, then
|
||||
the default directories are searched after the explicitly specified
|
||||
directories. For example, setting
|
||||
.B SANE_CONFIG_DIR
|
||||
to "/tmp/config:" would result in directories "tmp/config", ".", and
|
||||
"/usr/local/etc/sane.d" being searched (in this order).
|
||||
.TP
|
||||
.B SANE_DEBUG_ARTEC_EPLUS48U
|
||||
If the library was compiled with debug support enabled, this
|
||||
environment variable controls the debug level for this backend. Higher
|
||||
debug levels increase the verbosity of the output.
|
||||
|
||||
Example:
|
||||
export SANE_DEBUG_ARTEC_EPLUS48U=3
|
||||
|
||||
.SH "SEE ALSO"
|
||||
sane(7), sane-usb(5)
|
||||
|
||||
.SH AUTHOR
|
||||
Michael Herder <crapsite@gmx.net>
|
||||
.br
|
||||
This backend is based on the gt68xx test-program written by Sergey Vlasov, Andreas Nowack, and
|
||||
David Stevenson. Thanks to everyone who tested the backend or reported bugs.
|
||||
.br
|
||||
This man page is based on man sane-gt68xx, written by Henning Meier-Geinitz.
|
||||
.SH BUGS
|
||||
This backend has been tested on Linux only. If you are using it on a different platform, please
|
||||
contact me.
|
||||
.PP
|
||||
Interpolation with 1200 dpi is weak.
|
||||
.PP
|
||||
Support for buttons is missing due to missing support in SANE.
|
||||
.PP
|
||||
More detailed bug information is
|
||||
available at
|
||||
.IR http://www.angelfire.com/linux/crapsite .
|
||||
Please contact me if you find a bug or missing feature:
|
||||
<crapsite@gmx.net>
|
||||
Ładowanie…
Reference in New Issue