Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knxd crash when trying to write to knx bus #415

Open
megacar1 opened this issue Sep 3, 2019 · 6 comments
Open

knxd crash when trying to write to knx bus #415

megacar1 opened this issue Sep 3, 2019 · 6 comments

Comments

@megacar1
Copy link

megacar1 commented Sep 3, 2019

Hi guys,
I have seen the issue #290 about knxd crash on rapid groupwrite and used the debug commands from that topic to figure out my issue - my issue is much worse, I cannot write anything to the bus, knxd crashes immediately with some low level usb driver error.
I have read developer comments that usb hid is broken by design and it should be abandoned and I understand it, however, I'm asking your help here since I waited for the device to arrive over a month, and I attempted to order TPUART usb device from busware.de but unfortunately they do not deliver to my location....
logs are below - in your opinion, is there ANY chance to make this work before I throw it in the garbage, either by trying the older eibd software instead of knxd, or by installing/building knxd myself instead of using the script from some blog (that I did)

running RPI hassbian
kndx ver 0.14.29-5
usb device: ESYLUX EIB, KNX USB data interface, CU-DIN USB KNX
Product No.: NS6516567
I have added product and vendor id to my udev rules for it to work.
ESYLUX KNX-USB Inteface
SUBSYSTEM=="usb", ATTR{idVendor}=="28c2", ATTR{idProduct}=="000c", ACTION=="add", GROUP="knxd", MODE="0664"

The interface works fine when only reading data from knxbus, also tunneling works fine via knxd to ETS. the problems appear only when attempting to write with knxtool groupswrite ip:localhost 1/3/15 0 for example. or when trying via home assistant platform connected to knx tunnel of knxd, same behaviour, crash

about this libusb error below, people online say I need to unload kernel usb driver before claiming the device...if that is possible..

oot@knx:~# knxd -B log -t 1023 --eibaddr=1.1.128 --client-addrs=1.1.129:8 -D -T -R -S -i --listen-local=/tmp/knx -t 1023 -B log -b usb
Layer 4 [ 1:main 0.000] initialized
Layer 4 [ 1:main 0.000] setting up
Layer 0 [ 4:log/main 0.000] State setup
Layer 3 [ 5:server/Server 0.000] registerLink: 5:server
Layer 3 [10:A.tcp/inet 0.000] registerLink: 10:A.tcp
Layer 3 [13:B.unix/local 0.001] registerLink: 13:B.unix
Layer 0 [18:log/C.usb 0.001] State setup
Layer 1 [20:C.usb/usbL 0.019] Detect
Layer 1 [20:C.usb/usbL 0.020] Using 1:4:1:0:0 (1:130)
Layer 1 [20:C.usb/usbL 0.037] Detect
Layer 1 [20:C.usb/usbL 0.037] Using 1:4:1:0:0 (1:130)
Layer 3 [16:C.usb/Conn 0.037] registerLink: 16:C.usb
Layer 4 [ 1:main 0.037] setup OK
Layer 4 [ 1:main 0.038] trigger going up
Layer 0 [ 4:log/main 0.038] State start
Layer 3 [16:C.usb/Conn 0.038] Start: cfg:C.usb
Layer 5 [16:C.usb/Conn 0.038] down => >up
Layer 5 [16:C.usb/Conn 0.038] Starting
Layer 0 [18:log/C.usb 0.038] State start
Layer 1 [20:C.usb/usbL 0.038] Open
E00000029: [20:C.usb] USBLowLevelDriver: setup config: LIBUSB_ERROR_BUSY
Layer 1 [20:C.usb/usbL 0.038] Close
Layer 1 [20:C.usb/usbL 0.038] Release
Layer 0 [18:log/C.usb 0.039] State stopped
Layer 5 [16:C.usb/Conn 0.039] >up => down
Layer 4 [16:C.usb/Conn 0.039] down/error
Layer 4 [16:C.usb/Conn 0.039] down/error
Layer 3 [13:B.unix/local 0.039] Start: cfg:B.unix
Layer 5 [13:B.unix/local 0.039] down => >up
Layer 8 [13:B.unix/local 0.039] OpenLocalSocket /tmp/knx
E00000016: [13:B.unix] OpenLocalSocket /tmp/knx: bind: Address already in use
Layer 8 [13:B.unix/local 0.039] StopServer
Layer 5 [13:B.unix/local 0.040] >up => down
Layer 4 [13:B.unix/local 0.040] down/error
Layer 4 [13:B.unix/local 0.040] down/error
Layer 3 [ 5:server/Server 0.040] Start: cfg:server
Layer 5 [ 5:server/Server 0.040] down => >up
Layer 8 [ 5:server/Server 0.040] Open
Layer 0 [ 5:server/Server 0.040] Open
Layer 0 [ 5:server/Server 0.040] Opened
Layer 8 [22:router/driver 0.040] OpenD
Layer 8 [22:router/driver 0.041] OpenedD
Layer 3 [21:router/ConnC 0.041] registerLink: 21:router_21
Layer 3 [21:router/ConnC 0.041] Start: cfg:router
Layer 5 [21:router/ConnC 0.041] down => >up
Layer 5 [21:router/ConnC 0.041] Starting
Layer 5 [21:router/ConnC 0.041] >up => up
Layer 4 [21:router/ConnC 0.042] up
Layer 5 [21:router/ConnC 0.042] Started
Layer 4 [21:router/ConnC 0.042] up
Layer 8 [ 5:server/Server 0.042] Opened
Layer 5 [ 5:server/Server 0.042] >up => up
Layer 4 [ 5:server/Server 0.042] up
Layer 5 [ 5:server/Server 0.042] Started
Layer 4 [ 5:server/Server 0.042] up
Layer 3 [10:A.tcp/inet 0.042] Start: cfg:A.tcp
Layer 5 [10:A.tcp/inet 0.042] down => >up
Layer 8 [10:A.tcp/inet 0.042] OpenInetSocket 6720
E00000013: [10:A.tcp] OpenInetSocket 6720: bind: Address already in use
Layer 8 [10:A.tcp/inet 0.043] StopServer
Layer 5 [10:A.tcp/inet 0.043] >up => down
Layer 4 [10:A.tcp/inet 0.043] down/error
Layer 4 [10:A.tcp/inet 0.043] down/error
Layer 4 [ 1:main 0.043] going up triggered
Layer 4 [ 1:main 0.043] check start
Layer 4 [16:C.usb/Conn 0.043] is down
Layer 4 [13:B.unix/local 0.043] is down
Layer 4 [10:A.tcp/inet 0.043] is down
Layer 4 [ 1:main 0.043] check end: want_up 1 some 1>1 all 0>0, going 0 up 2 down 3
F00000105: [16:C.usb] Link down, terminating
F00000105: [13:B.unix] Link down, terminating
F00000105: [10:A.tcp] Link down, terminating
Layer 4 [ 1:main 0.044] trigger Going down
Layer 0 [ 4:log/main 0.044] State stop
Layer 4 [21:router/ConnC 0.044] Stopping
Layer 5 [21:router/ConnC 0.044] up => >down
Layer 5 [21:router/ConnC 0.044] Stopping
Layer 5 [21:router/ConnC 0.044] >down => down
Layer 4 [21:router/ConnC 0.044] down
Layer 4 [21:router/ConnC 0.044] down
Layer 4 [16:C.usb/Conn 0.044] Stopping
Layer 5 [16:C.usb/Conn 0.044] down/error => >down
Layer 4 [16:C.usb/Conn 0.044] down/error
Layer 4 [13:B.unix/local 0.044] Stopping
Layer 5 [13:B.unix/local 0.044] down/error => >down
Layer 4 [13:B.unix/local 0.044] down/error
Layer 4 [ 5:server/Server 0.045] Stopping
Layer 5 [ 5:server/Server 0.045] up => >down
Layer 5 [21:router/ConnC 0.045] Stopping
Layer 3 [21:router/ConnC 0.045] unregisterLink: router_21
Layer 0 [ 5:server/Server 0.045] Close
Layer 5 [ 5:server/Server 0.045] >down => down
Layer 4 [ 5:server/Server 0.045] down
Layer 4 [ 5:server/Server 0.045] down
Layer 4 [10:A.tcp/inet 0.045] Stopping
Layer 5 [10:A.tcp/inet 0.045] down/error => >down
Layer 4 [10:A.tcp/inet 0.045] down/error
Layer 4 [ 1:main 0.045] check start
Layer 8 [22:router/driver 0.046] CloseD
Layer 4 [16:C.usb/Conn 0.046] is down
Layer 4 [13:B.unix/local 0.046] is down
Layer 4 [ 5:server/Server 0.046] is down
Layer 4 [10:A.tcp/inet 0.046] is down
Layer 4 [ 1:main 0.046] check end: want_up 0 some 1>0 all 0>0, going 0 up 0 down 4
Layer 0 [ 4:log/main 0.046] State stopped
Layer 4 [ 1:main 0.046] down
Layer 4 [ 1:main 0.046] deleting
Layer 1 [20:C.usb/usbL 0.046] Close
Layer 1 [20:C.usb/usbL 0.046] Release
Layer 8 [13:B.unix/local 0.046] StopServer
Layer 8 [ 5:server/Server 0.046] Close
Layer 8 [10:A.tcp/inet 0.047] StopServer
Layer 4 [ 1:main 0.047] deleted.

@Jay-El66
Copy link

Jay-El66 commented Oct 31, 2019

Hi,

I have the exact same issue with an ABB STOTZ-KONTAKT GmbH KNX-USB Interface that used to work perfectly. After an MicroSD crash I reinstalled from scratch and ever since then only:

knxtool vbusmonitor1 ip:localhost

works.

But as soon as I write anything to the bus, KNXD crashes after a few seconds.

My log is also the same as above:
...........er 4 [ 1:main 27.587] check end: want_up 0 some 1>0 all 0>0, going 0 up 0 down 4
Layer 0 [ 4:log/main 27.587] State stopped
Layer 4 [ 1:main 27.587] down
Layer 4 [ 1:main 27.587] deleting
Layer 1 [20:C.usb/usbL 27.587] Close
Layer 1 [20:C.usb/usbL 27.587] Release
Layer 8 [13:B.unix/local 27.587] StopServer
Layer 8 [ 5:server/Server 27.587] Close
Layer 8 [10:A.tcp/inet 27.587] StopServer
Layer 4 [ 1:main 27.587] deleted.

So I too would really love a fix for this.

@Jay-El66
Copy link

Jay-El66 commented Nov 4, 2019

Hi guys,
...- my issue is much worse, I cannot write anything to the bus, knxd crashes immediately with some low level usb driver error.

I ditched knxd and switched to calimero, works great:

https://michlstechblog.info/blog/eib-knx-knxnet-ip-gateway-with-calimero-server-on-raspberry-pi-orange-pi-pc/?unapproved=2932&moderation-hash=35156679106884d4fa2b5b08e56e4599#comment-2932

@megacar1
Copy link
Author

megacar1 commented Nov 6, 2019

me too, sorry didn't see your post earlier. calimero works great for me too.

@akellai
Copy link
Contributor

akellai commented Dec 8, 2019

I might have spotted this particular crash. I'm using the current stable (knxd 0.14.24-3:42b06c4) and noticed that EMI_Common::start() is never called. Therefore initial value in the state is unpredictible

Still unreliable on RPI with Openwrt (19.07.0-rc2)/ABB USB device, but
the following patch fixes it for me on ubuntu VMWare virtual machine with ABB USB/S1.1 attached through pass-thru:

--- a/src/libserver/emi_common.cpp
+++ b/src/libserver/emi_common.cpp
@@ -81,6 +81,7 @@ EMI_Common::start()
void
EMI_Common::started()
{
+ state = E_idle;
TRACEPRINTF (t, 2, "OpenL2");
if (monitor)
cmdEnterMonitor();
@@ -103,7 +104,7 @@ EMI_Common::send_L_Data (LDataPtr l)
{
if (state != E_idle)
{
- ERRORPRINTF(t, E_ERROR, "EMI_common: send while waiting");
+ ERRORPRINTF(t, E_ERROR, "EMI_common: send while waiting: %d", state);
return;
}

EDIT: looks like suggestion from the other thread to increase the send-timeout to 5000 makes it also work (and looks pretty stable) on RPI 3B+ with USB ABB/S1.1. What a great software!

@megacar1
Copy link
Author

megacar1 commented Dec 9, 2019 via email

@akellai
Copy link
Contributor

akellai commented Dec 9, 2019

So far knxd is running fine w/o problems for me (RPI + openwrt + knxd + ABB USB/S1.1).
my goal was to run on Openwrt (at the end not on RPI but something like MR3020 v3). Don't think it's possible with calimero:(
I did a lot of changes to Openwrt knxd package (pushing to the latest knxd commit) and I did change /etc/init.d/knxd to make it run without systemd. But at the end very happy with the result.
In the past I had ported eidb with USB stack to openwrt and this device is still running 24x7 on my MR3020 router with ABB USB interface for 7+ years now. Rock solid. Just thought it's time to update to the latest HW/SW
Glad my suggestion made it to the commit so fast. Cannot wait for the release of both knxd and Openwrt 19 to make it final!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants