Boost logo

Boost Users :

Subject: Re: [Boost-users] Asio problems with async_read
From: Allan Nielsen (a_at_[hidden])
Date: 2011-08-08 11:53:17


Hi

> However having done a lot of serial comms in the past seeing a couple of characters only whilst more data is on the wire I'd guess that the timeout is as a result of the low level serial hardware interrupt. The UART is probably signalling that its internal FIFO buffer is full and you need to read this promptly - quite how that all pans out and what daemon / service has the responsibility of reading this these days I haven't got the faintest - I was writing TSR's when I knew the gory technical details of this so life was much simpler.

You might got a point...

I have done some strace'ing:

# This is the latest good read
readv(6, [{"\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
512}], 1) = 1
gettid() = 4712
write(2, "I0808 17:39:37.919446 4712 ccTa"..., 100) = 100
gettid() = 4712
write(2, "I0808 17:39:37.919489 4712 ccTa"..., 56) = 56

# What happens here?
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fdc6c5b3000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fdc6c5b2000
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
open("/usr/local/lib/libunwind.so.7", O_RDONLY) = 7
fstat(7, {st_mode=S_IFREG|0755, st_size=86957, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fdc6c5b1000
read(7, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\"\0\0\0\0\0\0"...,
4096) = 4096
lseek(7, 69632, SEEK_SET) = 69632
read(7, "\306\37\0\0\0\0\0\0\326\37\0\0\0\0\0\0\346\37\0\0\0\0\0\0\366\37\0\0\0\0\0\0"...,
4096) = 4096
lseek(7, 73728, SEEK_SET) = 73728
close(7) = 0
munmap(0x7fdc6c5b1000, 4096) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0

How should I catch such an event from my c++ code? And do you know
what it means?

> I'm actually impressed that you've found a computer that still has a serial port on it! Most seem to have gone over to the ubiquitous USB these days - though that may be the easiest solution - use USB and a usb/serial converter which would avoid having to rediscover the lost art of programming UART latch timings etc and give you a decent amount of low level buffering so you could ignore low level stuff and just read the data.

I'm using a USB to serial converter. But the case might be that the
firmware for the converter is buggy!

--
Allan W. Nielsen

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net