- renamed per frontend struct tp Rts8891_Session

- made use of new well-known option groups
	- added warming-up handling in sane_start()
merge-requests/1/head
Stéphane Voltz 2008-05-26 04:48:20 +00:00
rodzic c97e99a430
commit 1ed1d84f85
7 zmienionych plików z 501 dodań i 422 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2008-05-26 Stéphane Voltz <stef.dev@free.fr>
* backend/rts8891.[ch], backend/rts8891_low.[ch],
backend/rts88xx_lib.[ch]: renamed per frontend struct, made use of
new well-known option groups. Added warming-up handling in
sane_start().
2008-05-22 Stéphane Voltz <stef.dev@free.fr>
* backend/genesys.c:
changed top of scan area detection for MD6228/MD6471 models

Plik diff jest za duży Load Diff

Wyświetl plik

@ -65,10 +65,11 @@
*/
enum Rts8891_Option
{ OPT_NUM_OPTS = 0,
OPT_MODE_GROUP,
OPT_STANDARD_GROUP,
OPT_MODE,
OPT_PREVIEW,
OPT_RESOLUTION,
OPT_GEOMETRY_GROUP,
OPT_TL_X, /* top-left x */
OPT_TL_Y, /* top-left y */
@ -90,7 +91,7 @@ enum Rts8891_Option
OPT_LAMP_OFF,
/* button group */
OPT_BUTTON_GROUP,
OPT_SENSOR_GROUP,
OPT_BUTTON_1,
OPT_BUTTON_2,
OPT_BUTTON_3,
@ -110,11 +111,11 @@ enum Rts8891_Option
* the functions defined in SANE's standard. Informations closer
* to the hardware are in the Rts8891_Device structure.
*/
typedef struct Rts8891_Scanner
typedef struct Rts8891_Session
{
/**< Next handle in linked list */
struct Rts8891_Scanner *next;
struct Rts8891_Session *next;
/**< Low-level device object */
struct Rts8891_Device *dev;
@ -137,6 +138,6 @@ typedef struct Rts8891_Scanner
/**< bytes currently sent to frontend during the scan */
SANE_Int sent;
} Rts8891_Scanner;
} Rts8891_Session;
#endif /* not RTS8891_H */

Wyświetl plik

@ -46,10 +46,10 @@
* and separate functions with different goals.
*/
#include "sane/config.h"
#include "sane/sane.h"
#include "sane/sanei_backend.h"
#include "sane/sanei_usb.h"
#include "../include/sane/config.h"
#include "../include/sane/sane.h"
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_usb.h"
#include <stdio.h>
#ifdef HAVE_SYS_TIME_H
@ -527,11 +527,11 @@ rts8891_park (SANE_Int devnum, SANE_Byte * regs)
* mode since we cope with it on first data wait.
*/
static SANE_Status
read_data (struct Rts8891_Scanner *scanner, SANE_Byte * dest, SANE_Int length)
read_data (struct Rts8891_Session *session, SANE_Byte * dest, SANE_Int length)
{
SANE_Status status = SANE_STATUS_GOOD;
SANE_Int count, read, len, dummy;
struct Rts8891_Device *dev = scanner->dev;
struct Rts8891_Device *dev = session->dev;
static FILE *raw = NULL; /* for debugging purpose we need it static */
SANE_Byte control = 0x08;
unsigned char buffer[RTS88XX_MAX_XFER_SIZE];
@ -565,7 +565,7 @@ read_data (struct Rts8891_Scanner *scanner, SANE_Byte * dest, SANE_Int length)
/* in case there is no data, we return BUSY since this mean */
/* that scanning head hasn't reach is position and data hasn't */
/* come yet */
if (scanner->non_blocking && count == 0)
if (session->non_blocking && count == 0)
{
dev->regs[LAMP_REG] = 0x8d;
@ -657,9 +657,9 @@ read_data (struct Rts8891_Scanner *scanner, SANE_Byte * dest, SANE_Int length)
{
/* PNM header */
fprintf (raw, "P%c\n%d %d\n255\n",
scanner->params.format ==
session->params.format ==
SANE_FRAME_RGB
|| scanner->emulated_gray ==
|| session->emulated_gray ==
SANE_TRUE ? '6' : '5', dev->pixels,
dev->lines);
}

Wyświetl plik

@ -205,11 +205,27 @@ struct Rts8891_Device
/* end of the data buffer */
SANE_Byte *end;
/* amount of bytes read from scanner */
/**
* amount of bytes read from scanner
*/
SANE_Int read;
/* total amount of bytes to read for the scan */
/**
* total amount of bytes to read for the scan
*/
SANE_Int to_read;
#ifdef HAVE_SYS_TIME_H
/**
* last scan time, used to detect if warming-up is needed
*/
struct timeval last_scan;
/**
* warming-up start time
*/
struct timeval start_time;
#endif
};
/*

Wyświetl plik

@ -43,10 +43,10 @@
/* this file contains functions common to rts88xx ASICs */
#include "sane/config.h"
#include "sane/sane.h"
#include "sane/sanei_backend.h"
#include "sane/sanei_usb.h"
#include "../include/sane/config.h"
#include "../include/sane/sane.h"
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_usb.h"
#include "rts88xx_lib.h"
#include <stdio.h>

Wyświetl plik

@ -43,10 +43,10 @@
#ifndef RTS88XX_LIB_H
#define RTS88XX_LIB_H
#include "sane/sane.h"
#include "sane/sanei_usb.h"
#include "unistd.h"
#include "string.h"
#include "../include/sane/sane.h"
#include "../include/sane/sanei_usb.h"
#include <unistd.h>
#include <string.h>
/* TODO put his in a place where it can be reused */