Commit Graph

143 Commits

Author SHA1 Message Date
Aleksander Morgado
71a1b64b3b huawei: expect 'modem' and 'pcui' in ^GETPORTMODE responses
Newer huawei modems, like the E3372, use the following ^GETPORTMODE response
format:
  ^GETPORTMODE: TYPE: WCDMA: ,pcui:1,modem:2,ncm:3,mass:4,mass_two:5,

This patch updates the parser that looks for the control TTY (pcui) and data TTY
(modem).

https://bugs.freedesktop.org/show_bug.cgi?id=86658
2014-12-03 19:02:00 +01:00
Ben Chan
4669611412 broadband-modem,plugins: fix GMatchInfo leaks 2014-08-12 09:45:50 +02:00
Aleksander Morgado
da933468c8 huawei: minor style fixes 2014-08-11 18:31:47 +02:00
David McCullough
bd0ffd24f1 huawei: improve support for network time on Huawei modules
Third revision of Huawei nwtime support.  Takes on feedback from the
mailing list including helpers,  some basic tests and use of the ^NTCT
command to determine network time support (^NWTIME).  Expanded test cases,
more use of g_assert and more logical helper return values/errors.

Signed-off-by: David McCullough <david.mccullough@accelecon.com>
2014-08-11 18:31:46 +02:00
Aleksander Morgado
5358d6fea0 sim: rename 'MMSim' to 'MMBaseSim'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
Aleksander Morgado
3ca267b01f bearer: rename 'MMBearer' to 'MMBaseBearer'
Just so that we don't have same header names in src/ and /libmm-glib.
2014-07-06 16:55:29 +02:00
David McCullough
07fd7faea5 huawei: enable GPS_UNMANAGED for Huawei modems
Signed-off-by: David McCullough <david.mccullough@accelecon.com>
2014-07-04 19:51:56 +02:00
Aleksander Morgado
b7cf21dc24 huawei: close GPS port once GPS has been disabled 2014-07-04 09:47:49 +02:00
David McCullough
d73b633639 huawei: GPS support for MU609/MU909
Implement GPS support on the MU609 and MU090 Huawei modules.
Its highly likely the commands are the same for other Huawei modems
and it just needs to be activated via udev rules that flag the GPS port
with ID_MM_HUAWEI_GPS_PORT=1.

There are a lot of options that can be tweaked on the Huawei GPS setup,
this code just chooses a simple default for unassisted, standalone GPS
operation.

Signed-off-by: David McCullough <david.mccullough@accelecon.com>
2014-07-03 16:01:02 +02:00
David McCullough
83c8db8819 huawei: avoid AT^GETPORTMODE in Huawei MU609
The MU609 modems from Huawei have a bug (confirmed by Huawei) that causes
the modem to reset if AT^GETPORTMODE is issued.

I have provided and example udev rule I use to disable this command as a
patch,  feel free to drop that if its not acceptable.  Since I cannot tell
the modem type from within the udev rules this is less specific than my
previous code based patch,  but much simpler ;-)

I have two modems that share the same USB ID,  however,  neither supports the
^GETPORTMODE command (and one of them crashes when it is issued).  Perhaps
someone with a Huawei that supports ^GETPORTMODE can check their USB ID's
and see if they clash.

Here is a comment from the Huawei devs:
> We confirmed this is a issue. This is Qualcomm baseband command at Data
> Card. We didn’t delete and block it. We will fix this issue in next FW.
> Thank you very much.

Sign-off-by: David McCullough <david.mccullough@accelecon.com>
2014-07-01 11:08:47 +02:00
Aleksander Morgado
b520503686 huawei: quicker find matching cdc-wdm AT port
Without using a new GUdevClient.

