Added Canon's BJNP network protocol support, fix an ADF issue, updated doc and headers

merge-requests/1/head
Nicolas Martin 2008-10-14 19:48:59 +00:00
rodzic 56ae50027a
commit 391a6b4549
15 zmienionych plików z 2429 dodań i 174 usunięć

Wyświetl plik

@ -1,3 +1,16 @@
2008-10-14 Nicolas Martin <nicols-guest at users.alioth.debian.org>
* backend/pixma*.c, backend/pixma*.h (all pixma backend files),
doc/sane-pixma.man, doc/description/pixma.desc,
backend/Makefile.in
Added 3 new files backend/pixma_bjnp.c, backend/pixma_bjnp.h,
backend/pixma_bjnp_private.h:
- Thanks to Louis Lagendijk, added an implementation of Canon's BJNP
network protocol to the pixma backend, for scanning with PIXMA devices
over a LAN network.
- Fix for ADF scan reset session when ADF is loaded with more pages
to scan than the frontend requests.
- Updated pixma backend documentation and file headers.
2008-10-09 m. allan noah <kitno455 a t gmail d o t com>
* doc/descriptions/fujitsu.desc, doc/sane-fujitsu.man: backend v80

Wyświetl plik

@ -166,6 +166,7 @@ DISTFILES = Makefile.in saned.conf.in sane_strstatus.c stubs.c \
pixma.c pixma.h pixma_common.c pixma_common.h pixma_mp150.c pixma_mp730.c \
pixma_mp750.c pixma_sane_options.c pixma_sane_options.h pixma_io.h \
pixma_io_sanei.c pixma_rename.h pixma_imageclass.c \
pixma_bjnp.c pixma_bjnp.h pixma_bjnp_private.h \
plustek.c plustek.conf.in plustek-usbdevs.c plustek.h plustek-usb.c \
plustek-usb.h plustek-usbhw.c plustek-usbimg.c plustek-usbio.c \
plustek-usbmap.c plustek-usbscan.c plustek-usbshading.c plustek-usbcalfile.c \
@ -348,7 +349,7 @@ EXTRA_umax_pp = umax_pp_low umax_pp_mid
EXTRA_epson = epson_scsi epson_usb
EXTRA_epson2 = epson2_scsi epson_usb epson2_net epson2-io epson2-commands
EXTRA_lexmark = lexmark_low
EXTRA_pixma = pixma_io_sanei pixma_common pixma_mp150 pixma_mp730 pixma_mp750 pixma_imageclass
EXTRA_pixma = pixma_io_sanei pixma_common pixma_mp150 pixma_mp730 pixma_mp750 pixma_imageclass pixma_bjnp
EXTRA_rts8891 = rts88xx_lib
# When preloading dll, we need to add in all preloaded objects:

Wyświetl plik

@ -1,5 +1,6 @@
/* SANE - Scanner Access Now Easy.
Copyright (C) 2007-2008 Nicolas Martin, <nicols-guest at alioth dot debian dot org>
Copyright (C) 2006-2007 Wittawat Yamwong <wittawat@web.de>
This file is part of the SANE package.
@ -482,17 +483,17 @@ control_option (pixma_sane_t * ss, SANE_Int n,
}
return SANE_STATUS_GOOD;
case opt_button_update:
if (a == SANE_ACTION_SET_VALUE)
{
update_button_state (ss, info);
return SANE_STATUS_GOOD;
}
else
{
return SANE_STATUS_INVAL;
}
break;
case opt_button_update:
if (a == SANE_ACTION_SET_VALUE)
{
update_button_state (ss, info);
return SANE_STATUS_GOOD;
}
else
{
return SANE_STATUS_INVAL;
}
break;
}
switch (SOD (n).type)
@ -647,14 +648,12 @@ init_option_descriptors (pixma_sane_t * ss)
ss->source_map[i] = PIXMA_SOURCE_ADFDUP;
i++;
}
#if 1
if (cfg->cap & PIXMA_CAP_TPU)
{
ss->source_list[i] = SANE_I18N ("Transparency Unit");
ss->source_map[i] = PIXMA_SOURCE_TPU;
i++;
}
#endif
build_option_descriptors (ss);
@ -1003,8 +1002,7 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
status = pixma_init ();
if (status < 0)
{
PDBG (pixma_dbg
(2, "pixma_init() failed %s\n", pixma_strerror (status)));
PDBG (pixma_dbg (2, "pixma_init() failed %s\n", pixma_strerror (status)));
}
return map_error (status);
}
@ -1162,18 +1160,18 @@ sane_control_option (SANE_Handle h, SANE_Int n,
{
case SANE_ACTION_SET_VALUE:
if ((opt->sod.type != SANE_TYPE_BUTTON && !v) ||
!SANE_OPTION_IS_SETTABLE (opt->sod.cap))
return SANE_STATUS_INVAL; /* or _UNSUPPORTED? */
break;
!SANE_OPTION_IS_SETTABLE (opt->sod.cap))
return SANE_STATUS_INVAL; /* or _UNSUPPORTED? */
break;
case SANE_ACTION_SET_AUTO:
if (!(opt->sod.cap & SANE_CAP_AUTOMATIC) ||
!SANE_OPTION_IS_SETTABLE (opt->sod.cap))
return SANE_STATUS_INVAL; /* or _UNSUPPORTED? */
break;
!SANE_OPTION_IS_SETTABLE (opt->sod.cap))
return SANE_STATUS_INVAL; /* or _UNSUPPORTED? */
break;
case SANE_ACTION_GET_VALUE:
if (!v || !(opt->sod.cap & SANE_CAP_SOFT_DETECT))
return SANE_STATUS_INVAL; /* or _UNSUPPORTED? */
break;
return SANE_STATUS_INVAL; /* or _UNSUPPORTED? */
break;
default:
return SANE_STATUS_UNSUPPORTED;
}

Wyświetl plik

