I have a parallel port relay board which I want to control with my Amiga. I have seen applications on Aminet for controlling these, but I want something I can run from the CLI. The application itself (I think) just sends a single byte of data to the port, with each bit representing one of the 8 relays. So I need a way to send a single byte to the Amiga's parallel port.
I have the source code of the Linux version of the relay board control software, and have found what I believe to be the portion of the code which sends the actual data to the port:
void out_byte(int port, unsigned char byte)
{
off_t s;
int r;
s = lseek(dev_port_fd, port, 0);
if (s < 0) perror("lseek");
else if (s != port)
fprintf(stderr, "hmmm: seeking to %d, went to %ld.\n", port, (long)s);
r = write(dev_port_fd, &byte, 1);
if (r != 1)
{
fprintf(stderr, "hmmm: write returned %d\n", r);
if (r < 0) perror("write");
}
}
What I don't know is how to adapt this for the Amiga. Hopefully someone can point me in the right direction.
--
moto