From 19c3f7a4406b6c3467aaab734ab0df2eca80f462 Mon Sep 17 00:00:00 2001
From: Martin Teichmann <martin.teichmann@xfel.eu>
Date: Thu, 7 Sep 2023 11:47:43 +0200
Subject: [PATCH] fix counting terminals

there should be a test for this.
---
 ebpfcat/ethercat.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ebpfcat/ethercat.py b/ebpfcat/ethercat.py
index 0cd07a7..8c6b51f 100644
--- a/ebpfcat/ethercat.py
+++ b/ebpfcat/ethercat.py
@@ -375,7 +375,7 @@ class EtherCat(Protocol):
         p = Packet()
         p.append(ECCmd.APRD, b"\0\0", 0, 0, 0x10)
         ret = await self.roundtrip_packet(p)
-        no, = unpack("<h", ret[16:18])  # number of terminals
+        no, = unpack_from("<h", ret, 18)  # number of terminals
         return no
 
     async def find_free_address(self):
-- 
GitLab