On Sun, Oct 27, 2002 at 09:12:33AM -0800, David Nicholas Kayal wrote:

> I'm looking for a 5 volt signal.
> 
> I have wires plugged into pins 2 and 25 of the parallel port.
> 
> I have written a small program:
> 
> #include <stdio.h>
> #include <dev/ppbus/ppi.h>
> #include <dev/ppbus/ppbconf.h>
> 
> int main()
> {
>   int fd;
>   while(1)
>     {
>       ioctl(fd, PPISDATA, 255);
>     }
> }

PPISDATA actually takes an int* argument. (The man page may be a tad
confusing here.)

Try
int main() {
    int fd;
    int d = 255;
    fd = open( "/dev/ppi0", O_RDWR );

    ioctl( fd, PPISDATA, &d );

    return 0;
}

The port should hold the last value you send to it, there's no need
to continually refresh it.

--Joe

-- 
Joe Sunday <[EMAIL PROTECTED]>  http://www.csh.rit.edu/~sunday/
Computer Science House, Rochester Inst. Of Technology

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to