Fixed using stale states and mm reporting errors in success cases#125
Merged
rslater-cs merged 1 commit intodevfrom Sep 18, 2025
Merged
Fixed using stale states and mm reporting errors in success cases#125rslater-cs merged 1 commit intodevfrom
rslater-cs merged 1 commit intodevfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issues with stale state reporting and incorrect error handling in the GSM modem connection logic. The changes address scenarios where modem manager would report connection errors despite successful connections, and where stale state messages could cause the system to incorrectly believe it was in a registered state when actually connected.
- Moved the
purge_subfunction to be available earlier in the connection flow - Added logic to purge stale state messages before checking modem status
- Added a check for successful connection even when modem manager reports a failure
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
Sometimes modem manager would return an error for connection when the modem would actually connect successfully, in other cases the state sub would fill with stale state which could give the impression of being in registered state when the modem was connected. Both of these scenarios could result in a MultiplePDNConnection error which could cause the modem to no longer be useable even if the code is restarted. To avoid entering this state I have used a function to remove old bus messages so we only look at the most recent states and I have checked for the case of successful connection even if modem manager returns a connection failure.
Manual test
Manual test description
This one is very difficult to get, I have only seen it on bigbox-tera and the new bigbox-v1 prototype. To get this case I simply had to keep running the code, restarting the modem beforehand and hoping to see a connection error. Without this fix you will see a list of errors ending in a constant PDN error while never entering connected state if you hit the issue, with the fix applied you should only ever see normal errors and eventually end up in connected state (Multiple PDN error should not show).
Added tests?
Added to documentation?
[optional] Are there any post-deployment tasks we need to perform?