This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problem with reading nonblocking /dev/com in 1.7.10 and up


I have notice that I could not read serial device (/dev/com4 or
/dev/ttyS3) with non blocking mode since 1.7.10 and up. I used to read
serial data while doing openGL visualization. In which, the openGL
display was not changed due to blocking mode reading.

The command is

fcntl(fd, F_SETFL, FNDELAY); // set reading as non blocking mode, should
return '0' if no data comming
n=read(fd, &test, 10); // starting from 1.7.10 always return -1 although
there is incoming data

There is no problem with blocking mode, the program can read incoming data
fcntl(fd, F_SETFL, 0); // blocking mode
n=read(fd, &test, 10); // the program will stop here until incoming data
arrived

Before reporting this bug, I have tested in Windows 7 32bit, Windows 7
64bit.
luckily I have several cygwin version in different folder.
I have tested the program in version 1.7.9, 1.7.10, 1.7.11, and current
version 1.7.13 at both 32bit and 64bit Windows7.
The program can read in non blocking mode only in 1.7.9
In addition, although I compiled the program in 1.7.10 and put
cygwin1.dll (ver. 1.7.9) in the same folder, the program could read in
non blocking mode too. So, I suspect the bug is in cygwin1.dll in
version 1.7.10 and up.
Unfortunately, if I compiled the program in 1.7.11 and 1.7.13 then used
cygwin1.dll (ver. 1.7.9) the program stuck.

I notice in version 1.7.10, there are additional API_MINOR changed
(/usr/include/cygwin/version.h)

238: Export pthread_spin_destroy, pthread_spin_init, pthread_spin_lock,
pthread_spin_trylock, pthread_spin_unlock.
239: Export pthread_setschedprio.
240: Export ppoll.
241: Export pthread_attr_getstack, pthread_attr_getstackaddr,
pthread_getattr_np.
242: Export psiginfo, psignal, sys_siglist.
243: Export sysinfo.
244: Export clock_settime.
245: Export pthread_attr_getguardsize, pthread_attr_setguardsize,
pthread_attr_setstack, pthread_attr_setstackaddr.
246: Add CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID.
Export clock_getcpuclockid, pthread_getcpuclockid.
247: Export error, error_at_line, error_message_count, error_one_per_line,
error_print_progname.
248: Export __fpurge.
249: Export pthread_condattr_getclock, pthread_condattr_setclock.
250: Export clock_nanosleep.
251: RTLD_NODELETE, RTLD_NOLOAD, RTLD_DEEPBIND added.
252: CW_CVT_ENV_TO_WINENV added.
253: Export TIOCSCTTY, tcgetsid.
254: Export getgrouplist.
255: Export ptsname_r.
256: Add CW_ALLOC_DRIVE_MAP, CW_MAP_DRIVE_MAP, CW_FREE_DRIVE_MAP.
257: Export getpt.
258: Export get_current_dir_name.
259: Export pthread_sigqueue.

I don't know what kind of changed that made non blocking read failed. I
attached the program for testing.
I really hope next version will make it possible again.

Thanks in advanced for all efforts.
Kind regards,
Abdul Muis


Attachment: readserial.c
Description: Text document

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]