modemmanager: fix value call with modemmanager_get_field function
authorFlorian Eckert <fe@dev.tdt.de>
Thu, 26 Sep 2024 07:57:53 +0000 (09:57 +0200)
committerRobert Marko <robimarko@gmail.com>
Thu, 17 Oct 2024 16:29:16 +0000 (18:29 +0200)
The correct values are prefixed with 'modem.generic'. This is missing
for the value 'state' and 'state-failed-reason.

While we're at it, let's move the readout of 'state-failed-reason' to the
failed case, because that's the only place it's needed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
net/modemmanager/files/lib/netifd/proto/modemmanager.sh

index 562f2e3c378a84c760068eba22fa2f90548188ee..9da65935cf21d038b422972fda9c2001351a5984 100644 (file)
@@ -315,12 +315,11 @@ modemmanager_check_state() {
 
        local state reason
 
-       state="$(modemmanager_get_field "${modemstatus}" "state")"
-       state="${state%% *}"
-       reason="$(modemmanager_get_field "${modemstatus}" "state-failed-reason")"
+       state="$(modemmanager_get_field "${modemstatus}" "modem.generic.state")"
 
        case "$state" in
                "failed")
+                       reason="$(modemmanager_get_field "${modemstatus}" "modem.generic.state-failed-reason")"
                        case "$reason" in
                                "sim-missing")
                                        echo "SIM missing"