Hi all,
I know there are a lot of topics around this issue, but none of them helped me right now.
I am using two USB-serial ports in OpenHAB, one with a self-written sml binding, one with the plain serial binding (tried v1.5.0 and 1.7.0 SNAPSHOT)
I start OH with -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyUSB1
The serial binding has the above mentioned error when starting. It worked once, now I get this error every time.
This is what I get when starting OH. This is the second time I started it, of course I do not get the first two warning when starting OH after power on.
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyUSB0
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyUSB1
RXTX fhs_lock() Error: opening lock file: /var/lock/LCK..ttyUSB1: File exists. It is mine
8|2/ttyUSB1 testRead() Lock file failed
My problem is the part after RXTX fhs_lock() Error:... The serial binding fails to access the USB1 port, and it seems like there is a concurrent access, but no other binding or device uses this port (afaik, how can I check?). The contents of the files /var/lock/LCK..ttyUSB0 and ..1 have the same sid. To be clear: I get the same error when powering up, i.e. when the lock files do not exist.
Both devices are mine (I start OH as root):
crw-rw---- 1 root root 188, 0 Jan 1 2013 /dev/ttyUSB0
crw-rw---- 1 root root 188, 1 Jan 1 2013 /dev/ttyUSB1
It appears to me as if the serial binding creates the lock file, then is surprised that there is one, then says "ok, never mind, it is mine", and then cannot access the port because of the lock file !?!?
Are there any stty command I can issue that might help?
A strange thing, that is maybe related:
I initialize the port right before starting OH using
stty -F "/dev/ttyUSB1" 75 time 1 min 1 -icanon -ixon
And when I keep doing stty -F "/dev/ttyUSB1" every second while OH starts, I get the correct setting in return (i.e. 75 baud). Immediately after the testRead error, the baud rate is back to 9600. Any ideas?
Thanks in advance!
Yannick