@ -1,5 +1,6 @@
/* SANE - Scanner Access Now Easy.
Copyright (C) 2007-2008 Nicolas Martin, <nicols-guest at alioth dot debian dot org>
Copyright (C) 2006-2007 Wittawat Yamwong <wittawat@web.de>
This file is part of the SANE package.
@ -277,15 +278,16 @@ struct pixma_config_t
/* If you change this structure, don't forget to update the device list in
* subdrivers. */
const char *name; /**< Model name. */
uint16_t vid; /**< USB Vendor ID */
uint16_t pid; /**< USB Product ID */
unsigned iface; /**< USB Interface number */
const char *model; /**< Short model */
uint16_t vid; /**< USB Vendor ID */
uint16_t pid; /**< USB Product ID */
unsigned iface; /**< USB Interface number */
const pixma_scan_ops_t *ops; /**< Subdriver ops */
unsigned xdpi; /**< Maximum horizontal resolution[DPI] */
unsigned ydpi; /**< Maximum vertical resolution[DPI] */
unsigned width; /**< Maximum width of scannable area in pixels at 75DPI */
unsigned xdpi; /**< Maximum horizontal resolution[DPI] */
unsigned ydpi; /**< Maximum vertical resolution[DPI] */
unsigned width; /**< Maximum width of scannable area in pixels at 75DPI */
unsigned height; /**< Maximum height of scannable area in pixels at 75DPI */
unsigned cap; /**< Capability bitfield \see PIXMA_CAP_* */
unsigned cap; /**< Capability bitfield \see PIXMA_CAP_* */
};

1628
backend/pixma_bjnp.c 100644

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,178 @@
/* SANE - Scanner Access Now Easy.
Copyright (C) 2008 by Louis Lagendijk
based on sane_usb.h:
Copyright (C) 2003, 2005 Rene Rebe (sanei_read_int,sanei_set_timeout)
Copyright (C) 2001, 2002 Henning Meier-Geinitz
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, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
The exception is that, if you link a SANE library with other files
to produce an executable, this does not by itself cause the
resulting executable to be covered by the GNU General Public
License. Your use of that executable is in no way restricted on
account of linking the SANE library code into it.
This exception does not, however, invalidate any other reasons why
the executable file might be covered by the GNU General Public
License.
If you submit changes to SANE to the maintainers to be included in
a subsequent release, you agree by submitting the changes that
those changes may be distributed with this exception intact.
If you write modifications of your own for SANE, it is your choice
whether to permit this exception to apply to your modifications.
If you do not wish that, delete this exception notice.
*/
/** @file sanei_bjnp.h
* This file provides a generic BJNP interface.
*/
#ifndef sanei_bjnp_h
#define sanei_bjnp_h
#include "../include/sane/config.h"
#include "../include/sane/sane.h"
#include "pixma.h"
#include <stdlib.h> /* for size_t */
/** Initialize sanei_bjnp.
*
* Call this before any other sanei_bjnp function.
*/
extern void sanei_bjnp_init (void);
/** Find scanners responding to a BJNP broadcast.
*
* The function attach is called for every device which has been found.
*
* @param attach attach function
*
* @return SANE_STATUS_GOOD - on success (even if no scanner was found)
*/
extern SANE_Status
sanei_bjnp_find_devices (SANE_Status (*attach_bjnp)
(SANE_String_Const devname,
SANE_String_Const makemodel,
SANE_String_Const serial,
const struct pixma_config_t *
const pixma_devices[]),
const struct pixma_config_t *const pixma_devices[]);
/** Open a BJNP device.
*
* The device is opened by its name devname and the device number is
* returned in dn on success.
*
* Device names consist of an URI
* Where:
* method = bjnp
* hostname = resolvable name or IP-address
* port = 8612 for a scanner
* An example could look like this: bjnp://host.domain:8612
*
* @param devname name of the device to open
* @param dn device number
*
* @return
* - SANE_STATUS_GOOD - on success
* - SANE_STATUS_ACCESS_DENIED - if the file couldn't be accessed due to
* permissions
* - SANE_STATUS_INVAL - on every other error
*/
extern SANE_Status sanei_bjnp_open (SANE_String_Const devname, SANE_Int * dn);
/** Close a BJNP device.
*
* @param dn device number
*/
extern void sanei_bjnp_close (SANE_Int dn);
/** Set the libbjnp timeout for bulk and interrupt reads.
*
* @param devno device number
* @param timeout the new timeout in ms
*/
extern void sanei_bjnp_set_timeout (SANE_Int devno, SANE_Int timeout);
/** Check if sanei_bjnp_set_timeout() is available.
*/
#define HAVE_SANEI_BJNP_SET_TIMEOUT
/** Initiate a bulk transfer read.
*
* Read up to size bytes from the device to buffer. After the read, size
* contains the number of bytes actually read.
*
* @param dn device number
* @param buffer buffer to store read data in
* @param size size of the data
*
* @return
* - SANE_STATUS_GOOD - on succes
* - SANE_STATUS_EOF - if zero bytes have been read
* - SANE_STATUS_IO_ERROR - if an error occured during the read
* - SANE_STATUS_INVAL - on every other error
*
*/
extern SANE_Status
sanei_bjnp_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size);
/** Initiate a bulk transfer write.
*
* Write up to size bytes from buffer to the device. After the write size
* contains the number of bytes actually written.
*
* @param dn device number
* @param buffer buffer to write to device
* @param size size of the data
*
* @return
* - SANE_STATUS_GOOD - on succes
* - SANE_STATUS_IO_ERROR - if an error occured during the write
* - SANE_STATUS_INVAL - on every other error
*/
extern SANE_Status
sanei_bjnp_write_bulk (SANE_Int dn, const SANE_Byte * buffer, size_t * size);
/** Initiate a interrupt transfer read.
*
* Read up to size bytes from the interrupt endpoint from the device to
* buffer. After the read, size contains the number of bytes actually read.
*
* @param dn device number
* @param buffer buffer to store read data in
* @param size size of the data
*
* @return
* - SANE_STATUS_GOOD - on succes
* - SANE_STATUS_EOF - if zero bytes have been read
* - SANE_STATUS_IO_ERROR - if an error occured during the read
* - SANE_STATUS_INVAL - on every other error
*
*/
extern SANE_Status
sanei_bjnp_read_int (SANE_Int dn, SANE_Byte * buffer, size_t * size);
/*------------------------------------------------------*/
#endif /* sanei_bjnp_h */

Wyświetl plik

