Added manufacturer comment in mustek_usb.desc. Changed brightness to

threshold. Fixed some warnings. Really check the status in usb_low_open.
Henning Meier-Geinitz <henning@meier-geinitz.de>
DEVEL_2_0_BRANCH-1
Henning Geinitz 2002-07-17 17:33:25 +00:00
rodzic c04b3fec3d
commit c95e463805
5 zmienionych plików z 36 dodań i 27 usunięć

Wyświetl plik

@ -46,7 +46,7 @@
This file implements a SANE backend for Mustek 1200UB and similar
USB flatbed scanners. */
#define BUILD 14
#define BUILD 15
#include "../include/sane/config.h"
@ -357,16 +357,16 @@ init_options (Mustek_Usb_Scanner * s)
s->opt[OPT_ENHANCEMENT_GROUP].cap = 0;
s->opt[OPT_ENHANCEMENT_GROUP].constraint_type = SANE_CONSTRAINT_NONE;
/* brightness */
s->opt[OPT_BRIGHTNESS].name = SANE_NAME_BRIGHTNESS;
s->opt[OPT_BRIGHTNESS].title = SANE_TITLE_BRIGHTNESS;
s->opt[OPT_BRIGHTNESS].desc = SANE_DESC_BRIGHTNESS;
s->opt[OPT_BRIGHTNESS].type = SANE_TYPE_INT;
s->opt[OPT_BRIGHTNESS].unit = SANE_UNIT_NONE;
s->opt[OPT_BRIGHTNESS].constraint_type = SANE_CONSTRAINT_RANGE;
s->opt[OPT_BRIGHTNESS].constraint.range = &char_range;
s->opt[OPT_BRIGHTNESS].cap |= SANE_CAP_INACTIVE;
s->val[OPT_BRIGHTNESS].w = 0;
/* threshold */
s->opt[OPT_THRESHOLD].name = SANE_NAME_THRESHOLD;
s->opt[OPT_THRESHOLD].title = SANE_TITLE_THRESHOLD;
s->opt[OPT_THRESHOLD].desc = SANE_DESC_THRESHOLD;
s->opt[OPT_THRESHOLD].type = SANE_TYPE_INT;
s->opt[OPT_THRESHOLD].unit = SANE_UNIT_NONE;
s->opt[OPT_THRESHOLD].constraint_type = SANE_CONSTRAINT_RANGE;
s->opt[OPT_THRESHOLD].constraint.range = &u8_range;
s->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE;
s->val[OPT_THRESHOLD].w = 128;
/* custom-gamma table */
s->opt[OPT_CUSTOM_GAMMA].name = SANE_NAME_CUSTOM_GAMMA;
@ -593,7 +593,7 @@ static SANE_Status
fit_lines (Mustek_Usb_Scanner * s, SANE_Byte * src, SANE_Byte * dst,
SANE_Word src_lines, SANE_Word * dst_lines)
{
SANE_Int bright;
SANE_Int threshold;
SANE_Word src_width, dst_width;
SANE_Word dst_pixel, src_pixel;
SANE_Word dst_line, src_line;
@ -602,8 +602,7 @@ fit_lines (Mustek_Usb_Scanner * s, SANE_Byte * src, SANE_Byte * dst,
src_width = s->hw->width;
dst_width = s->width_dots;
bright = s->val[OPT_BRIGHTNESS].w;
bright = 128 - bright;
threshold = s->val[OPT_THRESHOLD].w;
DBG (5, "fit_lines: dst_width=%d, src_width=%d, src_lines=%d, "
"offset=%d\n", dst_width, src_width, src_lines, s->hw->line_offset);
@ -650,7 +649,7 @@ fit_lines (Mustek_Usb_Scanner * s, SANE_Byte * src, SANE_Byte * dst,
if ((dst_pixel % 8) == 0)
dst[dst_address] = 0;
dst[dst_address] |=
(((src[src_address] > bright) ? 0 : 1)
(((src[src_address] > threshold) ? 0 : 1)
<< (7 - (dst_pixel % 8)));
}
}
@ -1201,7 +1200,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
case OPT_TL_Y:
case OPT_BR_X:
case OPT_BR_Y:
case OPT_BRIGHTNESS:
case OPT_THRESHOLD:
case OPT_CUSTOM_GAMMA:
*(SANE_Word *) val = s->val[option].w;
break;
@ -1250,7 +1249,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
RIE (calc_parameters (s));
myinfo |= SANE_INFO_RELOAD_PARAMS;
break;
case OPT_BRIGHTNESS:
case OPT_THRESHOLD:
s->val[option].w = *(SANE_Word *) val;
break;
/* Boolean */
@ -1303,7 +1302,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
RIE (calc_parameters (s));
s->opt[OPT_BRIGHTNESS].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_CUSTOM_GAMMA].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR].cap |= SANE_CAP_INACTIVE;
s->opt[OPT_GAMMA_VECTOR_R].cap |= SANE_CAP_INACTIVE;
@ -1312,7 +1311,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
if (strcmp (val, "Lineart") == 0)
{
s->opt[OPT_BRIGHTNESS].cap &= ~SANE_CAP_INACTIVE;
s->opt[OPT_THRESHOLD].cap &= ~SANE_CAP_INACTIVE;
}
else
{
@ -1511,7 +1510,8 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len,
*len = MIN (max_len, (SANE_Int) s->hw->scan_buffer_len);
memcpy (buf, s->hw->scan_buffer_start, *len);
DBG (4, "sane_read: exit, read %d bytes from scan_buffer; "
"%d bytes remaining\n", *len, s->hw->scan_buffer_len - *len);
"%ld bytes remaining\n", *len,
(long int) (s->hw->scan_buffer_len - *len));
s->hw->scan_buffer_len -= (*len);
s->hw->scan_buffer_start += (*len);
s->total_bytes += (*len);
@ -1577,7 +1577,7 @@ sane_get_select_fd (SANE_Handle handle, SANE_Int * fd)
{
Mustek_Usb_Scanner *s = handle;
DBG (5, "sane_get_select_fd: handle = %p, fd = %p\n", handle, fd);
DBG (5, "sane_get_select_fd: handle = %p, fd = %p\n", handle, (void *) fd);
if (!s->scanning)
{
DBG (1, "sane_get_select_fd: not scanning\n");

Wyświetl plik

@ -153,7 +153,7 @@ enum Mustek_Usb_Option
OPT_BR_Y, /* bottom-right y */
OPT_ENHANCEMENT_GROUP, /* 10 */
OPT_BRIGHTNESS,
OPT_THRESHOLD,
OPT_CUSTOM_GAMMA,
OPT_GAMMA_VECTOR,
OPT_GAMMA_VECTOR_R,

Wyświetl plik

@ -67,8 +67,8 @@ usb_low_init (ma1017 ** chip_address)
if (!chip)
{
DBG (3, "usb_low_init: couldn't malloc %d bytes for chip\n",
sizeof (ma1017));
DBG (3, "usb_low_init: couldn't malloc %ld bytes for chip\n",
(long int) sizeof (ma1017));
*chip_address = 0;
return SANE_STATUS_NO_MEM;
}
@ -2829,7 +2829,7 @@ usb_low_open (ma1017 * chip, SANE_String_Const devname)
chip->is_opened = SANE_TRUE;
/* Try to get vendor and device ids */
DBG (7, "usb_low_open: trying to identify device `%s'\n", devname);
RIE (usb_low_identify_scanner (chip->fd, &scanner_type));
status = usb_low_identify_scanner (chip->fd, &scanner_type);
if (status != SANE_STATUS_GOOD)
{
DBG (3, "usb_low_open: device `%s' doesn't look like a supported "

Wyświetl plik

@ -1,9 +1,9 @@
:backend "mustek_usb"
:status :stable
:version "1.0-114"
:version "1.0-15"
:manpage "sane-mustek_usb"
:url "http://www.meier-geinitz.de/sane/"
:comment "Only the USB scanners mentioned below are supported. For BearPaws, look at the Plustek backend."
:devicetype :scanner
:mfg "Mustek"

Wyświetl plik

@ -1,5 +1,14 @@
CHANGES for the SANE Mustek USB backend
2002-07-17:
* Release of version 1.0-15.
2002-07-17:
* Added manufacturer comment in mustek_usb.desc.
* Changed brightness to threshold.
* Fixed some warnings.
* Really check the status in usb_low_open.
2002-04-24:
* Release of version 1.0-14.