- conditional handling of SANE_STATUS_WARMING_UP and SANE_STATUS_LOCKED

merge-requests/1/head
Stéphane Voltz 2009-04-13 06:10:26 +00:00
rodzic 56277dfc54
commit fc29149914
2 zmienionych plików z 18 dodań i 0 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2009-04-13 Stéphane Voltz <stef.dev@free.fr>
* backend/pnm.c: conditional handling of STATUS_HW_LOCKED
and STATUS_WARMING_UP
2009-04-12 m. allan noah <kitno455 a t gmail d o t com> 2009-04-12 m. allan noah <kitno455 a t gmail d o t com>
* doc/doxygen-sanei.conf.in: update to recent version of doxygen * doc/doxygen-sanei.conf.in: update to recent version of doxygen

Wyświetl plik

@ -81,8 +81,10 @@ static SANE_Word status_ioerror = SANE_FALSE;
static SANE_Word status_nomem = SANE_FALSE; static SANE_Word status_nomem = SANE_FALSE;
static SANE_Word status_accessdenied = SANE_FALSE; static SANE_Word status_accessdenied = SANE_FALSE;
static SANE_Word test_option = 0; static SANE_Word test_option = 0;
#ifdef SANE_STATUS_WARMING_UP
static SANE_Word warming_up = SANE_FALSE; static SANE_Word warming_up = SANE_FALSE;
static struct timeval start; static struct timeval start;
#endif
static SANE_Fixed bright = 0; static SANE_Fixed bright = 0;
static SANE_Word res = 75; static SANE_Word res = 75;
@ -536,16 +538,20 @@ static const SANE_Device dev[] = {
"Noname", "Noname",
"PNM file reader", "PNM file reader",
"virtual device"}, "virtual device"},
#ifdef SANE_STATUS_HW_LOCKED
{ {
"locked", "locked",
"Noname", "Noname",
"Hardware locked", "Hardware locked",
"virtual device"}, "virtual device"},
#endif
#ifdef SANE_STATUS_WARMING_UP
{ {
"warmup", "warmup",
"Noname", "Noname",
"Always warming up", "Always warming up",
"virtual device"}, "virtual device"},
#endif
}; };
SANE_Status SANE_Status
@ -591,14 +597,18 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle)
gamma[3][i] = i; gamma[3][i] = i;
} }
#ifdef SANE_STATUS_HW_LOCKED
if(strncmp(devicename,"locked",6)==0) if(strncmp(devicename,"locked",6)==0)
return SANE_STATUS_HW_LOCKED; return SANE_STATUS_HW_LOCKED;
#endif
#ifdef SANE_STATUS_WARMING_UP
if(strncmp(devicename,"warmup",6)==0) if(strncmp(devicename,"warmup",6)==0)
{ {
warming_up = SANE_TRUE; warming_up = SANE_TRUE;
start.tv_sec = 0; start.tv_sec = 0;
} }
#endif
return SANE_STATUS_GOOD; return SANE_STATUS_GOOD;
} }
@ -1094,13 +1104,16 @@ sane_start (SANE_Handle handle)
{ {
char buf[1024]; char buf[1024];
int nlines; int nlines;
#ifdef SANE_STATUS_WARMING_UP
struct timeval current; struct timeval current;
#endif
DBG (2, "sane_start\n"); DBG (2, "sane_start\n");
rgb_comp = 0; rgb_comp = 0;
if (handle != MAGIC || !is_open) if (handle != MAGIC || !is_open)
return SANE_STATUS_INVAL; /* Unknown handle ... */ return SANE_STATUS_INVAL; /* Unknown handle ... */
#ifdef SANE_STATUS_WARMING_UP
if(warming_up == SANE_TRUE) if(warming_up == SANE_TRUE)
{ {
gettimeofday(&current,NULL); gettimeofday(&current,NULL);
@ -1112,6 +1125,7 @@ sane_start (SANE_Handle handle)
if(current.tv_sec-start.tv_sec<5) if(current.tv_sec-start.tv_sec<5)
return SANE_STATUS_WARMING_UP; return SANE_STATUS_WARMING_UP;
} }
#endif
if (infile != NULL) if (infile != NULL)
{ {