modemmanager: improvement of readability by reversing the query

No functional change. The change makes reading the source clearer.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert 2024-09-26 10:19:54 +02:00 committed by Robert Marko
parent cdda998996
commit deaef51d07
1 changed files with 9 additions and 8 deletions

View File

@ -338,19 +338,20 @@ modemmanager_check_state_locked() {
local modemstatus="$3"
local pincode="$4"
if [ -n "$pincode" ]; then
mmcli --modem="${device}" -i any --pin=${pincode} || {
proto_notify_error "${interface}" MM_PINCODE_WRONG
proto_block_restart "${interface}"
return 1
}
return 0
else
if [ -z "$pincode" ]; then
echo "PIN required"
proto_notify_error "${interface}" MM_PINCODE_REQUIRED
proto_block_restart "${interface}"
return 1
fi
mmcli --modem="${device}" -i any --pin=${pincode} || {
proto_notify_error "${interface}" MM_PINCODE_WRONG
proto_block_restart "${interface}"
return 1
}
return 0
}
modemmanager_check_state() {