SOLVED! Re: Writing to parallel port
Mark
admin at asarian-host.net
Sun Jul 27 06:08:05 PDT 2003
----- Original Message -----
From: "Malcolm Kay" <malcolm.kay at internode.on.net>
To: "Daan Vreeken [PA4DAN]" <Danovitsch at Vitsch.net>; "Mark"
<admin at asarian-host.net>
Cc: <FreeBSD-questions at freebsd.org>
Sent: Saturday, July 26, 2003 5:12 AM
Subject: Re: Writing to parallel port
> > On Friday 25 July 2003 19:22, Mark wrote:
> > Hello,
> >
> > Has anyone an idea how to set/unset a bit on a parallel port in freebsd
> > 4.7? I installed Device::ParallelPort from CPAN (Perl 5.8.0), but that
> > does nothing (seems made for linux).
>
> Basically you need to open /dev/io to get io read/write permission, after
> that you are free to bang all IO-ports you want.
> Generally you still need to be root or have root privilege to do this;
> but might vary with different FreeBSD releases.
>
> An alternative that may or may not suit your needs is ppi device access
> to parallel ports eg /dev/ppi0; try:
# man ppi
Thanks, Malcolm!
Using /dev/ppi0 solved it. :) And I am back in securelevel 2 (accessing the
raw device directly, via /dev/io, though it worked like a charm, would not
go from securelevel 1 and up). Feeling a lot better now. :)
- Mark
P.S. In case someone wondered, this is what I did:
-----------------------------------------------
#include <stdio.h>
#include <dev/ppbus/ppi.h>
#include <dev/ppbus/ppbconf.h>
#include <fcntl.h>
int main (void)
{
int fd;
u_int8_t val;
fd = open ("/dev/ppi0", O_RDWR);
val = 0x01;
ioctl (fd, PPISDATA, &val);
ioctl (fd, PPIGCTRL, &val);
val |= STROBE;
ioctl (fd, PPISCTRL, &val);
val &= ~STROBE;
ioctl (fd, PPISCTRL, &val);
}
-----------------------------------------------
More information about the freebsd-questions
mailing list