Commit Graph
4 Commits
Author SHA1 Message Date
Dominique Martinet 0780526594 base-bearer: set dbus disconnect_request on ignored disconnection
When we get a disconnect event that we wanted to ignore, set the
DisconnectRequest property instead so clients on dbus can act on it.

Also upgrade the logs from dbg to msg (info) as there would be otherwise
no message indicating the disconnect request if it is not acted on.

This was checked with dbus-monitor:
```
$ dbus-monitor  --system "type='signal',sender='org.freedesktop.ModemManager1'"
signal time=1747362238.227804 sender=:1.73798 -> destination=(null destination) serial=741 path=/org/freedesktop/ModemManager1/Bearer/0; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.freedesktop.ModemManager1.Bearer"
   array [
      dict entry(
         string "DisconnectRequest"
         variant             boolean true
      )
   ]
   array [
   ]
```

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2025-05-16 22:06:24 +09:00
Dominique Martinet dea8f27464 api,bearer: new 'DisconnectRequest' property
To report that the bearer has been killed from the modem side and
the connection should be terminated.

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2025-05-16 22:06:24 +09:00
Dominique Martinet 2d29832f89 dispatcher-connection: add new 'disconnect-request' event
When bearer gets an event that should trigger a disconnection but we
cannot disconnect (for example because we're waiting for pppd to close),
we now trigger a new 'disconnect-request' event instead

This was tested with the following hook:
```
$ cat /etc/ModemManager/connection.d/handle-disconnect-request.sh
#!/bin/sh

if [ "$4" != disconnect-request ]; then
	exit 0
fi

iface=$(mmcli -b "$2" -K | awk '/bearer.status.interface/ { print $3 }')

if pkill -f "pppd\>.*\<$iface\>"; then
	logger -t mm-disconnect-request "Killed $iface pppd"
else
	logger -t mm-disconnect-request "No pppd found for $iface"
fi
```

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2025-05-16 22:06:10 +09:00
Dominique Martinet f3aaa113e0 dispatcher-connection: replace 'connected' boolean with a new enum
The next commit will introduce a new dispatcher event.
This commit should not change anything user-facing

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2025-05-16 15:34:02 +09:00