-
Notifications
You must be signed in to change notification settings - Fork 2
Description
When satpulsetool opens /dev/ttyACM1 (SinoGNSS K902 via USB-C) and immediately sends a text command, the receiver sometimes rejects it:
Error! Invalid key word!
^@SET PVTFREQ 1
The ^@ is a NUL byte (0x00) prepended to the command. The receiver's parser sees \x00SET PVTFREQ 1 and rejects it. Retrying the same command immediately always succeeds. Never seen it recur mid-session — it's purely an open-time problem.
Happens maybe 1 in 3 attempts, but hard to reproduce on demand. Happens with different commands (SET PVTFREQ, log versiona, ECUTOFF, etc.).
A 200ms post-open delay before the first write seemed to help (0/20 failures vs ~1/3 without), but 20 attempts isn't conclusive. We also tried clearing HUPCL to prevent DTR toggling on close/reopen, but realized term.Restore() puts the original termios back before close, so the clearing was being undone. After reverting both changes, the problem stopped reproducing entirely (0/100), so neither experiment was conclusive.