@ -0,0 +1,243 @@
/* SANE - Scanner Access Now Easy.
Copyright (C) 2008 by Louis Lagendijk
This file is part of the SANE package.
Data structures and definitions for
bjnp backend for the Common UNIX Printing System (CUPS).
These coded instructions, statements, and computer programs are the
property of Louis Lagendijk and are protected by Federal copyright
law. Distribution and use rights are outlined in the file "LICENSE.txt"
"LICENSE" which should have been included with this file. If this
file is missing or damaged, see the license at "http://www.cups.org/".
This file is subject to the Apple OS-Developed Software exception.
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, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
The exception is that, if you link a SANE library with other files
to produce an executable, this does not by itself cause the
resulting executable to be covered by the GNU General Public
License. Your use of that executable is in no way restricted on
account of linking the SANE library code into it.
This exception does not, however, invalidate any other reasons why
the executable file might be covered by the GNU General Public
License.
If you submit changes to SANE to the maintainers to be included in
a subsequent release, you agree by submitting the changes that
those changes may be distributed with this exception intact.
If you write modifications of your own for SANE, it is your choice
whether to permit this exception to apply to your modifications.
If you do not wish that, delete this exception notice.
*/
/*
* BJNP definitions
*/
#define BJNP_PRINTBUF_MAX 1400 /* size of printbuffer */
#define BJNP_CMD_MAX 2048 /* size of BJNP response buffer */
#define BJNP_RESP_MAX 2048 /* size of BJNP response buffer */
#define BJNP_SOCK_MAX 256 /* maximum number of open sockets */
#define BJNP_MODEL_MAX 64 /* max allowed size for make&model */
#define BJNP_STATUS_MAX 256 /* max size for status string */
#define BJNP_IEEE1284_MAX 1024 /* max. allowed size of IEEE1284 id */
#define BJNP_NO_DEVICES 16 /* max number of open devices */
#define SCAN_BUF_MAX 65536 /* size of scanner data intermediate buffer */
#define MAX_RECV_REQ 0x4000 /* max size of a single recv request */
/* must be < SSIZE_MAX */
#define LOG_DEBUG 11
#define LOG_DEBUG2 12
#define LOG_DEBUG3 13
#define LOG_CRIT 0
#define LOG_NOTICE 1
#define LOG_INFO 2
/*
* BJNP protocol related definitions
*/
/* port numbers */
typedef enum bjnp_port_e
{
BJNP_PORT_PRINT = 8611,
BJNP_PORT_SCAN = 8612,
BJNP_PORT_3 = 8613,
BJNP_PORT_4 = 8614
} bjnp_port_t;
#define BJNP_METHOD "bjnp"
#define BJNP_STRING "BJNP"
/* commands */
typedef enum bjnp_cmd_e
{
CMD_UDP_DISCOVER = 0x01, /* discover if service type is listening at this port */
CMD_UDP_JOB_DET = 0x10, /* send print job owner details */
CMD_UDP_CLOSE = 0x11, /* request connection closure */
CMD_UDP_GET_STATUS = 0x20, /* get printer status */
CMD_TCP_REQ = 0x20, /* read data from device */
CMD_TCP_SEND = 0x21, /* send data to device */
CMD_UDP_GET_ID = 0x30, /* get printer identity */
CMD_UDP_SCAN_INFO = 0x32 /* Send some scan info?????? */
} bjnp_cmd_t;
/* command type */
typedef enum uint8_t
{
BJNP_CMD_PRINT = 0x1, /* printer command */
BJNP_CMD_SCAN = 0x2, /* scanner command */
BJNP_RES_PRINT = 0x81, /* printer response */
BJNP_RES_SCAN = 0x82 /* scanner response */
} bjnp_cmd_type_t;
struct BJNP_command
{
char BJNP_id[4]; /* string: BJNP */
uint8_t dev_type; /* 1 = printer, 2 = scanner */
uint8_t cmd_code; /* command code/response code */
uint32_t seq_no; /* sequence number */
uint16_t session_id; /* session id for printing */
uint32_t payload_len; /* length of command buffer */
} __attribute__ ((__packed__));
/* Layout of the init response buffer */
struct DISCOVER_RESPONSE
{
struct BJNP_command response; /* reponse header */
char unknown1[6]; /* 00 01 08 00 06 04 */
char mac_addr[6]; /* printers mac address */
unsigned char ip_addr[4]; /* printers IP-address */
} __attribute__ ((__packed__));
/* layout of payload for the JOB_DETAILS command */
struct JOB_DETAILS
{
struct BJNP_command cmd; /* command header */
char unknown[8]; /* don't know what these are for */
char hostname[64]; /* hostname of sender */
char username[64]; /* username */
char jobtitle[256]; /* job title */
} __attribute__ ((__packed__));
/* layout of scan details, prety vague stuff */
struct INTR_STATUS_REQ
{
struct BJNP_command cmd; /* command header */
uint16_t type; /* 00 02 */
uint32_t unknown_2; /* 00 00 00 00 */
uint16_t dialogue; /* some kind of session number for */
/* the status requests */
char user_details[66]; /* user <space> <space> hostname */
uint16_t unknown_4; /* 00 14 */
char unknown_5[23]; /* only zeroes */
char date_len; /* length of date-field 0 for type 0 and 1 */
/* 0x16 for type 2 */
char ascii_date[16]; /* YYYYMMDDHHMMSS */
} __attribute__ ((__packed__));
struct INTR_STATUS_RESP
{
struct BJNP_command cmd; /* command header */
char unknown_1[16]; /* unknown stuff */
char status[16]; /* interrupt status */
char unknown_2[4]; /* 00 00 00 00 */
} __attribute__ ((__packed__));
/* Layout of ID and status responses */
struct IDENTITY
{
struct BJNP_command cmd;
uint16_t id_len; /* length of identity */
char id[BJNP_IEEE1284_MAX]; /* identity */
} __attribute__ ((__packed__));
/* response to TCP print command */
struct SCAN_BUF
{
struct BJNP_command cmd;
char scan_data[65536];
} __attribute__ ((__packed__));
typedef enum bjnp_paper_status_e
{
BJNP_PAPER_UNKNOWN = -1,
BJNP_PAPER_OK = 0,
BJNP_PAPER_OUT = 1
} bjnp_paper_status_t;
/*
* Device information for opened devices
*/
typedef struct device_s
{
char open; /* device state open/closed */
int fd; /* file descriptor */
struct sockaddr_in addr;
char makemodel[BJNP_MODEL_MAX]; /* make & model reported by the scanner */
char IEEE1284_id[BJNP_IEEE1284_MAX]; /* IEEE1284 string reported by scanner */
int session_id; /* session id used in bjnp protocol for TCP packets */
uint32_t serial; /* sequence number of command */
int bjnp_timeout_sec; /* timeout (seconds) for next command */
int bjnp_timeout_msec; /* timeout (msec) for next command */
size_t scanner_data_left; /* TCP data left from last read request */
int last_cmd; /* last command sent */
char short_read; /* last TCP read command was shorter than blocksize */
} device_t;
/*
* Private functions for bjnp protocol
*/
int parse_IEEE1284_to_model (char *scanner_id, char *model);
int charTo2byte (char d[], char s[], int len);
void set_cmd (int devno, struct BJNP_command *cmd, char cmd_code,
int payload_len);
int udp_command (const int dev_no, char *command, int cmd_len, char *response,
int resp_len);
int get_scanner_id (const int dev_no, char *model, char *IEEE1284_id);
void parse_scanner_address (char *resp_buf, char *name, char *serial);
int bjnp_send_broadcast (struct ifaddrs *interface, struct BJNP_command cmd,
int size);
int split_uri (const char *devname, char *method, char *hostname, int *port,
char *args);
void bjnp_finish_job (int devno);
int bjnp_send_job_details (int devno, char *hostname, char *user,
char *title);
int bjnp_get_intr (int devno, char type, char *hostname, char *user,
SANE_Byte * buffer, int len);
int bjnp_send_read_request (int devno);
int bjnp_write (int devno, const SANE_Byte * buf, size_t count);
int bjnp_open_tcp (int devno);
SANE_Status bjnp_recv_header (int devno);
SANE_Status bjnp_recv_data (int devno, SANE_Byte * buffer, size_t * len);
SANE_Status sanei_bjnp_attach (SANE_String_Const devname, SANE_Int * dn);

