I monitor a USB serial port (connected to a remote device that takes ASCII commands, returning an ASCII answer in return) by running the following command that creates a pseudo-tty that is relaying between nrjavaserial and the actual USB port:
e.g. the device is returning valid responses, and the serial driver on the linux instance is correctly working, BUT the inputstream.read() calls is returning a constant stream of HEX 00 bytes:
2017-05-08 20:00:19.402 [WARN ] [.oceanic.handler.OceanicThingHandler] - Received an empty answer for 'getCYN'
('[103, 101, 116, 67, 89, 84, 13]')eanic.handler.OceanicThingHandler] - writeString : getCYT
2017-05-08 20:00:22.412 [TRACE] [.oceanic.handler.OceanicThingHandler] - Read 1 bytes : 00
2017-05-08 20:00:22.412 [TRACE] [.oceanic.handler.OceanicThingHandler] - Byte 0 equals '' (hex '00')
2017-05-08 20:00:22.422 [TRACE] [.oceanic.handler.OceanicThingHandler] - Reading the inputStream
2017-05-08 20:00:32.428 [WARN ] [.oceanic.handler.OceanicThingHandler] - A timeout occurred while requesting data from the water softener
2017-05-08 20:00:32.428 [TRACE] [.oceanic.handler.OceanicThingHandler] - Resetting the SerialPortReader
2017-05-08 20:00:32.428 [WARN ] [.oceanic.handler.OceanicThingHandler] - Received an empty answer for 'getCYT'
('[103, 101, 116, 82, 84, 73, 13]')eanic.handler.OceanicThingHandler] - writeString : getRTI
2017-05-08 20:00:45.452 [WARN ] [.oceanic.handler.OceanicThingHandler] - A timeout occurred while requesting data from the water softener
2017-05-08 20:00:45.452 [TRACE] [.oceanic.handler.OceanicThingHandler] - Resetting the SerialPortReader
2017-05-08 20:00:45.452 [WARN ] [.oceanic.handler.OceanicThingHandler] - Received an empty answer for 'getRTI'
('[103, 101, 116, 87, 72, 85, 13]')eanic.handler.OceanicThingHandler] - writeString : getWHU
2017-05-08 20:00:48.457 [TRACE] [.oceanic.handler.OceanicThingHandler] - Read 1 bytes : 00
2017-05-08 20:00:48.457 [TRACE] [.oceanic.handler.OceanicThingHandler] - Byte 0 equals '' (hex '00')
2017-05-08 20:00:48.468 [TRACE] [.oceanic.handler.OceanicThingHandler] - Reading the inputStream
2017-05-08 20:00:58.459 [WARN ] [.oceanic.handler.OceanicThingHandler] - A timeout occurred while requesting data from the water softener
2017-05-08 20:00:58.459 [TRACE] [.oceanic.handler.OceanicThingHandler] - Resetting the SerialPortReader
2017-05-08 20:00:58.459 [WARN ] [.oceanic.handler.OceanicThingHandler] - Received an empty answer for 'getWHU'
('[103, 101, 116, 73, 87, 72, 13]')eanic.handler.OceanicThingHandler] - writeString : getIWH
2017-05-08 20:01:01.470 [TRACE] [.oceanic.handler.OceanicThingHandler] - Read 1 bytes : 00
2017-05-08 20:01:01.470 [TRACE] [.oceanic.handler.OceanicThingHandler] - Byte 0 equals '' (hex '00')
2017-05-08 20:01:01.481 [TRACE] [.oceanic.handler.OceanicThingHandler] - Reading the inputStream
@madhephaestus @cvanorman [as complement to https://github.com/NeuronRobotics/nrjavaserial/issues/95] I discovered the following behaviour on a Linux Ubuntu 17.04 instance:
I monitor a USB serial port (connected to a remote device that takes ASCII commands, returning an ASCII answer in return) by running the following command that creates a pseudo-tty that is relaying between nrjavaserial and the actual USB port:
sudo socat -v /dev/ttyUSB0,raw,echo=0 pty,link=/dev/ttyS1,raw,echo=0
In a first test, when I declare the following in java (omitting boiler plate try/catch clauses):
and then read out the stream as follows:
then socat is returning:
with "getCYN" the input for the remote device, and "C5" being the response from the device
on the java console I get the same ASCII sequence, as expected:
However, if I declare directly the USB port, in either PORT_RAW or PORT_SERIAL mode:
then the output is as follows for socat (socat is only reporting the bytes returned on the /dev/ttyUSB0 serial port):
e.g. the device is returning valid responses, and the serial driver on the linux instance is correctly working, BUT the inputstream.read() calls is returning a constant stream of HEX 00 bytes: