kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Improve set_head_pos_unknown() to set status per head
rodzic
a676810f5d
commit
645820bc4d
|
@ -124,10 +124,14 @@ unsigned Genesys_Device::head_pos(ScanHeadId scan_head) const
|
|||
}
|
||||
}
|
||||
|
||||
void Genesys_Device::set_head_pos_unknown()
|
||||
void Genesys_Device::set_head_pos_unknown(ScanHeadId scan_head)
|
||||
{
|
||||
is_head_pos_primary_known_ = false;
|
||||
is_head_pos_secondary_known_ = false;
|
||||
if ((scan_head & ScanHeadId::PRIMARY) != ScanHeadId::NONE) {
|
||||
is_head_pos_primary_known_ = false;
|
||||
}
|
||||
if ((scan_head & ScanHeadId::SECONDARY) != ScanHeadId::NONE) {
|
||||
is_head_pos_secondary_known_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Genesys_Device::set_head_pos_zero(ScanHeadId scan_head)
|
||||
|
|
|
@ -360,7 +360,7 @@ struct Genesys_Device
|
|||
|
||||
bool is_head_pos_known(ScanHeadId scan_head) const;
|
||||
unsigned head_pos(ScanHeadId scan_head) const;
|
||||
void set_head_pos_unknown();
|
||||
void set_head_pos_unknown(ScanHeadId scan_head);
|
||||
void set_head_pos_zero(ScanHeadId scan_head);
|
||||
void advance_head_pos_by_session(ScanHeadId scan_head);
|
||||
void advance_head_pos_by_steps(ScanHeadId scan_head, Direction direction, unsigned steps);
|
||||
|
|
|
@ -1169,7 +1169,7 @@ void scanner_move_back_home(Genesys_Device& dev, bool wait_until_home)
|
|||
// when we come here then the scanner needed too much time for this, so we better stop
|
||||
// the motor
|
||||
catch_all_exceptions(__func__, [&](){ scanner_stop_action(dev); });
|
||||
dev.set_head_pos_unknown();
|
||||
dev.set_head_pos_unknown(ScanHeadId::PRIMARY | ScanHeadId::SECONDARY);
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "timeout while waiting for scanhead to go home");
|
||||
}
|
||||
dbg.log(DBG_info, "scanhead is still moving");
|
||||
|
|
|
@ -1473,7 +1473,7 @@ void CommandSetGl646::move_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
|
||||
if (!i) /* the loop counted down to 0, scanner still is busy */
|
||||
{
|
||||
dev->set_head_pos_unknown();
|
||||
dev->set_head_pos_unknown(ScanHeadId::PRIMARY | ScanHeadId::SECONDARY);
|
||||
throw SaneException(SANE_STATUS_DEVICE_BUSY, "motor is still on: device busy");
|
||||
}
|
||||
|
||||
|
@ -1567,7 +1567,7 @@ void CommandSetGl646::move_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
// stop the motor
|
||||
catch_all_exceptions(__func__, [&](){ gl646_stop_motor (dev); });
|
||||
catch_all_exceptions(__func__, [&](){ end_scan_impl(dev, &dev->reg, true, false); });
|
||||
dev->set_head_pos_unknown();
|
||||
dev->set_head_pos_unknown(ScanHeadId::PRIMARY | ScanHeadId::SECONDARY);
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "timeout while waiting for scanhead to go home");
|
||||
}
|
||||
|
||||
|
|
|
@ -2183,7 +2183,7 @@ static void gl841_feed(Genesys_Device* dev, int steps)
|
|||
/* when we come here then the scanner needed too much time for this, so we better stop the motor */
|
||||
gl841_stop_action (dev);
|
||||
|
||||
dev->set_head_pos_unknown();
|
||||
dev->set_head_pos_unknown(ScanHeadId::PRIMARY);
|
||||
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "timeout while waiting for scanhead to go home");
|
||||
}
|
||||
|
@ -2279,7 +2279,7 @@ void CommandSetGl841::move_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
// when we come here then the scanner needed too much time for this, so we better stop
|
||||
// the motor
|
||||
catch_all_exceptions(__func__, [&](){ gl841_stop_action(dev); });
|
||||
dev->set_head_pos_unknown();
|
||||
dev->set_head_pos_unknown(ScanHeadId::PRIMARY);
|
||||
throw SaneException(SANE_STATUS_IO_ERROR, "timeout while waiting for scanhead to go home");
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue