~ubuntu-branches/ubuntu/saucy/sane-backends/saucy

« back to all changes in this revision

Viewing changes to backend/kvs20xx_cmd.h

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2011-02-14 14:28:56 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110214142856-6gxjetg88q9zctid
Tags: 1.0.22-0ubuntu1
* New upstream release
* debian/control:
  - Use standards version 3.9.1
* debian/patches/allow_dll.d_symlinks.patch:
* debian/patches/fix_epson2_cancel.patch:
* debian/patches/fix_epson2_commands.patch:
* debian/patches/fix_xerox_mfp_color_mode.patch:
* debian/patches/genesys_disable_raw_data_log.patch:
* debian/patches/no_translations.patch:
* debian/patches/saned_exit_avahi_process.patch:
* debian/patches/scsi_perfection_2450.patch:
* debian/patches/scsi_scanjet_4c.patch:
* debian/patches/xerox_mfp_new_ids.patch:
  - Applied upstream
* debian/watch:
  - Dropped, the URL is not consistent between releases

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __KVS20XX_CMD_H
 
2
#define __KVS20XX_CMD_H
 
3
 
 
4
/*
 
5
   Copyright (C) 2008, Panasonic Russia Ltd.
 
6
   Copyright (C) 2010, m. allan noah
 
7
*/
 
8
/*
 
9
   Panasonic KV-S20xx USB-SCSI scanners.
 
10
*/
 
11
 
 
12
#define COMMAND_BLOCK   1
 
13
#define DATA_BLOCK      2
 
14
#define RESPONSE_BLOCK  3
 
15
 
 
16
#define COMMAND_CODE    0x9000
 
17
#define DATA_CODE       0xb000
 
18
#define RESPONSE_CODE   0xa000
 
19
#define STATUS_SIZE 4
 
20
 
 
21
struct bulk_header
 
22
{
 
23
  u32 length;
 
24
  u16 type;
 
25
  u16 code;
 
26
  u32 transaction_id;
 
27
};
 
28
 
 
29
#define TEST_UNIT_READY        0x00
 
30
#define INQUIRY                0x12
 
31
#define SET_WINDOW             0x24
 
32
#define SCAN                   0x1B
 
33
#define SEND_10                0x2A
 
34
#define READ_10                0x28
 
35
#define REQUEST_SENSE          0x03
 
36
#define GET_BUFFER_STATUS      0x34
 
37
#define SET_TIMEOUT         0xE1
 
38
#define GET_ADJUST_DATA     0xE0
 
39
#define GOOD 0
 
40
#define CHECK_CONDITION 2
 
41
 
 
42
typedef enum
 
43
{
 
44
  CMD_NONE = 0,
 
45
  CMD_IN = 0x81,                /* scanner to pc */
 
46
  CMD_OUT = 0x02                /* pc to scanner */
 
47
} CMD_DIRECTION;                /* equals to endpoint address */
 
48
 
 
49
#define RESPONSE_SIZE   0x12
 
50
#define MAX_CMD_SIZE    12
 
51
struct cmd
 
52
{
 
53
  unsigned char cmd[MAX_CMD_SIZE];
 
54
  int cmd_size;
 
55
  void *data;
 
56
  int data_size;
 
57
  int dir;
 
58
};
 
59
struct response
 
60
{
 
61
  int status;
 
62
  unsigned char data[RESPONSE_SIZE];
 
63
};
 
64
 
 
65
#define END_OF_MEDIUM                   (1<<6)
 
66
#define INCORRECT_LENGTH_INDICATOR      (1<<5)
 
67
static const struct
 
68
{
 
69
  unsigned sense, asc, ascq;
 
70
  SANE_Status st;
 
71
} s_errors[] =
 
72
{
 
73
  {
 
74
  0, 0, 0, SANE_STATUS_GOOD},
 
75
  {
 
76
  2, 0, 0, SANE_STATUS_DEVICE_BUSY},
 
77
  {
 
78
  2, 4, 1, SANE_STATUS_DEVICE_BUSY},
 
79
  {
 
80
  2, 4, 0x80, SANE_STATUS_COVER_OPEN},
 
81
  {
 
82
  2, 4, 0x81, SANE_STATUS_COVER_OPEN},
 
83
  {
 
84
  2, 4, 0x82, SANE_STATUS_COVER_OPEN},
 
85
  {
 
86
  2, 4, 0x83, SANE_STATUS_COVER_OPEN},
 
87
  {
 
88
  2, 4, 0x84, SANE_STATUS_COVER_OPEN},
 
89
  {
 
90
  2, 0x80, 1, SANE_STATUS_CANCELLED},
 
91
  {
 
92
  2, 0x80, 2, SANE_STATUS_CANCELLED},
 
93
  {
 
94
  3, 0x3a, 0, SANE_STATUS_NO_DOCS},
 
95
  {
 
96
  3, 0x80, 1, SANE_STATUS_JAMMED},
 
97
  {
 
98
  3, 0x80, 2, SANE_STATUS_JAMMED},
 
99
  {
 
100
  3, 0x80, 3, SANE_STATUS_JAMMED},
 
101
  {
 
102
  3, 0x80, 4, SANE_STATUS_JAMMED},
 
103
  {
 
104
  3, 0x80, 5, SANE_STATUS_JAMMED},
 
105
  {
 
106
  3, 0x80, 6, SANE_STATUS_JAMMED},
 
107
  {
 
108
  3, 0x80, 7, SANE_STATUS_JAMMED},
 
109
  {
 
110
  3, 0x80, 8, SANE_STATUS_JAMMED},
 
111
  {
 
112
3, 0x80, 9, SANE_STATUS_JAMMED},};
 
113
 
 
114
SANE_Status usb_send_command (struct scanner *s, struct cmd *c,
 
115
  struct response *r, void *buf);
 
116
SANE_Status send_command (struct scanner * s, struct cmd * c);
 
117
SANE_Status test_unit_ready (struct scanner *s);
 
118
SANE_Status set_timeout (struct scanner *s, int timeout);
 
119
SANE_Status set_window (struct scanner *s, int wnd_id);
 
120
SANE_Status reset_window (struct scanner *s);
 
121
SANE_Status read_picture_element (struct scanner *s, unsigned side,
 
122
                                  SANE_Parameters * p);
 
123
SANE_Status read_image_data (struct scanner *s, unsigned page, unsigned side,
 
124
                             void *buf, unsigned max_size, unsigned *size);
 
125
SANE_Status document_exist (struct scanner *s);
 
126
SANE_Status get_buffer_status (struct scanner *s, unsigned *data_avalible);
 
127
SANE_Status scan (struct scanner *s);
 
128
SANE_Status get_adjust_data (struct scanner *s, unsigned *dummy_length);
 
129
SANE_Status sense_handler (int fd, u_char * sense_buffer, void *arg);
 
130
 
 
131
#endif /*__KVS20XX_CMD_H*/