From 7369f1675972e203b906315a9c79f851fbca6c7d Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 10 Aug 2012 10:21:36 +0200 Subject: broadband-modem-qmi: don't rely on the detailed service status to get HDR reg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'detailed service status' TLV is either pretty new and not always available, or given only under some specific circumstances. So, try to gather CDMA1x and EV-DO registration status with the default info we usually do get. The logic is the following: * If registered and the access technologies contain CDMA1x, then CDMA1x is registered, otherwise it's not. * If registered and the access technologies contain any of the EV-DO revisions, then EV-DO is registered, otherwise it's not. An example output in a CDMA network: [/dev/cdc-wdm0] Successfully got serving system: Registration state: 'registered' CS: 'attached' PS: 'attached' Selected network: '3gpp2' Radio interfaces: '2' [0]: 'cdma-1xevdo' [1]: 'cdma-1x' Roaming status: 'off' Data service capabilities: '2' [0]: 'cdma' [1]: 'evdo-rev-a' Current PLMN: MCC: '311' MNC: '480' Description: 'Verizon Wireless' CDMA System ID: SID: '26' ESN: '1' CDMA Base station info: Base station ID: '3633' Latitude: '44.913333'º Longitude: '-93.279722'º Roaming indicators: '2' [0]: '(null)' (cdma-1x) [1]: '(null)' (none) Default roaming status: '(null)' 3GPP2 time zone: Leap seconds: '16' seconds Local time offset: '-300' minutes Daylight saving time: 'no' CDMA P_Rev: '6' --- src/mm-broadband-modem-qmi.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 94be8ffc..d417902f 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -4031,8 +4031,6 @@ common_process_serving_system_cdma (MMBroadbandModemQmi *self, QmiNasNetworkType selected_network; GArray *radio_interfaces; GArray *data_service_capabilities; - QmiNasServiceStatus hdr_status; - gboolean hdr_hybrid; MMModemAccessTechnology mm_access_technologies; MMModemCdmaRegistrationState mm_cdma1x_registration_state; MMModemCdmaRegistrationState mm_evdo_registration_state; @@ -4101,38 +4099,19 @@ common_process_serving_system_cdma (MMBroadbandModemQmi *self, /* TODO: Roaming flags */ /* Build registration states */ - mm_cdma1x_registration_state = qmi_registration_state_to_cdma_registration_state (registration_state); - hdr_status = QMI_NAS_SERVICE_STATUS_NONE; - hdr_hybrid = FALSE; - if (response_output) - qmi_message_nas_get_serving_system_output_get_detailed_service_status ( - response_output, - NULL, /* status */ - NULL, /* capability */ - &hdr_status, - &hdr_hybrid, - NULL, /* forbidden */ - NULL); + if (mm_access_technologies & MM_IFACE_MODEM_CDMA_ALL_CDMA1X_ACCESS_TECHNOLOGIES_MASK) + mm_cdma1x_registration_state = qmi_registration_state_to_cdma_registration_state (registration_state); else - qmi_indication_nas_serving_system_output_get_detailed_service_status ( - indication_output, - NULL, /* status */ - NULL, /* capability */ - &hdr_status, - &hdr_hybrid, - NULL, /* forbidden */ - NULL); + mm_cdma1x_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN; - if (hdr_hybrid && - (hdr_status == QMI_NAS_SERVICE_STATUS_LIMITED || - hdr_status == QMI_NAS_SERVICE_STATUS_AVAILABLE || - hdr_status == QMI_NAS_SERVICE_STATUS_LIMITED_REGIONAL || - hdr_status == QMI_NAS_SERVICE_STATUS_POWER_SAVE)) - mm_evdo_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED; + if (mm_access_technologies & MM_IFACE_MODEM_CDMA_ALL_EVDO_ACCESS_TECHNOLOGIES_MASK) + mm_evdo_registration_state = qmi_registration_state_to_cdma_registration_state (registration_state); else mm_evdo_registration_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN; + /* Note: don't rely on the 'Detailed Service Status', it's not always given. */ + /* Report new registration states */ mm_iface_modem_cdma_update_cdma1x_registration_state (MM_IFACE_MODEM_CDMA (self), mm_cdma1x_registration_state, -- cgit v1.2.3-70-g09d2