-
Notifications
You must be signed in to change notification settings - Fork 375
T7492: Fix modem connection code #4527
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
base: current
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -29,6 +29,7 @@ | |||||||||||||||
from vyos.configverify import verify_mtu_ipv6 | ||||||||||||||||
from vyos.ifconfig import WWANIf | ||||||||||||||||
from vyos.utils.dict import dict_search | ||||||||||||||||
from vyos.utils.network import is_wwan_connected | ||||||||||||||||
from vyos.utils.process import cmd | ||||||||||||||||
from vyos.utils.process import call | ||||||||||||||||
from vyos.utils.process import DEVNULL | ||||||||||||||||
|
@@ -137,7 +138,7 @@ def apply(wwan): | |||||||||||||||
break | ||||||||||||||||
sleep(0.250) | ||||||||||||||||
|
||||||||||||||||
if 'shutdown_required' in wwan: | ||||||||||||||||
if 'shutdown_required' in wwan or (not is_wwan_connected(wwan['ifname'])): | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The compound condition
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The call to
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||
# we only need the modem number. wwan0 -> 0, wwan1 -> 1 | ||||||||||||||||
modem = wwan['ifname'].lstrip('wwan') | ||||||||||||||||
base_cmd = f'mmcli --modem {modem}' | ||||||||||||||||
|
@@ -159,7 +160,7 @@ def apply(wwan): | |||||||||||||||
|
||||||||||||||||
return None | ||||||||||||||||
|
||||||||||||||||
if 'shutdown_required' in wwan: | ||||||||||||||||
if 'shutdown_required' in wwan or (not is_wwan_connected(wwan['ifname'])): | ||||||||||||||||
ip_type = 'ipv4' | ||||||||||||||||
slaac = dict_search('ipv6.address.autoconf', wwan) != None | ||||||||||||||||
if 'address' in wwan: | ||||||||||||||||
|
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.
[nitpick] The same compound condition is repeated later in the file (line 163). Consider extracting
shutdown_required
or disconnected logic into a descriptive boolean variable (e.g.reconnect_required
) to reduce duplication and improve readability.Copilot uses AI. Check for mistakes.