From f5def8ffc4e309f2cc1a9a54b017ef508ab473f0 Mon Sep 17 00:00:00 2001 From: Siddharth Chandrasekaran Date: Sat, 18 May 2024 08:15:38 +0530 Subject: [PATCH] phy: Allow multiple mark bytes before SOM The specification requires the transmitting devices to allow an equivalent of 2 character time as idle time between packets. It also mentions that it must drive the line to all-high (done by sending 0xFF over the wire) for a minimum of 1 character width. The combination of these two should yield a pause of 2 char, and a mark of 1 char (UART start bit is 0). But some devices my chose to send more than one mark byte and we will be a bit more lenient to allow this. Signed-off-by: Siddharth Chandrasekaran --- src/osdp_phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osdp_phy.c b/src/osdp_phy.c index ff4743b..dc469fe 100644 --- a/src/osdp_phy.c +++ b/src/osdp_phy.c @@ -346,7 +346,6 @@ static int phy_check_header(struct osdp_pd *pd) buf[0] = OSDP_PKT_MARK; buf[1] = OSDP_PKT_SOM; pd->packet_buf_len = 2; - pd->packet_scan_skip--; SET_FLAG(pd, PD_FLAG_PKT_HAS_MARK); } else { buf[0] = OSDP_PKT_SOM; @@ -354,7 +353,8 @@ static int phy_check_header(struct osdp_pd *pd) CLEAR_FLAG(pd, PD_FLAG_PKT_HAS_MARK); } break; - } else { + } + if (cur_byte != OSDP_PKT_MARK) { pd->packet_scan_skip++; } prev_byte = cur_byte;