Closed openhab-bot closed 10 years ago
From igor.zel...@gmail.com on September 02, 2013 12:07:25
m_PortIdentifyer.open("Modbus Serial Master", 30000) crashes JVM if serial device file doesn't exist. Probably some defect in serial library...
I prepared small workaround for this issue.
Before calling m_PortIdentifyer.open("Modbus Serial Master", 30000) we need to check that device file exists in file system. One more important thing is that we need to check wherever it is Linux. Not sure about Windows - I don't have it.
It's pretty ugly (I added comment about it) but I don't see another way how to handle it...
So code (SerialConnectiom.java):
public void open() throws Exception {
I tested it trying to plug/unplug USB modbus master. Device unplugging doesn't crash Openhub. After plugging USB master - Openhub restores connection to it. So it works pretty well.
I cannot create my own server side clone of openhab ( https://groups.google.com/forum/#!topic/openhab/fi6Y_O-2rok ) so added patch file instead (see attachments).
How and to whom can I show it?
P.S. I'm not Java programmer - C++.
Attachment: SerialConnection.patch
From igor.zel...@gmail.com on September 02, 2013 14:53:59
Proposed patch is for Linux only.
If somebody uses modbus binding and USB rs485 (modbus) master under mac os/windows: check it please there as well.
For future: If problem will occur under Mac OS then line: if (SystemUtils.IS_OS_LINUX) { Should be replaced with: if (SystemUtils.IS_OS_UNIX) { SystemUtils.IS_OS_UNIX covers both of Linux and Mac OS. Of course it will require testing. That is why I restricted it to Linux only.
If problem will occur under Windows then it will require separate workaround (check if USB device exist at the moment).
From kai.openhab on September 14, 2013 02:03:54
This has been fixed with 1.3.0 with changeset https://code.google.com/p/openhab/source/detail?r=d5852603d140cba796afff1c6eac58423ccdae3a
Status: Fixed
Labels: Version-1.3.0
From igor.zel...@gmail.com on September 01, 2013 20:10:10
What steps will reproduce the problem? 1. Install openhab as described here https://code.google.com/p/openhab/wiki/Setup 2. Copy modbus binding into addons directory
Behaviour: openhab crash occurs Last output: execute try 1 error: I/O failed to write execute try 2 error: I/O failed to write 19:51:44.528 DEBUG o.o.b.m.internal.ModbusSlave[:338] - ModbusSlave:I/O failed to write 19:51:44.535 INFO o.o.b.m.internal.ModbusSlave[:306] - ModbusSlave error getting responce from slave /dev/ttyUSB0: No such file or directory What version of the product are you using? On what operating system? Ubuntu 13.04 Openhab 1.2.0 Openhab 1.3.0. I was able to reproduce it under debugger with latest source. Cannot reproduce with Openhab 1.3.0 SNAPSHOT because of issue #426 ( https://code.google.com/p/openhab/issues/detail?id=426 ) Please provide any additional information below. Crash occurs in class ModbusSerialSlave here: public boolean connect() { try {
In connection.open(): //2. open the port, wait for given timeout try { m_SerialPort = (SerialPort)
I cannot understand why call m_PortIdentifyer.open("Modbus Serial Master", 30000) terminates process (JVM) and doesn't throw exception...
Original issue: http://code.google.com/p/openhab/issues/detail?id=430