Commit Graph

1095 Commits

Author SHA1 Message Date
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
44194ac04d nokia: add port tags for CS-xx Internet Sticks
They appear to always want PPP to happen on interface 0, according
to the Windows .INF files.
2011-11-17 12:48:36 -06: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
Graham Inggs
71598a6289 huawei: remove padding from USSD responses
Probably needed in generic USSD code.
2011-11-15 11:29:04 -06:00
Dan Williams
262f0f5e81 wmc: fix build after fixup of WMC field names 2011-11-14 17:38:02 -06:00
Graham Inggs
add6131edf huawei: pad USSD requests if necessary
ModemManager currently encodes the USSD command *141*0# (for MTN South
Africa) as "AA182DA6828D00".
While this works on some modems, for example the E1820, other modems,
for example the E160, require USSD commands that are a multiple of 7
characters long to be padded with 0x0d.
Huawei Mobile Partner dashboard software for Windows encodes *141*0#
as "AA182DA6828D1A" which works on both the E1820 and the E160.

The attached patch pads the USSD command with 0x0d before encoding if
it is a multiple of 7 characters long.
2011-11-14 17:36:23 -06:00
Dan Williams
ef74d84b32 wmc: demystify some fields in the IP info reply 2011-11-14 12:33:59 -06:00
Dan Williams
61375a5fd6 wmc: demystify some more fields of the device info response 2011-11-14 12:24:56 -06:00
Dan Williams
1aa6d01d53 wmc: protocol and testcase update 2011-11-11 23:39:20 -06:00
Dan Williams
ae3f1cd578 libwmc: add testcases that talk to the device 2011-11-11 12:21:41 -06:00
Thomas Bechtold
83c9058376 build: remove duplicate 'policy' directory entry from SUBDIRS
It is already added when WITH_POLKIT is set.
2011-11-07 00:03:11 +01: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
3bcbc7b644 api: Let MM_MODEM_MODE be a bitfield, and new PreferredMode property
Supported and Allowed modes are modified to be bitmasks of MM_MODEM_MODE values,
and preference of a specific mode is now given in the new PreferredMode
property and as an extra argument to the SetAllowedModes() call.

 * Supported Modes: bitmask specifying which modes are supported by the specific
hardware. For example, a modem may only support 1G/2G/3G connections (not 4G).

 * Allowed Modes: bitmask specifying which modes, of the ones Supported by the
modem, are allowed to use. For example, a modem may support 1G/2G/3G connections
but only 1G and 2G connections are allowed by the user as 3G involves more
expensive data rates.

 [Allowed] ⊆ [Supported]

 * Preferred Mode: specific mode which is preferred among the ones defined in
the Allowed modes bitmask. For example, a modem may allow 1G/2G/3G connections
but the user would like that if possible 2G be used, as 3G consumes too much
battery. If 2G is not possible, 3G can be used.

 [Preferred] ∈ [Allowed]
2011-10-17 12:50:44 +02:00
Aleksander Morgado
0984dd9df8 build: ensure all needed files are included in dist
Added all needed headers to libwmc_la_SOURCES, so that they get into the dist
tarball.
2011-10-17 09:41:50 +02: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
Dan Williams
6e0e46e51e huawei: Gobi devices should be driven by gobi not huawei (bgo #660998) 2011-10-12 18:47:23 -05:00
Dan Williams
c61423f2cf wmc: add initial command parsing and response handling 2011-10-04 11:16:39 -05:00
Dan Williams
a7637ddf87 qcdm: add more mode prefs
It seems that various firmwares just pass values from eg AT^SYSCFG
straight through to the firmware so it's pretty easy to map them
to the actual response here.  Note that the NV mode pref item uses
a different mapping than CM state info response.  Yay.
2011-10-04 11:16:39 -05:00
Aleksander Morgado
a9f4ea9f81 api: rename MM_MODEM_ALLOWED_MODE to MM_MODEM_MODE
Makes more sense to have the enum named just as 'mode', as it applies to both
Supported and Allowed.
2011-10-01 15:23:11 +02:00
Aleksander Morgado
40406693b6 api: new SetAllowedBands() to be able to modify the allowed bands in the modem
Changing the allowed bands in a modem may fail, for example if trying to set a
frequency band which is not in the bands mask reported as Supported by the modem.
Therefore, we need an explicit SetAllowedBands() method with proper error
reporting instead of making the property writable.
2011-10-01 15:23:09 +02:00
Aleksander Morgado
b5393091de api: new SetAllowedModes() to be able to modify the allowed mode in the modem
Changing the allowed mode of a modem may fail, for example if trying to set a
mode which is not in the modes reported as Supported by the modem. Therefore, we
need an explicit SetAllowedModes() method with proper error reporting instead of
making the property writable.
2011-10-01 15:23:08 +02:00
Aleksander Morgado
dbc64d83ba api: let SignalQuality say if the given value was recently taken
Modems which only expose a single port will not be able to update the signal
quality value while in connected mode. The signal quality value reported in this
case, while the modem is connected, will be the last signal quality value read
before the connection.

The additional boolean value proposed here in the SignalQuality property will
just say if the given signal quality was recently taken (if TRUE) or cached
some time ago (if FALSE). The time to assume the value was recently taken or not
could depend on different things, for example:

 * If the modem always has an AT port, even if connected, we could directly
   query the current signal quality and report the value as being fresh.

 * If the modem has a single port, we could report the value as not being fresh
   as soon as the modem gets in connected state.

 * For modems which report the signal quality updates in unsolicited messages,
   we could report the value as being fresh if the update was received in the
   last minute or so.
2011-10-01 15:23:06 +02:00
Aleksander Morgado
e9743f4b49 api: let the Modem expose a 'Sim' property to link to a specific SIM object
SIM objects will be listed as independent objects in the DBus API, and the 'Sim'
property in a given modem object will specify which SIM object is in use.
2011-10-01 15:23:05 +02:00
Aleksander Morgado
588f9550ed api: remove GetInfo() from the Modem API and use read-only properties instead.
New 'Manufacturer', 'Model' and 'Revision properties are added, all being
read-only strings.
2011-10-01 15:23:02 +02:00
Aleksander Morgado
9d9a189026 api: include ScanDevices() and SetLogging() in the new manager API
These methods were available in the old API, and are needed in the new one.
2011-10-01 15:20:14 +02:00
Dan Williams
7a7014330c examples: add example of auto-enabling modems 2011-09-30 14:38:11 -05:00
Dan Williams
30a67862ec zte: update port hints for Onda MSA110 and others 2011-09-28 10:31:32 -05:00
Dan Williams
368b808869 libwmc: simpler logging and error handling 2011-09-27 15:33:53 -05: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
Dan Williams
18fc92ef73 libwmc: add more test code and start of com tests 2011-09-27 13:13:40 -05:00
Dan Williams
8250dee131 libwmc: add more tests including for UML290 quirks 2011-09-19 13:42:00 -05:00
Dan Williams
46a5c77616 libwmc: rename some test functions 2011-09-19 11:24:43 -05:00
Dan Williams
3dd4cdaf2b libwmc: beginning of bits for WMC-based devices like UML290 2011-09-17 13:27:54 -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
Aleksander Morgado
2a9a6ad79b nokia: use E1 E0 when initializing the modem
Passing E1 and E0 afterwards seems to properly disable the echo in Nokia modems
(N900 and C7 at least)
2011-08-25 22:00:56 -05:00