[sane-devel] Which Scanners are supportet by an older SANE Version?

2012-12-12 Thread Ruediger Meier
On Wednesday 12 December 2012, Kocher, Emil wrote:
 Hello,

 we have a lot of Thin Clients with the SANE version 1.0.20 installed.
 We can?t make an update to the latest version. I need a list of
 scanners that are supported by this version, because i must know
 which scanner model we could buy. On the SANE Website only a list of
 scanners is available that are supported with the latest SANE
 version. Do someone have a list with scanners supported by SANE
 1.0.20? We need a Scanner type that works with our version, and is
 available to buy.

If you have also a real machine within your network then you could run a 
recent sane version there and use it as net backend on your thin 
clients.

cu,
Rudi



[sane-devel] [PATCH 2/2] sane-config fix, don't provide random infos

2012-09-06 Thread Ruediger Meier
On Monday 03 September 2012, Nils Philippsen wrote:
 Hi there,

 I should probably monitor sane-devel more closely (sue me ;-)).

 On Tue, 2012-02-07 at 21:24 +0100, Ruediger Meier wrote:
  From: Ruediger Meier ruediger.meier at ga-group.nl
 
  This got broken in 26ea2a25.
  If we configure --prefix=/tmp/bla then /tmp/bla/bin/sane-config
  should tell us the right things instead of using any default search
  paths. ---
   tools/sane-config.in |4 
   1 files changed, 4 insertions(+), 0 deletions(-)
 
  diff --git a/tools/sane-config.in b/tools/sane-config.in
  index 1fae2e5..8e4b52a 100644
  --- a/tools/sane-config.in
  +++ b/tools/sane-config.in
  @@ -10,6 +10,10 @@ scriptname=sane-config
   prefix=@prefix@
   exec_prefix=@exec_prefix@
 
  +# using our installed *.pc only - neither default nor user paths
  +export PKG_CONFIG_LIBDIR=@libdir@/pkgconfig
  +export PKG_CONFIG_PATH=
  +

 Well, this ^^ broke multilib again in 1.0.23 (but it's really my
 fault for not spotting this earlier): it makes the sane-config script
 differ between 32bit and 64bit installation, which prevents
 installing both 32bit and 64bit versions of development packages
 (which usually contain it) on the same machine, see:

 https://admin.fedoraproject.org/updates/FEDORA-2012-13142/sane-backen
ds-1.0.23-1.fc17

 I agree that there should be a way to have sane-config produce the
 correct information if someone installs sane-backends into a private
 prefix (as long as we have it -- can we get rid of it pretty
 please?), but it should also work for both bit sizes when installed
 system-wide. I mean if someone used sane-config installed into
 /usr/bin it should work for building binaries for either ix86 or
 x86_64 if both variants are available. This was the intention of my
 original patch, i.e. defer the decision about 32bit/64bit to
 pkg-config which uses /usr/lib64/pkgconfig or /usr/lib/pkgconfig
 respectively, depending on the desired variant (i.e. default or
 whatever the user selected with setarch).

As I mentioned in one of my other emails in this thread I'd recommend to 
declare sane-config deprecated (print a warning) to let developers use 
pkg-config directly.
This is IMO much better than changing sane-config's current behavior 
just to make it usable for multiarch cases where it wasn't made for.

 BTW, now that I think about it the patch above will become faulty as
 soon as our *.pc file correctly specifies dependencies, i.e. listing
 libraries on which sane-backends depends on the Requires: line
 instead of hard-coding the flags in libs. In that case, pkg-config
 won't know what flags to use since we forbade it to look in its
 default location.

 Any ideas how to tackle this conundrum?

You could provide patches to 3rd party projects which are currently 
using sane-config to use pkg-config instead. Note that then these 
projects will require sane-backends = 1.0.23 if you don't keep a 
sane-config fallback.

cu,
Rudi



[sane-devel] Schedule for release of sane-backends 1.0.23

2012-07-23 Thread Ruediger Meier
On Thursday 19 July 2012, m. allan noah wrote:
 There is quite a bit of updated code (and many months) since our last
 release. In particular, there have been some bug fixes to regressions
 in a couple backends, and some major additions to others (genesys,
 pixma, fujitsu, etc). Seems like it is time for a release.

 Timetable:
 Jul 29, 2012: Feature freeze (only bugs + documentation updates)
 Aug 5, 2012: Code freeze (only horrible bugs + documentation updates)
 Aug 12, 2012: Release

 Speak up now if this timetable needs to change.

As I've mentioned several times on this list sane-config is still 
completely broken. IMO it would be a pity if you release it in current 
state. Please consider the fix I've sent to the list some time ago
http://lists.alioth.debian.org/pipermail/sane-devel/2012-February/029498.html

cu,
Rudi



[sane-devel] Schedule for next SANE's release

2012-06-12 Thread Ruediger Meier
On Monday 11 June 2012, stef wrote:
 Le 11/06/2012 20:29, m. allan noah a ?crit :
  How about late July?
 
  allan
 
  On Mon, Jun 11, 2012 at 2:28 PM, stef stef.dev at free.fr wrote:
  Hello,
 
  when our next release is planned ? Last release is more than
  one year old, and I think that quite some  bugs and help requests
  could have been avoided by  releasing latest backends version. I
  don't feel it is that urgent,  but is is worth thinking of.
 
  Regards,
  Stef
 
  --
  sane-devel mailing list: sane-devel at 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-request at lists.alioth.debian.org

  Well,

  this is perfect for me. That let me the time to tidy up
 documentation and test thoroughly all my scanners.

BTW sane-config is still broken. I'd posted a patch about half a year 
ago.


cu,
Rudi



[sane-devel] xsane source repositories

2012-03-28 Thread Ruediger Meier
On Monday 26 March 2012, Stef wrote:
 Le vendredi 23 mars 2012 11:33:49 Michael Nagel a ?crit :
  Hello Ruediger,
 
  I initiated a short discussion about putting the xsane soruce code
  under version control:
 
  http://lists.alioth.debian.org/pipermail/sane-devel/2012-January/02
 9417.html
  http://lists.alioth.debian.org/pipermail/sane-devel/2012-January/02
 9418.htm l
  http://lists.alioth.debian.org/pipermail/sane-devel/2012-February/0
 29574.ht ml
  http://lists.alioth.debian.org/pipermail/sane-devel/2012-February/0
 29576.ht ml
 
  I'd really like to hear your opinion on the topic.
 
  Best Regards  Thanks in Advance
  Michael

   Hello,

   why do you need such a repository ? The aforementioned mails don't
 explain it. Would sending patches to Oliver be enough ?

I don't think there is any explanation needed why a public VCS should be 
used for _any_ (open source) project...
Of course the lack of an existing VCS repo indicates already that the 
author has probably no sense for it. So probably it's waste of time to 
ask for it. 

cu,
Rudi



[sane-devel] [PATCH 0/2] fixes for sane-config and sane-backends.pc

2012-03-26 Thread Ruediger Meier
On Tuesday 07 February 2012, Ruediger Meier wrote:
 From: Ruediger Meier ruediger.meier at ga-group.nl

 sane-config was broken in 2 ways, since 26ea2a25.

 Ruediger Meier (2):
   bldchn fix, install sane-backends.pc
   sane-config fix, don't provide random infos

It's been a long time now, sane-config is still broken.
Maybe anybody could look through it?


  tools/Makefile.am|3 +++
  tools/Makefile.in|   49
 ++---
 tools/sane-config.in |4 
  3 files changed, 45 insertions(+), 11 deletions(-)

 --
 1.7.6.1

cu,
Rudi



[sane-devel] xsane source repositories

2012-02-26 Thread Ruediger Meier
On Saturday 25 February 2012, Michael Nagel wrote:
 Hi Ruediger,

  I am looking for an official, public repository of the xsane
  source code. Is there such a thing, and if yes, where is it?
 
  Don't think there is one - just tar balls.

 In my personal opinion it's no longer up to current
 development/publication standards to only release tarballs nowadays
 for open source projects. Therefore I'd be interested to see your
 repository on github (or a similarly public place).

It's already there
https://github.com/rudimeier/xsane

I guess I've omitted some stupid (unintended disributed) files like *.o, 
*~ etc. Don't remember exactly because it's a month ago.
In doubt you may diff at least the last commit against the original tar 
ball.


 An officially 
 blessed/advertised repository would be even better, of course. And
 the best thing (in my opinion) would be to really do the development
 using a distributed version control system.

xsane looks a bit dead anyway. Last release is more than 3 years ago.
I'd planned to fix some issues I have and ask Oliver Rauch what's going 
on with xsane but actually I haven't done it yet.


 Of course I cannot demand a official git repository, and if tarballs
 work better for the developers so be it, but I really only see
 advantages with distributed version control vs. tarballs. I'd be
 interested to learn any reasons speaking against version control. If
 there are no counter-arguments, I think it would be a great idea to
 start mirroring the tarballs in a git repo and work towards making
 that repository official...


cu,
Rudi



[sane-devel] [PATCH 0/2] fixes for sane-config and sane-backends.pc

2012-02-07 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

sane-config was broken in 2 ways, since 26ea2a25.

Ruediger Meier (2):
  bldchn fix, install sane-backends.pc
  sane-config fix, don't provide random infos

 tools/Makefile.am|3 +++
 tools/Makefile.in|   49 ++---
 tools/sane-config.in |4 
 3 files changed, 45 insertions(+), 11 deletions(-)

-- 
1.7.6.1




[sane-devel] [PATCH 2/2] sane-config fix, don't provide random infos

2012-02-07 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

This got broken in 26ea2a25.
If we configure --prefix=/tmp/bla then /tmp/bla/bin/sane-config should
tell us the right things instead of using any default search paths.
---
 tools/sane-config.in |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/sane-config.in b/tools/sane-config.in
index 1fae2e5..8e4b52a 100644
--- a/tools/sane-config.in
+++ b/tools/sane-config.in
@@ -10,6 +10,10 @@ scriptname=sane-config
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 
+# using our installed *.pc only - neither default nor user paths
+export PKG_CONFIG_LIBDIR=@libdir@/pkgconfig
+export PKG_CONFIG_PATH=
+
 pkgconfig_package=sane-backends
 
 usage ()
-- 
1.7.6.1




[sane-devel] [PATCH 1/2] bldchn fix, install sane-backends.pc

2012-02-07 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

It's required by sane-config since 26ea2a25.
---
 tools/Makefile.am |3 +++
 tools/Makefile.in |   49 ++---
 2 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/tools/Makefile.am b/tools/Makefile.am
index f52a39a..7c2a616 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -48,6 +48,9 @@ EXTRA_DIST += hotplug/README hotplug/libusbscanner
 EXTRA_DIST += hotplug-ng/README hotplug-ng/libsane.hotplug
 EXTRA_DIST += openbsd/attach openbsd/detach
 
+pkgconfigdir = @libdir@/pkgconfig
+pkgconfig_DATA = sane-backends.pc
+
 # When build directory is not same as source directory then any
 # subdirectories that targets use must be manually created (under
 # the build directory that is).
diff --git a/tools/Makefile.in b/tools/Makefile.in
index b95c792..49cbd71 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -16,6 +16,7 @@
 @SET_MAKE@
 
 
+
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -50,7 +51,8 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/include/sane/config.h
 CONFIG_CLEAN_FILES = sane-config sane-backends.pc
 CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(bindir)
+am__installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) \
+   $(DESTDIR)$(pkgconfigdir)
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
 am_gamma4scanimage_OBJECTS = gamma4scanimage.$(OBJEXT)
 gamma4scanimage_OBJECTS = $(am_gamma4scanimage_OBJECTS)
