[Rxtx] [USB Serial Port + RXTX 2.1.7] Very very strange reception speed BUG!
Trent Jarvi
tjarvi at qbang.org
Wed Dec 27 18:44:39 MST 2006
On Wed, 27 Dec 2006, Dominik S. Herwald wrote:
> Trent Jarvi wrote:
>> On Wed, 27 Dec 2006, Dominik S. Herwald wrote:
>>
>>> Hello Trent and everybody else,
>>>
>>> I could not resolve this problem so far ... :-(
>>>
>>> Really no idea?
>>> This is a very annoying problem!
>>>
>>> Just like I said - it works with javax.comm, but sadly javax.comm does
>>> not work with the Baudrates I need
>>> and it is slower than RXTX when transferring many data packets.
>>>
>>> Btw. I found out another interesting thing - when I use javax.comm I can
>>> remove USB Serial Port Adapters from the USB Port
>>> without closing the port before! No crash or error occurs!
>>> No problem like the exception/crash I get with RXTX! This seems to be
>>> solved better in Javax.comm.
>>> There MUST be a way to solve all these USB Port issues without writing
>>> any USB routines!
>>> javax.comm does not use any USB stuff at all - and it works like
>>> intended. The only issue is that it does not work
>>> with my Baudrates and not with Linux and some other things of course....
>>>
>>>
>>
>> Hi Dominik
>>
>> I do not yet have an answer to the slow data receiving except when you have
>> a hub in place. Keep in mind that observed differences may be bugs but
>> could be related to differences in implementation which the driver has not
>> been tested against. I don't know what Sun did. I assume I'll be seeing
>> more bug reports concerning this soon enough. Right now, I'm trying to get
>> up to speed on win64 and Mac. I don't have time to jump between fires but
>> will get to it eventually.
>>
>> With the unplugged USB dongle. How is javax.comm behaving if you read and
>> or write to the unplugged port? No exceptions? I would expect all sorts
>> of IOExceptions.
>>
>> --
>> Trent Jarvi
>> tjarvi at qbang.org
>>
>>
>
> Hi Trent,
>
> OK if there are more important things - no problem I can understand this. I
> will now try to use D2XX Drivers from FTDI via JNI (JD2XX). Maybe this will
> work ...
>
> To javax.comm:
> Sure I get an exception when I try to write to the Port after I physically
> removed it.
> javax.comm does not know that the port has been removed - just like RXTX. The
> big difference is: javax.comm does NOT crash and it does not produce
> exceptions when I don't do
> anything with the Serialport. If I just remove it - nothing happens. Only
> when I write to the port
> I get ONE single exception:
>
> java.io.IOException: write error
> at com.sun.comm.Win32SerialPort.write(Win32SerialPort.java:677)
> at
> com.sun.comm.Win32SerialOutputStream.write(Win32SerialOutputStream.java:38)
> ...
>
> The funny thing is - when I write a second time to the port - the application
> locks up and does not react
> anymore. I have to kill the process after this.
> But this is no problem as javax.comm does not produce exceptions in an
> infinite loop until I kill it when I remove the
> USB Port and thus I can close the Serialport when I get this write error
> exception and everything is fine.
> I can still use my application, close the port with no problems, reattach the
> USB Adapter and open the port
> again - works like noting has happened.
>
>
> Just to remind you of the old problem I posted a few month ago on this list:
> After removing an open USB Serialport,
> RXTX produces:
> java.io.IOException: No error in nativeavailable
> at gnu.io.RXTXPort.nativeavailable(Native Method)
> at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1373)
> at java.io.BufferedInputStream.fill(Unknown Source)
> at java.io.BufferedInputStream.read(Unknown Source)
> at
> de.dsh.rp6loader.io.RP6SerialPortRXTX.serialEvent(RP6SerialPortRXTX.java:294)
> at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
> at gnu.io.RXTXPort.eventLoop(Native Method)
> at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)
>
> And:
>
> Error 0x5 at /home/bob/foo/rxtx-devel/build/../src/termios.c(482): Zugriff
> verweigert
>
> on the system commandline - forever in an infinite loop! I continues
> generating serial events and
> everytime I get this exception.
> I can only perform System.exit(0) in the exception handler - closing the
> port causes the system to crash...
>
>
>
> If RXTX would behave like javax.comm - - hehe - I would have never posted a
> bug report on
> this list ;-)
>
ret = ClearCommError( index->hComm, &ErrCode, Stat );
if ( ret == 0 )
{
YACK();
return( ret );
}
We could silence that YACK. The evenLoop is throwing exceptions.
Since it loops, it will keep throwing those exceptions - for a good
reason. It probably keeps trying to clear the error too.
Those are the only two problems? I usually silence the yacks in
production code but they are invaluable here. The exceptions in the event
loop could be silenced too. They do not relate to a specific action a
person or program in trying to do.
The event loop could even just close the port and return knowing the port
is hosed and let the program figure it out from there. Reading and
writing would blow up.
I've not thought through it completely but those appear to be logical
choices.
More information about the Rxtx
mailing list