fbc1e3f89e89ba980417a77df8987425a654ec55
When a QMI/MBIM device is unplugged, we first get the notification from the proxy that the communication is broken, and then we get the kernel event reporting that the cdc-wdm port is gone. If we reprobe the device as soon as the proxy notifies us that the communication is broken, we would end up trying to reprobe the cdc-wdm port when it's already gone, and we end up trying to create a modem object when we shouldn't: <debug> [1577963152.429386] (ttyUSB0) unexpected port hangup! <debug> [1577963152.429506] (ttyUSB0) forced to close port <debug> [1577963152.429546] (ttyUSB0) device open count is 0 (close) <debug> [1577963152.429582] (ttyUSB0) closing serial port... <debug> [1577963152.429653] (ttyUSB0) serial port closed <debug> [1577963152.430340] (ttyUSB2) unexpected port hangup! <debug> [1577963152.430391] (ttyUSB2) forced to close port <debug> [1577963152.430418] (ttyUSB2) device open count is 0 (close) <debug> [1577963152.430451] (ttyUSB2) closing serial port... <debug> [1577963152.430517] (ttyUSB2) serial port closed <info> [1577963152.436932] (tty/ttyUSB0): released by device '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' <info> [1577963152.439176] (tty/ttyUSB1): released by device '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' <info> [1577963152.440409] (tty/ttyUSB2): released by device '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' <info> [1577963152.447977] (net/wwan1): released by device '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' Cannot read from istream: connection broken <info> [1577963152.458878] Connection to qmi-proxy for /dev/cdc-wdm1 lost, reprobing <debug> [1577963152.459144] [device /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3] unexported modem from path '/org/freedesktop/ModemManager1/Modem/1' <debug> [1577963152.460151] (ttyUSB1) forced to close port <info> [1577963152.460182] [device /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3] creating modem with plugin 'Sierra' and '1' ports <debug> [1577963152.460199] QMI-powered Sierra modem found... <debug> [1577963152.460382] (cdc-wdm1) type 'qmi' claimed by /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3 <debug> [1577963152.460417] Modem (Sierra) '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' completely disposed <warn> [1577963152.460431] Could not recreate modem for device '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3': Failed to find a net port in the QMI modem <debug> [1577963152.460526] Modem (Sierra) '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' completely disposed <info> [1577963152.460627] (usbmisc/cdc-wdm1): released by device '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' <debug> [1577963152.460666] Removing empty device '/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3' Fix this by delaying the reprobing attempt some time, and make sure we cancel the reprobing if the device detects that all ports are gone.
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%