Commit Graph
586 Commits
Author SHA1 Message Date
Dan Williams 86e3ab1540 sms: punt handling of 8-bit encoded SMSs to clients
There's no encoding information about 8-bit SMS messages,
and they are often binary things like ringtones or voicemail
indicator commands.  Since there's no point to our parsing
them just let clients deal with it.
2012-01-09 17:23:48 -06:00
Dan Williams 30bb9e878f cdma: fixes for libqcdm changes 2012-01-03 00:30:59 -06:00
Aleksander Morgado a2b578d755 modem-helpers: plug a leak when parsing CREG responses 2011-12-30 19:34:39 +01:00
Aleksander Morgado d38787c460 modem-helpers: plug a leak when building device ID 2011-12-30 19:34:21 +01:00
Aleksander Morgado 9ee88e8286 serial-parsers: plug small leak 2011-12-30 18:43:03 +01:00
Dan Williams 9f14d83047 gsm: treat "no network" error as zero signal for Simple.GetStatus 2011-12-14 14:19:10 -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
Nathan Williams c1e64f1a33 gsm: improve scan response regex construction error handling
Change the error handling to be a bit more like what appears to have
been intended: if constructing the regex fails, report an error and
return. The existing code looked like it was set up to do this, but
wasn't quite wired together, and had process-terminating calls
(g_error()) followed by other code.

Change-Id: I4a7cee8fe01291976edc2e343fcbeb73e882f20b
2011-12-02 13:06:44 -06:00
Nathan Williams 58b2a79f83 sms: fix two bugs with multipart SMS handling: signals and listing
First, arrange for received/complete signals to be sent by calling
cmti_received_has_sms() with the message properties even if the
message isn't complete yet.

Second, make the operation of the List command's multipart message
handling independent of message order by doing one pass to insert the
messages into the cache and second pass to retrieve the complete messages.

Change-Id: I3dcae940d71aec3ddb65c508675f710d1567b0e2
2011-12-02 12:57:36 -06:00
Vitaly Gimly ae92c74a77 trivial: remove unecessary semicolons 2011-11-30 10:56:50 -06:00
Jiří Klimeš 65340bdf6c cdma: free one more GError 2011-11-30 12:38:52 +01:00
Nathan Williams 8d64d0fdda gsm/cdma: free up a couple of dangling GErrors
Change-Id: I4f07e7e08bcbfc116114191c759cc0af4bb8ea23
2011-11-30 09:38:42 +01:00
Nathan Williams d5d9eec2b5 serial: report port-not-open in queueing commands via callback
Reporting errors instead of just returning permits routines like
mm-generic-gsm.c:simple_get_status() to work again, as their callbacks
get the error they are expecting. To make this work, adapt get_csq_done()
to handle a NULL response when error is set, and make sure that multiple
errors don't step on each other in the mm_callback_info_chain() sequence
created by simple_get_status().

Change-Id: Ie3a72b1ce71b7f117e8b1f3da7a406c4d2da9e02
2011-11-30 09:38:42 +01:00
Dan Williams 02aa10c72a gsm: check facility locks after unlocking PIN
Some modems don't allow most commands when they are PIN locked, so
the initial facility lock check errors out.  Check the locks again
after the SIM is unlocked.
2011-11-16 23:41:49 -06:00
Eric Shienbrood eede5bb621 gsm: add new property to track which facility locks are enabled
The property EnabledFacilityLocks on the .Modem.Gsm.Card interface
is a bit mask that indicates which of the various personalization
codes from 3GPP TS 22.022, plus the SIM PIN lock and SIM PIN2 lock,
are enabled. The set of facility locks supported by the modem is
determined at the time the modem is initialized, and the state of
each supported lock (enabled or disabled) is determined. When the
state of a lock changes, a property-change signal is sent out. Note
that ModemManager only supports enabling and disabling SIM-PIN, via
the EnablePin method on Modem.Gsm.Card.
2011-11-16 23:41:49 -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
Nathan Williams 128e9abcee serial: reject new commands when the port is closed.
Otherwise, we can schedule a main loop call to
mm_serial_port_queue_process() for an object that's about to
disappear, leading to a crash.

Change-Id: I433a76855c52536eb2b99a5ecf26ac71afe1f8bb
2011-11-04 11:57:22 -05:00
Nathan Williams a027d27da8 gsm: finish all disable commands before returning
Rearrange the primary and secondary-port disable operations so that
there's a linear chain of callbacks rather than a second dangling
callback chain for the secondary port; it's possible for the primary
port operations to complete, and for the callback to finish and start
tearing down the entire device, before the secondary port commands
run.

Change-Id: Ia95a7eae574737cdec38b14d39786127be1b3184
2011-11-03 16:54:08 -05:00
Nathan Williams 87ec5e09a5 gsm: multipart SMS support
Keep a local cache of SMS message fragments when we perform a List or
Get command on the modem; use this cache to reassemble fragments into
complete messages, which are then what is returned by the Get and List
DBus commands. Similarly, cause Delete to delete all known parts of a
multipart message.

While here, remove some extra whitespace in the SMS commands we send
to the modem.
2011-11-02 20:50:03 -05:00
Dan Williams 889ae2fb4b gsm: fix parsing of unsolicited CREG/CGREG response with RAC 2011-10-27 16:38:11 -05:00
Dan Williams ccad4aaa9d gsm: add regex for unsolicited CREG/CGREG response with RAC 2011-10-27 15:13:30 -05:00
Aleksander Morgado 58aa172b4e serial: use g_value_set_schar() and g_value_get_schar() when glib >= 2.31 2011-10-24 21:45:37 +02:00
Aleksander Morgado 28f64090df core: don't include private headers from glib
The "glib/gtypes.h" is now considered private, and only "glib.h" should be
included directly.
2011-10-24 21:44:30 +02:00
Dan Williams d40e043623 core: better handle NULL spew from serial ports during probing
Observed on a generic ZTE device.
2011-10-18 13:17:39 -05:00
Aleksander Morgado 5f24703b12 build: mm-modem-gsm.h no longer exists 2011-10-17 09:39:43 +02:00
Aleksander Morgado fd9f2d2804 serial: skip NUL bytes coming before real AT responses
Some Cinterion modems send a NUL byte before the "CONNECTED" reply to "ATD"
(only during the first ATD try anyway).

This fix will ignore any NUL byte leading the real response.
2011-10-14 17:22:12 +02: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
Nathan Williams 00670456ff sms: sanitize 8-bit data so that it is UTF8-clean
When receiving a SMS message with raw 8-bit data, sanitize it by
replacing non-ASCII characters with \xNN escape sequences. This
prevents a problem further down the line where the body of the message
is passed into DBus as a string, and DBus requires strings to be UTF-8.

BUG=chrome-os-partner:5953
TEST=Run network_ModemManagerSMS.py with the PDU from this bug.

Change-Id: Ic33a365f9a065c49a325e047e4c3f5e81450fa1f
Reviewed-on: http://gerrit.chromium.org/gerrit/8232
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Nathan J. Williams <njw@chromium.org>
Commit-Ready: Nathan J. Williams <njw@chromium.org>
2011-09-27 13:16:08 -05:00
Thomas Tuttle 953701a6f8 modem: add firmware interface 2011-09-08 17:20:00 -04:00
Aleksander Morgado 4c514bfd6d gsm/cdma: unsigned integers can't be < 0, so remove unnecessary conditions
It fixes compilation with the llvm/clang compiler as well.
2011-08-30 11:53:05 +02:00
Eric Shienbrood 7605ffec59 gsm: pass GSM registration errors up to caller
Register was appearing to succeed even when it failed.
2011-08-21 09:04:08 -05:00
Nathan J. Williams acc0928315 sms: check for the correct return value from sscanf() in sms_get_done()
Remove an unused variable so it's more obvious what the correct value is.
Fixes live (vs. list) SMS reception on ToT.

BUG=none
TEST=Send SMS to device, see that it shows up in Chrome.