@@ -105,6 +107,7 @@ SOURCES = $(gamma4scanimage_SOURCES) $(sane_desc_SOURCES) \
$(sane_find_scanner_SOURCES) $(umax_pp_SOURCES)
 DIST_SOURCES = $(gamma4scanimage_SOURCES) $(sane_desc_SOURCES) \
$(sane_find_scanner_SOURCES) $(umax_pp_SOURCES)
+DATA = $(pkgconfig_DATA)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -309,6 +312,8 @@ umax_pp_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=umax_pp_low
 umax_pp_LDADD = ../sanei/libsanei.la ../lib/liblib.la @MATH_LIB@
 sane_desc_SOURCES = sane-desc.c
 sane_desc_LDADD = ../sanei/libsanei.la ../lib/liblib.la
+pkgconfigdir = @libdir@/pkgconfig
+pkgconfig_DATA = sane-backends.pc
 all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
 
@@ -529,6 +534,26 @@ mostlyclean-libtool:
 
 clean-libtool:
-rm -rf .libs _libs
+install-pkgconfigDATA: $(pkgconfig_DATA)
+   @$(NORMAL_INSTALL)
+   test -z $(pkgconfigdir) || $(MKDIR_P) $(DESTDIR)$(pkgconfigdir)
+   @list='$(pkgconfig_DATA)'; test -n $(pkgconfigdir) || list=; \
+   for p in $$list; do \
+ if test -f $$p; then d=; else d=$(srcdir)/; fi; \
+ echo $$d$$p; \
+   done | $(am__base_list) | \
+   while read files; do \
+ echo  $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'; \
+ $(INSTALL_DATA) $$files $(DESTDIR)$(pkgconfigdir) || exit $$?; \
+   done
+
+uninstall-pkgconfigDATA:
+   @$(NORMAL_UNINSTALL)
+   @list='$(pkgconfig_DATA)'; test -n $(pkgconfigdir) || list=; \
+   files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+   test -n $$files || exit 0; \
+   echo  ( cd '$(DESTDIR)$(pkgconfigdir)'  rm -f $$files ); \
+   cd $(DESTDIR)$(pkgconfigdir)  rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -615,9 +640,9 @@ distdir: $(DISTFILES)
 check-am: all-am
 check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(PROGRAMS) $(SCRIPTS)
+all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)
 installdirs:
-   for dir in $(DESTDIR)$(bindir) $(DESTDIR)$(bindir); do \
+   for dir in $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) 
$(DESTDIR)$(pkgconfigdir); do \
  test -z $$dir || $(MKDIR_P) $$dir; \
done
 install: $(BUILT_SOURCES)
@@ -671,7 +696,7 @@ info: info-am
 
 info-am:
 
-install-data-am:
+install-data-am: install-pkgconfigDATA
 
 install-dvi: install-dvi-am
 
@@ -717,7 +742,8 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
+uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
+   uninstall-pkgconfigDATA
 
 .MAKE: all check install install-am install-strip
 
@@ -729,12 +755,13 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
install-binSCRIPTS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
-   install-pdf install-pdf-am install-ps install-ps-am \
-   install-strip installcheck installcheck-am installdirs \
-   maintainer-clean maintainer-clean-generic mostlyclean \
-   mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-   pdf pdf-am ps ps-am tags uninstall uninstall-am \
-   uninstall-binPROGRAMS uninstall-binSCRIPTS
+   install-pdf install-pdf-am

[sane-devel] [PATCH 2/2] sane-config fix, don't provide random infos

2012-02-07 Thread Ruediger Meier
On Tuesday 07 February 2012, Ruediger Meier wrote:
 From: Ruediger Meier ruediger.meier at ga-group.nl

 This got broken in 26ea2a25.
 If we configure --prefix=/tmp/bla then /tmp/bla/bin/sane-config
 should tell us the right things instead of using any default search
 paths. ---
  tools/sane-config.in |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 diff --git a/tools/sane-config.in b/tools/sane-config.in
 index 1fae2e5..8e4b52a 100644
 --- a/tools/sane-config.in
 +++ b/tools/sane-config.in
 @@ -10,6 +10,10 @@ scriptname=sane-config
  prefix=@prefix@
  exec_prefix=@exec_prefix@

 +# using our installed *.pc only - neither default nor user paths
 +export PKG_CONFIG_LIBDIR=@libdir@/pkgconfig
 +export PKG_CONFIG_PATH=
 +

It's debatable wheather sane-config should find any other 
sane-backends.pc than the cleanly make installed one.

If this would be wanted we could do only
export PKG_CONFIG_PATH=@libdir@/pkgconfig
without touching PKG_CONFIG_LIBDIR.

But IMO that use case is already covered by directly using pkg-config.
The way I did it here we can be more sure to include/link against that 
sane-backends the called sane-config belongs to.

Also it's IMO worth to think about declaring sane-config deprecated to 
remove it completely in some years.

cu,
Rudi

  pkgconfig_package=sane-backends

  usage ()
 --
 1.7.6.1



[sane-devel] Problem compiling scanbd (unkown type u_int8_t)

2012-02-04 Thread Ruediger Meier
On Saturday 04 February 2012, Alexander Tomisch wrote:
 Hello,

 I've tried to compile scanbd on Arch Linux ...


 USE_SCANBUTTOND=yes make -e clean all


 ... and got the following error:

 [...]

 cc -Wall -Wextra -std=c99 -g -DLinux -I../include -Dsyslog=slog
 -DLOG_INFO=SLOG_INFO -DLOG_WARNING=SLOG_WARN
 -DCFG_DIR=/usr/local/etc/scanbd/scanbuttond/backends -fPIC -shared -o
 mustek.so mustek.c
 In file included from ../include/scanbuttond/libusbi.h:22:0,
   from mustek.c:27:
 /usr/include/usb.h:81:2: Fehler: unbekannter Typname: ?u_int8_t?

 [...]

 It seems that scanbd is compiling well but the old scanbuttond not -
 and I did not found any useful information about this error.


 Any hints?

In mustek.c add
#include sys/types.h
before including libusbi.h

Maybe the libusb people should include that directly within usb.h.
You could report the issue there.

cu,
Rudi



[sane-devel] [PATCH v2 12/14] net, call WSAStartup on win32

2012-01-26 Thread Ruediger Meier
On Tuesday 24 January 2012, Chris Bagwell wrote:
 On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier sweet_f_a at gmx.de 
wrote:
  From: Ruediger Meier ruediger.meier at ga-group.nl
 
  We have to do this on win32 before doing winsock2 stuff. It affects
  the whole application so don't know wheather it's right to startup
  and clean it here within the net backend.

 Hmm, I wonder if the net.c backend can make more use of functions
 defined sanei_tcp.c?  I've added the same logic there to open and
 close for use by TCP sockets in epson2 backend.  Maybe the patch with
 net_read() and net_write() could make use of something there as well?

Generally I'd also like to re-use code to avoid duplicates but here I'm 
not happy with sanei_tcp/udp because of several reasons. 

1. sanei_tcp/udp does not support ipv6
2. sanei_tcp_read() is IMO broken since 581b94fb.
3. Most socket stuff is the same for udp and tcp so sanei_[tcp|udp] are   
   IMO doomed anyway.

Also switching to these global helpers would mix my win32-port changes 
with generic refactoring and increases the risk that anything I do 
could affect current bahavior.

Nevertheless I'd really like to help fixing and cleaning up network 
stuff in separate patch-sets later. This would probably make even more 
backends portable (and ipv6 ready!).

For now I hope it's ok to commit my net.c changes as they are.
I've re-rolled them according to you other comments. Please pull from my 
private clone
git://github.com/rudimeier/sane-backends.git
branch win32/net-v3

or I can also post it again on the list if wanted.

cu,
Rudi

 Chris

  ---
  ?backend/net.c | ? 15 +++
  ?1 files changed, 15 insertions(+), 0 deletions(-)
 
  diff --git a/backend/net.c b/backend/net.c
  index 0cd7f51..228bd59 100644
  --- a/backend/net.c
  +++ b/backend/net.c
  @@ -1016,6 +1016,18 @@ sane_init (SANE_Int * version_code,
  SANE_Auth_Callback authorize) DBG (3, sane_init: Client has little
  endian byte order\n); }
 
  +#ifdef _WIN32
  + ? ?{
  + ? ? ?/* no much fun on win32 without WSAStartup but is this the
  right place? */ + ? ? ?WSADATA data;
  + ? ? ?int wsa_err = WSAStartup( MAKEWORD(2, 2), data) != 0;
  + ? ? ?if ( wsa_err != 0 )
  + ? ? ? {
  + ? ? ? ? DBG (1, sane_init: WSAStartup failed with error %d\n,
  wsa_err ); + ? ? ? }
  + ? ?}
  +#endif
  +
  ?#ifndef NET_USES_AF_INDEP
  ? DBG (2, sane_init: determining sane service port\n);
  ? serv = getservbyname (sane-port, tcp);
  @@ -1196,6 +1208,9 @@ sane_exit (void)
  ? ? ? ?}
  ? ? ? free (devlist);
  ? ? }
  +#ifdef _WIN32
  + ?WSACleanup();
  +#endif
  ? DBG (3, sane_exit: finished.\n);
  ?}
 
  --
  1.7.6.1
 
 
  --
  sane-devel mailing list: sane-devel at 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-request at lists.alioth.debian.org





[sane-devel] [PATCH v2 04/14] bldchn, checking for socklen_t more safe

2012-01-25 Thread Ruediger Meier
On Tuesday 24 January 2012, Chris Bagwell wrote:
 On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier sweet_f_a at gmx.de 