Based on a patch from Dan Williams <dcbw@redhat.com>
2014-06-23 18:12:27 +02:00
Aleksander Morgado
7c347aa3ec port: store parent sysfs path in each MMPort 2014-06-23 18:12:27 +02:00
Aleksander Morgado
7752c9920d huawei: flag /dev/cdc-wdm as primary if no primary found already 2014-06-23 18:12:27 +02:00
Aleksander Morgado
e9d016f088 huawei: setup unsolicited message handlers also in the AT cdc-wdm ports 2014-06-23 18:12:27 +02:00
Aleksander Morgado
75a5c48345 huawei: use the cdc-wdm port dialing if available
With the new 'huawei-cdc-ncm' driver in the kernel, we now may get a
/dev/cdc-wdm AT-capable port exposed by the Huawei device. If so, we must use
this port for NDISDUP dialling in order to get the network interface connected.
2014-06-23 18:12:27 +02:00
Ben Chan
551197b4e5 plugins: remove unnecessary MM_BASE_MODEM() casts 2014-05-21 11:59:49 +02:00
Ben Chan
a0d15f23c9 huawei: minor coding style fixes 2014-05-19 12:47:28 +02:00
Ben Chan
771c83a73a huawei: treat CFUN 0 as low power state
The Huawei plugin uses +CFUN=0 to put the modem in low power mode as
+CFUN=4 isn't supported by all Huawei modems. This patch modifies the
plugin to treat CFUN 0 as the 'LOW' power state, which is necessary as
otherwise ModemManager would prevent the modem from transitioning to the
'ON' power state.
2014-05-01 16:57:30 +02:00
Ben Chan
1bd939d4b8 huawei: fix a debug message
This patch simply fixes the following debug message:

from:
  <debug> (Huawei) couldn't turn off unsolicited messages insecondary ports: 'Unknown error'

to:
  <debug> (Huawei) couldn't turn off unsolicited messages in secondary ports: 'Unknown error'
2014-02-19 18:49:30 -06:00
Aleksander Morgado
e684851698 huawei: use shortened version of NDISDUP when possible
Adds support for the Huawei E3276 by sending the shortened form of the
AT^NDISDUP command where possible, as the E3276 fails with an '+CME ERROR:
Incorrect parameters' if encoded_auth is set to 0. This behaviour is slightly
different to the E1820 and K4605 (E372) which will happily establish a
connection with encoded_auth set to 0, 1 or 2.
2014-02-13 13:41:09 +01:00
Aleksander Morgado
d4dfd661b9 port-serial-at: use GIO Async API like methods 2014-02-13 13:40:21 +01:00
Aleksander Morgado
0c86840dde ports: rename 'libserial' to 'libport' 2014-02-13 13:40:11 +01:00
Aleksander Morgado
6f235b9948 ports: rename 'MMAtSerialPort' to 'MMPortSerialAt' 2014-02-13 13:40:01 +01:00
Aleksander Morgado
fdba981f8e huawei: fix leaked string 2014-01-26 19:56:58 +01:00
Aleksander Morgado
48585c250b udev: apply udev rules upon 'move' events as well
Otherwise, we may end up losing the tags we expect if the device gets a 'move'
event just after the initial 'add'.
2014-01-26 19:33:45 +01:00
Aleksander Morgado
72d83898da huawei: fix some leaked 'GStrv' arrays 2014-01-26 11:01:42 +01:00
Aleksander Morgado
0cfc825e11 huawei: fix leaked 'GUdevDevice' 2014-01-26 10:55:43 +01:00
Ben Chan
50f3f41c3a huawei: avoid creating Connect3gppContext when no data port is available
This patch modifies MMBroadbandBearerHuawei such that connect_3gpp
simply reports an error via g_simple_async_report_error_in_idle, without
creating a Connect3gppContext, if no data port is available.
2014-01-09 13:12:26 +01:00
Ben Chan
76d52c2df3 huawei: avoid calling g_object_unref on NULL
This patch prevents connect_3gpp_context_complete_and_free from calling
'g_object_unref (ctx->data)' when connect_3gpp finds no data port (i.e.
ctx->data is set to NULL).
2014-01-08 10:09:06 +01:00
Yegor Yefremov
84bdcb04ed trivial: resolve maybe-uninitialized warnings
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2014-01-07 09:40:05 -06:00
Ben Chan
22b0de736b huawei: handle ^NDISSTAT disconnected notification only on a connected bearer
If the bearer is not actually connected and the modem (inappropriately)
indicates a disconnected status via a ^NDISSTAT unsolicited message, it
could potentially lead to the following assertion in
connect_3gpp_context_step. This patch addresses such an issue.

    g_assert (ctx->self->priv->network_disconnect_pending_id == 0);

