Commit Graph

43 Commits

Author SHA1 Message Date
Dan Williams
ab5e9a49cf zte: try to handle Icera devices that use PPP
Not all devices present a network interface, and on these devices
we need to fall back to PPP using the standard setup commands.  But
they appear to support the Icera custom commands for access technology
and such, so still use those.

Hopefully fixes ZTE MF665C.
2012-06-06 11:47:28 -05:00
Dan Williams
4dad94d500 core: rework port grabbing and organization
Make port roles more flexible.  We have modems that do PPP
on interfaces other than the primary interface, and that
wasn't possible with the old code.  So clean up all that
logic and move the port organization code into the core
so we can reduce code in the plugins.

In the new world order, the plugins say whether the port
is a QCDM port, an AT port, or ignored.  If it's an AT
port the plugins get to tag it as primary, secondary, or
PPP, or any combination of the 3.  This allows for modems
where PPP should really be done on the secondary port
(Huawei E220, Sierra devices) so that the primary port
stays open for command and status.

Modem subclasses no longer get asked to handle port grabbing
themselves.  Instead, that's now done by the generic classes
(MMGenericCdma and MMGenericGsm) and the plugins are notified
when a port is grabbed so they can add unsolicited response
handlers for it.  After all ports are grabbed by the generic
classes, they get "organized", which assigns various ports
to the roles of PRIMARY, SECONDARY, DATA, and QCDM based
on specific rules and hints that the plugin provided (which
are expressed as MMAtPortFlags).  The plugins then have
a chance to perform fixups on the primary port if they choose.

The plugin code is responsible for determining the port
hints (ie MMAtPortFlags) at probe time, instead of having
a combination of the plugin and the modem class do the
job.  This simplifies things greatly for the plugins at
the expense of more complicated logic in the core.
2012-02-28 10:06:04 -06:00
Nathan Williams
8710820156 core: ensure that GMatchInfo and GRegex objects are freed properly
In particular, g_regex_match() and g_regex_match_full() allocate a
match_info structure on both success and failure, so calling
g_match_info_free() only in the success case is insufficient.

BUG=None
TEST=Inspection