Wyświetl plik

@ -1,5 +1,6 @@
/* SANE - Scanner Access Now Easy.
Copyright (C) 2007-2008 Nicolas Martin, <nicols-guest at alioth dot debian dot org>
Copyright (C) 2006-2007 Wittawat Yamwong <wittawat@web.de>
This file is part of the SANE package.
@ -89,7 +90,7 @@ u8tohex (uint8_t x, char *str)
static const char hdigit[16] =
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
'e', 'f'
};
};
str[0] = hdigit[(x >> 4) & 0xf];
str[1] = hdigit[x & 0xf];
str[2] = '\0';
@ -108,20 +109,25 @@ void
pixma_hexdump (int level, const void *d_, unsigned len)
{
const uint8_t *d = (const uint8_t *) (d_);
unsigned ofs, c;
unsigned ofs, c, plen;
char line[100]; /* actually only 1+8+1+8*3+1+8*3+1 = 61 bytes needed */
if (level > debug_level)
return;
if (level == debug_level)
/* if debuglevel == exact match and buffer contains more than 3 lines, print 2 lines + .... */
plen = (len > 64) ? 32: len;
else
plen = len;
ofs = 0;
while (ofs < len)
while (ofs < plen)
{
char *p;
line[0] = ' ';
u32tohex (ofs, line + 1);
line[9] = ':';
p = line + 10;
for (c = 0; c != 16 && (ofs + c) < len; c++)
for (c = 0; c != 16 && (ofs + c) < plen; c++)
{
u8tohex (d[ofs + c], p);
p[2] = ' ';
@ -136,6 +142,8 @@ pixma_hexdump (int level, const void *d_, unsigned len)
pixma_dbg (level, "%s\n", line);
ofs += c;
}
if (len > plen)
pixma_dbg(level, "......\n");
}
static void

Wyświetl plik