Change-Id: I9c76fb15ef229fe83672e2eee8ae37d7e6ab7b9e
Reviewed-on: http://gerrit.chromium.org/gerrit/3216
Reviewed-by: Nathan J. Williams <njw chromium org>
Tested-by: Nathan J. Williams <njw chromium org>
2011-08-21 08:59:11 -05:00
Aleksander Morgado ea23851326 api: use common ModemManager.h for API, core and plugins 2011-08-19 22:54:48 +02:00
Dan Williams 8799f4da1f core: when probing mark ports as AT capable too
On a ZTE MF626, sometimes the aux port will respond only with
"ERROR" to probing commands (while the SIM is starting up) and
previously we'd lose the port because we were only looking for
valid probe responses.  But if the port returns ERROR or CME ERROR
etc we know it's an AT port and that we can use it once we've
gotten the type response (CDMA or GSM) from the main port.
2011-08-14 16:02:41 -05:00
Dan Williams 8ea17921e7 gsm: check both CS and PS registration state during poll
When connecting, and the modem isn't yet registered or denied, poll
both CS and PS registration state instead of just CS state, because
we're really more interested in PS state anyway.  If at least one
of the CS and PS state checks is successful then proceed with the
connection.
2011-08-14 15:37:38 -05:00
Dan Williams 33a97cdb13 core: log when serial port unexpectedly hangs up 2011-08-02 21:57:07 -05:00
Dan Williams eb2d14ab4a core: fix possible double-free
If there was data waiting, the task freed it, but then the port
got closed, and the data callback might have freed the data again.
2011-08-02 21:56:56 -05:00
Dan Williams 804cd7f077 gsm: work around Motorola Android phone modem bugs (bgo #637327)
It seems the Motorola Flipout with Android 2.1 doesn't like to return
configured PDP contexts via AT+CGDCONT?; it returns an error.  It
seems to accept the rest of the dial sequence though, so just ignore
the error when reading existing PDP contexts.
2011-08-02 12:43:26 -05:00
Dan Williams b9c2180886 core: fix serial port flashing after d3c2228f7b (bgo #650740)
Fix one more possible memory leak (left un-fixed by d3c2228 but not
caused by it) and ensure that modems that do want flashing get it
by default by adding the missing G_PARAM_CONSTRUCT so FLASH_OK
defaults to TRUE.
2011-08-02 11:07:55 -05:00
Dan Williams d3c2228f7b core: allow ports to skip flash behavior (bgo #650740)
Flashing is a technique to break out of the data/PPP stream and
re-enter command stream (like +++) and MM uses it in the generic
paths in various cases.  But devices that don't need it (ie, ones
with at least one AT capable port that won't be used for data)
now sometimes appear to have side-effects.

The Ericsson F5521gw firmware R2A07 resets port attributes like
echo and &C and such when the port is flashed, leading to
confusion on the part of MM.  Since the Ericsson devices will
always have at least one free AT port they don't need flashing
anyway.
2011-08-02 10:43:54 -05:00
Dan Williams e0eb7038af gsm: allow SIM operations while connected
No point in requiring these to be done from the primary port.
2011-08-01 17:18:08 -05:00
Dan Williams 30f848e700 cdma: don't blow away generic EVDO reg state if no specific state is available
Generic code (like the QCDM CM/HDR checks) would determine the EVDO
registration state, which would then get blown away by the device-specific
registration state query method.  Modems that have a more specific check
were fine, but generic devices that don't have more specific reg
state checks can simply rely on the generic checks done earlier and
don't need to update the EVDO state from real_query_registration_state().
2011-07-25 13:53:34 -05:00
Dan Williams b02dc7f50f core: allow getting the result from the MMCallbackInfo 2011-07-25 12:57:53 -05:00
Nathan Williams 061d410888 sms: calculate user-data bit padding correctly
Fourth and final in a series.

This fixes an off-by-one (septet) error in the calculation of the
amount of data to skip in the presence of a user data header, and adds
the test case from the wild that triggered it.
2011-07-25 01:18:35 -05:00
Nathan Williams e20173dc47 sms: recognize more text encodings from GSM 03.38
Third in a series. This fixes the bug detected by the dcsf1 test in
the just-added unit tests, by more thoroughly parsing the TP-DCS
field.
2011-07-25 01:18:30 -05:00
Nathan Williams c717dbd928 sms: add unit tests
Second in a series. Builds on the previous by actually unit-testing
the sms_parse_pdu() function. Note that the dcf1 test does not pass
as the code is currently written.
2011-07-25 01:18:22 -05:00
Nathan Williams e5faa242e9 sms: split SMS parsing out into a separate file
In preparation for adding tests.

Change-Id: If1ebd0fdd6e7470c21538042ab1735357649155c
2011-07-25 01:18:16 -05:00
Dan Williams 0cc813312f gsm: don't clear operator name or number when at least one of PS or CS is registered
The operator name/number isn't really tied to CS or PS registration, since
we retrieve it using AT+COPS.  But when one of CS or PS became unregistered
the operator name and number would get cleared out.  We only want to clear
it out when *both* CS and PS are unregistered.  Fixes an issue with the
location API where location would not be reported when one of CS or PS
became unregistered, because the location bits want an operator name
before they return the location.
2011-07-25 00:12:13 -05:00
Guido Günther 70715c1c12 huawei: implement ussd encoding/decoding
Huawei wants the USSD as packed GSM.
2011-07-21 15:16:44 -05:00
Guido Günther b82cec8c7e ussd: Add mm_modem_gsm_ussd_{de,en}code to the MMModemGsmUssd interface
since some some modems need different quirks to encode/decode USSD
messages.
2011-07-21 15:16:44 -05:00