Thanks. I looked my code again, which is modified from example cross-link.c. The section looks like: ... irq_time = rx_event.rxpend_timestamp; read = rt_dev_read(read_fd, &write_time, sz); if (read == sz) { read_time = rt_timer_read(); printf("%3d |%16llu |%16llu |%16llu\n", nr, irq_time - write_time, read_time - irq_time, read_time - write_time); nr++; } else if (read < 0 ) { printf(RTASK_PREFIX "error on rt_dev_read, code %s\n", strerror(-err)); <<<<<<<=========== break; } else { printf(RTASK_PREFIX "only %d / %d byte received \n", read, sz); break; } ... I guess I should change the strerror(-err) to strerror(-read). If I do that, I some times get a " code input/output error". That is better. What can cause input/output error? I get my serial port in that state consistently when I finish running my GPS program. I can reset it to a usable serial port again by remove and re-load xeno-16550A module. But setserial -G can't see anything unusual. Could it be some unclosed serial port? My simple code is attached. Thanks, Everett On Sat, Jun 12, 2010 at 5:31 PM, Gilles Chanteperdrix wrote: > Everett Wang wrote: >> Hi, >> >> I am developing a real time programming using xenomai, RTDM. When >> I try to read serial port, I sometimes get this message: >> >> error on rt_dev_read, code Success >> >> I checked my program and found that when rt_dev_read returns a >> negative number, this message is printed. What does this error message >> mean? It seems that my port is open when I tried to read from it. > > It means that you are probably using errno, and since rt_dev_read does > not set errno, you get "Success" as error message instead of the real > error message. If you want to print the real error message, you should > use strerror(-rc) where rc is the return code of rt_dev_read. > > But of course, I am just guessing here, seeing your test code would help > more. > > > -- >                                            Gilles. >