@ -591,29 +591,30 @@ static const pixma_scan_ops_t pixma_iclass_ops = {
iclass_get_status
};
#define DEV(name, pid, dpi, w, h, cap) { \
name, /* name */ \
0x04a9, pid, /* vid pid */ \
1, /* iface */ \
&pixma_iclass_ops, /* ops */ \
dpi, dpi, /* xdpi, ydpi */ \
w, h, /* width, height */ \
PIXMA_CAP_GRAY|PIXMA_CAP_EVENTS|cap \
#define DEV(name, model, pid, dpi, w, h, cap) { \
name, /* name */ \
model, /* model */ \
0x04a9, pid, /* vid pid */ \
1, /* iface */ \
&pixma_iclass_ops, /* ops */ \
dpi, dpi, /* xdpi, ydpi */ \
w, h, /* width, height */ \
PIXMA_CAP_GRAY|PIXMA_CAP_EVENTS|cap \
}
const pixma_config_t pixma_iclass_devices[] = {
DEV ("Canon imageCLASS MF4270", MF4200_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF4150", MF4100_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF4270", "MF4270", MF4200_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF4150", "MF4100", MF4100_PID, 600, 640, 877, PIXMA_CAP_ADF),
/* FIXME: the following capabilities all need updating/verifying */
DEV ("Canon imageCLASS MF5630", MF5630_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon laserBase MF5650", MF5650_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF8170c", MF8100_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF5730", MF5730_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF5750", MF5750_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF5770", MF5770_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF3110", MF3110_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF3240", MF3200_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon MF6500 Series", MF6500_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF4690", MF4600_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF4010", MF4010_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV (NULL, 0, 0, 0, 0, 0)
DEV ("Canon imageCLASS MF5630", "MF5630", MF5630_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon laserBase MF5650", "MF5650", MF5650_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF8170c", "MF8170c", MF8100_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF5730", "MF5730", MF5730_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF5750", "MF5750", MF5750_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF5770", "MF5770", MF5770_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF3110", "MF3110", MF3110_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF3240", "MF3240", MF3200_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon MF6500 Series", "MF6500", MF6500_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF4690", "MF4690", MF4600_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV ("Canon imageCLASS MF4010", "MF4010", MF4010_PID, 600, 640, 877, PIXMA_CAP_ADF),
DEV (NULL, NULL, 0, 0, 0, 0, 0)
};

Wyświetl plik

@ -1,4 +1,5 @@
/* SANE - Scanner Access Now Easy.
* For limitations, see function sanei_usb_get_vendor_product().
Copyright (C) 2006-2007 Wittawat Yamwong <wittawat@web.de>
@ -44,11 +45,13 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h> /* INT_MAX */
#include "pixma_rename.h"
#include "pixma_common.h"
#include "pixma_io.h"
#include "pixma_bjnp.h"
#include "../include/sane/sanei_usb.h"
@ -63,18 +66,22 @@
struct pixma_io_t
{
pixma_io_t *next;
SANE_Int usb;
int interface;
SANE_Int dev;
};
typedef struct scanner_info_t
{
struct scanner_info_t *next;
char *devname;
int interface;
const pixma_config_t *cfg;
char serial[PIXMA_MAX_ID_LEN + 1]; /* "xxxxyyyy_zzzzzzz..."
x = vid, y = pid, z = serial */
} scanner_info_t;
#define INT_USB 0
#define INT_BJNP 1
static scanner_info_t *first_scanner = NULL;
static pixma_io_t *first_io = NULL;
@ -91,6 +98,36 @@ get_scanner_info (unsigned devnr)
return si;
}
static const struct pixma_config_t *lookup_scanner(const char *makemodel,
const struct pixma_config_t *const pixma_devices[])
{
int i;
const struct pixma_config_t *cfg;
char *match;
for (i = 0; pixma_devices[i]; i++)
{
/* loop through the device classes (mp150, mp730 etc) */
for (cfg = pixma_devices[i]; cfg->name; cfg++)
{
/* loop through devices in class */
if ((match = strcasestr (makemodel, cfg->model)) != NULL)
{
/* possible match found, make sure it is not a partial match */
/* MP600 and MP600R are different models! */
if ((match[strlen(cfg->model)] == ' ') ||
(match[strlen(cfg->model)] == '\0'))
{
pixma_dbg (13, "Scanner model found: Name %s(%s) matches %s\n", cfg->model, cfg->name, makemodel);
return cfg;
}
}
pixma_dbg (13, "Name %s(%s) does not match %s\n", cfg->model, cfg->name, makemodel);
}
}
return NULL;
}
static SANE_Status
attach (SANE_String_Const devname)
{
@ -102,6 +139,35 @@ attach (SANE_String_Const devname)
si->devname = strdup (devname);
if (!si->devname)
return SANE_STATUS_NO_MEM;
si -> interface = INT_USB;
si->next = first_scanner;
first_scanner = si;
nscanners++;
return SANE_STATUS_GOOD;
}
static SANE_Status
attach_bjnp (SANE_String_Const devname, SANE_String_Const makemodel,
SANE_String_Const serial,
const struct pixma_config_t *const pixma_devices[])
{
scanner_info_t *si;
const pixma_config_t *cfg;
/* const struct pixma_config_t *const *pixma_devices;
pixma_devices = input; */
si = (scanner_info_t *) calloc (1, sizeof (*si));
if (!si)
return SANE_STATUS_NO_MEM;
si->devname = strdup (devname);
if (!si->devname)
return SANE_STATUS_NO_MEM;
if ((cfg = lookup_scanner(makemodel, pixma_devices)) == (struct pixma_config_t *)NULL)
return SANE_STATUS_INVAL;
si->cfg = cfg;
sprintf(si->serial, "%04x%04x_%s", (unsigned int) cfg->vid, (unsigned int) cfg->pid, serial);
si -> interface = INT_BJNP;
si->next = first_scanner;
first_scanner = si;
nscanners++;
@ -145,7 +211,7 @@ u16tohex (uint16_t x, char *str)
static const char hdigit[16] =
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
'E', 'F'
};
};
str[0] = hdigit[(x >> 12) & 0xf];
str[1] = hdigit[(x >> 8) & 0xf];
str[2] = hdigit[(x >> 4) & 0xf];
@ -177,26 +243,25 @@ read_serial_number (scanner_info_t * si)
int iSerialNumber = ddesc[16];
/* Read the first language code. Assumed that there is at least one. */
if (get_string_descriptor (usb, 0, 0, 4, unicode) != SANE_STATUS_GOOD)
goto done;
goto done;
/* Read the serial number string. */
status =
get_string_descriptor (usb, iSerialNumber,
unicode[3] * 256 + unicode[2],
sizeof (unicode), unicode);
status = get_string_descriptor (usb, iSerialNumber,
unicode[3] * 256 + unicode[2],
sizeof (unicode), unicode);
if (status != SANE_STATUS_GOOD)
goto done;
goto done;
/* Assumed charset: Latin1 */
len = unicode[0];
if (len > (int) sizeof (unicode))
{
len = sizeof (unicode);
PDBG (pixma_dbg (1, "WARNING:Truncated serial number\n"));
}
serial[8] = '_';
for (i = 2; i < len; i += 2)
{
serial[9 + i / 2 - 1] = unicode[i];
}
{
len = sizeof (unicode);
PDBG (pixma_dbg (1, "WARNING:Truncated serial number\n"));
}
serial[8] = '_';
for (i = 2; i < len; i += 2)
{
serial[9 + i / 2 - 1] = unicode[i];
}
serial[9 + i / 2 - 1] = '\0';
}
else
@ -248,6 +313,7 @@ int
pixma_io_init (void)
{
sanei_usb_init ();
sanei_bjnp_init();
nscanners = 0;
return 0;
}
@ -264,27 +330,37 @@ unsigned
pixma_collect_devices (const struct pixma_config_t *const pixma_devices[])
{
unsigned i, j;
scanner_info_t *si;
const pixma_config_t *cfg;
struct scanner_info_t *si;
const struct pixma_config_t *cfg;
clear_scanner_list ();
j = 0;
for (i = 0; pixma_devices[i]; i++)
{
for (cfg = pixma_devices[i]; cfg->name; cfg++)
{
sanei_usb_find_devices (cfg->vid, cfg->pid, attach);
si = first_scanner;
while (j < nscanners)
{
PDBG (pixma_dbg (3, "pixma_collect_devices() found %s at %s\n",
cfg->name, si->devname));
si->cfg = cfg;
read_serial_number (si);
si = si->next;
j++;
}
}
{
sanei_usb_find_devices (cfg->vid, cfg->pid, attach);
si = first_scanner;
while (j < nscanners)
{
PDBG (pixma_dbg (3, "pixma_collect_devices() found %s at %s\n",
cfg->name, si->devname));
si->cfg = cfg;
read_serial_number (si);
si = si->next;
j++;
}
}
}
sanei_bjnp_find_devices(attach_bjnp, pixma_devices);
si = first_scanner;
while (j < nscanners)
{
PDBG (pixma_dbg (3, "pixma_collect_devices() found %s at %s\n",
si->cfg->name, si->devname));
si = si->next;
j++;
}
return nscanners;
}
@ -307,7 +383,7 @@ int
pixma_connect (unsigned devnr, pixma_io_t ** handle)
{
pixma_io_t *io;
SANE_Int usb;
SANE_Int dev;
const scanner_info_t *si;
int error;
@ -315,18 +391,26 @@ pixma_connect (unsigned devnr, pixma_io_t ** handle)
si = get_scanner_info (devnr);
if (!si)
return PIXMA_EINVAL;
error = map_error (sanei_usb_open (si->devname, &usb));
if (si-> interface == INT_BJNP)
error = map_error (sanei_bjnp_open (si->devname, &dev));
else
error = map_error (sanei_usb_open (si->devname, &dev));
if (error < 0)
return error;
io = (pixma_io_t *) calloc (1, sizeof (*io));
if (!io)
{
sanei_usb_close (usb);
if (si -> interface == INT_BJNP)
sanei_bjnp_close (dev);
else
sanei_usb_close (dev);
return PIXMA_ENOMEM;
}
io->next = first_io;
first_io = io;
io->usb = usb;
io->dev = dev;
io->interface = si->interface;
*handle = io;
return 0;
}
@ -345,7 +429,10 @@ pixma_disconnect (pixma_io_t * io)
PASSERT (*p);
if (!(*p))
return;
sanei_usb_close (io->usb);
if (io-> interface == INT_BJNP)
sanei_bjnp_close (io->dev);
else
sanei_usb_close (io->dev);
*p = io->next;
free (io);
}
@ -363,10 +450,18 @@ pixma_write (pixma_io_t * io, const void *cmd, unsigned len)
size_t count = len;
int error;
if (io->interface == INT_BJNP)
{
sanei_bjnp_set_timeout (io->dev, PIXMA_BULKOUT_TIMEOUT);
error = map_error (sanei_bjnp_write_bulk (io->dev, cmd, &count));
}
else
{
#ifdef HAVE_SANEI_USB_SET_TIMEOUT
sanei_usb_set_timeout (PIXMA_BULKOUT_TIMEOUT);
sanei_usb_set_timeout (PIXMA_BULKOUT_TIMEOUT);
#endif
error = map_error (sanei_usb_write_bulk (io->usb, cmd, &count));
error = map_error (sanei_usb_write_bulk (io->dev, cmd, &count));
}
if (error == PIXMA_EIO)
error = PIXMA_ETIMEDOUT; /* FIXME: SANE doesn't have ETIMEDOUT!! */
if (count != len)
@ -387,10 +482,19 @@ pixma_read (pixma_io_t * io, void *buf, unsigned size)
size_t count = size;
int error;
if (io-> interface == INT_BJNP)
{
sanei_bjnp_set_timeout (io->dev, PIXMA_BULKIN_TIMEOUT);
error = map_error (sanei_bjnp_read_bulk (io->dev, buf, &count));
}
else
{
#ifdef HAVE_SANEI_USB_SET_TIMEOUT
sanei_usb_set_timeout (PIXMA_BULKIN_TIMEOUT);
sanei_usb_set_timeout (PIXMA_BULKIN_TIMEOUT);
#endif
error = map_error (sanei_usb_read_bulk (io->usb, buf, &count));
error = map_error (sanei_usb_read_bulk (io->dev, buf, &count));
}
if (error == PIXMA_EIO)
error = PIXMA_ETIMEDOUT; /* FIXME: SANE doesn't have ETIMEDOUT!! */
if (error >= 0)
@ -405,15 +509,23 @@ pixma_wait_interrupt (pixma_io_t * io, void *buf, unsigned size, int timeout)
size_t count = size;
int error;
#ifdef HAVE_SANEI_USB_SET_TIMEOUT
/* FIXME: What is the meaning of "timeout" in sanei_usb? */
if (timeout < 0)
timeout = INT_MAX;
else if (timeout < 10)
timeout = 10;
sanei_usb_set_timeout (timeout);
if (io-> interface == INT_BJNP)
{
sanei_bjnp_set_timeout (io->dev, timeout);
error = map_error (sanei_bjnp_read_int (io->dev, buf, &count));
}
else
{
#ifdef HAVE_SANEI_USB_SET_TIMEOUT
sanei_usb_set_timeout (timeout);
#endif
error = map_error (sanei_usb_read_int (io->usb, buf, &count));
error = map_error (sanei_usb_read_int (io->dev, buf, &count));
}
if (error == PIXMA_EIO)
error = PIXMA_ETIMEDOUT; /* FIXME: SANE doesn't have ETIMEDOUT!! */
if (error == 0)

