From d98ff2b73c4dba86842234a88616fa2305b7de96 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Fri, 19 Jul 2019 14:45:53 +0200 Subject: [PATCH] 1730698 - add Canon CanonScan LiDE 300 support --- ...-pixma-new-scanner-CanoScan-LIDE-300.patch | 72 +++++++++++++++++++ sane-backends.spec | 8 ++- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 0001-pixma-new-scanner-CanoScan-LIDE-300.patch diff --git a/0001-pixma-new-scanner-CanoScan-LIDE-300.patch b/0001-pixma-new-scanner-CanoScan-LIDE-300.patch new file mode 100644 index 0000000..43d3a66 --- /dev/null +++ b/0001-pixma-new-scanner-CanoScan-LIDE-300.patch @@ -0,0 +1,72 @@ +diff --git a/backend/pixma_mp150.c b/backend/pixma_mp150.c +index dca0965..4eaea9c 100644 +--- a/backend/pixma_mp150.c ++++ b/backend/pixma_mp150.c +@@ -241,6 +241,7 @@ + #define MG3000_PID 0x180b + #define E470_PID 0x180c + #define G3000_PID 0x181d ++#define LIDE300_PID 0x1913 /* tested */ + + /* Generation 4 XML messages that encapsulates the Pixma protocol messages */ + #define XML_START_1 \ +@@ -977,6 +978,14 @@ handle_interrupt (pixma_t * s, int timeout) + if (buf[7] & 2) + s->events = PIXMA_EV_BUTTON2 | buf[11] | buf[10]<<8 | buf[12]<<16; /* b/w scan */ + } ++ else if (s->cfg->pid == LIDE300_PID) ++ /* unknown value in buf[4] ++ * target in buf[0x13] ++ * always set button-1 */ ++ { ++ if (buf[0x13]) ++ s->events = PIXMA_EV_BUTTON1 | buf[0x13]; ++ } + else + /* button no. in buf[0] + * original in buf[0] +@@ -1331,7 +1340,8 @@ mp150_check_param (pixma_t * s, pixma_scan_param_t * sp) + if ((s->cfg->cap & PIXMA_CAP_ADF) && sp->source == PIXMA_SOURCE_FLATBED) + sp->h = MIN (sp->h, 877 * sp->xdpi / 75); + +- if (sp->source == PIXMA_SOURCE_TPU) ++ if (sp->source == PIXMA_SOURCE_TPU ++ || s->cfg->pid == LIDE300_PID) + { + uint8_t k; + +@@ -1864,6 +1874,7 @@ const pixma_config_t pixma_mp150_devices[] = { + DEVICE ("Canon PIXMA MG3000 Series", "MG3000", MG3000_PID, 600, 0, 0, 638, 877, PIXMA_CAP_CIS), + DEVICE ("Canon PIXMA E470 Series", "E470", E470_PID, 600, 0, 0, 638, 877, PIXMA_CAP_CIS), + DEVICE ("Canon PIXMA G4000 Series", "G3000", G3000_PID, 600, 0, 0, 638, 877, PIXMA_CAP_CIS), ++ DEVICE ("CanoScan LiDE 300", "LIDE300", LIDE300_PID, 4800, 0, 0, 638, 877, PIXMA_CAP_CIS), + + END_OF_DEVICE_LIST + }; +diff --git a/doc/descriptions/pixma.desc b/doc/descriptions/pixma.desc +index ad33faa..b610a71 100644 +--- a/doc/descriptions/pixma.desc ++++ b/doc/descriptions/pixma.desc +@@ -1162,3 +1162,9 @@ + :usbid "0x04a9" "0x190d" + :status :complete + :comment "Full flatbed support up to 4800DPI (Note: flatbed does not have 9600DPI capability). Full TPU support (negatives, slides and infrared) up to 9600DPI." ++ ++:model "CanoScan LiDE 300" ++:interface "USB" ++:usbid "0x04a9" "0x1913" ++:status :complete ++:comment "Support up to 4800DPI (Note: does not have less than 300DPI support)" +diff --git a/doc/sane-pixma.man b/doc/sane-pixma.man +index 1058e92..9c23b9d 100644 +--- a/doc/sane-pixma.man ++++ b/doc/sane-pixma.man +@@ -67,6 +67,8 @@ imageRUNNER 1020/1024/1025 + .br + CanoScan 8800F, 9000F, 9000F Mark II + .br ++CanoScan LiDE 300 ++.br + MAXIFY MB5000 (ADF is not working) + .RE + .PP diff --git a/sane-backends.spec b/sane-backends.spec index befce72..27a3098 100644 --- a/sane-backends.spec +++ b/sane-backends.spec @@ -33,7 +33,7 @@ Summary: Scanner access software Name: sane-backends Version: 1.0.27 -Release: 23%{?dist} +Release: 24%{?dist} # lib/ is LGPLv2+, backends are GPLv2+ with exceptions # Tools are GPLv2+, docs are public domain # see LICENSE for details @@ -62,6 +62,8 @@ Patch5: sane-backends-revert-samsung-patch.patch # Mustek scanner did not work since Fedora 27 due more strict gcc flags # Backported from upstream https://gitlab.com/sane-project/backends/commit/93340afddfbc4085a5297fe635b65dd7f7f3ef05 Patch6: 0001-mustek_usb2-Avoid-stack-smashing.-Fixes-35.patch +# added support for Canon CanoScan LiDE 300 +Patch7: 0001-pixma-new-scanner-CanoScan-LIDE-300.patch URL: http://www.sane-project.org @@ -198,6 +200,7 @@ access image acquisition devices available on the local host. %patch4 -p1 -b .canon-lide-100 %patch5 -p1 -b .revert-samsung-patch %patch6 -p1 -b .mustek-stack-smash +%patch7 -p1 -b .add-canoscan-lide-300 %build CFLAGS="%optflags -fno-strict-aliasing" @@ -359,6 +362,9 @@ exit 0 %{_unitdir}/saned@.service %changelog +* Thu Jul 18 2019 Zdenek Dohnal - 1.0.27-24 +- 1730698 - add Canon CanonScan LiDE 300 support + * Wed Apr 03 2019 Zdenek Dohnal - 1.0.27-23 - mustek backend crashed from stack smashing (upstream issue #71)