Remove unused definitions from mustek_usb2.h.

merge-requests/1/head
Jan Hauffa 2011-03-06 14:48:40 +01:00 zatwierdzone przez m. allan noah
rodzic 21be236e84
commit 694a69dcab
2 zmienionych plików z 12 dodań i 51 usunięć

Wyświetl plik

@ -122,30 +122,21 @@ static SANE_String_Const source_list[] = {
0 0
}; };
static Scanner_Model mustek_A2nu2_model = { static Scanner_Model mustek_A2nu2_model = {
"mustek-A2nu2", /* Name */ "Mustek", /* Device vendor string */
"Mustek", /* Device vendor string */
"BearPaw 2448TA Pro", /* Device model name */ "BearPaw 2448TA Pro", /* Device model name */
"", /* Name of the firmware file */
{1200, 600, 300, 150, 75, 0}, /* possible resolutions */ {1200, 600, 300, 150, 75, 0}, /* possible resolutions */
SANE_FIX (0.0), /* Start of scan area in mm (x) */
SANE_FIX (0.0), /* Start of scan area in mm (y) */
SANE_FIX (8.3 * MM_PER_INCH), /* Size of scan area in mm (x) */ SANE_FIX (8.3 * MM_PER_INCH), /* Size of scan area in mm (x) */
SANE_FIX (11.6 * MM_PER_INCH), /* Size of scan area in mm (y) */ SANE_FIX (11.6 * MM_PER_INCH), /* Size of scan area in mm (y) */
SANE_FIX (0.0), /* Start of scan area in TA mode in mm (x) */
SANE_FIX (0.0), /* Start of scan area in TA mode in mm (y) */
SANE_FIX (1.46 * MM_PER_INCH), /* Size of scan area in TA mode in mm (x) */ SANE_FIX (1.46 * MM_PER_INCH), /* Size of scan area in TA mode in mm (x) */
SANE_FIX (6.45 * MM_PER_INCH), /* Size of scan area in TA mode in mm (y) */ SANE_FIX (6.45 * MM_PER_INCH), /* Size of scan area in TA mode in mm (y) */
RO_RGB, /* Order of the CCD/CIS colors */ RO_RGB, /* Order of the CCD/CIS colors */
SANE_FIX (2.0), /* Default gamma value */ SANE_FIX (2.0), /* Default gamma value */
SANE_FALSE, /* Is this a CIS scanner? */ SANE_FALSE /* Is this a CIS scanner? */
0 /* Which flags are needed for this scanner? */
/* Setup and tested */
}; };
@ -260,12 +251,6 @@ calc_parameters (Mustek_Scanner * s)
s->setpara.fmArea.y2 = s->setpara.fmArea.y2 =
(unsigned short) ((SANE_UNFIX (s->val[OPT_BR_Y].w) * 300.0) / MM_PER_INCH + 0.5); (unsigned short) ((SANE_UNFIX (s->val[OPT_BR_Y].w) * 300.0) / MM_PER_INCH + 0.5);
if (s->val[OPT_PREVIEW].w)
{
s->setpara.fmArea.y1 = s->setpara.fmArea.y1 + PER_ADD_START_LINES;
s->setpara.fmArea.x1 += PRE_ADD_START_X;
} /*just for range bug. */
s->setpara.pfPixelFlavor = PF_BlackIs0; s->setpara.pfPixelFlavor = PF_BlackIs0;
s->setpara.wLinearThreshold = s->val[OPT_THRESHOLD].w; s->setpara.wLinearThreshold = s->val[OPT_THRESHOLD].w;
@ -1926,7 +1911,6 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle)
return SANE_STATUS_NO_MEM; return SANE_STATUS_NO_MEM;
memset (s, 0, sizeof (*s)); memset (s, 0, sizeof (*s));
s->gamma_table = NULL;
memcpy (&s->model, &mustek_A2nu2_model, sizeof (Scanner_Model)); memcpy (&s->model, &mustek_A2nu2_model, sizeof (Scanner_Model));
s->next = NULL; s->next = NULL;
s->bIsScanning = SANE_FALSE; s->bIsScanning = SANE_FALSE;
@ -2075,7 +2059,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
case OPT_BR_X: case OPT_BR_X:
case OPT_BR_Y: case OPT_BR_Y:
s->val[option].w = *(SANE_Word *) val; s->val[option].w = *(SANE_Word *) val;
RIE (calc_parameters (s)); status = calc_parameters (s);
if (status != SANE_STATUS_GOOD)
return status;
myinfo |= SANE_INFO_RELOAD_PARAMS; myinfo |= SANE_INFO_RELOAD_PARAMS;
break; break;
case OPT_THRESHOLD: case OPT_THRESHOLD:
@ -2096,7 +2082,9 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
{ {
DISABLE (OPT_THRESHOLD); DISABLE (OPT_THRESHOLD);
} }
RIE (calc_parameters (s)); status = calc_parameters (s);
if (status != SANE_STATUS_GOOD)
return status;
myinfo |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS; myinfo |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS;
break; break;
case OPT_SOURCE: case OPT_SOURCE:
@ -2351,7 +2339,7 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len,
(long int) sizeof (SANE_Byte) * lines_to_read * s->getpara.dwLineByteWidth + (long int) sizeof (SANE_Byte) * lines_to_read * s->getpara.dwLineByteWidth +
3 * 1024 + 1); 3 * 1024 + 1);
image_row.roRgbOrder = mustek_A2nu2_model.line_mode_color_order; image_row.roRgbOrder = s->model.line_mode_color_order;
image_row.wWantedLineNum = lines_to_read; image_row.wWantedLineNum = lines_to_read;
image_row.pBuffer = (SANE_Byte *) tempbuf; image_row.pBuffer = (SANE_Byte *) tempbuf;
s->bIsReading = SANE_TRUE; s->bIsReading = SANE_TRUE;
@ -2439,14 +2427,7 @@ sane_cancel (SANE_Handle handle)
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
{ {
if (s->bIsReading == SANE_FALSE) if (s->bIsReading == SANE_FALSE)
{ break;
if (s->gamma_table != NULL)
{
free (s->gamma_table);
s->gamma_table = NULL;
break;
}
}
else else
sleep (1); sleep (1);
} }

