From 3bbd43cc1be23830efc61f94b487bfd710554ef5 Mon Sep 17 00:00:00 2001 From: gretel Date: Tue, 19 Nov 2024 20:55:16 +0100 Subject: [PATCH] Fix KISS beacon frame formatting and add sync pattern Two issues were resolved with KISS interface beacon transmissions: 1. Fixed frame length handling to meet minimum length requirements (15 bytes) for TNCs like Direwolf. Previously, raw beacon data was being sent directly, causing frame length errors: ``` <<< Data frame from KISS client application, channel 0, total length = 11 000: c0 00 44 4e 39 54 54 2d 31 35 c0 ..FOOBAR-15. Frame length 8 not in allowable range of 15 to 2123. ERROR - Invalid KISS data frame from client app. ``` 2. Added standard 0xAA 0xAA sync pattern to improve radio modem synchronization and compatibility with packet radio protocols like FX.25 and IL2P. This ensures: - Proper frame length for TNC compatibility - Better bit synchronization with standard sync pattern - Improved reception reliability - Compatible with both KISS TNCs and packet radio protocols ``` <<< Data frame from KISS client application, channel 0, total length = 18 000: c0 00 aa aa 44 4e 39 54 54 2d 31 35 00 00 00 00 ....FOOBAR-15.... 010: 00 c0 .. [0L 21:25:43 UTC] (Not AX.25)<0xaa><0xaa>FOOBAR-15<0x00><0x00><0x00><0x00><0x00> IL2P frame, max_fec = 1, 49 encoded bytes total 000: f1 5e 48 87 b8 59 b7 a1 cc 24 57 d6 0b 36 7c f1 .^H..Y...$W..6|. 010: 7c d5 af 85 db 12 99 80 9d b8 6b bb 6b 05 df 1e |.........k.k... 020: 69 0e d8 69 05 f6 ff c4 24 fa 58 f7 e7 f2 a4 df i..i....$.X..... 030: a1 . ``` --- RNS/Interfaces/KISSInterface.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/RNS/Interfaces/KISSInterface.py b/RNS/Interfaces/KISSInterface.py index 4dad095..6441f96 100644 --- a/RNS/Interfaces/KISSInterface.py +++ b/RNS/Interfaces/KISSInterface.py @@ -319,7 +319,14 @@ class KISSInterface(Interface): if time.time() > self.first_tx + self.beacon_i: RNS.log("Interface "+str(self)+" is transmitting beacon data: "+str(self.beacon_d.decode("utf-8")), RNS.LOG_DEBUG) self.first_tx = None - self.processOutgoing(self.beacon_d) + + # Using standard HDLC flag or sync bytes + frame = bytearray([0xAA, 0xAA]) # Standard sync pattern + frame.extend(self.beacon_d) + while len(frame) < 15: + frame.append(0x00) + + self.processOutgoing(bytes(frame)) except Exception as e: self.online = False