Change-Id: Iea76b5b5dc3ec48120e15601a5e2dd45322133d8
2011-09-27 13:40:39 -05:00
Guido Günther
a57618b091 zte: skip hex encoding (bgo #652682) 2011-07-21 15:16:44 -05:00
Aleksander Morgado
da55d11e72 plugins: use MMCallbackInfo instead of custom DisableInfo
Implemented using a custom invoke method which doesn't call the callback, and
instead calls parent disable passing the callback as argument.

This fix ensures that if a modem gets removed, no invalid modem reference is
passed to the parent disable, as info->modem would be set to NULL and we can
detect it in the custom invoke method.
2011-06-05 17:51:05 +02:00
Aleksander Morgado
9323daec01 core, plugins: if modem removed don't process response
We try to avoid a memory leak when info->error is reset, as well as a second
re-schedule of the info.
2011-06-05 17:51:00 +02:00
Dan Williams
2a5cf2978b zte: only dispose Icera data once 2011-04-19 11:07:46 -05:00
Dan Williams
8333fb657a icera: fix abuse of GInterface
The GInterface structure for MMModemIcera isn't instance data, thus we
shouldn't be storing an instance pointer in it.  Instead, make implemtors
store the intstance data in their private structure, and have them
implement an accessor for the Icera-private data.  This makes everone
(especially GObject) happy.  It's a bit of additional indirection, but
we still get to use the MM_MODEM_ICERA_GET_PRIVATE() and we still
get to cast the passed-in GInterface MMModemIcera into the various
GSM MMModem subclasses, which is all we ever wanted anyway.
2011-04-18 22:08:19 -05:00
Dan Williams
8f223f45f9 zte: fix handling of Icera simple connect process
Yay for GInterface.
2011-02-01 22:52:34 -06:00
Dan Williams
9733746dc1 icera: add complete support for generic Icera devices
Implement connect, disconnect, and IP4 config stuff.

Also fix handling of Icera private data.  After creation we
need to use MM_MODEM_ICERA_GET_INTERFACE(m)->priv to get the
private data instead of just dereferencing the MMModemIcera,
for reasons that I don't know.  If this isn't done, data
gets silently corrupted because writes to the private data
are going into a random location in the object.  This a
side-effect of the slightly hack-ish way that MMModemIcera
is a GInterface with private data.
2011-01-01 18:11:14 -06:00
Dan Williams
af9adab9cd icera: convert to GInterface
We'll need to store some private data later for authentication, and
this makes it easier and clearer to access that private data.
2011-01-01 14:12:07 -06:00
Dan Williams
b8a74490b2 zte: Icera devices use static IP configuration 2011-01-01 13:41:22 -06:00
Dan Williams
9d777763a2 icera: consolidate Icera check code into utility lib 2011-01-01 12:23:14 -06:00
Dan Williams
f84958933b icera: move Icera utils into standalone utility library 2011-01-01 12:08:46 -06:00
Dan Williams
657e5ac7f6 zte: partially support Icera-based devices like T-Mobile Rocket 2 2010-12-31 00:30:47 -06:00
Dan Williams
adcc29fa6b zte: really shut the device up
The MF691 appears to ignore E0 on the same line as some other stuff,
so really shut it up by sending E0 by itself.
2010-12-30 16:43:04 -06:00
Dan Williams
7ae8ffe21b core: use hardware IDs as part of DeviceIdentifier
Pass the device's hardware IDs through modem creation and use them
when calculating the device's identifier.  Add a bunch of testcases
for real hardware to ensure we don't break the device ID in the
future unless we really want to.
2010-10-22 11:06:48 -05:00
Dan Williams
da8cf4a7c2 gsm: use generic string -> access technology helper 2010-05-01 22:42:58 -07:00
Dan Williams
de86b71b3d zte: fix getting GSM allowed mode 2010-04-30 00:35:30 -07:00
Dan Williams
a4c094c340 core: fix serial error #defines
Should have ERROR in them.
2010-04-24 23:44:35 -07:00
Dan Williams
b9bb12a01e core: flash failure on disconnect shouldn't be a hard error (rh #578280) 2010-04-24 23:40:24 -07:00
Dan Williams
b876182fe6 zte: implement GSM solicited access technology request 2010-03-26 01:27:49 -07:00
Dan Williams
6744e08104 gsm: simplify finding the right serial port for commands 2010-03-16 13:17:14 -07:00
Dan Williams
2777f9f488 trivial: spacing fixes 2010-03-12 16:59:39 -08:00
Dan Williams
4202bfb86e zte: implement GSM mode preference handling 2010-03-12 16:49:22 -08:00
Dan Williams
1979512d8d Merge remote branch 'origin/master' into qcdm 2010-03-10 14:50:41 -08:00
Dan Williams
658d3d572d zte: handle access technology changes 2010-03-09 22:12:46 -08:00
Dan Williams
f3721a5674 Merge remote branch 'origin/master' into qcdm 2010-03-08 20:01:22 -08:00
Dan Williams
54c1d069eb gsm: rework registration handling
First, generically handle registration polling if the device does
not support unsolicited registration.  Second, using the new
creg/cgreg parsing functions from mm-modem-helpers.c, handle
CREG=2 unsolicited registration replies to capture the GSM LAC/CI
for the location information API.

Because of these changes we can simplify the registration polling
during connection as well by using the common registration parsing
code and the cached registration state.
2010-03-06 10:28:11 -08:00
Dan Williams
6c760464d4 zte: remove PIN checking code
This is handled by the generic class before the modem is even exported
over D-Bus.
2010-03-04 20:43:22 -08:00
Dan Williams
a8c7bba19e serial: refactor MMSerialPort into a base class and an AT-capable serial port
For QCDM devices we want most of what MMSerialPort does, but not
the AT command handling stuff since the commands and responses
aren't AT commands nor are they even strings.  So convert everything
that MMSerialPort does into a GByteArray, and let MMAtSerialPort
handle the conversion to strings when necessary.
2010-02-20 14:55:10 -08:00
Dan Williams
33c63a6681 zte: quite ZUSIMR messages for PIN-enabled devices too
Normally this would get done by the prober, but if the device
has a PIN enabled it'll reject almost all commands so the +CPMS?
in the prober will fail.  Thus we have to do it after we've unlocked
the device.
2010-02-08 12:37:06 -08:00
Dan Williams
4cb58b8f5f zte: ignore SIM Build Main Menu requests (rh #551376) 2010-01-16 15:59:29 -08:00
Dan Williams
5bdabaabec gsm: implement enable/connecting/disconnecting state handling
And consolidate generic port enable code in one place since pretty
much every modem needs that.
2009-12-02 14:43:09 -08:00
Dan Williams
ac9cae2bc8 zte: retry init strings once on timeout
Some ZTE devices (MF626 for example) will emit the ZPASR unsolicited
response right after MM opens the port, and they will just throw the
init string away. So retry the init string once; the ZTE devices will
see it the second time and continue as normal.

This is the MM version of NM commit 861e9689c513cbd61fa75205a681a69d4ba8236c
2009-11-24 12:16:14 -08:00
Dan Williams
49b5ffd076 core: use G_DEFINE_TYPE_* instead of rolling our own
Use the macro; save some trees.
2009-10-26 17:56:48 -07:00
Dan Williams
3b19a85727 core: split generic modem enable/disable operations 2009-09-23 16:04:25 -07:00
Dan Williams
14e5c52f78 core: don't allow concurrent flashes on the same device
Previously, a few operations (like disable) could trigger a modem
flash in parallel with another flash.  That's wrong, don't allow
that.  At the same time, add in finer-grained error checking on
serial port speed operations, and fix a GSM generic bug that would
send the POWER_UP string on disable.
2009-09-08 17:34:04 -07:00
Dan Williams
736aa0d2d6 serial: rework 'connected' logic
So many modems just don't implement carrier detect that it makes
the previous 'connected' logic useless, so base it off connect/disconnect
and fix up a few places that didn't check connect status before
trying to send commands.  Also ensure the serial port is unlocked
for PPP to use when connected.
2009-07-06 11:40:22 -04:00
Dan Williams
52da9990ee plugins: allow plugins to more easily suggest port types
ZTE modems need to use udev rules to assign port type hints,
so generalize that and port all the plugins over to suggested
port types in the MMModem interface's grab_port() function.
2009-07-02 13:48:30 -04:00
Dan Williams
6077763d90 asynchronous and deferred port detection
Allow plugins to perform asynchronous port detection, and to defer port detection
until later.  This moves the prober bits into MMPluginBase so that all plugins
can take adavantage of it only when needed; the probing is not done at udev time.
Furthermore, plugins like Novatel can flip the secondary ports over the AT mode
through	deferred detection, by deferring the secondary ports until the main port
has been detected and AT$NWDMAT	has been sent.

This commit also finishes the port of the rest of the plugins (except mbm) over
to the new port detection methods and plugin API.
2009-06-28 14:05:05 -04:00
Tambet Ingo
b79a3c0a65 Fix a typo. 2009-04-03 13:45:17 +03:00
Tambet Ingo
636fe2921c Implement a plugin for ZTE modems.
Contributed by Jesse Sung (jsung@novell.com).
2009-04-02 14:48:12 +03:00