All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Inserted the GSM syntax option in modem.conf.
@ 2009-10-29 11:04 Ryan M. Raasch
  2009-10-29 12:37 ` Andres Salomon
  2009-10-29 13:53 ` Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Ryan M. Raasch @ 2009-10-29 11:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

Hello,

Since the modems need to be setup in particular ways, this patch
allows for the GSM syntax to be specified by the configuration file.


Regards,
Ryan

---
 plugins/atgen.c     |    9 ++++++++-
 plugins/modemconf.c |    6 ++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/plugins/atgen.c b/plugins/atgen.c
index db59e36..67a1e8c 100644
--- a/plugins/atgen.c
+++ b/plugins/atgen.c
@@ -117,7 +117,14 @@ static int atgen_enable(struct ofono_modem *modem)
 		return -EIO;
 	}
 
-	syntax = g_at_syntax_new_gsmv1();
+	value = ofono_modem_get_string(modem, "GsmSyntax");
+	if (value && g_str_equal(value, "GSM_V1"))
+		syntax = g_at_syntax_new_gsmv1();
+	else if (value && g_str_equal(value, "GSM_Permissive"))
+		syntax = g_at_syntax_new_gsm_permissive();
+	else if (value)
+		return -EINVAL;
+
 	chat = g_at_chat_new(channel, syntax);
 	g_at_syntax_unref(syntax);
 	g_io_channel_unref(channel);
diff --git a/plugins/modemconf.c b/plugins/modemconf.c
index 6b317e6..a5e5824 100644
--- a/plugins/modemconf.c
+++ b/plugins/modemconf.c
@@ -138,6 +138,12 @@ static int set_device(struct ofono_modem *modem,
 	} else
 		ofono_modem_set_string(modem, "Rtscts", "on");
 
+	value = g_key_file_get_string(keyfile, group, "GsmSyntax", NULL);
+	if (value) {
+		ofono_modem_set_string(modem, "GsmSyntax", value);
+		g_free(value);
+	} else
+		ofono_modem_set_string(modem, "GsmSyntax", "GSM_V1");
 
 	return 0;
 }
-- 
1.6.4.GIT


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Inserted the GSM syntax option in modem.conf.
  2009-10-29 11:04 [PATCH] Inserted the GSM syntax option in modem.conf Ryan M. Raasch
@ 2009-10-29 12:37 ` Andres Salomon
  2009-10-29 13:53 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Andres Salomon @ 2009-10-29 12:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

On Thu, 29 Oct 2009 12:04:23 +0100
"Ryan M. Raasch" <ryan.raasch@gmail.com>
wrote:

> Hello,
> 
> Since the modems need to be setup in particular ways, this patch
> allows for the GSM syntax to be specified by the configuration file.
> 
> 

I like this a whole lot better than having to write a new plugin for
every piece of hardware that doesn't work with the strict parser.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Inserted the GSM syntax option in modem.conf.
  2009-10-29 11:04 [PATCH] Inserted the GSM syntax option in modem.conf Ryan M. Raasch
  2009-10-29 12:37 ` Andres Salomon
@ 2009-10-29 13:53 ` Marcel Holtmann
  2009-10-29 14:11   ` Ryan Raasch
  1 sibling, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2009-10-29 13:53 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]

Hi Ryan,

> Since the modems need to be setup in particular ways, this patch
> allows for the GSM syntax to be specified by the configuration file.
> ---
>  plugins/atgen.c     |    9 ++++++++-
>  plugins/modemconf.c |    6 ++++++
>  2 files changed, 14 insertions(+), 1 deletions(-)
> 
> diff --git a/plugins/atgen.c b/plugins/atgen.c
> index db59e36..67a1e8c 100644
> --- a/plugins/atgen.c
> +++ b/plugins/atgen.c
> @@ -117,7 +117,14 @@ static int atgen_enable(struct ofono_modem *modem)
>  		return -EIO;
>  	}
>  
> -	syntax = g_at_syntax_new_gsmv1();
> +	value = ofono_modem_get_string(modem, "GsmSyntax");
> +	if (value && g_str_equal(value, "GSM_V1"))
> +		syntax = g_at_syntax_new_gsmv1();
> +	else if (value && g_str_equal(value, "GSM_Permissive"))
> +		syntax = g_at_syntax_new_gsm_permissive();
> +	else if (value)
> +		return -EINVAL;
> +