Wyświetl plik

@ -1,5 +1,6 @@
/* SANE - Scanner Access Now Easy.
Copyright (C) 2007-2008 Nicolas Martin, <nicols-guest at alioth dot debian dot org>
Copyright (C) 2006-2007 Wittawat Yamwong <wittawat@web.de>
This file is part of the SANE package.
@ -111,7 +112,8 @@
#define MP140_PID 0x172b
/* Generation 3 */
#define MX7600_PID 0x171c /* untested */
/* PIXMA 2007 vintage */
#define MX7600_PID 0x171c
#define MP210_PID 0x1721
#define MP220_PID 0x1722
#define MP470_PID 0x1723
@ -123,6 +125,18 @@
#define MX700_PID 0x1729
#define MX850_PID 0x172c
/* PIXMA 2008 vintage */
#define MP980_PID 0x172d /* Untested */
#define MP630_PID 0x172e /* Untested */
#define MP620_PID 0x172f /* Untested */
#define MP540_PID 0x1730 /* Untested */
#define MP480_PID 0x1731 /* Untested */
#define MP240_PID 0x1732 /* Untested */
#define MP260_PID 0x1733 /* Untested */
#define MP190_PID 0x1734 /* Untested */
enum mp150_state_t
{
state_idle,
@ -884,15 +898,15 @@ static unsigned
pack_48_24_bpc (uint8_t * sptr, unsigned n)
{
unsigned i;
uint8_t *cptr;
uint8_t *cptr, lsb;
cptr = sptr;
if (n % 2 != 0)
PDBG (pixma_dbg (3, "Warning: Odd number of bytes received, misaligned image.\n"));
for (i = 0; i < n; i += 2)
{
sptr++;
*cptr++ = *sptr++;
lsb = *sptr++;
*cptr++ = ((*sptr++) << 0) | lsb >> 8;
}
return (n / 2);
}
@ -1136,6 +1150,7 @@ mp150_scan (pixma_t * s)
error = start_scan_3 (s);
if (error < 0)
{
mp->last_block = 0x38; /* Force abort session if ADF scan */
mp150_finish_scan (s);
return error;
}
@ -1286,8 +1301,9 @@ static const pixma_scan_ops_t pixma_mp150_ops = {
mp150_get_status
};
#define DEVICE(name, pid, dpi, cap) { \
#define DEVICE(name, model, pid, dpi, cap) { \
name, /* name */ \
model, /* model */ \
CANON_VID, pid, /* vid pid */ \
0, /* iface */ \
&pixma_mp150_ops, /* ops */ \
@ -1297,60 +1313,60 @@ static const pixma_scan_ops_t pixma_mp150_ops = {
PIXMA_CAP_GAMMA_TABLE|PIXMA_CAP_EVENTS|cap \
}
#define END_OF_DEVICE_LIST DEVICE(NULL, 0, 0, 0)
#define END_OF_DEVICE_LIST DEVICE(NULL, NULL, 0, 0, 0)
const pixma_config_t pixma_mp150_devices[] = {
/* Generation 1: CIS */
DEVICE ("Canon PIXMA MP150", MP150_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP170", MP170_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP450", MP450_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP500", MP500_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP530", MP530_PID, 1200,
PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MP150", "MP150", MP150_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP170", "MP170", MP170_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP450", "MP450", MP450_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP500", "MP500", MP500_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP530", "MP530", MP530_PID, 1200, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
/* Generation 1: CCD */
DEVICE ("Canon PIXMA MP800", MP800_PID, 2400,
PIXMA_CAP_CCD | PIXMA_CAP_TPU | PIXMA_CAP_48BIT),
DEVICE ("Canon PIXMA MP800R", MP800R_PID, 2400,
PIXMA_CAP_CCD | PIXMA_CAP_TPU | PIXMA_CAP_48BIT),
DEVICE ("Canon PIXMA MP830", MP830_PID, 2400,
PIXMA_CAP_CCD | PIXMA_CAP_ADFDUP | PIXMA_CAP_48BIT),
DEVICE ("Canon PIXMA MP800", "MP800", MP800_PID, 2400, PIXMA_CAP_CCD | PIXMA_CAP_TPU | PIXMA_CAP_48BIT),
DEVICE ("Canon PIXMA MP800R", "MP800R", MP800R_PID, 2400, PIXMA_CAP_CCD | PIXMA_CAP_TPU | PIXMA_CAP_48BIT),
DEVICE ("Canon PIXMA MP830", "MP830", MP830_PID, 2400, PIXMA_CAP_CCD | PIXMA_CAP_ADFDUP | PIXMA_CAP_48BIT),
/* Generation 2: CIS */
DEVICE ("Canon PIXMA MP140", MP140_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP160", MP160_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP180", MP180_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP460", MP460_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP510", MP510_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP600", MP600_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP600R", MP600R_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP140", "MP140", MP140_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP160", "MP160", MP160_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP180", "MP180", MP180_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP460", "MP460", MP460_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP510", "MP510", MP510_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP600", "MP600", MP600_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP600R", "MP600R", MP600R_PID, 2400, PIXMA_CAP_CIS),
/* Generation 2: CCD */
DEVICE ("Canon PIXMA MP810", MP810_PID, 4800,
PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP960", MP960_PID, 4800,
PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP810", "MP810", MP810_PID, 4800, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP960", "MP960", MP960_PID, 4800, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
/* Generation 3: CIS */
DEVICE ("Canon PIXMA MP210", MP210_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP220", MP220_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP470", MP470_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP520", MP520_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP610", MP610_PID, 4800, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP210", "MP210", MP210_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP220", "MP220", MP220_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP470", "MP470", MP470_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP520", "MP520", MP520_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP610", "MP610", MP610_PID, 4800, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MX300", MX300_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MX310", MX310_PID, 1200,
PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MX700", MX700_PID, 2400,
PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MX850", MX850_PID, 2400,
PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
DEVICE ("Canon PIXMA MX7600", MX7600_PID, 4800,
PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
DEVICE ("Canon PIXMA MX300", "MX300", MX300_PID, 600, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MX310", "MX310", MX310_PID, 1200, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MX700", "MX700", MX700_PID, 2400, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MX850", "MX850", MX850_PID, 2400, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
DEVICE ("Canon PIXMA MX7600", "MX7600", MX7600_PID, 4800, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
/* Generation 3 CCD not managed as Generation 2 */
DEVICE ("Canon PIXMA MP970", MP970_PID, 4800,
PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon Pixma MP970", "MP970", MP970_PID, 4800, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
/* PIXMA 2008 vintage */
DEVICE ("Canon MP980 series", "MP980", MP980_PID, 4800, PIXMA_CAP_CCD | PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP630", "MP630", MP630_PID, 4800, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP620", "MP620", MP620_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP540", "MP540", MP540_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP480", "MP480", MP480_PID, 2400, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP240", "MP240", MP240_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP260", "MP260", MP260_PID, 1200, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MP190", "MP190", MP190_PID, 600, PIXMA_CAP_CIS),
END_OF_DEVICE_LIST
};

Wyświetl plik

@ -1,5 +1,6 @@
/* SANE - Scanner Access Now Easy.
Copyright (C) 2007-2008 Nicolas Martin, <nicols-guest at alioth dot debian dot org>
Copyright (C) 2006-2007 Wittawat Yamwong <wittawat@web.de>
This file is part of the SANE package.
@ -620,23 +621,24 @@ static const pixma_scan_ops_t pixma_mp730_ops = {
mp730_get_status
};
#define DEVICE(name, pid, dpi, w, h, cap) { \
name, /* name */ \
0x04a9, pid, /* vid pid */ \
1, /* iface */ \
&pixma_mp730_ops, /* ops */ \
dpi, dpi, /* xdpi, ydpi */ \
w, h, /* width, height */ \
PIXMA_CAP_GRAY|PIXMA_CAP_EVENTS|cap \
#define DEVICE(name, model, pid, dpi, w, h, cap) { \
name, /* name */ \
model, /* model */ \
0x04a9, pid, /* vid pid */ \
1, /* iface */ \
&pixma_mp730_ops, /* ops */ \
dpi, dpi, /* xdpi, ydpi */ \
w, h, /* width, height */ \
PIXMA_CAP_GRAY|PIXMA_CAP_EVENTS|cap \
}
const pixma_config_t pixma_mp730_devices[] = {
/* TODO: check area limits */
DEVICE ("Canon SmartBase MP360", MP360_PID, 1200, 636, 868, 0),
DEVICE ("Canon SmartBase MP370", MP370_PID, 1200, 636, 868, 0),
DEVICE ("Canon SmartBase MP390", MP390_PID, 1200, 636, 868, 0),
DEVICE ("Canon MultiPASS MP700", MP700_PID, 1200, 638, 877 /*1035 */ , 0),
DEVICE ("Canon MultiPASS MP710", MP710_PID, 1200, 637, 868, 0),
DEVICE ("Canon MultiPASS MP730", MP730_PID, 1200, 637, 868, PIXMA_CAP_ADF),
DEVICE ("Canon MultiPASS MP740", MP740_PID, 1200, 637, 868, PIXMA_CAP_ADF),
DEVICE (NULL, 0, 0, 0, 0, 0)
DEVICE ("Canon SmartBase MP360", "MP360", MP360_PID, 1200, 636, 868, 0),
DEVICE ("Canon SmartBase MP370", "MP370", MP370_PID, 1200, 636, 868, 0),
DEVICE ("Canon SmartBase MP390", "MP390", MP390_PID, 1200, 636, 868, 0),
DEVICE ("Canon MultiPASS MP700", "MP700", MP700_PID, 1200, 638, 877 /*1035 */ , 0),
DEVICE ("Canon MultiPASS MP710", "MP710", MP710_PID, 1200, 637, 868, 0),
DEVICE ("Canon MultiPASS MP730", "MP730", MP730_PID, 1200, 637, 868, PIXMA_CAP_ADF),
DEVICE ("Canon MultiPASS MP740", "MP740", MP740_PID, 1200, 637, 868, PIXMA_CAP_ADF),
DEVICE (NULL, NULL, 0, 0, 0, 0, 0)
};

Wyświetl plik

@ -844,8 +844,9 @@ static const pixma_scan_ops_t pixma_mp750_ops = {
mp750_get_status
};
#define DEVICE(name, pid, dpi, cap) { \
#define DEVICE(name, model, pid, dpi, cap) { \
name, /* name */ \
model, /* model */ \
0x04a9, pid, /* vid pid */ \
0, /* iface */ \
&pixma_mp750_ops, /* ops */ \
@ -855,8 +856,8 @@ static const pixma_scan_ops_t pixma_mp750_ops = {
}
const pixma_config_t pixma_mp750_devices[] = {
DEVICE ("Canon PIXMA MP750", MP750_PID, 2400, PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MP760", MP760_PID, 2400, PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP780", MP780_PID, 2400, PIXMA_CAP_ADF),
DEVICE (NULL, 0, 0, 0)
DEVICE ("Canon PIXMA MP750", "MP750", MP750_PID, 2400, PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MP760", "MP760", MP760_PID, 2400, PIXMA_CAP_TPU),
DEVICE ("Canon PIXMA MP780", "MP780", MP780_PID, 2400, PIXMA_CAP_ADF),
DEVICE (NULL, NULL, 0, 0, 0)
};

Wyświetl plik

@ -234,8 +234,8 @@
:model "PIXMA MX850"
:interface "USB"
:usbid "0x04a9" "0x172c"
:status :basic
:comment "Works in flatbed. Speed issue in ADF simplex ? USB Snoops needed to set up ADF Duplex"
:status :good
:comment "Works in flatbed and ADF simplex. ADF Duplex supported, but no report yet."
:model "PIXMA MX7600"
:interface "USB"
@ -243,6 +243,54 @@
:status :good
:comment "Flatbed and ADF scan. All resolutions supported (up to 4800DPI)"
:model "PIXMA MP980"
:interface "USB"
:usbid "0x04a9" "0x172d"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "PIXMA MP630"
:interface "USB"
:usbid "0x04a9" "0x172e"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "PIXMA MP620"
:interface "USB"
:usbid "0x04a9" "0x172f"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "PIXMA MP540"
:interface "USB"
:usbid "0x04a9" "0x1730"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "PIXMA MP480"
:interface "USB"
:usbid "0x04a9" "0x1731"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "PIXMA MP240"
:interface "USB"
:usbid "0x04a9" "0x1732"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "PIXMA MP260"
:interface "USB"
:usbid "0x04a9" "0x1733"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "PIXMA MP190"
:interface "USB"
:usbid "0x04a9" "0x1734"
:status :untested
:comment "Same protocol as Pixma Generation 3? Testers needed!"
:model "imageCLASS MF5630"
:interface "USB"
:usbid "0x04a9" "0x264e"

Wyświetl plik

@ -1,4 +1,4 @@
.TH "sane\-pixma" "5" "7 Sep 2008" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.TH "sane\-pixma" "5" "11 Oct 2008" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane\-pixma
.SH NAME
sane\-pixma \- SANE backend for Canon PIXMA MP series
@ -7,6 +7,8 @@ The
.B sane\-pixma
library implements a SANE (Scanner Access Now Easy) backend that provides
access to Canon PIXMA multi-function devices (All-in-one printers).
The backend implements both USB interface and Network LAN interface
using Canon's BJNP protocol.
Currently, the following models work with this backend:
.PP
.RS
@ -40,7 +42,9 @@ in the backend so that they get recognized and activated.
Feedback in the Sane-dev mailing list welcome.
.PP
.RS
PIXMA MP740, MX7600
PIXMA MP740
.br
PIXMA MP190, MP240, MP260, MP480, MP540, MP620, MP630, MP980
.br
ImageCLASS MF3110, MF3240
.br
@ -62,11 +66,11 @@ The backend supports
.br
* color and grayscale mode,
.br
* a custom gamma table and
* a custom gamma table,
.br
* Automatic Document Feeder (Duplex for some models).
.br
* Transparency Unit support is still experimental.
* Transparency Unit.
.PP
The device name is in the form pixma:xxxxyyyy_zzzzz
where x, y and z are vendor ID, product ID and serial number respectively.
@ -148,7 +152,7 @@ You should also set SANE_DEBUG_PIXMA to 10.
.I http://home.arcor.de/wittawat/pixma/,
.I http://mp610.blogspot.com/
.SH AUTHORS
Wittawat Yamwong, Nicolas Martin
Wittawat Yamwong, Nicolas Martin, Dennis Lou, Louis Lagendijk
.PP
We would like to thank all testers and helpers. Without them we could not be
able to write subdrivers for models we don't have. See also the project