kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-calibration' into 'master'
genesys: Fix multiple issues in calibration code paths See merge request sane-project/backends!407merge-requests/213/head^2
commit
549e10314f
|
@ -3513,6 +3513,7 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
unsigned int steps, expected;
|
unsigned int steps, expected;
|
||||||
|
|
||||||
|
|
||||||
/* since not all scanners are set ot wait for head to park
|
/* since not all scanners are set ot wait for head to park
|
||||||
* we check we are not still parking before starting a new scan */
|
* we check we are not still parking before starting a new scan */
|
||||||
if (dev->parking) {
|
if (dev->parking) {
|
||||||
|
@ -4906,7 +4907,7 @@ static void probe_genesys_devices()
|
||||||
of Genesys_Calibration_Cache as is.
|
of Genesys_Calibration_Cache as is.
|
||||||
*/
|
*/
|
||||||
static const char* CALIBRATION_IDENT = "sane_genesys";
|
static const char* CALIBRATION_IDENT = "sane_genesys";
|
||||||
static const int CALIBRATION_VERSION = 29;
|
static const int CALIBRATION_VERSION = 30;
|
||||||
|
|
||||||
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
||||||
const std::string& path)
|
const std::string& path)
|
||||||
|
@ -5326,21 +5327,6 @@ static void sane_open_impl(SANE_String_Const devicename, SANE_Handle * handle)
|
||||||
|
|
||||||
// some hardware capabilities are detected through sensors
|
// some hardware capabilities are detected through sensors
|
||||||
s->dev->cmd_set->update_hardware_sensors (s);
|
s->dev->cmd_set->update_hardware_sensors (s);
|
||||||
|
|
||||||
/* here is the place to fetch a stored calibration cache */
|
|
||||||
if (s->dev->force_calibration == 0)
|
|
||||||
{
|
|
||||||
auto path = calibration_filename(s->dev);
|
|
||||||
s->calibration_file = path;
|
|
||||||
s->dev->calib_file = path;
|
|
||||||
DBG(DBG_info, "%s: Calibration filename set to:\n", __func__);
|
|
||||||
DBG(DBG_info, "%s: >%s<\n", __func__, s->dev->calib_file.c_str());
|
|
||||||
|
|
||||||
catch_all_exceptions(__func__, [&]()
|
|
||||||
{
|
|
||||||
sanei_genesys_read_calibration(s->dev->calibration_cache, s->dev->calib_file);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_GENESYS_API_LINKAGE
|
SANE_GENESYS_API_LINKAGE
|
||||||
|
@ -6158,6 +6144,20 @@ void sane_start_impl(SANE_Handle handle)
|
||||||
throw SaneException("top left y >= bottom right y");
|
throw SaneException("top left y >= bottom right y");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fetch stored calibration
|
||||||
|
if (s->dev->force_calibration == 0) {
|
||||||
|
auto path = calibration_filename(s->dev);
|
||||||
|
s->calibration_file = path;
|
||||||
|
s->dev->calib_file = path;
|
||||||
|
DBG(DBG_info, "%s: Calibration filename set to:\n", __func__);
|
||||||
|
DBG(DBG_info, "%s: >%s<\n", __func__, s->dev->calib_file.c_str());
|
||||||
|
|
||||||
|
catch_all_exceptions(__func__, [&]()
|
||||||
|
{
|
||||||
|
sanei_genesys_read_calibration(s->dev->calibration_cache, s->dev->calib_file);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* First make sure we have a current parameter set. Some of the
|
/* First make sure we have a current parameter set. Some of the
|
||||||
parameters will be overwritten below, but that's OK. */
|
parameters will be overwritten below, but that's OK. */
|
||||||
|
|
||||||
|
|
|
@ -2005,6 +2005,9 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
||||||
length -= (-offset);
|
length -= (-offset);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
|
if (static_cast<int>(length) + offset > static_cast<int>(size)) {
|
||||||
|
length = size - offset;
|
||||||
|
}
|
||||||
|
|
||||||
/* loop over calibration data */
|
/* loop over calibration data */
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
|
|
Ładowanie…
Reference in New Issue