Open szescxz opened 7 months ago
After digging further I realized my modem is using CRLF
while quectel-timesync
only handles LF
.
--- a/quectel-timesync.c
+++ b/quectel-timesync.c
@@ -105,6 +105,9 @@ int read_response(int fd, const char *response, char *buf, int buf_size)
break;
case READ_STATE_CONTENT:
if (input_char == '\n') {
+ if (*(ptr - 1) == '\r')
+ ptr--;
+
*ptr = '\0';
return ptr - buf;
} else {
@szescxz I'll look info this. Can you tell me which modem you are seeing this behavior on?
RM520N-GL, works if applied the patch above. Although I'll need to ensure quectel-timesync
has exclusive access to the serial port, but that would be another story.
I think we have the same modem around. I'll check.
Tested with commit 4333888cb8025b92511597a95859943fae0a0bc8 on
aarch64
, applied a small patch to see what's going on:Result: