Commit Graph

3500 Commits

Author SHA1 Message Date
Aleksander Morgado
c1ef36b860 libmm-glib,simple-connect-properties: avoid using an uninitialized variable 2013-02-13 15:03:07 +01:00
Dan Williams
2d700043ab core: use g_unix_signal_add() for more reliable Unix signal handling
There were a few problems with MM's existing signal handling, first
of which was that calling g_main_loop_quit() from a signal handler
only works 50% of the time due to severe restrictions on what you
can do from the handler.  This caused INT or TERM to sometimes be
ignored by MM.

Instead, use the glib signal functions which ensure that the handler
is run in the right context, where we can do anything we want.
2013-02-12 15:48:39 -06:00
Dan Williams
625e1c4884 serial-port: don't steal data from PPP when connected
There was a race where if PPP was slow to start, MM could read the
first bits of PPP from the port, which MM shouldn't really do.  So
if the port is connected, don't read any data and let pppd do its
thing.

See the logs in https://bugzilla.gnome.org/show_bug.cgi?id=624956#c10
for an example of this:

DEBUG: <1280300196.929489> (ttyACM0): <-- '<CR><LF>CONNECT<CR><LF>'
DEBUG: <1280300196.929761> (ttyACM0): port now connected
DEBUG: <1280300196.929853> Modem /org/freedesktop/ModemManager/Modems/0: state changed (connecting -> connected)
DEBUG: <1280300196.929954> (ttyACM0): simple connect state 6
DEBUG: <1280300196.933432> (ttyACM0): <-- '~\-1}#\-64!}!} } }2}#}$\-64#}!}$}%\-36}"}&} }*} } g}%~'
2013-02-12 15:26:21 -06:00
Dan Williams
67fcac2541 qcdm: fix handling of active pilot set
Typo caused candidate or remaining sets to be treated as the
active pilot set.
2013-02-08 09:15:55 -06:00
Aleksander Morgado
5860de182d sierra: fix access tech reporting logic 2013-02-08 12:08:44 +01:00
Dan Williams
cd2545c2b6 broadband-modem-mbm: handle HSPA access technology in ERINFO response
HSUPA/HSPA capable devices (ex F5521gw) can report '3' here, which
we'll decide to interpret as HSPA.  It might actually be HSDPA + HSUPA,
but whatever...
2013-02-07 12:49:55 -06:00
Dan Williams
a4ad95e3da broadband-modem-longcheer: fix handling of preferred modes
Treat NONE the same as ANY and handle specific preferred modes too.
2013-02-06 16:18:51 -06:00
Dan Williams
18436a8f77 iface-modem-messaging: fix INSTANCE_CAST() vs. GET_INTERFACE() confusion
Yeah, GObject is pretty obscure here.  But to get the implementation's
override function, we want GET_INTERFACE, otherwise we're looking at
some random memory location that's sometimes NULL.  And then we crash.
2013-02-06 15:50:22 -06:00
Aleksander Morgado
d44eb83ac4 libmm-glib,manager: add missing logic to ensure the proxy is created 2013-02-06 22:20:19 +01:00
Aleksander Morgado
84adf4e4ef cli: don't autostart the ModemManager service 2013-02-06 19:59:16 +01:00
Aleksander Morgado
a85fd0ab4f libmm-glib,manager: don't fail creation if the ModemManager process is not found
A 'GDBusObjectManagerClient' for a service for which there is no current
name-owner is a perfectly valid and useful object. For example, we could then
connect to the 'notify::name-owner' property to follow the life cycle of the
ModemManager process.

So, don't tie the successful creation of a 'MMManager' to the successful
creation of the internal GDBusProxy for the 'Manager1' interface. If there is
no current name owner, the GDBusProxy wouldn't be created, and instead we
would completely fail the 'MMManager' creation.
2013-02-06 19:56:18 +01:00
Aleksander Morgado
2ad6e0627d libmm-glib: fix error reporting when 'MMManager' is created 2013-02-06 19:10:13 +01:00
Dan Williams
34da83450e anydata: support QMI-based devices
Some devices (like the ADU960S) support QMI, so if the modem has a
QMI port, use it.
2013-02-06 12:00:04 -06:00
Dan Williams
f3ad2e5bb5 trivial: fix typo 2013-02-06 11:59:16 -06:00
Dan Williams
dcbb6dc811 iface-modem-cdma: fix handling of HDR registration state
hybrid mode is the first parameter, not the third.  Caused EVDO
to look like it wasn't registered.
2013-02-06 11:57:00 -06:00
Dan Williams
8070627011 trivial: add debugging to generic QCDM registration parsing 2013-02-06 11:57:00 -06:00
Dan Williams
90ecbe325a broadband-modem-novatel: read HDR revision for access technology
Specialize what the superclass gave us, if we can.
2013-02-06 11:57:00 -06:00
Dan Williams
8253d6f9de broadband-modem-novatel: use ERI subsystem information to better determine roaming
We use the Icon ID here because a value of 1 *always* means not roaming,
while the other values don't appear to be consistent.  For example,
an ERI value of "0" is supposed to mean roaming according to the
standards, but the Novatel devices appear to use 0 to mean home.
Since we're not sure, don't depend on the ERI value itself, just
depend on the Icon ID, where we know for sure that 1 means "home".
2013-02-06 11:57:00 -06:00
Dan Williams
74e94e624d qcdm: add Novatel ERI subsystem support
Returns various ERI information like Indicator ID/Index, Icon
ID/Index, Icon Mode, and banner.
2013-02-06 11:57:00 -06:00
Dan Williams
bf07f02cff qcdm: rename Novatel subsystem defines 2013-02-06 11:57:00 -06:00
Dan Williams
b9d0a3275f trivial: debug print CDMA1x State results 2013-02-06 11:57:00 -06:00
Aleksander Morgado
222825d642 systemd: include systemd unit file support
Allow having systemd handling the life cycle of the ModemManager process.
2013-02-06 17:32:59 +01:00
Aleksander Morgado
596c9ea508 build: polish configure.ac a bit 2013-02-06 16:26:07 +01:00
Ben Chan
86fcfe3121 novatel-lte: use +CFUN=4 for power down 2013-01-30 23:12:10 +01:00
Ben Chan
87a556dbb1 novatel-lte: retry $NWQMISTATUS check upon error during disconnect
$NWQMISTATUS sometimes returns 'ERROR'. This patch modifies the Novatel
LTE plugin to retry $NWQMISTATUS (up to 5 times) to determine if the
disconnect operation succeeds. It also changes the plugin to assume that
the disconnect operation succeeds if $NWQMISTATUS fails to report the
current connection status.
2013-01-30 23:11:59 +01:00
Ben Chan
24b28d1a72 iface-modem: add a missing step increment in interface_initialization_step 2013-01-30 23:11:51 +01:00
Ben Chan
c204a8ce4e iface-modem: rearrange initialization steps
This patch rearranges the initialization steps in MMIfaceModem such that
the following SIM related operations happen at the end of the
initialization:
    - INITIALIZATION_STEP_UNLOCK_REQUIRED
    - INITIALIZATION_STEP_SIM
    - INITIALIZATION_STEP_OWN_NUMBERS

The rationale of this change is that the SIM interface of some modems
may require some time to initialize before it responds to SIM related
AT commands. By rearranging the initialization steps to execute non-SIM
related AT commands first, some of the latency for the SIM
initialization can be absorbed.
2013-01-24 13:37:52 +01:00
Ben Chan
69aff6183a iface-modem: fix invalid modem state consolidation
ModemManager has a bogus modem state transition from 'enabling' to 'disabled':

ModemManager[26214]: <info>  Modem fully enabled...
ModemManager[26214]: <info>  Modem /org/freedesktop/ModemManager1/Modem/2: state changed (enabling -> disabled)

