Re: [PATCH 1/1] telit: fix supported and current bands query with GE910

2016-10-11 Thread Aleksander Morgado
On 10/10/16 14:42, Daniele Palmas wrote:
> GE910 is a 2g only modem and when queried for bands it returns
> only a 2g set of bands:
> 
> --> 'AT#BND=?'
> <-- '#BND: (0-3)OK'
> 
> Current regex fails, since it considers the 3g bands block mandatory.
> 
> A similar problem happens for current bands.
> 
> This patch modifies the regular expressions for properly
> supporting GE910 and updates tests.

Thanks, pushed to git master and mm-1-6.

> ---
>  plugins/telit/mm-modem-helpers-telit.c| 4 ++--
>  plugins/telit/tests/test-mm-modem-helpers-telit.c | 8 
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/plugins/telit/mm-modem-helpers-telit.c 
> b/plugins/telit/mm-modem-helpers-telit.c
> index d71a712..665668f 100644
> --- a/plugins/telit/mm-modem-helpers-telit.c
> +++ b/plugins/telit/mm-modem-helpers-telit.c
> @@ -162,9 +162,9 @@ mm_telit_parse_csim_response (const guint step,
>  return retries;
>  }
>  
> -#define SUPP_BAND_RESPONSE_REGEX  
> "#BND:\\s*\\((?P.*)\\),\\s*\\((?P.*)\\)"
> +#define SUPP_BAND_RESPONSE_REGEX  
> "#BND:\\s*\\((?P[0-9\\-,]*)\\)(,\\s*\\((?P.*)\\))?"
>  #define SUPP_BAND_4G_MODEM_RESPONSE_REGEX 
> "#BND:\\s*\\((?P.*)\\),\\s*\\((?P.*)\\),\\s*\\((?P\\d+-\\d+)\\)"
> -#define CURR_BAND_RESPONSE_REGEX  
> "#BND:\\s*(?P\\d+),\\s*(?P\\d+)"
> +#define CURR_BAND_RESPONSE_REGEX  
> "#BND:\\s*(?P\\d+)(,\\s*(?P\\d+))?"
>  #define CURR_BAND_4G_MODEM_RESPONSE_REGEX 
> "#BND:\\s*(?P\\d+),\\s*(?P\\d+),\\s*(?P\\d+)"
>  
>  
> /*/
> diff --git a/plugins/telit/tests/test-mm-modem-helpers-telit.c 
> b/plugins/telit/tests/test-mm-modem-helpers-telit.c
> index bfdde89..03b1bc7 100644
> --- a/plugins/telit/tests/test-mm-modem-helpers-telit.c
> +++ b/plugins/telit/tests/test-mm-modem-helpers-telit.c
> @@ -160,6 +160,10 @@ typedef struct {
>  } BNDResponseTest;
>  
>  static BNDResponseTest supported_band_mapping_tests [] = {
> +{ "#BND: (0-3)", TRUE, FALSE, FALSE, 4, { MM_MODEM_BAND_EGSM,
> +  MM_MODEM_BAND_DCS,
> +  MM_MODEM_BAND_PCS,
> +  MM_MODEM_BAND_G850} },
>  { "#BND: (0-3),(0,2,5,6)", TRUE, TRUE, FALSE, 7, { MM_MODEM_BAND_EGSM,
>MM_MODEM_BAND_DCS,
>MM_MODEM_BAND_PCS,
> @@ -242,6 +246,10 @@ test_parse_supported_bands_response (void) {
>  
>  
>  static BNDResponseTest current_band_mapping_tests [] = {
> +{ "#BND: 0", TRUE, FALSE, FALSE, 2, { MM_MODEM_BAND_EGSM,
> +  MM_MODEM_BAND_DCS
> +}
> +},
>  { "#BND: 0,5", TRUE, TRUE, FALSE, 3, { MM_MODEM_BAND_EGSM,
> MM_MODEM_BAND_DCS,
> MM_MODEM_BAND_U900
> 


-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH 1/1] telit: fix supported and current bands query with GE910

2016-10-10 Thread Daniele Palmas
GE910 is a 2g only modem and when queried for bands it returns
only a 2g set of bands:

--> 'AT#BND=?'
<-- '#BND: (0-3)OK'

Current regex fails, since it considers the 3g bands block mandatory.

A similar problem happens for current bands.

This patch modifies the regular expressions for properly
supporting GE910 and updates tests.
---
 plugins/telit/mm-modem-helpers-telit.c| 4 ++--
 plugins/telit/tests/test-mm-modem-helpers-telit.c | 8 
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/plugins/telit/mm-modem-helpers-telit.c 
b/plugins/telit/mm-modem-helpers-telit.c
index d71a712..665668f 100644
--- a/plugins/telit/mm-modem-helpers-telit.c
+++ b/plugins/telit/mm-modem-helpers-telit.c
@@ -162,9 +162,9 @@ mm_telit_parse_csim_response (const guint step,
 return retries;
 }
 
-#define SUPP_BAND_RESPONSE_REGEX  
"#BND:\\s*\\((?P.*)\\),\\s*\\((?P.*)\\)"
+#define SUPP_BAND_RESPONSE_REGEX  
"#BND:\\s*\\((?P[0-9\\-,]*)\\)(,\\s*\\((?P.*)\\))?"
 #define SUPP_BAND_4G_MODEM_RESPONSE_REGEX 
"#BND:\\s*\\((?P.*)\\),\\s*\\((?P.*)\\),\\s*\\((?P\\d+-\\d+)\\)"
-#define CURR_BAND_RESPONSE_REGEX  
"#BND:\\s*(?P\\d+),\\s*(?P\\d+)"
+#define CURR_BAND_RESPONSE_REGEX  
"#BND:\\s*(?P\\d+)(,\\s*(?P\\d+))?"
 #define CURR_BAND_4G_MODEM_RESPONSE_REGEX 
"#BND:\\s*(?P\\d+),\\s*(?P\\d+),\\s*(?P\\d+)"
 
 /*/
diff --git a/plugins/telit/tests/test-mm-modem-helpers-telit.c 
b/plugins/telit/tests/test-mm-modem-helpers-telit.c
index bfdde89..03b1bc7 100644
--- a/plugins/telit/tests/test-mm-modem-helpers-telit.c
+++ b/plugins/telit/tests/test-mm-modem-helpers-telit.c
@@ -160,6 +160,10 @@ typedef struct {
 } BNDResponseTest;
 
 static BNDResponseTest supported_band_mapping_tests [] = {
+{ "#BND: (0-3)", TRUE, FALSE, FALSE, 4, { MM_MODEM_BAND_EGSM,
+  MM_MODEM_BAND_DCS,
+  MM_MODEM_BAND_PCS,
+  MM_MODEM_BAND_G850} },
 { "#BND: (0-3),(0,2,5,6)", TRUE, TRUE, FALSE, 7, { MM_MODEM_BAND_EGSM,
   MM_MODEM_BAND_DCS,
   MM_MODEM_BAND_PCS,
@@ -242,6 +246,10 @@ test_parse_supported_bands_response (void) {
 
 
 static BNDResponseTest current_band_mapping_tests [] = {
+{ "#BND: 0", TRUE, FALSE, FALSE, 2, { MM_MODEM_BAND_EGSM,
+  MM_MODEM_BAND_DCS
+}
+},
 { "#BND: 0,5", TRUE, TRUE, FALSE, 3, { MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_U900
-- 
2.7.4

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel