static void
modem_object_added (MMManager *modem_manager,
                    MMObject  *modem_object,
                    NmaBtDevice *self)
{
	NmaBtDevicePrivate *priv = NMA_BT_DEVICE_GET_PRIVATE (self);
	NMDeviceType devtype = NM_DEVICE_TYPE_UNKNOWN;
	MMModem *modem_iface;
	const gchar *path;
	const gchar *primary_port;
	const gchar *iface_basename;
	MMModemCapability caps;

	path = mm_object_get_path (modem_object);
	g_message ("%s: (%s) modem found", __func__, path);

	/* Ensure we have the 'Modem' interface at least */
	modem_iface = mm_object_peek_modem (modem_object);
	g_return_if_fail (modem_iface != NULL);

	/* Get modem's primary port */
	primary_port = mm_modem_get_primary_port (modem_iface);
	g_return_if_fail (primary_port != NULL);

	/* Get rfcomm iface name */
	iface_basename = g_path_get_basename (priv->rfcomm_iface);

	/* If not matched, just return */
	if (!g_str_equal (primary_port, iface_basename)) {
		g_message ("%s: (%s) (%s) not the modem we're looking for (%s)",
		           __func__, path, primary_port, iface_basename);
		return;
	}

	/* This is the modem we were waiting for, so keep on */
	caps = mm_modem_get_current_capabilities (modem_iface);
	/* CDMA-only? */
	if (caps == MM_MODEM_CAPABILITY_CDMA_EVDO)
		devtype = NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO;
	/* GSM/UMTS-only? */
	else if (caps == MM_MODEM_CAPABILITY_GSM_UMTS)
		devtype = NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS;
	/* LTE? */
	else if (caps & MM_MODEM_CAPABILITY_LTE)
		devtype = NM_DEVICE_MODEM_CAPABILITY_LTE;
	else
		g_message ("%s: (%s) unknown modem type", __func__, path);

	/* Launch wizard! */
	start_wizard (self, path, devtype);
}
Exemplo n.º 2
0
static void
ensure_modem_location (void)
{
    if (mm_modem_get_state (mm_object_peek_modem (ctx->object)) < MM_MODEM_STATE_ENABLED) {
        g_printerr ("error: modem not enabled yet\n");
        exit (EXIT_FAILURE);
    }

    if (!ctx->modem_location) {
        g_printerr ("error: modem has no location capabilities\n");
        exit (EXIT_FAILURE);
    }

    /* Success */
}