diff options
author | Dan Williams <dcbw@redhat.com> | 2010-10-21 16:57:37 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2010-10-21 16:57:37 -0500 |
commit | 328d2369a9dadfae786e4c524b5ff2fd0d1a9e17 (patch) | |
tree | 66eec3af08301dbb9ffbd8a26b1f558134fb289b /src/mm-generic-cdma.c | |
parent | 9fa20cd018ddbbcc95fd600ca140ac85661567bd (diff) |
core: add DeviceIdentifier property
This is computed before any PIN is entered, and thus before we can
usually get IMEI or MEID/ESN out of the device in many cases. It's
therefore not the same as EquipmentIdentifier.
This is intended to be used by UI programs for matching devices with
PIN numbers for automatic unlocking. While the PIN number is actually
*SIM* specific, no modems allow access to the IMSI before the PIN is
entered, and thus we cannot actually match the PIN with the SIM. The
device ID is the next best thing we can use and should allow auto
unlocking in most cases.
Diffstat (limited to 'src/mm-generic-cdma.c')
-rw-r--r-- | src/mm-generic-cdma.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c index 3dc3de4d..4dd1f0ef 100644 --- a/src/mm-generic-cdma.c +++ b/src/mm-generic-cdma.c @@ -162,6 +162,47 @@ initial_esn_check (MMGenericCdma *self) } } +static void +get_info_cb (MMModem *modem, + const char *manufacturer, + const char *model, + const char *version, + GError *error, + gpointer user_data) +{ + /* Base class handles saving the info for us */ + if (modem) + mm_serial_port_close (MM_SERIAL_PORT (MM_GENERIC_CDMA_GET_PRIVATE (modem)->primary)); +} + +static void +initial_info_check (MMGenericCdma *self) +{ + GError *error = NULL; + MMGenericCdmaPrivate *priv; + + g_return_if_fail (MM_IS_GENERIC_CDMA (self)); + priv = MM_GENERIC_CDMA_GET_PRIVATE (self); + + g_return_if_fail (priv->primary != NULL); + + if (mm_serial_port_open (MM_SERIAL_PORT (priv->primary), &error)) { + /* Make sure echoing is off */ + mm_at_serial_port_queue_command (priv->primary, "E0", 3, NULL, NULL); + mm_modem_base_get_card_info (MM_MODEM_BASE (self), + priv->primary, + NULL, + get_info_cb, + NULL); + } else { + g_warning ("%s: failed to open serial port: (%d) %s", + __func__, + error ? error->code : -1, + error && error->message ? error->message : "(unknown)"); + g_clear_error (&error); + } +} + static gboolean owns_port (MMModem *modem, const char *subsys, const char *name) { @@ -215,6 +256,9 @@ mm_generic_cdma_grab_port (MMGenericCdma *self, g_object_notify (G_OBJECT (self), MM_MODEM_DATA_DEVICE); } + /* Get the modem's general info */ + initial_info_check (self); + /* Get modem's ESN number */ initial_esn_check (self); |