[Rxtx] Pulling out USB Devices
Trent Jarvi
taj at www.linux.org.uk
Fri May 13 12:18:51 MDT 2005
On Fri, 13 May 2005 Christopher.Dawes at retail-logic.com wrote:
>
>
>
>
> Hello, I'm afraid i'm trying to do something rather horrible to rather
> disastrous effects. I have 1 thread which reads a command and writes a
> response with a USB serial device. When i yank the device out the reading
> terminates by throwing an exception in the read method which then tries to
> clean up and stop the communication however I then try to close the serial
> port as sometimes cleanup is performed tidily by an exit command however it
> then throws this horrible stream of errors. Has anybody got any ideas how i
> could stop this from happening?
>
> java.io.IOException: No error in readArray
> at gnu.io.RXTXPort.readArray(Native Method)
> at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1368)
> at
> com.retail_logic.apposite.appositeAgent.PED.DASistemiPEDConnector.listenAndProcessSerialData(DASistemiPEDConnector.java:310)
> at
> com.retail_logic.apposite.appositeAgent.PED.DASistemiPEDConnector.run(DASistemiPEDConnector.java:226)
> at java.lang.Thread.run(Thread.java:534)
> Closing PED About To Send
> Error 0x1f at /home/bob/rxtx-devel/src/termios.c(1284): A device attached
> to the system is not functioning.
>
>
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(488): Access is denied.
>
>
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(1476): Access is denied.
>
>
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(488): Access is denied.
>
>
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(488): Access is denied.
>
>
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(488): Access is denied.
>
>
> GetCommMOdemStatus failed!
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(488): Access is denied.
>
>
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(488): Access is denied.
>
>
> Error 0x5 at /home/bob/rxtx-devel/src/termios.c(488): Access is denied.
>
>
>
Hi Christopher
Error 0xF00 at ... is defined in win32termios.h This is the YACK()
function called when the w32 calls produce an error.
GetCommMOdemStatus failed! is an error printed when getting the comm port
stats failed in termios.c (easy enough to find with the typo :)
You can modify the source easy enough to not produce the messages. I
think those messages are useful for diagnosing problems usually.
There should be an IOException I think. What behavior do you expect when
the underlying hardware vanishes? I don't really know what the right
thing to do would be as this could happen with wiring/connection problems
so just shutting up rxtx is going to lead to worse conditions (silent
failures).
Maybe handle this in a new child class of IOException like
IODeviceDetatchedException? That first error # is telling us thats what
happened.
--
Trent Jarvi
taj at www.linux.org.uk
More information about the Rxtx
mailing list