Re: write() only sends 16 chars to serial port?
- From: gus.reid@xxxxxxxxx
- Date: Wed, 19 Sep 2007 13:00:02 -0700
Grant Edwards wrote:
Ah, I think I see the problem. When you call write(), the
serial driver fills the tx FIFO with 16 bytes and starts it
transmitting. You then almost immediately call tcflush(),
which discards whatever is waiting to be sent in the serial
driver's tx buffer
Argh! Yup, that's it. Well spotted.
you probably want to call tcdrain()
tcdrain() waits until all output written to the object
referred to by fd has been transmitted.
Not sure I need it, but I'll probably add the tcdrain for safety. I'm
closing the port pretty soon after each access since there can be
multiple processes controlling my hardware. This doesn't seem to flush
the buffer when I do it, but I don't know if that's guaranteed
behaviour or not.
-Gus
.
- Follow-Ups:
- Re: write() only sends 16 chars to serial port?
- From: Grant Edwards
- Re: write() only sends 16 chars to serial port?
- References:
- Re: write() only sends 16 chars to serial port?
- From: Grant Edwards
- Re: write() only sends 16 chars to serial port?
- Prev by Date: Re: Viewing multiple .png files simultaneously
- Next by Date: Re: write() only sends 16 chars to serial port?
- Previous by thread: Re: write() only sends 16 chars to serial port?
- Next by thread: Re: write() only sends 16 chars to serial port?
- Index(es):
Relevant Pages
|