The root cause seems to be the following:

get_current_consolidated_state() in MMIfaceModem returns
MM_MODEM_STATE_DISABLED as the default fallback value. When
mm_iface_modem_update_state() is invoked to transition the modem state from
MM_MODEM_STATE_ENABLING to MM_MODEM_STATE_ENABLED, the following code can
potentially cause the final state to be MM_MODEM_STATE_DISABLED instead.

     /* Enabled may really be searching or registered */
     if (new_state == MM_MODEM_STATE_ENABLED)
         new_state = get_current_consolidated_state (self);

https://code.google.com/p/chromium-os/issues/detail?id=38173
2013-01-24 09:08:44 +01:00
Aleksander Morgado
9d5794e9e4 iface-modem: print power state as string
Thanks to Marius B. Kotsbak <marius@kotsbak.com> for reporting.
2013-01-21 10:33:49 +01:00
Ben Chan
1cf8ccbdd5 iface-modem: schedule signal quality check more often initially
This patch modifies MMIfaceModem to schedule the periodic signal quality
check with a period of 3s instead of 30s (up to 5 periods) initially
until a non-zero signal quality value is obtained and then switch back
to the 30s period.
2013-01-18 11:28:08 +01:00
Ben Chan
9474654f67 novatel-lte: skip soft reset if modem is newly plugged in
Soft resetting a Novatel LTE modem can a significant amount of time
(3-4 seconds). If the modem is newly plugged in, skip the unnecessary
soft reset when enabling the modem.
2013-01-18 11:27:58 +01:00
Ben Chan
e75dba639f core: add 'hotplugged' flag to indicate if modem is newly plugged in
This patch adds a 'hotplugged' flag to MMBaseModem to indicate if a
modem is newly plugged in. A plugin can use this information to
determine if, for example, the modem needs to be soft reset using the
ATZ command.

Dan Williams <dcbw@redhat.com> contributed the idea of implementation.
2013-01-18 11:27:51 +01:00
Aleksander Morgado
2550cb20a9 huawei: only retry DHCP? check on specific errors
We don't want to retry DHCP? on every possible GError reported; specially if the
error is about the port being forced to get closed when the modem gets
unplugged or the like. So just retry on very specific errors reported.

The main cause for retry is really when the modem replies the following:
-->  AT^DHCP?
<--  ERROR

Which in our case gets translated to a 'unknown' mobile equipment error. We'll
also consider any kind of mobile equipment error, as the modems may reply a
CME ERROR instead.
2013-01-16 10:56:53 +01:00
Aleksander Morgado
2b3f353770 huawei: check NDISDUP support only once 2013-01-16 10:56:53 +01:00
Aleksander Morgado
f2a9ea3779 huawei: use NDISDUP only if net port from cdc_ncm or cdc_ether 2013-01-16 10:56:53 +01:00
Aleksander Morgado
8c5bd6375f huawei: refactor the connection and disconnection sequences in the bearer
We will now use a step-based state machine to handle the connection and
disconnection sequences. All the previous behaviour is kept, except for these
new things:

 * Instead of just subclassing the 'dialling' step in the 3GPP connection
   sequence, completely subclass the whole 3GPP connection sequence. We do this
   because we don't need to preconfigure PDP contexts with AT+CGDCONT before
   issuing ^NDISDUP.

 * Don't allow IP types other than IPv4. These modems work only with IPv4
   bearers.

 * Remove cancellation signal handler; not needed as we can check the status of
   the cancellation in every 1s timeout.

 * Removed the event source id handling for timeouts; timeouts are never
   cancelled here.
2013-01-16 10:56:53 +01:00
Aleksander Morgado
2499f5760b huawei: explicitly check for the ^NDISDUP command support
Don't assume that all modems exporting a 'net' port will support ^NDISDUP.
2013-01-16 10:56:53 +01:00
Franko Fang
696403e50a huawei: handle modems exposing 'net' ports with AT^NDISDUP
Modems with ECM (e.g. usb0) ports should use AT^NDISDUP in the control port to
request the connection and afterwards just fire up the DHCP client in the net
port.

