ports: rename 'MMQmiPort' to 'MMPortQmi'

This commit is contained in:
Aleksander Morgado
2013-11-20 15:49:57 +01:00
parent 6f235b9948
commit 403e013f15
10 changed files with 150 additions and 150 deletions

View File

@@ -98,8 +98,8 @@ libserial_la_SOURCES = \
# Additional QMI support in libserial # Additional QMI support in libserial
if WITH_QMI if WITH_QMI
libserial_la_SOURCES += \ libserial_la_SOURCES += \
mm-qmi-port.c \ mm-port-qmi.c \
mm-qmi-port.h mm-port-qmi.h
libserial_la_CPPFLAGS += $(QMI_CFLAGS) libserial_la_CPPFLAGS += $(QMI_CFLAGS)
endif endif

View File

@@ -248,7 +248,7 @@ mm_base_modem_grab_port (MMBaseModem *self,
g_str_has_prefix (name, "cdc-wdm")) { g_str_has_prefix (name, "cdc-wdm")) {
#if defined WITH_QMI #if defined WITH_QMI
if (ptype == MM_PORT_TYPE_QMI) if (ptype == MM_PORT_TYPE_QMI)
port = MM_PORT (mm_qmi_port_new (name)); port = MM_PORT (mm_port_qmi_new (name));
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
if (!port && ptype == MM_PORT_TYPE_MBIM) if (!port && ptype == MM_PORT_TYPE_MBIM)
@@ -569,41 +569,41 @@ mm_base_modem_peek_port_gps (MMBaseModem *self)
#if defined WITH_QMI #if defined WITH_QMI
MMQmiPort * MMPortQmi *
mm_base_modem_get_port_qmi (MMBaseModem *self) mm_base_modem_get_port_qmi (MMBaseModem *self)
{ {
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL); g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
/* First QMI port in the list is the primary one always */ /* First QMI port in the list is the primary one always */
return (self->priv->qmi ? ((MMQmiPort *)g_object_ref (self->priv->qmi->data)) : NULL); return (self->priv->qmi ? ((MMPortQmi *)g_object_ref (self->priv->qmi->data)) : NULL);
} }
MMQmiPort * MMPortQmi *
mm_base_modem_peek_port_qmi (MMBaseModem *self) mm_base_modem_peek_port_qmi (MMBaseModem *self)
{ {
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL); g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
/* First QMI port in the list is the primary one always */ /* First QMI port in the list is the primary one always */
return (self->priv->qmi ? (MMQmiPort *)self->priv->qmi->data : NULL); return (self->priv->qmi ? (MMPortQmi *)self->priv->qmi->data : NULL);
} }
MMQmiPort * MMPortQmi *
mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, mm_base_modem_get_port_qmi_for_data (MMBaseModem *self,
MMPort *data, MMPort *data,
GError **error) GError **error)
{ {
MMQmiPort *qmi; MMPortQmi *qmi;
qmi = mm_base_modem_peek_port_qmi_for_data (self, data, error); qmi = mm_base_modem_peek_port_qmi_for_data (self, data, error);
return (qmi ? (MMQmiPort *)g_object_ref (qmi) : NULL); return (qmi ? (MMPortQmi *)g_object_ref (qmi) : NULL);
} }
MMQmiPort * MMPortQmi *
mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
MMPort *data, MMPort *data,
GError **error) GError **error)
{ {
MMQmiPort *found; MMPortQmi *found;
GUdevClient *client; GUdevClient *client;
GUdevDevice *data_device; GUdevDevice *data_device;
GUdevDevice *data_device_parent; GUdevDevice *data_device_parent;
@@ -683,7 +683,7 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
if (g_str_equal (g_udev_device_get_sysfs_path (data_device_parent), if (g_str_equal (g_udev_device_get_sysfs_path (data_device_parent),
g_udev_device_get_sysfs_path (qmi_device_parent))) g_udev_device_get_sysfs_path (qmi_device_parent)))
found = MM_QMI_PORT (l->data); found = MM_PORT_QMI (l->data);
g_object_unref (qmi_device_parent); g_object_unref (qmi_device_parent);
} }
@@ -702,7 +702,7 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
mm_info ("Assuming QMI port '%s' is associated to net/%s", mm_info ("Assuming QMI port '%s' is associated to net/%s",
mm_port_get_device (MM_PORT (self->priv->qmi->data)), mm_port_get_device (MM_PORT (self->priv->qmi->data)),
mm_port_get_device (data)); mm_port_get_device (data));
found = MM_QMI_PORT (self->priv->qmi->data); found = MM_PORT_QMI (self->priv->qmi->data);
} else { } else {
g_set_error (error, g_set_error (error,
MM_CORE_ERROR, MM_CORE_ERROR,
@@ -1593,7 +1593,7 @@ dispose (GObject *object)
* otherwise the allocated CIDs will be kept allocated, and if we end up * otherwise the allocated CIDs will be kept allocated, and if we end up
* allocating too many newer allocations will fail with client-ids-exhausted * allocating too many newer allocations will fail with client-ids-exhausted
* errors. */ * errors. */
g_list_foreach (self->priv->qmi, (GFunc)mm_qmi_port_close, NULL); g_list_foreach (self->priv->qmi, (GFunc)mm_port_qmi_close, NULL);
g_list_free_full (self->priv->qmi, g_object_unref); g_list_free_full (self->priv->qmi, g_object_unref);
self->priv->qmi = NULL; self->priv->qmi = NULL;
#endif #endif

View File

@@ -35,7 +35,7 @@
#include "mm-port-serial-gps.h" #include "mm-port-serial-gps.h"
#if defined WITH_QMI #if defined WITH_QMI
#include "mm-qmi-port.h" #include "mm-port-qmi.h"
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
@@ -130,8 +130,8 @@ MMPortSerialQcdm *mm_base_modem_peek_port_qcdm (MMBaseModem *self);
MMPortSerialAt *mm_base_modem_peek_port_gps_control (MMBaseModem *self); MMPortSerialAt *mm_base_modem_peek_port_gps_control (MMBaseModem *self);
MMPortSerialGps *mm_base_modem_peek_port_gps (MMBaseModem *self); MMPortSerialGps *mm_base_modem_peek_port_gps (MMBaseModem *self);
#if defined WITH_QMI #if defined WITH_QMI
MMQmiPort *mm_base_modem_peek_port_qmi (MMBaseModem *self); MMPortQmi *mm_base_modem_peek_port_qmi (MMBaseModem *self);
MMQmiPort *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error); MMPortQmi *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
MMMbimPort *mm_base_modem_peek_port_mbim (MMBaseModem *self); MMMbimPort *mm_base_modem_peek_port_mbim (MMBaseModem *self);
@@ -147,8 +147,8 @@ MMPortSerialQcdm *mm_base_modem_get_port_qcdm (MMBaseModem *self);
MMPortSerialAt *mm_base_modem_get_port_gps_control (MMBaseModem *self); MMPortSerialAt *mm_base_modem_get_port_gps_control (MMBaseModem *self);
MMPortSerialGps *mm_base_modem_get_port_gps (MMBaseModem *self); MMPortSerialGps *mm_base_modem_get_port_gps (MMBaseModem *self);
#if defined WITH_QMI #if defined WITH_QMI
MMQmiPort *mm_base_modem_get_port_qmi (MMBaseModem *self); MMPortQmi *mm_base_modem_get_port_qmi (MMBaseModem *self);
MMQmiPort *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error); MMPortQmi *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
MMMbimPort *mm_base_modem_get_port_mbim (MMBaseModem *self); MMMbimPort *mm_base_modem_get_port_mbim (MMBaseModem *self);

View File

@@ -70,7 +70,7 @@ typedef struct {
GCancellable *cancellable; GCancellable *cancellable;
ConnectStep step; ConnectStep step;
MMPort *data; MMPort *data;
MMQmiPort *qmi; MMPortQmi *qmi;
gchar *user; gchar *user;
gchar *password; gchar *password;
gchar *apn; gchar *apn;
@@ -468,7 +468,7 @@ set_ip_family_ready (QmiClientWds *client,
} }
static void static void
qmi_port_allocate_client_ready (MMQmiPort *qmi, qmi_port_allocate_client_ready (MMPortQmi *qmi,
GAsyncResult *res, GAsyncResult *res,
ConnectContext *ctx) ConnectContext *ctx)
{ {
@@ -477,20 +477,20 @@ qmi_port_allocate_client_ready (MMQmiPort *qmi,
g_assert (ctx->running_ipv4 || ctx->running_ipv6); g_assert (ctx->running_ipv4 || ctx->running_ipv6);
g_assert (!(ctx->running_ipv4 && ctx->running_ipv6)); g_assert (!(ctx->running_ipv4 && ctx->running_ipv6));
if (!mm_qmi_port_allocate_client_finish (qmi, res, &error)) { if (!mm_port_qmi_allocate_client_finish (qmi, res, &error)) {
g_simple_async_result_take_error (ctx->result, error); g_simple_async_result_take_error (ctx->result, error);
connect_context_complete_and_free (ctx); connect_context_complete_and_free (ctx);
return; return;
} }
if (ctx->running_ipv4) if (ctx->running_ipv4)
ctx->client_ipv4 = QMI_CLIENT_WDS (mm_qmi_port_get_client (qmi, ctx->client_ipv4 = QMI_CLIENT_WDS (mm_port_qmi_get_client (qmi,
QMI_SERVICE_WDS, QMI_SERVICE_WDS,
MM_QMI_PORT_FLAG_WDS_IPV4)); MM_PORT_QMI_FLAG_WDS_IPV4));
else else
ctx->client_ipv6 = QMI_CLIENT_WDS (mm_qmi_port_get_client (qmi, ctx->client_ipv6 = QMI_CLIENT_WDS (mm_port_qmi_get_client (qmi,
QMI_SERVICE_WDS, QMI_SERVICE_WDS,
MM_QMI_PORT_FLAG_WDS_IPV6)); MM_PORT_QMI_FLAG_WDS_IPV6));
/* Keep on */ /* Keep on */
ctx->step++; ctx->step++;
@@ -498,13 +498,13 @@ qmi_port_allocate_client_ready (MMQmiPort *qmi,
} }
static void static void
qmi_port_open_ready (MMQmiPort *qmi, qmi_port_open_ready (MMPortQmi *qmi,
GAsyncResult *res, GAsyncResult *res,
ConnectContext *ctx) ConnectContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
if (!mm_qmi_port_open_finish (qmi, res, &error)) { if (!mm_port_qmi_open_finish (qmi, res, &error)) {
g_simple_async_result_take_error (ctx->result, error); g_simple_async_result_take_error (ctx->result, error);
connect_context_complete_and_free (ctx); connect_context_complete_and_free (ctx);
return; return;
@@ -537,8 +537,8 @@ connect_context_step (ConnectContext *ctx)
ctx->step++; ctx->step++;
case CONNECT_STEP_OPEN_QMI_PORT: case CONNECT_STEP_OPEN_QMI_PORT:
if (!mm_qmi_port_is_open (ctx->qmi)) { if (!mm_port_qmi_is_open (ctx->qmi)) {
mm_qmi_port_open (ctx->qmi, mm_port_qmi_open (ctx->qmi,
TRUE, TRUE,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)qmi_port_open_ready, (GAsyncReadyCallback)qmi_port_open_ready,
@@ -567,14 +567,14 @@ connect_context_step (ConnectContext *ctx)
case CONNECT_STEP_WDS_CLIENT_IPV4: { case CONNECT_STEP_WDS_CLIENT_IPV4: {
QmiClient *client; QmiClient *client;
client = mm_qmi_port_get_client (ctx->qmi, client = mm_port_qmi_get_client (ctx->qmi,
QMI_SERVICE_WDS, QMI_SERVICE_WDS,
MM_QMI_PORT_FLAG_WDS_IPV4); MM_PORT_QMI_FLAG_WDS_IPV4);
if (!client) { if (!client) {
mm_dbg ("Allocating IPv4-specific WDS client"); mm_dbg ("Allocating IPv4-specific WDS client");
mm_qmi_port_allocate_client (ctx->qmi, mm_port_qmi_allocate_client (ctx->qmi,
QMI_SERVICE_WDS, QMI_SERVICE_WDS,
MM_QMI_PORT_FLAG_WDS_IPV4, MM_PORT_QMI_FLAG_WDS_IPV4,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)qmi_port_allocate_client_ready, (GAsyncReadyCallback)qmi_port_allocate_client_ready,
ctx); ctx);
@@ -654,14 +654,14 @@ connect_context_step (ConnectContext *ctx)
case CONNECT_STEP_WDS_CLIENT_IPV6: { case CONNECT_STEP_WDS_CLIENT_IPV6: {
QmiClient *client; QmiClient *client;
client = mm_qmi_port_get_client (ctx->qmi, client = mm_port_qmi_get_client (ctx->qmi,
QMI_SERVICE_WDS, QMI_SERVICE_WDS,
MM_QMI_PORT_FLAG_WDS_IPV6); MM_PORT_QMI_FLAG_WDS_IPV6);
if (!client) { if (!client) {
mm_dbg ("Allocating IPv6-specific WDS client"); mm_dbg ("Allocating IPv6-specific WDS client");
mm_qmi_port_allocate_client (ctx->qmi, mm_port_qmi_allocate_client (ctx->qmi,
QMI_SERVICE_WDS, QMI_SERVICE_WDS,
MM_QMI_PORT_FLAG_WDS_IPV6, MM_PORT_QMI_FLAG_WDS_IPV6,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)qmi_port_allocate_client_ready, (GAsyncReadyCallback)qmi_port_allocate_client_ready,
ctx); ctx);
@@ -794,7 +794,7 @@ _connect (MMBearer *self,
ConnectContext *ctx; ConnectContext *ctx;
MMBaseModem *modem = NULL; MMBaseModem *modem = NULL;
MMPort *data; MMPort *data;
MMQmiPort *qmi; MMPortQmi *qmi;
GError *error = NULL; GError *error = NULL;
const gchar *apn; const gchar *apn;

View File

@@ -130,7 +130,7 @@ peek_qmi_client (MMBroadbandModemQmi *self,
QmiService service, QmiService service,
GError **error) GError **error)
{ {
MMQmiPort *port; MMPortQmi *port;
QmiClient *client; QmiClient *client;
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self)); port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
@@ -142,9 +142,9 @@ peek_qmi_client (MMBroadbandModemQmi *self,
return NULL; return NULL;
} }
client = mm_qmi_port_peek_client (port, client = mm_port_qmi_peek_client (port,
service, service,
MM_QMI_PORT_FLAG_DEFAULT); MM_PORT_QMI_FLAG_DEFAULT);
if (!client) if (!client)
g_set_error (error, g_set_error (error,
MM_CORE_ERROR, MM_CORE_ERROR,
@@ -6557,7 +6557,7 @@ messaging_check_support (MMIfaceModemMessaging *self,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
MMQmiPort *port; MMPortQmi *port;
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
@@ -6566,7 +6566,7 @@ messaging_check_support (MMIfaceModemMessaging *self,
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self)); port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
/* If we have support for the WMS client, messaging is supported */ /* If we have support for the WMS client, messaging is supported */
if (!port || !mm_qmi_port_peek_client (port, QMI_SERVICE_WMS, MM_QMI_PORT_FLAG_DEFAULT)) { if (!port || !mm_port_qmi_peek_client (port, QMI_SERVICE_WMS, MM_PORT_QMI_FLAG_DEFAULT)) {
/* Try to fallback to AT support */ /* Try to fallback to AT support */
iface_modem_messaging_parent->check_support ( iface_modem_messaging_parent->check_support (
self, self,
@@ -7636,7 +7636,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
{ {
MMModemLocationSource sources; MMModemLocationSource sources;
GError *error = NULL; GError *error = NULL;
MMQmiPort *port; MMPortQmi *port;
sources = iface_modem_location_parent->load_capabilities_finish (self, res, &error); sources = iface_modem_location_parent->load_capabilities_finish (self, res, &error);
if (error) { if (error) {
@@ -7651,9 +7651,9 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
/* Now our own checks */ /* Now our own checks */
/* If we have support for the PDS client, GPS location is supported */ /* If we have support for the PDS client, GPS location is supported */
if (port && mm_qmi_port_peek_client (port, if (port && mm_port_qmi_peek_client (port,
QMI_SERVICE_PDS, QMI_SERVICE_PDS,
MM_QMI_PORT_FLAG_DEFAULT)) MM_PORT_QMI_FLAG_DEFAULT))
sources |= (MM_MODEM_LOCATION_SOURCE_GPS_NMEA | MM_MODEM_LOCATION_SOURCE_GPS_RAW); sources |= (MM_MODEM_LOCATION_SOURCE_GPS_NMEA | MM_MODEM_LOCATION_SOURCE_GPS_RAW);
/* If the modem is CDMA, we have support for CDMA BS location */ /* If the modem is CDMA, we have support for CDMA BS location */
@@ -8116,7 +8116,7 @@ oma_check_support (MMIfaceModemOma *self,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
MMQmiPort *port; MMPortQmi *port;
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
@@ -8125,7 +8125,7 @@ oma_check_support (MMIfaceModemOma *self,
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self)); port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
/* If we have support for the OMA client, OMA is supported */ /* If we have support for the OMA client, OMA is supported */
if (!port || !mm_qmi_port_peek_client (port, QMI_SERVICE_OMA, MM_QMI_PORT_FLAG_DEFAULT)) { if (!port || !mm_port_qmi_peek_client (port, QMI_SERVICE_OMA, MM_PORT_QMI_FLAG_DEFAULT)) {
mm_dbg ("OMA capabilities not supported"); mm_dbg ("OMA capabilities not supported");
g_simple_async_result_set_op_res_gboolean (result, FALSE); g_simple_async_result_set_op_res_gboolean (result, FALSE);
} else { } else {
@@ -9398,7 +9398,7 @@ signal_check_support (MMIfaceModemSignal *self,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
MMQmiPort *port; MMPortQmi *port;
gboolean supported = FALSE; gboolean supported = FALSE;
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
@@ -9410,7 +9410,7 @@ signal_check_support (MMIfaceModemSignal *self,
/* If NAS service is available, assume either signal info or signal strength are supported */ /* If NAS service is available, assume either signal info or signal strength are supported */
if (port) if (port)
supported = !!mm_qmi_port_peek_client (port, QMI_SERVICE_NAS, MM_QMI_PORT_FLAG_DEFAULT); supported = !!mm_port_qmi_peek_client (port, QMI_SERVICE_NAS, MM_PORT_QMI_FLAG_DEFAULT);
mm_dbg ("Extended signal capabilities %ssupported", supported ? "" : "not "); mm_dbg ("Extended signal capabilities %ssupported", supported ? "" : "not ");
g_simple_async_result_set_op_res_gboolean (result, supported); g_simple_async_result_set_op_res_gboolean (result, supported);
@@ -9911,7 +9911,7 @@ enabling_started (MMBroadbandModem *self,
typedef struct { typedef struct {
MMBroadbandModem *self; MMBroadbandModem *self;
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
MMQmiPort *qmi; MMPortQmi *qmi;
QmiService services[32]; QmiService services[32];
guint service_index; guint service_index;
} InitializationStartedContext; } InitializationStartedContext;
@@ -9974,13 +9974,13 @@ parent_initialization_started (InitializationStartedContext *ctx)
static void allocate_next_client (InitializationStartedContext *ctx); static void allocate_next_client (InitializationStartedContext *ctx);
static void static void
qmi_port_allocate_client_ready (MMQmiPort *qmi, qmi_port_allocate_client_ready (MMPortQmi *qmi,
GAsyncResult *res, GAsyncResult *res,
InitializationStartedContext *ctx) InitializationStartedContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
if (!mm_qmi_port_allocate_client_finish (qmi, res, &error)) { if (!mm_port_qmi_allocate_client_finish (qmi, res, &error)) {
mm_dbg ("Couldn't allocate client for service '%s': %s", mm_dbg ("Couldn't allocate client for service '%s': %s",
qmi_service_get_string (ctx->services[ctx->service_index]), qmi_service_get_string (ctx->services[ctx->service_index]),
error->message); error->message);
@@ -10001,9 +10001,9 @@ allocate_next_client (InitializationStartedContext *ctx)
} }
/* Otherwise, allocate next client */ /* Otherwise, allocate next client */
mm_qmi_port_allocate_client (ctx->qmi, mm_port_qmi_allocate_client (ctx->qmi,
ctx->services[ctx->service_index], ctx->services[ctx->service_index],
MM_QMI_PORT_FLAG_DEFAULT, MM_PORT_QMI_FLAG_DEFAULT,
NULL, NULL,
(GAsyncReadyCallback)qmi_port_allocate_client_ready, (GAsyncReadyCallback)qmi_port_allocate_client_ready,
ctx); ctx);
@@ -10011,13 +10011,13 @@ allocate_next_client (InitializationStartedContext *ctx)
static void static void
qmi_port_open_ready_no_data_format (MMQmiPort *qmi, qmi_port_open_ready_no_data_format (MMPortQmi *qmi,
GAsyncResult *res, GAsyncResult *res,
InitializationStartedContext *ctx) InitializationStartedContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
if (!mm_qmi_port_open_finish (qmi, res, &error)) { if (!mm_port_qmi_open_finish (qmi, res, &error)) {
g_simple_async_result_take_error (ctx->result, error); g_simple_async_result_take_error (ctx->result, error);
initialization_started_context_complete_and_free (ctx); initialization_started_context_complete_and_free (ctx);
return; return;
@@ -10027,19 +10027,19 @@ qmi_port_open_ready_no_data_format (MMQmiPort *qmi,
} }
static void static void
qmi_port_open_ready (MMQmiPort *qmi, qmi_port_open_ready (MMPortQmi *qmi,
GAsyncResult *res, GAsyncResult *res,
InitializationStartedContext *ctx) InitializationStartedContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
if (!mm_qmi_port_open_finish (qmi, res, &error)) { if (!mm_port_qmi_open_finish (qmi, res, &error)) {
/* Really, really old devices (Gobi 1K, 2008-era firmware) may not /* Really, really old devices (Gobi 1K, 2008-era firmware) may not
* support SetDataFormat, so if we get an error opening the port * support SetDataFormat, so if we get an error opening the port
* try without it. The qmi_wwan driver will fix up any issues that * try without it. The qmi_wwan driver will fix up any issues that
* the device might have between raw-ip and 802.3 mode anyway. * the device might have between raw-ip and 802.3 mode anyway.
*/ */
mm_qmi_port_open (ctx->qmi, mm_port_qmi_open (ctx->qmi,
FALSE, FALSE,
NULL, NULL,
(GAsyncReadyCallback)qmi_port_open_ready_no_data_format, (GAsyncReadyCallback)qmi_port_open_ready_no_data_format,
@@ -10075,7 +10075,7 @@ initialization_started (MMBroadbandModem *self,
return; return;
} }
if (mm_qmi_port_is_open (ctx->qmi)) { if (mm_port_qmi_is_open (ctx->qmi)) {
/* Nothing to be done, just launch parent's callback */ /* Nothing to be done, just launch parent's callback */
parent_initialization_started (ctx); parent_initialization_started (ctx);
return; return;
@@ -10090,7 +10090,7 @@ initialization_started (MMBroadbandModem *self,
ctx->services[5] = QMI_SERVICE_UNKNOWN; ctx->services[5] = QMI_SERVICE_UNKNOWN;
/* Now open our QMI port */ /* Now open our QMI port */
mm_qmi_port_open (ctx->qmi, mm_port_qmi_open (ctx->qmi,
TRUE, TRUE,
NULL, NULL,
(GAsyncReadyCallback)qmi_port_open_ready, (GAsyncReadyCallback)qmi_port_open_ready,
@@ -10127,14 +10127,14 @@ mm_broadband_modem_qmi_init (MMBroadbandModemQmi *self)
static void static void
finalize (GObject *object) finalize (GObject *object)
{ {
MMQmiPort *qmi; MMPortQmi *qmi;
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (object); MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (object);
qmi = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self)); qmi = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
/* If we did open the QMI port during initialization, close it now */ /* If we did open the QMI port during initialization, close it now */
if (qmi && if (qmi &&
mm_qmi_port_is_open (qmi)) { mm_port_qmi_is_open (qmi)) {
mm_qmi_port_close (qmi); mm_port_qmi_close (qmi);
} }
g_free (self->priv->imei); g_free (self->priv->imei);

View File

@@ -37,7 +37,7 @@
#include "mm-daemon-enums-types.h" #include "mm-daemon-enums-types.h"
#if defined WITH_QMI #if defined WITH_QMI
#include "mm-qmi-port.h" #include "mm-port-qmi.h"
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
@@ -109,7 +109,7 @@ typedef struct {
#if defined WITH_QMI #if defined WITH_QMI
/* ---- QMI probing specific context ---- */ /* ---- QMI probing specific context ---- */
MMQmiPort *qmi_port; MMPortQmi *port_qmi;
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
@@ -338,10 +338,10 @@ port_probe_run_task_free (PortProbeRunTask *task)
} }
#if defined WITH_QMI #if defined WITH_QMI
if (task->qmi_port) { if (task->port_qmi) {
if (mm_qmi_port_is_open (task->qmi_port)) if (mm_port_qmi_is_open (task->port_qmi))
mm_qmi_port_close (task->qmi_port); mm_port_qmi_close (task->port_qmi);
g_object_unref (task->qmi_port); g_object_unref (task->port_qmi);
} }
#endif #endif
@@ -416,7 +416,7 @@ static gboolean wdm_probe (MMPortProbe *self);
#if defined WITH_QMI #if defined WITH_QMI
static void static void
qmi_port_open_ready (MMQmiPort *qmi_port, port_qmi_open_ready (MMPortQmi *port_qmi,
GAsyncResult *res, GAsyncResult *res,
MMPortProbe *self) MMPortProbe *self)
{ {
@@ -424,7 +424,7 @@ qmi_port_open_ready (MMQmiPort *qmi_port,
GError *error = NULL; GError *error = NULL;
gboolean is_qmi; gboolean is_qmi;
is_qmi = mm_qmi_port_open_finish (qmi_port, res, &error); is_qmi = mm_port_qmi_open_finish (port_qmi, res, &error);
if (!is_qmi) { if (!is_qmi) {
mm_dbg ("(%s/%s) error checking QMI support: '%s'", mm_dbg ("(%s/%s) error checking QMI support: '%s'",
g_udev_device_get_subsystem (self->priv->port), g_udev_device_get_subsystem (self->priv->port),
@@ -436,7 +436,7 @@ qmi_port_open_ready (MMQmiPort *qmi_port,
/* Set probing result */ /* Set probing result */
mm_port_probe_set_result_qmi (self, is_qmi); mm_port_probe_set_result_qmi (self, is_qmi);
mm_qmi_port_close (qmi_port); mm_port_qmi_close (port_qmi);
/* Keep on */ /* Keep on */
task->source_id = g_idle_add ((GSourceFunc)wdm_probe, self); task->source_id = g_idle_add ((GSourceFunc)wdm_probe, self);
@@ -455,11 +455,11 @@ wdm_probe_qmi (MMPortProbe *self)
g_udev_device_get_name (self->priv->port)); g_udev_device_get_name (self->priv->port));
/* Create a port and try to open it */ /* Create a port and try to open it */
task->qmi_port = mm_qmi_port_new (g_udev_device_get_name (self->priv->port)); task->port_qmi = mm_port_qmi_new (g_udev_device_get_name (self->priv->port));
mm_qmi_port_open (task->qmi_port, mm_port_qmi_open (task->port_qmi,
FALSE, FALSE,
NULL, NULL,
(GAsyncReadyCallback)qmi_port_open_ready, (GAsyncReadyCallback)port_qmi_open_ready,
self); self);
#else #else
/* If not compiled with QMI support, just assume we won't have any QMI port */ /* If not compiled with QMI support, just assume we won't have any QMI port */

View File

@@ -21,18 +21,18 @@
#include <ModemManager.h> #include <ModemManager.h>
#include <mm-errors-types.h> #include <mm-errors-types.h>
#include "mm-qmi-port.h" #include "mm-port-qmi.h"
#include "mm-log.h" #include "mm-log.h"
G_DEFINE_TYPE (MMQmiPort, mm_qmi_port, MM_TYPE_PORT) G_DEFINE_TYPE (MMPortQmi, mm_port_qmi, MM_TYPE_PORT)
typedef struct { typedef struct {
QmiService service; QmiService service;
QmiClient *client; QmiClient *client;
MMQmiPortFlag flag; MMPortQmiFlag flag;
} ServiceInfo; } ServiceInfo;
struct _MMQmiPortPrivate { struct _MMPortQmiPrivate {
gboolean opening; gboolean opening;
QmiDevice *qmi_device; QmiDevice *qmi_device;
GList *services; GList *services;
@@ -41,9 +41,9 @@ struct _MMQmiPortPrivate {
/*****************************************************************************/ /*****************************************************************************/
QmiClient * QmiClient *
mm_qmi_port_peek_client (MMQmiPort *self, mm_port_qmi_peek_client (MMPortQmi *self,
QmiService service, QmiService service,
MMQmiPortFlag flag) MMPortQmiFlag flag)
{ {
GList *l; GList *l;
@@ -59,20 +59,20 @@ mm_qmi_port_peek_client (MMQmiPort *self,
} }
QmiClient * QmiClient *
mm_qmi_port_get_client (MMQmiPort *self, mm_port_qmi_get_client (MMPortQmi *self,
QmiService service, QmiService service,
MMQmiPortFlag flag) MMPortQmiFlag flag)
{ {
QmiClient *client; QmiClient *client;
client = mm_qmi_port_peek_client (self, service, flag); client = mm_port_qmi_peek_client (self, service, flag);
return (client ? g_object_ref (client) : NULL); return (client ? g_object_ref (client) : NULL);
} }
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
MMQmiPort *self; MMPortQmi *self;
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
ServiceInfo *info; ServiceInfo *info;
} AllocateClientContext; } AllocateClientContext;
@@ -91,7 +91,7 @@ allocate_client_context_complete_and_free (AllocateClientContext *ctx)
} }
gboolean gboolean
mm_qmi_port_allocate_client_finish (MMQmiPort *self, mm_port_qmi_allocate_client_finish (MMPortQmi *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -122,16 +122,16 @@ allocate_client_ready (QmiDevice *qmi_device,
} }
void void
mm_qmi_port_allocate_client (MMQmiPort *self, mm_port_qmi_allocate_client (MMPortQmi *self,
QmiService service, QmiService service,
MMQmiPortFlag flag, MMPortQmiFlag flag,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
AllocateClientContext *ctx; AllocateClientContext *ctx;
if (!!mm_qmi_port_peek_client (self, service, flag)) { if (!!mm_port_qmi_peek_client (self, service, flag)) {
g_simple_async_report_error_in_idle (G_OBJECT (self), g_simple_async_report_error_in_idle (G_OBJECT (self),
callback, callback,
user_data, user_data,
@@ -147,7 +147,7 @@ mm_qmi_port_allocate_client (MMQmiPort *self,
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
mm_qmi_port_allocate_client); mm_port_qmi_allocate_client);
ctx->info = g_new0 (ServiceInfo, 1); ctx->info = g_new0 (ServiceInfo, 1);
ctx->info->service = service; ctx->info->service = service;
ctx->info->flag = flag; ctx->info->flag = flag;
@@ -164,7 +164,7 @@ mm_qmi_port_allocate_client (MMQmiPort *self,
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
MMQmiPort *self; MMPortQmi *self;
gboolean set_data_format; gboolean set_data_format;
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
GCancellable *cancellable; GCancellable *cancellable;
@@ -182,7 +182,7 @@ port_open_context_complete_and_free (PortOpenContext *ctx)
} }
gboolean gboolean
mm_qmi_port_open_finish (MMQmiPort *self, mm_port_qmi_open_finish (MMPortQmi *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -242,7 +242,7 @@ qmi_device_new_ready (GObject *unused,
} }
void void
mm_qmi_port_open (MMQmiPort *self, mm_port_qmi_open (MMPortQmi *self,
gboolean set_data_format, gboolean set_data_format,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -252,7 +252,7 @@ mm_qmi_port_open (MMQmiPort *self,
gchar *fullpath; gchar *fullpath;
PortOpenContext *ctx; PortOpenContext *ctx;
g_return_if_fail (MM_IS_QMI_PORT (self)); g_return_if_fail (MM_IS_PORT_QMI (self));
ctx = g_new0 (PortOpenContext, 1); ctx = g_new0 (PortOpenContext, 1);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
@@ -260,7 +260,7 @@ mm_qmi_port_open (MMQmiPort *self,
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
mm_qmi_port_open); mm_port_qmi_open);
ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL; ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
if (self->priv->opening) { if (self->priv->opening) {
@@ -293,20 +293,20 @@ mm_qmi_port_open (MMQmiPort *self,
} }
gboolean gboolean
mm_qmi_port_is_open (MMQmiPort *self) mm_port_qmi_is_open (MMPortQmi *self)
{ {
g_return_val_if_fail (MM_IS_QMI_PORT (self), FALSE); g_return_val_if_fail (MM_IS_PORT_QMI (self), FALSE);
return !!self->priv->qmi_device; return !!self->priv->qmi_device;
} }
void void
mm_qmi_port_close (MMQmiPort *self) mm_port_qmi_close (MMPortQmi *self)
{ {
GList *l; GList *l;
GError *error = NULL; GError *error = NULL;
g_return_if_fail (MM_IS_QMI_PORT (self)); g_return_if_fail (MM_IS_PORT_QMI (self));
if (!self->priv->qmi_device) if (!self->priv->qmi_device)
return; return;
@@ -337,10 +337,10 @@ mm_qmi_port_close (MMQmiPort *self)
/*****************************************************************************/ /*****************************************************************************/
MMQmiPort * MMPortQmi *
mm_qmi_port_new (const gchar *name) mm_port_qmi_new (const gchar *name)
{ {
return MM_QMI_PORT (g_object_new (MM_TYPE_QMI_PORT, return MM_PORT_QMI (g_object_new (MM_TYPE_PORT_QMI,
MM_PORT_DEVICE, name, MM_PORT_DEVICE, name,
MM_PORT_SUBSYS, MM_PORT_SUBSYS_USB, MM_PORT_SUBSYS, MM_PORT_SUBSYS_USB,
MM_PORT_TYPE, MM_PORT_TYPE_QMI, MM_PORT_TYPE, MM_PORT_TYPE_QMI,
@@ -348,15 +348,15 @@ mm_qmi_port_new (const gchar *name)
} }
static void static void
mm_qmi_port_init (MMQmiPort *self) mm_port_qmi_init (MMPortQmi *self)
{ {
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_QMI_PORT, MMQmiPortPrivate); self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_PORT_QMI, MMPortQmiPrivate);
} }
static void static void
dispose (GObject *object) dispose (GObject *object)
{ {
MMQmiPort *self = MM_QMI_PORT (object); MMPortQmi *self = MM_PORT_QMI (object);
GList *l; GList *l;
/* Deallocate all clients */ /* Deallocate all clients */
@@ -372,15 +372,15 @@ dispose (GObject *object)
/* Clear device object */ /* Clear device object */
g_clear_object (&self->priv->qmi_device); g_clear_object (&self->priv->qmi_device);
G_OBJECT_CLASS (mm_qmi_port_parent_class)->dispose (object); G_OBJECT_CLASS (mm_port_qmi_parent_class)->dispose (object);
} }
static void static void
mm_qmi_port_class_init (MMQmiPortClass *klass) mm_port_qmi_class_init (MMPortQmiClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMQmiPortPrivate)); g_type_class_add_private (object_class, sizeof (MMPortQmiPrivate));
/* Virtual methods */ /* Virtual methods */
object_class->dispose = dispose; object_class->dispose = dispose;

View File

@@ -13,8 +13,8 @@
* Copyright (C) 2012 Google, Inc. * Copyright (C) 2012 Google, Inc.
*/ */
#ifndef MM_QMI_PORT_H #ifndef MM_PORT_QMI_H
#define MM_QMI_PORT_H #define MM_PORT_QMI_H
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
@@ -24,62 +24,62 @@
#include "mm-port.h" #include "mm-port.h"
#define MM_TYPE_QMI_PORT (mm_qmi_port_get_type ()) #define MM_TYPE_PORT_QMI (mm_port_qmi_get_type ())
#define MM_QMI_PORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_QMI_PORT, MMQmiPort)) #define MM_PORT_QMI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PORT_QMI, MMPortQmi))
#define MM_QMI_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_QMI_PORT, MMQmiPortClass)) #define MM_PORT_QMI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PORT_QMI, MMPortQmiClass))
#define MM_IS_QMI_PORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_QMI_PORT)) #define MM_IS_PORT_QMI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PORT_QMI))
#define MM_IS_QMI_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_QMI_PORT)) #define MM_IS_PORT_QMI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PORT_QMI))
#define MM_QMI_PORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_QMI_PORT, MMQmiPortClass)) #define MM_PORT_QMI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PORT_QMI, MMPortQmiClass))
typedef struct _MMQmiPort MMQmiPort; typedef struct _MMPortQmi MMPortQmi;
typedef struct _MMQmiPortClass MMQmiPortClass; typedef struct _MMPortQmiClass MMPortQmiClass;
typedef struct _MMQmiPortPrivate MMQmiPortPrivate; typedef struct _MMPortQmiPrivate MMPortQmiPrivate;
struct _MMQmiPort { struct _MMPortQmi {
MMPort parent; MMPort parent;
MMQmiPortPrivate *priv; MMPortQmiPrivate *priv;
}; };
struct _MMQmiPortClass { struct _MMPortQmiClass {
MMPortClass parent; MMPortClass parent;
}; };
GType mm_qmi_port_get_type (void); GType mm_port_qmi_get_type (void);
MMQmiPort *mm_qmi_port_new (const gchar *name); MMPortQmi *mm_port_qmi_new (const gchar *name);
void mm_qmi_port_open (MMQmiPort *self, void mm_port_qmi_open (MMPortQmi *self,
gboolean set_data_format, gboolean set_data_format,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean mm_qmi_port_open_finish (MMQmiPort *self, gboolean mm_port_qmi_open_finish (MMPortQmi *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
gboolean mm_qmi_port_is_open (MMQmiPort *self); gboolean mm_port_qmi_is_open (MMPortQmi *self);
void mm_qmi_port_close (MMQmiPort *self); void mm_port_qmi_close (MMPortQmi *self);
typedef enum { typedef enum {
MM_QMI_PORT_FLAG_DEFAULT = 0, MM_PORT_QMI_FLAG_DEFAULT = 0,
MM_QMI_PORT_FLAG_WDS_IPV4 = 100, MM_PORT_QMI_FLAG_WDS_IPV4 = 100,
MM_QMI_PORT_FLAG_WDS_IPV6 = 101 MM_PORT_QMI_FLAG_WDS_IPV6 = 101
} MMQmiPortFlag; } MMPortQmiFlag;
void mm_qmi_port_allocate_client (MMQmiPort *self, void mm_port_qmi_allocate_client (MMPortQmi *self,
QmiService service, QmiService service,
MMQmiPortFlag flag, MMPortQmiFlag flag,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean mm_qmi_port_allocate_client_finish (MMQmiPort *self, gboolean mm_port_qmi_allocate_client_finish (MMPortQmi *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
QmiClient *mm_qmi_port_peek_client (MMQmiPort *self, QmiClient *mm_port_qmi_peek_client (MMPortQmi *self,
QmiService service, QmiService service,
MMQmiPortFlag flag); MMPortQmiFlag flag);
QmiClient *mm_qmi_port_get_client (MMQmiPort *self, QmiClient *mm_port_qmi_get_client (MMPortQmi *self,
QmiService service, QmiService service,
MMQmiPortFlag flag); MMPortQmiFlag flag);
#endif /* MM_QMI_PORT_H */ #endif /* MM_PORT_QMI_H */

View File

@@ -40,7 +40,7 @@ ensure_qmi_client (MMSimQmi *self,
{ {
MMBaseModem *modem = NULL; MMBaseModem *modem = NULL;
QmiClient *client; QmiClient *client;
MMQmiPort *port; MMPortQmi *port;
g_object_get (self, g_object_get (self,
MM_SIM_MODEM, &modem, MM_SIM_MODEM, &modem,
@@ -60,9 +60,9 @@ ensure_qmi_client (MMSimQmi *self,
return FALSE; return FALSE;
} }
client = mm_qmi_port_peek_client (port, client = mm_port_qmi_peek_client (port,
service, service,
MM_QMI_PORT_FLAG_DEFAULT); MM_PORT_QMI_FLAG_DEFAULT);
if (!client) { if (!client) {
g_simple_async_report_error_in_idle (G_OBJECT (self), g_simple_async_report_error_in_idle (G_OBJECT (self),
callback, callback,

View File

@@ -46,7 +46,7 @@ ensure_qmi_client (MMSmsQmi *self,
{ {
MMBaseModem *modem = NULL; MMBaseModem *modem = NULL;
QmiClient *client; QmiClient *client;
MMQmiPort *port; MMPortQmi *port;
g_object_get (self, g_object_get (self,
MM_SMS_MODEM, &modem, MM_SMS_MODEM, &modem,
@@ -66,9 +66,9 @@ ensure_qmi_client (MMSmsQmi *self,
return FALSE; return FALSE;
} }
client = mm_qmi_port_peek_client (port, client = mm_port_qmi_peek_client (port,
service, service,
MM_QMI_PORT_FLAG_DEFAULT); MM_PORT_QMI_FLAG_DEFAULT);
if (!client) { if (!client) {
g_simple_async_report_error_in_idle (G_OBJECT (self), g_simple_async_report_error_in_idle (G_OBJECT (self),
callback, callback,