mhi_wwan_mbim ends up being detected as mhi-pci-generic, so we need to
look for that in addition to cdc_wwan when doing MBIM data port stuff.
Otherwise devices (various Foxconn X55/X72, Cinterion MV3x, Quectel
EM1xx, Telit FN990) that expose the IP_HW0_MBIM MHI channel won't
correctly clean up data ports on startup, and may not correctly
handle bearer multiplexing.
mhi_net is only used for QMI devices with rmnet so it shouldn't
be involved in the MBIM data path at all.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Track when the timeout was started, so that if it needs to be increased
we can calculate how long the new timeout should be. Then cancel the
original timeout and start a new one with.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
In preparation for a "terse" mode, but also because "shutdown" was
kind of weird since we're not always shutting the modem down; sometimes
we're just putting it in low-power mode.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Send each character through the state machine one at a time. Some
modems (various Quectel ones for example) can process multiple at
the same time, and while that should be easily implemented using
the new changes to send_dtmf() it's not done in any plugin yet.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Split into groups of non-pause characters and single pause characters
by themselves and return as an array of strings.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Generalize the timeout/stop logic that QMI requires into the
base call. We'll use this to implement the pause character (,)
generically.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Instead of hard-coding a 500ms DTMF tone duration, let applications
use a specific duration at call setup time.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Split out the things we actually use from MMBaseModem into
separate properties that can be independently implemented
(or just left NULL) for unit tests.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Add an interface and implementation for a port scheduler that round-
robins between ports the scheduler is attached to, serializing command
execution among one or more MMPortSerial instances.
Theory of operation:
Sources (e.g. MMPort subclasses) register themselves with the scheduler.
Each source notifies the scheduler whenever its command queue depth changes,
for example when new commands are submitted, when commands are completed,
or when commands are canceled.
The scheduler will round-robin between all sources with pending commands,
sleeping when there are no pending commands from any source.
For each source with a pending command the scheduler will emit the
'send-command' signal with that source's ID. The given source should
send the next command in its queue to the modem.
When that command is finished (either successfully or with an error/timeout)
the source must call mm_port_scheduler_notify_command_done() to notify the
scheduler that it may advance to the next source with a pending command, if
any. If the 'send-command' signal and the notify_command_done() call are not
balanced the scheduler may stall.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
If the object has an owner ID already but doesn't yet have enough
information to build its log ID, don't cache a less-than-useful
log ID string for it.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Some older MTK-based phones (Tecno T528 NEW) reply to +CPIN with
an error but are (obviously) unlocked, otherwise they wouldn't
be able to boot up to the point of talking to a computer. Since
they are actually unlocked they will happily give out the IMSI
even if +CPIN errors.
To work around the +CPIN issue treat the device as unlocked if we
can successfully read the IMSI.
Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/980
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Some Sierra devices omit the leading <CR> from call start/end URCs
like NO CARRIER and CONNECT, which caused the echo-removal code to
remove from the response buffer because the leading <CR><LF> did
not exist. That can break call control and hangup handling on
those devices.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Mainly because we need somewhere to stash the call end regex, and
it's silly to have a 3rd instance of that in MMPortSerialAt when
we already have one in the serial parsers that MMPortSerialAt
relies on pretty heavily.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Add some test responses from the Quectel EG915Q and some other Quectel devices.
Then try to parse those responses.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
MMSmsList has logic to allow multiple unstored messages as long as
they use SMS_PART_INVALID_INDEX. These messages aren't stored so
they don't have an index.
But the MBIM and QMI modems used index 0 for unstored messages,
meaning there could only ever be one and also that multipart
messages would fail to be combined.
Let's fix that by just using SMS_PART_INVALID_INDEX for every
scenario where an unstored message comes in.
Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/979
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Instead of going through the messaging interface, which just asks
the MMSmsList anyway, just go straight to the list.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Move error paths after getting a multipart reference to before getting
one, to reduce the possiblity that we get a reference from the MMSmsList
that ultimately doesn't end up getting used.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Instead of getting it from the MMIfaceModemMessaging when the
SMS is stored. This flattens dependencies between MMBaseSms and
MMIfaceModemMessaging.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
This commit moves creation of the MMBaseSms objects out of MMSmsList and up
into MMIfaceModemMessaging (which is already a MMBroadbandModem) and
the MMBroadbandModem subclasses themselves.
This flattens the creation of MMBaseSms objects by passing them down
from the object that creates the SMS parts, rather than having a
convoluted callback scheme relying on MMSmsList and MMBaseSms having
direct knowledge of their owning modem.
The goal is to eventually remove usage of MMBaseModem from MMBaseSms
and MMSmsList so that we can test them more easily.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Simplify MMBaseSms (making it easier to use from testcases) by
splitting the AT-specific code into MMSmsAt rather than keeping
it in the base class.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
CBM isn't as complicated as SMS, and the CBM class itself doesn't
need to be overridden by QMI/MBIM/etc. Now that the log parent
and connection binding no longer require MMBaseModem we can flatten
the CBM object creation and remove usage of MMBaseModem.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Continues removing usage of MMBaseModem in a bunch of files
by splitting out bits of its usage to separate interfaces.
Signed-off-by: Dan Williams <dan@ioncontrol.co>