~jfbcable/ubuntu/wily/sane-backends/fix-pixma

« back to all changes in this revision

Viewing changes to backend/hp5590_cmds.h

  • Committer: Julian Cable
  • Author(s): Michael Thayer
  • Date: 2015-09-16 08:25:15 UTC
  • Revision ID: jfbcable@gmail.com-20150916082515-j5f0gb84wv90tok1
Tags: upstream-1.0.25+git20150528
ImportĀ upstreamĀ versionĀ 1.0.25+git20150528

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* sane - Scanner Access Now Easy.
 
2
   Copyright (C) 2007 Ilia Sotnikov <hostcc@gmail.com>
 
3
   HP ScanJet 4570c support by Markham Thomas
 
4
   This file is part of the SANE package.
 
5
 
 
6
   This program is free software; you can redistribute it and/or
 
7
   modify it under the terms of the GNU General Public License as
 
8
   published by the Free Software Foundation; either version 2 of the
 
9
   License, or (at your option) any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful, but
 
12
   WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
   General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program; if not, write to the Free Software
 
18
   Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
19
   MA 02111-1307, USA.
 
20
 
 
21
   As a special exception, the authors of SANE give permission for
 
22
   additional uses of the libraries contained in this release of SANE.
 
23
 
 
24
   The exception is that, if you link a SANE library with other files
 
25
   to produce an executable, this does not by itself cause the
 
26
   resulting executable to be covered by the GNU General Public
 
27
   License.  Your use of that executable is in no way restricted on
 
28
   account of linking the SANE library code into it.
 
29
 
 
30
   This exception does not, however, invalidate any other reasons why
 
31
   the executable file might be covered by the GNU General Public
 
32
   License.
 
33
 
 
34
   If you submit changes to SANE to the maintainers to be included in
 
35
   a subsequent release, you agree by submitting the changes that
 
36
   those changes may be distributed with this exception intact.
 
37
 
 
38
   If you write modifications of your own for SANE, it is your choice
 
39
   whether to permit this exception to apply to your modifications.
 
40
   If you do not wish that, delete this exception notice.
 
41
 
 
42
   This file is part of a SANE backend for
 
43
   HP ScanJet 4500C/4570C/5500C/5550C/5590/7650 Scanners
 
44
*/
 
45
 
 
46
#ifndef HP5590_H
 
47
#define HP5590_H
 
48
 
 
49
#include "hp5590_low.h"
 
50
 
 
51
#define TMA_MAX_X_INCHES        1.69
 
52
#define TMA_MAX_Y_INCHES        6
 
53
 
 
54
#define ADF_MAX_Y_INCHES        14
 
55
 
 
56
enum hp_scanner_types
 
57
{
 
58
  SCANNER_NONE = 0,
 
59
  SCANNER_HP4570,
 
60
  SCANNER_HP5550,
 
61
  SCANNER_HP5590,
 
62
  SCANNER_HP7650
 
63
};
 
64
 
 
65
enum scan_sources
 
66
{
 
67
  SOURCE_NONE = 1,
 
68
  SOURCE_FLATBED,
 
69
  SOURCE_ADF,
 
70
  SOURCE_ADF_DUPLEX,
 
71
  SOURCE_TMA_NEGATIVES,
 
72
  SOURCE_TMA_SLIDES
 
73
};
 
74
 
 
75
enum scan_modes
 
76
{
 
77
  MODE_NORMAL = 1,
 
78
  MODE_PREVIEW
 
79
};
 
80
 
 
81
enum color_depths
 
82
{
 
83
  DEPTH_BW = 1,
 
84
  DEPTH_GRAY,
 
85
  DEPTH_COLOR_24,
 
86
  DEPTH_COLOR_48
 
87
};
 
88
 
 
89
enum button_status
 
90
{
 
91
  BUTTON_NONE = 1,
 
92
  BUTTON_POWER,
 
93
  BUTTON_SCAN,
 
94
  BUTTON_COLLECT,
 
95
  BUTTON_FILE,
 
96
  BUTTON_EMAIL,
 
97
  BUTTON_COPY,
 
98
  BUTTON_UP,
 
99
  BUTTON_DOWN,
 
100
  BUTTON_MODE,
 
101
  BUTTON_CANCEL
 
102
};
 
103
 
 
104
enum hp5590_lamp_state
 
105
{
 
106
  LAMP_STATE_TURNOFF = 1,
 
107
  LAMP_STATE_TURNON,
 
108
  LAMP_STATE_SET_TURNOFF_TIME,
 
109
  LAMP_STATE_SET_TURNOFF_TIME_LONG
 
110
};
 
111
 
 
112
struct hp5590_model
 
