[PATCH] Inserted the GSM syntax option in modem.conf.
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 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Inserted the GSM syntax option in modem.conf.
On Thu, 29 Oct 2009 12:04:23 +0100 "Ryan M. Raasch" 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. ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Inserted the GSM syntax option in modem.conf.
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 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 0/2] python test scripts
Hello, Python script to enter a pin number to unlock the sim card. Regards, Ryan test/enable-modem |6 +- test/enable-sim | 18 ++ 2 files changed, 23 insertions(+), 1 deletions(-) create mode 100755 test/enable-sim ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/2] Added functionality to remove modem from system, if needed.
--- test/enable-modem |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/test/enable-modem b/test/enable-modem index 0f9f604..d44783d 100755 --- a/test/enable-modem +++ b/test/enable-modem @@ -1,6 +1,7 @@ #!/usr/bin/python import dbus +import sys bus = dbus.SystemBus() @@ -14,4 +15,7 @@ path = properties["Modems"][0] modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem') -modem.SetProperty("Powered", dbus.Boolean(1)) +if len(sys.argv) > 1 and sys.argv[1] == '0' : +modem.SetProperty("Powered", dbus.Boolean(0)) +else : +modem.SetProperty("Powered", dbus.Boolean(1)) -- 1.6.4.GIT ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 2/2] This patch enables the pin number and type of pin to be sent to daemon to unlock the sim card.
--- test/enable-sim | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) create mode 100755 test/enable-sim diff --git a/test/enable-sim b/test/enable-sim new file mode 100755 index 000..bbfd34f --- /dev/null +++ b/test/enable-sim @@ -0,0 +1,18 @@ +#!/usr/bin/python + +import dbus +import sys + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + +properties = manager.GetProperties() + +path = properties["Modems"][0] + +modem = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.SimManager') + +modem.EnterPin(sys.argv[1], sys.argv[2]) -- 1.6.4.GIT ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.
Hi Ryan, > --- > test/enable-modem |6 +- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/test/enable-modem b/test/enable-modem > index 0f9f604..d44783d 100755 > --- a/test/enable-modem > +++ b/test/enable-modem > @@ -1,6 +1,7 @@ > #!/usr/bin/python > > import dbus > +import sys > > bus = dbus.SystemBus() > > @@ -14,4 +15,7 @@ path = properties["Modems"][0] > modem = dbus.Interface(bus.get_object('org.ofono', path), > 'org.ofono.Modem') > > -modem.SetProperty("Powered", dbus.Boolean(1)) > +if len(sys.argv) > 1 and sys.argv[1] == '0' : > +modem.SetProperty("Powered", dbus.Boolean(0)) > +else : > +modem.SetProperty("Powered", dbus.Boolean(1)) if you want this, then add a disable-modem script. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/2] This patch enables the pin number and type of pin to be sent to daemon to unlock the sim card.
Hi Ryan, > --- > test/enable-sim | 18 ++ > 1 files changed, 18 insertions(+), 0 deletions(-) > create mode 100755 test/enable-sim > > diff --git a/test/enable-sim b/test/enable-sim > new file mode 100755 > index 000..bbfd34f > --- /dev/null > +++ b/test/enable-sim > @@ -0,0 +1,18 @@ > +#!/usr/bin/python > + > +import dbus > +import sys > + > +bus = dbus.SystemBus() > + > +manager = dbus.Interface(bus.get_object('org.ofono', '/'), > + 'org.ofono.Manager') > + > +properties = manager.GetProperties() > + > +path = properties["Modems"][0] > + > +modem = dbus.Interface(bus.get_object('org.ofono', path), > + 'org.ofono.SimManager') > + > +modem.EnterPin(sys.argv[1], sys.argv[2]) call this script enter-pin and have it check if a PIN is actually required. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Inserted the GSM syntax option in modem.conf.
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 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.
Marcel Holtmann wrote: Hi Ryan, --- test/enable-modem |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/test/enable-modem b/test/enable-modem index 0f9f604..d44783d 100755 --- a/test/enable-modem +++ b/test/enable-modem @@ -1,6 +1,7 @@ #!/usr/bin/python import dbus +import sys bus = dbus.SystemBus() @@ -14,4 +15,7 @@ path = properties["Modems"][0] modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem') -modem.SetProperty("Powered", dbus.Boolean(1)) +if len(sys.argv) > 1 and sys.argv[1] == '0' : +modem.SetProperty("Powered", dbus.Boolean(0)) +else : +modem.SetProperty("Powered", dbus.Boolean(1)) if you want this, then add a disable-modem script. Ok. If no one else thinks it may be needed, i won't. In my case, i thought it would be helpful to see what happens to the system to remove a modem out of the system, ie. power off. I would be nice to be able to set a toggle power to the modem, and allow the daemon to be in the correct state to recover. I have tried toggling the power to the modem (has a switch on the board) when the daemon was running, and the daemon was not able to return to a known state. Greetings, Ryan Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/2] This patch enables the pin number and type of pin to be sent to daemon to unlock the sim card.
Marcel Holtmann wrote: Hi Ryan, --- test/enable-sim | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) create mode 100755 test/enable-sim diff --git a/test/enable-sim b/test/enable-sim new file mode 100755 index 000..bbfd34f --- /dev/null +++ b/test/enable-sim @@ -0,0 +1,18 @@ +#!/usr/bin/python + +import dbus +import sys + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + +properties = manager.GetProperties() + +path = properties["Modems"][0] + +modem = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.SimManager') + +modem.EnterPin(sys.argv[1], sys.argv[2]) call this script enter-pin and have it check if a PIN is actually required. No prob. Thanks, Ryan Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.
Hi Ryan, > >> test/enable-modem |6 +- > >> 1 files changed, 5 insertions(+), 1 deletions(-) > >> > >> diff --git a/test/enable-modem b/test/enable-modem > >> index 0f9f604..d44783d 100755 > >> --- a/test/enable-modem > >> +++ b/test/enable-modem > >> @@ -1,6 +1,7 @@ > >> #!/usr/bin/python > >> > >> import dbus > >> +import sys > >> > >> bus = dbus.SystemBus() > >> > >> @@ -14,4 +15,7 @@ path = properties["Modems"][0] > >> modem = dbus.Interface(bus.get_object('org.ofono', path), > >>'org.ofono.Modem') > >> > >> -modem.SetProperty("Powered", dbus.Boolean(1)) > >> +if len(sys.argv) > 1 and sys.argv[1] == '0' : > >> +modem.SetProperty("Powered", dbus.Boolean(0)) > >> +else : > >> +modem.SetProperty("Powered", dbus.Boolean(1)) > > > > if you want this, then add a disable-modem script. > > Ok. If no one else thinks it may be needed, i won't. In my case, i > thought it would be helpful to see what happens to the system to remove > a modem out of the system, ie. power off. I would be nice to be able to > set a toggle power to the modem, and allow the daemon to be in the > correct state to recover. I am fine with disable-modem script. I just never needed it so far. Otherwise it would have been there. > I have tried toggling the power to the modem (has a switch on the board) > when the daemon was running, and the daemon was not able to return to a > known state. Weird. Might need some udev magic to do the right thing. Or some special handling inside the plugin. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.
Marcel Holtmann wrote: Hi Ryan, test/enable-modem |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/test/enable-modem b/test/enable-modem index 0f9f604..d44783d 100755 --- a/test/enable-modem +++ b/test/enable-modem @@ -1,6 +1,7 @@ #!/usr/bin/python import dbus +import sys bus = dbus.SystemBus() @@ -14,4 +15,7 @@ path = properties["Modems"][0] modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem') -modem.SetProperty("Powered", dbus.Boolean(1)) +if len(sys.argv) > 1 and sys.argv[1] == '0' : +modem.SetProperty("Powered", dbus.Boolean(0)) +else : +modem.SetProperty("Powered", dbus.Boolean(1)) if you want this, then add a disable-modem script. Ok. If no one else thinks it may be needed, i won't. In my case, i thought it would be helpful to see what happens to the system to remove a modem out of the system, ie. power off. I would be nice to be able to set a toggle power to the modem, and allow the daemon to be in the correct state to recover. I am fine with disable-modem script. I just never needed it so far. Otherwise it would have been there. I have tried toggling the power to the modem (has a switch on the board) when the daemon was running, and the daemon was not able to return to a known state. Weird. Might need some udev magic to do the right thing. Or some special handling inside the plugin. Yea. I haven't looked at that part of the code, only that AT+CRC is the first command sent (if i remember right). Our modem sends a ^SYSSTART on powerup, what causes ofonod to go back to its initial state? What is the "normal" start-up string for modems (i was told mc75 doesn't really abide the norm) ? Thanks, Ryan Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] Altered the options for the modem.conf to include more tty options.
Hi Ryan, > The modem.conf patch split into gatchat changes. > Patch has been applied. Thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/2] Altered the atgeneric modem to include the added modem.conf options.
Hi Ryan, > The modem.conf options for the driver portion of the patch. Patch has been applied with some refactoring afterward. I know you ran checkpatch.pl, but please make sure you follow the coding standard even for parts which checkpatch.pl does not catch. In particular: > +static const char *tty_opts[] = > + { > + "Baud", > + "Read", > + "Local", > + "StopBits", > + "DataBits", > + "Parity", > + "XonXoff", > + "Rtscts", > + NULL, > + }; - There are spaces for indentation, ONLY tabs should be used. - The opening brace should be on the tty_opts line. ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.
Hi, > > I have tried toggling the power to the modem (has a switch on the board) > > when the daemon was running, and the daemon was not able to return to a > > known state. > > Weird. Might need some udev magic to do the right thing. Or some special > handling inside the plugin. What kind of modem is this? If it is a UART modem then udev won't help here. Custom plugin handling is required. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/2] Added functionality to remove modem from system, if needed.
Hi Ryan, > Yea. I haven't looked at that part of the code, only that AT+CRC is the > first command sent (if i remember right). Our modem sends a ^SYSSTART on > powerup, what causes ofonod to go back to its initial state? The core has no idea, everything is up to the modem driver. Only the driver knows when the powered up / down events happened. The driver is responsible for informing the core. > > What is the "normal" start-up string for modems (i was told mc75 doesn't > really abide the norm) ? There isn't one, they are all different. Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 2/2] Altered the atgeneric modem to include the added modem.conf options.
2009/10/29 Denis Kenzior : > Hi Ryan, > >> The modem.conf options for the driver portion of the patch. > > Patch has been applied with some refactoring afterward. I know you ran > checkpatch.pl, but please make sure you follow the coding standard even for > parts which checkpatch.pl does not catch. In particular: > >> +static const char *tty_opts[] = >> + { >> + "Baud", >> + "Read", >> + "Local", >> + "StopBits", >> + "DataBits", >> + "Parity", >> + "XonXoff", >> + "Rtscts", >> + NULL, >> + }; > > - There are spaces for indentation, ONLY tabs should be used. > - The opening brace should be on the tty_opts line. > Thanks. I will make sure next time. Greetings, Ryan > ___ > ofono mailing list > ofono@ofono.org > http://lists.ofono.org/listinfo/ofono > ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono