Wed, 15 Jun 2005, Francisco Areas Guimaraes wrote:
Hi, I'm having the following problem: when I'm reading from the serial
port, I get a lot of garbage thta was written. Is there anyway to clear
the input before reading? I searched through the mail list archive, but
didn't find anything conclusive. Any response is deeply appreciated.
I dont think this is specified in CommAPI at all. If you found something,
please let me know.
So what you are asking for is an extension to commapi or a change in the
open() behavior that is not documented.
In Linux/Unix, you can do this in the native open code with the following:
tcflush( fd , TCIFLUSH );
search for RXTX.open. The code should be placed after PEN() man termios
documents this for the C API.
It looks like I have implemented this in the w32 termios.c so the above
change should just work in w32 too. it has not been tested.
If there is a real need for accessing this functionality from Java, we
could easily add yet another extension in rxtx 2.1. rxtx 2.0 sticks with
whatever Sun documents though.
The following patch should not cause anyone problems and could go in
easily. Could you review that its doing what you want? I can build a
test .dll on the bob account if thats what you are after.
The patch is against cvs 2.1 HEAD.
Wed, 15 Jun 2005, Francisco Areas Guimaraes wrote:
Thanks for the quick response. I realize now that there were some info
missing: I'm using win2k and rxtx version 2.0pre7. I saw the tcflush
function in the termios.c really does what I need. I have two questions:
1.You said that maybe this function might have a call in Java in version
2.1, can you tell me when this will be decided? Because based on this,
I will decide if I wait for version this build of 2.1
2.in the tcflush function, when PurgeComm is called, it is used
PURGE_RXABRT, wouldn't it be better to use PURGE_RXCLEAR instead?
Thanks,
Francisco
Trent Jarvi wrote:
Wed, 15 Jun 2005, Francisco Areas Guimaraes wrote:
>
>>Hi, I'm having the following problem: when I'm reading from the serial
>>port, I get a lot of garbage thta was written. Is there anyway to clear
>>the input before reading? I searched through the mail list archive, but
>>didn't find anything conclusive. Any response is deeply appreciated.
>>
>
>>
>
>I dont think this is specified in CommAPI at all. If you found something,
>please let me know.
>
>So what you are asking for is an extension to commapi or a change in the
>open() behavior that is not documented.
>
>
>In Linux/Unix, you can do this in the native open code with the following:
>
>tcflush( fd , TCIFLUSH );
>
>search for RXTX.open. The code should be placed after PEN() man termios
>documents this for the C API.
>
>It looks like I have implemented this in the w32 termios.c so the above
>change should just work in w32 too. it has not been tested.
>
>If there is a real need for accessing this functionality from Java, we
>could easily add yet another extension in rxtx 2.1. rxtx 2.0 sticks with
>whatever Sun documents though.
>
>
Rxtx mailing list
Rxtx (AT) mail (DOT) electronpusher.org
Francisco noted this was not working for him (though tested with rxtx 2.0.
"I couldn't test with version 2.1, because I would have to change more of
the app code than I intended, since it doesn't use the javax.comm API,
so I tested this on the 2.0pre7 code. I altered the tcflush code to use
the PURGE_RXCLEAR flag instead of the abort flag and put a call to
tcflush in the open function in SerialImp.c just before the call to
"return (jint) fd;", but it didn't work. Maybe something else is
missing, or the abort flag should be used after all."
Wed, 15 Jun 2005, Trent Jarvi wrote:
The following patch should not cause anyone problems and could go in
easily. Could you review that its doing what you want? I can build a
test .dll on the bob account if thats what you are after.
The patch is against cvs 2.1 HEAD.
Wed, 15 Jun 2005, Francisco Areas Guimaraes wrote:
Thanks for the quick response. I realize now that there were some info
missing: I'm using win2k and rxtx version 2.0pre7. I saw the tcflush
function in the termios.c really does what I need. I have two questions:
1.You said that maybe this function might have a call in Java in version
2.1, can you tell me when this will be decided? Because based on this,
I will decide if I wait for version this build of 2.1
2.in the tcflush function, when PurgeComm is called, it is used
PURGE_RXABRT, wouldn't it be better to use PURGE_RXCLEAR instead?
Thanks,
Francisco
Trent Jarvi wrote:
Wed, 15 Jun 2005, Francisco Areas Guimaraes wrote:
>
>>Hi, I'm having the following problem: when I'm reading from the serial
>>port, I get a lot of garbage thta was written. Is there anyway to clear
>>the input before reading? I searched through the mail list archive, but
>>didn't find anything conclusive. Any response is deeply appreciated.
>>
>
>>
>
>I dont think this is specified in CommAPI at all. If you found something,
>please let me know.
>
>So what you are asking for is an extension to commapi or a change in the
>open() behavior that is not documented.
>
>
>In Linux/Unix, you can do this in the native open code with the following:
>
>tcflush( fd , TCIFLUSH );
>
>search for RXTX.open. The code should be placed after PEN() man termios
>documents this for the C API.
>
>It looks like I have implemented this in the w32 termios.c so the above
>change should just work in w32 too. it has not been tested.
>
>If there is a real need for accessing this functionality from Java, we
>could easily add yet another extension in rxtx 2.1. rxtx 2.0 sticks with
>whatever Sun documents though.
>
>
Rxtx mailing list
Rxtx (AT) mail (DOT) electronpusher.org
Copyright © 2008 www.emsdn.com • All rights reserved • CMS Theme by www.emsdn.com - 0.25