aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem.c
AgeCommit message (Collapse)Author
2020-01-22base-modem: use g_steal_pointer() during disposeAleksander Morgado
g_steal_pointer() sets the original location to NULL already, so it's very handy.
2020-01-22base-modem: serial ports require 'timed-out' signal disconnection on cleanupAleksander Morgado
Fixes https://lists.freedesktop.org/archives/modemmanager-devel/2020-January/007686.html
2020-01-22base-modem: new helper method to cleanup ports during modem disposeAleksander Morgado
The different types of ports available in the modem will require different types of cleanup actions. E.g. QMI and MBIM ports need an explicit device close, and some other port types may need other cleanups.
2020-01-22port-qmi: asynchronous close operation alwaysAleksander Morgado
To be in sync with the qmi_device_close_async() underlying method, given that the synchronous one is deprecated.
2020-01-22base-modem: fix list iteration closing MBIM portsAleksander Morgado
The mm_port_mbim_close() operation needs 3 arguments explicitly, so make sure we provide the two additional ones as NULL.
2019-10-15core: allow flagging ports as 'audio'Aleksander Morgado
Instead of flagging them as 'ignored' so that they aren't probed, we can also flag them as 'audio' now, so that the logic knows which port to report as used for audio in the Call object.
2018-11-28base-modem: fix segfault when disposing modemAleksander Morgado
If we have a modem reference around during an ongoing operation but the modem has already been disposed after getting removed from the system, we were trying to iterate a NULL hash table, which led to a crash. https://lists.freedesktop.org/archives/modemmanager-devel/2018-November/006915.html Reported by Sebastien Fabre <sebastien.fabre@sigfox.com>
2018-10-06base-modem: remove explicit GDestroyNotify cast on g_object_unrefBen Chan
g_object_unref is in form of `void (*)(gpointer)`, which matches the GDestroyNotify signature. An explicit GDestroyNotify cast on g_object_unref is thus not needed.
2018-09-25udev: define all generic tags as symbolsAleksander Morgado
This prevents errors due to nasty typos in the strings. We define all symbols in a single header file that is NOT considered part of the API, as there is no need for MM clients to know about these tags code-wise. These tags are only meaningful when associated to devices in udev. Information of each tag is included in the general API documentation. https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/88
2018-09-12modem-helpers: reuse nicknames for the flow control tagsAleksander Morgado
And check that the string given in the tag is actually a valid one.
2018-09-12port-serial,broadband-modem: minor coding style fixesAleksander Morgado
2018-09-12base-modem,port-probe: set serial port flow control from udev tagAlfonso Sánchez-Beato
Set the serial port flow control from the udev tag ID_MM_TTY_FLOW_CONTROL before accessing the port.
2018-08-10base-modem: load AT port type hints when adding portAleksander Morgado
We keep the pflags input in mm_base_modem_grab_port() so that plugins can use other methods to gather port type hints (e.g. querying with AT commands as in Huawei/Telit or looking at sysfs properties as in HSO). For standard udev tag port type hints, it will be the base modem looking them up. Note that there is no longer any need to ignore non-flagged ports for those modems that require primary/secondary flags. They will be implicitly ignored when mm_base_modem_organize_ports() decides which ports to use, as the flagged ones are preferred over the non-flagged ones.
2018-08-08base-modem: allow parallel Enable() and Disable() requestsAleksander Morgado
If additional Enable() requests are received while one is already ongoing, we queue them and will end up completing all with the same result once the first one finishes. Same logic also for Disable(). https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/8
2018-06-02base-modem: setup a maximum number of timeouts also for USB modemsAleksander Morgado
We have a maximum number of timeouts that could be enabled for TTY modems, e.g. to detect whether the modem is available in the RS232 port or has been unplugged. This was required because RS232 modems aren't notified via udev, so there was no other way to check presence of the modem. But, the same kind of checks may be used in order to detect failed broken modems. If we have a modem that gets into an unstable state where no AT port command goes through and all get timed out, we can definitely flag the modem as invalid and get rid of it. If we don't do this, we would end up leaving the modem exposed and available for users of the API, but in a non-working state. .... <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (registered -> connecting) <debug> Launching 3GPP connection attempt with APN 'telefonica.es' <debug> Looking for best CID... <debug> (ttyACM2) device open count is 2 (open) <debug> (ttyACM2): --> 'AT+CGDCONT?<CR>' <debug> Unexpected +CGDCONT? error: 'Serial command timed out' <warn> (tty/ttyACM2) at port timed out 9 consecutive times <debug> Using empty CID 1 with PDP type 'ipv4' <debug> (ttyACM2) device open count is 3 (open) <debug> (ttyACM2) device open count is 2 (close) <debug> (ttyACM2): --> 'AT+CGDCONT=1,"IP","telefonica.es"<CR>' <warn> Couldn't initialize PDP context with our APN: 'Serial command timed out' <debug> Couldn't connect bearer '/org/freedesktop/ModemManager1/Bearer/0': 'Serial command timed out' <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> registered) <debug> Couldn't connect bearer: 'Serial command timed out' <debug> (ttyACM2) device open count is 1 (close) <error> (tty/ttyACM2) at port timed out 10 consecutive times, marking modem '/org/freedesktop/ModemManager1/Modem/0' as invalid <debug> Removing from DBus bearer at '/org/freedesktop/ModemManager1/Bearer/0' <debug> [device /sys/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.5] unexported modem from path '/org/freedesktop/ModemManager1/Modem/0' <debug> Periodic signal checks disabled <debug> (ttyACM2) device open count is 0 (close) <debug> (ttyACM2) closing serial port... <debug> (ttyACM2) serial port closed <debug> (ttyACM2) forced to close port <debug> Modem (u-blox) '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.5' completely disposed
2018-04-30base-modem: improve broken modem detection logicAleksander Morgado
If the serial port timeout detection logic is enabled, warn whenever more than one consecutive command timeout happens, not just when the limit is reached.
2017-12-05kerneldevice: allow getting interface class/subclass/protocolAleksander Morgado
2017-10-07base-modem: plug memleaks when building port listsAleksander Morgado
The mm_base_modem_find_ports() method builds a list of full references, so we need to unref them in the peek() methods. ==10047== 14,959 (24 direct, 14,935 indirect) bytes in 1 blocks are definitely lost in loss record 5,470 of 5,473 ==10047== at 0x4C2CE5F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==10047== by 0x66E3028: g_malloc (in /usr/lib/libglib-2.0.so.0.5200.3) ==10047== by 0x66FAB25: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.5200.3) ==10047== by 0x66D9A33: g_list_append (in /usr/lib/libglib-2.0.so.0.5200.3) ==10047== by 0x15F6A7: mm_base_modem_find_ports (mm-base-modem.c:845) ==10047== by 0x15E9F3: mm_base_modem_peek_port_qmi_for_data (mm-base-modem.c:579) ==10047== by 0x15E8FC: mm_base_modem_get_port_qmi_for_data (mm-base-modem.c:555) ==10047== by 0x1BB99F: _connect (mm-bearer-qmi.c:1391) ==10047== by 0x1540B4: mm_base_bearer_connect (mm-base-bearer.c:841) ==10047== by 0x181F4F: connection_step (mm-iface-modem-simple.c:597) ==10047== by 0x181321: create_bearer_ready (mm-iface-modem-simple.c:258) ==10047== by 0x612FD52: ??? (in /usr/lib/libgio-2.0.so.0.5200.3)
2017-07-17base-modem: minor coding style fixesBen Chan
2017-06-23core: use g_list_copy_deep for deep copying a GListBen Chan
2017-04-06base-modem: port mm_base_modem_authorize to use GTaskBen Chan
2017-03-22serial: allow specifying baudrate to use via udev tagsAleksander Morgado
A new 'ID_MM_TTY_BAUDRATE' per-port udev tag is introduced, which allows specifying the baudrate that will be used when opening a specific serial port. E.g.: ACTION!="add|change|move", GOTO="mm_my_modem_end" DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/*", ENV{ID_MM_TTY_BAUDRATE}="115200" LABEL="mm_my_modem_end" https://bugs.freedesktop.org/show_bug.cgi?id=100158
2017-01-04base-modem,cinterion: no need for a peek_current_data_port() methodAleksander Morgado
We already get the data port given as input parameter in disconnect_3gpp(), so there is no point in trying to find out which the data port is.
2017-01-04cinterion: implement support for the new SWWAN interfaceMatthew Stanger
2016-09-29core: use the kernel device object in the port object and the plugin interfaceAleksander Morgado
The mm_base_modem_grab_port() now receives a MMKernelDevice directly from the plugin, which is then stored in the MMPort corresponding to the port. This means that we have direct access to e.g. all properties set by udev rules everywhere, and we don't need additional GUdevClient objects (e.g. like the one used in the Huawei plugin to detect NDISDUP support during runtime). For virtual ports (e.g. generated during unit tests), we have a new 'generic' kernel device object which just provides the values from the kernel device properties given during its creation.
2016-09-22base-modem: add missing 'reprobe' property setupAleksander Morgado
The sim hotswap logic likely just uses the getter/setter methods, but we should anyway fix the property definition bits.
2016-08-10core: minor coding style changesAleksander Morgado
2016-08-10modem: support SIM hot swapCarlo Lobrano
BaseModem added reprobe property. MMDevice added logic to recreate the modem if it is set invalid and "to reprobe" MMBroadbandModem * added initialization step for SIM hot swap: 1. keep dedicated ports open to listen to modem's unsolicited 2. dedicated error management in case of initialization failure due to SIM missing * added function to be called in order to act upon SIM insertion/removal: 1. close dedicated ports 2. set the modem to be reprobed 3. disable modem * added SIM HOT SWAP boolean property MMIfaceModem * added initialization step for SIM hot swap, if supported by the plugin * dedicated error management in case of initialization failure due to SIM missing
2016-03-27base-modem: remove unused 'mm_base_modem_get_port()' methodAleksander Morgado
2016-03-27base-modem: remove unused 'mm_base_modem_owns_port()' methodAleksander Morgado
2016-03-27base-modem: remove unused 'mm_base_modem_release_port()' methodAleksander Morgado
2015-12-02core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncsAleksander Morgado
2014-09-05base-modem: always grab ports marked as ignoredAleksander Morgado
Modems may expose ports that are either just not used (e.g. modems exposing more than 2 functional AT ports) or explicitly avoided (e.g. WWAN ports when we don't know how to use them). Those kind of ports are part of the modem, but not used by ModemManager. Still, ModemManager should list them in the list of ports available for the modem, with IGNORED type.
2014-06-23base-modem: quicker find matching cdc-wdm QMI or MBIM portsAleksander Morgado
2014-06-23port: store parent sysfs path in each MMPortAleksander Morgado
2014-05-20core: minor coding style fixesBen Chan
2014-02-26base-modem: if no AT primary given, try to use data portAleksander Morgado
The Cinterion PHS8 reports a single AT port to be used as data port, and no other port as primary. In this case, recover the tty as primary AT port, instead of failing with an error.
2014-02-13base-modem: don't apply auth checks if running in the SESSION busAleksander Morgado
2014-02-13base-modem: allow grabbing 'virtual' AT portsAleksander Morgado
2014-02-13base-modem: allow looking for a subset of the available portsAleksander Morgado
2014-02-13base-modem: allow grabbing non-tty AT portsAleksander Morgado
2014-02-13port-serial-at: allow specifying subsystem when creating a 'MMPortSerialAt'Aleksander Morgado
Don't just assume that all AT ports are TTYs.
2014-02-13ports: rename 'libserial' to 'libport'Aleksander Morgado
2014-02-13ports: rename 'MMMbimPort' to 'MMPortMbim'Aleksander Morgado
2014-02-13ports: rename 'MMQmiPort' to 'MMPortQmi'Aleksander Morgado
2014-02-13ports: rename 'MMAtSerialPort' to 'MMPortSerialAt'Aleksander Morgado
2014-02-13ports: rename 'MMQcdmSerialPort' to 'MMPortSerialQcdm'Aleksander Morgado
2014-02-13ports: rename 'MMGpsSerialPort' to 'MMPortSerialGps'Aleksander Morgado
2014-02-13ports: rename 'MMSerialPort' to 'MMPortSerial'Aleksander Morgado
2013-11-22base-modem: also release cdc-wdm portsAleksander Morgado