Re: [MM] [PATCH] sierra: add support for new !SELRAT values in newer Sierra LTE modems



Patch attached again in right format.
>From d54ebafd698210e44ca92f4ba6f0fed597ed9518 Mon Sep 17 00:00:00 2001
From: "Marius B. Kotsbak" <marius kotsbak com>
Date: Sun, 2 Sep 2012 22:29:18 +0200
Subject: [PATCH] sierra: add support for new !SELRAT values in newer Sierra
 LTE modems:

AT!SELRAT=?
!SELRAT: Index, Name
00, Automatic
01, UMTS 3G Only
02, GSM 2G Only
03, Automatic
04, Automatic
05, GSM and UMTS Only
06, LTE Only
07, GSM, UMTS, LTE
---
 plugins/sierra/mm-broadband-modem-sierra.c |   45 ++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c
index 69f8293..0c45667 100644
--- a/plugins/sierra/mm-broadband-modem-sierra.c
+++ b/plugins/sierra/mm-broadband-modem-sierra.c
@@ -184,7 +184,7 @@ selrat_query_ready (MMBaseModem *self,
 
         if (mm_get_uint_from_match_info (match_info, 1, &mode) &&
             mode >= 0 &&
-            mode <= 4) {
+            mode <= 7) {
             switch (mode) {
             case 0:
                 result.allowed = MM_MODEM_MODE_ANY;
@@ -199,12 +199,36 @@ selrat_query_ready (MMBaseModem *self,
                 result.preferred = MM_MODEM_MODE_NONE;
                 break;
             case 3:
-                result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
-                result.preferred = MM_MODEM_MODE_3G;
+                // in Sierra LTE devices, mode 3 is automatic, including LTE, no preference
+                if (mm_iface_modem_is_3gpp_lte(MM_IFACE_MODEM(self))) {
+                    result.allowed = MM_MODEM_MODE_ANY;
+                    result.preferred = MM_MODEM_MODE_NONE;
+                } else {
+                    result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
+                    result.preferred = MM_MODEM_MODE_3G;
+                }
                 break;
             case 4:
+                // in Sierra LTE devices, modes 4 is automatic, including LTE, no preference
+                if (mm_iface_modem_is_3gpp_lte(MM_IFACE_MODEM(self))) {
+                    result.allowed = MM_MODEM_MODE_ANY;
+                    result.preferred = MM_MODEM_MODE_NONE;
+                } else {
+                    result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
+                    result.preferred = MM_MODEM_MODE_2G;
+                }
+                break;
+            case 5:
                 result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
-                result.preferred = MM_MODEM_MODE_2G;
+                result.preferred = MM_MODEM_MODE_NONE;
+                break;
+            case 6:
+                result.allowed = (MM_MODEM_MODE_4G);
+                result.preferred = MM_MODEM_MODE_NONE;
+                break;
+            case 7:
+                result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G);
+                result.preferred = MM_MODEM_MODE_NONE;
                 break;
             default:
                 g_assert_not_reached ();
@@ -346,13 +370,22 @@ set_allowed_modes (MMIfaceModem *self,
     else if (allowed == MM_MODEM_MODE_2G)
         idx = 2;
     else if (allowed == (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G)) {
-        if (preferred == MM_MODEM_MODE_3G)
+        // in Sierra LTE devices, modes 3 and 4 are automatic, including LTE, no preference
+        if (mm_iface_modem_is_3gpp_lte(self)) {
+            if (preferred == MM_MODEM_MODE_NONE)
+                idx = 5; // GSM and UMTS Only
+        }
+        else if (preferred == MM_MODEM_MODE_3G)
             idx = 3;
         else if (preferred == MM_MODEM_MODE_2G)
             idx = 4;
         else if (preferred == MM_MODEM_MODE_NONE)
             idx = 0;
-    } else if (allowed == MM_MODEM_MODE_ANY)
+    } else if (allowed == MM_MODEM_MODE_4G)
+        idx = 6;
+    else if (allowed == (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G))
+        idx = 7;
+    else if (allowed == MM_MODEM_MODE_ANY)
         idx = 0;
 
     if (idx < 0) {
-- 
1.7.10.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]