kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify scanner status handling
rodzic
7385e0d305
commit
2ca325c638
|
|
@ -514,6 +514,7 @@ libgenesys_la_SOURCES = genesys/genesys.cpp genesys/genesys.h \
|
|||
genesys/settings.h genesys/settings.cpp \
|
||||
genesys/serialize.h \
|
||||
genesys/static_init.h genesys/static_init.cpp \
|
||||
genesys/status.h genesys/status.cpp \
|
||||
genesys/tables_frontend.cpp \
|
||||
genesys/tables_gpo.cpp \
|
||||
genesys/tables_model.cpp \
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ public:
|
|||
Genesys_Register_Set& regs) const = 0;
|
||||
virtual void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor) const = 0;
|
||||
|
||||
virtual bool test_buffer_empty_bit(std::uint8_t val) const = 0;
|
||||
|
||||
virtual void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, std::uint8_t set) const = 0;
|
||||
virtual void set_powersaving(Genesys_Device* dev, int delay) const = 0;
|
||||
virtual void save_power(Genesys_Device* dev, bool enable) const = 0;
|
||||
|
|
|
|||
|
|
@ -53,11 +53,6 @@
|
|||
namespace genesys {
|
||||
namespace gl124 {
|
||||
|
||||
bool CommandSetGl124::test_buffer_empty_bit(SANE_Byte val) const
|
||||
{
|
||||
return (val & BUFEMPTY);
|
||||
}
|
||||
|
||||
static void gl124_homsnr_gpio(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
|
|
@ -1020,16 +1015,15 @@ void CommandSetGl124::set_powersaving(Genesys_Device* dev, int delay /* in minut
|
|||
static void gl124_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val40, val;
|
||||
std::uint8_t val40;
|
||||
unsigned int loop;
|
||||
|
||||
// post scan gpio : without that HOMSNR is unreliable
|
||||
gl124_homsnr_gpio(dev);
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
val40 = dev->interface->read_register(REG_0x100);
|
||||
|
|
@ -1041,7 +1035,7 @@ static void gl124_stop_action(Genesys_Device* dev)
|
|||
}
|
||||
|
||||
/* ends scan */
|
||||
val = dev->reg.get8(REG_0x01);
|
||||
std::uint8_t val = dev->reg.get8(REG_0x01);
|
||||
val &= ~REG_0x01_SCAN;
|
||||
dev->reg.set8(REG_0x01, val);
|
||||
dev->interface->write_register(REG_0x01, val);
|
||||
|
|
@ -1055,17 +1049,18 @@ static void gl124_stop_action(Genesys_Device* dev)
|
|||
loop = 10;
|
||||
while (loop > 0)
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
}
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
val40 = dev->interface->read_register(REG_0x100);
|
||||
|
||||
/* if scanner is in command mode, we are done */
|
||||
if (!(val40 & REG_0x100_DATAENB) && !(val40 & REG_0x100_MOTMFLG) && !(val & MOTORENB)) {
|
||||
return;
|
||||
}
|
||||
if (!(val40 & REG_0x100_DATAENB) && !(val40 & REG_0x100_MOTMFLG) &&
|
||||
!status.is_motor_enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
loop--;
|
||||
|
|
@ -1205,32 +1200,25 @@ void CommandSetGl124::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
|
||||
// post scan gpio : without that HOMSNR is unreliable
|
||||
gl124_homsnr_gpio(dev);
|
||||
|
||||
// first read gives HOME_SENSOR true
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
dev->interface->sleep_ms(100);
|
||||
|
||||
// second is reliable
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
/* is sensor at home? */
|
||||
if (val & HOMESNR)
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG (DBG_info, "%s: already at home, completed\n", __func__);
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
return;
|
||||
|
|
@ -1297,13 +1285,11 @@ void CommandSetGl124::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
if (wait_until_home)
|
||||
{
|
||||
|
||||
while (loop < 300) /* do not wait longer then 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
while (loop < 300) {
|
||||
status = scanner_read_status(*dev);
|
||||
|
||||
if (val & HOMESNR) /* home sensor */
|
||||
{
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1329,7 +1315,6 @@ static void gl124_feed(Genesys_Device* dev, unsigned int steps, int reverse)
|
|||
DBG_HELPER_ARGS(dbg, "steps=%d", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
|
||||
/* prepare local registers */
|
||||
local_reg = dev->reg;
|
||||
|
|
@ -1397,9 +1382,10 @@ static void gl124_feed(Genesys_Device* dev, unsigned int steps, int reverse)
|
|||
}
|
||||
|
||||
// wait until feed count reaches the required value, but do not exceed 30s
|
||||
Status status;
|
||||
do {
|
||||
val = sanei_genesys_get_status(dev);
|
||||
} while (!(val & FEEDFSH));
|
||||
status = scanner_read_status(*dev);
|
||||
} while (!status.is_feeding_finished);
|
||||
|
||||
// then stop scanning
|
||||
gl124_stop_action(dev);
|
||||
|
|
@ -1592,19 +1578,19 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
void CommandSetGl124::wait_for_motor_stop(Genesys_Device* dev) const
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val;
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
uint8_t val40 = dev->interface->read_register(REG_0x100);
|
||||
|
||||
if ((val & MOTORENB) == 0 && (val40 & REG_0x100_MOTMFLG) == 0)
|
||||
if (!status.is_motor_enabled && (val40 & REG_0x100_MOTMFLG) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
dev->interface->sleep_ms(10);
|
||||
val = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
val40 = dev->interface->read_register(REG_0x100);
|
||||
} while ((val & MOTORENB) ||(val40 & REG_0x100_MOTMFLG));
|
||||
} while (status.is_motor_enabled ||(val40 & REG_0x100_MOTMFLG));
|
||||
dev->interface->sleep_ms(50);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,8 +137,6 @@ public:
|
|||
|
||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor) const override;
|
||||
|
||||
bool test_buffer_empty_bit(std::uint8_t val) const override;
|
||||
|
||||
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
|
||||
void set_powersaving(Genesys_Device* dev, int delay) const override;
|
||||
void save_power(Genesys_Device* dev, bool enable) const override;
|
||||
|
|
|
|||
|
|
@ -90,32 +90,6 @@ static void gl646_gpio_output_enable(IUsbDevice& usb_dev, uint8_t value)
|
|||
usb_dev.control_msg(REQUEST_TYPE_OUT, REQUEST_REGISTER, GPIO_OUTPUT_ENABLE, INDEX, 1, &value);
|
||||
}
|
||||
|
||||
bool CommandSetGl646::test_buffer_empty_bit(SANE_Byte val) const
|
||||
{
|
||||
return (val & REG_0x41_BUFEMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes and prints content of status (0x41) register
|
||||
* @param val value read from reg41
|
||||
*/
|
||||
static void
|
||||
print_status (uint8_t val)
|
||||
{
|
||||
char msg[80];
|
||||
|
||||
std::sprintf(msg, "%s%s%s%s%s%s%s%s",
|
||||
val & REG_0x41_PWRBIT ? "PWRBIT " : "",
|
||||
val & REG_0x41_BUFEMPTY ? "BUFEMPTY " : "",
|
||||
val & REG_0x41_FEEDFSH ? "FEEDFSH " : "",
|
||||
val & REG_0x41_SCANFSH ? "SCANFSH " : "",
|
||||
val & REG_0x41_HOMESNR ? "HOMESNR " : "",
|
||||
val & REG_0x41_LAMPSTS ? "LAMPSTS " : "",
|
||||
val & REG_0x41_FEBUSY ? "FEBUSY " : "",
|
||||
val & REG_0x41_MOTMFLG ? "MOTMFLG" : "");
|
||||
DBG(DBG_info, "status=%s\n", msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* stop scanner's motor
|
||||
* @param dev scanner's device
|
||||
|
|
@ -1128,7 +1102,6 @@ void CommandSetGl646::load_document(Genesys_Device* dev) const
|
|||
Genesys_Register_Set regs(Genesys_Register_Set::SEQUENTIAL);
|
||||
unsigned int used, vfinal, count;
|
||||
std::vector<uint16_t> slope_table;
|
||||
uint8_t val;
|
||||
|
||||
/* no need to load document is flatbed scanner */
|
||||
if (!dev->model->is_sheetfed) {
|
||||
|
|
@ -1137,15 +1110,15 @@ void CommandSetGl646::load_document(Genesys_Device* dev) const
|
|||
return;
|
||||
}
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
|
||||
/* HOMSNR is set if a document is inserted */
|
||||
if ((val & REG_0x41_HOMESNR)) {
|
||||
// home sensor is set if a document is inserted
|
||||
if (status.is_at_home) {
|
||||
/* if no document, waits for a paper event to start loading */
|
||||
/* with a 60 seconde minutes timeout */
|
||||
count = 0;
|
||||
do
|
||||
{
|
||||
std::uint8_t val = 0;
|
||||
do {
|
||||
gl646_gpio_read(dev->interface->get_usb_device(), &val);
|
||||
|
||||
DBG(DBG_info, "%s: GPIO=0x%02x\n", __func__, val);
|
||||
|
|
@ -1205,10 +1178,10 @@ void CommandSetGl646::load_document(Genesys_Device* dev) const
|
|||
count = 0;
|
||||
do
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
dev->interface->sleep_ms(200);
|
||||
count++;
|
||||
} while ((val & REG_0x41_MOTMFLG) && (count < 300));
|
||||
} while (status.is_motor_enabled && (count < 300));
|
||||
|
||||
if (count == 300)
|
||||
{
|
||||
|
|
@ -1233,15 +1206,15 @@ void CommandSetGl646::load_document(Genesys_Device* dev) const
|
|||
void CommandSetGl646::detect_document_end(Genesys_Device* dev) const
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val, gpio;
|
||||
std::uint8_t gpio;
|
||||
unsigned int bytes_left;
|
||||
|
||||
// test for document presence
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL > DBG_info)
|
||||
{
|
||||
print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
gl646_gpio_read(dev->interface->get_usb_device(), &gpio);
|
||||
DBG(DBG_info, "%s: GPIO=0x%02x\n", __func__, gpio);
|
||||
|
||||
|
|
@ -1295,7 +1268,7 @@ void CommandSetGl646::eject_document(Genesys_Device* dev) const
|
|||
Genesys_Register_Set regs((Genesys_Register_Set::SEQUENTIAL));
|
||||
unsigned int used, vfinal, count;
|
||||
std::vector<uint16_t> slope_table;
|
||||
uint8_t gpio, state;
|
||||
std::uint8_t gpio;
|
||||
|
||||
/* at the end there will be noe more document */
|
||||
dev->document = false;
|
||||
|
|
@ -1306,16 +1279,13 @@ void CommandSetGl646::eject_document(Genesys_Device* dev) const
|
|||
DBG(DBG_info, "%s: GPIO=0x%02x\n", __func__, gpio);
|
||||
|
||||
// test status : paper event + HOMESNR -> no more doc ?
|
||||
state = sanei_genesys_get_status(dev);
|
||||
|
||||
DBG(DBG_info, "%s: state=0x%02x\n", __func__, state);
|
||||
if (DBG_LEVEL > DBG_info)
|
||||
{
|
||||
print_status (state);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
/* HOMSNR=0 if no document inserted */
|
||||
if ((state & REG_0x41_HOMESNR) != 0) {
|
||||
// home sensor is set when document is inserted
|
||||
if (status.is_at_home) {
|
||||
dev->document = false;
|
||||
DBG(DBG_info, "%s: no more document to eject\n", __func__);
|
||||
DBG(DBG_proc, "%s: end\n", __func__);
|
||||
|
|
@ -1326,12 +1296,11 @@ void CommandSetGl646::eject_document(Genesys_Device* dev) const
|
|||
dev->interface->write_register(0x01, 0xb0);
|
||||
|
||||
/* wait for motor to stop */
|
||||
do
|
||||
{
|
||||
do {
|
||||
dev->interface->sleep_ms(200);
|
||||
state = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
}
|
||||
while (state & REG_0x41_MOTMFLG);
|
||||
while (status.is_motor_enabled);
|
||||
|
||||
/* set up to fast move before scan then move until document is detected */
|
||||
regs.init_reg(0x01, 0xb0);
|
||||
|
|
@ -1375,14 +1344,13 @@ void CommandSetGl646::eject_document(Genesys_Device* dev) const
|
|||
/* loop until paper sensor tells paper is out, and till motor is running */
|
||||
/* use a 30 timeout */
|
||||
count = 0;
|
||||
do
|
||||
{
|
||||
state = sanei_genesys_get_status(dev);
|
||||
do {
|
||||
status = scanner_read_status(*dev);
|
||||
debug_print_status(dbg, status);
|
||||
|
||||
print_status (state);
|
||||
dev->interface->sleep_ms(200);
|
||||
count++;
|
||||
} while (((state & REG_0x41_HOMESNR) == 0) && (count < 150));
|
||||
} while (!status.is_at_home && (count < 150));
|
||||
|
||||
// read GPIO on exit
|
||||
gl646_gpio_read(dev->interface->get_usb_device(), &gpio);
|
||||
|
|
@ -1418,52 +1386,45 @@ static void end_scan_impl(Genesys_Device* dev, Genesys_Register_Set* reg, bool c
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "check_stop = %d, eject = %d", check_stop, eject);
|
||||
int i = 0;
|
||||
uint8_t val, scanfsh = 0;
|
||||
uint8_t scanfsh = 0;
|
||||
|
||||
/* we need to compute scanfsh before cancelling scan */
|
||||
if (dev->model->is_sheetfed) {
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (val & REG_0x41_SCANFSH) {
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
if (status.is_scanning_finished) {
|
||||
scanfsh = 1;
|
||||
}
|
||||
if (DBG_LEVEL > DBG_io2)
|
||||
{
|
||||
print_status (val);
|
||||
}
|
||||
}
|
||||
|
||||
/* ends scan */
|
||||
val = reg->get8(0x01);
|
||||
std::uint8_t val = reg->get8(0x01);
|
||||
val &= ~REG_0x01_SCAN;
|
||||
reg->set8(0x01, val);
|
||||
dev->interface->write_register(0x01, val);
|
||||
|
||||
/* for sheetfed scanners, we may have to eject document */
|
||||
if (dev->model->is_sheetfed) {
|
||||
if (eject && dev->document)
|
||||
{
|
||||
if (eject && dev->document) {
|
||||
dev->cmd_set->eject_document(dev);
|
||||
}
|
||||
if (check_stop)
|
||||
{
|
||||
if (check_stop) {
|
||||
for (i = 0; i < 30; i++) /* do not wait longer than wait 3 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
if (status.is_scanning_finished) {
|
||||
scanfsh = 1;
|
||||
}
|
||||
|
||||
if (val & REG_0x41_SCANFSH) {
|
||||
scanfsh = 1;
|
||||
}
|
||||
|
||||
if (DBG_LEVEL > DBG_io2)
|
||||
{
|
||||
print_status (val);
|
||||
}
|
||||
|
||||
if (!(val & REG_0x41_MOTMFLG) && (val & REG_0x41_FEEDFSH) && scanfsh) {
|
||||
DBG(DBG_proc, "%s: scanfeed finished\n", __func__);
|
||||
break; /* leave for loop */
|
||||
}
|
||||
if (!status.is_motor_enabled && status.is_feeding_finished && scanfsh) {
|
||||
DBG(DBG_proc, "%s: scanfeed finished\n", __func__);
|
||||
break; /* leave for loop */
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
}
|
||||
|
|
@ -1471,30 +1432,28 @@ static void end_scan_impl(Genesys_Device* dev, Genesys_Register_Set* reg, bool c
|
|||
}
|
||||
else /* flat bed scanners */
|
||||
{
|
||||
if (check_stop)
|
||||
{
|
||||
if (check_stop) {
|
||||
for (i = 0; i < 300; i++) /* do not wait longer than wait 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (val & REG_0x41_SCANFSH) {
|
||||
scanfsh = 1;
|
||||
}
|
||||
if (DBG_LEVEL > DBG_io)
|
||||
{
|
||||
print_status (val);
|
||||
}
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
if (!(val & REG_0x41_MOTMFLG) && (val & REG_0x41_FEEDFSH) && scanfsh)
|
||||
{
|
||||
if (status.is_scanning_finished) {
|
||||
scanfsh = 1;
|
||||
}
|
||||
|
||||
if (!status.is_motor_enabled && status.is_feeding_finished && scanfsh) {
|
||||
DBG(DBG_proc, "%s: scanfeed finished\n", __func__);
|
||||
break; /* leave while loop */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((!(val & REG_0x41_MOTMFLG)) && (val & REG_0x41_HOMESNR)) {
|
||||
if (!status.is_motor_enabled && status.is_at_home) {
|
||||
DBG(DBG_proc, "%s: head at home\n", __func__);
|
||||
break; /* leave while loop */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
}
|
||||
|
|
@ -1520,43 +1479,42 @@ void CommandSetGl646::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d\n", wait_until_home);
|
||||
Genesys_Settings settings;
|
||||
uint8_t val;
|
||||
int i;
|
||||
int loop = 0;
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL > DBG_io)
|
||||
{
|
||||
print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
|
||||
if (val & REG_0x41_HOMESNR) {
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: end since already at home\n", __func__);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/* stop motor if needed */
|
||||
if (val & REG_0x41_MOTMFLG) {
|
||||
if (status.is_motor_enabled) {
|
||||
gl646_stop_motor(dev);
|
||||
dev->interface->sleep_ms(200);
|
||||
}
|
||||
|
||||
/* when scanhead is moving then wait until scanhead stops or timeout */
|
||||
DBG(DBG_info, "%s: ensuring that motor is off\n", __func__);
|
||||
val = REG_0x41_MOTMFLG;
|
||||
for (i = 400; i > 0 && (val & REG_0x41_MOTMFLG); i--) {
|
||||
for (i = 400; i > 0; i--) {
|
||||
// do not wait longer than 40 seconds, count down to get i = 0 when busy
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
|
||||
if (((val & (REG_0x41_MOTMFLG | REG_0x41_HOMESNR)) == REG_0x41_HOMESNR)) {
|
||||
// at home and motor is off
|
||||
if (!status.is_motor_enabled && status.is_at_home) {
|
||||
DBG(DBG_info, "%s: already at home and not moving\n", __func__);
|
||||
return;
|
||||
}
|
||||
if (!status.is_motor_enabled) {
|
||||
break;
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
}
|
||||
|
||||
|
|
@ -1619,10 +1577,9 @@ void CommandSetGl646::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
while (loop < 300) /* do not wait longer then 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
|
||||
if (val & 0x08) /* home sensor */
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
DBG(DBG_proc, "%s: end\n", __func__);
|
||||
dev->interface->sleep_ms(500);
|
||||
|
|
@ -2794,17 +2751,14 @@ void CommandSetGl646::init(Genesys_Device* dev) const
|
|||
uint32_t addr = 0xdead;
|
||||
size_t len;
|
||||
|
||||
// to detect real power up condition, we write to REG_0x41 with pwrbit set, then read it back. When
|
||||
// scanner is cold (just replugged) PWRBIT will be set in the returned value
|
||||
std::uint8_t cold = sanei_genesys_get_status(dev);
|
||||
DBG(DBG_info, "%s: status=0x%02x\n", __func__, cold);
|
||||
cold = !(cold & REG_0x41_PWRBIT);
|
||||
if (cold)
|
||||
{
|
||||
// to detect real power up condition, we write to REG_0x41 with pwrbit set, then read it back.
|
||||
// When scanner is cold (just replugged) PWRBIT will be set in the returned value
|
||||
auto status = scanner_read_status(*dev);
|
||||
debug_print_status(dbg, status);
|
||||
|
||||
if (status.is_replugged) {
|
||||
DBG(DBG_info, "%s: device is cold\n", __func__);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
DBG(DBG_info, "%s: device is hot\n", __func__);
|
||||
}
|
||||
|
||||
|
|
@ -2828,13 +2782,14 @@ void CommandSetGl646::init(Genesys_Device* dev) const
|
|||
dev->calib_reg = dev->reg;
|
||||
}
|
||||
|
||||
/* execute physical unit init only if cold */
|
||||
if (cold)
|
||||
// execute physical unit init only if cold
|
||||
if (status.is_replugged)
|
||||
{
|
||||
DBG(DBG_info, "%s: device is cold\n", __func__);
|
||||
|
||||
val = 0x04;
|
||||
dev->interface->get_usb_device().control_msg(REQUEST_TYPE_OUT, REQUEST_REGISTER, VALUE_INIT, INDEX, 1, &val);
|
||||
dev->interface->get_usb_device().control_msg(REQUEST_TYPE_OUT, REQUEST_REGISTER,
|
||||
VALUE_INIT, INDEX, 1, &val);
|
||||
|
||||
// ASIC reset
|
||||
dev->interface->write_register(0x0e, 0x00);
|
||||
|
|
@ -2848,7 +2803,7 @@ void CommandSetGl646::init(Genesys_Device* dev) const
|
|||
|
||||
// Set powersaving(default = 15 minutes)
|
||||
dev->cmd_set->set_powersaving(dev, 15);
|
||||
} /* end if cold */
|
||||
}
|
||||
|
||||
// Set analog frontend
|
||||
gl646_set_fe(dev, sensor, AFE_INIT, 0);
|
||||
|
|
|
|||
|
|
@ -254,8 +254,6 @@ public:
|
|||
|
||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor) const override;
|
||||
|
||||
bool test_buffer_empty_bit(std::uint8_t val) const override;
|
||||
|
||||
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
|
||||
void set_powersaving(Genesys_Device* dev, int delay) const override;
|
||||
void save_power(Genesys_Device* dev, bool enable) const override;
|
||||
|
|
|
|||
|
|
@ -68,11 +68,6 @@ static int gl841_exposure_time(Genesys_Device *dev, const Genesys_Sensor& sensor
|
|||
int start,
|
||||
int used_pixels);
|
||||
|
||||
bool CommandSetGl841::test_buffer_empty_bit(SANE_Byte val) const
|
||||
{
|
||||
return (val & REG_0x41_BUFEMPTY);
|
||||
}
|
||||
|
||||
/** copy sensor specific settings */
|
||||
/* *dev : device infos
|
||||
*regs : registers to be set
|
||||
|
|
@ -1871,13 +1866,11 @@ static void gl841_stop_action(Genesys_Device* dev)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
Genesys_Register_Set local_reg;
|
||||
uint8_t val;
|
||||
unsigned int loop;
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
uint8_t val40 = dev->interface->read_register(0x40);
|
||||
|
|
@ -1906,9 +1899,6 @@ static void gl841_stop_action(Genesys_Device* dev)
|
|||
loop = 10;
|
||||
while (loop > 0) {
|
||||
val40 = dev->interface->read_register(0x40);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
sanei_genesys_print_status(val);
|
||||
}
|
||||
|
||||
/* if scanner is in command mode, we are done */
|
||||
if (!(val40 & REG_0x40_DATAENB) && !(val40 & REG_0x40_MOTMFLG)) {
|
||||
|
|
@ -1948,7 +1938,8 @@ void CommandSetGl841::eject_document(Genesys_Device* dev) const
|
|||
|
||||
local_reg.clear();
|
||||
|
||||
sanei_genesys_get_status(dev);
|
||||
// FIXME: unused result
|
||||
scanner_read_status(*dev);
|
||||
|
||||
gl841_stop_action(dev);
|
||||
|
||||
|
|
@ -2184,7 +2175,6 @@ static void gl841_feed(Genesys_Device* dev, int steps)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "steps = %d", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
uint8_t val;
|
||||
int loop;
|
||||
|
||||
gl841_stop_action(dev);
|
||||
|
|
@ -2221,10 +2211,10 @@ static void gl841_feed(Genesys_Device* dev, int steps)
|
|||
loop = 0;
|
||||
while (loop < 300) /* do not wait longer then 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
|
||||
if (!(val & REG_0x41_MOTORENB)) { /* motor enabled */
|
||||
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||
if (!status.is_motor_enabled) {
|
||||
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||
dev->scanhead_position_in_steps += steps;
|
||||
return;
|
||||
}
|
||||
|
|
@ -2267,26 +2257,21 @@ void CommandSetGl841::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
dev->cmd_set->save_power(dev, false);
|
||||
|
||||
// first read gives HOME_SENSOR true
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
dev->interface->sleep_ms(100);
|
||||
|
||||
// second is reliable
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
|
||||
if (val & REG_0x41_HOMESNR) /* is sensor at home? */
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: already at home, completed\n", __func__);
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
return;
|
||||
|
|
@ -2298,7 +2283,7 @@ void CommandSetGl841::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
dev->interface->write_register(REG_0x01, r->value);
|
||||
|
||||
/* if motor is on, stop current action */
|
||||
if (val & REG_0x41_MOTORENB) {
|
||||
if (status.is_motor_enabled) {
|
||||
gl841_stop_action(dev);
|
||||
}
|
||||
|
||||
|
|
@ -2335,10 +2320,8 @@ void CommandSetGl841::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
while (loop < 300) /* do not wait longer then 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (val & REG_0x41_HOMESNR) /* home sensor */
|
||||
{
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||
return;
|
||||
|
|
@ -3600,7 +3583,6 @@ static void sanei_gl841_repark_head(Genesys_Device* dev)
|
|||
*/
|
||||
void CommandSetGl841::init(Genesys_Device* dev) const
|
||||
{
|
||||
uint8_t val;
|
||||
size_t size;
|
||||
|
||||
DBG_INIT ();
|
||||
|
|
@ -3611,11 +3593,11 @@ void CommandSetGl841::init(Genesys_Device* dev) const
|
|||
/* Check if the device has already been initialized and powered up */
|
||||
if (dev->already_initialized)
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (val & REG_0x41_PWRBIT) {
|
||||
DBG(DBG_info, "%s: already initialized\n", __func__);
|
||||
return;
|
||||
}
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (!status.is_replugged) {
|
||||
DBG(DBG_info, "%s: already initialized\n", __func__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dev->dark_average_data.clear();
|
||||
|
|
|
|||
|
|
@ -71,8 +71,6 @@ public:
|
|||
|
||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor) const override;
|
||||
|
||||
bool test_buffer_empty_bit(std::uint8_t val) const override;
|
||||
|
||||
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
|
||||
void set_powersaving(Genesys_Device* dev, int delay) const override;
|
||||
void save_power(Genesys_Device* dev, bool enable) const override;
|
||||
|
|
|
|||
|
|
@ -89,11 +89,6 @@ gl843_get_step_multiplier (Genesys_Register_Set * regs)
|
|||
return value;
|
||||
}
|
||||
|
||||
bool CommandSetGl843::test_buffer_empty_bit(SANE_Byte val) const
|
||||
{
|
||||
return (val & REG_0x41_BUFEMPTY);
|
||||
}
|
||||
|
||||
/** copy sensor specific settings */
|
||||
static void gl843_setup_sensor(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* regs)
|
||||
|
|
@ -1334,13 +1329,11 @@ static void gl843_stop_action_no_move(Genesys_Device* dev, Genesys_Register_Set*
|
|||
static void gl843_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val;
|
||||
unsigned int loop;
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
uint8_t val40 = dev->interface->read_register(REG_0x40);
|
||||
|
|
@ -1353,7 +1346,7 @@ static void gl843_stop_action(Genesys_Device* dev)
|
|||
}
|
||||
|
||||
/* ends scan 646 */
|
||||
val = dev->reg.get8(REG_0x01);
|
||||
std::uint8_t val = dev->reg.get8(REG_0x01);
|
||||
val &= ~REG_0x01_SCAN;
|
||||
dev->reg.set8(REG_0x01, val);
|
||||
dev->interface->write_register(REG_0x01, val);
|
||||
|
|
@ -1365,21 +1358,19 @@ static void gl843_stop_action(Genesys_Device* dev)
|
|||
}
|
||||
|
||||
loop = 10;
|
||||
while (loop > 0)
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
}
|
||||
while (loop > 0) {
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
val40 = dev->interface->read_register(0x40);
|
||||
|
||||
/* if scanner is in command mode, we are done */
|
||||
if (!(val40 & REG_0x40_DATAENB) && !(val40 & REG_0x40_MOTMFLG)
|
||||
&& !(val & REG_0x41_MOTORENB))
|
||||
{
|
||||
return;
|
||||
}
|
||||
&& !status.is_motor_enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
loop--;
|
||||
|
|
@ -1748,7 +1739,6 @@ static void gl843_park_xpa_lamp(Genesys_Device* dev)
|
|||
DBG_HELPER(dbg);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
|
||||
/* copy scan settings */
|
||||
|
|
@ -1783,15 +1773,12 @@ static void gl843_park_xpa_lamp(Genesys_Device* dev)
|
|||
|
||||
while (loop < 600) /* do not wait longer then 60 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
if (DBG_LEVEL >= DBG_io2)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
}
|
||||
|
||||
if (val & REG_0x41_HOMESNR) /* home sensor */
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||
|
||||
|
|
@ -1815,7 +1802,6 @@ void CommandSetGl843::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
|
||||
if (dev->needs_home_ta) {
|
||||
|
|
@ -1826,20 +1812,21 @@ void CommandSetGl843::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
dev->scanhead_position_in_steps = 0;
|
||||
|
||||
// first read gives HOME_SENSOR true
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
|
||||
// second is reliable
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
if (val & HOMESNR) /* is sensor at home? */
|
||||
{
|
||||
return;
|
||||
|
||||
if (status.is_at_home) {
|
||||
return;
|
||||
}
|
||||
|
||||
local_reg = dev->reg;
|
||||
|
|
@ -1899,22 +1886,19 @@ void CommandSetGl843::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
|
||||
while (loop < 300) /* do not wait longer then 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io2)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
if (val & REG_0x41_HOMESNR) /* home sensor */
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
DBG(DBG_proc, "%s: finished\n", __func__);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
dev->interface->sleep_ms(100);
|
||||
++loop;
|
||||
}
|
||||
}
|
||||
|
||||
// when we come here then the scanner needed too much time for this, so we better stop
|
||||
// the motor
|
||||
|
|
@ -2052,7 +2036,6 @@ static void gl843_feed(Genesys_Device* dev, unsigned int steps)
|
|||
DBG_HELPER(dbg);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
|
||||
/* prepare local registers */
|
||||
local_reg = dev->reg;
|
||||
|
|
@ -2112,9 +2095,10 @@ static void gl843_feed(Genesys_Device* dev, unsigned int steps)
|
|||
}
|
||||
|
||||
// wait until feed count reaches the required value, but do not exceed 30s
|
||||
Status status;
|
||||
do {
|
||||
val = sanei_genesys_get_status(dev);
|
||||
} while (!(val & FEEDFSH));
|
||||
status = scanner_read_status(*dev);
|
||||
} while (!status.is_feeding_finished);
|
||||
|
||||
// looks like the scanner locks up if we scan immediately after feeding
|
||||
dev->interface->sleep_ms(100);
|
||||
|
|
|
|||
|
|
@ -71,8 +71,6 @@ public:
|
|||
|
||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor) const override;
|
||||
|
||||
bool test_buffer_empty_bit(std::uint8_t val) const override;
|
||||
|
||||
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
|
||||
void set_powersaving(Genesys_Device* dev, int delay) const override;
|
||||
void save_power(Genesys_Device* dev, bool enable) const override;
|
||||
|
|
|
|||
|
|
@ -58,11 +58,6 @@
|
|||
namespace genesys {
|
||||
namespace gl846 {
|
||||
|
||||
bool CommandSetGl846::test_buffer_empty_bit(SANE_Byte val) const
|
||||
{
|
||||
return (val & REG_0x41_BUFEMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* compute the step multiplier used
|
||||
*/
|
||||
|
|
@ -306,10 +301,10 @@ static void gl846_set_adi_fe(Genesys_Device* dev, uint8_t set)
|
|||
int i;
|
||||
|
||||
// wait for FE to be ready
|
||||
std::uint8_t val8 = sanei_genesys_get_status(dev);
|
||||
while (val8 & REG_0x41_FEBUSY) {
|
||||
auto status = scanner_read_status(*dev);
|
||||
while (status.is_front_end_busy) {
|
||||
dev->interface->sleep_ms(10);
|
||||
val8 = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
};
|
||||
|
||||
if (set == AFE_INIT)
|
||||
|
|
@ -858,15 +853,13 @@ void CommandSetGl846::set_powersaving(Genesys_Device* dev, int delay /* in minut
|
|||
static void gl846_stop_action(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val;
|
||||
unsigned int loop;
|
||||
|
||||
// post scan gpio : without that HOMSNR is unreliable
|
||||
gl846_homsnr_gpio(dev);
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
uint8_t val40 = dev->interface->read_register(REG_0x40);
|
||||
|
|
@ -878,7 +871,7 @@ static void gl846_stop_action(Genesys_Device* dev)
|
|||
}
|
||||
|
||||
/* ends scan */
|
||||
val = dev->reg.get8(REG_0x01);
|
||||
std::uint8_t val = dev->reg.get8(REG_0x01);
|
||||
val &= ~REG_0x01_SCAN;
|
||||
dev->reg.set8(REG_0x01, val);
|
||||
dev->interface->write_register(REG_0x01, val);
|
||||
|
|
@ -889,20 +882,18 @@ static void gl846_stop_action(Genesys_Device* dev)
|
|||
}
|
||||
|
||||
loop = 10;
|
||||
while (loop > 0)
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
while (loop > 0) {
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
val40 = dev->interface->read_register(REG_0x40);
|
||||
|
||||
/* if scanner is in command mode, we are done */
|
||||
if (!(val40 & REG_0x40_DATAENB) && !(val40 & REG_0x40_MOTMFLG) &&
|
||||
!(val & REG_0x41_MOTORENB))
|
||||
!status.is_motor_enabled)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
|
|
@ -959,7 +950,6 @@ void CommandSetGl846::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
ScanColorMode scan_mode;
|
||||
|
||||
|
|
@ -967,25 +957,20 @@ void CommandSetGl846::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
gl846_homsnr_gpio(dev);
|
||||
|
||||
// first read gives HOME_SENSOR true
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
dev->interface->sleep_ms(100);
|
||||
|
||||
// second is reliable
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
/* is sensor at home? */
|
||||
if (val & HOMESNR)
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: already at home, completed\n", __func__);
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
return;
|
||||
|
|
@ -1054,10 +1039,8 @@ void CommandSetGl846::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
while (loop < 300) /* do not wait longer then 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (val & HOMESNR) /* home sensor */
|
||||
{
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
gl846_stop_action (dev);
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
|
|
@ -1199,7 +1182,6 @@ static void gl846_feed(Genesys_Device* dev, unsigned int steps)
|
|||
DBG_HELPER_ARGS(dbg, "steps=%d\n", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
|
||||
/* prepare local registers */
|
||||
local_reg = dev->reg;
|
||||
|
|
@ -1263,9 +1245,10 @@ static void gl846_feed(Genesys_Device* dev, unsigned int steps)
|
|||
}
|
||||
|
||||
// wait until feed count reaches the required value, but do not exceed 30s
|
||||
Status status;
|
||||
do {
|
||||
val = sanei_genesys_get_status(dev);
|
||||
} while (!(val & FEEDFSH));
|
||||
status = scanner_read_status(*dev);
|
||||
} while (!status.is_feeding_finished);
|
||||
|
||||
// then stop scanning
|
||||
gl846_stop_action(dev);
|
||||
|
|
|
|||
|
|
@ -156,8 +156,6 @@ public:
|
|||
|
||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor) const override;
|
||||
|
||||
bool test_buffer_empty_bit(std::uint8_t val) const override;
|
||||
|
||||
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
|
||||
void set_powersaving(Genesys_Device* dev, int delay) const override;
|
||||
void save_power(Genesys_Device* dev, bool enable) const override;
|
||||
|
|
|
|||
|
|
@ -53,11 +53,6 @@
|
|||
namespace genesys {
|
||||
namespace gl847 {
|
||||
|
||||
bool CommandSetGl847::test_buffer_empty_bit(SANE_Byte val) const
|
||||
{
|
||||
return (val & REG_0x41_BUFEMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* compute the step multiplier used
|
||||
*/
|
||||
|
|
@ -327,10 +322,10 @@ static void gl847_set_ad_fe(Genesys_Device* dev, uint8_t set)
|
|||
int i;
|
||||
|
||||
// wait for FE to be ready
|
||||
std::uint8_t val8 = sanei_genesys_get_status(dev);
|
||||
while (val8 & REG_0x41_FEBUSY) {
|
||||
auto status = scanner_read_status(*dev);
|
||||
while (status.is_front_end_busy) {
|
||||
dev->interface->sleep_ms(10);
|
||||
val8 = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
};
|
||||
|
||||
if (set == AFE_INIT)
|
||||
|
|
@ -874,10 +869,9 @@ static void gl847_stop_action(Genesys_Device* dev)
|
|||
|
||||
// post scan gpio : without that HOMSNR is unreliable
|
||||
gl847_homsnr_gpio(dev);
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
uint8_t val40 = dev->interface->read_register(REG_0x40);
|
||||
|
|
@ -903,19 +897,18 @@ static void gl847_stop_action(Genesys_Device* dev)
|
|||
loop = 10;
|
||||
while (loop > 0)
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
}
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
val40 = dev->interface->read_register(REG_0x40);
|
||||
|
||||
/* if scanner is in command mode, we are done */
|
||||
if (!(val40 & REG_0x40_DATAENB) && !(val40 & REG_0x40_MOTMFLG) &&
|
||||
!(val & REG_0x41_MOTORENB))
|
||||
!status.is_motor_enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dev->interface->sleep_ms(100);
|
||||
loop--;
|
||||
|
|
@ -1010,7 +1003,6 @@ void CommandSetGl847::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
ScanColorMode scan_mode;
|
||||
|
||||
|
|
@ -1018,25 +1010,19 @@ void CommandSetGl847::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
gl847_homsnr_gpio(dev);
|
||||
|
||||
// first read gives HOME_SENSOR true
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
dev->interface->sleep_ms(100);
|
||||
|
||||
// second is reliable
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
/* is sensor at home? */
|
||||
if (val & HOMESNR)
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: already at home, completed\n", __func__);
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
return;
|
||||
|
|
@ -1103,18 +1089,16 @@ void CommandSetGl847::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
{
|
||||
while (loop < 300) /* do not wait longer then 30 seconds */
|
||||
{
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (val & HOMESNR) /* home sensor */
|
||||
{
|
||||
auto status = scanner_read_status(*dev);
|
||||
if (status.is_at_home) {
|
||||
DBG(DBG_info, "%s: reached home position\n", __func__);
|
||||
gl847_stop_action (dev);
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
dev->interface->sleep_ms(100);
|
||||
++loop;
|
||||
}
|
||||
}
|
||||
|
||||
// when we come here then the scanner needed too much time for this, so we better stop
|
||||
// the motor
|
||||
|
|
@ -1248,7 +1232,6 @@ static void gl847_feed(Genesys_Device* dev, unsigned int steps)
|
|||
DBG_HELPER_ARGS(dbg, "steps=%d", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
|
||||
local_reg = dev->reg;
|
||||
|
||||
|
|
@ -1310,10 +1293,10 @@ static void gl847_feed(Genesys_Device* dev, unsigned int steps)
|
|||
}
|
||||
|
||||
// wait until feed count reaches the required value, but do not exceed 30s
|
||||
Status status;
|
||||
do {
|
||||
val = sanei_genesys_get_status(dev);
|
||||
}
|
||||
while (!(val & FEEDFSH));
|
||||
status = scanner_read_status(*dev);
|
||||
} while (!status.is_feeding_finished);
|
||||
|
||||
// then stop scanning
|
||||
gl847_stop_action(dev);
|
||||
|
|
|
|||
|
|
@ -140,8 +140,6 @@ public:
|
|||
|
||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor) const override;
|
||||
|
||||
bool test_buffer_empty_bit(std::uint8_t val) const override;
|
||||
|
||||
void set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set) const override;
|
||||
void set_powersaving(Genesys_Device* dev, int delay) const override;
|
||||
void save_power(Genesys_Device* dev, bool enable) const override;
|
||||
|
|
|
|||
|
|
@ -266,36 +266,54 @@ void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr)
|
|||
/* Medium level functions */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/** read the status register
|
||||
*/
|
||||
std::uint8_t sanei_genesys_get_status(Genesys_Device* dev)
|
||||
Status scanner_read_status(Genesys_Device& dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
std::uint16_t address = 0x41;
|
||||
if (dev->model->asic_type == AsicType::GL124) {
|
||||
address = 0x101;
|
||||
std::uint16_t address = 0;
|
||||
|
||||
switch (dev.model->asic_type) {
|
||||
case AsicType::GL124: address = 0x101; break;
|
||||
case AsicType::GL646:
|
||||
case AsicType::GL841:
|
||||
case AsicType::GL843:
|
||||
case AsicType::GL845:
|
||||
case AsicType::GL846:
|
||||
case AsicType::GL847: address = 0x41; break;
|
||||
default: throw SaneException("Unsupported asic type");
|
||||
}
|
||||
return dev->interface->read_register(address);
|
||||
|
||||
// same for all chips
|
||||
constexpr std::uint8_t PWRBIT = 0x80;
|
||||
constexpr std::uint8_t BUFEMPTY = 0x40;
|
||||
constexpr std::uint8_t FEEDFSH = 0x20;
|
||||
constexpr std::uint8_t SCANFSH = 0x10;
|
||||
constexpr std::uint8_t HOMESNR = 0x08;
|
||||
constexpr std::uint8_t LAMPSTS = 0x04;
|
||||
constexpr std::uint8_t FEBUSY = 0x02;
|
||||
constexpr std::uint8_t MOTORENB = 0x01;
|
||||
|
||||
auto value = dev.interface->read_register(address);
|
||||
Status status;
|
||||
status.is_replugged = !(value & PWRBIT);
|
||||
status.is_buffer_empty = value & BUFEMPTY;
|
||||
status.is_feeding_finished = value & FEEDFSH;
|
||||
status.is_scanning_finished = value & SCANFSH;
|
||||
status.is_at_home = value & HOMESNR;
|
||||
status.is_lamp_on = value & LAMPSTS;
|
||||
status.is_front_end_busy = value & FEBUSY;
|
||||
status.is_motor_enabled = value & MOTORENB;
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes and prints content of status register
|
||||
* @param val value read from status register
|
||||
*/
|
||||
void sanei_genesys_print_status (uint8_t val)
|
||||
void debug_print_status(DebugMessageHelper& dbg, Status val)
|
||||
{
|
||||
char msg[80];
|
||||
|
||||
sprintf (msg, "%s%s%s%s%s%s%s%s",
|
||||
val & PWRBIT ? "PWRBIT " : "",
|
||||
val & BUFEMPTY ? "BUFEMPTY " : "",
|
||||
val & FEEDFSH ? "FEEDFSH " : "",
|
||||
val & SCANFSH ? "SCANFSH " : "",
|
||||
val & HOMESNR ? "HOMESNR " : "",
|
||||
val & LAMPSTS ? "LAMPSTS " : "",
|
||||
val & FEBUSY ? "FEBUSY " : "",
|
||||
val & MOTORENB ? "MOTORENB" : "");
|
||||
DBG(DBG_info, "status=%s\n", msg);
|
||||
std::stringstream str;
|
||||
str << val;
|
||||
dbg.vlog(DBG_info, "status=%s\n", str.str().c_str());
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
@ -400,12 +418,12 @@ void sanei_genesys_read_scancnt(Genesys_Device* dev, unsigned int* words)
|
|||
bool sanei_genesys_is_buffer_empty(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val = 0;
|
||||
|
||||
dev->interface->sleep_ms(1);
|
||||
val = sanei_genesys_get_status(dev);
|
||||
|
||||
if (dev->cmd_set->test_buffer_empty_bit(val)) {
|
||||
auto status = scanner_read_status(*dev);
|
||||
|
||||
if (status.is_buffer_empty) {
|
||||
/* fix timing issue on USB3 (or just may be too fast) hardware
|
||||
* spotted by John S. Weber <jweber53@gmail.com>
|
||||
*/
|
||||
|
|
@ -427,7 +445,7 @@ void wait_until_buffer_non_empty(Genesys_Device* dev, bool check_status_twice)
|
|||
|
||||
if (check_status_twice) {
|
||||
// FIXME: this only to preserve previous behavior, can be removed
|
||||
sanei_genesys_get_status(dev);
|
||||
scanner_read_status(*dev);
|
||||
}
|
||||
|
||||
bool empty = sanei_genesys_is_buffer_empty(dev);
|
||||
|
|
@ -1634,7 +1652,6 @@ bool get_registers_gain4_bit(AsicType asic_type, const Genesys_Register_Set& reg
|
|||
void sanei_genesys_wait_for_home(Genesys_Device* dev)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t val;
|
||||
|
||||
/* clear the parking status whatever the outcome of the function */
|
||||
dev->parking = false;
|
||||
|
|
@ -1645,13 +1662,11 @@ void sanei_genesys_wait_for_home(Genesys_Device* dev)
|
|||
|
||||
// read initial status, if head isn't at home and motor is on we are parking, so we wait.
|
||||
// gl847/gl124 need 2 reads for reliable results
|
||||
val = sanei_genesys_get_status(dev);
|
||||
auto status = scanner_read_status(*dev);
|
||||
dev->interface->sleep_ms(10);
|
||||
val = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
|
||||
/* if at home, return */
|
||||
if(val & HOMESNR)
|
||||
{
|
||||
if (status.is_at_home) {
|
||||
DBG (DBG_info,
|
||||
"%s: already at home\n", __func__);
|
||||
return;
|
||||
|
|
@ -1664,16 +1679,15 @@ void sanei_genesys_wait_for_home(Genesys_Device* dev)
|
|||
dev->interface->sleep_ms(100);
|
||||
elapsed_ms += 100;
|
||||
|
||||
val = sanei_genesys_get_status(dev);
|
||||
status = scanner_read_status(*dev);
|
||||
if (DBG_LEVEL >= DBG_io) {
|
||||
debug_print_status(dbg, status);
|
||||
}
|
||||
|
||||
if (DBG_LEVEL >= DBG_io2)
|
||||
{
|
||||
sanei_genesys_print_status (val);
|
||||
}
|
||||
} while (elapsed_ms < timeout_ms && !(val & HOMESNR));
|
||||
} while (elapsed_ms < timeout_ms && !status.is_at_home);
|
||||
|
||||
/* if after the timeout, head is still not parked, error out */
|
||||
if (elapsed_ms >= timeout_ms && !(val & HOMESNR)) {
|
||||
if (elapsed_ms >= timeout_ms && !status.is_at_home) {
|
||||
DBG (DBG_error, "%s: failed to reach park position in %dseconds\n", __func__,
|
||||
timeout_ms / 1000);
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "failed to reach park position");
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@
|
|||
#include "serialize.h"
|
||||
#include "settings.h"
|
||||
#include "static_init.h"
|
||||
#include "status.h"
|
||||
#include "register.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -196,15 +197,6 @@
|
|||
#define MOTOR_SPEED_MAX 350
|
||||
#define DARK_VALUE 0
|
||||
|
||||
#define PWRBIT 0x80
|
||||
#define BUFEMPTY 0x40
|
||||
#define FEEDFSH 0x20
|
||||
#define SCANFSH 0x10
|
||||
#define HOMESNR 0x08
|
||||
#define LAMPSTS 0x04
|
||||
#define FEBUSY 0x02
|
||||
#define MOTORENB 0x01
|
||||
|
||||
#define MAX_RESOLUTIONS 13
|
||||
#define MAX_DPI 4
|
||||
|
||||
|
|
@ -258,9 +250,9 @@ inline GenesysRegister* sanei_genesys_get_address(Genesys_Register_Set* regs, ui
|
|||
|
||||
extern void sanei_genesys_init_cmd_set(Genesys_Device* dev);
|
||||
|
||||
std::uint8_t sanei_genesys_get_status(Genesys_Device* dev);
|
||||
Status scanner_read_status(Genesys_Device& dev);
|
||||
|
||||
extern void sanei_genesys_print_status (uint8_t val);
|
||||
extern void debug_print_status(DebugMessageHelper& dbg, Status status);
|
||||
|
||||
extern void sanei_genesys_write_ahb(Genesys_Device* dev, uint32_t addr, uint32_t size,
|
||||
uint8_t* data);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
If you do not wish that, delete this exception notice.
|
||||
*/
|
||||
|
||||
#define DEBUG_DECLARE_ONLY
|
||||
|
||||
#include "static_init.h"
|
||||
#include <vector>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
/* sane - Scanner Access Now Easy.
|
||||
|
||||
Copyright (C) 2019 Povilas Kanapickas <povilas@radix.lt>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#define DEBUG_DECLARE_ONLY
|
||||
|
||||
#include "status.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, Status status)
|
||||
{
|
||||
out << "Status{\n"
|
||||
<< " replugged: " << (status.is_replugged ? "yes" : "no") << '\n'
|
||||
<< " is_buffer_empty: " << (status.is_buffer_empty ? "yes" : "no") << '\n'
|
||||
<< " is_feeding_finished: " << (status.is_feeding_finished ? "yes" : "no") << '\n'
|
||||
<< " is_scanning_finished: " << (status.is_scanning_finished ? "yes" : "no") << '\n'
|
||||
<< " is_at_home: " << (status.is_at_home ? "yes" : "no") << '\n'
|
||||
<< " is_lamp_on: " << (status.is_lamp_on ? "yes" : "no") << '\n'
|
||||
<< " is_front_end_busy: " << (status.is_front_end_busy ? "yes" : "no") << '\n'
|
||||
<< " is_motor_enabled: " << (status.is_motor_enabled ? "yes" : "no") << '\n'
|
||||
<< "}\n";
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
/* sane - Scanner Access Now Easy.
|
||||
|
||||
Copyright (C) 2019 Povilas Kanapickas <povilas@radix.lt>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef BACKEND_GENESYS_STATUS_H
|
||||
#define BACKEND_GENESYS_STATUS_H
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/// Represents the scanner status register
|
||||
struct Status
|
||||
{
|
||||
bool is_replugged = false;
|
||||
bool is_buffer_empty = false;
|
||||
bool is_feeding_finished = false;
|
||||
bool is_scanning_finished = false;
|
||||
bool is_at_home = false;
|
||||
bool is_lamp_on = false;
|
||||
bool is_front_end_busy = false;
|
||||
bool is_motor_enabled = false;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, Status status);
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_STATUS_H
|
||||
Ładowanie…
Reference in New Issue