[sane-devel] sane runs in windows without cygwin

m. allan noah kitno455 at gmail.com
Wed Jan 14 14:25:34 UTC 2009


2009/1/13 Michael Cronenworth <mike at cchtml.com>:
> Hello,
>
> I've had success in building sane with MinGW, MSYS, and libusb-win32-0.12.
> During my initial work I was unable to find much of anything about such a
> feat as most people settled for Cygwin.

Excellent news!

> Some caveats:
> 1. I ripped out all backends except for "fujitsu" as this is the scanner I
> have. The "fujitsu" code required no modifications to compile.

Did you try any others, or start with only fujitsu?

> 2. Signals, threading, and scsi are also obviously not available. I put
> #ifdef 32 or #ifndef WIN32 around the problem areas.

sane-fujitsu does not use signals or threading, so you made a good
choice of backend :)

> 3. I changed sleep() calls to usleep() calls or used the Windows method of
> sleep.

I only see usleep calls in sane, but there is alot of code...

> 4. getpass() is used?!?

By scanimage, yes. SANE includes a rudimentary form of authentication
checking, in case a resource requires more security. I don't know of
anything that uses it.

> In retrospect:
> 1. The rest of the backends seemed to need extensive rework as they use
> signals and ioctl calls that do not translate at all.

There are a few others that dont use threading or signals (canon_dr,
cardscan, ...), it would be nice to see if those compile as well.

> 2. Threading and scsi could be made available quite easily by adding Windows
> equivalents.

Well, we would need a windows expert to do it :)

> 3. Platform independent sleep calls should be put in.
> 4. Obsolete function! This should be replaced with similar functionality.

Certainly these two are easy fixes.

> I have a GTK+2 app that used sane in Linux and it works in Windows without
> any modification to the app code. I scanned successfully and my program
> rendered a beautiful PNG to the screen. It should be noted that in order for
> the scanner to be detected, I had to install the Fujitsu TWAIN driver. I
> guess libusb-win32 could not detect the device until the appropriate driver
> was installed? Artefact of using Windows inside of VirtualBox?

That is odd. I don't know how windows works in that regard. Makes me
wonder if we could produce some sort of prog that would read the sane
.desc files and build a .inf or something to tell windows to talk to
the device?

> If anyone is interested in the changes I've made, I'd be interested in
> making them available.

yes, very much interested. there has been some talk lately about
updating the sane build system, it might be possible to coordinate
with that effort, so that at least minimal win32 support is added to
mainline sane.

allan
-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list