2a8d20292abc55f28cc8b1d8218513626878a7d8
If the reopening operation fails when attempting to recover the previous open count, it could mean the port is already gone. We didn't get a HUP in the TTY because the channel I/O monitoring isn't in place during this time, so this is the best way to detect that at this point. And if we do see an error, we'll flag the port as forced closed so that we do not attempt to reopen it again. ModemManager[4219]: <debug> [1568123246.421399] Disconnecting bearer '/org/freedesktop/ModemManager1/Bearer/0' ModemManager[4219]: <info> [1568123246.421465] Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connected -> disconnecting) ModemManager[4219]: <debug> [1568123246.421698] Reopening data port (modemu)... ModemManager[4219]: <debug> [1568123246.421722] (modemu) reopening port (2) ModemManager[4219]: <debug> [1568123246.421740] (modemu) device open count is 1 (close) ModemManager[4219]: <debug> [1568123246.421754] (modemu) device open count is 0 (close) ModemManager[4219]: <debug> [1568123246.421770] (modemu) closing serial port... ModemManager[4219]: <debug> [1568123246.421786] (modemu): port now disconnected ModemManager[4219]: <debug> [1568123246.421816] (modemu) serial port closed ModemManager[4219]: <info> [1568123248.028573] (tty/modemu): released by device '/sys/devices/pci0000:00/0000:00:00.0' ModemManager[4219]: <debug> [1568123248.028637] Removing empty device '/sys/devices/pci0000:00/0000:00:00.0' ModemManager[4219]: <debug> [1568123248.028866] Removing from DBus bearer at '/org/freedesktop/ModemManager1/Bearer/0' ModemManager[4219]: <debug> [1568123248.028914] [device /sys/devices/pci0000:00/0000:00:00.0] unexported modem from path '/org/freedesktop/ModemManager1/Modem/0' ModemManager[4219]: <debug> [1568123248.028944] Periodic signal checks disabled ModemManager[4219]: <debug> [1568123256.401738] Connection monitoring is unsupported by the device ModemManager[4219]: <debug> [1568123256.422939] (modemu) opening serial port... ModemManager[4219]: <warn> [1568123256.423062] (modemu) could not open serial device (2) ModemManager[4219]: <debug> [1568123256.423104] Couldn't disconnect bearer '/org/freedesktop/ModemManager1/Bearer/0': Couldn't reopen port (0): Could not open serial device modemu: No such file or directory ModemManager[4219]: _close_internal: assertion 'self->priv->open_count > 0' failed Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff77894e6 in ?? () from /usr/lib/libglib-2.0.so.0 (gdb) (gdb) bt #0 0x00007ffff77894e6 in () at /usr/lib/libglib-2.0.so.0 #1 0x00007ffff7789738 in g_logv () at /usr/lib/libglib-2.0.so.0 #2 0x00007ffff777ff80 in g_log () at /usr/lib/libglib-2.0.so.0 #3 0x0000555555661115 in _close_internal (self=0x555555796380, force=0) at mm-port-serial.c:1378 #4 0x0000555555661865 in mm_port_serial_close (self=0x555555796380) at mm-port-serial.c:1503 #5 0x00005555556078cc in ports_context_unref (ctx=0x5555557c4ca0) at mm-broadband-modem.c:9801 #6 0x000055555560e33a in finalize (object=0x5555557a4250) at mm-broadband-modem.c:11940 #7 0x00007ffff787b351 in g_object_unref () at /usr/lib/libgobject-2.0.so.0 #8 0x00005555555b1c71 in detailed_disconnect_context_free (ctx=0x555555785000) at mm-broadband-bearer.c:1369 #9 0x00007ffff795d62a in () at /usr/lib/libgio-2.0.so.0 #10 0x00007ffff787b351 in g_object_unref () at /usr/lib/libgobject-2.0.so.0 #11 0x00005555555b2532 in data_reopen_3gpp_ready (data=0x555555796380, res=0x55555573a580, task=0x55555573a040) at mm-broadband-bearer.c:1605 #12 0x00007ffff795d584 in () at /usr/lib/libgio-2.0.so.0 #13 0x00007ffff7962a87 in () at /usr/lib/libgio-2.0.so.0 #14 0x0000555555661bc6 in reopen_do (self=0x555555796380) at mm-port-serial.c:1607 #15 0x00007ffff778e3c4 in () at /usr/lib/libglib-2.0.so.0 #16 0x00007ffff778ebb0 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0 #17 0x00007ffff7790b11 in () at /usr/lib/libglib-2.0.so.0 #18 0x00007ffff7791a63 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0 #19 0x000055555559afb0 in main (argc=3, argv=0x7fffffffea58) at main.c:181
ModemManager. ModemManager provides a unified high level API for communicating with mobile broadband modems, regardless of the protocol used to communicate with the actual device (Generic AT, vendor-specific AT, QCDM, QMI, MBIM...). Using. ModemManager is a system daemon and is not meant to be used directly from the command line. However, since it provides a DBus API, it is possible to use 'dbus-send' commands or the new 'mmcli' command line interface to control it from the terminal. The devices are queried from udev and automatically updated based on hardware events, although a manual re-scan can also be requested to look for RS232 modems. Implementation. ModemManager is a DBus system bus activated service (meaning it's started automatically when a request arrives). It is written in C, using glib and gio. Several GInterfaces specify different features that the modems support, including the generic MMIfaceModem3gpp and MMIfaceModemCdma which provide basic operations for 3GPP (GSM, UMTS, LTE) or CDMA (CDMA1x, EV-DO) modems. If a given feature is not available in the modem, the specific interface will not be exported in DBus. Plugins. Plugins are loaded on startup, and must implement the MMPlugin interface. It consists of a couple of methods which tell the daemon whether the plugin supports a port and to create custom MMBroadbandModem implementations. It most likely makes sense to derive custom modem implementations from one of the generic classes and just add (or override) operations which are not standard. There are multiple fully working plugins in the plugins/ directory that can be used as an example for writing new plugins. Writing new plugins is highly encouraged! The plugin API is open for changes, so if you're writing a plugin and need to add or change some public method, feel free to suggest it! License. The ModemManager and mmcli binaries are both GPLv2+. The libmm-glib library is LGPLv2+.
Languages
C
98.6%
Meson
0.8%
Python
0.4%
Shell
0.2%