This patch is originally developed by:
  Franko Fang <fangxiaozhi@huawei.com>

And afterwareds reviewed and updated by:
  Aleksander Morgado <aleksander@gnu.org>
2013-01-16 10:56:53 +01:00
Dan Williams
fdad4d636d broadband-modem: guess CDMA access technologies from registration state
Setting access technologies from registration state as part of the
registration checking in the CDMA Interface code fights with
custom implementations in each modem subclass, which causes the
access technologies to ping-pong between more specific (custom
implementation) and less specific (generated from registration state
during registration checking).  If the modem class has more
specific access technology knowledge, we should use that and not
override it on the next registration state poll.

So instead, implement the generic access technology update from
registration state in the broadband modem base class'
load_access_technologies() hook.  Thus, modem classes with more
specific checking (which override MMBroadbandModem's implementation)
will never fight with generic checking, while modems that don't
(and thus actually need the generic checking) still get some basic
access technology handling.
2013-01-14 13:50:27 -06:00
Dan Williams
edeb75b028 broadband-modem: implement generic QCDM access technology checks
For modems that don't implement vendor-specific access technology
checks, try to get the access technology via QCDM if the modem has
a QCDM port.
2013-01-14 13:50:27 -06:00
Dan Williams
f71852c5b9 iface-modem-cdma: get CDMA1x Serving System during QCDM registration
We want the SID/NID even when AT Serving System checks are disabled,
otherwise the SID/NID don't get filled at all.  QCDM doesn't need the
SID/NID to determine registration, so the values are informational
only and don't affect registration state.  But we still want to
export them via the API.
2013-01-14 13:50:27 -06:00
Dan Williams
fe7438973a trivial: fix comment 2013-01-14 13:50:27 -06:00
Dan Williams
7489951f88 qcdm: various LTE-related NV mode pref and sysmode updates 2013-01-14 13:50:27 -06:00
Dan Williams
fc4034a72f broadband-modem-sierra: implement access technology reporting for CDMA devices
Use AT!STATUS to grab current access technology.
2013-01-14 13:50:26 -06:00
Dan Williams
56bdf4a37b broadband-modem-sierra: make CDMA AT!STATUS parsing code generic
We'll use it for access technology reporting too.
2013-01-14 13:50:26 -06:00
Dan Williams
b68a487e15 broadband-modem-sierra: don't check +CAD and +CSS for CDMA devices
We have !STATUS for that, which is much more detailed.  Use it.
2013-01-14 13:50:26 -06:00
Dan Williams
01e8e0574f broadband-modem: more compatible CSQ parsing
Some devices (usually CDMA modems like the Sierra MC5725 and others)
don't prefix their +CSQ replies with +CSQ.  So don't require that.
The scanf() should ensure the reply is valid even without the +CSQ.
2013-01-14 13:50:26 -06:00
Dan Williams
48b36b1afa broadband-modem-sierra: load own numbers via ~NAMVAL?0 for CDMA
Sierra CDMA devices don't always have QCDM ports, or if they do,
they aren't always usable.  Try Sierra-proprietary commands for
loading the modem's MDN and fall back to QCDM if that fails.
2013-01-14 13:50:26 -06:00
Dan Williams
f7d55a688a broadband-modem-novatel: fix signal strength processing for older devices
mm_get_int_from_str() does not allow anything in the string after the
number, eg "-91  asdfasdf" returns an error.  So we have to chop off
anything after the number we're interested in.
2013-01-14 13:50:26 -06:00
Dan Williams
f95274e735 broadband-modem: load own numbers with QCDM too
Not many CDMA/EVDO-only modems support CNUM since it's not a
standard IS707/856 AT command, so for those that don't
support it and have a QCDM port, try grabbing the number from
NV memory.
2013-01-14 13:50:26 -06:00