0x7f940c2ecd95   [libc-2.15.so]            - raise.c:64                         raise
0x7f940c2ee217   [libc-2.15.so]            - abort.c:91                         abort
0x7f940c8e6086   [libglib-2.0.so.0.3400.3] - gtestutils.c:1877                  g_assertion_message
0x7f940c8e6553   [libglib-2.0.so.0.3400.3] - gtestutils.c:1888                  g_assertion_message_expr
0x7f940cba5710   [libmm-plugin-huawei.so]  - mm-broadband-bearer-huawei.c:240   connect_3gpp_context_step
0x7f940cd4a51e   [ModemManager]            - mm-broadband-bearer.c:1246         connect
0x7f940cd662b7   [ModemManager]            - mm-iface-modem-simple.c:588        connection_step
0x7f940cd66e6e   [ModemManager]            - mm-iface-modem-simple.c:267        register_in_3gpp_or_cdma_network_ready
0x7f940ca0e296   [libgio-2.0.so.0.3400.3]  - gsimpleasyncresult.c:775           g_simple_async_result_complete
0x7f940ca0e398   [libgio-2.0.so.0.3400.3]  - gsimpleasyncresult.c:787           complete_in_idle_cb
0x7f940c8c2ff4   [libglib-2.0.so.0.3400.3] - gmain.c:2715                       g_main_context_dispatch
0x7f940c8c3377   [libglib-2.0.so.0.3400.3] - gmain.c:3290                       g_main_context_iterate
0x7f940c8c37c9   [libglib-2.0.so.0.3400.3] - gmain.c:3484                       g_main_loop_run
0x7f940cd3b425   [ModemManager]            - main.c:142                         main
0x7f940c2d9464   [libc-2.15.so]            - libc-start.c:234                   __libc_start_main
0x7f940cd3afa8   [ModemManager]            + 0x0001efa8
2014-01-06 18:23:58 -06:00
Ben Chan
cddc4af7bd huawei: report an error when ^PREFMODE reports no valid values
This patch fixes mm_huawei_parse_prefmode_test to always report an error when
returning NULL, which avoid a potential crash when the caller tries to access
the error.
2014-01-03 12:20:33 +01:00
Aleksander Morgado
fc42b2df8c huawei: handle empty response to AT^SYSCFG=?
Some Huawei modems (e.g. E220) may give an empty response for AT^SYSCFG=?, even
if they do support the command. Handle this case by prividing a default fallback
format string when this happens.
2013-12-09 23:07:19 +01:00
Aleksander Morgado
e81fdd07c3 huawei: new current mode setting based on the supported combinations 2013-12-09 23:07:19 +01:00
Aleksander Morgado
c337f52e30 huawei: new current mode loading based on the supported combinations 2013-12-09 23:07:19 +01:00
Aleksander Morgado
02839b2e44 huawei: new ^SYSCFGEX? response parser 2013-12-09 23:07:19 +01:00
Aleksander Morgado
9ac136028b huawei: new ^SYSCFG? response parser 2013-12-09 23:07:19 +01:00
Aleksander Morgado
4e5c35a69f huawei: new ^PREFMODE? response parser 2013-12-09 23:07:19 +01:00
Aleksander Morgado
8cc3eff661 huawei: load supported modes, not just assume them 2013-12-09 23:07:19 +01:00
Aleksander Morgado
ef526395df huawei: consolidate command support checks 2013-12-09 23:07:19 +01:00
Aleksander Morgado
47640a6507 huawei: new ^SYSCFGEX=? test parser 2013-12-09 23:07:19 +01:00
Aleksander Morgado
677dd7da91 huawei: new ^SYSCFG=? test parser 2013-12-09 23:07:19 +01:00
Aleksander Morgado
ceb578a824 huawei: new ^PREFMODE=? test parser 2013-12-09 23:07:18 +01:00
Aleksander Morgado
0dcf609dcc huawei,tests: enable log traces in the tests 2013-12-09 23:07:18 +01:00
Dan Williams
a1ffe805af broadband-modem-huawei: fix CDMA unsolicited response parsing
On at least the EC168C, various unsolicited responses like RSSILVL,
HRSSILVL, and MODE can include an extra Carriage Return:

