Re: [sane-devel] Please: CanoScan Lide 220
If you could provide the exact versions of sane-backends and sane-frontends you are using, that would be more useful. I have a Canon CanoScan LiDE 220 sitting right next to me and it is functioning quite well (I'm using scanimage to drive it). Try running $ scanimage -d genesys --format=tiff --resolution 75 > test.tiff and see if that works as expected. I often find that the thing that's making the scanner not work is the application, not the SANE driver. Cheers, and happy easter to you! -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org
Re: [sane-devel] scanbd and Canon LiDE 60: buttons not recognized ?
Am 16.04.2017 um 16:15 schrieb Florian Gagel: > Hi Wilhelm, > > thanks for your patch, works like a charm - I just had to made a small > modification since > the backend name inside the wrapper actually is "Genesys USB" (see below). Thank you, Florian, for checking this once again. Just pushed this into trunk! > A minor hint for those who tinker around like me: Do no forget to turn > debugging off in > scanbd.conf when finished, otherwise syslog will overflow :-) > > Regards, > > Florian > > === cut here > --- /usr/local/src/tmp/1.5.0/src/scanbd/scanbuttond_wrapper.c > 2017-04-05 05:46:59.0 + > +++ scanbuttond_wrapper.c2017-04-16 13:41:07.140209953 + > @@ -1062,11 +1062,35 @@ > assert(backend_name); > slog(SLOG_INFO, "scanbtnd_button_name, backend: %s", backend_name); > > -if (strcmp("snapscan", backend_name)) { > -assert(button <= 5); > +if (strncmp("Genesys", backend_name,7) == 0) { > switch(button) { > case 0: > -return NULL; > +return "zero"; > +break; > +case 1: > +return "copy"; > +break; > +case 2: > +return "scan"; > +break; > +case 3: > +return "pdf"; > +break; > +case 4: > +return "email"; > +break; > +case 5: > +return "stop"; > +break; > +default: > +return "default"; > +break; > +} > +} > +else { > +switch(button) { > +case 0: > +return "zero"; > break; > case 1: > return "scan"; // "web"; > @@ -1084,9 +1108,10 @@ > return "stop"; > break; > default: > -return NULL; > +return "default"; > break; > } > + > } > return NULL; > } > > > Am 16.04.2017 um 11:59 schrieb Wilhelm: >> Am 15.04.2017 um 20:38 schrieb Florian Gagel: >>> Hi Wilhelm, >>> >>> thanks, your modification made all four buttons work ! >> Great! >> >>> This seems somewhat surprising to me at first glance, should the >>> backend not be strcmp'ed using "==0", providing >>> an own section for each backend :-) ? Anyway, it works, even if the >>> buttons are somewhat scrambled: >> Please backout the last patch I sent and now apply the attached one. >> This should mark your buttons with the right labels. >> >> If thats ok for you, I'll check this into trunk. >> >> Please report if teh patch is ok, or make your own modifications and >> send the patch back to me to be inserted into trunk. >> >> Thanks for using scanbd. >> >> -- Wilhelm >> >>> (Button press at scanner) -> (Action) >>> >>> Email -> PDF >>> PDF -> Email >>> Scan -> Copy >>> Copy -> Scan. >>> >>> I also used string-triggers only. The buttons may have to be pressed for >>> a short period exceeding the polling interval. >>> Some minor possible pitfalls using the installations defaults of >>> scanbd-1.5.0 under Ubuntu 16.04: >>> - I removed the default package and configured the newer scanbd 1.5.0 as >>> described in the previous mail. I also used xinetd instead of the ubuntu >>> default >>>bsd-inetd for network scanner access although this should be of no >>> relevance. >>> - Wilhelms patch has to be applied to scanbuttond_wrapper.c (removed >>> assertion, return strings on any value of "button"). >>> - In scanbd.conf: Group should be "saned". Make sure all paths refer to >>> /usr/local/etc/scanbd, scriptdir = /usr/local/etc/scanbd/scripts, ... >>> - The new path also enters into /lib/systemd/system/scanbd.service, >>> after changing that do "systemctl daemon-reload" and restart scanbd. >>> >>> Now I am happy because of the four programmable buttons for my Odroid-U2 >>> SoC which has no monitor attached to it :-) >>> >>> Thanks again Wilhelm and Happy Easter ! >>> >>> Florian >>> >>> Am 15.04.2017 um 17:32 schrieb Wilhelm: Am 15.04.2017 um 16:13 schrieb Florian Gagel: > Hi Wilhelm, > > thanks for your reply - I made some progress in this issue however > still did not fully succeed. > > - First step as you told me: make clean, configure --enable-scanbuttond, > make, make install, copy manually the > old backends to /usr/local/lib/scanbd/scanbuttond as described in the > README (this all with the 1.5.0 version of scanbd). > - Starting scanbd -f -d7, I first got a "scanbd: Can't get the scbtn > device list" error. > - I edited /usr/local/lib/scanbd/scanbuttond/backends/meta.conf, making > it contain the single line "genesys" which was missing before. Yes, per default this was not included - I added it to trunk. > - Then the LiDE-60 was recognized by the old backend, together with its > four buttons ! > - However, scanbd finally stumbled on an assertion:/ Lo
[sane-devel] Please: CanoScan Lide 220
Please help to breathe a life of my scanners Lide 220... Please... Thx. csola48 ps.: Happy Easter for everybody! :) -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org
[sane-devel] [PATCH 1/2] Separate ICC profile loading into a separate file.
This cuts out some duplicate code, and enables us to reuse this logic for PNG, JPEG, and any other future output format. sanei_load_icc_profile also allows us to know that an ICC profile file is not long enough before we start to write it to the output; this should prevent poorly-written software from overflowing into image data when they read the bad profile based on its length. --- frontend/Makefile.am | 2 +- frontend/Makefile.in | 5 +-- frontend/sicc.c | 65 ++ frontend/sicc.h | 19 ++ frontend/stiff.c | 99 +--- 5 files changed, 113 insertions(+), 77 deletions(-) create mode 100644 frontend/sicc.c create mode 100644 frontend/sicc.h diff --git a/frontend/Makefile.am b/frontend/Makefile.am index 892b32a..1b234db 100644 --- a/frontend/Makefile.am +++ b/frontend/Makefile.am @@ -16,7 +16,7 @@ endif AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -scanimage_SOURCES = scanimage.c stiff.c stiff.h +scanimage_SOURCES = scanimage.c sicc.c sicc.h stiff.c stiff.h scanimage_LDADD = ../backend/libsane.la ../sanei/libsanei.la ../lib/liblib.la \ $(PNG_LIBS) $(JPEG_LIBS) diff --git a/frontend/Makefile.in b/frontend/Makefile.in index e944a9c..6571ba3 100644 --- a/frontend/Makefile.in +++ b/frontend/Makefile.in @@ -114,7 +114,7 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -am_scanimage_OBJECTS = scanimage.$(OBJEXT) stiff.$(OBJEXT) +am_scanimage_OBJECTS = scanimage.$(OBJEXT) sicc.$(OBJEXT) stiff.$(OBJEXT) scanimage_OBJECTS = $(am_scanimage_OBJECTS) scanimage_DEPENDENCIES = ../backend/libsane.la ../sanei/libsanei.la \ ../lib/liblib.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -381,7 +381,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -scanimage_SOURCES = scanimage.c stiff.c stiff.h +scanimage_SOURCES = scanimage.c sicc.c sicc.h stiff.c stiff.h scanimage_LDADD = ../backend/libsane.la ../sanei/libsanei.la ../lib/liblib.la \ $(PNG_LIBS) $(JPEG_LIBS) @@ -550,6 +550,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saned.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanimage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sicc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stiff.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstbackend.Po@am__quote@ diff --git a/frontend/sicc.c b/frontend/sicc.c new file mode 100644 index 000..21d600d --- /dev/null +++ b/frontend/sicc.c @@ -0,0 +1,65 @@ +/* Load an ICC profile for embedding in an output file + Copyright (C) 2017 Aaron Muir Hamilton + + This program 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. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include +#include +#include + +void * +sanei_load_icc_profile (const char *path, size_t *size) +{ + FILE *fd = NULL; + size_t stated_size = 0; + void *profile = NULL; + struct stat s; + + fd = fopen(path, "r"); + + if (!fd) + { +fprintf(stderr, "Could not open ICC profile %s\n", path); + } + else + { +fstat(fileno(fd), &s); +stated_size = 16777216 * fgetc(fd) + 65536 * fgetc(fd) + 256 * fgetc(fd) + fgetc(fd); +rewind(fd); + +if (stated_size > (size_t) s.st_size) +{ + fprintf(stderr, "Ignoring ICC profile because file %s is shorter than the profile\n", path); +} +else +{ + profile = malloc(stated_size); + + if (fread(profile, stated_size, 1, fd) != 1) + { +fprintf(stderr, "Error reading ICC profile %s\n", path); +free(profile); + } + else + { +fclose(fd); +*size = stated_size; +return profile; + } +} +fclose(fd); + } + return NULL; +} diff --git a/frontend/sicc.h b/frontend/sicc.h new file mode 100644 index 000..5c225da --- /dev/null +++ b/frontend/sicc.h @@ -0,0 +1,19 @@ +/* Load an ICC profile for embedding in an output file + Copyright (C) 2017 Aaron Muir Hamilton + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU
[sane-devel] [PATCH 2/2] Add ICC profile embedding for PNG output.
--- frontend/scanimage.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/scanimage.c b/frontend/scanimage.c index 77c2288..0f71422 100644 --- a/frontend/scanimage.c +++ b/frontend/scanimage.c @@ -56,6 +56,7 @@ #include "../include/sane/sanei.h" #include "../include/sane/saneopts.h" +#include "sicc.h" #include "stiff.h" #include "../include/md5.h" @@ -1165,9 +1166,11 @@ write_pnm_header (SANE_Frame format, int width, int height, int depth, FILE *ofp #ifdef HAVE_LIBPNG static void -write_png_header (SANE_Frame format, int width, int height, int depth, FILE *ofp, png_structp* png_ptr, png_infop* info_ptr) +write_png_header (SANE_Frame format, int width, int height, int depth, const char * icc_profile, FILE *ofp, png_structp* png_ptr, png_infop* info_ptr) { int color_type; + size_t icc_size = 0; + void *icc_buffer; *png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); @@ -1200,6 +1203,16 @@ write_png_header (SANE_Frame format, int width, int height, int depth, FILE *ofp depth, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + if (icc_profile) +{ + icc_buffer = sanei_load_icc_profile(icc_profile, &icc_size); + if (icc_size > 0) +{ + png_set_iCCP(*png_ptr, *info_ptr, basename(icc_profile), PNG_COMPRESSION_TYPE_BASE, icc_buffer, icc_size); + free(icc_buffer); + } +} + png_write_info(*png_ptr, *info_ptr); } #endif @@ -1379,7 +1392,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBPNG case OUTPUT_PNG: write_png_header (parm.format, parm.pixels_per_line, - parm.lines, parm.depth, ofp, &png_ptr, &info_ptr); + parm.lines, parm.depth, icc_profile, + ofp, &png_ptr, &info_ptr); break; #endif #ifdef HAVE_LIBJPEG @@ -1635,7 +1649,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBPNG case OUTPUT_PNG: write_png_header (parm.format, parm.pixels_per_line, - image.height, parm.depth, ofp, &png_ptr, &info_ptr); + image.height, parm.depth, icc_profile, + ofp, &png_ptr, &info_ptr); break; #endif #ifdef HAVE_LIBJPEG -- 1.8.3.1 -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org
[sane-devel] [PATCH 2/2] Add ICC profile embedding for PNG output.
--- frontend/scanimage.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/scanimage.c b/frontend/scanimage.c index 77c2288..0f71422 100644 --- a/frontend/scanimage.c +++ b/frontend/scanimage.c @@ -56,6 +56,7 @@ #include "../include/sane/sanei.h" #include "../include/sane/saneopts.h" +#include "sicc.h" #include "stiff.h" #include "../include/md5.h" @@ -1165,9 +1166,11 @@ write_pnm_header (SANE_Frame format, int width, int height, int depth, FILE *ofp #ifdef HAVE_LIBPNG static void -write_png_header (SANE_Frame format, int width, int height, int depth, FILE *ofp, png_structp* png_ptr, png_infop* info_ptr) +write_png_header (SANE_Frame format, int width, int height, int depth, const char * icc_profile, FILE *ofp, png_structp* png_ptr, png_infop* info_ptr) { int color_type; + size_t icc_size = 0; + void *icc_buffer; *png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); @@ -1200,6 +1203,16 @@ write_png_header (SANE_Frame format, int width, int height, int depth, FILE *ofp depth, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + if (icc_profile) +{ + icc_buffer = sanei_load_icc_profile(icc_profile, &icc_size); + if (icc_size > 0) +{ + png_set_iCCP(*png_ptr, *info_ptr, basename(icc_profile), PNG_COMPRESSION_TYPE_BASE, icc_buffer, icc_size); + free(icc_buffer); + } +} + png_write_info(*png_ptr, *info_ptr); } #endif @@ -1379,7 +1392,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBPNG case OUTPUT_PNG: write_png_header (parm.format, parm.pixels_per_line, - parm.lines, parm.depth, ofp, &png_ptr, &info_ptr); + parm.lines, parm.depth, icc_profile, + ofp, &png_ptr, &info_ptr); break; #endif #ifdef HAVE_LIBJPEG @@ -1635,7 +1649,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBPNG case OUTPUT_PNG: write_png_header (parm.format, parm.pixels_per_line, - image.height, parm.depth, ofp, &png_ptr, &info_ptr); + image.height, parm.depth, icc_profile, + ofp, &png_ptr, &info_ptr); break; #endif #ifdef HAVE_LIBJPEG -- 1.8.3.1 -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org
[sane-devel] [PATCH 1/2] Separate ICC profile loading into a separate file.
This cuts out some duplicate code, and enables us to reuse this logic for PNG, JPEG, and any other future output format. sanei_load_icc_profile also allows us to know that an ICC profile file is not long enough before we start to write it to the output; this should prevent poorly-written software from overflowing into image data when they read the bad profile based on its length. --- frontend/Makefile.am | 2 +- frontend/Makefile.in | 5 +-- frontend/sicc.c | 65 ++ frontend/sicc.h | 19 ++ frontend/stiff.c | 99 +--- 5 files changed, 113 insertions(+), 77 deletions(-) create mode 100644 frontend/sicc.c create mode 100644 frontend/sicc.h diff --git a/frontend/Makefile.am b/frontend/Makefile.am index 892b32a..1b234db 100644 --- a/frontend/Makefile.am +++ b/frontend/Makefile.am @@ -16,7 +16,7 @@ endif AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -scanimage_SOURCES = scanimage.c stiff.c stiff.h +scanimage_SOURCES = scanimage.c sicc.c sicc.h stiff.c stiff.h scanimage_LDADD = ../backend/libsane.la ../sanei/libsanei.la ../lib/liblib.la \ $(PNG_LIBS) $(JPEG_LIBS) diff --git a/frontend/Makefile.in b/frontend/Makefile.in index e944a9c..6571ba3 100644 --- a/frontend/Makefile.in +++ b/frontend/Makefile.in @@ -114,7 +114,7 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -am_scanimage_OBJECTS = scanimage.$(OBJEXT) stiff.$(OBJEXT) +am_scanimage_OBJECTS = scanimage.$(OBJEXT) sicc.$(OBJEXT) stiff.$(OBJEXT) scanimage_OBJECTS = $(am_scanimage_OBJECTS) scanimage_DEPENDENCIES = ../backend/libsane.la ../sanei/libsanei.la \ ../lib/liblib.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -381,7 +381,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -scanimage_SOURCES = scanimage.c stiff.c stiff.h +scanimage_SOURCES = scanimage.c sicc.c sicc.h stiff.c stiff.h scanimage_LDADD = ../backend/libsane.la ../sanei/libsanei.la ../lib/liblib.la \ $(PNG_LIBS) $(JPEG_LIBS) @@ -550,6 +550,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saned.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanimage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sicc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stiff.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstbackend.Po@am__quote@ diff --git a/frontend/sicc.c b/frontend/sicc.c new file mode 100644 index 000..21d600d --- /dev/null +++ b/frontend/sicc.c @@ -0,0 +1,65 @@ +/* Load an ICC profile for embedding in an output file + Copyright (C) 2017 Aaron Muir Hamilton + + This program 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. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include +#include +#include + +void * +sanei_load_icc_profile (const char *path, size_t *size) +{ + FILE *fd = NULL; + size_t stated_size = 0; + void *profile = NULL; + struct stat s; + + fd = fopen(path, "r"); + + if (!fd) + { +fprintf(stderr, "Could not open ICC profile %s\n", path); + } + else + { +fstat(fileno(fd), &s); +stated_size = 16777216 * fgetc(fd) + 65536 * fgetc(fd) + 256 * fgetc(fd) + fgetc(fd); +rewind(fd); + +if (stated_size > (size_t) s.st_size) +{ + fprintf(stderr, "Ignoring ICC profile because file %s is shorter than the profile\n", path); +} +else +{ + profile = malloc(stated_size); + + if (fread(profile, stated_size, 1, fd) != 1) + { +fprintf(stderr, "Error reading ICC profile %s\n", path); +free(profile); + } + else + { +fclose(fd); +*size = stated_size; +return profile; + } +} +fclose(fd); + } + return NULL; +} diff --git a/frontend/sicc.h b/frontend/sicc.h new file mode 100644 index 000..5c225da --- /dev/null +++ b/frontend/sicc.h @@ -0,0 +1,19 @@ +/* Load an ICC profile for embedding in an output file + Copyright (C) 2017 Aaron Muir Hamilton + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU
Re: [sane-devel] scanbd and Canon LiDE 60: buttons not recognized ?
Hi Wilhelm, thanks for your patch, works like a charm - I just had to made a small modification since the backend name inside the wrapper actually is "Genesys USB" (see below). A minor hint for those who tinker around like me: Do no forget to turn debugging off in scanbd.conf when finished, otherwise syslog will overflow :-) Regards, Florian === cut here --- /usr/local/src/tmp/1.5.0/src/scanbd/scanbuttond_wrapper.c 2017-04-05 05:46:59.0 + +++ scanbuttond_wrapper.c2017-04-16 13:41:07.140209953 + @@ -1062,11 +1062,35 @@ assert(backend_name); slog(SLOG_INFO, "scanbtnd_button_name, backend: %s", backend_name); -if (strcmp("snapscan", backend_name)) { -assert(button <= 5); +if (strncmp("Genesys", backend_name,7) == 0) { switch(button) { case 0: -return NULL; +return "zero"; +break; +case 1: +return "copy"; +break; +case 2: +return "scan"; +break; +case 3: +return "pdf"; +break; +case 4: +return "email"; +break; +case 5: +return "stop"; +break; +default: +return "default"; +break; +} +} +else { +switch(button) { +case 0: +return "zero"; break; case 1: return "scan"; // "web"; @@ -1084,9 +1108,10 @@ return "stop"; break; default: -return NULL; +return "default"; break; } + } return NULL; } Am 16.04.2017 um 11:59 schrieb Wilhelm: Am 15.04.2017 um 20:38 schrieb Florian Gagel: Hi Wilhelm, thanks, your modification made all four buttons work ! Great! This seems somewhat surprising to me at first glance, should the backend not be strcmp'ed using "==0", providing an own section for each backend :-) ? Anyway, it works, even if the buttons are somewhat scrambled: Please backout the last patch I sent and now apply the attached one. This should mark your buttons with the right labels. If thats ok for you, I'll check this into trunk. Please report if teh patch is ok, or make your own modifications and send the patch back to me to be inserted into trunk. Thanks for using scanbd. -- Wilhelm (Button press at scanner) -> (Action) Email -> PDF PDF -> Email Scan -> Copy Copy -> Scan. I also used string-triggers only. The buttons may have to be pressed for a short period exceeding the polling interval. Some minor possible pitfalls using the installations defaults of scanbd-1.5.0 under Ubuntu 16.04: - I removed the default package and configured the newer scanbd 1.5.0 as described in the previous mail. I also used xinetd instead of the ubuntu default bsd-inetd for network scanner access although this should be of no relevance. - Wilhelms patch has to be applied to scanbuttond_wrapper.c (removed assertion, return strings on any value of "button"). - In scanbd.conf: Group should be "saned". Make sure all paths refer to /usr/local/etc/scanbd, scriptdir = /usr/local/etc/scanbd/scripts, ... - The new path also enters into /lib/systemd/system/scanbd.service, after changing that do "systemctl daemon-reload" and restart scanbd. Now I am happy because of the four programmable buttons for my Odroid-U2 SoC which has no monitor attached to it :-) Thanks again Wilhelm and Happy Easter ! Florian Am 15.04.2017 um 17:32 schrieb Wilhelm: Am 15.04.2017 um 16:13 schrieb Florian Gagel: Hi Wilhelm, thanks for your reply - I made some progress in this issue however still did not fully succeed. - First step as you told me: make clean, configure --enable-scanbuttond, make, make install, copy manually the old backends to /usr/local/lib/scanbd/scanbuttond as described in the README (this all with the 1.5.0 version of scanbd). - Starting scanbd -f -d7, I first got a "scanbd: Can't get the scbtn device list" error. - I edited /usr/local/lib/scanbd/scanbuttond/backends/meta.conf, making it contain the single line "genesys" which was missing before. Yes, per default this was not included - I added it to trunk. - Then the LiDE-60 was recognized by the old backend, together with its four buttons ! - However, scanbd finally stumbled on an assertion:/ Looks like you were the first one with an appropriate scanner to test this ;-) You can safely remove the mentioned assertion if you return non-null string-literals in all switch cases including the default case: --- scanbuttond_wrapper.c (Revision 236) +++ scanbuttond_wrapper.c (Arbeitskopie) @@ -1063,10 +1063,9 @@ slog(SLOG_INFO, "scanbtnd_button_name, backend: %s", backend_name); if (strcmp("snapscan", backend_name)) { -assert(button <= 5); switch(button) { case 0: -return NUL
[sane-devel] [PATCH] Include physical resolution (pHYs section) in PNG output.
--- frontend/scanimage.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/scanimage.c b/frontend/scanimage.c index 77c2288..432c2ea 100644 --- a/frontend/scanimage.c +++ b/frontend/scanimage.c @@ -1165,9 +1165,12 @@ write_pnm_header (SANE_Frame format, int width, int height, int depth, FILE *ofp #ifdef HAVE_LIBPNG static void -write_png_header (SANE_Frame format, int width, int height, int depth, FILE *ofp, png_structp* png_ptr, png_infop* info_ptr) +write_png_header (SANE_Frame format, int width, int height, int depth, int dpi, FILE *ofp, png_structp* png_ptr, png_infop* info_ptr) { int color_type; + /* PNG does not have imperial reference units, so we must convert to metric. */ + /* There are nominally 39.3700787401575 inches in a meter. */ + const double pixels_per_meter = dpi * 39.3700787401575; *png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); @@ -1200,6 +1203,10 @@ write_png_header (SANE_Frame format, int width, int height, int depth, FILE *ofp depth, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + png_set_pHYs(*png_ptr, *info_ptr, +pixels_per_meter, pixels_per_meter, +PNG_RESOLUTION_METER); + png_write_info(*png_ptr, *info_ptr); } #endif @@ -1379,7 +1386,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBPNG case OUTPUT_PNG: write_png_header (parm.format, parm.pixels_per_line, - parm.lines, parm.depth, ofp, &png_ptr, &info_ptr); + parm.lines, parm.depth, resolution_value, + ofp, &png_ptr, &info_ptr); break; #endif #ifdef HAVE_LIBJPEG @@ -1635,7 +1643,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBPNG case OUTPUT_PNG: write_png_header (parm.format, parm.pixels_per_line, - image.height, parm.depth, ofp, &png_ptr, &info_ptr); + image.height, parm.depth, resolution_value, + ofp, &png_ptr, &info_ptr); break; #endif #ifdef HAVE_LIBJPEG -- 1.8.3.1 -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org
Re: [sane-devel] scanbd and Canon LiDE 60: buttons not recognized ?
Am 15.04.2017 um 20:38 schrieb Florian Gagel: > Hi Wilhelm, > > thanks, your modification made all four buttons work ! Great! > This seems somewhat surprising to me at first glance, should the > backend not be strcmp'ed using "==0", providing > an own section for each backend :-) ? Anyway, it works, even if the > buttons are somewhat scrambled: Please backout the last patch I sent and now apply the attached one. This should mark your buttons with the right labels. If thats ok for you, I'll check this into trunk. Please report if teh patch is ok, or make your own modifications and send the patch back to me to be inserted into trunk. Thanks for using scanbd. -- Wilhelm > (Button press at scanner) -> (Action) > > Email -> PDF > PDF -> Email > Scan -> Copy > Copy -> Scan. > > I also used string-triggers only. The buttons may have to be pressed for > a short period exceeding the polling interval. > Some minor possible pitfalls using the installations defaults of > scanbd-1.5.0 under Ubuntu 16.04: > - I removed the default package and configured the newer scanbd 1.5.0 as > described in the previous mail. I also used xinetd instead of the ubuntu > default >bsd-inetd for network scanner access although this should be of no > relevance. > - Wilhelms patch has to be applied to scanbuttond_wrapper.c (removed > assertion, return strings on any value of "button"). > - In scanbd.conf: Group should be "saned". Make sure all paths refer to > /usr/local/etc/scanbd, scriptdir = /usr/local/etc/scanbd/scripts, ... > - The new path also enters into /lib/systemd/system/scanbd.service, > after changing that do "systemctl daemon-reload" and restart scanbd. > > Now I am happy because of the four programmable buttons for my Odroid-U2 > SoC which has no monitor attached to it :-) > > Thanks again Wilhelm and Happy Easter ! > > Florian > > Am 15.04.2017 um 17:32 schrieb Wilhelm: >> Am 15.04.2017 um 16:13 schrieb Florian Gagel: >>> Hi Wilhelm, >>> >>> thanks for your reply - I made some progress in this issue however >>> still did not fully succeed. >>> >>> - First step as you told me: make clean, configure --enable-scanbuttond, >>> make, make install, copy manually the >>> old backends to /usr/local/lib/scanbd/scanbuttond as described in the >>> README (this all with the 1.5.0 version of scanbd). >>> - Starting scanbd -f -d7, I first got a "scanbd: Can't get the scbtn >>> device list" error. >>> - I edited /usr/local/lib/scanbd/scanbuttond/backends/meta.conf, making >>> it contain the single line "genesys" which was missing before. >> Yes, per default this was not included - I added it to trunk. >> >>> - Then the LiDE-60 was recognized by the old backend, together with its >>> four buttons ! >>> - However, scanbd finally stumbled on an assertion:/ >> Looks like you were the first one with an appropriate scanner to test >> this ;-) >> >> You can safely remove the mentioned assertion if you return non-null >> string-literals in all switch cases including the default case: >> >> --- scanbuttond_wrapper.c (Revision 236) >> >> +++ scanbuttond_wrapper.c (Arbeitskopie) >> >> @@ -1063,10 +1063,9 @@ >> >> slog(SLOG_INFO, "scanbtnd_button_name, backend: %s", backend_name); >> >> >> >> if (strcmp("snapscan", backend_name)) { >> -assert(button <= 5); >> switch(button) { >> case 0: >> -return NULL; >> +return "zero"; >> break; >> case 1: >> return "scan"; // "web"; >> @@ -1084,7 +1083,7 @@ >> return "stop"; >> break; >> default: >> -return NULL; >> +return "default"; >> break; >> } >> } >> >> >> If you don't mind please test this modification. I you succeed with it >> I'll put it into trunk. >> >>> root@gandroid:/usr/local/etc/scanbd# scanbd -f -d7 >>> scanbd: reading config file /usr/local/etc/scanbd/scanbd.conf >>> scanbd: debug on: level: 7 >>> scanbd: dropping privs to uid saned >>> scanbd: dropping privs to gid scanner >>> scanbd: group scanner has member: >>> scanbd: saned >>> scanbd: drop privileges to gid: 121 >>> scanbd: Running as effective gid 121 >>> scanbd: drop privileges to uid: 120 >>> scanbd: Running as effective uid 120 >>> scanbd: dbus_init >>> scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager' >>> scanbd: Loading /usr/local/lib/scanbd/scanbuttond/backends/meta.so >>> scanbd: Loading /usr/local/lib/scanbd/scanbuttond/backends/genesys.so >>> scanbd: Scanning for local-only devices >>> scanbd: found device: CanoScan LiDE 60 Canon genesys:libusb:001:016 >>> scanbd: start_scbtn_threads >>> scanbd: start the threads (1) >>> scanbd: Starting poll thread for CanoScan LiDE 60 >>> scanbd: Thread started for device CanoScan LiDE 60 >>> scanbd: start dbus thread >>> scanbd: scbtn_poll >>> scanbd: udev init >>> scanbd: get udev monitor >>> scanbd: udev fd is non-
Re: [sane-devel] SCSI-scanner & scanbuttond ...
Am 16.04.2017 um 09:27 schrieb Dr.-Ing. Dieter Jurzitza: > Dear listmembers, > prior to actually start playing around: can scanbuttond work with a SCSI - > scanner? I know, it is oldfashioned, but I like it this way :-) > I am using an HP ScanJet 6300 C via its SCSI-interface. It has 5 buttons at > the front side. Looking into the list of supported devices of libsane, you'll find that the HP 6300C has complete support. Looking into the sources of scanbuttond I don't see any support. So, scanbd with libsane will do the trick if querying the button-options is implemented in the backend for the HP6300C ... Just make a test ... -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org
Re: [sane-devel] [sane-genesys] Support for Plustek Smartscan PL1500 - chip GL843
Hi, This scanner didn't appeared on http://www.sane-project.org/sane-mfgs.html since my last mail, do I have something else to do ? I have seen that in genesys_devices.c, there is some model specific properties, so I think that I had no chance to get it work with the ubuntu tutorial (edition of /etc/sane.d/dll.conf and /etc/sane.d/genesys.conf). I have seen in mailing list archive that Plustek offered some helps to develop sane backends, but no news since then. [1] http://lists.alioth.debian.org/pipermail/sane-devel/2016-November/034854.html [2] http://lists.alioth.debian.org/pipermail/sane-devel/2016-November/034872.html Does the genesys sane back-end development is stopped until some news from Plustek ?In the thread, Gerhard Jäger said that in the good old days I did a similar thing for the Plustek backend. In fact I had an NDA and the allowance to use their code - in fact Windoze driver code. http://lists.alioth.debian.org/pipermail/sane-devel/2016-November/034865.html Do I have any chance to achieve to find the good values for genesys_devices.c ? Is it sufficient for enabling support for this scanner ? I have some programming skills, but mainly in java, however, C doesn't afraid me too much. Linux shell is ok. Where do I have to start ? - Decompilation ? I have done some decompilation in java, but never in C, what (affordable) software can I use ? (IDA is a bit expensive). - USB sniffing ? Same question, what software do you advise ? - Other ? Thank'sQuentin B. Le Dimanche 2 avril 2017 17h49, Quentin B. a écrit : Hi, I have a Plustek SmartOffice PL1500 ADF scanner, do not work out of the box, I would like to help to get it supported. http://plustek.com/uk/products/workgroup-scanners/smartoffice-pl1500/ It's not referenced here : http://www.sane-project.org/sane-mfgs.html so I asked for an addition here : http://www.meier-geinitz.de/tinc It doesn't have either closed source drivers for Linux, drivers are available from Windows XP to 10 and are "Twain compatible". Some infos : $ sudo sane-find-scanner found USB scanner (vendor=0x07b3 [PLUSTEK INC], product=0x0c1f [USB2.0 SCANNER], chip=GL843) at libusb:001:010 I use Ubuntu 16.10 with sane-backends Version: 1.0.25+git20150528-1ubuntu2 sane-genesys man page say that GL843 is supported ( http://manpages.ubuntu.com/manpages/yakkety/man5/sane-genesys.5.html ) So I tried to add support for it by following those basics steps : https://help.ubuntu.com/community/SANE%20-%20Installing%20a%20scanner%20that%20isn%27t%20auto-detected That doesn't helped. This command may give interesting infos : $ SANE_DEBUG_GENESYS=255 scanimage -L [genesys] attach: vendor 1971 product 3103 is not supported by this backend 1971 and 3103 are decimal values of vendor and product ids . Could anyone help me ? Thanks Quentin B. PS : Full output : of scanimage -L : $ SANE_DEBUG_GENESYS=255 scanimage -L [sanei_debug] Setting debug level of genesys to 255. [genesys] SANE Genesys backend version 1.0 build 2506 from sane-backends 1.0.25git [genesys] SANE Genesys backend built with libusb-1.0 [genesys] sane_init: authorize != null [genesys] sane_init: little endian machine [genesys] probe_genesys_devices start [genesys] attach: start: devp != NULL, may_wait = 0 [genesys] attach: trying to open device `libusb:001:006' [genesys] attach: device `libusb:001:006' successfully opened [genesys] attach: vendor 1971 product 3103 is not supported by this backend [genesys] attach_one_device: Invalid argument [genesys] probe_genesys_devices: 0 devices currently attached [genesys] probe_genesys_devices completed [genesys] sane_genesys_init completed [genesys] sane_get_devices: start: local_only = false [genesys] probe_genesys_devices start [genesys] attach: start: devp != NULL, may_wait = 0 [genesys] attach: trying to open device `libusb:001:006' [genesys] attach: couldn't open device `libusb:001:006': Invalid argument [genesys] attach_one_device: Invalid argument [genesys] probe_genesys_devices: 0 devices currently attached [genesys] probe_genesys_devices completed [genesys] sane_genesys_get_devices completed No scanners were identified. If you were expecting something different, check that the scanner is plugged in, turned on and detected by the sane-find-scanner tool (if appropriate). Please read the documentation which came with this software (README, FAQ, manpages). [genesys] sane_genesys_exit start [genesys] sane_genesys_exit completed PS2 : Almost full output of sane-find-scanner -v -v : $sudo sane-find-scanner -v -v This is sane-find-scanner from sane-backends 1.0.25git # sane-find-scanner will now attempt to detect your scanner. If the # result is different from what you expected, first make sure your # scanner is powered up and properly connected to your computer. bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 255 bDeviceSubClass 255 bDeviceProtocol 255 bMaxPacketSiz
[sane-devel] SCSI-scanner & scanbuttond ...
Dear listmembers, prior to actually start playing around: can scanbuttond work with a SCSI - scanner? I know, it is oldfashioned, but I like it this way :-) I am using an HP ScanJet 6300 C via its SCSI-interface. It has 5 buttons at the front side. Thank you very much, regards Dieter Jurzitza -- --- Dr.-Ing. Dieter Jurzitza76131 Karlsruhe -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org