summaryrefslogtreecommitdiff
path: root/backend/s9036.h
blob: 97292acd1f10dfa0366d172ad4c13524fbb255b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* sane - Scanner Access Now Easy.

   This file (C) 1997 Ingo Schneider

   This file is part of the SANE package.

   SANE is free software; you can redistribute it and/or modify it under
   the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   SANE is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with sane; see the file COPYING.
   If not, see <https://www.gnu.org/licenses/>.  */
#ifndef s9036_h
#define s9036_h

enum S9036_Option
  {
    OPT_NUM_OPTS = 0,

    OPT_MODE_GROUP,
    OPT_DEPTH,
    OPT_RESOLUTION,

    OPT_GEOMETRY_GROUP,
    OPT_TL_X,			/* top-left x */
    OPT_TL_Y,			/* top-left y */
    OPT_BR_X,			/* bottom-right x */
    OPT_BR_Y,			/* bottom-right y */

    OPT_ENHANCEMENT_GROUP,
    OPT_BRIGHTNESS,
    OPT_CONTRAST,
    OPT_BRIGHT_ADJUST,
    OPT_CONTR_ADJUST,

    /* must come last: */
    NUM_OPTIONS
  };

typedef struct S9036_Device
  {
    struct S9036_Device *next;
    SANE_Device sane;
    SANE_Handle handle;
  }
S9036_Device;

typedef struct S9036_Scanner
  {
    /* all the state needed to define a scan request: */

    SANE_Option_Descriptor opt[NUM_OPTIONS];
    SANE_Word val[NUM_OPTIONS];

    /* Parsed option values and variables that are valid only during
       actual scanning: */
    SANE_Bool scanning;
    SANE_Parameters params;

    size_t bufsize;		/* about SCSI_MAX_REQUEST_SIZE */
    SANE_Byte *buffer;		/* buffer of size 'bufsize' */
    SANE_Byte *bufstart;	/* Start of data for next read */
    size_t in_buffer;		/* bytes already in buffer */

    int lines_in_scanner;	/* Lines in scanner memory */
    int lines_read;		/* Total lines read for now */

    int fd;			/* SCSI filedescriptor */

    /* scanner dependent/low-level state: */
    S9036_Device *hw;

  }
S9036_Scanner;

#endif /* s9036_h */