Skip to content

fix: GSM init AT commands + monitor/AT race condition#542

Merged
ShaerWare merged 1 commit intomainfrom
fix/gsm-init-and-monitor-race
Mar 5, 2026
Merged

fix: GSM init AT commands + monitor/AT race condition#542
ShaerWare merged 1 commit intomainfrom
fix/gsm-init-and-monitor-race

Conversation

@ShaerWare
Copy link
Owner

Summary

  • Fix GSM initialization: add proper AT commands for SIM7600E-H (AT+CNMP=14 force 2G/3G, AT+CMEE=2 verbose errors, AT+CRC=1 extended ring, AT+COPS=3,0 operator format, AT+CMGF=0 PDU mode, AT+CNMI SMS notifications, AT+CMGD=1,4 clean SIM)
  • Remove AT+CSCS="UTF-8" (not supported by SIM7600E-H hardware)
  • Fix race condition: background monitor now skips reading when _serial_lock is held, preventing it from stealing AT command responses
  • Fix COPS parsing: fallback to unquoted operator name format
  • Fix CNUM parsing: use findall for robustness
  • Monitor: handle +CRING:, +CMTI:, VOICE CALL: END

Test plan

  • Restart backend — GSM initializes in hardware mode
  • Status shows real data: operator name, phone number, signal, network mode
  • SMS tab: incoming/outgoing SMS work
  • No more null fields in /admin/gsm/status

🤖 Generated with Claude Code

- Initialize: add AT+CMEE=2, AT+CRC=1, AT+CNMP=14 (force 2G/3G),
  AT+COPS=3,0, AT+CMGF=0 (PDU mode), AT+CNMI=2,1,0,0,0, AT+CMGD=1,4;
  remove AT+CSCS="UTF-8" (not supported by SIM7600E-H)
- Monitor: skip reading while _serial_lock is held (fixes race
  condition where monitor steals AT command responses)
- Monitor: handle +CRING:, +CMTI:, VOICE CALL: END
- COPS parsing: fallback to unquoted operator name
- CNUM parsing: use findall instead of search for robustness

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ShaerWare ShaerWare merged commit c63917e into main Mar 5, 2026
3 checks passed
@ShaerWare ShaerWare deleted the fix/gsm-init-and-monitor-race branch March 5, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant