piuspatch
v0.1
USB addition to PIE backend
|
Go to the source code of this file.
Data Structures | |
struct | PIE_USB_Value_Data |
USB control sequence element. More... | |
struct | PIE_USB_cal_ired |
Infrared extension, not critical. More... | |
struct | PIE_USB_Calibration_Read |
Read by vendor specific 0xd7 SCSI command "PIE_READ_CALIBRATION". More... | |
struct | PIE_USB_Calibration_Send |
Written by vendor specific 0xdc SCSI command "PIE_WRITE_CALIBRATION". More... | |
struct | PIE_USB_Calibration_Set |
Handle calibration in software. More... | |
struct | PIE_USB_Calibration |
Hold data from the last calibration. More... | |
struct | PIE_USB_Model |
Describe a PIE USB scanner. More... | |
struct | PIE_USB_Device_Entry |
Distinguish between different scanner models. More... | |
Defines | |
#define | BULKIN_MAXSIZE 0xFFF0 |
#define | BUFFER_MAXSIZE 0x7F000 |
#define | AVERAGE_CAL_LINES 13 |
#define | REQUEST_TYPE_IN (USB_TYPE_VENDOR | USB_DIR_IN) |
#define | REQUEST_TYPE_OUT (USB_TYPE_VENDOR | USB_DIR_OUT) |
#define | REQUEST_REGISTER 0x0c |
#define | REQUEST_BUFFER 0x04 |
#define | VALUE_BUFFER 0x82 |
#define | VALUE_READ_REGISTER 0x84 |
#define | VALUE_WRITE_REGISTER 0x85 |
#define | VALUE_INIT_1 0x87 |
#define | VALUE_INIT_2 0x88 |
#define | VALUE_BUF_ENDACCESS 0x8c |
#define | VALUE_GET_REGISTER 0x8e |
#define | INDEX 0x00 |
#define | SLOW_START 26700.0 |
slowdown values for calibration | |
#define | SLOW_LENGTH 5340.0 |
#define | SLOW_HEIGHT 8.0 |
#define | SLOW_IRED -2 |
#define | PIE_USB_FLAG_MIRROR_IMAGE (1 << 0) /**> mirror image and X-window settings */ |
#define | PIE_USB_FLAG_XRES_FAKE (1 << 1) /**> highest X-resolution has to be emulated */ |
#define | CONST_GAMMA 0.454545455 |
Typedefs | |
typedef struct PIE_USB_Value_Data | PIE_USB_Value_Data |
USB control sequence element. | |
typedef struct PIE_USB_Calibration_Set | PIE_USB_Calibration_Set |
Handle calibration in software. | |
typedef struct PIE_USB_Calibration | PIE_USB_Calibration |
Hold data from the last calibration. | |
typedef struct PIE_USB_Model | PIE_USB_Model |
Describe a PIE USB scanner. | |
typedef struct PIE_USB_Device_Entry | PIE_USB_Device_Entry |
Distinguish between different scanner models. | |
Enumerations | |
enum | PIE_USB_Operation_Mode { OPM_PREVIEW, OPM_SKIPCAL, OPM_QUALITY } |
Modes affecting calibration and quality. More... | |
Functions | |
struct PIE_USB_cal_ired | __attribute__ ((__packed__)) PIE_USB_cal_ired |
Infrared extension, not critical. | |
Variables | |
uint16_t | texp |
unsigned char | offset |
unsigned char | zero |
unsigned char | gain |
unsigned char | zero_1 [54] |
uint16_t | illumination [3] |
unsigned char | zero_2 [3] |
unsigned char | some_time |
uint16_t | t_min |
unsigned char | no_idea [20] |
PIE_USB_cal_ired | infrared |
unsigned char | scsi_cmd [6] |
This file contains definitions for the USB code for PIE SF film scanners. For documentation of the code see pie.c. Here the more general things are explained.
Exposure time (texp) and gain calibration is done in software for each of the R, G, B channels between two custom SCSI commands. The first 0xd7 named PIE_READ_CALIBRATION reads what the scanner suggest, the second 0xdc named PIE_WRITE_CALIBRATION sends what has been calculated. Commands sent during a scan:
Steps 7 to 17 are done for calibration. Steps 11 to 16 are only done for full calibration, i.e. for steps 7, 8 an initial set or the result of the last full calibration is used. Full calibration mode is termed OPM_QUALITY below, the short sequence may be OPM_PREVIEW or OPM_SKIPCAL.
The best documentation of what the 0xd7 and 0xdc commands contain is found in Jan Vleeshouwers post "Reflecta Crystalscan / ProScan 7200 update" at sane-devel Tue Dec 20 22:26:52 UTC 2011: http://lists.alioth.debian.org/pipermail/sane-devel/2011-December/029337.html Jan disassembled a PIE ROM.
Jan named the 0xd7 command READ GAIN OFFSET and the 0xdc one SET GAIN OFFSET. Here they are phrased PIE_READ_CALIBRATION and PIE_WRITE_CALIBRATION because the Windows programs do all calibration by changing exposure time (texp below, Jan's Timer count) and gain values. In USB snoops, the offsets are the same in read to write.
PIE_USB_Calibration_Read contains what is read for calibration.
PIE_USB_Calibration_Send contains what is written for calibration.
Definition in file pie_usb.h.
#define AVERAGE_CAL_LINES 13 |
#define BUFFER_MAXSIZE 0x7F000 |
#define BULKIN_MAXSIZE 0xFFF0 |
#define CONST_GAMMA 0.454545455 |
#define PIE_USB_FLAG_MIRROR_IMAGE (1 << 0) /**> mirror image and X-window settings */ |
#define PIE_USB_FLAG_XRES_FAKE (1 << 1) /**> highest X-resolution has to be emulated */ |
#define REQUEST_BUFFER 0x04 |
#define REQUEST_REGISTER 0x0c |
#define REQUEST_TYPE_IN (USB_TYPE_VENDOR | USB_DIR_IN) |
#define REQUEST_TYPE_OUT (USB_TYPE_VENDOR | USB_DIR_OUT) |
#define SLOW_HEIGHT 8.0 |
#define SLOW_LENGTH 5340.0 |
#define SLOW_START 26700.0 |
slowdown values for calibration
No need yet to make them model specific. Construct a slope SLOW_HEIGHT / SLOW_LENGTH beginning at SLOW_START bytes per line, for infrared result is lower. This quirk seems to satisfy a limitation of the physical SCSI to USB interface within the scanner
#define VALUE_BUF_ENDACCESS 0x8c |
#define VALUE_BUFFER 0x82 |
#define VALUE_GET_REGISTER 0x8e |
#define VALUE_INIT_1 0x87 |
#define VALUE_INIT_2 0x88 |
#define VALUE_READ_REGISTER 0x84 |
#define VALUE_WRITE_REGISTER 0x85 |
typedef struct PIE_USB_Calibration PIE_USB_Calibration |
Hold data from the last calibration.
Initially loaded with default sets for exposure and gain but not shading
typedef struct PIE_USB_Calibration_Set PIE_USB_Calibration_Set |
Handle calibration in software.
typedef struct PIE_USB_Device_Entry PIE_USB_Device_Entry |
Distinguish between different scanner models.
typedef struct PIE_USB_Model PIE_USB_Model |
Describe a PIE USB scanner.
There are several different PIE SF scanners which are different from each other. The following is an approach to hold model specific values.
typedef struct PIE_USB_Value_Data PIE_USB_Value_Data |
USB control sequence element.
Modes affecting calibration and quality.
the full calibration sequence has to be done by the code !!! The actual values sent may be different for different scanner models.
struct PIE_USB_Calibration_Send __attribute__ | ( | (__packed__) | ) |
Infrared extension, not critical.
Written by vendor specific 0xdc SCSI command "PIE_WRITE_CALIBRATION".
Read by vendor specific 0xd7 SCSI command "PIE_READ_CALIBRATION".
unsigned char gain |
uint16_t illumination[3] |
unsigned char offset |
unsigned char some_time |
uint16_t texp |