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

« back to all changes in this revision

Viewing changes to plugins/mm-modem-huawei-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:
171
171
{
172
172
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
173
173
 
 
174
    /* If the modem has already been removed, return without
 
175
     * scheduling callback */
 
176
    if (mm_callback_info_check_modem_removed (info))
 
177
        return;
 
178
 
174
179
    if (error)
175
180
        info->error = g_error_copy (error);
176
181
 
232
237
                       gpointer user_data)
233
238
{
234
239
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
235
 
    MMModemHuaweiGsm *self = MM_MODEM_HUAWEI_GSM (info->modem);
 
240
    MMModemHuaweiGsm *self;
236
241
    int mode_a, mode_b, u1, u2;
237
242
    guint32 band;
238
243
    MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
239
244
 
 
245
    /* If the modem has already been removed, return without
 
246
     * scheduling callback */
 
247
    if (mm_callback_info_check_modem_removed (info))
 
248
        return;
 
249
 
 
250
    self = MM_MODEM_HUAWEI_GSM (info->modem);
 
251
 
240
252
    if (error)
241
253
        info->error = g_error_copy (error);
242
254
    else if (parse_syscfg (self, response->str, &mode_a, &mode_b, &band, &u1, &u2, &mode))
271
283
               gpointer user_data)
272
284
{
273
285
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
274
 
    MMModemHuaweiGsm *self = MM_MODEM_HUAWEI_GSM (info->modem);
275
 
    MMModemHuaweiGsmPrivate *priv = MM_MODEM_HUAWEI_GSM_GET_PRIVATE (self);
 
286
    MMModemHuaweiGsm *self;
 
287
    MMModemHuaweiGsmPrivate *priv;
 
288
 
 
289
    /* If the modem has already been removed, return without
 
290
     * scheduling callback */
 
291
    if (mm_callback_info_check_modem_removed (info))
 
292
        return;
 
293
 
 
294
    self = MM_MODEM_HUAWEI_GSM (info->modem);
 
295
    priv = MM_MODEM_HUAWEI_GSM_GET_PRIVATE (self);
276
296
 
277
297
    if (error)
278
298
        info->error = g_error_copy (error);
321
341
               gpointer user_data)
322
342
{
323
343
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
324
 
    MMModemHuaweiGsm *self = MM_MODEM_HUAWEI_GSM (info->modem);
 
344
    MMModemHuaweiGsm *self;
325
345
    int mode_a, mode_b, u1, u2;
326
346
    guint32 band;
327
347
 
 
348
    /* If the modem has already been removed, return without
 
349
     * scheduling callback */
 
350
    if (mm_callback_info_check_modem_removed (info))
 
351
        return;
 
352
 
 
353
    self = MM_MODEM_HUAWEI_GSM (info->modem);
 
354
 
328
355
    if (error)
329
356
        info->error = g_error_copy (error);
330
357
    else if (parse_syscfg (self, response->str, &mode_a, &mode_b, &band, &u1, &u2, NULL)) {
410
437
    char *str;
411
438
    int srv_stat = 0;
412
439
 
 
440
    /* If the modem has already been removed, return without
 
441
     * scheduling callback */
 
442
    if (mm_callback_info_check_modem_removed (info))
 
443
        return;
 
444
 
413
445
    if (error) {
414
446
        info->error = g_error_copy (error);
415
447
        goto done;
504
536
    char *str = NULL;
505
537
    guint32 num = 0;
506
538
 
 
539
    /* If the modem has already been removed, return without
 
540
     * scheduling callback */
 
541
    if (mm_callback_info_check_modem_removed (info))
 
542
        return;
 
543
 
507
544
    if (error) {
508
545
        info->error = g_error_copy (error);
509
546
        goto done;
710
747
 
711
748
/*****************************************************************************/
712
749
 
713
 
typedef struct {
714
 
    MMModem *modem;
715
 
    MMModemFn callback;
716
 
    gpointer user_data;
717
 
} DisableInfo;
718
 
 
719
750
static void
720
751
disable_unsolicited_done (MMAtSerialPort *port,
721
752
                          GString *response,
723
754
                          gpointer user_data)
724
755
 
725
756
{
726
 
    MMModem *parent_modem_iface;
727
 
    DisableInfo *info = user_data;
728
 
 
729
 
    parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (info->modem));
730
 
    parent_modem_iface->disable (info->modem, info->callback, info->user_data);
731
 
    g_free (info);
 
757
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
 
758
 
 
759
    /* If the modem has already been removed, return without
 
760
     * scheduling callback */
 
761
    if (mm_callback_info_check_modem_removed (info))
 
762
        return;
 
763
 
 
764
    /* Ignore all errors */
 
765
    mm_callback_info_schedule (info);
 
766
}
 
767
 
 
768
static void
 
769
invoke_call_parent_disable_fn (MMCallbackInfo *info)
 
770
{
 
771
    /* Note: we won't call the parent disable if info->modem is no longer
 
772
     * valid. The invoke is called always once the info gets scheduled, which
 
773
     * may happen during removed modem detection. */
 
774
    if (info->modem) {
 
775
        MMModem *parent_modem_iface;
 
776
 
 
777
        parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (info->modem));
 
778
        parent_modem_iface->disable (info->modem, (MMModemFn)info->callback, info->user_data);
 
779
    }
732
780
}
733
781
 
734
782
static void
737
785
         gpointer user_data)
738
786
{
739
787
    MMAtSerialPort *primary;
740
 
    DisableInfo *info;
 
788
    MMCallbackInfo *info;
741
789
 
742
 
    info = g_malloc0 (sizeof (DisableInfo));
743
 
    info->callback = callback;
744
 
    info->user_data = user_data;
745
 
    info->modem = modem;
 
790
    info = mm_callback_info_new_full (modem,
 
791
                                      invoke_call_parent_disable_fn,
 
792
                                      (GCallback)callback,
 
793
                                      user_data);
746
794
 
747
795
    primary = mm_generic_gsm_get_at_port (MM_GENERIC_GSM (modem), MM_PORT_TYPE_PRIMARY);
748
796
    g_assert (primary);