kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-return-errors-as-exceptions' into 'master'
genesys: Return errors as exceptions instead of error codes See merge request sane-project/backends!101merge-requests/102/head
commit
326b2a04f7
Plik diff jest za duży
Load Diff
|
@ -83,6 +83,7 @@ genesys_reverse_bits(
|
|||
uint8_t *dst_data,
|
||||
size_t bytes)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
size_t i;
|
||||
for(i = 0; i < bytes; i++) {
|
||||
*dst_data++ = ~ *src_data++;
|
||||
|
@ -101,6 +102,7 @@ genesys_reverse_bits(
|
|||
static SANE_Status
|
||||
binarize_line(Genesys_Device * dev, uint8_t *src, uint8_t *dst, int width)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
int j, windowX, sum = 0;
|
||||
int thresh;
|
||||
int offset, addCol, dropCol;
|
||||
|
@ -192,6 +194,7 @@ genesys_gray_lineart(
|
|||
size_t lines,
|
||||
uint8_t threshold)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
size_t y;
|
||||
|
||||
DBG(DBG_io2, "%s: converting %lu lines of %lu pixels\n", __func__, (unsigned long)lines,
|
||||
|
@ -220,6 +223,7 @@ genesys_shrink_lines_1 (
|
|||
unsigned int dst_pixels,
|
||||
unsigned int channels)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
unsigned int dst_x, src_x, y, c, cnt;
|
||||
unsigned int avg[3], val;
|
||||
uint8_t *src = (uint8_t *) src_data;
|
||||
|
@ -325,6 +329,7 @@ genesys_shrink_lines_1 (
|
|||
static SANE_Status
|
||||
genesys_crop(Genesys_Scanner *s)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Genesys_Device *dev = s->dev;
|
||||
int top = 0;
|
||||
|
@ -332,8 +337,6 @@ genesys_crop(Genesys_Scanner *s)
|
|||
int left = 0;
|
||||
int right = 0;
|
||||
|
||||
DBG (DBG_proc, "%s: start\n", __func__);
|
||||
|
||||
/* first find edges if any */
|
||||
status = sanei_magic_findEdges (&s->params,
|
||||
dev->img_buffer.data(),
|
||||
|
@ -363,7 +366,6 @@ genesys_crop(Genesys_Scanner *s)
|
|||
/* update counters to new image size */
|
||||
dev->total_bytes_to_read = s->params.bytes_per_line * s->params.lines;
|
||||
|
||||
DBG (DBG_proc, "%s: completed\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
@ -375,14 +377,13 @@ genesys_crop(Genesys_Scanner *s)
|
|||
static SANE_Status
|
||||
genesys_deskew(Genesys_Scanner *s, const Genesys_Sensor& sensor)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
Genesys_Device *dev = s->dev;
|
||||
|
||||
int x = 0, y = 0, bg;
|
||||
double slope = 0;
|
||||
|
||||
DBG (DBG_proc, "%s: start\n", __func__);
|
||||
|
||||
bg=0;
|
||||
if(s->params.format==SANE_FRAME_GRAY && s->params.depth == 1)
|
||||
{
|
||||
|
@ -414,7 +415,6 @@ genesys_deskew(Genesys_Scanner *s, const Genesys_Sensor& sensor)
|
|||
DBG (DBG_error, "%s: rotate error: %s", __func__, sane_strstatus(status));
|
||||
}
|
||||
|
||||
DBG (DBG_proc, "%s: completed\n", __func__);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
@ -425,6 +425,7 @@ genesys_deskew(Genesys_Scanner *s, const Genesys_Sensor& sensor)
|
|||
static SANE_Status
|
||||
genesys_despeck(Genesys_Scanner *s)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
if(sanei_magic_despeck(&s->params,
|
||||
s->dev->img_buffer.data(),
|
||||
s->despeck)!=SANE_STATUS_GOOD)
|
||||
|
@ -440,10 +441,10 @@ genesys_despeck(Genesys_Scanner *s)
|
|||
static SANE_Status
|
||||
genesys_derotate (Genesys_Scanner * s)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
int angle = 0;
|
||||
|
||||
DBGSTART;
|
||||
status = sanei_magic_findTurn (&s->params,
|
||||
s->dev->img_buffer.data(),
|
||||
s->resolution,
|
||||
|
@ -453,7 +454,6 @@ genesys_derotate (Genesys_Scanner * s)
|
|||
if (status)
|
||||
{
|
||||
DBG (DBG_warn, "%s: failed : %d\n", __func__, status);
|
||||
DBGCOMPLETED;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
@ -462,13 +462,11 @@ genesys_derotate (Genesys_Scanner * s)
|
|||
if (status)
|
||||
{
|
||||
DBG (DBG_warn, "%s: failed : %d\n", __func__, status);
|
||||
DBGCOMPLETED;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* update counters to new image size */
|
||||
s->dev->total_bytes_to_read = s->params.bytes_per_line * s->params.lines;
|
||||
|
||||
DBGCOMPLETED;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ FUNC_NAME(genesys_reorder_components_cis) (
|
|||
unsigned int lines,
|
||||
unsigned int pixels)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
unsigned int x, y;
|
||||
uint8_t *src[3];
|
||||
uint8_t *dst = dst_data;
|
||||
|
@ -104,6 +105,7 @@ FUNC_NAME(genesys_reorder_components_cis_bgr) (
|
|||
unsigned int lines,
|
||||
unsigned int pixels)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
unsigned int x, y;
|
||||
uint8_t *src[3];
|
||||
uint8_t *dst = dst_data;
|
||||
|
@ -155,6 +157,7 @@ FUNC_NAME(genesys_reorder_components_bgr) (
|
|||
unsigned int lines,
|
||||
unsigned int pixels)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
unsigned int c;
|
||||
uint8_t *src = src_data;
|
||||
uint8_t *dst = dst_data;
|
||||
|
@ -198,6 +201,7 @@ FUNC_NAME(genesys_reorder_components_endian) (
|
|||
unsigned int pixels,
|
||||
unsigned int channels)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
unsigned int c;
|
||||
uint8_t *src = src_data;
|
||||
uint8_t *dst = dst_data;
|
||||
|
@ -221,6 +225,7 @@ FUNC_NAME(genesys_reverse_ccd) (
|
|||
unsigned int *ccd_shift,
|
||||
unsigned int component_count)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
unsigned int x, y, c;
|
||||
COMPONENT_TYPE *src = (COMPONENT_TYPE *)src_data;
|
||||
COMPONENT_TYPE *dst = (COMPONENT_TYPE *)dst_data;
|
||||
|
@ -290,6 +295,7 @@ FUNC_NAME(genesys_shrink_lines) (
|
|||
unsigned int dst_pixels,
|
||||
unsigned int channels)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
unsigned int dst_x, src_x, y, c, cnt;
|
||||
unsigned int avg[3];
|
||||
unsigned int count;
|
||||
|
|
|
@ -69,6 +69,68 @@ static unsigned num_uncaught_exceptions()
|
|||
#endif
|
||||
}
|
||||
|
||||
SaneException::SaneException(SANE_Status status) : status_(status)
|
||||
{
|
||||
std::va_list args;
|
||||
set_msg(nullptr, args);
|
||||
}
|
||||
|
||||
SaneException::SaneException(SANE_Status status, const char* format, ...) : status_(status)
|
||||
{
|
||||
std::va_list args;
|
||||
va_start(args, format);
|
||||
set_msg(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
SaneException::SaneException(const char* format, ...) : status_(SANE_STATUS_INVAL)
|
||||
{
|
||||
std::va_list args;
|
||||
va_start(args, format);
|
||||
set_msg(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
SANE_Status SaneException::status() const
|
||||
{
|
||||
return status_;
|
||||
}
|
||||
|
||||
const char* SaneException::what() const noexcept
|
||||
{
|
||||
return msg_.c_str();
|
||||
}
|
||||
|
||||
void SaneException::set_msg(const char* format, std::va_list vlist)
|
||||
{
|
||||
const char* status_msg = sane_strstatus(status_);
|
||||
std::size_t status_msg_len = std::strlen(status_msg);
|
||||
|
||||
if (format == nullptr) {
|
||||
msg_.reserve(status_msg_len);
|
||||
msg_ = status_msg;
|
||||
return;
|
||||
}
|
||||
|
||||
int msg_len = std::vsnprintf(nullptr, 0, format, vlist);
|
||||
if (msg_len < 0) {
|
||||
const char* formatting_error_msg = "(error formatting arguments)";
|
||||
msg_.reserve(std::strlen(formatting_error_msg) + 3 + status_msg_len);
|
||||
msg_ = formatting_error_msg;
|
||||
msg_ += " : ";
|
||||
msg_ += status_msg;
|
||||
return;
|
||||
}
|
||||
|
||||
msg_.reserve(msg_len + status_msg_len + 3);
|
||||
msg_.resize(msg_len + 1, ' ');
|
||||
std::vsnprintf(&msg_[0], msg_len + 1, format, vlist);
|
||||
msg_.resize(msg_len, ' ');
|
||||
|
||||
msg_ += " : ";
|
||||
msg_ += status_msg;
|
||||
}
|
||||
|
||||
DebugMessageHelper::DebugMessageHelper(const char* func)
|
||||
{
|
||||
func_ = func;
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "../include/sane/sanei_backend.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
|
@ -64,40 +65,25 @@
|
|||
|
||||
class SaneException : std::exception {
|
||||
public:
|
||||
SaneException(SANE_Status status) : status_(status)
|
||||
{
|
||||
set_msg(nullptr);
|
||||
}
|
||||
SaneException(SANE_Status status);
|
||||
SaneException(SANE_Status status, const char* format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
|
||||
SaneException(SANE_Status status, const char* msg) : status_(status)
|
||||
{
|
||||
set_msg(msg);
|
||||
}
|
||||
SaneException(const char* format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
|
||||
SaneException(const char* msg) : SaneException(SANE_STATUS_INVAL, msg) {}
|
||||
|
||||
SANE_Status status() const { return status_; }
|
||||
virtual const char* what() const noexcept override { return msg_.c_str(); }
|
||||
SANE_Status status() const;
|
||||
const char* what() const noexcept override;
|
||||
|
||||
private:
|
||||
|
||||
void set_msg(const char* msg)
|
||||
{
|
||||
const char* status_msg = sane_strstatus(status_);
|
||||
std::size_t status_msg_len = std::strlen(status_msg);
|
||||
|
||||
if (msg) {
|
||||
std::size_t msg_len = std::strlen(msg);
|
||||
msg_.reserve(msg_len + status_msg_len + 3);
|
||||
msg_ = msg;
|
||||
msg_ += " : ";
|
||||
msg_ += status_msg;
|
||||
return;
|
||||
}
|
||||
|
||||
msg_.reserve(status_msg_len);
|
||||
msg_ = status_msg;
|
||||
}
|
||||
void set_msg(const char* format, std::va_list vlist);
|
||||
|
||||
std::string msg_;
|
||||
SANE_Status status_;
|
||||
|
@ -124,9 +110,6 @@ private:
|
|||
} \
|
||||
} while (false)
|
||||
|
||||
#define DBGSTART DBG (DBG_proc, "%s start\n", __func__);
|
||||
#define DBGCOMPLETED DBG (DBG_proc, "%s completed\n", __func__);
|
||||
|
||||
class DebugMessageHelper {
|
||||
public:
|
||||
static constexpr unsigned MAX_BUF_SIZE = 120;
|
||||
|
|
Plik diff jest za duży
Load Diff
|
@ -476,14 +476,13 @@ gl124_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg,
|
|||
static SANE_Status
|
||||
gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home);
|
||||
static SANE_Status gl124_init(Genesys_Device * dev);
|
||||
static SANE_Status gl124_send_shading_data (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
uint8_t * data, int size);
|
||||
static void gl124_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
uint8_t* data, int size);
|
||||
|
||||
static SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse);
|
||||
|
||||
static SANE_Status
|
||||
gl124_stop_action (Genesys_Device * dev);
|
||||
|
||||
static SANE_Status
|
||||
gl124_send_slope_table (Genesys_Device * dev, int table_nr,
|
||||
uint16_t * slope_table, int steps);
|
||||
static void gl124_send_slope_table(Genesys_Device* dev, int table_nr, uint16_t* slope_table,
|
||||
int steps);
|
||||
|
|
Plik diff jest za duży
Load Diff
|
@ -165,11 +165,9 @@
|
|||
|
||||
#include "genesys.h"
|
||||
|
||||
static SANE_Status gl646_set_fe(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
uint8_t set, int dpi);
|
||||
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
|
||||
|
||||
static SANE_Status gl646_public_set_fe(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
uint8_t set);
|
||||
static void gl646_public_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set);
|
||||
|
||||
static
|
||||
SANE_Status
|
||||
|
|
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
|
@ -1026,7 +1026,7 @@ typedef struct Genesys_Calibration_Cache Genesys_Calibration_Cache;
|
|||
* same command set, but may have different optical resolution and other
|
||||
* parameters.
|
||||
*/
|
||||
typedef struct Genesys_Command_Set
|
||||
struct Genesys_Command_Set
|
||||
{
|
||||
/** @name Identification */
|
||||
/*@{ */
|
||||
|
@ -1061,7 +1061,7 @@ typedef struct Genesys_Command_Set
|
|||
SANE_Bool (*test_buffer_empty_bit) (SANE_Byte val);
|
||||
SANE_Bool (*test_motor_flag_bit) (SANE_Byte val);
|
||||
|
||||
SANE_Status (*set_fe) (Genesys_Device * dev, const Genesys_Sensor& sensor, uint8_t set);
|
||||
void (*set_fe) (Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set);
|
||||
SANE_Status (*set_powersaving) (Genesys_Device * dev, int delay);
|
||||
SANE_Status (*save_power) (Genesys_Device * dev, SANE_Bool enable);
|
||||
|
||||
|
@ -1091,14 +1091,10 @@ typedef struct Genesys_Command_Set
|
|||
SANE_Status (*slow_back_home) (Genesys_Device * dev, SANE_Bool wait_until_home);
|
||||
SANE_Status (*rewind) (Genesys_Device * dev);
|
||||
|
||||
SANE_Status (*bulk_write_register) (Genesys_Device * dev,
|
||||
Genesys_Register_Set& regs);
|
||||
void (*bulk_write_register) (Genesys_Device* dev, Genesys_Register_Set& regs);
|
||||
|
||||
SANE_Status (*bulk_write_data) (Genesys_Device * dev, uint8_t addr,
|
||||
uint8_t * data, size_t len);
|
||||
|
||||
SANE_Status (*bulk_read_data) (Genesys_Device * dev, uint8_t addr,
|
||||
uint8_t * data, size_t len);
|
||||
void (*bulk_write_data) (Genesys_Device* dev, uint8_t addr, uint8_t* data, size_t len);
|
||||
void (*bulk_read_data) (Genesys_Device * dev, uint8_t addr, uint8_t * data, size_t len);
|
||||
|
||||
// Updates hardware sensor information in Genesys_Scanner.val[].
|
||||
SANE_Status (*update_hardware_sensors) (struct Genesys_Scanner * s);
|
||||
|
@ -1136,8 +1132,8 @@ typedef struct Genesys_Command_Set
|
|||
/**
|
||||
* write shading data calibration to ASIC
|
||||
*/
|
||||
SANE_Status (*send_shading_data) (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
uint8_t * data, int size);
|
||||
void (*send_shading_data) (Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||
int size);
|
||||
|
||||
// calculate current scan setup
|
||||
void (*calculate_current_setup) (Genesys_Device * dev, const Genesys_Sensor& sensor);
|
||||
|
@ -1147,7 +1143,7 @@ typedef struct Genesys_Command_Set
|
|||
*/
|
||||
SANE_Status (*asic_boot) (Genesys_Device * dev, SANE_Bool cold);
|
||||
|
||||
} Genesys_Command_Set;
|
||||
};
|
||||
|
||||
/** @brief structure to describe a scanner model
|
||||
* This structure describes a model. It is composed of information on the
|
||||
|
@ -1715,40 +1711,34 @@ inline void sanei_genesys_set_reg_from_set(Genesys_Register_Set* regs, uint16_t
|
|||
regs->set8(address, value);
|
||||
}
|
||||
|
||||
extern SANE_Status sanei_genesys_init_cmd_set (Genesys_Device * dev);
|
||||
extern void sanei_genesys_init_cmd_set(Genesys_Device* dev);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_read_register (Genesys_Device * dev, uint16_t reg, uint8_t * val);
|
||||
extern void sanei_genesys_read_register(Genesys_Device* dev, uint16_t reg, uint8_t* val);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_write_register (Genesys_Device * dev, uint16_t reg, uint8_t val);
|
||||
extern void sanei_genesys_write_register(Genesys_Device* dev, uint16_t reg, uint8_t val);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_read_hregister (Genesys_Device * dev, uint16_t reg, uint8_t * val);
|
||||
extern void sanei_genesys_read_hregister(Genesys_Device* dev, uint16_t reg, uint8_t* val);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_write_hregister (Genesys_Device * dev, uint16_t reg, uint8_t val);
|
||||
extern void sanei_genesys_write_hregister(Genesys_Device* dev, uint16_t reg, uint8_t val);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_bulk_write_register(Genesys_Device * dev,
|
||||
Genesys_Register_Set& regs);
|
||||
extern void sanei_genesys_bulk_write_register(Genesys_Device* dev, Genesys_Register_Set& regs);
|
||||
|
||||
extern SANE_Status sanei_genesys_write_0x8c (Genesys_Device * dev, uint8_t index, uint8_t val);
|
||||
extern void sanei_genesys_write_0x8c(Genesys_Device* dev, uint8_t index, uint8_t val);
|
||||
|
||||
extern unsigned sanei_genesys_get_bulk_max_size(Genesys_Device * dev);
|
||||
|
||||
extern SANE_Status sanei_genesys_bulk_read_data(Genesys_Device * dev, uint8_t addr, uint8_t* data,
|
||||
size_t len);
|
||||
extern void sanei_genesys_bulk_read_data(Genesys_Device * dev, uint8_t addr, uint8_t* data,
|
||||
size_t len);
|
||||
|
||||
extern SANE_Status sanei_genesys_bulk_write_data(Genesys_Device * dev, uint8_t addr, uint8_t* data,
|
||||
extern void sanei_genesys_bulk_write_data(Genesys_Device* dev, uint8_t addr, uint8_t* data,
|
||||
size_t len);
|
||||
|
||||
extern SANE_Status sanei_genesys_get_status (Genesys_Device * dev, uint8_t * status);
|
||||
extern void sanei_genesys_get_status(Genesys_Device* dev, uint8_t* status);
|
||||
|
||||
extern void sanei_genesys_print_status (uint8_t val);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_write_ahb(Genesys_Device* dev, uint32_t addr, uint32_t size, uint8_t * data);
|
||||
extern void sanei_genesys_write_ahb(Genesys_Device* dev, uint32_t addr, uint32_t size,
|
||||
uint8_t* data);
|
||||
|
||||
extern void sanei_genesys_init_structs (Genesys_Device * dev);
|
||||
|
||||
|
@ -1763,14 +1753,11 @@ extern SANE_Status
|
|||
sanei_genesys_init_shading_data (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
int pixels_per_line);
|
||||
|
||||
extern SANE_Status sanei_genesys_read_valid_words (Genesys_Device * dev,
|
||||
unsigned int *steps);
|
||||
extern void sanei_genesys_read_valid_words(Genesys_Device* dev, unsigned int* steps);
|
||||
|
||||
extern SANE_Status sanei_genesys_read_scancnt (Genesys_Device * dev,
|
||||
unsigned int *steps);
|
||||
extern void sanei_genesys_read_scancnt(Genesys_Device* dev, unsigned int* steps);
|
||||
|
||||
extern SANE_Status sanei_genesys_read_feed_steps (Genesys_Device * dev,
|
||||
unsigned int *steps);
|
||||
extern void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps);
|
||||
|
||||
void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set& regs, bool set);
|
||||
|
@ -1793,23 +1780,18 @@ sanei_genesys_calculate_zmode (uint32_t exposure_time,
|
|||
uint8_t fwdstep, uint8_t tgtime,
|
||||
uint32_t * z1, uint32_t * z2);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_set_buffer_address (Genesys_Device * dev, uint32_t addr);
|
||||
extern void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr);
|
||||
|
||||
/** @brief Reads data from frontend register.
|
||||
* Reads data from the given frontend register. May be used to query
|
||||
* analog frontend status by reading the right register.
|
||||
*/
|
||||
extern SANE_Status
|
||||
sanei_genesys_fe_read_data (Genesys_Device * dev, uint8_t addr,
|
||||
uint16_t *data);
|
||||
extern void sanei_genesys_fe_read_data(Genesys_Device* dev, uint8_t addr, uint16_t* data);
|
||||
/** @brief Write data to frontend register.
|
||||
* Writes data to analog frontend register at the given address.
|
||||
* The use and address of registers change from model to model.
|
||||
*/
|
||||
extern SANE_Status
|
||||
sanei_genesys_fe_write_data (Genesys_Device * dev, uint8_t addr,
|
||||
uint16_t data);
|
||||
extern void sanei_genesys_fe_write_data(Genesys_Device* dev, uint8_t addr, uint16_t data);
|
||||
|
||||
extern SANE_Int
|
||||
sanei_genesys_exposure_time2 (Genesys_Device * dev,
|
||||
|
@ -1867,8 +1849,7 @@ extern SANE_Status
|
|||
sanei_genesys_write_pnm_file (const char *filename, uint8_t * data, int depth,
|
||||
int channels, int pixels_per_line, int lines);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_test_buffer_empty (Genesys_Device * dev, SANE_Bool * empty);
|
||||
extern void sanei_genesys_test_buffer_empty(Genesys_Device* dev, SANE_Bool* empty);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_read_data_from_scanner (Genesys_Device * dev, uint8_t * data,
|
||||
|
@ -1923,8 +1904,7 @@ inline SensorExposure sanei_genesys_fixup_exposure(SensorExposure exposure)
|
|||
return exposure;
|
||||
}
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_wait_for_home(Genesys_Device *dev);
|
||||
extern void sanei_genesys_wait_for_home(Genesys_Device* dev);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_asic_init(Genesys_Device *dev, SANE_Bool cold);
|
||||
|
@ -1993,23 +1973,22 @@ sanei_genesys_load_lut (unsigned char * lut,
|
|||
int slope,
|
||||
int offset);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_generate_gamma_buffer(Genesys_Device * dev,
|
||||
extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
|
||||
const Genesys_Sensor& sensor,
|
||||
int bits,
|
||||
int max,
|
||||
int size,
|
||||
uint8_t *gamma);
|
||||
uint8_t* gamma);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* ASIC specific functions declarations */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern SANE_Status sanei_gl646_init_cmd_set (Genesys_Device * dev);
|
||||
extern SANE_Status sanei_gl841_init_cmd_set (Genesys_Device * dev);
|
||||
extern SANE_Status sanei_gl843_init_cmd_set (Genesys_Device * dev);
|
||||
extern SANE_Status sanei_gl846_init_cmd_set (Genesys_Device * dev);
|
||||
extern SANE_Status sanei_gl847_init_cmd_set (Genesys_Device * dev);
|
||||
extern SANE_Status sanei_gl124_init_cmd_set (Genesys_Device * dev);
|
||||
extern void sanei_gl646_init_cmd_set(Genesys_Device* dev);
|
||||
extern void sanei_gl841_init_cmd_set(Genesys_Device* dev);
|
||||
extern void sanei_gl843_init_cmd_set(Genesys_Device* dev);
|
||||
extern void sanei_gl846_init_cmd_set(Genesys_Device* dev);
|
||||
extern void sanei_gl847_init_cmd_set(Genesys_Device* dev);
|
||||
extern void sanei_gl124_init_cmd_set(Genesys_Device* dev);
|
||||
|
||||
// same as usleep, except that it does nothing if testing mode is enabled
|
||||
extern void sanei_genesys_usleep(unsigned int useconds);
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
|
||||
TEST_LDADD = \
|
||||
../../../sanei/libsanei.la \
|
||||
../../../sanei/sanei_usb.lo \
|
||||
../../../sanei/sanei_magic.lo \
|
||||
../../../lib/liblib.la \
|
||||
../../../backend/libgenesys.la \
|
||||
../../../backend/sane_strstatus.lo \
|
||||
$(MATH_LIB) $(USB_LIBS) $(PTHREAD_LIBS)
|
||||
$(MATH_LIB) $(USB_LIBS) $(XML_LIBS) $(PTHREAD_LIBS)
|
||||
|
||||
check_PROGRAMS = genesys_tests
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "minigtest.h"
|
||||
|
||||
#define DEBUG_DECLARE_ONLY
|
||||
|
||||
size_t s_num_successes = 0;
|
||||
size_t s_num_failures = 0;
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define DEBUG_DECLARE_ONLY
|
||||
|
||||
#include "tests.h"
|
||||
#include "minigtest.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define DEBUG_DECLARE_ONLY
|
||||
|
||||
#include "tests.h"
|
||||
#include "minigtest.h"
|
||||
|
||||
|
@ -27,8 +29,6 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#define DEBUG_DECLARE_ONLY
|
||||
|
||||
Genesys_Calibration_Cache create_fake_calibration_entry()
|
||||
{
|
||||
Genesys_Calibration_Cache calib;
|
||||
|
|
Ładowanie…
Reference in New Issue