first of all, stop checking value all the time. It is fine to have
nested ifs here. And second you duplicate GSM in the parameter name and
also in the value. So just call it V1 and Permissive.

>  	chat = g_at_chat_new(channel, syntax);
>  	g_at_syntax_unref(syntax);
>  	g_io_channel_unref(channel);
> diff --git a/plugins/modemconf.c b/plugins/modemconf.c
> index 6b317e6..a5e5824 100644
> --- a/plugins/modemconf.c
> +++ b/plugins/modemconf.c
> @@ -138,6 +138,12 @@ static int set_device(struct ofono_modem *modem,
>  	} else
>  		ofono_modem_set_string(modem, "Rtscts", "on");
>  
> +	value = g_key_file_get_string(keyfile, group, "GsmSyntax", NULL);
> +	if (value) {
> +		ofono_modem_set_string(modem, "GsmSyntax", value);
> +		g_free(value);
> +	} else
> +		ofono_modem_set_string(modem, "GsmSyntax", "GSM_V1");
>  

Did you check that this applies cleanly against latest GIT tree?

Regards

Marcel



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Inserted the GSM syntax option in modem.conf.
  2009-10-29 13:53 ` Marcel Holtmann
@ 2009-10-29 14:11   ` Ryan Raasch
  0 siblings, 0 replies; 4+ messages in thread
From: Ryan Raasch @ 2009-10-29 14:11 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]



Marcel Holtmann wrote:
> Hi Ryan,
> 
>> Since the modems need to be setup in particular ways, this patch
>> allows for the GSM syntax to be specified by the configuration file.
>> ---
>>  plugins/atgen.c     |    9 ++++++++-
>>  plugins/modemconf.c |    6 ++++++
>>  2 files changed, 14 insertions(+), 1 deletions(-)
>>
>> diff --git a/plugins/atgen.c b/plugins/atgen.c
>> index db59e36..67a1e8c 100644
>> --- a/plugins/atgen.c
>> +++ b/plugins/atgen.c
>> @@ -117,7 +117,14 @@ static int atgen_enable(struct ofono_modem *modem)
>>  		return -EIO;
>>  	}
>>  
>> -	syntax = g_at_syntax_new_gsmv1();
>> +	value = ofono_modem_get_string(modem, "GsmSyntax");
>> +	if (value && g_str_equal(value, "GSM_V1"))
>> +		syntax = g_at_syntax_new_gsmv1();
>> +	else if (value && g_str_equal(value, "GSM_Permissive"))
>> +		syntax = g_at_syntax_new_gsm_permissive();
>> +	else if (value)
>> +		return -EINVAL;
>> +
> 
> first of all, stop checking value all the time. It is fine to have
> nested ifs here. And second you duplicate GSM in the parameter name and
> also in the value. So just call it V1 and Permissive.
> 

Will do.

>>  	chat = g_at_chat_new(channel, syntax);
>>  	g_at_syntax_unref(syntax);
>>  	g_io_channel_unref(channel);
>> diff --git a/plugins/modemconf.c b/plugins/modemconf.c
>> index 6b317e6..a5e5824 100644
>> --- a/plugins/modemconf.c
>> +++ b/plugins/modemconf.c
>> @@ -138,6 +138,12 @@ static int set_device(struct ofono_modem *modem,
>>  	} else
>>  		ofono_modem_set_string(modem, "Rtscts", "on");
>>  
>> +	value = g_key_file_get_string(keyfile, group, "GsmSyntax", NULL);
>> +	if (value) {
>> +		ofono_modem_set_string(modem, "GsmSyntax", value);
>> +		g_free(value);
>> +	} else
>> +		ofono_modem_set_string(modem, "GsmSyntax", "GSM_V1");
>>  
> 
> Did you check that this applies cleanly against latest GIT tree?
> 

You got me there. The 2 outstanding patches for modemconf need to be 
applied first (wooops). I will make a new set of patches for all the 
modemconf changes.

Greetings,
Ryan

> Regards
> 
> Marcel
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-29 14:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 11:04 [PATCH] Inserted the GSM syntax option in modem.conf Ryan M. Raasch
2009-10-29 12:37 ` Andres Salomon
2009-10-29 13:53 ` Marcel Holtmann
2009-10-29 14:11   ` Ryan Raasch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.