> bzero(&newtio, sizeof(newtio)); /* clear struct for new port settings */
needs #include <string.h> to suppress the warning.
> int w = write(fd,"hello world\n",12);
I think you can wait for a few milliseconds before read.
>res = read(fd,buf,255);
I don't know what you are getting after executing the code. You can try
making your serial read non blocking to know what is happening.
fcntl(fd, F_SETFL, FNDELAY);
//......
res = read(fd,buf,255);
//.....
if (read_ret < 0)
{
if (EAGAIN == errno)
{
printf("no data, read again.\n");
}
else
{
printf("read error.\n");
}
}
FYI, I haven't tested your code with serial loop-back.
Happy Hacking,
Jos Collin
_______________________________________________
Indian Libre User Group Cochin Mailing List
http://www.ilug-cochin.org/mailing-list/
http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org
#[email protected]