wrote:
  From: Ruediger Meier ruediger.meier at ga-group.nl
 
  Here I just want to fix conflicts for win32 systems. Generally I'd
  say that we should never #define socklen_t int within config.h.
  But this may decide somebody else.
 
  Note this patch may break the build on systems where socklen_t is
  available now but the right headers are not included yet. For
  example for win32 you need to add
  ?#ifdef HAVE_WS2TCPIP_H
  ?#include ws2tcpip.h
  ?#endif
  wherever socklen_t is used.
  ---
  ?configure ? ?| ? 14 +++---
  ?configure.in | ? 12 ++--
  ?2 files changed, 21 insertions(+), 5 deletions(-)
 
  diff --git a/configure b/configure
  index 5da8db8..ba1df33 100755
  --- a/configure
  +++ b/configure
  @@ -8257,12 +8257,20 @@ rm -f core conftest.err conftest.$ac_objext
  conftest.$ac_ext { $as_echo $as_me:${as_lineno-$LINENO}: result:
  $have_long_long 5 $as_echo $have_long_long 6; }
 
  -{ $as_echo $as_me:${as_lineno-$LINENO}: checking for socklen_t in
  sys/socket.h 5 -$as_echo_n checking for socklen_t in
  sys/socket.h...  6; } +{ $as_echo
  $as_me:${as_lineno-$LINENO}: checking for socklen_t 5
  +$as_echo_n checking for socklen_t...  6; }
  ?cat confdefs.h - _ACEOF conftest.$ac_ext
  ?/* end confdefs.h. ?*/
 
  -#include sys/socket.h
  +#ifdef HAVE_SYS_SOCKET_H
  +# include sys/socket.h
  +#endif
  +#ifdef HAVE_WINSOCK2_H
  +# include winsock2.h
  +#endif
  +#ifdef HAVE_WS2TCPIP_H
  +# include ws2tcpip.h
  +#endif
 
  ?int
  ?main ()
  diff --git a/configure.in b/configure.in
  index 060b8b6..b30dd92 100644
  --- a/configure.in
  +++ b/configure.in
  @@ -232,9 +232,17 @@ have_long_long=no
  ?AC_TRY_COMPILE([], [long long x; x = (long long)0;],
  AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the long long type is
  available.]) have_long_long=yes) AC_MSG_RESULT($have_long_long)
 
  -AC_MSG_CHECKING([for socklen_t in sys/socket.h])
  +AC_MSG_CHECKING([for socklen_t])
  ?AC_TRY_COMPILE([
  -#include sys/socket.h
  +#ifdef HAVE_SYS_SOCKET_H
  +# include sys/socket.h
  +#endif
  +#ifdef HAVE_WINSOCK2_H
  +# include winsock2.h
  +#endif
  +#ifdef HAVE_WS2TCPIP_H
  +# include ws2tcpip.h
  +#endif
  ?],[socklen_t len],AC_MSG_RESULT(yes),
  ?[AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int,
  ?[Define socklen_t as \'int\' if necessary.])])

 Since we are changing this, maybe we should change to more proper
 AC_CHECK_TYPES as well?  That would require adding an #ifndef
 HAVE_SOCKELEN_T towards bottom of acinclude.m4 to match it.


Fine, but then I'd go even a step further like I've mentioned in my 
commit message above - never _define_ such types in config.h. Better 
only using
AC_CHECK_TYPES([socklen_t],,,[some includes];

This will replace
#define socklen_t int
by
#undef HAVE_SOCKLEN_T

Then we'd need to do 
  #ifdef HAVE_SOCKLEN_T
typedef int socklen_t;
  #endif
wherever we use it or even better within a central header sane_types.h 
(maybe we have such header yet!?). In the long term I would do this for 
all types we are currently defining in config.h (*).

Actually we are using socklen_t only within 5 files
backend/dell1600n_net.c
backend/net.c
backend/pixma_bjnp.c
frontend/saned.c
sanei/sanei_udp.c

So I'd like to post that AC_CHECK_TYPES([socklen_t]) patch separately 
from this win32/net series and you as a global maintainer may decide 
wheather and where to put the missing typedefs.  


(*) see also
http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.68/html_node/Obsolete-Macros.html#Obsolete-Macros
18.4 Obsolete Macros
? Macro: AC_CHECK_TYPE (type, default)


cu Rudi






[sane-devel] [PATCH 2/2] fix sanei_udp, socklen_t was not defined on win32

2012-01-25 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Signed-off-by: Ruediger Meier ruediger.meier at ga-group.nl
---
 sanei/sanei_udp.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sanei/sanei_udp.c b/sanei/sanei_udp.c
index ab316ea..baf4ee9 100644
--- a/sanei/sanei_udp.c
+++ b/sanei/sanei_udp.c
@@ -50,6 +50,9 @@
 #ifdef HAVE_WINSOCK2_H
 #include winsock2.h
 #endif
+#ifdef HAVE_WS2TCPIP_H
+#include ws2tcpip.h
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include sys/socket.h
 #include netinet/in.h
@@ -63,6 +66,10 @@
 #include ../include/sane/sanei_debug.h
 #include ../include/sane/sanei_udp.h
 
+#ifdef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
 static SANE_Status
 sanei_udp_socket(int *fdp, int broadcast)
 {
-- 
1.7.6.1




[sane-devel] [PATCH 0/2] don't define socklen_t in config.h

2012-01-25 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

As discussed here
http://lists.alioth.debian.org/pipermail/sane-devel/2012-January/029424.html
I post this patches separately from my other win32/net series.

I've fixed possible build failures caused by the first patch only in
sanei/sanei_udp.c so far because this is currently the only (central) unit
there this issue may matter in real life.


Ruediger Meier (2):
  bldchn, checking for socklen_t more safe
  fix sanei_udp, socklen_t was not defined on win32

 configure|   37 -
 configure.in |   17 +++--
 include/sane/config.h.in |6 +++---
 sanei/sanei_udp.c|7 +++
 4 files changed, 37 insertions(+), 30 deletions(-)

-- 
1.7.6.1




[sane-devel] [PATCH 1/2] bldchn, checking for socklen_t more safe

2012-01-25 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

This patch is needed because currently we fail always where both
ws2tcpip.h and socklen_t is needed.

Now there is no #define socklen_t int in config.h anymore. Thus you
have to do
  #ifdef HAVE_SOCKLEN_T
typedef int socklen_t;
  #endif
wherever it's needed.

Note this patch may also discover missing includes on systems where
socklen_t is available but the right headers are not included yet.
For example on win32 we need
  #ifdef HAVE_WS2TCPIP_H
  # include ws2tcpip.h
  #endif

Further patches should fix this.

Signed-off-by: Ruediger Meier ruediger.meier at ga-group.nl
---
 configure|   37 -
 configure.in |   17 +++--
 include/sane/config.h.in |6 +++---
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/configure b/configure
index ba864b0..606b8e9 100755
--- a/configure
+++ b/configure
@@ -8257,31 +8257,26 @@ rm -f core conftest.err conftest.$ac_objext 
conftest.$ac_ext
 { $as_echo $as_me:${as_lineno-$LINENO}: result: $have_long_long 5
 $as_echo $have_long_long 6; }
 
-{ $as_echo $as_me:${as_lineno-$LINENO}: checking for socklen_t in 
sys/socket.h 5
-$as_echo_n checking for socklen_t in sys/socket.h...  6; }
-cat confdefs.h - _ACEOF conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include sys/socket.h
+ac_fn_c_check_type $LINENO socklen_t ac_cv_type_socklen_t 
$ac_includes_default
+#ifdef HAVE_NETDB_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+#ifdef HAVE_WS2TCPIP_H
+# include ws2tcpip.h
+#endif
+
+if test x$ac_cv_type_socklen_t = xyes; then :
 
-int
-main ()
-{
-socklen_t len
-  ;
-  return 0;
-}
+cat confdefs.h _ACEOF
+#define HAVE_SOCKLEN_T 1
 _ACEOF
-if ac_fn_c_try_compile $LINENO; then :
-  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
-$as_echo yes 6; }
-else
-  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
-$as_echo no 6; };
-$as_echo #define socklen_t int confdefs.h
+
 
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 
 { $as_echo $as_me:${as_lineno-$LINENO}: checking for union semun in 
sys/sem.h 5
 $as_echo_n checking for union semun in sys/sem.h...  6; }
diff --git a/configure.in b/configure.in
index 6fac904..8fc0fcb 100644
--- a/configure.in
+++ b/configure.in
@@ -232,12 +232,17 @@ have_long_long=no
 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG, 
1, [Define if the long long type is available.]) have_long_long=yes)
 AC_MSG_RESULT($have_long_long)
 
-AC_MSG_CHECKING([for socklen_t in sys/socket.h])
-AC_TRY_COMPILE([
-#include sys/socket.h
-],[socklen_t len],AC_MSG_RESULT(yes),
-[AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int,
-[Define socklen_t as \'int\' if necessary.])])
+AC_CHECK_TYPES([socklen_t],,,
+[$ac_includes_default
+#ifdef HAVE_NETDB_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+#ifdef HAVE_WS2TCPIP_H
+# include ws2tcpip.h
+#endif])
 
 AC_MSG_CHECKING([for union semun in sys/sem.h])
 AC_TRY_COMPILE([
diff --git a/include/sane/config.h.in b/include/sane/config.h.in
index 00c8669..fb78824 100644
--- a/include/sane/config.h.in
+++ b/include/sane/config.h.in
@@ -282,6 +282,9 @@
 /* Define to 1 if you have the `snprintf' function. */
 #undef HAVE_SNPRINTF
 
+/* Define to 1 if the system has the type `socklen_t'. */
+#undef HAVE_SOCKLEN_T
+
 /* Define to 1 if you have the stdint.h header file. */
 #undef HAVE_STDINT_H
 
@@ -584,9 +587,6 @@
 /* Define to `unsigned int' if sys/types.h does not define. */
 #undef size_t
 
-/* Define socklen_t as \'int\' if necessary. */
-#undef socklen_t
-
 /* Define to `long' if sys/types.h does not define. */
 #undef ssize_t
 
-- 
1.7.6.1




[sane-devel] [PATCH 0/2] don't define socklen_t in config.h

2012-01-25 Thread Ruediger Meier
On Wednesday 25 January 2012, Ruediger Meier wrote:
 From: Ruediger Meier ruediger.meier at ga-group.nl

 As discussed here
 http://lists.alioth.debian.org/pipermail/sane-devel/2012-January/0294
24.html I post this patches separately from my other win32/net series.

 I've fixed possible build failures caused by the first patch only in
 sanei/sanei_udp.c so far because this is currently the only (central)
 unit there this issue may matter in real life.

OMG, please forget about this patch-set!
Beside the fact that I've screwed up some ifdefs I've changed my mind to 
better not introducing typeset socklen_t yet.

I'll resend it as a single squashed patch in reply to this email. 

cu,
Rudi



 Ruediger Meier (2):
   bldchn, checking for socklen_t more safe
   fix sanei_udp, socklen_t was not defined on win32

  configure|   37
 - configure.in |   17
 +++--
  include/sane/config.h.in |6 +++---
  sanei/sanei_udp.c|7 +++
  4 files changed, 37 insertions(+), 30 deletions(-)

 --
 1.7.6.1



[sane-devel] [PATCH v2] bldchn, checking for socklen_t more safe

2012-01-25 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

This patch is needed because currently we fail always where both
ws2tcpip.h and socklen_t is needed.

Note this patch may discover missing includes on systems where
socklen_t is available but the right headers are not included yet.
For example on win32 we need
  #ifdef HAVE_WS2TCPIP_H
  # include ws2tcpip.h
  #endif

Further patches should fix this. Here we do that for sanei/sanei_udp.c only
because this seems to be the only affected unit which would compile on win32
anyway.

Signed-off-by: Ruediger Meier ruediger.meier at ga-group.nl
---
 ChangeLog|4 
 acinclude.m4 |3 +++
 configure|   46 +-
 configure.in |   19 ---
 include/sane/config.h.in |   12 +---
 sanei/sanei_udp.c|4 
 6 files changed, 53 insertions(+), 35 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2983e24..d169da8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-01-25 Ruediger Meier sweet_f_a at gmx.de
+   * acinclude.m4, configure.in, sanei/sanei_udp.c:
+   checking for socklen_t more safe
+
 2012-01-23 Rolf Bensch rolf at bensch hyphen online dot de
* backend/pixma_mp150, doc/descriptions/pixma.desc, doc/sane-pixma.man:
New scanner PIXMA MX880 Series.
diff --git a/acinclude.m4 b/acinclude.m4
index d91c733..904a226 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -669,6 +669,9 @@ AH_BOTTOM([
 #define _BSDTYPES_DEFINED
 #endif
 
+#ifndef HAVE_SOCKLEN_T
+#define socklen_t int
+#endif
 #ifndef HAVE_U_CHAR
 #define u_char unsigned char
 #endif
diff --git a/configure b/configure
index ba864b0..10c3361 100755
--- a/configure
+++ b/configure
@@ -8059,12 +8059,13 @@ done
   fi
 
 
-for ac_header in winsock2.h
+for ac_header in winsock2.h ws2tcpip.h
 do :
-  ac_fn_c_check_header_mongrel $LINENO winsock2.h 
ac_cv_header_winsock2_h $ac_includes_default
-if test x$ac_cv_header_winsock2_h = xyes; then :
+  as_ac_Header=`$as_echo ac_cv_header_$ac_header | $as_tr_sh`
+ac_fn_c_check_header_mongrel $LINENO $ac_header $as_ac_Header 
$ac_includes_default
+if eval test \x\$$as_ac_Header\ = xyes; then :
   cat confdefs.h _ACEOF
-#define HAVE_WINSOCK2_H 1
+#define `$as_echo HAVE_$ac_header | $as_tr_cpp` 1
 _ACEOF
  SOCKET_LIB=-lws2_32
 fi
@@ -8257,31 +8258,26 @@ rm -f core conftest.err conftest.$ac_objext 
conftest.$ac_ext
 { $as_echo $as_me:${as_lineno-$LINENO}: result: $have_long_long 5
 $as_echo $have_long_long 6; }
 
-{ $as_echo $as_me:${as_lineno-$LINENO}: checking for socklen_t in 
sys/socket.h 5
-$as_echo_n checking for socklen_t in sys/socket.h...  6; }
-cat confdefs.h - _ACEOF conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include sys/socket.h
+ac_fn_c_check_type $LINENO socklen_t ac_cv_type_socklen_t 
$ac_includes_default
+#ifdef HAVE_SYS_SOCKET_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+#ifdef HAVE_WS2TCPIP_H
+# include ws2tcpip.h
+#endif
+
+if test x$ac_cv_type_socklen_t = xyes; then :
 
-int
-main ()
-{
-socklen_t len
-  ;
-  return 0;
-}
+cat confdefs.h _ACEOF
+#define HAVE_SOCKLEN_T 1
 _ACEOF
-if ac_fn_c_try_compile $LINENO; then :
-  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
-$as_echo yes 6; }
-else
-  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
-$as_echo no 6; };
-$as_echo #define socklen_t int confdefs.h
+
 
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 
 { $as_echo $as_me:${as_lineno-$LINENO}: checking for union semun in 
sys/sem.h 5
 $as_echo_n checking for union semun in sys/sem.h...  6; }
diff --git a/configure.in b/configure.in
index 6fac904..3b7d42b 100644
--- a/configure.in
+++ b/configure.in
@@ -204,7 +204,7 @@ AC_CHECK_HEADERS([asm/io.h],,,[#include sys/types.h])
 
 SANE_CHECK_MISSING_HEADERS
 
-AC_CHECK_HEADERS(winsock2.h, SOCKET_LIB=-lws2_32)
+AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], SOCKET_LIB=-lws2_32)
 
 AC_CHECK_HEADER(resmgr.h,[
AC_CHECK_LIB(
@@ -232,12 +232,17 @@ have_long_long=no
 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG, 
1, [Define if the long long type is available.]) have_long_long=yes)
 AC_MSG_RESULT($have_long_long)
 
-AC_MSG_CHECKING([for socklen_t in sys/socket.h])
-AC_TRY_COMPILE([
-#include sys/socket.h
-],[socklen_t len],AC_MSG_RESULT(yes),
-[AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int,
-[Define socklen_t as \'int\' if necessary.])])
+AC_CHECK_TYPES([socklen_t], [], [],
+[[$ac_includes_default
+#ifdef HAVE_SYS_SOCKET_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+#ifdef HAVE_WS2TCPIP_H
+# include ws2tcpip.h
+#endif]])
 
 AC_MSG_CHECKING([for union semun in sys/sem.h])
 AC_TRY_COMPILE([
diff --git a/include/sane/config.h.in b/include/sane/config.h.in
index 00c8669..ec4332b 100644
--- a/include/sane/config.h.in
+++ b/include/sane/config.h.in
@@ -282,6 +282,9 @@
 /* Define to 1 if you have the `snprintf

[sane-devel] [PATCH v2 01/14] bldchn, provide macro SANE_CHECK_NETDB_FUNC

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

We want to use it later to do checks for getaddrinfo and getnameinfo
more portable.
---
 acinclude.m4 |   57 +
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index d91c733..38d1819 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -486,6 +486,63 @@ AC_DEFUN([SANE_CHECK_GPHOTO2],
 ])
 
 #
+# Checks for functions which comming usually from netdb.h or ws2tcpip.h (e.g.
+# getaddrinfo). Header checks have to be done before as well as adding the 
right
+# libs 
+AC_DEFUN([SANE_CHECK_NETDB_FUNC],
+[
+  sane_netdb_includes=$ac_includes_default
+  #ifdef HAVE_SYS_SOCKET_H
+  # include sys/socket.h
+  #endif
+  #ifdef HAVE_NETDB_H
+  # include netdb.h
+  #endif
+  #ifdef HAVE_WINSOCK2_H
+  # include winsock2.h
+  #endif
+  #ifdef HAVE_WS2TCPIP_H
+  # include ws2tcpip.h
+  #endif
+
+  ac_cv_func_$1=no
+  need_winver_xp=no
+
+  AC_MSG_CHECKING([for win32 ]$1)
+  AC_TRY_COMPILE(
+[$sane_netdb_includes],
+[int testme(){ ]$1[; }],
+[AC_MSG_RESULT(yes)
+ac_cv_func_$1=yes],
+[AC_MSG_RESULT(no)])
+
+  dnl Under mingw, we may need to set WINVER to 0x0501 to expose the function.
+  if test $ac_cv_func_$1 != yes; then
+AC_MSG_CHECKING([for win32 ]$1[ if WINVER is 0x0501])
+AC_TRY_COMPILE(
+  [#define WINVER 0x0501
+  $sane_netdb_includes],
+  [int testme(){ ]$1[; }],
+  [AC_MSG_RESULT(yes)
+  ac_cv_func_$1=yes
+  need_winver_xp=yes],
+  [AC_MSG_RESULT(no)])
+  fi
+
+  if test $ac_cv_func_$1 = yes; then
+AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), [1],
+  [Define to 1 if you have the `]$1[' function.])
+
+if test $need_winver_xp = yes; then
+  AC_DEFINE([NEED_WINVER_XP], [1],
+[Define to 1 if some win32 functions needs WINVER set.])
+fi
+  fi
+
+  unset sane_netdb_includes
+])
+
+#
 # Check for AF_INET6, determines whether or not to enable IPv6 support
 # Check for ss_family member in struct sockaddr_storage
 AC_DEFUN([SANE_CHECK_IPV6],
-- 
1.7.6.1




[sane-devel] [PATCH v2 00/14] win32 portable net backend

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

v2:
1) PEBKAC fixes in macro SANE_CHECK_NETDB_FUNC
2) ChangeLog updated
3) rebased on 6aeb0527

This patch-set ports the net backend to win32. Maybe we 
could build a useful native (non-cygwin) xsane (saned client) on 
Windows now.

You can pull this patch-set also from my private clone
git://github.com/rudimeier/sane-backends.git
branch win32/net


Ruediger Meier (14):
  bldchn, provide macro SANE_CHECK_NETDB_FUNC
  bldchn, add checks for netdb.h and ws2tcpip.h
  bldchn, use our new macro SANE_CHECK_NETDB_FUNC
  bldchn, checking for socklen_t more safe
  fix sanei_udp, socklen_t was not defined on win32
  bldchn, don't always disable net backend on win32
  net, move some includes from net.h to net.c
  net, add missing includes for win32
  net, re-use sane_set_io_mode
  net, implement O_NONBLOCK stuff for win32
  net, use recv/send instead of read/write
  net, call WSAStartup on win32
  bldchn, SANE_CHECK_IPV6 more portable
  update ChangeLog for previous commits

 ChangeLog|4 +
 acinclude.m4 |   84 ---
 backend/net.c|   54 +++-
 backend/net.h|3 -
 configure|  217 ++
 configure.in |   22 -
 include/sane/config.h.in |9 ++
 sanei/sanei_udp.c|3 +
 8 files changed, 357 insertions(+), 39 deletions(-)

-- 
1.7.6.1




[sane-devel] [PATCH v2 03/14] bldchn, use our new macro SANE_CHECK_NETDB_FUNC

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Now we will find getaddrinfo and getnameinfo on win32 systems.
Note it should be even safe to use that macro for all systems instead of
trying AC_CHECK_FUNCS first. For now I don't want to do such risky things
things and leave it as is.
---
 configure|  169 ++
 configure.in |8 ++
 include/sane/config.h.in |3 +
 3 files changed, 180 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 4c9dfcd..5da8db8 100755
--- a/configure
+++ b/configure
@@ -9508,6 +9508,175 @@ fi
 
 
 
+if test $ac_cv_func_getaddrinfo != yes \
+  || test $ac_cv_func_getnameinfo != yes; then
+
+
+  sane_netdb_includes=$ac_includes_default
+  #ifdef HAVE_SYS_SOCKET_H
+  # include sys/socket.h
+  #endif
+  #ifdef HAVE_NETDB_H
+  # include netdb.h
+  #endif
+  #ifdef HAVE_WINSOCK2_H
+  # include winsock2.h
+  #endif
+  #ifdef HAVE_WS2TCPIP_H
+  # include ws2tcpip.h
+  #endif
+
+  ac_cv_func_getaddrinfo=no
+  need_winver_xp=no
+
+  { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo 5
+$as_echo_n checking for win32 getaddrinfo...  6; }
+  cat confdefs.h - _ACEOF conftest.$ac_ext
+/* end confdefs.h.  */
+$sane_netdb_includes
+int
+main ()
+{
+int testme(){ getaddrinfo; }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile $LINENO; then :
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
+$as_echo yes 6; }
+ac_cv_func_getaddrinfo=yes
+else
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
+$as_echo no 6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_func_getaddrinfo != yes; then
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo if 
WINVER is 0x0501 5
+$as_echo_n checking for win32 getaddrinfo if WINVER is 0x0501...  6; }
+cat confdefs.h - _ACEOF conftest.$ac_ext
+/* end confdefs.h.  */
+#define WINVER 0x0501
+  $sane_netdb_includes
+int
+main ()
+{
+int testme(){ getaddrinfo; }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile $LINENO; then :
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
+$as_echo yes 6; }
+  ac_cv_func_getaddrinfo=yes
+  need_winver_xp=yes
+else
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
+$as_echo no 6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  fi
+
+  if test $ac_cv_func_getaddrinfo = yes; then
+
+$as_echo #define HAVE_GETADDRINFO 1 confdefs.h
+
+
+if test $need_winver_xp = yes; then
+
+$as_echo #define NEED_WINVER_XP 1 confdefs.h
+
+fi
+  fi
+
+  unset sane_netdb_includes
+
+
+  sane_netdb_includes=$ac_includes_default
+  #ifdef HAVE_SYS_SOCKET_H
+  # include sys/socket.h
+  #endif
+  #ifdef HAVE_NETDB_H
+  # include netdb.h
+  #endif
+  #ifdef HAVE_WINSOCK2_H
+  # include winsock2.h
+  #endif
+  #ifdef HAVE_WS2TCPIP_H
+  # include ws2tcpip.h
+  #endif
+
+  ac_cv_func_getnameinfo=no
+  need_winver_xp=no
+
+  { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getnameinfo 5
+$as_echo_n checking for win32 getnameinfo...  6; }
+  cat confdefs.h - _ACEOF conftest.$ac_ext
+/* end confdefs.h.  */
+$sane_netdb_includes
+int
+main ()
+{
+int testme(){ getnameinfo; }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile $LINENO; then :
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
+$as_echo yes 6; }
+ac_cv_func_getnameinfo=yes
+else
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
+$as_echo no 6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_func_getnameinfo != yes; then
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getnameinfo if 
WINVER is 0x0501 5
+$as_echo_n checking for win32 getnameinfo if WINVER is 0x0501...  6; }
+cat confdefs.h - _ACEOF conftest.$ac_ext
+/* end confdefs.h.  */
+#define WINVER 0x0501
+  $sane_netdb_includes
+int
+main ()
+{
+int testme(){ getnameinfo; }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile $LINENO; then :
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
+$as_echo yes 6; }
+  ac_cv_func_getnameinfo=yes
+  need_winver_xp=yes
+else
+  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
+$as_echo no 6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  fi
+
+  if test $ac_cv_func_getnameinfo = yes; then
+
+$as_echo #define HAVE_GETNAMEINFO 1 confdefs.h
+
+
+if test $need_winver_xp = yes; then
+
+$as_echo #define NEED_WINVER_XP 1 confdefs.h
+
+fi
+  fi
+
+  unset sane_netdb_includes
+
+fi
+
 
 
 
diff --git a/configure.in b/configure.in
index 6eb3355..060b8b6 100644
--- a/configure.in
+++ b/configure.in
@@ -308,6 +308,14 @@ AC_CHECK_FUNCS(atexit ioperm i386_set_ioperm \
 AC_REPLACE_FUNCS(getenv isfdtype sigprocmask snprintf \
 strcasestr strdup strndup strsep usleep sleep syslog vsyslog)
 
+dnl Some systems need better ckecks for get*info
+if test $ac_cv_func_getaddrinfo != yes \
+  || test $ac_cv_func_getnameinfo != yes

[sane-devel] [PATCH v2 04/14] bldchn, checking for socklen_t more safe

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Here I just want to fix conflicts for win32 systems. Generally I'd say
that we should never #define socklen_t int within config.h. But this
may decide somebody else.

Note this patch may break the build on systems where socklen_t is
available now but the right headers are not included yet. For example
for win32 you need to add
  #ifdef HAVE_WS2TCPIP_H
  #include ws2tcpip.h
  #endif
wherever socklen_t is used.
---
 configure|   14 +++---
 configure.in |   12 ++--
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 5da8db8..ba1df33 100755
--- a/configure
+++ b/configure
@@ -8257,12 +8257,20 @@ rm -f core conftest.err conftest.$ac_objext 
conftest.$ac_ext
 { $as_echo $as_me:${as_lineno-$LINENO}: result: $have_long_long 5
 $as_echo $have_long_long 6; }
 
-{ $as_echo $as_me:${as_lineno-$LINENO}: checking for socklen_t in 
sys/socket.h 5
-$as_echo_n checking for socklen_t in sys/socket.h...  6; }
+{ $as_echo $as_me:${as_lineno-$LINENO}: checking for socklen_t 5
+$as_echo_n checking for socklen_t...  6; }
 cat confdefs.h - _ACEOF conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include sys/socket.h
+#ifdef HAVE_SYS_SOCKET_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+#ifdef HAVE_WS2TCPIP_H
+# include ws2tcpip.h
+#endif
 
 int
 main ()
diff --git a/configure.in b/configure.in
index 060b8b6..b30dd92 100644
--- a/configure.in
+++ b/configure.in
@@ -232,9 +232,17 @@ have_long_long=no
 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG, 
1, [Define if the long long type is available.]) have_long_long=yes)
 AC_MSG_RESULT($have_long_long)
 
-AC_MSG_CHECKING([for socklen_t in sys/socket.h])
+AC_MSG_CHECKING([for socklen_t])
 AC_TRY_COMPILE([
-#include sys/socket.h
+#ifdef HAVE_SYS_SOCKET_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+#ifdef HAVE_WS2TCPIP_H
+# include ws2tcpip.h
+#endif
 ],[socklen_t len],AC_MSG_RESULT(yes),
 [AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int,
 [Define socklen_t as \'int\' if necessary.])])
-- 
1.7.6.1




[sane-devel] [PATCH v2 05/14] fix sanei_udp, socklen_t was not defined on win32

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 sanei/sanei_udp.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sanei/sanei_udp.c b/sanei/sanei_udp.c
index ab316ea..e9e2bfe 100644
--- a/sanei/sanei_udp.c
+++ b/sanei/sanei_udp.c
@@ -50,6 +50,9 @@
 #ifdef HAVE_WINSOCK2_H
 #include winsock2.h
 #endif
+#ifdef HAVE_WS2TCPIP_H
+#include ws2tcpip.h
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include sys/socket.h
 #include netinet/in.h
-- 
1.7.6.1




[sane-devel] [PATCH v2 02/14] bldchn, add checks for netdb.h and ws2tcpip.h

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 configure|2 +-
 configure.in |2 +-
 include/sane/config.h.in |6 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index ba864b0..4c9dfcd 100755
--- a/configure
+++ b/configure
@@ -8009,7 +8009,7 @@ for ac_header in fcntl.h unistd.h libc.h sys/dsreq.h 
sys/select.h \
 sys/socket.h sys/io.h sys/hw.h sys/types.h linux/ppdev.h \
 dev/ppbus/ppi.h machine/cpufunc.h sys/bitypes.h sys/sem.h sys/poll.h \
 windows.h be/kernel/OS.h limits.h sys/ioctl.h asm/types.h\
-netinet/in.h tiffio.h ifaddrs.h pwd.h getopt.h
+netinet/in.h tiffio.h ifaddrs.h pwd.h getopt.h netdb.h ws2tcpip.h
 do :
   as_ac_Header=`$as_echo ac_cv_header_$ac_header | $as_tr_sh`
 ac_fn_c_check_header_mongrel $LINENO $ac_header $as_ac_Header 
$ac_includes_default
diff --git a/configure.in b/configure.in
index 6fac904..6eb3355 100644
--- a/configure.in
+++ b/configure.in
@@ -199,7 +199,7 @@ AC_CHECK_HEADERS(fcntl.h unistd.h libc.h sys/dsreq.h 
sys/select.h \
 sys/socket.h sys/io.h sys/hw.h sys/types.h linux/ppdev.h \
 dev/ppbus/ppi.h machine/cpufunc.h sys/bitypes.h sys/sem.h sys/poll.h \
 windows.h be/kernel/OS.h limits.h sys/ioctl.h asm/types.h\
-netinet/in.h tiffio.h ifaddrs.h pwd.h getopt.h)
+netinet/in.h tiffio.h ifaddrs.h pwd.h getopt.h netdb.h ws2tcpip.h)
 AC_CHECK_HEADERS([asm/io.h],,,[#include sys/types.h])
 
 SANE_CHECK_MISSING_HEADERS
diff --git a/include/sane/config.h.in b/include/sane/config.h.in
index 00c8669..afeb667 100644
--- a/include/sane/config.h.in
+++ b/include/sane/config.h.in
@@ -207,6 +207,9 @@
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
+/* Define to 1 if you have the netdb.h header file. */
+#undef HAVE_NETDB_H
+
 /* Define to 1 if you have the netinet/in.h header file. */
 #undef HAVE_NETINET_IN_H
 
@@ -441,6 +444,9 @@
 /* Define to 1 if you have the winsock2.h header file. */
 #undef HAVE_WINSOCK2_H
 
+/* Define to 1 if you have the ws2tcpip.h header file. */
+#undef HAVE_WS2TCPIP_H
+
 /* Define to 1 if you have the `_portaccess' function. */
 #undef HAVE__PORTACCESS
 
-- 
1.7.6.1




[sane-devel] [PATCH v2 10/14] net, implement O_NONBLOCK stuff for win32

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 backend/net.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/backend/net.c b/backend/net.c
index 5946a1b..03133d3 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -2363,7 +2363,12 @@ sane_set_io_mode (SANE_Handle handle, SANE_Bool 
non_blocking)
   return SANE_STATUS_INVAL;
 }
 
+#if ! defined _WIN32
   if (fcntl (s-data, F_SETFL, non_blocking ? O_NONBLOCK : 0)  0)
+#else
+  u_long iMode = non_blocking;
+  if (ioctlsocket(s-data, FIONBIO, iMode) != NO_ERROR)
+#endif
 {
   DBG (1, sane_set_io_mode: fcntl failed (%s)\n, strerror (errno));
   return SANE_STATUS_IO_ERROR;
-- 
1.7.6.1




[sane-devel] [PATCH v2 07/14] net, move some includes from net.h to net.c

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

We are doing this allthough these includes are needed in net.h because
1. net.h doesn't have all necessary includes anyway
2. net.c includes the missing headers before net.h
3. we want to add more platform dependent ifdefs to net.c only
---
 backend/net.c |1 +
 backend/net.h |3 ---
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/backend/net.c b/backend/net.c
index 16fba2f..dea36ce 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -64,6 +64,7 @@
 #include sys/time.h
 #include sys/types.h
 
+#include sys/socket.h
 #include netinet/in.h
 #include netdb.h /* OS/2 needs this _after_ netinet/in.h, grrr... */
 
diff --git a/backend/net.h b/backend/net.h
index 7d72fdd..f006164 100644
--- a/backend/net.h
+++ b/backend/net.h
@@ -43,9 +43,6 @@
 #ifndef net_h
 #define net_h
 
-#include sys/types.h
-#include sys/socket.h
-
 #include ../include/sane/sanei_wire.h
 #include ../include/sane/config.h
 
-- 
1.7.6.1




[sane-devel] [PATCH v2 06/14] bldchn, don't always disable net backend on win32

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Building net backend will still fail but how else we could try it.
---
 acinclude.m4 |5 +++--
 configure|   10 ++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 38d1819..7cc4228 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -693,8 +693,9 @@ for be in ${BACKENDS}; do
 ;;
 
 net)
-if test ${ac_cv_header_sys_socket_h} = no; then
-  echo *** $be backend requires sys/socket.h - $DISABLE_MSG
+if test ${ac_cv_header_sys_socket_h} != yes \
+   test ${ac_cv_header_winsock2_h} != yes; then
+  echo *** $be backend requires sys/socket.h or winsock2.h - $DISABLE_MSG
   backend_supported=no
 fi
 ;;
diff --git a/configure b/configure
index ba1df33..7f60bb9 100755
--- a/configure
+++ b/configure
@@ -17942,8 +17942,9 @@ for be in ${BACKENDS}; do
 ;;
 
 net)
-if test ${ac_cv_header_sys_socket_h} = no; then
-  echo *** $be backend requires sys/socket.h - $DISABLE_MSG
+if test ${ac_cv_header_sys_socket_h} != yes \
+   test ${ac_cv_header_winsock2_h} != yes; then
+  echo *** $be backend requires sys/socket.h or winsock2.h - $DISABLE_MSG
   backend_supported=no
 fi
 ;;
@@ -18106,8 +18107,9 @@ for be in ${BACKENDS}; do
 ;;
 
 net)
-if test ${ac_cv_header_sys_socket_h} = no; then
-  echo *** $be backend requires sys/socket.h - $DISABLE_MSG
+if test ${ac_cv_header_sys_socket_h} != yes \
+   test ${ac_cv_header_winsock2_h} != yes; then
+  echo *** $be backend requires sys/socket.h or winsock2.h - $DISABLE_MSG
   backend_supported=no
 fi
 ;;
-- 
1.7.6.1




[sane-devel] [PATCH v2 09/14] net, re-use sane_set_io_mode

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Now we have only one place where we could implement turning off
non-blocking I/O  platform dependent.
---
 backend/net.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/backend/net.c b/backend/net.c
index f3800d9..5946a1b 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -2209,7 +2209,7 @@ sane_read (SANE_Handle handle, SANE_Byte * data, SANE_Int 
max_length,
  DBG (2, sane_read: received error signal\n);
 
  /* turn off non-blocking I/O (s-data will be closed anyhow): */
- fcntl (s-data, F_SETFL, 0);
+ sane_set_io_mode (s, SANE_FALSE);
 
  /* read the status byte: */
  if (read (s-data, ch, sizeof (ch)) != 1)
-- 
1.7.6.1




[sane-devel] [PATCH v2 14/14] update ChangeLog for previous commits

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 ChangeLog |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2983e24..1eef9a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-01-23 Ruediger Meier sweet_f_a at gmx.de
+   * acinclude.m4, backend/net.c, backend/net.h, configure.in,
+   include/sane/config.h.in, sanei/sanei_udp.c: port net backend to win32
+
 2012-01-23 Rolf Bensch rolf at bensch hyphen online dot de
* backend/pixma_mp150, doc/descriptions/pixma.desc, doc/sane-pixma.man:
New scanner PIXMA MX880 Series.
-- 
1.7.6.1




[sane-devel] [PATCH v2 13/14] bldchn, SANE_CHECK_IPV6 more portable

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Even win32 seems to be ipv6 capable now.
---
 acinclude.m4 |   22 +-
 configure|   22 +-
 2 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 7cc4228..d498a7b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -556,11 +556,19 @@ AC_DEFUN([SANE_CHECK_IPV6],
  fi
   ])
 
+  ipv6_includes=
+#define INET6
+$ac_includes_default
+#ifdef HAVE_SYS_SOCKET_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+
   if test $ipv6 != no ; then
 AC_TRY_COMPILE([
-   #define INET6 
-   #include sys/types.h 
-   #include sys/socket.h ], [
+   $ipv6_includes], [
 /* AF_INET6 available check */  
if (socket(AF_INET6, SOCK_STREAM, 0)  0) 
  exit(1); 
@@ -579,9 +587,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
   if test $ipv6 != no ; then
 AC_MSG_CHECKING([whether struct sockaddr_storage has an ss_family member])
 AC_TRY_COMPILE([
-   #define INET6
-   #include sys/types.h
-   #include sys/socket.h ], [
+   $ipv6_includes], [
/* test if the ss_family member exists in struct sockaddr_storage */
struct sockaddr_storage ss;
ss.ss_family = AF_INET;
@@ -591,9 +597,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
AC_DEFINE([HAS_SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage 
has an ss_family member])
 ], [
AC_TRY_COMPILE([
-   #define INET6
-   #include sys/types.h
-   #include sys/socket.h ], [
+   $ipv6_includes], [
/* test if the __ss_family member exists in struct 
sockaddr_storage */
struct sockaddr_storage ss;
ss.__ss_family = AF_INET;
diff --git a/configure b/configure
index 7f60bb9..98716d5 100755
--- a/configure
+++ b/configure
@@ -10299,13 +10299,21 @@ $as_echo no, manually disabled 6; }
 fi
 
 
+  ipv6_includes=
+#define INET6
+$ac_includes_default
+#ifdef HAVE_SYS_SOCKET_H
+# include sys/socket.h
+#endif
+#ifdef HAVE_WINSOCK2_H
+# include winsock2.h
+#endif
+
   if test $ipv6 != no ; then
 cat confdefs.h - _ACEOF conftest.$ac_ext
 /* end confdefs.h.  */
 
-   #define INET6
-   #include sys/types.h
-   #include sys/socket.h
+   $ipv6_includes
 int
 main ()
 {
@@ -10345,9 +10353,7 @@ $as_echo_n checking whether struct sockaddr_storage 
has an ss_family member...
 cat confdefs.h - _ACEOF conftest.$ac_ext
 /* end confdefs.h.  */
 
-   #define INET6
-   #include sys/types.h
-   #include sys/socket.h
+   $ipv6_includes
 int
 main ()
 {
@@ -10374,9 +10380,7 @@ else
cat confdefs.h - _ACEOF conftest.$ac_ext
 /* end confdefs.h.  */
 
-   #define INET6
-   #include sys/types.h
-   #include sys/socket.h
+   $ipv6_includes
 int
 main ()
 {
-- 
1.7.6.1




[sane-devel] [PATCH v2 11/14] net, use recv/send instead of read/write

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

We need this on win32. This shouldn't break anything on other systems.
---
 backend/net.c |   15 +--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/backend/net.c b/backend/net.c
index 03133d3..0cd7f51 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -158,6 +158,17 @@ static int hang_over;
 */
 static int left_over;
 
+static ssize_t
+net_write (int fd, const void *buf, size_t count)
+{
+   return send( fd, buf, count, 0 );
+}
+
+static ssize_t
+net_read (int fd, void *buf, size_t count)
+{
+   return recv( fd, buf, count, 0 );
+}
 
 #ifdef NET_USES_AF_INDEP
 static SANE_Status
@@ -493,8 +504,8 @@ connect_dev (Net_Device * dev)
   DBG (2, connect_dev: sanei_w_init\n);
   sanei_w_init (dev-wire, sanei_codec_bin_init);
   dev-wire.io.fd = dev-ctl;
-  dev-wire.io.read = read;
-  dev-wire.io.write = write;
+  dev-wire.io.read = net_read;
+  dev-wire.io.write = net_write;
 
   /* exchange version codes with the server: */
   req.version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR,
-- 
1.7.6.1




[sane-devel] [PATCH v2 08/14] net, add missing includes for win32

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 backend/net.c |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/backend/net.c b/backend/net.c
index dea36ce..f3800d9 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -64,9 +64,21 @@
 #include sys/time.h
 #include sys/types.h
 
-#include sys/socket.h
-#include netinet/in.h
-#include netdb.h /* OS/2 needs this _after_ netinet/in.h, grrr... */
+#if ! defined _WIN32
+# include sys/socket.h
+# include netinet/in.h
+# include netdb.h /* OS/2 needs this _after_ netinet/in.h, grrr... */
+#else
+# ifdef NEED_WINVER_XP
+#  define WINVER 0x0501
+# endif
+# ifdef HAVE_WINSOCK2_H
+#  include winsock2.h
+# endif
+# ifdef HAVE_WS2TCPIP_H
+#  include ws2tcpip.h
+# endif
+#endif
 
 #ifdef WITH_AVAHI
 # include avahi-client/client.h
-- 
1.7.6.1




[sane-devel] [PATCH v2 12/14] net, call WSAStartup on win32

2012-01-24 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

We have to do this on win32 before doing winsock2 stuff. It affects the
whole application so don't know wheather it's right to startup and clean
it here within the net backend.
---
 backend/net.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/backend/net.c b/backend/net.c
index 0cd7f51..228bd59 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -1016,6 +1016,18 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback 
authorize)
   DBG (3, sane_init: Client has little endian byte order\n);
 }
 
+#ifdef _WIN32
+{
+  /* no much fun on win32 without WSAStartup but is this the right place? 
*/
+  WSADATA data;
+  int wsa_err = WSAStartup( MAKEWORD(2, 2), data) != 0;
+  if ( wsa_err != 0 )
+   {
+ DBG (1, sane_init: WSAStartup failed with error %d\n, wsa_err );
+   }
+}
+#endif
+
 #ifndef NET_USES_AF_INDEP
   DBG (2, sane_init: determining sane service port\n);
   serv = getservbyname (sane-port, tcp);
@@ -1196,6 +1208,9 @@ sane_exit (void)
}
   free (devlist);
 }
+#ifdef _WIN32
+  WSACleanup();
+#endif
   DBG (3, sane_exit: finished.\n);
 }
 
-- 
1.7.6.1




[sane-devel] [PATCH v2 03/14] bldchn, use our new macro SANE_CHECK_NETDB_FUNC

2012-01-24 Thread Ruediger Meier
On Tuesday 24 January 2012, Chris Bagwell wrote:
 On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier sweet_f_a at gmx.de 
wrote:
  From: Ruediger Meier ruediger.meier at ga-group.nl
 
  Now we will find getaddrinfo and getnameinfo on win32 systems.
  Note it should be even safe to use that macro for all systems
  instead of trying AC_CHECK_FUNCS first. For now I don't want to do
  such risky things things and leave it as is.

 I would prefer if we went ahead and did your suggestion of doing
 check with new macro on all systems instead of this.  I will be glad
 to test on a sampling of Unix systems to make sure there are no
 issues.

 So I'm saying I'd prefer this patch to change to delete old check for
 get* functions and do macro unconditionally.

Ok, then I will polish SANE_CHECK_NETDB_FUNC a little for this:
1. maybe allowing multiple args
2. respecting cached results 


 One thing I notice must be a bug.  Right before the old call to
 AC_CHECK_FUNCS(), there is a check for BeOS and forces the variables
 to be no.  Those need to be after the AC_CHECK_FUNCS to be
 meaningful.

On first view I've also wondered about this but note that all ac_cv_* 
vars are cached variables and having them set to no before doing 
the check will result it this:

checking for getaddrinfo... (cached) no
checking for getnameinfo... (cached) no


 I'm pretty sure BeOS support is broke in other ways. 

 Anyways, I'll probably submit a patch to fix BeOS bug along with your
 patches.


 Chris

  ---
   configure|  169
  ++ configure.in
  |8 ++
   include/sane/config.h.in |3 +
   3 files changed, 180 insertions(+), 0 deletions(-)
 
  diff --git a/configure b/configure
  index 4c9dfcd..5da8db8 100755
  --- a/configure
  +++ b/configure
  @@ -9508,6 +9508,175 @@ fi
 
 
 
  +if test $ac_cv_func_getaddrinfo != yes \
  +  || test $ac_cv_func_getnameinfo != yes; then
  +
  +
  +  sane_netdb_includes=$ac_includes_default
  +  #ifdef HAVE_SYS_SOCKET_H
  +  # include sys/socket.h
  +  #endif
  +  #ifdef HAVE_NETDB_H
  +  # include netdb.h
  +  #endif
  +  #ifdef HAVE_WINSOCK2_H
  +  # include winsock2.h
  +  #endif
  +  #ifdef HAVE_WS2TCPIP_H
  +  # include ws2tcpip.h
  +  #endif
  +
  +  ac_cv_func_getaddrinfo=no
  +  need_winver_xp=no
  +
  +  { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32
  getaddrinfo 5 +$as_echo_n checking for win32 getaddrinfo... 
  6; }
  +  cat confdefs.h - _ACEOF conftest.$ac_ext
  +/* end confdefs.h.  */
  +$sane_netdb_includes
  +int
  +main ()
  +{
  +int testme(){ getaddrinfo; }
  +  ;
  +  return 0;
  +}
  +_ACEOF
  +if ac_fn_c_try_compile $LINENO; then :
  +  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
  +$as_echo yes 6; }
  +ac_cv_func_getaddrinfo=yes
  +else
  +  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
  +$as_echo no 6; }
  +fi
  +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  +
  +if test $ac_cv_func_getaddrinfo != yes; then
  +{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32
  getaddrinfo if WINVER is 0x0501 5 +$as_echo_n checking for
  win32 getaddrinfo if WINVER is 0x0501...  6; } +cat
  confdefs.h - _ACEOF conftest.$ac_ext
  +/* end confdefs.h.  */
  +#define WINVER 0x0501
  +  $sane_netdb_includes
  +int
  +main ()
  +{
  +int testme(){ getaddrinfo; }
  +  ;
  +  return 0;
  +}
  +_ACEOF
  +if ac_fn_c_try_compile $LINENO; then :
  +  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
  +$as_echo yes 6; }
  +  ac_cv_func_getaddrinfo=yes
  +  need_winver_xp=yes
  +else
  +  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
  +$as_echo no 6; }
  +fi
  +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  +  fi
  +
  +  if test $ac_cv_func_getaddrinfo = yes; then
  +
  +$as_echo #define HAVE_GETADDRINFO 1 confdefs.h
  +
  +
  +if test $need_winver_xp = yes; then
  +
  +$as_echo #define NEED_WINVER_XP 1 confdefs.h
  +
  +fi
  +  fi
  +
  +  unset sane_netdb_includes
  +
  +
  +  sane_netdb_includes=$ac_includes_default
  +  #ifdef HAVE_SYS_SOCKET_H
  +  # include sys/socket.h
  +  #endif
  +  #ifdef HAVE_NETDB_H
  +  # include netdb.h
  +  #endif
  +  #ifdef HAVE_WINSOCK2_H
  +  # include winsock2.h
  +  #endif
  +  #ifdef HAVE_WS2TCPIP_H
  +  # include ws2tcpip.h
  +  #endif
  +
  +  ac_cv_func_getnameinfo=no
  +  need_winver_xp=no
  +
  +  { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32
  getnameinfo 5 +$as_echo_n checking for win32 getnameinfo... 
  6; }
  +  cat confdefs.h - _ACEOF conftest.$ac_ext
  +/* end confdefs.h.  */
  +$sane_netdb_includes
  +int
  +main ()
  +{
  +int testme(){ getnameinfo; }
  +  ;
  +  return 0;
  +}
  +_ACEOF
  +if ac_fn_c_try_compile $LINENO; then :
  +  { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5
  +$as_echo yes 6; }
  +ac_cv_func_getnameinfo=yes
  +else
  +  { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5
  +$as_echo no 6; }
  +fi
  +rm -f core

[sane-devel] xsane source repositories

2012-01-23 Thread Ruediger Meier
On Monday 23 January 2012, Michael Nagel wrote:
 Hi there,

 I am looking for an official, public repository of the xsane source
 code. Is there such a thing, and if yes, where is it?

Don't think there is one - just tar balls.
I've made a git repo of them and could publish it if you are interested 
in this.

cu,
Rudi



[sane-devel] [PATCH 00/13] win32 portable net backend

2012-01-23 Thread Ruediger Meier
On Monday 23 January 2012 at 16:58, you wrote:
 Ruediger, I'm try to find time and comment on this soon.  Should I
 comment on github or should you post the patches to the list so I can
 reply?  I had at least 3 comments from quick glance.

Thx,
better I post them on the list to discuss there right? I'am going to 
post them later this night.
Anyway you may also comment on github if you want.

BTW even I've re-rolled these patches again to fix some trivial things.
Maybe you need to pull again.

 Also, you might should request write access to git so you can commit
 these patches yourself if you think you'll be cleaning up for a
 while; although I have no problems doing that on your behalf.

I think I will not really need it. Just came over to have a native ipv6 
net backend for our windows clients.
Probably I will post a few more fixes but that's it.

cu,
Rudi



[sane-devel] [PATCH 00/13] win32 portable net backend

2012-01-22 Thread Ruediger Meier
Hi,

I've spend some time making the net backend win32 portable. Maybe we 
could build a useful native (non-cygwin) xsane (saned client) on 
Windows now.

Please pull from my private clone
git://github.com/rudimeier/sane-backends.git
branch win32/net

Hope this doesn't break something.
If wanted I would post these patches on this list too.


Ruediger Meier (13):
  bldchn, provide macro SANE_CHECK_NETDB_FUNC
  bldchn, add checks for netdb.h and ws2tcpip.h
  bldchn, use our new macro SANE_CHECK_NETDB_FUNC
  bldchn, checking for socklen_t more safe
  fix sanei_udp, socklen_t was not defined on win32
  bldchn, don't always disable net backend on win32
  net, move some includes from net.h to net.c
  net, add missing includes for win32
  net, re-use sane_set_io_mode
  net, implement O_NONBLOCK stuff for win32
  net, use recv/send instead of read/write
  net, call WSAStartup on win32
  bldchn, SANE_CHECK_IPV6 more portable

 acinclude.m4 |   76 +++---
 backend/net.c|   54 +++-
 backend/net.h|3 -
 configure|  201 
++
 configure.in |   22 +-
 include/sane/config.h.in |9 ++
 sanei/sanei_udp.c|3 +
 7 files changed, 329 insertions(+), 39 deletions(-)

--
1.7.6.1



[sane-devel] Subject: [PATCH 0/4] fix and cleanup portable PATH_SEP and DIR_PATH defines

2012-01-18 Thread Ruediger Meier
On Wednesday 18 January 2012, Chris Bagwell wrote:
 On Tue, Jan 17, 2012 at 3:01 PM, Ruediger Meier wrote:

  Thx, I just see I've messed up that patch series a little while
  playing around with my MUA. Could you cleanly apply it? If not then
  I would reroll it.

 I haven't tried yet.  Can you resend directly to me to save time? 
 You can send as attachements to me until you get MUA worked out.

Please pull from my private clone
git://github.com/rudimeier/sane-backends.git

branches
win32/path
win32/scsi


cu,
Rudi



[sane-devel] [PATCH 0/2] build fix for win32

2012-01-17 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Ruediger Meier (2):
  add checks for ntddscsi.h and ddk/ntddscsi.h (to be used for win32)
  build fix, use the right scsi header on win32

 configure |   14 ++
 configure.in  |1 +
 include/sane/config.h.in  |6 ++
 sanei/sanei_scsi.c|   10 --
 tools/sane-find-scanner.c |   17 +++--
 5 files changed, 40 insertions(+), 8 deletions(-)

--
1.7.6.1



[sane-devel] [PATCH 1/2] add checks for ntddscsi.h and ddk/ntddscsi.h (to be used for win32)

2012-01-17 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 configure|   14 ++
 configure.in |1 +
 include/sane/config.h.in |6 ++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index ae60009..ba864b0 100755
--- a/configure
+++ b/configure
@@ -9867,6 +9867,20 @@ fi

 done

+for ac_header in ntddscsi.h ddk/ntddscsi.h
+do :
+  as_ac_Header=`$as_echo ac_cv_header_$ac_header | $as_tr_sh`
+ac_fn_c_check_header_compile $LINENO $ac_header $as_ac_Header #include 
windows.h
+
+if eval test \x\$$as_ac_Header\ = xyes; then :
+  cat confdefs.h _ACEOF
+#define `$as_echo HAVE_$ac_header | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+

 if test $ac_cv_header_sys_scsiio_h = yes \
   -a $ac_cv_header_scsi_h = yes; then
diff --git a/configure.in b/configure.in
index ac09173..6fac904 100644
--- a/configure.in
+++ b/configure.in
@@ -421,6 +421,7 @@ AC_CHECK_HEADERS(IOKit/scsi/SCSITaskLib.h 
IOKit/cdb/IOSCSILib.h \
   sys/scsi/targets/scgio.h apollo/scsi.h sys/sdi_comm.h \
   sys/passthrudef.h)
 AC_CHECK_HEADERS([io/cam/cam.h],,,[#include io/common/iotypes.h])
+AC_CHECK_HEADERS([ntddscsi.h ddk/ntddscsi.h],,,[#include windows.h])

 dnl FreeBSD  3
 if test $ac_cv_header_sys_scsiio_h = yes \
diff --git a/include/sane/config.h.in b/include/sane/config.h.in
index 738a521..00c8669 100644
--- a/include/sane/config.h.in
+++ b/include/sane/config.h.in
@@ -61,6 +61,9 @@
 /* Define to 1 if you have the `cfmakeraw' function. */
 #undef HAVE_CFMAKERAW

+/* Define to 1 if you have the ddk/ntddscsi.h header file. */
+#undef HAVE_DDK_NTDDSCSI_H
+
 /* Define to 1 if you have the dev/ppbus/ppi.h header file. */
 #undef HAVE_DEV_PPBUS_PPI_H

@@ -210,6 +213,9 @@
 /* Define to 1 if you have the `NSLinkModule' function. */
 #undef HAVE_NSLINKMODULE

+/* Define to 1 if you have the ntddscsi.h header file. */
+#undef HAVE_NTDDSCSI_H
+
 /* Define to 1 if you have the os2.h header file. */
 #undef HAVE_OS2_H

--
1.7.6.1



[sane-devel] build fix, use the right scsi header on win32

2012-01-17 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Now we are using either ddk/ntddscsi.h or ntddscsi.h and even don't
stop if we have none of them.
---
 sanei/sanei_scsi.c|   10 --
 tools/sane-find-scanner.c |   17 +++--
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/sanei/sanei_scsi.c b/sanei/sanei_scsi.c
index 09127c8..6d171d3 100644
--- a/sanei/sanei_scsi.c
+++ b/sanei/sanei_scsi.c
@@ -62,6 +62,10 @@
 #include sys/param.h
 #include sys/types.h

+#if defined (HAVE_WINDOWS_H)
+# include windows.h
+#endif
+
 #define STUBBED_INTERFACE  0
 #define LINUX_INTERFACE1
 #define BSD_INTERFACE  2
@@ -211,11 +215,13 @@
 #  include IOKit/scsi-commands/SCSITaskLib.h
 # endif
 # endif
-#elif defined (HAVE_WINDOWS_H)
+#elif defined (HAVE_DDK_NTDDSCSI_H)
 # define USE WIN32_INTERFACE
-# include windows.h
 # include ddk/scsi.h
 # include ddk/ntddscsi.h
+#elif defined (HAVE_NTDDSCSI_H)
+# define USE WIN32_INTERFACE
+# include ntddscsi.h
 #endif

 #ifndef USE
diff --git a/tools/sane-find-scanner.c b/tools/sane-find-scanner.c
index 2b1b164..bfcfaf0 100644
--- a/tools/sane-find-scanner.c
+++ b/tools/sane-find-scanner.c
@@ -30,10 +30,15 @@
 #include dirent.h
 #include errno.h

-#if defined (HAVE_WINDOWS_H)
-#include windows.h
-#include ddk/scsi.h
-#include ddk/ntddscsi.h
+#if defined (HAVE_DDK_NTDDSCSI_H) || defined (HAVE_NTDDSCSI_H)
+# define WIN32_SCSI
+# include windows.h
+# if defined (HAVE_DDK_NTDDSCSI_H)
+#  include ddk/scsi.h
+#  include ddk/ntddscsi.h
+# elif defined (HAVE_NTDDSCSI_H)
+#  include ntddscsi.h
+# endif
 #endif

 #include ../include/sane/sanei.h
@@ -1148,7 +1153,7 @@ get_next_file (char *dir_name, DIR * dir)
   return file_name;
 }

-#if defined (HAVE_WINDOWS_H)
+#if defined(WIN32_SCSI)
 /* Return a list of potential scanners. There's a lot of hardcoded values here 
that might break on a system with lots of scsi devices. */
 static char **build_scsi_dev_list(void)
 {
@@ -1840,7 +1845,7 @@ main (int argc, char **argv)
0
   };

-#if defined (HAVE_WINDOWS_H) || \
+#if defined (WIN32_SCSI) || \
 defined (HAVE_IOKIT_CDB_IOSCSILIB_H) || \
 defined (HAVE_IOKIT_SCSI_SCSICOMMANDOPERATIONCODES_H) || \
 defined (HAVE_IOKIT_SCSI_COMMANDS_SCSICOMMANDOPERATIONCODES_H)
--
1.7.6.1



[sane-devel] Subject: [PATCH 0/4] fix and cleanup portable PATH_SEP and DIR_PATH defines

2012-01-17 Thread Ruediger Meier
On Tuesday 17 January 2012, Chris Bagwell wrote:
 This patch series makes minor portability fixes to following
 backends. I've not seen any objections from various maintainers... so
 if I do not hear back by weekend, I'll commit this patch series.

Thx, I just see I've messed up that patch series a little while playing 
around with my MUA. Could you cleanly apply it? If not then I would 
reroll it.

BTW is this list the right one to send patches at all?

cu,
Rudi



[sane-devel] Subject: [PATCH 0/4] fix and cleanup portable PATH_SEP and DIR_PATH defines

2012-01-15 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

This patch-set is to fix and unify PATH_SEP and DIR_PATH defines in the 
context of seeing them conflicting on cygwin.

Ruediger Meier (4):
  fix, PATH_SEP and DIR_SEP were inconsistently defined on cygwin since
5168206e (also see a28bd843)
  cleanup, remove all unused PATH_SEP defines
  cleanup, always use the same portable PATH_SEP define (note _WIN32
 is not defined on cygwin)
  update ChangeLog for previous commits

 ChangeLog|6 ++
 backend/canon_dr.h   |8 
 backend/cardscan.h   |8 
 backend/dll.c|6 +-
 backend/epjitsu.h|8 
 backend/fujitsu.h|8 
 backend/gt68xx.c |2 +-
 backend/kodak.h  |8 
 backend/microtek2.h  |2 +-
 sanei/sanei_access.c |2 +-
 sanei/sanei_config.c |5 +
 11 files changed, 11 insertions(+), 52 deletions(-)

--
1.7.6.1



[sane-devel] [PATCH 1/4] fix, inconsistent PATH_SEP and DIR_SEP defines

2012-01-15 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

PATH_SEP and DIR_SEP were inconsistently defined on cygwin since
5168206e (also see a28bd843)
---
 sanei/sanei_config.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sanei/sanei_config.c b/sanei/sanei_config.c
index 1279a3e..5fbc37f 100644
--- a/sanei/sanei_config.c
+++ b/sanei/sanei_config.c
@@ -62,6 +62,9 @@
 #if defined(HAVE_OS2_H)
 # define DIR_SEP   ;
 # define PATH_SEP  '\\'
+#elif defined(__CYGWIN__)
+# define DIR_SEP   :
+# define PATH_SEP  '/'
 #elif defined(HAVE_WINDOWS_H)
 # define DIR_SEP   ;
 # define PATH_SEP  '\\'
--
1.7.6.1



[sane-devel] [PATCH 2/4] cleanup, remove all unused PATH_SEP defines

2012-01-15 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 backend/canon_dr.h |8 
 backend/cardscan.h |8 
 backend/epjitsu.h  |8 
 backend/fujitsu.h  |8 
 backend/kodak.h|8 
 5 files changed, 0 insertions(+), 40 deletions(-)

diff --git a/backend/canon_dr.h b/backend/canon_dr.h
index b1a05c1..f7240c3 100644
--- a/backend/canon_dr.h
+++ b/backend/canon_dr.h
@@ -433,14 +433,6 @@ enum {
 #  define PATH_MAX 1024
 #endif

-#ifndef PATH_SEP
-#ifdef HAVE_OS2_H
-#  define PATH_SEP   '\\'
-#else
-#  define PATH_SEP   '/'
-#endif
-#endif
-
 /* - 
*/

 SANE_Status sane_init (SANE_Int * version_code, SANE_Auth_Callback 
authorize);
diff --git a/backend/cardscan.h b/backend/cardscan.h
index d4f9802..a673dc6 100644
--- a/backend/cardscan.h
+++ b/backend/cardscan.h
@@ -133,14 +133,6 @@ struct scanner
 #  define PATH_MAX 1024
 #endif

-#ifndef PATH_SEP
-#ifdef HAVE_OS2_H
-#  define PATH_SEP   '\\'
-#else
-#  define PATH_SEP   '/'
-#endif
-#endif
-
 /* - 
*/

 SANE_Status sane_init (SANE_Int * version_code, SANE_Auth_Callback 
authorize);
diff --git a/backend/epjitsu.h b/backend/epjitsu.h
index 53642da..ed63504 100644
--- a/backend/epjitsu.h
+++ b/backend/epjitsu.h
@@ -292,14 +292,6 @@ struct scanner
 #  define PATH_MAX 1024
 #endif

-#ifndef PATH_SEP
-#ifdef HAVE_OS2_H
-#  define PATH_SEP   '\\'
-#else
-#  define PATH_SEP   '/'
-#endif
-#endif
-
 /* - 
*/

 SANE_Status sane_init (SANE_Int * version_code, SANE_Auth_Callback 
authorize);
diff --git a/backend/fujitsu.h b/backend/fujitsu.h
index 1bfd300..5c97275 100644
--- a/backend/fujitsu.h
+++ b/backend/fujitsu.h
@@ -662,14 +662,6 @@ struct fujitsu
 #  define PATH_MAX 1024
 #endif

-#ifndef PATH_SEP
-#ifdef HAVE_OS2_H
-#  define PATH_SEP   '\\'
-#else
-#  define PATH_SEP   '/'
-#endif
-#endif
-
 /* - 
*/

 SANE_Status sane_init (SANE_Int * version_code, SANE_Auth_Callback 
authorize);
diff --git a/backend/kodak.h b/backend/kodak.h
index 9de427b..ea2a3e4 100644
--- a/backend/kodak.h
+++ b/backend/kodak.h
@@ -198,14 +198,6 @@ struct scanner
 #  define PATH_MAX 1024
 #endif

-#ifndef PATH_SEP
-#ifdef HAVE_OS2_H
-#  define PATH_SEP   '\\'
-#else
-#  define PATH_SEP   '/'
-#endif
-#endif
-
 /* - 
*/

 SANE_Status sane_init (SANE_Int * version_code, SANE_Auth_Callback 
authorize);
--
1.7.6.1



[sane-devel] [PATCH 3/4] cleanup, uniq PATH_SEP defines

2012-01-15 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

Always use the same portable PATH_SEP define (note _WIN32
is not defined on cygwin).
---
 backend/dll.c|6 +-
 backend/gt68xx.c |2 +-
 backend/microtek2.h  |2 +-
 sanei/sanei_access.c |2 +-
 sanei/sanei_config.c |8 +---
 5 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/backend/dll.c b/backend/dll.c
index 8e893e6..83d8550 100644
--- a/backend/dll.c
+++ b/backend/dll.c
@@ -108,11 +108,7 @@
 # define PATH_MAX   1024
 #endif

-#if defined(HAVE_OS2_H)
-# define DIR_SEP;
-#elif defined(__CYGWIN__)
-# define DIR_SEP:
-#elif defined(HAVE_WINDOWS_H)
+#if defined(_WIN32) || defined(HAVE_OS2_H)
 # define DIR_SEP;
 #else
 # define DIR_SEP:
diff --git a/backend/gt68xx.c b/backend/gt68xx.c
index c3fdca0..efdb5e0 100644
--- a/backend/gt68xx.c
+++ b/backend/gt68xx.c
@@ -934,7 +934,7 @@ attach_one_device (SANE_String_Const devname)
   return SANE_STATUS_GOOD;
 }

-#if defined(HAVE_OS2_H)
+#if defined(_WIN32) || defined(HAVE_OS2_H)
 # define PATH_SEP   \\
 #else
 # define PATH_SEP   /
diff --git a/backend/microtek2.h b/backend/microtek2.h
index faa856e..4100fad 100644
--- a/backend/microtek2.h
+++ b/backend/microtek2.h
@@ -64,7 +64,7 @@

 #ifdef HAVE_AUTHORIZATION
 #ifndef PATH_SEP
-#if defined(HAVE_OS2_H)
+#if defined(_WIN32) || defined(HAVE_OS2_H)
 # define PATH_SEP  \\
 #else
 # define PATH_SEP  /
diff --git a/sanei/sanei_access.c b/sanei/sanei_access.c
index ca77d8c..b77cdd9 100644
--- a/sanei/sanei_access.c
+++ b/sanei/sanei_access.c
@@ -62,7 +62,7 @@
 # define PATH_MAX  1024
 #endif

-#if defined(HAVE_OS2_H) || defined(HAVE_WINDOWS_H)
+#if defined(_WIN32) || defined(HAVE_OS2_H)
 # define PATH_SEP  '\\'
 #else
 # define PATH_SEP  '/'
diff --git a/sanei/sanei_config.c b/sanei/sanei_config.c
index 5fbc37f..c158766 100644
--- a/sanei/sanei_config.c
+++ b/sanei/sanei_config.c
@@ -59,13 +59,7 @@
 # define PATH_MAX  1024
 #endif

-#if defined(HAVE_OS2_H)
-# define DIR_SEP   ;
-# define PATH_SEP  '\\'
-#elif defined(__CYGWIN__)
-# define DIR_SEP   :
-# define PATH_SEP  '/'
-#elif defined(HAVE_WINDOWS_H)
+#if defined(_WIN32) || defined(HAVE_OS2_H)
 # define DIR_SEP   ;
 # define PATH_SEP  '\\'
 #else
--
1.7.6.1



[sane-devel] [PATCH 4/4] update ChangeLog for previous commits

2012-01-15 Thread Ruediger Meier
From: Ruediger Meier ruediger.me...@ga-group.nl

---
 ChangeLog |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 458575e..140fb7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-15 Ruediger Meier sweet_f_a at gmx.de
+   * backend/canon_dr.h, backend/cardscan.h, backend/dll.c,
+   backend/epjitsu.h, backend/fujitsu.h, backend/gt68xx.c,
+   backend/kodak.h, backend/microtek2.h, sanei/sanei_access.[hc]: 
fix and
+   cleanup portable PATH_SEP and DIR_PATH defines
+
 2012-01-14 m. allan noah kitno455 at gmail dot com
* backend/Makefile.{am,in}, backend/pixma.[ch],
backend/pixma_common.c, backend/pixma_mp[17]50.c,
--
1.7.6.1



[sane-devel] samsung smfp, local scanimage works but not via net

2012-01-14 Thread Ruediger Meier
Hi,


I have a Samsung SCX-4833FR with libsane-smfp.so.1 installed on saned 
server.

scanimage works locally on the server but not on saned client:

$ scanimage /dev/null
[...]
[net] sane_start: remote start
[net] sane_start: server has little endian byte order
[net] sane_start: remote start finished, data at port 44740
[net] sane_start: done (Success)
[dll] sane_get_parameters(handle=0x614700,params=0x7fffe1b807f0)
[net] sane_get_parameters
[net] sane_get_parameters: remote get parameters
[net] sane_get_parameters: returned status Success
scanimage: scanning image of size 2538x3295 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
[dll] 
sane_read(handle=0x614700,data=0x615d00,maxlen=65536,lenp=0x7fffe1b8081c)
[net] sane_read: handle=0x613760, data=0x615d00, max_length=65536, 
length=0x7fffe1b8081c
[net] sane_read: reading packet length
[net] sane_read: read 4 bytes, 0 from 4 total
[net] sane_read: next record length=4294967295 bytes
[net] sane_read: received error signal
[net] sane_read: error code Error during device I/O
[net] do_cancel: 0x613760
[net] do_cancel: closing data pipe
scanimage: min/max graylevel value = 255/0
scanimage: sane_read: Error during device I/O
[...]


The funny thing is that xsane (same libsane) does the job. So I've 
looked at saned's debug output to see what both clients are doing 
differently.
As far I can see it looks like xsane and scanimage are sending some 
different parameters to saned but I could not find out something 
specific.

So would be nice if somebody of you could log at the attached logs to 
point me to the right direction.
Maybe it's even a bug in scanimage.


thx,
Rudi
-- next part --
A non-text attachment was scrubbed...
Name: saned_bad.log.gz
Type: application/x-gzip
Size: 2130 bytes
Desc: not available
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20120114/3fe4e6ea/attachment.bin
-- next part --
A non-text attachment was scrubbed...
Name: saned_good.log.gz
Type: application/x-gzip
Size: 2919 bytes
Desc: not available
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20120114/3fe4e6ea/attachment-0001.bin