kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return errors as exceptions from *read_valid_words()
rodzic
478ddd5d01
commit
693d42c025
|
@ -3975,13 +3975,7 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
|
|||
do
|
||||
{
|
||||
sanei_genesys_sleep_ms(100);
|
||||
status = sanei_genesys_read_valid_words (dev, &steps);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: failed to read valid words: %s\n", __func__,
|
||||
sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
sanei_genesys_read_valid_words(dev, &steps);
|
||||
}
|
||||
while (steps < 1);
|
||||
}
|
||||
|
|
|
@ -1947,8 +1947,8 @@ gl646_detect_document_end (Genesys_Device * dev)
|
|||
DBG(DBG_io, "%s: total_bytes_read =%lu\n", __func__, (u_long) dev->total_bytes_read);
|
||||
DBG(DBG_io, "%s: read_bytes_left =%lu\n", __func__, (u_long) dev->read_bytes_left);
|
||||
|
||||
/* amount of data available from scanner is what to scan */
|
||||
status = sanei_genesys_read_valid_words (dev, &bytes_left);
|
||||
// amount of data available from scanner is what to scan
|
||||
sanei_genesys_read_valid_words(dev, &bytes_left);
|
||||
|
||||
/* we add the number of lines needed to read the last part of the document in */
|
||||
lines =
|
||||
|
|
|
@ -708,9 +708,8 @@ genesys_dpiset (Genesys_Register_Set * reg)
|
|||
/** read the number of valid words in scanner's RAM
|
||||
* ie registers 42-43-44
|
||||
*/
|
||||
/*candidate for moving into chip specific files?*/
|
||||
SANE_Status
|
||||
sanei_genesys_read_valid_words (Genesys_Device * dev, unsigned int *words)
|
||||
// candidate for moving into chip specific files?
|
||||
void sanei_genesys_read_valid_words(Genesys_Device* dev, unsigned int* words)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint8_t value;
|
||||
|
@ -764,7 +763,6 @@ sanei_genesys_read_valid_words (Genesys_Device * dev, unsigned int *words)
|
|||
}
|
||||
|
||||
DBG(DBG_proc, "%s: %d words\n", __func__, *words);
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/** read the number of lines scanned
|
||||
|
@ -836,23 +834,15 @@ sanei_genesys_read_data_from_scanner (Genesys_Device * dev, uint8_t * data,
|
|||
size_t size)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "size = %lu bytes", (u_long) size);
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
int time_count = 0;
|
||||
unsigned int words = 0;
|
||||
|
||||
if (size & 1)
|
||||
DBG(DBG_info, "WARNING %s: odd number of bytes\n", __func__);
|
||||
|
||||
/* wait until buffer not empty for up to 5 seconds */
|
||||
do
|
||||
{
|
||||
status = sanei_genesys_read_valid_words (dev, &words);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: checking for empty buffer failed: %s\n", __func__,
|
||||
sane_strstatus(status));
|
||||
return status;
|
||||
}
|
||||
// wait until buffer not empty for up to 5 seconds
|
||||
do {
|
||||
sanei_genesys_read_valid_words (dev, &words);
|
||||
if (words == 0)
|
||||
{
|
||||
sanei_genesys_sleep_ms(10);
|
||||
|
|
|
@ -1753,8 +1753,7 @@ 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 void sanei_genesys_read_scancnt(Genesys_Device* dev, unsigned int* steps);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue