Write "Input/output error" after Timeperiod on Fre
Posted: Tue Mar 18, 2008 9:24 am
Hello !
I hope you can understand me. My english is bad ;-(
Since one week i have portet my linux server to freebsd 6.3 server.
Now i must compile my source to connect my LCD2041 serial display.
The problem is that the write command after time period produce
Input/output error's (code 5). I think it's the problem is initialising the display or full write buffer or another application will work on serial port and chrashes my application ?
Here is my code snipped (without error handling) :
int id = open("/dev/cuad5", O_RDWR|O_NOCTTY);
struct termios portset;
tcgetattr(id, &portset);
cfmakeraw(&portset);
cfsetospeed(&portset, B9600);
cfsetispeed(&portset, B0);
tcsetattr(id, TCSANOW, &portset);
bool bError = false;
int iWritten = 0;
char out[256] = "";
while(!bError)
{
// clear screen
snprintf(out,sizeof(out),"\xFE" "X");
if((iWritten = write(id, out, 2)) != 2)
{
fprintf(stderr,"\nError (%d)... [%d %s]", iWritten, errno, strerror(errno));
bError = true;
}
for(int i=0; i<4 && !bError; i++)
{
// set cursor
snprintf(out,sizeof(out),"\xFE" "G" "%c%c",i,i);
if((iWritten = write(id, out, 4)) != 4)
{
fprintf(stderr,"\nError (%d)... [%d %s]", iWritten, errno, strerror(errno));
bError = true;
}
// write text
if((iWritten = write(id, "0123456789", 10)) != 10)
{
fprintf(stderr,"\nError (%d)... [%d %s]", iWritten, errno, strerror(errno));
bError = true;
}
// waiting a while
// usleep(100000); // 0.1 sec
}
}
}
}
close(id);
}
------->
after a time period betwen 10 minutes to 2 hours the write command in the middle from the script fails an produce error 5 - Input/output error ?
Can someone tell me what i can doing ?
Thanx 4 ever !
...Jaro (from Germany)
I hope you can understand me. My english is bad ;-(
Since one week i have portet my linux server to freebsd 6.3 server.
Now i must compile my source to connect my LCD2041 serial display.
The problem is that the write command after time period produce
Input/output error's (code 5). I think it's the problem is initialising the display or full write buffer or another application will work on serial port and chrashes my application ?
Here is my code snipped (without error handling) :
int id = open("/dev/cuad5", O_RDWR|O_NOCTTY);
struct termios portset;
tcgetattr(id, &portset);
cfmakeraw(&portset);
cfsetospeed(&portset, B9600);
cfsetispeed(&portset, B0);
tcsetattr(id, TCSANOW, &portset);
bool bError = false;
int iWritten = 0;
char out[256] = "";
while(!bError)
{
// clear screen
snprintf(out,sizeof(out),"\xFE" "X");
if((iWritten = write(id, out, 2)) != 2)
{
fprintf(stderr,"\nError (%d)... [%d %s]", iWritten, errno, strerror(errno));
bError = true;
}
for(int i=0; i<4 && !bError; i++)
{
// set cursor
snprintf(out,sizeof(out),"\xFE" "G" "%c%c",i,i);
if((iWritten = write(id, out, 4)) != 4)
{
fprintf(stderr,"\nError (%d)... [%d %s]", iWritten, errno, strerror(errno));
bError = true;
}
// write text
if((iWritten = write(id, "0123456789", 10)) != 10)
{
fprintf(stderr,"\nError (%d)... [%d %s]", iWritten, errno, strerror(errno));
bError = true;
}
// waiting a while
// usleep(100000); // 0.1 sec
}
}
}
}
close(id);
}
------->
after a time period betwen 10 minutes to 2 hours the write command in the middle from the script fails an produce error 5 - Input/output error ?
Can someone tell me what i can doing ?
Thanx 4 ever !
...Jaro (from Germany)