ports: rename 'MMQmiPort' to 'MMPortQmi'
This commit is contained in:
@@ -98,8 +98,8 @@ libserial_la_SOURCES = \
|
||||
# Additional QMI support in libserial
|
||||
if WITH_QMI
|
||||
libserial_la_SOURCES += \
|
||||
mm-qmi-port.c \
|
||||
mm-qmi-port.h
|
||||
mm-port-qmi.c \
|
||||
mm-port-qmi.h
|
||||
libserial_la_CPPFLAGS += $(QMI_CFLAGS)
|
||||
endif
|
||||
|
||||
|
@@ -248,7 +248,7 @@ mm_base_modem_grab_port (MMBaseModem *self,
|
||||
g_str_has_prefix (name, "cdc-wdm")) {
|
||||
#if defined WITH_QMI
|
||||
if (ptype == MM_PORT_TYPE_QMI)
|
||||
port = MM_PORT (mm_qmi_port_new (name));
|
||||
port = MM_PORT (mm_port_qmi_new (name));
|
||||
#endif
|
||||
#if defined WITH_MBIM
|
||||
if (!port && ptype == MM_PORT_TYPE_MBIM)
|
||||
@@ -569,41 +569,41 @@ mm_base_modem_peek_port_gps (MMBaseModem *self)
|
||||
|
||||
#if defined WITH_QMI
|
||||
|
||||
MMQmiPort *
|
||||
MMPortQmi *
|
||||
mm_base_modem_get_port_qmi (MMBaseModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
|
||||
/* 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)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
|
||||
|
||||
/* 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,
|
||||
MMPort *data,
|
||||
GError **error)
|
||||
{
|
||||
MMQmiPort *qmi;
|
||||
MMPortQmi *qmi;
|
||||
|
||||
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,
|
||||
MMPort *data,
|
||||
GError **error)
|
||||
{
|
||||
MMQmiPort *found;
|
||||
MMPortQmi *found;
|
||||
GUdevClient *client;
|
||||
GUdevDevice *data_device;
|
||||
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),
|
||||
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);
|
||||
}
|
||||
@@ -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_port_get_device (MM_PORT (self->priv->qmi->data)),
|
||||
mm_port_get_device (data));
|
||||
found = MM_QMI_PORT (self->priv->qmi->data);
|
||||
found = MM_PORT_QMI (self->priv->qmi->data);
|
||||
} else {
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
@@ -1593,7 +1593,7 @@ dispose (GObject *object)
|
||||
* otherwise the allocated CIDs will be kept allocated, and if we end up
|
||||
* allocating too many newer allocations will fail with client-ids-exhausted
|
||||
* 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);
|
||||
self->priv->qmi = NULL;
|
||||
#endif
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#include "mm-port-serial-gps.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
#include "mm-qmi-port.h"
|
||||
#include "mm-port-qmi.h"
|
||||
#endif
|
||||
|
||||
#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);
|
||||
MMPortSerialGps *mm_base_modem_peek_port_gps (MMBaseModem *self);
|
||||
#if defined WITH_QMI
|
||||
MMQmiPort *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 (MMBaseModem *self);
|
||||
MMPortQmi *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
|
||||
#endif
|
||||
#if defined WITH_MBIM
|
||||
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);
|
||||
MMPortSerialGps *mm_base_modem_get_port_gps (MMBaseModem *self);
|
||||
#if defined WITH_QMI
|
||||
MMQmiPort *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 (MMBaseModem *self);
|
||||
MMPortQmi *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
|
||||
#endif
|
||||
#if defined WITH_MBIM
|
||||
MMMbimPort *mm_base_modem_get_port_mbim (MMBaseModem *self);
|
||||
|
@@ -70,7 +70,7 @@ typedef struct {
|
||||
GCancellable *cancellable;
|
||||
ConnectStep step;
|
||||
MMPort *data;
|
||||
MMQmiPort *qmi;
|
||||
MMPortQmi *qmi;
|
||||
gchar *user;
|
||||
gchar *password;
|
||||
gchar *apn;
|
||||
@@ -468,7 +468,7 @@ set_ip_family_ready (QmiClientWds *client,
|
||||
}
|
||||
|
||||
static void
|
||||
qmi_port_allocate_client_ready (MMQmiPort *qmi,
|
||||
qmi_port_allocate_client_ready (MMPortQmi *qmi,
|
||||
GAsyncResult *res,
|
||||
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));
|
||||
|
||||
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);
|
||||
connect_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
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,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV4));
|
||||
MM_PORT_QMI_FLAG_WDS_IPV4));
|
||||
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,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV6));
|
||||
MM_PORT_QMI_FLAG_WDS_IPV6));
|
||||
|
||||
/* Keep on */
|
||||
ctx->step++;
|
||||
@@ -498,13 +498,13 @@ qmi_port_allocate_client_ready (MMQmiPort *qmi,
|
||||
}
|
||||
|
||||
static void
|
||||
qmi_port_open_ready (MMQmiPort *qmi,
|
||||
qmi_port_open_ready (MMPortQmi *qmi,
|
||||
GAsyncResult *res,
|
||||
ConnectContext *ctx)
|
||||
{
|
||||
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);
|
||||
connect_context_complete_and_free (ctx);
|
||||
return;
|
||||
@@ -537,8 +537,8 @@ connect_context_step (ConnectContext *ctx)
|
||||
ctx->step++;
|
||||
|
||||
case CONNECT_STEP_OPEN_QMI_PORT:
|
||||
if (!mm_qmi_port_is_open (ctx->qmi)) {
|
||||
mm_qmi_port_open (ctx->qmi,
|
||||
if (!mm_port_qmi_is_open (ctx->qmi)) {
|
||||
mm_port_qmi_open (ctx->qmi,
|
||||
TRUE,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)qmi_port_open_ready,
|
||||
@@ -567,14 +567,14 @@ connect_context_step (ConnectContext *ctx)
|
||||
case CONNECT_STEP_WDS_CLIENT_IPV4: {
|
||||
QmiClient *client;
|
||||
|
||||
client = mm_qmi_port_get_client (ctx->qmi,
|
||||
client = mm_port_qmi_get_client (ctx->qmi,
|
||||
QMI_SERVICE_WDS,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV4);
|
||||
MM_PORT_QMI_FLAG_WDS_IPV4);
|
||||
if (!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,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV4,
|
||||
MM_PORT_QMI_FLAG_WDS_IPV4,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)qmi_port_allocate_client_ready,
|
||||
ctx);
|
||||
@@ -654,14 +654,14 @@ connect_context_step (ConnectContext *ctx)
|
||||
case CONNECT_STEP_WDS_CLIENT_IPV6: {
|
||||
QmiClient *client;
|
||||
|
||||
client = mm_qmi_port_get_client (ctx->qmi,
|
||||
client = mm_port_qmi_get_client (ctx->qmi,
|
||||
QMI_SERVICE_WDS,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV6);
|
||||
MM_PORT_QMI_FLAG_WDS_IPV6);
|
||||
if (!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,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV6,
|
||||
MM_PORT_QMI_FLAG_WDS_IPV6,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)qmi_port_allocate_client_ready,
|
||||
ctx);
|
||||
@@ -794,7 +794,7 @@ _connect (MMBearer *self,
|
||||
ConnectContext *ctx;
|
||||
MMBaseModem *modem = NULL;
|
||||
MMPort *data;
|
||||
MMQmiPort *qmi;
|
||||
MMPortQmi *qmi;
|
||||
GError *error = NULL;
|
||||
const gchar *apn;
|
||||
|
||||
|
@@ -130,7 +130,7 @@ peek_qmi_client (MMBroadbandModemQmi *self,
|
||||
QmiService service,
|
||||
GError **error)
|
||||
{
|
||||
MMQmiPort *port;
|
||||
MMPortQmi *port;
|
||||
QmiClient *client;
|
||||
|
||||
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
|
||||
@@ -142,9 +142,9 @@ peek_qmi_client (MMBroadbandModemQmi *self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
client = mm_qmi_port_peek_client (port,
|
||||
client = mm_port_qmi_peek_client (port,
|
||||
service,
|
||||
MM_QMI_PORT_FLAG_DEFAULT);
|
||||
MM_PORT_QMI_FLAG_DEFAULT);
|
||||
if (!client)
|
||||
g_set_error (error,
|
||||
MM_CORE_ERROR,
|
||||
@@ -6557,7 +6557,7 @@ messaging_check_support (MMIfaceModemMessaging *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
MMQmiPort *port;
|
||||
MMPortQmi *port;
|
||||
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
@@ -6566,7 +6566,7 @@ messaging_check_support (MMIfaceModemMessaging *self,
|
||||
|
||||
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
|
||||
/* 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 */
|
||||
iface_modem_messaging_parent->check_support (
|
||||
self,
|
||||
@@ -7636,7 +7636,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
|
||||
{
|
||||
MMModemLocationSource sources;
|
||||
GError *error = NULL;
|
||||
MMQmiPort *port;
|
||||
MMPortQmi *port;
|
||||
|
||||
sources = iface_modem_location_parent->load_capabilities_finish (self, res, &error);
|
||||
if (error) {
|
||||
@@ -7651,9 +7651,9 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
|
||||
/* Now our own checks */
|
||||
|
||||
/* 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,
|
||||
MM_QMI_PORT_FLAG_DEFAULT))
|
||||
MM_PORT_QMI_FLAG_DEFAULT))
|
||||
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 */
|
||||
@@ -8116,7 +8116,7 @@ oma_check_support (MMIfaceModemOma *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
MMQmiPort *port;
|
||||
MMPortQmi *port;
|
||||
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
@@ -8125,7 +8125,7 @@ oma_check_support (MMIfaceModemOma *self,
|
||||
|
||||
port = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
|
||||
/* 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");
|
||||
g_simple_async_result_set_op_res_gboolean (result, FALSE);
|
||||
} else {
|
||||
@@ -9398,7 +9398,7 @@ signal_check_support (MMIfaceModemSignal *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSimpleAsyncResult *result;
|
||||
MMQmiPort *port;
|
||||
MMPortQmi *port;
|
||||
gboolean supported = FALSE;
|
||||
|
||||
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 (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 ");
|
||||
g_simple_async_result_set_op_res_gboolean (result, supported);
|
||||
@@ -9911,7 +9911,7 @@ enabling_started (MMBroadbandModem *self,
|
||||
typedef struct {
|
||||
MMBroadbandModem *self;
|
||||
GSimpleAsyncResult *result;
|
||||
MMQmiPort *qmi;
|
||||
MMPortQmi *qmi;
|
||||
QmiService services[32];
|
||||
guint service_index;
|
||||
} InitializationStartedContext;
|
||||
@@ -9974,13 +9974,13 @@ parent_initialization_started (InitializationStartedContext *ctx)
|
||||
static void allocate_next_client (InitializationStartedContext *ctx);
|
||||
|
||||
static void
|
||||
qmi_port_allocate_client_ready (MMQmiPort *qmi,
|
||||
qmi_port_allocate_client_ready (MMPortQmi *qmi,
|
||||
GAsyncResult *res,
|
||||
InitializationStartedContext *ctx)
|
||||
{
|
||||
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",
|
||||
qmi_service_get_string (ctx->services[ctx->service_index]),
|
||||
error->message);
|
||||
@@ -10001,9 +10001,9 @@ allocate_next_client (InitializationStartedContext *ctx)
|
||||
}
|
||||
|
||||
/* Otherwise, allocate next client */
|
||||
mm_qmi_port_allocate_client (ctx->qmi,
|
||||
mm_port_qmi_allocate_client (ctx->qmi,
|
||||
ctx->services[ctx->service_index],
|
||||
MM_QMI_PORT_FLAG_DEFAULT,
|
||||
MM_PORT_QMI_FLAG_DEFAULT,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)qmi_port_allocate_client_ready,
|
||||
ctx);
|
||||
@@ -10011,13 +10011,13 @@ allocate_next_client (InitializationStartedContext *ctx)
|
||||
|
||||
|
||||
static void
|
||||
qmi_port_open_ready_no_data_format (MMQmiPort *qmi,
|
||||
qmi_port_open_ready_no_data_format (MMPortQmi *qmi,
|
||||
GAsyncResult *res,
|
||||
InitializationStartedContext *ctx)
|
||||
{
|
||||
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);
|
||||
initialization_started_context_complete_and_free (ctx);
|
||||
return;
|
||||
@@ -10027,19 +10027,19 @@ qmi_port_open_ready_no_data_format (MMQmiPort *qmi,
|
||||
}
|
||||
|
||||
static void
|
||||
qmi_port_open_ready (MMQmiPort *qmi,
|
||||
qmi_port_open_ready (MMPortQmi *qmi,
|
||||
GAsyncResult *res,
|
||||
InitializationStartedContext *ctx)
|
||||
{
|
||||
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
|
||||
* support SetDataFormat, so if we get an error opening the port
|
||||
* 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.
|
||||
*/
|
||||
mm_qmi_port_open (ctx->qmi,
|
||||
mm_port_qmi_open (ctx->qmi,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)qmi_port_open_ready_no_data_format,
|
||||
@@ -10075,7 +10075,7 @@ initialization_started (MMBroadbandModem *self,
|
||||
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 */
|
||||
parent_initialization_started (ctx);
|
||||
return;
|
||||
@@ -10090,7 +10090,7 @@ initialization_started (MMBroadbandModem *self,
|
||||
ctx->services[5] = QMI_SERVICE_UNKNOWN;
|
||||
|
||||
/* Now open our QMI port */
|
||||
mm_qmi_port_open (ctx->qmi,
|
||||
mm_port_qmi_open (ctx->qmi,
|
||||
TRUE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)qmi_port_open_ready,
|
||||
@@ -10127,14 +10127,14 @@ mm_broadband_modem_qmi_init (MMBroadbandModemQmi *self)
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
MMQmiPort *qmi;
|
||||
MMPortQmi *qmi;
|
||||
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (object);
|
||||
|
||||
qmi = mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self));
|
||||
/* If we did open the QMI port during initialization, close it now */
|
||||
if (qmi &&
|
||||
mm_qmi_port_is_open (qmi)) {
|
||||
mm_qmi_port_close (qmi);
|
||||
mm_port_qmi_is_open (qmi)) {
|
||||
mm_port_qmi_close (qmi);
|
||||
}
|
||||
|
||||
g_free (self->priv->imei);
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include "mm-daemon-enums-types.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
#include "mm-qmi-port.h"
|
||||
#include "mm-port-qmi.h"
|
||||
#endif
|
||||
|
||||
#if defined WITH_MBIM
|
||||
@@ -109,7 +109,7 @@ typedef struct {
|
||||
|
||||
#if defined WITH_QMI
|
||||
/* ---- QMI probing specific context ---- */
|
||||
MMQmiPort *qmi_port;
|
||||
MMPortQmi *port_qmi;
|
||||
#endif
|
||||
|
||||
#if defined WITH_MBIM
|
||||
@@ -338,10 +338,10 @@ port_probe_run_task_free (PortProbeRunTask *task)
|
||||
}
|
||||
|
||||
#if defined WITH_QMI
|
||||
if (task->qmi_port) {
|
||||
if (mm_qmi_port_is_open (task->qmi_port))
|
||||
mm_qmi_port_close (task->qmi_port);
|
||||
g_object_unref (task->qmi_port);
|
||||
if (task->port_qmi) {
|
||||
if (mm_port_qmi_is_open (task->port_qmi))
|
||||
mm_port_qmi_close (task->port_qmi);
|
||||
g_object_unref (task->port_qmi);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -416,7 +416,7 @@ static gboolean wdm_probe (MMPortProbe *self);
|
||||
#if defined WITH_QMI
|
||||
|
||||
static void
|
||||
qmi_port_open_ready (MMQmiPort *qmi_port,
|
||||
port_qmi_open_ready (MMPortQmi *port_qmi,
|
||||
GAsyncResult *res,
|
||||
MMPortProbe *self)
|
||||
{
|
||||
@@ -424,7 +424,7 @@ qmi_port_open_ready (MMQmiPort *qmi_port,
|
||||
GError *error = NULL;
|
||||
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) {
|
||||
mm_dbg ("(%s/%s) error checking QMI support: '%s'",
|
||||
g_udev_device_get_subsystem (self->priv->port),
|
||||
@@ -436,7 +436,7 @@ qmi_port_open_ready (MMQmiPort *qmi_port,
|
||||
/* Set probing result */
|
||||
mm_port_probe_set_result_qmi (self, is_qmi);
|
||||
|
||||
mm_qmi_port_close (qmi_port);
|
||||
mm_port_qmi_close (port_qmi);
|
||||
|
||||
/* Keep on */
|
||||
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));
|
||||
|
||||
/* Create a port and try to open it */
|
||||
task->qmi_port = mm_qmi_port_new (g_udev_device_get_name (self->priv->port));
|
||||
mm_qmi_port_open (task->qmi_port,
|
||||
task->port_qmi = mm_port_qmi_new (g_udev_device_get_name (self->priv->port));
|
||||
mm_port_qmi_open (task->port_qmi,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)qmi_port_open_ready,
|
||||
(GAsyncReadyCallback)port_qmi_open_ready,
|
||||
self);
|
||||
#else
|
||||
/* If not compiled with QMI support, just assume we won't have any QMI port */
|
||||
|
@@ -21,18 +21,18 @@
|
||||
#include <ModemManager.h>
|
||||
#include <mm-errors-types.h>
|
||||
|
||||
#include "mm-qmi-port.h"
|
||||
#include "mm-port-qmi.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 {
|
||||
QmiService service;
|
||||
QmiClient *client;
|
||||
MMQmiPortFlag flag;
|
||||
MMPortQmiFlag flag;
|
||||
} ServiceInfo;
|
||||
|
||||
struct _MMQmiPortPrivate {
|
||||
struct _MMPortQmiPrivate {
|
||||
gboolean opening;
|
||||
QmiDevice *qmi_device;
|
||||
GList *services;
|
||||
@@ -41,9 +41,9 @@ struct _MMQmiPortPrivate {
|
||||
/*****************************************************************************/
|
||||
|
||||
QmiClient *
|
||||
mm_qmi_port_peek_client (MMQmiPort *self,
|
||||
mm_port_qmi_peek_client (MMPortQmi *self,
|
||||
QmiService service,
|
||||
MMQmiPortFlag flag)
|
||||
MMPortQmiFlag flag)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
@@ -59,20 +59,20 @@ mm_qmi_port_peek_client (MMQmiPort *self,
|
||||
}
|
||||
|
||||
QmiClient *
|
||||
mm_qmi_port_get_client (MMQmiPort *self,
|
||||
mm_port_qmi_get_client (MMPortQmi *self,
|
||||
QmiService service,
|
||||
MMQmiPortFlag flag)
|
||||
MMPortQmiFlag flag)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
MMQmiPort *self;
|
||||
MMPortQmi *self;
|
||||
GSimpleAsyncResult *result;
|
||||
ServiceInfo *info;
|
||||
} AllocateClientContext;
|
||||
@@ -91,7 +91,7 @@ allocate_client_context_complete_and_free (AllocateClientContext *ctx)
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_qmi_port_allocate_client_finish (MMQmiPort *self,
|
||||
mm_port_qmi_allocate_client_finish (MMPortQmi *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -122,16 +122,16 @@ allocate_client_ready (QmiDevice *qmi_device,
|
||||
}
|
||||
|
||||
void
|
||||
mm_qmi_port_allocate_client (MMQmiPort *self,
|
||||
mm_port_qmi_allocate_client (MMPortQmi *self,
|
||||
QmiService service,
|
||||
MMQmiPortFlag flag,
|
||||
MMPortQmiFlag flag,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
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),
|
||||
callback,
|
||||
user_data,
|
||||
@@ -147,7 +147,7 @@ mm_qmi_port_allocate_client (MMQmiPort *self,
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
mm_qmi_port_allocate_client);
|
||||
mm_port_qmi_allocate_client);
|
||||
ctx->info = g_new0 (ServiceInfo, 1);
|
||||
ctx->info->service = service;
|
||||
ctx->info->flag = flag;
|
||||
@@ -164,7 +164,7 @@ mm_qmi_port_allocate_client (MMQmiPort *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
MMQmiPort *self;
|
||||
MMPortQmi *self;
|
||||
gboolean set_data_format;
|
||||
GSimpleAsyncResult *result;
|
||||
GCancellable *cancellable;
|
||||
@@ -182,7 +182,7 @@ port_open_context_complete_and_free (PortOpenContext *ctx)
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_qmi_port_open_finish (MMQmiPort *self,
|
||||
mm_port_qmi_open_finish (MMPortQmi *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -242,7 +242,7 @@ qmi_device_new_ready (GObject *unused,
|
||||
}
|
||||
|
||||
void
|
||||
mm_qmi_port_open (MMQmiPort *self,
|
||||
mm_port_qmi_open (MMPortQmi *self,
|
||||
gboolean set_data_format,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -252,7 +252,7 @@ mm_qmi_port_open (MMQmiPort *self,
|
||||
gchar *fullpath;
|
||||
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->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),
|
||||
callback,
|
||||
user_data,
|
||||
mm_qmi_port_open);
|
||||
mm_port_qmi_open);
|
||||
ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||
|
||||
if (self->priv->opening) {
|
||||
@@ -293,20 +293,20 @@ mm_qmi_port_open (MMQmiPort *self,
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void
|
||||
mm_qmi_port_close (MMQmiPort *self)
|
||||
mm_port_qmi_close (MMPortQmi *self)
|
||||
{
|
||||
GList *l;
|
||||
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)
|
||||
return;
|
||||
@@ -337,10 +337,10 @@ mm_qmi_port_close (MMQmiPort *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMQmiPort *
|
||||
mm_qmi_port_new (const gchar *name)
|
||||
MMPortQmi *
|
||||
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_SUBSYS, MM_PORT_SUBSYS_USB,
|
||||
MM_PORT_TYPE, MM_PORT_TYPE_QMI,
|
||||
@@ -348,15 +348,15 @@ mm_qmi_port_new (const gchar *name)
|
||||
}
|
||||
|
||||
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
|
||||
dispose (GObject *object)
|
||||
{
|
||||
MMQmiPort *self = MM_QMI_PORT (object);
|
||||
MMPortQmi *self = MM_PORT_QMI (object);
|
||||
GList *l;
|
||||
|
||||
/* Deallocate all clients */
|
||||
@@ -372,15 +372,15 @@ dispose (GObject *object)
|
||||
/* Clear device object */
|
||||
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
|
||||
mm_qmi_port_class_init (MMQmiPortClass *klass)
|
||||
mm_port_qmi_class_init (MMPortQmiClass *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 */
|
||||
object_class->dispose = dispose;
|
@@ -13,8 +13,8 @@
|
||||
* Copyright (C) 2012 Google, Inc.
|
||||
*/
|
||||
|
||||
#ifndef MM_QMI_PORT_H
|
||||
#define MM_QMI_PORT_H
|
||||
#ifndef MM_PORT_QMI_H
|
||||
#define MM_PORT_QMI_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
@@ -24,62 +24,62 @@
|
||||
|
||||
#include "mm-port.h"
|
||||
|
||||
#define MM_TYPE_QMI_PORT (mm_qmi_port_get_type ())
|
||||
#define MM_QMI_PORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_QMI_PORT, MMQmiPort))
|
||||
#define MM_QMI_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_QMI_PORT, MMQmiPortClass))
|
||||
#define MM_IS_QMI_PORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_QMI_PORT))
|
||||
#define MM_IS_QMI_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_QMI_PORT))
|
||||
#define MM_QMI_PORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_QMI_PORT, MMQmiPortClass))
|
||||
#define MM_TYPE_PORT_QMI (mm_port_qmi_get_type ())
|
||||
#define MM_PORT_QMI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PORT_QMI, MMPortQmi))
|
||||
#define MM_PORT_QMI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PORT_QMI, MMPortQmiClass))
|
||||
#define MM_IS_PORT_QMI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PORT_QMI))
|
||||
#define MM_IS_PORT_QMI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PORT_QMI))
|
||||
#define MM_PORT_QMI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PORT_QMI, MMPortQmiClass))
|
||||
|
||||
typedef struct _MMQmiPort MMQmiPort;
|
||||
typedef struct _MMQmiPortClass MMQmiPortClass;
|
||||
typedef struct _MMQmiPortPrivate MMQmiPortPrivate;
|
||||
typedef struct _MMPortQmi MMPortQmi;
|
||||
typedef struct _MMPortQmiClass MMPortQmiClass;
|
||||
typedef struct _MMPortQmiPrivate MMPortQmiPrivate;
|
||||
|
||||
struct _MMQmiPort {
|
||||
struct _MMPortQmi {
|
||||
MMPort parent;
|
||||
MMQmiPortPrivate *priv;
|
||||
MMPortQmiPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MMQmiPortClass {
|
||||
struct _MMPortQmiClass {
|
||||
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,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_qmi_port_open_finish (MMQmiPort *self,
|
||||
gboolean mm_port_qmi_open_finish (MMPortQmi *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
gboolean mm_qmi_port_is_open (MMQmiPort *self);
|
||||
void mm_qmi_port_close (MMQmiPort *self);
|
||||
gboolean mm_port_qmi_is_open (MMPortQmi *self);
|
||||
void mm_port_qmi_close (MMPortQmi *self);
|
||||
|
||||
typedef enum {
|
||||
MM_QMI_PORT_FLAG_DEFAULT = 0,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV4 = 100,
|
||||
MM_QMI_PORT_FLAG_WDS_IPV6 = 101
|
||||
} MMQmiPortFlag;
|
||||
MM_PORT_QMI_FLAG_DEFAULT = 0,
|
||||
MM_PORT_QMI_FLAG_WDS_IPV4 = 100,
|
||||
MM_PORT_QMI_FLAG_WDS_IPV6 = 101
|
||||
} MMPortQmiFlag;
|
||||
|
||||
void mm_qmi_port_allocate_client (MMQmiPort *self,
|
||||
void mm_port_qmi_allocate_client (MMPortQmi *self,
|
||||
QmiService service,
|
||||
MMQmiPortFlag flag,
|
||||
MMPortQmiFlag flag,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_qmi_port_allocate_client_finish (MMQmiPort *self,
|
||||
gboolean mm_port_qmi_allocate_client_finish (MMPortQmi *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
QmiClient *mm_qmi_port_peek_client (MMQmiPort *self,
|
||||
QmiClient *mm_port_qmi_peek_client (MMPortQmi *self,
|
||||
QmiService service,
|
||||
MMQmiPortFlag flag);
|
||||
QmiClient *mm_qmi_port_get_client (MMQmiPort *self,
|
||||
MMPortQmiFlag flag);
|
||||
QmiClient *mm_port_qmi_get_client (MMPortQmi *self,
|
||||
QmiService service,
|
||||
MMQmiPortFlag flag);
|
||||
MMPortQmiFlag flag);
|
||||
|
||||
#endif /* MM_QMI_PORT_H */
|
||||
#endif /* MM_PORT_QMI_H */
|
@@ -40,7 +40,7 @@ ensure_qmi_client (MMSimQmi *self,
|
||||
{
|
||||
MMBaseModem *modem = NULL;
|
||||
QmiClient *client;
|
||||
MMQmiPort *port;
|
||||
MMPortQmi *port;
|
||||
|
||||
g_object_get (self,
|
||||
MM_SIM_MODEM, &modem,
|
||||
@@ -60,9 +60,9 @@ ensure_qmi_client (MMSimQmi *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
client = mm_qmi_port_peek_client (port,
|
||||
client = mm_port_qmi_peek_client (port,
|
||||
service,
|
||||
MM_QMI_PORT_FLAG_DEFAULT);
|
||||
MM_PORT_QMI_FLAG_DEFAULT);
|
||||
if (!client) {
|
||||
g_simple_async_report_error_in_idle (G_OBJECT (self),
|
||||
callback,
|
||||
|
@@ -46,7 +46,7 @@ ensure_qmi_client (MMSmsQmi *self,
|
||||
{
|
||||
MMBaseModem *modem = NULL;
|
||||
QmiClient *client;
|
||||
MMQmiPort *port;
|
||||
MMPortQmi *port;
|
||||
|
||||
g_object_get (self,
|
||||
MM_SMS_MODEM, &modem,
|
||||
@@ -66,9 +66,9 @@ ensure_qmi_client (MMSmsQmi *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
client = mm_qmi_port_peek_client (port,
|
||||
client = mm_port_qmi_peek_client (port,
|
||||
service,
|
||||
MM_QMI_PORT_FLAG_DEFAULT);
|
||||
MM_PORT_QMI_FLAG_DEFAULT);
|
||||
if (!client) {
|
||||
g_simple_async_report_error_in_idle (G_OBJECT (self),
|
||||
callback,
|
||||
|
Reference in New Issue
Block a user