Commit Graph

70 Commits

Author SHA1 Message Date
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
Dan Williams
2af1a612e9 core: don't crash on error if response is NULL
Various bits of the code didn't check if response was valid
or not during error conditions, and when an error occurs
sometimes it'll be NULL (since not all errors are translated
errors from the modem, some are serial or general ones).  We
have to make sure we don't try to use response->str when
response doesn't exist.

Found in the generic CDMA code likely as a result of
d5d9eec2b5 but was a bug long
before that commit happened anyway.
2011-12-07 17:07:46 -06:00
Eric Shienbrood
e7b6b2dc1c core: keep track of all PIN retry counts
Added a PinRetryCounts property on org.freedesktop.ModemManager.Modem.
This is dictionary that records the number of PIN tries remaining
for each of the possible PIN code types for which the modem is
capable of reporting the count. Also, these counts are kept up
to date across ChangePin and EnablePin operations, not just when
an unlock is attempted.
2011-11-16 17:42:50 -06:00
Dan Williams
26debc1a97 mbm: don't flash serial ports on disconnect (bgo #650740)
The F5521gw resets various port properties like echo when the port
is flashed, which was happening on disconnect.  Since MM had already
turned of echo with ATE0, and the AT parser in-use expected no
echo, this confused MM when the port magically started echoing commands
back.  We don't need flashing on the Ericsson devices because there
will always be a free AT port even if PPP is used for a secondary
PDP context, so we can just skip flashing entirely for these
devices.
2011-08-02 10:47:25 -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
16039244bb core: rework logging
Make it more flexible, add logging to a file, and absolute and
relative timestamps.
2011-01-23 20:51:48 -06:00
Dan Williams
d908389aff core: add modem reset/power-cycle command
Based on a patch by Elly Jones from Google.
2011-01-14 12:17:02 -06:00
Dan Williams
dc95f531ad gsm: query signal strength with +CIND if modem does not support +CSQ (lp:682282) 2010-11-28 22:46:03 -06:00
Dan Williams
802a6f3a56 gsm: fix up CID signed/unsigned confusion
-1 = no APN set, so use modem default.  We'll have to fix a few
more things up for modems like hso/mbm that don't use ATDT and
require CIDs, but this gets us halfway there for other devices.
2010-11-10 13:16:19 -06:00
Dan Williams
bda86f553a mbm: fix handling of unsolicited CIEV response
Rob McQueen saw a 10 here, which means SMS full.  Handle that.
2010-11-09 08:46:27 -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
Torgny Johansson
48dbece33c mbm: add factory reset support 2010-06-23 16:39:13 -07:00
Torgny Johansson
f179a56908 gsm: add UnlockRetries property
Which reports the # of attempts remaining for the current PIN required
by the device or SIM.

Some modifications/cleanups by dcbw.
2010-06-22 14:05:09 -07:00
Torgny Johansson
6a663c3a48 mbm: catch *E2NAP error codes too 2010-05-17 21:59:58 -07:00
Dan Williams
15962279a3 mbm: (trivial) line ending change?
No idea what git thinks is different about these two lines, they
strcmp() the same.
2010-05-17 21:56:45 -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
7aeac2f646 mbm: fix getting current allowed mode 2010-04-07 15:04:32 -07:00
Dan Williams
6744e08104 gsm: simplify finding the right serial port for commands 2010-03-16 13:17:14 -07:00
Dan Williams
19257f540c gsm: handle allowed mode during Simple.Connect() 2010-03-16 11:02:35 -07:00
Dan Williams
70d9d60d0c mbm: send internet account username/password in modem character set
Apparently at least the F3507g wants the username and password in
the modem's current character set, otherwise it sends the wrong
thing over-the-air.
2010-03-15 14:52:21 -07:00
Dan Williams
479937cbbb Merge remote branch 'origin/master' into qcdm 2010-03-10 15:04:49 -08:00
Dan Williams
1979512d8d Merge remote branch 'origin/master' into qcdm 2010-03-10 14:50:41 -08:00
Dan Williams
461de7ea0e mbm: use new disconnect handling helper 2010-03-10 14:42:34 -08:00
Dan Williams
ce1c72152b mbm: fix memory leak in connection state processing 2010-03-09 21:56:57 -08:00
Dan Williams
82abd5595e mbm: fix memory leak in unsolicited signal strength processing 2010-03-09 21:55:51 -08:00
Dan Williams
59605936d0 mbm: use unsolicited access technology updates 2010-03-09 21:55:19 -08:00
Dan Williams
38514db896 gsm: let generic class handle signal quality caching and updates 2010-03-09 21:31:57 -08:00
Dan Williams
f3721a5674 Merge remote branch 'origin/master' into qcdm 2010-03-08 20:01:22 -08:00
Dan Williams
c5a897d0ae api+gsm: clean up AllowedMode values
Instead of trying to stuff everything into the mode bitfield it
turns out it's just easier, clearer, and simpler to use different
values for each of the following:

1) the device's supported access technologies and allowed modes
2) the device's current access technology
3) the device's allowed mode preference

Since none of the AccessTechnology or AllowedMode stuff has hit a
release yet, let's make sure we're doing it the right way early on.
2010-03-08 17:27:56 -08:00
Dan Williams
aeac17a81e gsm: implement allowed mode 2010-03-08 15:13:14 -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
Torgny Johansson
6dd751bf3f mbm: handle E2NAP disconnect notification during connection attempt
If E2NAP:0 is received during a connection attempt the connection
attempt has failed or will fail.  So stop polling for connection
success for another 50 seconds and abort the connection attempt
immediately.  Also moves the E2NAP request call a bit earlier to
ensure that no E2NAP unsolicited messages are lost.
2010-03-04 17:19:28 -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
053db1d27c misc: fix FSF address in license headers 2010-01-22 14:11:24 -08:00
Dan Williams
488baa1330 mbm: ensure various unsolicited responses are turned off when disabling
If the modem wasn't connected when disable is called, the generic GSM
code doesn't need to shut anything down and thus closes the serial
port immediately.  That means the mbm plugin's CREG=0 and CMER=0 won't
get sent because the port is closed.  mbm needs to ensure that it's
commands actually get sent to the modem by really sending them and
waiting for the response before chaining up to the parent's disable.
2009-12-11 13:19:21 -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
bb6f997fb8 gsm: update for new states and state flow fixes 2009-12-01 16:46:23 -08:00
Dan Williams
76facd6891 mbm: update state after enabling the device 2009-12-01 12:58:25 -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
Alexander Sack
acd785bfa4 mbm: use generic get_signal_quality implementation rather than our own CIND based one 2009-10-15 01:24:24 +02:00
Alexander Sack
139741d140 mbm: implement AT*ENAP polling 2009-10-15 01:22:20 +02:00
Alexander Sack
6885505dea mbm: flip order in which we send enap/e2nap to modem to make f3507g happier 2009-10-15 01:22:14 +02:00
Alexander Sack
6ddd97e81c mbm: send ENAP=0 on init to set modem back to sane state and ignore CIND errors 2009-10-15 01:22:00 +02:00
Dan Williams
ea29dc8044 mbm: fix disable after 3b19a85727
C & P error in enable/disable split.
2009-10-14 13:36:59 -07:00
Dan Williams
3b19a85727 core: split generic modem enable/disable operations 2009-09-23 16:04:25 -07:00
Alexander Sack
feb00e4553 mbm: more permissive ESTKSMENU regexp 2009-09-21 15:42:30 -07:00
Torgny Johansson
3d178fafcf mbm: handle *EMWI unsolicited responses 2009-09-19 11:42:10 -07:00
Torgny Johansson
1f7bb908eb mbm: fix up +PACSP0 unsolicited response matching 2009-09-19 11:37:16 -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