basic support for 600C

merge-requests/1/head
m. allan noah 2010-02-10 16:15:09 -05:00
rodzic 82913c4f7c
commit 95aeeee4fd
7 zmienionych plików z 164 dodań i 55 usunięć

Wyświetl plik

@ -1,6 +1,15 @@
2010-02-10 Stéphane Voltz <stef.dev ar free.fr>
* doc/descriptions/genesys.desc: added G2410
2010-02-10 m. allan noah <kitno455 at gmail dot com>
* backend/cardscan.[ch], backend/cardscan.conf.in,
doc/descriptions/cardscan.desc, doc/sane-cardscan.man:
- add lines_per_block config option
- add has_cal_buffer config option
- basic support for 600C
- clean #include lines
* doc/sane.man: add missing backends
2010-02-10 m. allan noah <kitno455 at gmail dot com>
* backend/gt68xx_devices.c: add GT68XX_FLAG_NO_STOP to SF600
* doc/.gitignore, doc/Makefile.am, doc/Makefile.in:

Wyświetl plik

@ -1,6 +1,9 @@
/* sane - Scanner Access Now Easy.
This file is part of the SANE package.
This file is part of the SANE package, and implements a SANE backend
for various Corex Cardscan scanners.
Copyright (C) 2007-2010 m. allan noah
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@ -53,10 +56,15 @@
Section 6 - misc functions
Changes:
V 1.0.0, 2007-05-09, MAN (SANE v1.0.19)
v0, 2007-05-09, MAN (SANE v1.0.19)
- initial release
V 1.0.1, 2008-02-14, MAN
- sanei_config_read has already cleaned string (#310597)
v1, 2008-02-14, MAN
- sanei_config_read has already cleaned string (#310597)
v2, 2010-02-10, MAN
- add lines_per_block config option
- add has_cal_buffer config option
- basic support for 600c
- clean #include lines
##################################################
DATA FROM TRACE OF WINDOWS DRIVER:
@ -205,22 +213,8 @@ four times {
#include "../include/sane/config.h"
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef HAVE_LIBC_H
# include <libc.h> /* NeXTStep/OpenStep */
#endif
#include <string.h> /*memcpy...*/
#include <ctype.h> /*isspace*/
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_usb.h"
@ -230,7 +224,7 @@ four times {
#include "cardscan.h"
#define DEBUG 1
#define BUILD 1
#define BUILD 2
/* values for SANE_DEBUG_CARDSCAN env var:
- errors 5
@ -242,6 +236,9 @@ four times {
- useless noise 35
*/
int global_has_cal_buffer = 1;
int global_lines_per_block = 16;
/* ------------------------------------------------------------------------- */
static const char string_Grayscale[] = "Gray";
static const char string_Color[] = "Color";
@ -329,7 +326,10 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
local_only = local_only; /* get rid of compiler warning */
DBG (10, "sane_get_devices: start\n");
global_has_cal_buffer = 1;
global_lines_per_block = 16;
fp = sanei_config_open (CONFIG_FILE);
if (fp) {
@ -352,6 +352,44 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
DBG (15, "sane_get_devices: looking for '%s'\n", lp);
sanei_usb_attach_matching_devices(lp, attach_one);
}
else if (!strncmp(lp, "has_cal_buffer", 14) && isspace (lp[14])) {
int buf;
lp += 14;
lp = sanei_config_skip_whitespace (lp);
buf = atoi (lp);
if(buf){
global_has_cal_buffer = 1;
}
else{
global_has_cal_buffer = 0;
}
DBG (15, "sane_get_devices: setting \"has_cal_buffer\" to %d\n",
global_has_cal_buffer);
}
else if (!strncmp(lp, "lines_per_block", 15) && isspace (lp[15])) {
int buf;
lp += 15;
lp = sanei_config_skip_whitespace (lp);
buf = atoi (lp);
if(buf < 1 || buf > 32){
DBG (15,
"sane_get_devices: \"lines_per_block\"=%d\n out of range",
buf
);
continue;
}
DBG (15, "sane_get_devices: \"lines_per_block\" is %d\n", buf);
global_lines_per_block = buf;
}
else{
DBG (5, "sane_get_devices: config line \"%s\" ignored.\n", lp);
}
@ -444,6 +482,9 @@ attach_one (const char *device_name)
if(pid == 0x0005){
s->product_name = "800c";
}
else if(pid == 0x0002){
s->product_name = "600c";
}
else{
DBG (5, "Unknown product, using default settings\n");
s->product_name = "Unknown";
@ -457,16 +498,27 @@ attach_one (const char *device_name)
DBG (15, "attach_one: Found %s scanner %s at %s\n",
s->vendor_name, s->product_name, s->device_name);
/*copy config file settings*/
s->has_cal_buffer = global_has_cal_buffer;
s->lines_per_block = global_lines_per_block;
s->color_block_size = s->lines_per_block * PIXELS_PER_LINE * 3;
s->gray_block_size = s->lines_per_block * PIXELS_PER_LINE;
/* try to get calibration */
DBG (15, "attach_one: scanner calibration\n");
ret = load_calibration(s);
if (ret != SANE_STATUS_GOOD) {
DBG (5, "sane_start: ERROR: cannot calibrate, incompatible?\n");
free (s->device_name);
free (s);
return ret;
if(s->has_cal_buffer){
DBG (15, "attach_one: scanner calibration\n");
ret = load_calibration(s);
if (ret != SANE_STATUS_GOOD) {
DBG (5, "sane_start: ERROR: cannot calibrate, incompatible?\n");
free (s->device_name);
free (s);
return ret;
}
}
else{
DBG (15, "attach_one: skipping calibration\n");
}
/* set SANE option 'values' to good defaults */
@ -1165,13 +1217,15 @@ read_from_scanner_gray(struct scanner *s)
SANE_Status ret=SANE_STATUS_GOOD;
/*cmd len-le16 move lines ??? ??? ??? ???*/
unsigned char cmd[] =
{0x12, 0x06, 0x00, 0x01, 0x10, 0x60, 0x00, 0x18, 0x05};
size_t bytes = HEADER_SIZE + GRAY_BLOCK_SIZE;
{0x12, 0x06, 0x00, 0x01, 0x01, 0x60, 0x00, 0x18, 0x05};
size_t bytes = HEADER_SIZE + s->gray_block_size;
unsigned char * buf;
int i,j;
DBG (10, "read_from_scanner_gray: start\n");
cmd[4] = s->lines_per_block;
buf = malloc(bytes);
if(!buf){
DBG(5, "read_from_scanner_gray: not enough mem for buffer: %lu\n",
@ -1191,15 +1245,15 @@ read_from_scanner_gray(struct scanner *s)
DBG(15, "read_from_scanner_gray: got GOOD\n");
if(!buf[1]){
s->paperless_lines += LINES_PER_PASS;
s->paperless_lines += s->lines_per_block;
}
s->bytes_rx = GRAY_BLOCK_SIZE;
s->bytes_rx = s->gray_block_size;
/*memcpy(s->buffer,buf+HEADER_SIZE,GRAY_BLOCK_SIZE);*/
/*memcpy(s->buffer,buf+HEADER_SIZE,s->gray_block_size);*/
/* reorder the gray data into the struct's buffer */
for(i=0;i<GRAY_BLOCK_SIZE;i+=PIXELS_PER_LINE){
for(i=0;i<s->gray_block_size;i+=PIXELS_PER_LINE){
for(j=0;j<PIXELS_PER_LINE;j++){
unsigned char byte = buf[ HEADER_SIZE + i + j ];
@ -1228,13 +1282,15 @@ read_from_scanner_color(struct scanner *s)
{
SANE_Status ret=SANE_STATUS_GOOD;
unsigned char cmd[] =
{0x18, 0x07, 0x00, 0x01, 0x10, 0x60, 0x00, 0x18, 0x05, 0x07};
size_t bytes = HEADER_SIZE + COLOR_BLOCK_SIZE;
{0x18, 0x07, 0x00, 0x01, 0x01, 0x60, 0x00, 0x18, 0x05, 0x07};
size_t bytes = HEADER_SIZE + s->color_block_size;
unsigned char * buf;
int i,j,k;
DBG (10, "read_from_scanner_color: start\n");
cmd[4] = s->lines_per_block;
buf = malloc(bytes);
if(!buf){
DBG(5, "read_from_scanner_color: not enough mem for buffer: %lu\n",
@ -1254,15 +1310,15 @@ read_from_scanner_color(struct scanner *s)
DBG(15, "read_from_scanner_color: got GOOD\n");
if(!buf[1]){
s->paperless_lines += LINES_PER_PASS;
s->paperless_lines += s->lines_per_block;
}
s->bytes_rx = COLOR_BLOCK_SIZE;
s->bytes_rx = s->color_block_size;
/*memcpy(s->buffer,buf+HEADER_SIZE,COLOR_BLOCK_SIZE);*/
/*memcpy(s->buffer,buf+HEADER_SIZE,s->color_block_size);*/
/* reorder the color data into the struct's buffer */
for(i=0;i<COLOR_BLOCK_SIZE;i+=PIXELS_PER_LINE*3){
for(i=0;i<s->color_block_size;i+=PIXELS_PER_LINE*3){
for(j=0;j<PIXELS_PER_LINE;j++){
for(k=0;k<3;k++){

Wyświetl plik

@ -10,3 +10,8 @@
# Corex Cardscan 800c
usb 0x08f0 0x0005
# Corex Cardscan 600c
has_cal_buffer 0
lines_per_block 1
usb 0x08f0 0x0002

Wyświetl plik

@ -31,9 +31,6 @@ enum scanner_Option
#define CAL_GRAY_SIZE PIXELS_PER_LINE
/* values for image data */
#define LINES_PER_PASS 16
#define COLOR_BLOCK_SIZE (LINES_PER_PASS * PIXELS_PER_LINE * 3)
#define GRAY_BLOCK_SIZE (LINES_PER_PASS * PIXELS_PER_LINE)
#define MAX_PAPERLESS_LINES 210
struct scanner
@ -49,6 +46,13 @@ struct scanner
char * vendor_name;
char * product_name;
/* --------------------------------------------------------------------- */
/* immutable values which are set during reading of config file. */
int has_cal_buffer;
int lines_per_block;
int color_block_size;
int gray_block_size;
/* --------------------------------------------------------------------- */
/* changeable SANE_Option structs provide our interface to frontend. */
@ -95,7 +99,7 @@ struct scanner
int paperless_lines;
/* buffer part of image */
unsigned char buffer[COLOR_BLOCK_SIZE];
unsigned char buffer[PIXELS_PER_LINE * 3 * 32];
/* how far we have read from scanner into buffer */
int bytes_rx;

Wyświetl plik

@ -11,9 +11,9 @@
:backend "cardscan" ; name of backend
:url "http://www.thebility.com/cardscan/"
:version "1.0.1" ; version of backend
:version "2" ; version of backend
:manpage "sane-cardscan" ; name of manpage (if it exists)
:comment "New for sane 1.0.19"
:comment "Backend updated for SANE release 1.0.21, see sane-cardscan manpage"
:devicetype :scanner ; start of a list of devices....
; other types: :stillcam, :vidcam,
; :meta, :api
@ -27,3 +27,9 @@
:status :good
:comment "4 inch wide 8bit Gray or 24bit Color simplex card/receipt scanner"
:model "600c"
:interface "USB"
:usbid "0x08f0" "0x0002"
:status :basic
:comment "4 inch wide 8bit Gray or 24bit Color simplex card/receipt scanner"

Wyświetl plik

@ -1,14 +1,14 @@
.TH sane\-cardscan 5 "11 Jul 2008" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.TH sane\-cardscan 5 "10 Feb 2010" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane\-cardscan
.SH NAME
sane\-cardscan \- SANE backend for Corex CardScan 800c usb scanner
sane\-cardscan \- SANE backend for Corex CardScan usb scanners
.SH DESCRIPTION
The
.B sane\-cardscan
library implements a SANE (Scanner Access Now Easy) backend which
provides access to the Corex CardScan 800c small-format scanner.
provides access to the Corex CardScan 800c & 600c small-format scanners.
The backend supports only grayscale and color modes and media of
(theoretically) infinite length.
@ -47,6 +47,22 @@ to determine if it is a cardscan scanner.
Some systems use a kernel driver to access usb scanners. This method is untested.
.RE
Additionally, there are two configuration options that control the protocol
used by the backend:
.PP
"lines_per_block 16" (or other number from 1 to 32)
.RS
Controls the number of lines of image data which will be aquired in each pass.
Older scanners will require this number set lower, often 1.
.RE
.PP
"has_cal_buffer 1" (1 or 0)
.RS
Causes the backend to get calibration data from scanner during initialization.
Older scanners do not support this request, and must be set to 0.
.RE
.SH ENVIRONMENT
The backend uses a single environment variable, SANE_DEBUG_CARDSCAN, which
enables debugging output to stderr. Valid values are:

Wyświetl plik

@ -213,6 +213,11 @@ The canon630u backend supports the CanoScan 630u and 636u USB scanners. See
.BR sane\-canon630u (5)
for details.
.TP
.B canon_dr
The canon_dr backend supports the Canon DR-Series ADF SCSI and USB scanners. See
.BR sane\-canon_dr (5)
for details.
.TP
.B canon_pp
The canon_pp backend supports the CanoScan FB330P, FB630P, N340P and N640P
parallel port scanners. See
@ -220,7 +225,7 @@ parallel port scanners. See
for details.
.TP
.B cardscan
This backend provides support for the Corex Cardscan 800c USB scanner. See
This backend provides support for Corex Cardscan USB scanners. See
.BR sane\-cardscan (5)
for details.
.TP
@ -255,7 +260,7 @@ and adf scanners. See
for details.
.TP
.B genesys
The genesys backend provides support for scanners based on the Genesys Logic
The genesys backend provides support for scanners based on the Genesys Logic
GL646 and GL841 chips like the Medion 6471 and Hewlett-Packard 2300c.
Support for GL841 based scanners is far from being complete. See
.BR sane\-genesys (5)
@ -315,6 +320,11 @@ The SANE backend for some IBM and Ricoh SCSI scanners. See
.BR sane\-ibm (5)
for details.
.TP
.B kodak
The SANE backend for some large Kodak scanners. See
.BR sane\-kodak (5)
for details.
.TP
.B leo
This backend supports the Leo S3 and the Across FS-1130, which is a re-badged
LEO FS-1130 scanner. See
@ -823,7 +833,9 @@ for details).
.BR sane\-bh (5),
.BR sane\-canon (5),
.BR sane\-canon630u (5),
.BR sane\-canon_dr (5),
.BR sane\-canon_pp (5),
.BR sane\-cardscan (5),
.BR sane\-coolscan2 (5),
.BR sane\-coolscan (5),
.BR sane\-dc210 (5),
@ -844,6 +856,7 @@ for details).
.BR sane\-hp5400 (5),
.BR sane\-hpljm1005 (5),
.BR sane\-ibm (5),
.BR sane\-kodak (5),
.BR sane\-leo (5),
.BR sane\-lexmark (5),
.BR sane\-ma1509 (5),