build: move plugins directory to src/plugins
We are going to allow including the plugin sources built within the ModemManager daemon binary; moving the sources within the daemon sources directory makes it easier.
This commit is contained in:
committed by
Aleksander Morgado
parent
072d7ac906
commit
e14b904cbd
@@ -0,0 +1,38 @@
|
||||
# do not edit this file, it will be overwritten on update
|
||||
|
||||
ACTION!="add|change|move|bind", GOTO="mm_nokia_port_types_end"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0421", GOTO="mm_nokia_port_types"
|
||||
GOTO="mm_nokia_port_types_end"
|
||||
|
||||
LABEL="mm_nokia_port_types"
|
||||
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
|
||||
|
||||
# For Nokia Internet Sticks (CS-xx) the modem/PPP port appears to always be USB interface 1
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="060D", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0611", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="061A", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="061B", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="061F", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0619", ENV{.MM_USBIFNUM}=="03", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0620", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0623", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0624", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0625", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="062A", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="062E", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="062F", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
|
||||
LABEL="mm_nokia_port_types_end"
|
||||
@@ -0,0 +1,399 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 - 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011 Google Inc.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ModemManager.h"
|
||||
#include "mm-serial-parsers.h"
|
||||
#include "mm-errors-types.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-messaging.h"
|
||||
#include "mm-iface-modem-3gpp.h"
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-base-modem-at.h"
|
||||
#include "mm-broadband-modem-nokia.h"
|
||||
#include "mm-sim-nokia.h"
|
||||
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
static void iface_modem_messaging_init (MMIfaceModemMessaging *iface);
|
||||
|
||||
static MMIfaceModem *iface_modem_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemNokia, mm_broadband_modem_nokia, MM_TYPE_BROADBAND_MODEM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init));
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Create SIM (Modem interface) */
|
||||
|
||||
static MMBaseSim *
|
||||
create_sim_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return mm_sim_nokia_new_finish (res, error);
|
||||
}
|
||||
|
||||
static void
|
||||
create_sim (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* New Nokia SIM */
|
||||
mm_sim_nokia_new (MM_BASE_MODEM (self),
|
||||
NULL, /* cancellable */
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Load access technologies (Modem interface) */
|
||||
|
||||
typedef struct {
|
||||
MMModemAccessTechnology act;
|
||||
guint mask;
|
||||
} AccessTechInfo;
|
||||
|
||||
static gboolean
|
||||
load_access_technologies_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemAccessTechnology *access_technologies,
|
||||
guint *mask,
|
||||
GError **error)
|
||||
{
|
||||
GError *inner_error = NULL;
|
||||
gssize value;
|
||||
|
||||
value = g_task_propagate_int (G_TASK (res), &inner_error);
|
||||
if (inner_error) {
|
||||
g_propagate_error (error, inner_error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*access_technologies = (MMModemAccessTechnology)value;
|
||||
*mask = MM_IFACE_MODEM_3GPP_ALL_ACCESS_TECHNOLOGIES_MASK;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
parent_load_access_technologies_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMModemAccessTechnology act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
|
||||
guint mask = 0;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!iface_modem_parent->load_access_technologies_finish (self, res, &act, &mask, &error))
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_task_return_int (task, act);
|
||||
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
access_tech_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMModemAccessTechnology act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
|
||||
const gchar *response, *p;
|
||||
|
||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, NULL);
|
||||
if (!response) {
|
||||
/* Chain up to parent */
|
||||
iface_modem_parent->load_access_technologies (
|
||||
MM_IFACE_MODEM (self),
|
||||
(GAsyncReadyCallback)parent_load_access_technologies_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
|
||||
p = mm_strip_tag (response, "*CNTI:");
|
||||
p = strchr (p, ',');
|
||||
if (p)
|
||||
act = mm_string_to_access_tech (p + 1);
|
||||
|
||||
if (act == MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN)
|
||||
g_task_return_new_error (
|
||||
task,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Couldn't parse access technologies result: '%s'",
|
||||
response);
|
||||
else
|
||||
g_task_return_int (task, act);
|
||||
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
load_access_technologies (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"*CNTI=0",
|
||||
3,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback)access_tech_ready,
|
||||
g_task_new (self, NULL, callback, user_data));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Loading supported charsets (Modem interface) */
|
||||
|
||||
static MMModemCharset
|
||||
load_supported_charsets_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
const gchar *response;
|
||||
MMModemCharset charsets = MM_MODEM_CHARSET_UNKNOWN;
|
||||
|
||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
|
||||
if (!response)
|
||||
return MM_MODEM_CHARSET_UNKNOWN;
|
||||
|
||||
if (!mm_3gpp_parse_cscs_test_response (response, &charsets)) {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Failed to parse the supported character sets response");
|
||||
return MM_MODEM_CHARSET_UNKNOWN;
|
||||
}
|
||||
|
||||
return charsets;
|
||||
}
|
||||
|
||||
static void
|
||||
load_supported_charsets (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+CSCS=?",
|
||||
20,
|
||||
TRUE,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Initializing the modem (during first enabling) */
|
||||
|
||||
typedef struct {
|
||||
guint retries;
|
||||
} EnablingModemInitContext;
|
||||
|
||||
static gboolean
|
||||
enabling_modem_init_finish (MMBroadbandModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
|
||||
{
|
||||
return g_task_propagate_boolean (G_TASK (res), error);
|
||||
}
|
||||
|
||||
static void retry_atz (GTask *task);
|
||||
|
||||
static void
|
||||
atz_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
EnablingModemInitContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
/* One retry less */
|
||||
ctx->retries--;
|
||||
|
||||
if (!mm_base_modem_at_command_full_finish (self, res, &error)) {
|
||||
/* Consumed all retries... */
|
||||
if (ctx->retries == 0) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Retry... */
|
||||
g_error_free (error);
|
||||
retry_atz (task);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Good! */
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
retry_atz (GTask *task)
|
||||
{
|
||||
MMBaseModem *self;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
|
||||
mm_base_modem_at_command_full (self,
|
||||
mm_base_modem_peek_port_primary (self),
|
||||
"Z",
|
||||
6,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)atz_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
static void
|
||||
enabling_modem_init (MMBroadbandModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
EnablingModemInitContext *ctx;
|
||||
GTask *task;
|
||||
|
||||
ctx = g_new (EnablingModemInitContext, 1);
|
||||
|
||||
/* Send the init command twice; some devices (Nokia N900) appear to take a
|
||||
* few commands before responding correctly. Instead of penalizing them for
|
||||
* being stupid the first time by failing to enable the device, just
|
||||
* try again. */
|
||||
ctx->retries = 2;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
g_task_set_task_data (task, ctx, g_free);
|
||||
|
||||
retry_atz (task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Setup ports (Broadband modem class) */
|
||||
|
||||
static const gchar *primary_init_sequence[] = {
|
||||
/* When initializing a Nokia port, first enable the echo,
|
||||
* and then disable it, so that we get it properly disabled. */
|
||||
"E1 E0",
|
||||
/* The N900 ignores the E0 when it's on the same line as the E1, so try again */
|
||||
"E0",
|
||||
/* Get word responses */
|
||||
"V1",
|
||||
/* Extended numeric codes */
|
||||
"+CMEE=1",
|
||||
/* Report all call status */
|
||||
"X4",
|
||||
/* Assert DCD when carrier detected */
|
||||
"&C1",
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
setup_ports (MMBroadbandModem *self)
|
||||
{
|
||||
MMPortSerialAt *primary;
|
||||
|
||||
/* Call parent's setup ports first always */
|
||||
MM_BROADBAND_MODEM_CLASS (mm_broadband_modem_nokia_parent_class)->setup_ports (self);
|
||||
|
||||
primary = mm_base_modem_peek_port_primary (MM_BASE_MODEM (self));
|
||||
|
||||
g_object_set (primary,
|
||||
MM_PORT_SERIAL_AT_INIT_SEQUENCE, primary_init_sequence,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMBroadbandModemNokia *
|
||||
mm_broadband_modem_nokia_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id)
|
||||
{
|
||||
return g_object_new (MM_TYPE_BROADBAND_MODEM_NOKIA,
|
||||
MM_BASE_MODEM_DEVICE, device,
|
||||
MM_BASE_MODEM_DRIVERS, drivers,
|
||||
MM_BASE_MODEM_PLUGIN, plugin,
|
||||
MM_BASE_MODEM_VENDOR_ID, vendor_id,
|
||||
MM_BASE_MODEM_PRODUCT_ID, product_id,
|
||||
/* Generic bearer supports TTY only */
|
||||
MM_BASE_MODEM_DATA_NET_SUPPORTED, FALSE,
|
||||
MM_BASE_MODEM_DATA_TTY_SUPPORTED, TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_nokia_init (MMBroadbandModemNokia *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_messaging_init (MMIfaceModemMessaging *iface)
|
||||
{
|
||||
/* Don't even try to check messaging support */
|
||||
iface->check_support = NULL;
|
||||
iface->check_support_finish = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_init (MMIfaceModem *iface)
|
||||
{
|
||||
iface_modem_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
/* Create Nokia-specific SIM*/
|
||||
iface->create_sim = create_sim;
|
||||
iface->create_sim_finish = create_sim_finish;
|
||||
|
||||
/* Nokia handsets (at least N85) do not support "power on"; they do
|
||||
* support "power off" but you proabably do not want to turn off the
|
||||
* power on your telephone if something went wrong with connecting
|
||||
* process. So, disabling both these operations. The Nokia GSM/UMTS command
|
||||
* reference v1.2 also states that only CFUN=0 (turn off but still charge)
|
||||
* and CFUN=1 (full functionality) are supported, and since the phone has
|
||||
* to be in CFUN=1 before we'll be able to talk to it in the first place,
|
||||
* we shouldn't bother with CFUN at all.
|
||||
*/
|
||||
iface->load_power_state = NULL;
|
||||
iface->load_power_state_finish = NULL;
|
||||
iface->modem_power_up = NULL;
|
||||
iface->modem_power_up_finish = NULL;
|
||||
iface->modem_power_down = NULL;
|
||||
iface->modem_power_down_finish = NULL;
|
||||
iface->load_supported_charsets = load_supported_charsets;
|
||||
iface->load_supported_charsets_finish = load_supported_charsets_finish;
|
||||
|
||||
iface->load_access_technologies = load_access_technologies;
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_nokia_class_init (MMBroadbandModemNokiaClass *klass)
|
||||
{
|
||||
MMBroadbandModemClass *broadband_modem_class = MM_BROADBAND_MODEM_CLASS (klass);
|
||||
|
||||
broadband_modem_class->setup_ports = setup_ports;
|
||||
broadband_modem_class->enabling_modem_init = enabling_modem_init;
|
||||
broadband_modem_class->enabling_modem_init_finish = enabling_modem_init_finish;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 - 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011 Google Inc.
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_MODEM_NOKIA_H
|
||||
#define MM_BROADBAND_MODEM_NOKIA_H
|
||||
|
||||
#include "mm-broadband-modem.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_NOKIA (mm_broadband_modem_nokia_get_type ())
|
||||
#define MM_BROADBAND_MODEM_NOKIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_NOKIA, MMBroadbandModemNokia))
|
||||
#define MM_BROADBAND_MODEM_NOKIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_NOKIA, MMBroadbandModemNokiaClass))
|
||||
#define MM_IS_BROADBAND_MODEM_NOKIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_NOKIA))
|
||||
#define MM_IS_BROADBAND_MODEM_NOKIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_NOKIA))
|
||||
#define MM_BROADBAND_MODEM_NOKIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_NOKIA, MMBroadbandModemNokiaClass))
|
||||
|
||||
typedef struct _MMBroadbandModemNokia MMBroadbandModemNokia;
|
||||
typedef struct _MMBroadbandModemNokiaClass MMBroadbandModemNokiaClass;
|
||||
|
||||
struct _MMBroadbandModemNokia {
|
||||
MMBroadbandModem parent;
|
||||
};
|
||||
|
||||
struct _MMBroadbandModemNokiaClass{
|
||||
MMBroadbandModemClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_modem_nokia_get_type (void);
|
||||
|
||||
MMBroadbandModemNokia *mm_broadband_modem_nokia_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_NOKIA_H */
|
||||
@@ -0,0 +1,90 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2009 - 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-plugin-nokia-icera.h"
|
||||
#include "mm-broadband-modem-icera.h"
|
||||
|
||||
G_DEFINE_TYPE (MMPluginNokiaIcera, mm_plugin_nokia_icera, MM_TYPE_PLUGIN)
|
||||
|
||||
MM_PLUGIN_DEFINE_MAJOR_VERSION
|
||||
MM_PLUGIN_DEFINE_MINOR_VERSION
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Custom commands for AT probing */
|
||||
|
||||
static const MMPortProbeAtCommand custom_at_probe[] = {
|
||||
{ "ATE1 E0", 3, mm_port_probe_response_processor_is_at },
|
||||
{ "ATE1 E0", 3, mm_port_probe_response_processor_is_at },
|
||||
{ "ATE1 E0", 3, mm_port_probe_response_processor_is_at },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static MMBaseModem *
|
||||
create_modem (MMPlugin *self,
|
||||
const gchar *uid,
|
||||
const gchar **drivers,
|
||||
guint16 vendor,
|
||||
guint16 product,
|
||||
guint16 subsystem_vendor,
|
||||
GList *probes,
|
||||
GError **error)
|
||||
{
|
||||
return MM_BASE_MODEM (mm_broadband_modem_icera_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *
|
||||
mm_plugin_create (void)
|
||||
{
|
||||
static const gchar *subsystems[] = { "tty", "net", NULL };
|
||||
static const guint16 vendor_ids[] = { 0x0421, 0 };
|
||||
|
||||
return MM_PLUGIN (
|
||||
g_object_new (MM_TYPE_PLUGIN_NOKIA_ICERA,
|
||||
MM_PLUGIN_NAME, MM_MODULE_NAME,
|
||||
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
|
||||
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
|
||||
MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe,
|
||||
MM_PLUGIN_ALLOWED_AT, TRUE,
|
||||
MM_PLUGIN_ALLOWED_ICERA, TRUE, /* Only Nokia/Icera modems */
|
||||
NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_nokia_icera_init (MMPluginNokiaIcera *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_nokia_icera_class_init (MMPluginNokiaIceraClass *klass)
|
||||
{
|
||||
MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
|
||||
|
||||
plugin_class->create_modem = create_modem;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2009 - 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#ifndef MM_PLUGIN_NOKIA_ICERA_H
|
||||
#define MM_PLUGIN_NOKIA_ICERA_H
|
||||
|
||||
#include "mm-plugin.h"
|
||||
|
||||
#define MM_TYPE_PLUGIN_NOKIA_ICERA (mm_plugin_nokia_icera_get_type ())
|
||||
#define MM_PLUGIN_NOKIA_ICERA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_NOKIA_ICERA, MMPluginNokiaIcera))
|
||||
#define MM_PLUGIN_NOKIA_ICERA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_NOKIA_ICERA, MMPluginNokiaIceraClass))
|
||||
#define MM_IS_PLUGIN_NOKIA_ICERA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_NOKIA_ICERA))
|
||||
#define MM_IS_PLUGIN_NOKIA_ICERA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_NOKIA_ICERA))
|
||||
#define MM_PLUGIN_NOKIA_ICERA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_NOKIA_ICERA, MMPluginNokiaIceraClass))
|
||||
|
||||
typedef struct {
|
||||
MMPlugin parent;
|
||||
} MMPluginNokiaIcera;
|
||||
|
||||
typedef struct {
|
||||
MMPluginClass parent;
|
||||
} MMPluginNokiaIceraClass;
|
||||
|
||||
GType mm_plugin_nokia_icera_get_type (void);
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
|
||||
|
||||
#endif /* MM_PLUGIN_NOKIA_ICERA_H */
|
||||
@@ -0,0 +1,93 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 - 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011 - 2012 Google, Inc.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-plugin-nokia.h"
|
||||
#include "mm-broadband-modem-nokia.h"
|
||||
|
||||
G_DEFINE_TYPE (MMPluginNokia, mm_plugin_nokia, MM_TYPE_PLUGIN)
|
||||
|
||||
MM_PLUGIN_DEFINE_MAJOR_VERSION
|
||||
MM_PLUGIN_DEFINE_MINOR_VERSION
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Custom commands for AT probing */
|
||||
|
||||
static const MMPortProbeAtCommand custom_at_probe[] = {
|
||||
{ "ATE1 E0", 3, mm_port_probe_response_processor_is_at },
|
||||
{ "ATE1 E0", 3, mm_port_probe_response_processor_is_at },
|
||||
{ "ATE1 E0", 3, mm_port_probe_response_processor_is_at },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static MMBaseModem *
|
||||
create_modem (MMPlugin *self,
|
||||
const gchar *uid,
|
||||
const gchar **drivers,
|
||||
guint16 vendor,
|
||||
guint16 product,
|
||||
guint16 subsystem_vendor,
|
||||
GList *probes,
|
||||
GError **error)
|
||||
{
|
||||
return MM_BASE_MODEM (mm_broadband_modem_nokia_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *
|
||||
mm_plugin_create (void)
|
||||
{
|
||||
static const gchar *subsystems[] = { "tty", NULL };
|
||||
static const guint16 vendor_ids[] = { 0x0421, 0 };
|
||||
static const gchar *vendor_strings[] = { "nokia", NULL };
|
||||
|
||||
return MM_PLUGIN (
|
||||
g_object_new (MM_TYPE_PLUGIN_NOKIA,
|
||||
MM_PLUGIN_NAME, MM_MODULE_NAME,
|
||||
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
|
||||
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
|
||||
MM_PLUGIN_ALLOWED_VENDOR_STRINGS, vendor_strings,
|
||||
MM_PLUGIN_CUSTOM_AT_PROBE, custom_at_probe,
|
||||
MM_PLUGIN_ALLOWED_SINGLE_AT, TRUE, /* only 1 AT port expected! */
|
||||
MM_PLUGIN_FORBIDDEN_ICERA, TRUE, /* No Nokia/Icera modems */
|
||||
NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_nokia_init (MMPluginNokia *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_nokia_class_init (MMPluginNokiaClass *klass)
|
||||
{
|
||||
MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
|
||||
|
||||
plugin_class->create_modem = create_modem;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef MM_PLUGIN_NOKIA_H
|
||||
#define MM_PLUGIN_NOKIA_H
|
||||
|
||||
#include "mm-plugin.h"
|
||||
|
||||
#define MM_TYPE_PLUGIN_NOKIA (mm_plugin_nokia_get_type ())
|
||||
#define MM_PLUGIN_NOKIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_NOKIA, MMPluginNokia))
|
||||
#define MM_PLUGIN_NOKIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_NOKIA, MMPluginNokiaClass))
|
||||
#define MM_IS_PLUGIN_NOKIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_NOKIA))
|
||||
#define MM_IS_PLUGIN_NOKIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_NOKIA))
|
||||
#define MM_PLUGIN_NOKIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_NOKIA, MMPluginNokiaClass))
|
||||
|
||||
typedef struct {
|
||||
MMPlugin parent;
|
||||
} MMPluginNokia;
|
||||
|
||||
typedef struct {
|
||||
MMPluginClass parent;
|
||||
} MMPluginNokiaClass;
|
||||
|
||||
GType mm_plugin_nokia_get_type (void);
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
|
||||
|
||||
#endif /* MM_PLUGIN_NOKIA_H */
|
||||
@@ -0,0 +1,86 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ModemManager.h>
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-sim-nokia.h"
|
||||
|
||||
G_DEFINE_TYPE (MMSimNokia, mm_sim_nokia, MM_TYPE_BASE_SIM)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMBaseSim *
|
||||
mm_sim_nokia_new_finish (GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
GObject *source;
|
||||
GObject *sim;
|
||||
|
||||
source = g_async_result_get_source_object (res);
|
||||
sim = g_async_initable_new_finish (G_ASYNC_INITABLE (source), res, error);
|
||||
g_object_unref (source);
|
||||
|
||||
if (!sim)
|
||||
return NULL;
|
||||
|
||||
/* Only export valid SIMs */
|
||||
mm_base_sim_export (MM_BASE_SIM (sim));
|
||||
|
||||
return MM_BASE_SIM (sim);
|
||||
}
|
||||
|
||||
void
|
||||
mm_sim_nokia_new (MMBaseModem *modem,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_async_initable_new_async (MM_TYPE_SIM_NOKIA,
|
||||
G_PRIORITY_DEFAULT,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_sim_nokia_init (MMSimNokia *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_sim_nokia_class_init (MMSimNokiaClass *klass)
|
||||
{
|
||||
MMBaseSimClass *base_sim_class = MM_BASE_SIM_CLASS (klass);
|
||||
|
||||
/* Skip querying most SIM card info, +CRSM not supported by Nokia modems */
|
||||
base_sim_class->load_sim_identifier = NULL;
|
||||
base_sim_class->load_sim_identifier_finish = NULL;
|
||||
base_sim_class->load_operator_identifier = NULL;
|
||||
base_sim_class->load_operator_identifier_finish = NULL;
|
||||
base_sim_class->load_operator_name = NULL;
|
||||
base_sim_class->load_operator_name_finish = NULL;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#ifndef MM_SIM_NOKIA_H
|
||||
#define MM_SIM_NOKIA_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "mm-base-sim.h"
|
||||
|
||||
#define MM_TYPE_SIM_NOKIA (mm_sim_nokia_get_type ())
|
||||
#define MM_SIM_NOKIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SIM_NOKIA, MMSimNokia))
|
||||
#define MM_SIM_NOKIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_SIM_NOKIA, MMSimNokiaClass))
|
||||
#define MM_IS_SIM_NOKIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SIM_NOKIA))
|
||||
#define MM_IS_SIM_NOKIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_SIM_NOKIA))
|
||||
#define MM_SIM_NOKIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_SIM_NOKIA, MMSimNokiaClass))
|
||||
|
||||
typedef struct _MMSimNokia MMSimNokia;
|
||||
typedef struct _MMSimNokiaClass MMSimNokiaClass;
|
||||
|
||||
struct _MMSimNokia {
|
||||
MMBaseSim parent;
|
||||
};
|
||||
|
||||
struct _MMSimNokiaClass {
|
||||
MMBaseSimClass parent;
|
||||
};
|
||||
|
||||
GType mm_sim_nokia_get_type (void);
|
||||
|
||||
void mm_sim_nokia_new (MMBaseModem *modem,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
MMBaseSim *mm_sim_nokia_new_finish (GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_SIM_NOKIA_H */
|
||||
Reference in New Issue
Block a user