113
{
 
114
  enum hp_scanner_types scanner_type;
 
115
  unsigned int          usb_vendor_id;
 
116
  unsigned int          usb_product_id;
 
117
  const char            *vendor_id;
 
118
  const char            *model;
 
119
  const char            *kind;
 
120
  enum proto_flags      proto_flags;
 
121
};
 
122
 
 
123
#define FEATURE_NONE         0
 
124
#define FEATURE_ADF     1 << 0
 
125
#define FEATURE_TMA     1 << 1
 
126
#define FEATURE_LCD     1 << 2
 
127
 
 
128
struct scanner_info
 
129
{
 
130
  const char    *model;
 
131
  const char    *kind;
 
132
  unsigned int  features;
 
133
  const char    *fw_version;
 
134
  unsigned int  max_dpi_x;
 
135
  unsigned int  max_dpi_y;
 
136
  unsigned int  max_pixels_x;
 
137
  unsigned int  max_pixels_y;
 
138
  float         max_size_x;
 
139
  float         max_size_y;
 
140
  unsigned int  max_motor_param;
 
141
  unsigned int  normal_motor_param;
 
142
};
 
143
 
 
144
static SANE_Status hp5590_model_def (enum hp_scanner_types scanner_type,
 
145
                                     const struct hp5590_model ** model);
 
146
static SANE_Status hp5590_vendor_product_id (enum hp_scanner_types scanner_type,
 
147
                                      SANE_Word * vendor_id,
 
148
                                      SANE_Word * product_id);
 
149
static SANE_Status hp5590_init_scanner (SANE_Int dn,
 
150
                                 enum proto_flags proto_flags,
 
151
                                 struct scanner_info **info,
 
152
                                 enum hp_scanner_types scanner_type);
 
153
static SANE_Status hp5590_power_status (SANE_Int dn,
 
154
                                        enum proto_flags proto_flags);
 
155
static SANE_Status hp5590_read_max_scan_count (SANE_Int dn,
 
156
                                        enum proto_flags proto_flags,
 
157
                                        unsigned int *max_count);
 
158
static SANE_Status hp5590_select_source_and_wakeup (SANE_Int dn,
 
159
                                             enum proto_flags proto_flags,
 
160
                                             enum scan_sources source,
 
161
                                             SANE_Bool extend_lamp_timeout);
 
162
static SANE_Status hp5590_stop_scan (SANE_Int dn,
 
163
                                enum proto_flags proto_flags);
 
164
static SANE_Status hp5590_read_scan_count (SANE_Int dn,
 
165
                                    enum proto_flags proto_flags,
 
166
                                    unsigned int *count);
 
167
static SANE_Status hp5590_set_scan_params (SANE_Int dn,
 
168
                                    enum proto_flags proto_flags,
 
169
                                    struct scanner_info *scanner_info,
 
170
                                    unsigned int top_x, unsigned int top_y,
 
171
                                    unsigned int width, unsigned int height,
 
172
                                    unsigned int dpi,
 
173
                                    enum color_depths color_depth,
 
174
                                    enum scan_modes scan_mode,
 
175
                                    enum scan_sources scan_source);
 
176
static SANE_Status hp5590_send_forward_calibration_maps (SANE_Int dn,
 
177
                                        enum proto_flags proto_flags);
 
178
static SANE_Status hp5590_send_reverse_calibration_map (SANE_Int dn,
 
179
                                        enum proto_flags proto_flags);
 
180
static SANE_Status hp5590_inc_scan_count (SANE_Int dn,
 
181
                                        enum proto_flags proto_flags);
 
182
static SANE_Status hp5590_start_scan (SANE_Int dn,
 
183
                                enum proto_flags proto_flags);
 
184
static SANE_Status hp5590_read (SANE_Int dn,
 
185
                         enum proto_flags proto_flags,
 
186
                         unsigned char *bytes,
 
187
                         unsigned int size, void *state);
 
188
static SANE_Status hp5590_read_buttons (SANE_Int dn,
 
189
                                 enum proto_flags proto_flags,
 
190
                                 enum button_status *status);
 
191
static SANE_Status hp5590_read_part_number (SANE_Int dn,
 
192
                                enum proto_flags proto_flags);
 
193
static SANE_Status hp5590_calc_pixel_bits (unsigned int dpi,
 
194
                                    enum color_depths color_depth,
 
195
                                    unsigned int *pixel_bits);
 
196
static SANE_Status hp5590_is_data_available (SANE_Int dn,
 
197
                                enum proto_flags proto_flags);
 
198
static SANE_Status hp5590_reset_scan_head (SANE_Int dn,
 
199
                                enum proto_flags proto_flags);
 
200
#endif /* HP5590_H */
 
201
/* vim: sw=2 ts=8
 
202
 */