Wyświetl plik

@ -55,16 +55,10 @@
#define ENABLE(OPTION) s->opt[OPTION].cap &= ~SANE_CAP_INACTIVE #define ENABLE(OPTION) s->opt[OPTION].cap &= ~SANE_CAP_INACTIVE
#define DISABLE(OPTION) s->opt[OPTION].cap |= SANE_CAP_INACTIVE #define DISABLE(OPTION) s->opt[OPTION].cap |= SANE_CAP_INACTIVE
#define IS_ACTIVE(OPTION) (((s->opt[OPTION].cap) & SANE_CAP_INACTIVE) == 0)
/* RIE: return if error */
#define RIE(function) do {status = function; if (status != SANE_STATUS_GOOD) \
return status;} while (SANE_FALSE)
#define SCAN_BUFFER_SIZE (64 * 1024) #define SCAN_BUFFER_SIZE (64 * 1024)
#define MAX_RESOLUTIONS 12 #define MAX_RESOLUTIONS 12
#define DEF_LINEARTTHRESHOLD 128 #define DEF_LINEARTTHRESHOLD 128
#define PER_ADD_START_LINES 0
#define PRE_ADD_START_X 0
enum Mustek_Usb_Option enum Mustek_Usb_Option
@ -98,29 +92,18 @@ typedef struct Scanner_Model
/** @name Identification */ /** @name Identification */
/*@{ */ /*@{ */
/** A single lowercase word to be used in the configuration file. */
SANE_String_Const name;
/** Device vendor string. */ /** Device vendor string. */
SANE_String_Const vendor; SANE_String_Const vendor_name;
/** Device model name. */ /** Device model name. */
SANE_String_Const model; SANE_String_Const model_name;
/** Name of the firmware file. */
SANE_String_Const firmware_name;
/** @name Scanner model parameters */ /** @name Scanner model parameters */
/*@{ */ /*@{ */
SANE_Int dpi_values[MAX_RESOLUTIONS]; /* possible resolutions */ SANE_Int dpi_values[MAX_RESOLUTIONS]; /* possible resolutions */
SANE_Fixed x_offset; /* Start of scan area in mm */
SANE_Fixed y_offset; /* Start of scan area in mm */
SANE_Fixed x_size; /* Size of scan area in mm */ SANE_Fixed x_size; /* Size of scan area in mm */
SANE_Fixed y_size; /* Size of scan area in mm */ SANE_Fixed y_size; /* Size of scan area in mm */
SANE_Fixed x_offset_ta; /* Start of scan area in TA mode in mm */
SANE_Fixed y_offset_ta; /* Start of scan area in TA mode in mm */
SANE_Fixed x_size_ta; /* Size of scan area in TA mode in mm */ SANE_Fixed x_size_ta; /* Size of scan area in TA mode in mm */
SANE_Fixed y_size_ta; /* Size of scan area in TA mode in mm */ SANE_Fixed y_size_ta; /* Size of scan area in TA mode in mm */
@ -129,8 +112,6 @@ typedef struct Scanner_Model
SANE_Fixed default_gamma_value; /* Default gamma value */ SANE_Fixed default_gamma_value; /* Default gamma value */
SANE_Bool is_cis; /* Is this a CIS or CCD scanner? */ SANE_Bool is_cis; /* Is this a CIS or CCD scanner? */
SANE_Word flags; /* Which hacks are needed for this scanner? */
/*@} */ /*@} */
} Scanner_Model; } Scanner_Model;
@ -141,7 +122,6 @@ typedef struct Mustek_Scanner
SANE_Option_Descriptor opt[NUM_OPTIONS]; SANE_Option_Descriptor opt[NUM_OPTIONS];
Option_Value val[NUM_OPTIONS]; Option_Value val[NUM_OPTIONS];
unsigned short *gamma_table;
SANE_Parameters params; /**< SANE Parameters */ SANE_Parameters params; /**< SANE Parameters */
Scanner_Model model; Scanner_Model model;
SETPARAMETERS setpara; SETPARAMETERS setpara;