Age | Commit message (Collapse) | Author |
|
g_steal_pointer() sets the original location to NULL already, so it's
very handy.
|
|
Fixes https://lists.freedesktop.org/archives/modemmanager-devel/2020-January/007686.html
|
|
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.
|
|
To be in sync with the qmi_device_close_async() underlying method,
given that the synchronous one is deprecated.
|
|
The mm_port_mbim_close() operation needs 3 arguments explicitly, so
make sure we provide the two additional ones as NULL.
|
|
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.
|
|
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>
|
|
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.
|
|
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
|
|
And check that the string given in the tag is actually a valid one.
|
|
|
|
Set the serial port flow control from the udev tag
ID_MM_TTY_FLOW_CONTROL before accessing the port.
|
|
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.
|
|
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
|
|
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
|
|
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.
|
|
|
|
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)
|
|
|
|
|
|
|
|
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
|
|
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.
|
|
|
|
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.
|
|
The sim hotswap logic likely just uses the getter/setter methods, but we should
anyway fix the property definition bits.
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
Don't just assume that all AT ports are TTYs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|