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

rabbit rabbit@ulyssis.org
Sat, 12 Apr 2003 13:56:36 +0200 (CEST)


On Fri, 11 Apr 2003, Henning Meier-Geinitz wrote:

> Hi,
>
> <snip>
>
> Does the access to i/o ports work in OpenBSD like in FreeBSD?

I should've looked further, and indeed, i/o ports are handled
differently in OpenBSD. I guess that explains why it didn't work ;)

> <snip>
>
> Looks like this code in sanei_ab306_get_io_privilege fails:
>
>       if (dev_io_fd == 0)
>       	 dev_io_fd = open ("/dev/io", O_RDONLY);
>
> Maybe there is no /dev/io in OpenBSD or its name is different?

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)

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
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().
Now, the biggest problem is that my programming skills are lacking to
implement this...

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

Thanks