[sane-devel] Mustek Paragon 600 II N and OpenBSD 3.2 problems

Henning Meier-Geinitz henning@meier-geinitz.de
Sat, 12 Apr 2003 18:26:41 +0200


Hi,

On Sat, Apr 12, 2003 at 01:56:36PM +0200, rabbit wrote:
> That's what fails indeed, because there isn't a /dev/io on OpenBSD. So if
> I understand correctly, this piece of code should give the program access
> to i/o ports, which can then be written to using the inb and outb
> functions? (I can read some C, but I can hardly write it... yet)

That's correct.

> So after some research, I found that in order to get access to i/o ports
> on OpenBSD (i386 only of course) one should use the syscalls
> i386_get_ioperm() and i386_set_ioperm(). They look a bit like the linux
> ioperm(), if I'm not mistaking.
> You can look at the manpages for these functions at
> http://www.openbsd.org/cgi-bin/man.cgi

Thanks. I've tried to use the simpler (but less secure) i386_iopl but
I can't get it working. It needs libi386 and that lib is only provided
as a static library (at least on my OpenBSD version). So the SANE build
failed. Well, it didn't really fail but all the libs were static but
the dll backend didn't know about it.

I don't want to disable shared libraries just beacuse of this.
But maybe you can find a simple solution that doesn't harm other users.

If you want to just try, run configure --disable-shared, add libi386
to the LIBS (I did it in configure.in) and change the code in
sanei_ab306.c to #include <machine/sysarch.h>. Also add a test in
get_io_privilege() for OpenBSD and do a i386_iopl (3). I don't know if
that's the right value, I found that somewhere on the net.

> So probably it would help to i386_get_ioperm() the io permission table,
> flip some bits (which ones? which ports are needed?), and then write it
> back with i386_set_ioperm().

You need the configuration port for the card and the port that's used
for communication. For the latter one, you must reserve 3 port
addresses, for the first one only one. The numbers are in the source
code.

> I'd really appreciate it if you could help me out a little, because all
> my attempts thusfar have failed :(

I did try some stuff but I haven't been really successful. And I don't
have ISA in the computer running OpenBSD so I couldn't test if the
scanner works anyway.

If you find out how to get it working, please tell us!

Bye,
  Henning