~ubuntu-branches/ubuntu/vivid/modemmanager/vivid-proposed

« back to all changes in this revision

Viewing changes to plugins/mm-modem-samsung-gsm.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-16 17:12:41 UTC
  • mfrom: (16.1.1 oneiric)
  • Revision ID: james.westby@ubuntu.com-20110616171241-k8vgsdmbpsvx467q
Tags: 0.4.997-1
* debian/watch: Switch to .bz2 tarballs.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
{
145
145
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
146
146
 
 
147
    /* If the modem has already been removed, return without
 
148
     * scheduling callback */
 
149
    if (mm_callback_info_check_modem_removed (info))
 
150
        return;
 
151
 
147
152
    if (error)
148
153
        info->error = g_error_copy (error);
149
154
 
232
237
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
233
238
    MMModemGsmBand mm_band = MM_MODEM_GSM_BAND_UNKNOWN;
234
239
 
 
240
    /* If the modem has already been removed, return without
 
241
     * scheduling callback */
 
242
    if (mm_callback_info_check_modem_removed (info))
 
243
        return;
 
244
 
235
245
    if (error)
236
246
        info->error = g_error_copy (error);
237
247
    else if (parse_ipbm (response->str, &mm_band))
290
300
    char *str = NULL;
291
301
    guint32 num = 0;
292
302
 
 
303
    /* If the modem has already been removed, return without
 
304
     * scheduling callback */
 
305
    if (mm_callback_info_check_modem_removed (info))
 
306
        return;
 
307
 
293
308
    if (error) {
294
309
        info->error = g_error_copy (error);
295
310
        goto done;
410
425
    mm_modem_icera_get_access_technology (MM_MODEM_ICERA (gsm), callback, user_data);
411
426
}
412
427
 
413
 
typedef struct {
414
 
    MMModem *modem;
415
 
    MMModemFn callback;
416
 
    gpointer user_data;
417
 
} DisableInfo;
 
428
/*****************************************************************************/
418
429
 
419
430
static void
420
431
disable_unsolicited_done (MMAtSerialPort *port,
423
434
                          gpointer user_data)
424
435
 
425
436
{
426
 
    MMModem *parent_modem_iface;
427
 
    DisableInfo *info = user_data;
428
 
 
429
 
    parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (info->modem));
430
 
    parent_modem_iface->disable (info->modem, info->callback, info->user_data);
431
 
    g_free (info);
 
437
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
 
438
 
 
439
    /* If the modem has already been removed, return without
 
440
     * scheduling callback */
 
441
    if (mm_callback_info_check_modem_removed (info))
 
442
        return;
 
443
 
 
444
    /* Ignore all errors */
 
445
    mm_callback_info_schedule (info);
 
446
}
 
447
 
 
448
static void
 
449
invoke_call_parent_disable_fn (MMCallbackInfo *info)
 
450
{
 
451
    /* Note: we won't call the parent disable if info->modem is no longer
 
452
     * valid. The invoke is called always once the info gets scheduled, which
 
453
     * may happen during removed modem detection. */
 
454
    if (info->modem) {
 
455
        MMModem *parent_modem_iface;
 
456
 
 
457
        parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (info->modem));
 
458
        parent_modem_iface->disable (info->modem, (MMModemFn)info->callback, info->user_data);
 
459
    }
432
460
}
433
461
 
434
462
static void
437
465
         gpointer user_data)
438
466
{
439
467
    MMAtSerialPort *primary;
440
 
    DisableInfo *info;
 
468
    MMCallbackInfo *info;
441
469
 
442
470
    mm_modem_icera_cleanup (MM_MODEM_ICERA (modem));
443
471
    mm_modem_icera_change_unsolicited_messages (MM_MODEM_ICERA (modem), FALSE);
444
472
 
445
 
    info = g_malloc0 (sizeof (DisableInfo));
446
 
    info->callback = callback;
447
 
    info->user_data = user_data;
448
 
    info->modem = modem;
 
473
    info = mm_callback_info_new_full (modem,
 
474
                                      invoke_call_parent_disable_fn,
 
475
                                      (GCallback)callback,
 
476
                                      user_data);
449
477
 
450
478
    primary = mm_generic_gsm_get_at_port (MM_GENERIC_GSM (modem), MM_PORT_TYPE_PRIMARY);
451
479
    g_assert (primary);
461
489
               gpointer user_data)
462
490
{
463
491
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
464
 
    MMModemSamsungGsm *self = MM_MODEM_SAMSUNG_GSM (info->modem);
 
492
    MMModemSamsungGsm *self;
 
493
 
 
494
    /* If the modem has already been removed, return without
 
495
     * scheduling callback */
 
496
    if (mm_callback_info_check_modem_removed (info))
 
497
        return;
 
498
 
 
499
    self = MM_MODEM_SAMSUNG_GSM (info->modem);
465
500
 
466
501
    if (!error)
467
502
        mm_modem_icera_change_unsolicited_messages (MM_MODEM_ICERA (self), TRUE);
476
511
            gpointer user_data)
477
512
{
478
513
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
479
 
    MMModemSamsungGsm *self = MM_MODEM_SAMSUNG_GSM (info->modem);
 
514
    MMModemSamsungGsm *self;
 
515
 
 
516
    /* If the modem has already been removed, return without
 
517
     * scheduling callback */
 
518
    if (mm_callback_info_check_modem_removed (info))
 
519
        return;
 
520
 
 
521
    self = MM_MODEM_SAMSUNG_GSM (info->modem);
480
522
 
481
523
    if (error)
482
524
        mm_generic_gsm_enable_complete (MM_GENERIC_GSM (self), error, info);
493
535
           gpointer user_data)
494
536
{
495
537
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
496
 
    MMModemSamsungGsm *self = MM_MODEM_SAMSUNG_GSM (info->modem);
 
538
    MMModemSamsungGsm *self;
 
539
 
 
540
    /* If the modem has already been removed, return without
 
541
     * scheduling callback */
 
542
    if (mm_callback_info_check_modem_removed (info))
 
543
        return;
 
544
 
 
545
    self = MM_MODEM_SAMSUNG_GSM (info->modem);
497
546
 
498
547
    if (error)
499
548
        mm_generic_gsm_enable_complete (MM_GENERIC_GSM (self), error, info);