-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nm): Added modem reset timer when connection is failed #5644
Conversation
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
private class MMFailedModemResetTimerTask extends NMModemResetTimerTask { | ||
|
||
private final String modemManagerDbusPath; | ||
|
||
public MMFailedModemResetTimerTask(Modem modem, String modemManagerDbusPath) { | ||
super(modem); | ||
this.modemManagerDbusPath = modemManagerDbusPath; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
try { | ||
MMModemState modemState = getMMModemState(modemManagerDbusPath); | ||
if (MMModemState.MM_MODEM_STATE_FAILED.equals(modemState)) { | ||
super.run(); | ||
} | ||
} catch (DBusException e) { | ||
ModemManagerDbusWrapper.logger.warn("Couldn't get state of modem interface, caused by:", e); | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably move where the NMModemResetTimerTask
is stored (signal/handlers
... or should we move both somewhere else? Extending it here is quite confusing IMO)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see... you need it here because you're leveraging the getMMModemState
method. Still not super sure about it 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd create a new class instead of using the NMModemResetTimerTask
one, only because I need to check the state of the modem before reset. I'd not put it in the signal/handler
folder since it doesn't manage any signal, as you correclty pointed out.
Finally, since we use these classes only here for a specific task (that is we'll not use them anywhere...), I prefer to make them private.
What do you think?
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/NMDbusConnector.java
Outdated
Show resolved
Hide resolved
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/NMDbusConnector.java
Outdated
Show resolved
Hide resolved
kura/test/org.eclipse.kura.nm.test/src/test/java/org/eclipse/kura/nm/NMDbusConnectorTest.java
Show resolved
Hide resolved
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
e6c2754
to
bff4f37
Compare
@mattdibi I updated this PR, but I've not tested it yet. So, please take a look, but don't merge it. |
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/ModemManagerDbusWrapper.java
Outdated
Show resolved
Hide resolved
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
0eb4aba
to
ef861e0
Compare
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM there's only a rename that you missed
@@ -49,6 +51,7 @@ public class ModemManagerDbusWrapper { | |||
private final DBusConnection dbusConnection; | |||
|
|||
private final Map<String, NMModemResetHandler> modemHandlers = new HashMap<>(); | |||
private final Map<String, MMFailedModemResetTimer> failedModemHandlers = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not "handlers" anymore at this point
private final Map<String, MMFailedModemResetTimer> failedModemHandlers = new HashMap<>(); | |
private final Map<String, MMFailedModemResetTimer> failedModemResetTimers = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh! 😩
Signed-off-by: pierantoniomerlino <[email protected]>
TestingRunning current PR build on a Dg1014. I configured the modem to connect without installing a SIM. In the log I can see the following:
I then installed a SIM in the slot and, after 5 minutes, I can see the following:
The timer does work but the current installed version of MM (1.16.2) doesn't properly support the installed modem (Quectel EM05-G) For me this constitutes as a pass. I'll try and update the Dg1014. Update: after updating the OS and repeating the test I get the following:
|
This PR adds a modem reset timer when the connection fails.
Related Issue: This PR fixes/closes N/A
Description of the solution adopted: When a cellular connection fails at the first try (most likely because of an error on the sim), the modem stays in
FAILED
state and NM/MM refuse to start a connection. As a result, no dbus signals are reported and the usual modem reset timer is never triggered.This PR adds a reset timer when the connection fails. If the connection is recovered before the timeout of the timer, the task is terminated. If the connection is down, instead, a modem reset is requested.
Manual Tests: To trigger this behavior, power on a device without a sim inserted. Then try to setup a cellular connection. Observe in the logs that after
Modem Reset Timeout
minutes the modem is reset. Insert the sim and observe that after a further modem reset, the connection can be established.