output via serial com1
lee
funnyvoice at tlabs.ac.za
Tue Jun 30 10:18:22 UTC 2009
Hi... Im trying to output my screen "output" to console via serial cable
on com1.
Here is my Code:
void testCom1(void) {
char buffer[256];
printf("*** Simple COM1 Test (9600 8N1) ***\n");
int fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY | _FNDELAY);
printf("\nOpened COM1, fd=%d\n\n", fd);
int numBytes = write(fd, "Hello, I'm waiting for input...\r\n", 33);
if (numBytes < 0) {
printf("\nFailed to send from COM1!\n");
}
numBytes = read(fd, buffer, 255);
if (numBytes < 0) {
printf("\nFailed to read from COM1!\n");
} else {
buffer[numBytes] = 0; // terminate
printf(buffer);
}
close(fd);
}
This code is from an example...
I've set up kermit to listen in on the host machine on com1 on the
host... I then run my little program but it just stops after
printf("\nOpened COM1, fd=%d\n\n", fd); where fd = 3....
I get no responce on kermit... I've checked the cable and it seems to
work ok... am I missing something????
thanx
Lee
More information about the users
mailing list