SANEI  1.0.27-241-gdc8b27c1-dirty
sanei_scsi.h
Go to the documentation of this file.
1 /* sane - Scanner Access Now Easy.
2  Copyright (C) 1996, 1997 David Mosberger-Tang
3  This file is part of the SANE package.
4 
5  SANE is free software; you can redistribute it and/or modify it
6  under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  SANE is distributed in the hope that it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13  License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with sane; see the file COPYING. If not, write to the Free
17  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19  As a special exception, the authors of SANE give permission for
20  additional uses of the libraries contained in this release of SANE.
21 
22  The exception is that, if you link a SANE library with other files
23  to produce an executable, this does not by itself cause the
24  resulting executable to be covered by the GNU General Public
25  License. Your use of that executable is in no way restricted on
26  account of linking the SANE library code into it.
27 
28  This exception does not, however, invalidate any other reasons why
29  the executable file might be covered by the GNU General Public
30  License.
31 
32  If you submit changes to SANE to the maintainers to be included in
33  a subsequent release, you agree by submitting the changes that
34  those changes may be distributed with this exception intact.
35 
36  If you write modifications of your own for SANE, it is your choice
37  whether to permit this exception to apply to your modifications.
38  If you do not wish that, delete this exception notice.
39 */
40 
47 #ifndef sanei_scsi_h
48 #define sanei_scsi_h
49 
50 #include <sys/types.h>
51 
52 #include <sane/sane.h>
53 #include <sane/config.h>
54 
68 typedef SANE_Status (*SANEI_SCSI_Sense_Handler) (int fd,
69  u_char *sense_buffer,
70  void *arg);
74 
94 extern void sanei_scsi_find_devices (const char *vendor, const char *model,
95  const char *type,
96  int bus, int channel, int id, int lun,
97  SANE_Status (*attach) (const char *dev));
98 
99 
120 extern SANE_Status sanei_scsi_open (const char * device_name, int * fd,
121  SANEI_SCSI_Sense_Handler sense_handler,
122  void *sense_arg);
123 
151 extern SANE_Status sanei_scsi_open_extended (
152  const char * device_name, int * fd,
153  SANEI_SCSI_Sense_Handler sense_handler,
154  void *sense_arg, int *buffersize);
155 
165 #define HAVE_SANEI_SCSI_OPEN_EXTENDED
166 
193 extern SANE_Status sanei_scsi_req_enter (int fd,
194  const void * src, size_t src_size,
195  void * dst, size_t * dst_size,
196  void **idp);
197 
230 extern SANE_Status sanei_scsi_req_enter2 (int fd,
231  const void * cmd, size_t cmd_size,
232  const void * src, size_t src_size,
233  void * dst, size_t * dst_size,
234  void **idp);
235 
247 extern SANE_Status sanei_scsi_req_wait (void *id);
248 
271 extern SANE_Status sanei_scsi_cmd (int fd,
272  const void * src, size_t src_size,
273  void * dst, size_t * dst_size);
274 
298 extern SANE_Status sanei_scsi_cmd2 (int fd,
299  const void * cmd, size_t cmd_size,
300  const void * src, size_t src_size,
301  void * dst, size_t * dst_size);
302 
310 extern void sanei_scsi_req_flush_all (void);
311 
320 extern void sanei_scsi_req_flush_all_extended (int fd);
321 
327 extern void sanei_scsi_close (int fd);
328 
329 #endif /* sanei_scsi_h */
void sanei_scsi_find_devices(const char *vendor, const char *model, const char *type, int bus, int channel, int id, int lun, SANE_Status(*attach)(const char *dev))
Find SCSI devices.
void sanei_scsi_req_flush_all_extended(int fd)
Flush queue for handle.
SANE_Status sanei_scsi_cmd(int fd, const void *src, size_t src_size, void *dst, size_t *dst_size)
Send SCSI command.
SANE_Status sanei_scsi_req_enter(int fd, const void *src, size_t src_size, void *dst, size_t *dst_size, void **idp)
Enqueue SCSI command.
void sanei_scsi_req_flush_all(void)
Flush queue.
SANE_Status sanei_scsi_open_extended(const char *device_name, int *fd, SANEI_SCSI_Sense_Handler sense_handler, void *sense_arg, int *buffersize)
Open a SCSI device and set the buffer size.
void sanei_scsi_close(int fd)
Close a SCSI device.
int sanei_scsi_max_request_size
Maximum size of a SCSI request.
SANE_Status sanei_scsi_req_enter2(int fd, const void *cmd, size_t cmd_size, const void *src, size_t src_size, void *dst, size_t *dst_size, void **idp)
Enqueue SCSI command and separated data.
SANE_Status sanei_scsi_open(const char *device_name, int *fd, SANEI_SCSI_Sense_Handler sense_handler, void *sense_arg)
Open a SCSI device.
SANE_Status sanei_scsi_cmd2(int fd, const void *cmd, size_t cmd_size, const void *src, size_t src_size, void *dst, size_t *dst_size)
Send SCSI command and separated data.
SANE_Status(* SANEI_SCSI_Sense_Handler)(int fd, u_char *sense_buffer, void *arg)
Sense handler.
Definition: sanei_scsi.h:68
SANE_Status sanei_scsi_req_wait(void *id)
Wait for SCSI command.