^MODE: 2<CR><CR><LF><CR><CR><LF>
^RSSILVL:60<CR><CR><LF><CR><CR><LF>
2013-12-09 11:27:27 -06:00
Aleksander Morgado
e9523a6abd huawei: clear only once the timeout to wait for the first interface
As soon as we get a match between the current interface being probed, and the
first expected interface to probe, clear the timeout. But this doesn't mean that
this interface being probed will be the correct one, so it may be the case that
we end up expecting a new first interface and probing another one.

With an example probably seen better...

Modem appears with interfaces 2, 3 and 4.

1. We first try to look for interface 0, which is not in the set:
  1.1. Probing interfaces 2, 3 and 4 get deferred.

2. First-interface timeout happens because interface 0 doesn't appear, so we
switch to wait for interface 1:
  2.1 Probing interfaces 2, 3 and 4 get deferred.

3. First-interface timeout happens because interface 1 doesn't appear, so we
switch to wait for interface 2:
  3.1. We get a match on interface 2, which exists. We now remove the
       first-interface timeout and start running the init sequence there.
  3.2. Probing interfaces 3 and 4 get deferred.

4. Init sequence in interface 2 fails, because it is not an AT port, so we
switch to wait for interface 3:
  3.1. We get a match on interface 3, which exists. We do *not* need to remove
now the first-interface timeout because this interface we are testing is
actually the second one which we tried.

So, just check whether the timeout exists or not, and if it exists remove it.
Yeah, this commit just fixes a warning at the end.
2013-10-30 20:18:11 +01:00
Ben Chan
686caef536 huawei: handle pending network-initiated disconnection in disconnect_3gpp
If a client-initiated disconnection attempt is issued while a
network-initiated disconnection is still pending, the latter may
interfere with the former. Also, when the client-initiated disconnection
attempt fails but the bearer status is reported as 'disconnected', the
pending network-initiated disconnection is not cleared and may result
in an assertion when a connection attempt is issued.

This patch addresses the issue by clearing any pending network-initiated
disconnection before proceeding with a client-initiated disconnection.
2013-10-24 16:44:05 +02:00
Ben Chan
18053540ea huawei: handle unquoted strings in ^SYSINFOEX response
The original sysinfoex_parse() in MMBroadbandModemHuawei does not handle
unquoted <sysmode_name> and <submode_name> fields in ^SYSINFOEX responses,
which are sen on some Huawei modems (e.g. E303). This patch moves the
^SYSINFOEX parsing code to mm-modem-helpers-huawei.c, fixes the regex for
handling unquoted strings in ^SYSINFOEX responses, and adds unit tests.
2013-10-20 17:01:59 +02:00
Ben Chan
49d4163a2b huawei: fix ^SYSINFO parsing
The original sysinfo_parse() in MMBroadbandModemHuawei incorrectly sets
'out_sys_submode_valid' to TRUE even when <sys_submode> is not present
in a ^SYSINFO response. This patch moves the code to
mm-modem-helpers-huawei.c, fixes the regex for parsing ^SYSINFO
responses, and adds unit tests.
2013-10-20 17:01:51 +02:00
Ben Chan
b5ef861d12 modem-helpers,sim: auto-detect if ICCID response is character swapped
This patch modifies mm_3gpp_parse_iccid() to auto-detect if an ICCID
response is character swapped or not by comparsing the major industry
identifier part of the ICCID response to the known value (89) for
telecommunication purposes. This addresses the issue where the same AT
command (e.g. AT^ICCID used by the huawei plugin) does not report ICCID
in a consistent format.
2013-09-26 20:23:51 +02:00