summaryrefslogtreecommitdiff
path: root/backend/pixma/pixma_mp150.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/pixma/pixma_mp150.c')
-rw-r--r--backend/pixma/pixma_mp150.c73
1 files changed, 58 insertions, 15 deletions
diff --git a/backend/pixma/pixma_mp150.c b/backend/pixma/pixma_mp150.c
index b438c1b..f3d5934 100644
--- a/backend/pixma/pixma_mp150.c
+++ b/backend/pixma/pixma_mp150.c
@@ -17,9 +17,7 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
@@ -299,6 +297,25 @@
#define TS3300_PID 0x18a2
#define E3300_PID 0x18a3
+/* 2020 new devices (untested) */
+#define G7080_PID 0x1864
+#define GM4080_PID 0x186A
+#define TS3400_PID 0x18B7
+#define E3400_PID 0x18B8
+#define TR7000_PID 0x18B9
+#define G2020_PID 0x18BD
+#define G3060_PID 0x18C3
+#define G2060_PID 0x18C1
+#define G3020_PID 0x18BF
+#define TS7430_PID 0x18B2
+#define XK90_PID 0x18B6
+#define TS8430_PID 0x18B5
+#define TR7600_PID 0x18AA
+#define TR8600_PID 0x18AD
+#define TR8630_PID 0x18AF
+#define TS6400_PID 0x18D3
+#define TS7400_PID 0x18D7
+
/* Generation 4 XML messages that encapsulates the Pixma protocol messages */
#define XML_START_1 \
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\
@@ -322,6 +339,10 @@
<ivec:param_set servicetype=\"scan\"><ivec:jobID>00000001</ivec:jobID>\
</ivec:param_set></ivec:contents></cmd>"
+#if !defined(HAVE_LIBXML2)
+#define XML_OK "<ivec:response>OK</ivec:response>"
+#endif
+
enum mp150_state_t
{
state_idle,
@@ -459,7 +480,11 @@ send_xml_dialog (pixma_t * s, const char * xml_message)
PDBG (pixma_dbg (10, "XML message sent to scanner:\n%s\n", xml_message));
PDBG (pixma_dbg (10, "XML response back from scanner:\n%s\n", mp->cb.buf));
+#if defined(HAVE_LIBXML2)
return pixma_parse_xml_response((const char*)mp->cb.buf) == PIXMA_STATUS_OK;
+#else
+ return (strcasestr ((const char *) mp->cb.buf, XML_OK) != NULL);
+#endif
}
static int
@@ -614,7 +639,7 @@ static unsigned
calc_raw_width (const mp150_t * mp, const pixma_scan_param_t * param)
{
unsigned raw_width;
- /* NOTE: Actually, we can send arbitary width to MP150. Lines returned
+ /* NOTE: Actually, we can send arbitrary width to MP150. Lines returned
are always padded to multiple of 4 or 12 pixels. Is this valid for
other models, too? */
if (mp->generation >= 2)
@@ -705,10 +730,7 @@ send_scan_param (pixma_t * s)
{
data[0x03] = 0x01;
}
- else
- {
- data[0x05] = 0x01; /* This one also seen at 0. Don't know yet what's used for */
- }
+ data[0x05] = pixma_calc_calibrate (s);
pixma_set_be16 (xdpi | 0x8000, data + 0x08);
pixma_set_be16 (ydpi | 0x8000, data + 0x0a);
pixma_set_be32 (x - xs, data + 0x0c);
@@ -909,6 +931,7 @@ handle_interrupt (pixma_t * s, int timeout)
|| s->cfg->pid == MG5400_PID
|| s->cfg->pid == MG6200_PID
|| s->cfg->pid == MG6300_PID
+ || s->cfg->pid == MX340_PID
|| s->cfg->pid == MX520_PID
|| s->cfg->pid == MX720_PID
|| s->cfg->pid == MX920_PID
@@ -938,8 +961,11 @@ handle_interrupt (pixma_t * s, int timeout)
/* some scanners provide additional information:
* document type in buf[6] 01=Document; 02=Photo; 03=Auto Scan
* ADF status in buf[8] 01 = ADF empty; 02 = ADF filled
- * ADF orientation in buf[16] 01=Portrait; 02=Landscape */
- if (s->cfg->pid == TR4500_PID)
+ * ADF orientation in buf[16] 01=Portrait; 02=Landscape
+ *
+ * ToDo: maybe this if isn't needed
+ */
+ if (s->cfg->pid == TR4500_PID || s->cfg->pid == MX340_PID)
{
s->events |= (buf[6] & 0x0f) << 12;
s->events |= (buf[8] & 0x0f) << 20;
@@ -1029,7 +1055,7 @@ reorder_pixels (uint8_t * linebuf, uint8_t * sptr, unsigned c, unsigned n,
memcpy (sptr, linebuf, line_size);
}
-/* the scanned image must be shrinked by factor "scale"
+/* the scanned image must be shrunk by factor "scale"
* the image can be formatted as rgb (c=3) or gray (c=1)
* we need to crop the left side (xs)
* we ignore more pixels inside scanned line (wx), behind needed line (w)
@@ -1069,7 +1095,7 @@ shrink_image (uint8_t * dptr, uint8_t * sptr, unsigned xs, unsigned w,
pixel = 0;
/* sum shrink pixels */
- for (unsigned m = 0; m < scale; m++) /* get pixels from shrinked lines */
+ for (unsigned m = 0; m < scale; m++) /* get pixels from shrunk lines */
{
for (unsigned n = 0; n < scale; n++) /* get pixels from same line */
{
@@ -1080,7 +1106,7 @@ shrink_image (uint8_t * dptr, uint8_t * sptr, unsigned xs, unsigned w,
#endif
}
- /* jump over shrinked data */
+ /* jump over shrunk data */
src += c * scale;
/* next pixel */
dst += c;
@@ -1715,7 +1741,7 @@ const pixma_config_t pixma_mp150_devices[] = {
DEVICE ("Canon PIXMA MP190", "MP190", MP190_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
/* PIXMA 2009 vintage */
- DEVICE ("Canon PIXMA MX320", "MX320", MX320_PID, 0, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
+ DEVICE ("Canon PIXMA MX320", "MX320", MX320_PID, 0, 1200, 0, 600, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MX330", "MX330", MX330_PID, 0, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MX860", "MX860", MX860_PID, 0, 2400, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
/* width and height adjusted to flatbed size 21.8 x 30.2 cm^2 respective
@@ -1805,7 +1831,7 @@ const pixma_config_t pixma_mp150_devices[] = {
DEVICE ("Canon PIXMA E460 Series", "E460", E460_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
/* Latest devices (2015) Generation 5 CIS */
- DEVICE ("Canon PIXMA MX490 Series", "MX490", MX490_PID, 0, 600, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
+ DEVICE ("Canon PIXMA MX490 Series", "MX490", MX490_PID, 0, 600, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF | PIXMA_CAP_ADF_JPEG),
DEVICE ("Canon PIXMA E480 Series", "E480", E480_PID, 0, 600, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA MG3600 Series", "MG3600", MG3600_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA MG7700 Series", "MG7700", MG7700_PID, 0, 2400, 0, 0, 638, 877, PIXMA_CAP_CIS),
@@ -1882,6 +1908,23 @@ const pixma_config_t pixma_mp150_devices[] = {
DEVICE ("Canon PIXMA TS6330 Series", "TS6330", TS6330_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA TS3300 Series", "TS3300", TS3300_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA E3300 Series", "E3300", E3300_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA TS3400 Series", "TS3400", TS3400_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA E3400 Series", "E3400", E3400_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
+ DEVICE ("Canon PIXMA TR7000 Series", "TR7000", TR7000_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
+ DEVICE ("Canon PIXMA G2020", "G2020", G2020_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA G3060", "G3060", G3060_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA G2060", "G2060", G2060_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA G3020", "G3020", G3020_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA TS7430 Series", "TS7430", TS7430_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXUS XK90 Series", "XK90", XK90_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA TS8430 Series", "TS8430", TS8430_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA TR7600 Series", "TR7600", TR7600_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
+ DEVICE ("Canon PIXMA TR8600 Series", "TR8600", TR8600_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
+ DEVICE ("Canon PIXMA TR8630 Series", "TR8630", TR8630_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
+ DEVICE ("Canon PIXMA TS6400 Series", "TS6400", TS6400_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA TS7400 Series", "TS7400", TS7400_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA G7080 Series", "G7080", G7080_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
+ DEVICE ("Canon PIXMA GM4080", "GM4080", GM4080_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
END_OF_DEVICE_LIST
};