static void
setup_flow_control (MMIfaceModem *self,
                    GAsyncReadyCallback callback,
                    gpointer user_data)
{
    GSimpleAsyncResult *result;
    gchar *cmd;
    guint flow_control = 1; /* Default flow control: XON/XOFF */

    switch (mm_base_modem_get_product_id (MM_BASE_MODEM (self)) & 0xFFFF) {
    case 0x0021:
        flow_control = 2; /* Telit IMC modems support only RTS/CTS mode */
        break;
    default:
        break;
    }

    cmd = g_strdup_printf ("+IFC=%u,%u", flow_control, flow_control);
    mm_base_modem_at_command (MM_BASE_MODEM (self),
                              cmd,
                              3,
                              FALSE,
                              NULL,
                              NULL);
    result = g_simple_async_result_new (G_OBJECT (self),
                                        callback,
                                        user_data,
                                        setup_flow_control);
    g_simple_async_result_set_op_res_gboolean (result, TRUE);
    g_simple_async_result_complete_in_idle (result);
    g_object_unref (result);
    g_free (cmd);
}
Пример #2
0
static void
debug_modem_info (MMManager *self,
                  MMBaseModem *modem,
                  const gchar *path)
{
    GUdevDevice *physdev;
    const gchar *subsys;

    physdev = g_udev_client_query_by_sysfs_path (self->priv->udev,
                                                 mm_base_modem_get_device (modem));
    subsys = (physdev ?
              g_udev_device_get_subsystem (physdev) :
              NULL);

    mm_dbg ("(%s): '%s' modem, VID 0x%04X PID 0x%04X (%s)",
            path,
            mm_base_modem_get_plugin (modem),
            (mm_base_modem_get_vendor_id (modem) & 0xFFFF),
            (mm_base_modem_get_product_id (modem) & 0xFFFF),
            subsys ? subsys : "unknown");

    if (physdev)
        g_object_unref (physdev);
}