~ubuntu-branches/ubuntu/oneiric/modemmanager/oneiric-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-03-14 15:35:28 UTC
  • Revision ID: package-import@ubuntu.com-20120314153528-9lafb09hdef5t6kv
Tags: 0.5-1ubuntu1.1
debian/patches/git_revert_huawei_probing_rework_7e406c2.patch: revert the
rework for probing Huawei devices that was introduced in 0.5; it appears to
break the Huawei E220 and as such constitues a regression. The revert
appears to let all devices properly work (even the newer ones) and is
included in version 0.5.2. (LP: #868034)

Show diffs side-by-side

added added

removed removed

Lines of Context:
729
729
 
730
730
/*****************************************************************************/
731
731
 
732
 
static void
733
 
do_enable_power_up_done (MMGenericGsm *gsm,
734
 
                         GString *response,
735
 
                         GError *error,
736
 
                         MMCallbackInfo *info)
737
 
{
738
 
    if (!error) {
739
 
        MMAtSerialPort *primary;
740
 
 
741
 
        /* Enable unsolicited result codes */
742
 
        primary = mm_generic_gsm_get_at_port (gsm, MM_PORT_TYPE_PRIMARY);
743
 
        g_assert (primary);
744
 
 
745
 
        mm_at_serial_port_queue_command (primary, "^CURC=1", 5, NULL, NULL);
746
 
    }
747
 
 
748
 
    /* Chain up to parent */
749
 
    MM_GENERIC_GSM_CLASS (mm_modem_huawei_gsm_parent_class)->do_enable_power_up_done (gsm, NULL, error, info);
750
 
}
751
 
 
752
 
/*****************************************************************************/
753
 
 
754
 
static void
755
 
disable_unsolicited_done (MMAtSerialPort *port,
756
 
                          GString *response,
757
 
                          GError *error,
758
 
                          gpointer user_data)
759
 
 
760
 
{
761
 
    MMCallbackInfo *info = (MMCallbackInfo *) user_data;
762
 
 
763
 
    /* If the modem has already been removed, return without
764
 
     * scheduling callback */
765
 
    if (mm_callback_info_check_modem_removed (info))
766
 
        return;
767
 
 
768
 
    /* Ignore all errors */
769
 
    mm_callback_info_schedule (info);
770
 
}
771
 
 
772
 
static void
773
 
invoke_call_parent_disable_fn (MMCallbackInfo *info)
774
 
{
775
 
    /* Note: we won't call the parent disable if info->modem is no longer
776
 
     * valid. The invoke is called always once the info gets scheduled, which
777
 
     * may happen during removed modem detection. */
778
 
    if (info->modem) {
779
 
        MMModem *parent_modem_iface;
780
 
 
781
 
        parent_modem_iface = g_type_interface_peek_parent (MM_MODEM_GET_INTERFACE (info->modem));
782
 
        parent_modem_iface->disable (info->modem, (MMModemFn)info->callback, info->user_data);
783
 
    }
784
 
}
785
 
 
786
 
static void
787
 
disable (MMModem *modem,
788
 
         MMModemFn callback,
789
 
         gpointer user_data)
790
 
{
791
 
    MMAtSerialPort *primary;
792
 
    MMCallbackInfo *info;
793
 
 
794
 
    info = mm_callback_info_new_full (modem,
795
 
                                      invoke_call_parent_disable_fn,
796
 
                                      (GCallback)callback,
797
 
                                      user_data);
798
 
 
799
 
    primary = mm_generic_gsm_get_at_port (MM_GENERIC_GSM (modem), MM_PORT_TYPE_PRIMARY);
800
 
    g_assert (primary);
801
 
 
802
 
    /* Turn off unsolicited responses */
803
 
    mm_at_serial_port_queue_command (primary, "^CURC=0", 5, disable_unsolicited_done, info);
804
 
}
805
 
 
806
 
/*****************************************************************************/
807
 
 
808
732
static gboolean
809
733
grab_port (MMModem *modem,
810
734
           const char *subsys,
920
844
modem_init (MMModem *modem_class)
921
845
{
922
846
    modem_class->grab_port = grab_port;
923
 
    modem_class->disable = disable;
924
847
}
925
848
 
926
849
static void
960
883
    gsm_class->set_allowed_mode = set_allowed_mode;
961
884
    gsm_class->get_allowed_mode = get_allowed_mode;
962
885
    gsm_class->get_access_technology = get_access_technology;
963
 
    gsm_class->do_enable_power_up_done = do_enable_power_up_done;
964
886
}
965
887