[Rxtx] Not receiving 0xa characters
tjarvi at qbang.org
Wed Nov 24 11:09:48 MST 2010
On POSIX (Mac, Linux, Solaris, ...) systems, RXTX explicitly sets the port
to 'raw' after opening to avoid those translations/filters. We 'stomp' on
the port to force it into a predictable configuration.
term->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
term->c_oflag &= ~OPOST;
term->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
term->c_cflag &= ~(CSIZE|PARENB);
term->c_cflag |= CS8;
On windows, RXTX may not be as robust and could probably use a code review
by someone familiar with the structs (termios.c).
I could imagine a driver on windows having unusual defaults RXTX does not
override causing problems. There are not many drivers out there though.
I've personally not run into the situation mentioned.
On Wed, 24 Nov 2010, Kustaa Nyholm wrote:
> have look at:
> I think (without looking at txrx source code) that the port
> is opened without correctly setting INLCR,ICRNL and/or IGNCR.
> But that is Unix/Linux stuff and you are on windows. However,
> I would suspect there is a similar feature and possibility
> of a bug in rxtx on Windows too.
> The obvious workaround is to correct that in the source code
> if you are able to recompile from source.
> The other possibility is to try to figure out why the
> port in question defaults to eating LFs (0x0A).
> I had a program that had this same bug and hundreds of
> people used it without a problem until on one Linux machine
> it failed with similar symptoms to yours, only in my case
> it was output.
> So you might be able to somehow configure the port to default to sensible
> values so that even if rxtx does not set them correctly they
> would be set correctly by default.
> Just 2 snt worth.
> br Kusti
>> From: Christoph Weiß <weissch at technikum-wien.at>
>> Reply-To: <rxtx at qbang.org>
>> Date: Tue, 23 Nov 2010 23:28:15 +0200
>> To: <rxtx at qbang.org>
>> Conversation: [Rxtx] Not receiving 0xa characters
>> Subject: [Rxtx] Not receiving 0xa characters
>> Dear all,
>> I am currently trying to work with RxTx on a Windows 7 OS with JDK6 installed.
>> I can connect to a serial port created by a FTDI USB chip and send receive
>> data from it. However it seems that I am not able to receive any characters
>> with the value 0x0a (LF).
>> Upon looking into the source code of the serial implementation I found that
>> opening the port happens without the binary flag so I suppose that LF gets
>> possibly eaten by the OS. Could this be the problem? Is such a problem known?
>> Are there workarounds?
>> Thanks in advance,
>> best regards,
> Rxtx mailing list
> Rxtx at qbang.org
More information about the Rxtx