Re: [PATCH 1/2] Expose voice call direction synchronously

2011-01-12 Thread Rémi Denis-Courmont
On Wednesday 12 January 2011 07:14:20 ext Denis Kenzior, you wrote:
 Hi Kai,
 
 On 01/11/2011 06:47 AM, kai.vehma...@nokia.com wrote:
  Hi,
  
  On 10 Jan 2010, Rémi Denis-Courmont wrote:
  Currently, the call direction can only be inferred from the signals.
  This adds a property to keep it visible also from GetCalls().
  
  just adding one more do { ++votes; } while(0) for this.
  telepathy-ring needs this as well when it is (re)started and there
  are existing calls:
  https://bugs.freedesktop.org/show_bug.cgi?id=32990
 
 I'm still waiting for someone to give me a proper usecase for how the
 Dialer UI is going to use this information.

The dialer UI is not going to use GetCalls anyway. It is going to watch the 
signals, or place the call itself. So this question makes no sense.

I am not interested in playing politics on whether Telepathy should be used or 
something, whether oFono should be the AT commands emulator or not, or whether 
some operator or UI requirements make sense. I am interested in getting my 
work done.

We know this is required for TP-Ring and required for matd. Besides, it's two 
line, it's consistent and it's clear.

-- 
Rémi Denis-Courmont
Nokia Devices RD, Maemo Software, Helsinki
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] test: add set-call-forwarding

2011-01-12 Thread Jarko Poutiainen
---
 Makefile.am  |3 +-
 test/set-call-forwarding |   64 ++
 2 files changed, 66 insertions(+), 1 deletions(-)
 create mode 100755 test/set-call-forwarding

diff --git a/Makefile.am b/Makefile.am
index 4dec90a..ead154d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -449,7 +449,8 @@ test_scripts = test/backtrace \
test/set-tty \
test/set-gsm-band \
test/set-umts-band \
-   test/lockdown-modem
+   test/lockdown-modem \
+   test/set-call-forwarding
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/set-call-forwarding b/test/set-call-forwarding
new file mode 100755
index 000..159a27c
--- /dev/null
+++ b/test/set-call-forwarding
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+import sys
+import gobject
+
+import dbus
+import dbus.mainloop.glib
+
+def property_changed(property, value):
+   if len(value.__str__())  0:
+   print CF property %s changed to %s % (property, value)
+   else:
+   print CF property %s changed to disabled % (property)
+
+   if canexit:
+   mainloop.quit();
+
+if __name__ == __main__:
+   if len(sys.argv)  3:
+   print Usage: %s property value % (sys.argv[0])
+   print Properties can be: VoiceUnconditional, VoiceBusy,
+   print  VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable
+   print Value: number to or the timeout
+   sys.exit(1)
+
+   property = sys.argv[1]
+   value = sys.argv[2]
+
+   canexit = False
+
+   dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+   bus = dbus.SystemBus()
+
+   manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+
+   modems = manager.GetModems()
+
+   cf = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
+   'org.ofono.CallForwarding')
+
+   cf.connect_to_signal(PropertyChanged, property_changed)
+
+   if (property == VoiceNoReplyTimeout):
+   try:
+   cf.SetProperty(property, dbus.UInt16(value),
+   timeout = 100)
+   except dbus.DBusException, e:
+   print Unable SetProperty, e
+   sys.exit(1);
+   else:
+   try:
+   cf.SetProperty(property, value, timeout = 100)
+   except dbus.DBusException, e:
+   print Unable SetProperty, e
+   sys.exit(1);
+
+   print Set Property successfull
+
+   canexit = True
+
+   mainloop = gobject.MainLoop()
+   mainloop.run()
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] sim: check if lock is locked after code changing attempt

2011-01-12 Thread Lucas De Marchi
Hi Jussi,

On Wed, Jan 12, 2011 at 5:39 AM,  jussi.kan...@tieto.com wrote:
 Hi Lucas,

 On Tue, 2011-01-11 at 16:08 +0200, Lucas De Marchi wrote:
 Hi Jussi

 On Tue, Jan 11, 2011 at 10:17 AM,  jussi.kan...@tieto.com wrote:
  Hi,
 
  This is fix to Marit Henriksen's TODO item Check SIM pin status if 
  sim_change_pin fails. I've discussed with Marit and it's ok for her if I 
  fix the issue. Problem here is that issue could perhaps also be fixed with 
  retry counter solution introduced by Lucas De Marchi couple of tasks ago. 
  That would seem however require some extra implementation in ste modem ( 
  at least I was not able get the ofono show correct values without extra 
  modifications ) and I think that isimodems don't have that sort of retry 
  counter at all. Because of that and since I had this solution already 
  implemented I propose it to be added as well.
 

 I failed to understand why you are hard-coding this and why you'd like
 to use retry counters. Can't you just check the pin state by calling
 sim_pin_check()?

 Moreover, this is not really implementing what the TODO item says.


 regards,
 Lucas De Marchi

 Marit already proposed sim_pin_check approach 2010/11/2. Denis Kenzior
 thought that initializing sim interface would not be a good idea. See
 mail Re: [Patch] sim: Check SIM pin status after changing pin from
 Friday 5th in November 2010.

 True, fix proposal does not do exactly what TODO item says. It trusts to
 returned error value instead of going to check the sim state once more.
 In my testings this value has been trustable so far and there has not
 been reason to go check the state. Of course I've tested only with one
 modem so this might not be a universal truth.

 I don't particularly wish to use the retry counters. I was just thinking that 
 same
 information ( PUK required ) could be deduced by counting the retries.

IMO you should try querying the pin state on failure as Denis and I
suggested rather than using retry counters and/or hard-coding this
here. You might do this without re-initializing the sim interface.
Then Denis' worries in
http://www.mail-archive.com/ofono@ofono.org/msg05294.html are gone.



Lucas De Marchi
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 01/16] smsutil: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 src/smsutil.c |2 +-
 src/smsutil.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index 5e1d233..3a54fe6 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -3902,7 +3902,7 @@ static inline gboolean cbs_is_update_newer(unsigned int 
n, unsigned int o)
return FALSE;
 }
 
-struct cbs_assembly *cbs_assembly_new()
+struct cbs_assembly *cbs_assembly_new(void)
 {
return g_new0(struct cbs_assembly, 1);
 }
diff --git a/src/smsutil.h b/src/smsutil.h
index 4b6159f..dd65884 100644
--- a/src/smsutil.h
+++ b/src/smsutil.h
@@ -540,7 +540,7 @@ gboolean cbs_extract_app_port(const struct cbs *cbs, int 
*dst, int *src,
 
 char *cbs_decode_text(GSList *cbs_list, char *iso639_lang);
 
-struct cbs_assembly *cbs_assembly_new();
+struct cbs_assembly *cbs_assembly_new(void);
 void cbs_assembly_free(struct cbs_assembly *assembly);
 GSList *cbs_assembly_add_page(struct cbs_assembly *assembly,
const struct cbs *cbs);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 00/16] M15 coding style fixes

2011-01-12 Thread Jeevaka Badrappan
Hi,

 Coding style fix patches for the whole oFono tree.

Regards,
Jeevaka

Jeevaka Badrappan (16):
  smsutil: M15 coding style fix
  core: M15 coding style fix
  include: M15 coding style fix
  mbmmodem: M15 coding style fix
  hfpmodem: M15 coding style fix
  huaweimodem: M15 coding style fix
  stemodem: M15 coding style fix
  calypsomodem: M15 coding style fix
  ifxmodem: M15 coding style fix
  hsomodem: M15 coding style fix
  nwmodem: M15 coding style fix
  isimodem: M15 coding style fix
  atmodem: M15 coding style fix
  plugins: M15 coding style fix
  unit: M15 coding style fix
  gatchat: M15 coding styles fixes

 drivers/atmodem/atmodem.h   |   68 +++---
 drivers/atmodem/call-barring.c  |4 +-
 drivers/atmodem/call-forwarding.c   |4 +-
 drivers/atmodem/call-meter.c|4 +-
 drivers/atmodem/call-settings.c |4 +-
 drivers/atmodem/call-volume.c   |4 +-
 drivers/atmodem/cbs.c   |4 +-
 drivers/atmodem/gprs-context.c  |4 +-
 drivers/atmodem/gprs.c  |4 +-
 drivers/atmodem/network-registration.c  |4 +-
 drivers/atmodem/phonebook.c |6 +-
 drivers/atmodem/sim.c   |4 +-
 drivers/atmodem/sms.c   |4 +-
 drivers/atmodem/ssn.c   |4 +-
 drivers/atmodem/stk.c   |4 +-
 drivers/atmodem/ussd.c  |4 +-
 drivers/atmodem/voicecall.c |4 +-
 drivers/calypsomodem/calypsomodem.h |8 ++--
 drivers/calypsomodem/stk.c  |4 +-
 drivers/calypsomodem/voicecall.c|4 +-
 drivers/hfpmodem/call-volume.c  |4 +-
 drivers/hfpmodem/hfpmodem.h |   12 +++---
 drivers/hfpmodem/network-registration.c |4 +-
 drivers/hfpmodem/voicecall.c|4 +-
 drivers/hsomodem/gprs-context.c |4 +-
 drivers/hsomodem/hsomodem.h |8 ++--
 drivers/hsomodem/radio-settings.c   |4 +-
 drivers/huaweimodem/audio-settings.c|4 +-
 drivers/huaweimodem/gprs-context.c  |4 +-
 drivers/huaweimodem/huaweimodem.h   |   16 
 drivers/huaweimodem/radio-settings.c|4 +-
 drivers/huaweimodem/voicecall.c |4 +-
 drivers/ifxmodem/audio-settings.c   |4 +-
 drivers/ifxmodem/gprs-context.c |4 +-
 drivers/ifxmodem/ifxmodem.h |   20 +-
 drivers/ifxmodem/radio-settings.c   |4 +-
 drivers/ifxmodem/stk.c  |4 +-
 drivers/ifxmodem/voicecall.c|4 +-
 drivers/isimodem/audio-settings.c   |4 +-
 drivers/isimodem/call-barring.c |4 +-
 drivers/isimodem/call-forwarding.c  |4 +-
 drivers/isimodem/call-meter.c   |4 +-
 drivers/isimodem/call-settings.c|4 +-
 drivers/isimodem/cbs.c  |4 +-
 drivers/isimodem/devinfo.c  |4 +-
 drivers/isimodem/gprs-context.c |4 +-
 drivers/isimodem/isimodem.h |   68 +++---
 drivers/isimodem/network-registration.c |4 +-
 drivers/isimodem/phonebook.c|4 +-
 drivers/isimodem/radio-settings.c   |4 +-
 drivers/isimodem/sim.c  |4 +-
 drivers/isimodem/sms.c  |4 +-
 drivers/isimodem/ssn.c  |4 +-
 drivers/isimodem/ussd.c |4 +-
 drivers/isimodem/voicecall.c|4 +-
 drivers/mbmmodem/gprs-context.c |4 +-
 drivers/mbmmodem/mbmmodem.h |8 ++--
 drivers/mbmmodem/stk.c  |4 +-
 drivers/nwmodem/nwmodem.h   |4 +-
 drivers/nwmodem/radio-settings.c|4 +-
 drivers/stemodem/gprs-context.c |4 +-
 drivers/stemodem/radio-settings.c   |4 +-
 drivers/stemodem/stemodem.h |   12 +++---
 drivers/stemodem/voicecall.c|4 +-
 gatchat/gatsyntax.c |4 +-
 gatchat/gatsyntax.h |4 +-
 gatchat/gsmdial.c   |4 +-
 gatchat/test-server.c   |4 +-
 include/dbus.h  |2 +-
 plugins/bluetooth.h |2 +-
 plugins/hfp.c   |6 +-
 plugins/push-notification.c |4 +-
 plugins/smart-messaging.c   |4 +-
 src/dbus.c  |2 +-
 src/main.c  |2 +-
 src/manager.c   |4 +-
 src/modem.c |6 +-
 src/ofono.h |   12 +++---
 src/smsutil.c   |2 +-
 src/smsutil.h   |2 +-
 unit/test-common.c  |6 +-
 unit/test-idmap.c   |4 +-
 unit/test-mux.c |8 ++--
 unit/test-simutil.c |   14 

[PATCH 04/16] mbmmodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/mbmmodem/gprs-context.c |4 ++--
 drivers/mbmmodem/mbmmodem.h |8 
 drivers/mbmmodem/stk.c  |4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c
index 0a1ca2c..b9b4574 100644
--- a/drivers/mbmmodem/gprs-context.c
+++ b/drivers/mbmmodem/gprs-context.c
@@ -514,12 +514,12 @@ static struct ofono_gprs_context_driver driver = {
.deactivate_primary = mbm_gprs_deactivate_primary,
 };
 
-void mbm_gprs_context_init()
+void mbm_gprs_context_init(void)
 {
ofono_gprs_context_driver_register(driver);
 }
 
-void mbm_gprs_context_exit()
+void mbm_gprs_context_exit(void)
 {
ofono_gprs_context_driver_unregister(driver);
 }
diff --git a/drivers/mbmmodem/mbmmodem.h b/drivers/mbmmodem/mbmmodem.h
index 65786d7..4c6f263 100644
--- a/drivers/mbmmodem/mbmmodem.h
+++ b/drivers/mbmmodem/mbmmodem.h
@@ -21,8 +21,8 @@
 
 #include drivers/atmodem/atutil.h
 
-extern void mbm_gprs_context_init();
-extern void mbm_gprs_context_exit();
+extern void mbm_gprs_context_init(void);
+extern void mbm_gprs_context_exit(void);
 
-extern void mbm_stk_init();
-extern void mbm_stk_exit();
+extern void mbm_stk_init(void);
+extern void mbm_stk_exit(void);
diff --git a/drivers/mbmmodem/stk.c b/drivers/mbmmodem/stk.c
index 81c36db..d0a9f3b 100644
--- a/drivers/mbmmodem/stk.c
+++ b/drivers/mbmmodem/stk.c
@@ -270,12 +270,12 @@ static struct ofono_stk_driver driver = {
.terminal_response  = mbm_stk_terminal_response,
 };
 
-void mbm_stk_init()
+void mbm_stk_init(void)
 {
ofono_stk_driver_register(driver);
 }
 
-void mbm_stk_exit()
+void mbm_stk_exit(void)
 {
ofono_stk_driver_unregister(driver);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 02/16] core: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 src/dbus.c|2 +-
 src/main.c|2 +-
 src/manager.c |4 ++--
 src/modem.c   |6 +++---
 src/ofono.h   |   12 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/dbus.c b/src/dbus.c
index b719217..01d43cf 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -415,7 +415,7 @@ gboolean __ofono_dbus_valid_object_path(const char *path)
return TRUE;
 }
 
-DBusConnection *ofono_dbus_get_connection()
+DBusConnection *ofono_dbus_get_connection(void)
 {
return g_connection;
 }
diff --git a/src/main.c b/src/main.c
index 87fb0ab..3db8819 100644
--- a/src/main.c
+++ b/src/main.c
@@ -42,7 +42,7 @@
 
 static GMainLoop *event_loop;
 
-void __ofono_exit()
+void __ofono_exit(void)
 {
g_main_loop_quit(event_loop);
 }
diff --git a/src/manager.c b/src/manager.c
index 0649bcc..7075909 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -91,7 +91,7 @@ static GDBusSignalTable manager_signals[] = {
{ }
 };
 
-int __ofono_manager_init()
+int __ofono_manager_init(void)
 {
DBusConnection *conn = ofono_dbus_get_connection();
gboolean ret;
@@ -107,7 +107,7 @@ int __ofono_manager_init()
return 0;
 }
 
-void __ofono_manager_cleanup()
+void __ofono_manager_cleanup(void)
 {
DBusConnection *conn = ofono_dbus_get_connection();
 
diff --git a/src/modem.c b/src/modem.c
index 953d6c3..981aabc 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -1560,12 +1560,12 @@ static void sim_watch(struct ofono_atom *atom,
modem, NULL);
 }
 
-void __ofono_modemwatch_init()
+void __ofono_modemwatch_init(void)
 {
g_modemwatches = __ofono_watchlist_new(g_free);
 }
 
-void __ofono_modemwatch_cleanup()
+void __ofono_modemwatch_cleanup(void)
 {
__ofono_watchlist_free(g_modemwatches);
 }
@@ -1850,7 +1850,7 @@ void ofono_modem_driver_unregister(const struct 
ofono_modem_driver *d)
}
 }
 
-void __ofono_modem_shutdown()
+void __ofono_modem_shutdown(void)
 {
struct ofono_modem *modem;
GSList *l;
diff --git a/src/ofono.h b/src/ofono.h
index cab70cd..77567c2 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -25,12 +25,12 @@
 
 #include ofono/types.h
 
-void __ofono_exit();
+void __ofono_exit(void);
 
-int __ofono_manager_init();
-void __ofono_manager_cleanup();
+int __ofono_manager_init(void);
+void __ofono_manager_cleanup(void);
 
-void __ofono_modem_shutdown();
+void __ofono_modem_shutdown(void);
 
 #include ofono/log.h
 
@@ -174,8 +174,8 @@ void __ofono_atom_free(struct ofono_atom *atom);
 
 typedef void (*ofono_modemwatch_cb_t)(struct ofono_modem *modem,
gboolean added, void *data);
-void __ofono_modemwatch_init();
-void __ofono_modemwatch_cleanup();
+void __ofono_modemwatch_init(void);
+void __ofono_modemwatch_cleanup(void);
 unsigned int __ofono_modemwatch_add(ofono_modemwatch_cb_t cb, void *user,
ofono_destroy_func destroy);
 gboolean __ofono_modemwatch_remove(unsigned int id);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 06/16] huaweimodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/huaweimodem/audio-settings.c |4 ++--
 drivers/huaweimodem/gprs-context.c   |4 ++--
 drivers/huaweimodem/huaweimodem.h|   16 
 drivers/huaweimodem/radio-settings.c |4 ++--
 drivers/huaweimodem/voicecall.c  |4 ++--
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/huaweimodem/audio-settings.c 
b/drivers/huaweimodem/audio-settings.c
index 305776f..46d4e44 100644
--- a/drivers/huaweimodem/audio-settings.c
+++ b/drivers/huaweimodem/audio-settings.c
@@ -119,12 +119,12 @@ static struct ofono_audio_settings_driver driver = {
.remove = huawei_audio_settings_remove,
 };
 
-void huawei_audio_settings_init()
+void huawei_audio_settings_init(void)
 {
ofono_audio_settings_driver_register(driver);
 }
 
-void huawei_audio_settings_exit()
+void huawei_audio_settings_exit(void)
 {
ofono_audio_settings_driver_unregister(driver);
 }
diff --git a/drivers/huaweimodem/gprs-context.c 
b/drivers/huaweimodem/gprs-context.c
index ef3d93c..30f423b 100644
--- a/drivers/huaweimodem/gprs-context.c
+++ b/drivers/huaweimodem/gprs-context.c
@@ -406,12 +406,12 @@ static struct ofono_gprs_context_driver driver = {
.deactivate_primary = huawei_gprs_deactivate_primary,
 };
 
-void huawei_gprs_context_init()
+void huawei_gprs_context_init(void)
 {
ofono_gprs_context_driver_register(driver);
 }
 
-void huawei_gprs_context_exit()
+void huawei_gprs_context_exit(void)
 {
ofono_gprs_context_driver_unregister(driver);
 }
diff --git a/drivers/huaweimodem/huaweimodem.h 
b/drivers/huaweimodem/huaweimodem.h
index 596aa08..f8323e3 100644
--- a/drivers/huaweimodem/huaweimodem.h
+++ b/drivers/huaweimodem/huaweimodem.h
@@ -21,14 +21,14 @@
 
 #include drivers/atmodem/atutil.h
 
-extern void huawei_voicecall_init();
-extern void huawei_voicecall_exit();
+extern void huawei_voicecall_init(void);
+extern void huawei_voicecall_exit(void);
 
-extern void huawei_audio_settings_init();
-extern void huawei_audio_settings_exit();
+extern void huawei_audio_settings_init(void);
+extern void huawei_audio_settings_exit(void);
 
-extern void huawei_radio_settings_init();
-extern void huawei_radio_settings_exit();
+extern void huawei_radio_settings_init(void);
+extern void huawei_radio_settings_exit(void);
 
-extern void huawei_gprs_context_init();
-extern void huawei_gprs_context_exit();
+extern void huawei_gprs_context_init(void);
+extern void huawei_gprs_context_exit(void);
diff --git a/drivers/huaweimodem/radio-settings.c 
b/drivers/huaweimodem/radio-settings.c
index bece2cd..68112fe 100644
--- a/drivers/huaweimodem/radio-settings.c
+++ b/drivers/huaweimodem/radio-settings.c
@@ -404,12 +404,12 @@ static struct ofono_radio_settings_driver driver = {
.set_band   = huawei_set_band,
 };
 
-void huawei_radio_settings_init()
+void huawei_radio_settings_init(void)
 {
ofono_radio_settings_driver_register(driver);
 }
 
-void huawei_radio_settings_exit()
+void huawei_radio_settings_exit(void)
 {
ofono_radio_settings_driver_unregister(driver);
 }
diff --git a/drivers/huaweimodem/voicecall.c b/drivers/huaweimodem/voicecall.c
index ff08124..0c0aaa1 100644
--- a/drivers/huaweimodem/voicecall.c
+++ b/drivers/huaweimodem/voicecall.c
@@ -508,12 +508,12 @@ static struct ofono_voicecall_driver driver = {
.release_specific   = huawei_release_specific,
 };
 
-void huawei_voicecall_init()
+void huawei_voicecall_init(void)
 {
ofono_voicecall_driver_register(driver);
 }
 
-void huawei_voicecall_exit()
+void huawei_voicecall_exit(void)
 {
ofono_voicecall_driver_unregister(driver);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 05/16] hfpmodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/hfpmodem/call-volume.c  |4 ++--
 drivers/hfpmodem/hfpmodem.h |   12 ++--
 drivers/hfpmodem/network-registration.c |4 ++--
 drivers/hfpmodem/voicecall.c|4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/hfpmodem/call-volume.c b/drivers/hfpmodem/call-volume.c
index f985175..19f57c4 100644
--- a/drivers/hfpmodem/call-volume.c
+++ b/drivers/hfpmodem/call-volume.c
@@ -226,12 +226,12 @@ static struct ofono_call_volume_driver driver = {
.mute   = NULL,
 };
 
-void hfp_call_volume_init()
+void hfp_call_volume_init(void)
 {
ofono_call_volume_driver_register(driver);
 }
 
-void hfp_call_volume_exit()
+void hfp_call_volume_exit(void)
 {
ofono_call_volume_driver_unregister(driver);
 }
diff --git a/drivers/hfpmodem/hfpmodem.h b/drivers/hfpmodem/hfpmodem.h
index bf5d563..fca1a9b 100644
--- a/drivers/hfpmodem/hfpmodem.h
+++ b/drivers/hfpmodem/hfpmodem.h
@@ -72,11 +72,11 @@ struct hfp_data {
gboolean agent_registered;
 };
 
-extern void hfp_netreg_init();
-extern void hfp_netreg_exit();
+extern void hfp_netreg_init(void);
+extern void hfp_netreg_exit(void);
 
-extern void hfp_call_volume_init();
-extern void hfp_call_volume_exit();
+extern void hfp_call_volume_init(void);
+extern void hfp_call_volume_exit(void);
 
-extern void hfp_voicecall_init();
-extern void hfp_voicecall_exit();
+extern void hfp_voicecall_init(void);
+extern void hfp_voicecall_exit(void);
diff --git a/drivers/hfpmodem/network-registration.c 
b/drivers/hfpmodem/network-registration.c
index 03ddc7b..273490e 100644
--- a/drivers/hfpmodem/network-registration.c
+++ b/drivers/hfpmodem/network-registration.c
@@ -348,12 +348,12 @@ static struct ofono_netreg_driver driver = {
.strength   = hfp_signal_strength,
 };
 
-void hfp_netreg_init()
+void hfp_netreg_init(void)
 {
ofono_netreg_driver_register(driver);
 }
 
-void hfp_netreg_exit()
+void hfp_netreg_exit(void)
 {
ofono_netreg_driver_unregister(driver);
 }
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 53ca4bd..4c8ee37 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -1174,12 +1174,12 @@ static struct ofono_voicecall_driver driver = {
.send_tones = hfp_send_dtmf
 };
 
-void hfp_voicecall_init()
+void hfp_voicecall_init(void)
 {
ofono_voicecall_driver_register(driver);
 }
 
-void hfp_voicecall_exit()
+void hfp_voicecall_exit(void)
 {
ofono_voicecall_driver_unregister(driver);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 07/16] stemodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/stemodem/gprs-context.c   |4 ++--
 drivers/stemodem/radio-settings.c |4 ++--
 drivers/stemodem/stemodem.h   |   12 ++--
 drivers/stemodem/voicecall.c  |4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index 1762fb3..4325628 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -596,13 +596,13 @@ static struct ofono_gprs_context_driver driver = {
.deactivate_primary = ste_gprs_deactivate_primary,
 };
 
-void ste_gprs_context_init()
+void ste_gprs_context_init(void)
 {
caif_rtnl_init();
ofono_gprs_context_driver_register(driver);
 }
 
-void ste_gprs_context_exit()
+void ste_gprs_context_exit(void)
 {
ofono_gprs_context_driver_unregister(driver);
caif_rtnl_exit();
diff --git a/drivers/stemodem/radio-settings.c 
b/drivers/stemodem/radio-settings.c
index e65baf4..5b50126 100644
--- a/drivers/stemodem/radio-settings.c
+++ b/drivers/stemodem/radio-settings.c
@@ -220,12 +220,12 @@ static struct ofono_radio_settings_driver driver = {
.set_rat_mode   = ste_set_rat_mode
 };
 
-void ste_radio_settings_init()
+void ste_radio_settings_init(void)
 {
ofono_radio_settings_driver_register(driver);
 }
 
-void ste_radio_settings_exit()
+void ste_radio_settings_exit(void)
 {
ofono_radio_settings_driver_unregister(driver);
 }
diff --git a/drivers/stemodem/stemodem.h b/drivers/stemodem/stemodem.h
index b1691a2..f522ecd 100644
--- a/drivers/stemodem/stemodem.h
+++ b/drivers/stemodem/stemodem.h
@@ -22,11 +22,11 @@
 
 #include drivers/atmodem/atutil.h
 
-extern void ste_gprs_context_init();
-extern void ste_gprs_context_exit();
+extern void ste_gprs_context_init(void);
+extern void ste_gprs_context_exit(void);
 
-extern void ste_voicecall_init();
-extern void ste_voicecall_exit();
+extern void ste_voicecall_init(void);
+extern void ste_voicecall_exit(void);
 
-extern void ste_radio_settings_init();
-extern void ste_radio_settings_exit();
+extern void ste_radio_settings_init(void);
+extern void ste_radio_settings_exit(void);
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
index 99383cf..8f3533d 100644
--- a/drivers/stemodem/voicecall.c
+++ b/drivers/stemodem/voicecall.c
@@ -597,12 +597,12 @@ static struct ofono_voicecall_driver driver = {
.send_tones = ste_send_dtmf
 };
 
-void ste_voicecall_init()
+void ste_voicecall_init(void)
 {
ofono_voicecall_driver_register(driver);
 }
 
-void ste_voicecall_exit()
+void ste_voicecall_exit(void)
 {
ofono_voicecall_driver_unregister(driver);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 08/16] calypsomodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/calypsomodem/calypsomodem.h |8 
 drivers/calypsomodem/stk.c  |4 ++--
 drivers/calypsomodem/voicecall.c|4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/calypsomodem/calypsomodem.h 
b/drivers/calypsomodem/calypsomodem.h
index caf7a3d..47ebf34 100644
--- a/drivers/calypsomodem/calypsomodem.h
+++ b/drivers/calypsomodem/calypsomodem.h
@@ -21,8 +21,8 @@
 
 #include drivers/atmodem/atutil.h
 
-extern void calypso_voicecall_init();
-extern void calypso_voicecall_exit();
+extern void calypso_voicecall_init(void);
+extern void calypso_voicecall_exit(void);
 
-extern void calypso_stk_init();
-extern void calypso_stk_exit();
+extern void calypso_stk_init(void);
+extern void calypso_stk_exit(void);
diff --git a/drivers/calypsomodem/stk.c b/drivers/calypsomodem/stk.c
index 203cb9b..196b9e3 100644
--- a/drivers/calypsomodem/stk.c
+++ b/drivers/calypsomodem/stk.c
@@ -300,12 +300,12 @@ static struct ofono_stk_driver driver = {
.terminal_response  = calypso_stk_terminal_response,
 };
 
-void calypso_stk_init()
+void calypso_stk_init(void)
 {
ofono_stk_driver_register(driver);
 }
 
-void calypso_stk_exit()
+void calypso_stk_exit(void)
 {
ofono_stk_driver_unregister(driver);
 }
diff --git a/drivers/calypsomodem/voicecall.c b/drivers/calypsomodem/voicecall.c
index 0e6a388..f87e480 100644
--- a/drivers/calypsomodem/voicecall.c
+++ b/drivers/calypsomodem/voicecall.c
@@ -434,12 +434,12 @@ static struct ofono_voicecall_driver driver = {
.send_tones = calypso_send_dtmf
 };
 
-void calypso_voicecall_init()
+void calypso_voicecall_init(void)
 {
ofono_voicecall_driver_register(driver);
 }
 
-void calypso_voicecall_exit()
+void calypso_voicecall_exit(void)
 {
ofono_voicecall_driver_unregister(driver);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 11/16] nwmodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/nwmodem/nwmodem.h|4 ++--
 drivers/nwmodem/radio-settings.c |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nwmodem/nwmodem.h b/drivers/nwmodem/nwmodem.h
index 68a829b..e87f375 100644
--- a/drivers/nwmodem/nwmodem.h
+++ b/drivers/nwmodem/nwmodem.h
@@ -21,5 +21,5 @@
 
 #include drivers/atmodem/atutil.h
 
-extern void nw_radio_settings_init();
-extern void nw_radio_settings_exit();
+extern void nw_radio_settings_init(void);
+extern void nw_radio_settings_exit(void);
diff --git a/drivers/nwmodem/radio-settings.c b/drivers/nwmodem/radio-settings.c
index 36fab39..b8b5719 100644
--- a/drivers/nwmodem/radio-settings.c
+++ b/drivers/nwmodem/radio-settings.c
@@ -201,12 +201,12 @@ static struct ofono_radio_settings_driver driver = {
.set_rat_mode   = nw_set_rat_mode
 };
 
-void nw_radio_settings_init()
+void nw_radio_settings_init(void)
 {
ofono_radio_settings_driver_register(driver);
 }
 
-void nw_radio_settings_exit()
+void nw_radio_settings_exit(void)
 {
ofono_radio_settings_driver_unregister(driver);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 09/16] ifxmodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/ifxmodem/audio-settings.c |4 ++--
 drivers/ifxmodem/gprs-context.c   |4 ++--
 drivers/ifxmodem/ifxmodem.h   |   20 ++--
 drivers/ifxmodem/radio-settings.c |4 ++--
 drivers/ifxmodem/stk.c|4 ++--
 drivers/ifxmodem/voicecall.c  |4 ++--
 6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/ifxmodem/audio-settings.c 
b/drivers/ifxmodem/audio-settings.c
index 8273335..287221f 100644
--- a/drivers/ifxmodem/audio-settings.c
+++ b/drivers/ifxmodem/audio-settings.c
@@ -145,12 +145,12 @@ static struct ofono_audio_settings_driver driver = {
.remove = ifx_audio_settings_remove,
 };
 
-void ifx_audio_settings_init()
+void ifx_audio_settings_init(void)
 {
ofono_audio_settings_driver_register(driver);
 }
 
-void ifx_audio_settings_exit()
+void ifx_audio_settings_exit(void)
 {
ofono_audio_settings_driver_unregister(driver);
 }
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index fcfe698..2c68b44 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -489,12 +489,12 @@ static struct ofono_gprs_context_driver driver = {
.deactivate_primary = ifx_gprs_deactivate_primary,
 };
 
-void ifx_gprs_context_init()
+void ifx_gprs_context_init(void)
 {
ofono_gprs_context_driver_register(driver);
 }
 
-void ifx_gprs_context_exit()
+void ifx_gprs_context_exit(void)
 {
ofono_gprs_context_driver_unregister(driver);
 }
diff --git a/drivers/ifxmodem/ifxmodem.h b/drivers/ifxmodem/ifxmodem.h
index 8ea52e5..fbd3c06 100644
--- a/drivers/ifxmodem/ifxmodem.h
+++ b/drivers/ifxmodem/ifxmodem.h
@@ -21,17 +21,17 @@
 
 #include drivers/atmodem/atutil.h
 
-extern void ifx_voicecall_init();
-extern void ifx_voicecall_exit();
+extern void ifx_voicecall_init(void);
+extern void ifx_voicecall_exit(void);
 
-extern void ifx_audio_settings_init();
-extern void ifx_audio_settings_exit();
+extern void ifx_audio_settings_init(void);
+extern void ifx_audio_settings_exit(void);
 
-extern void ifx_radio_settings_init();
-extern void ifx_radio_settings_exit();
+extern void ifx_radio_settings_init(void);
+extern void ifx_radio_settings_exit(void);
 
-extern void ifx_gprs_context_init();
-extern void ifx_gprs_context_exit();
+extern void ifx_gprs_context_init(void);
+extern void ifx_gprs_context_exit(void);
 
-extern void ifx_stk_init();
-extern void ifx_stk_exit();
+extern void ifx_stk_init(void);
+extern void ifx_stk_exit(void);
diff --git a/drivers/ifxmodem/radio-settings.c 
b/drivers/ifxmodem/radio-settings.c
index 2ec94f1..fd590ae 100644
--- a/drivers/ifxmodem/radio-settings.c
+++ b/drivers/ifxmodem/radio-settings.c
@@ -204,12 +204,12 @@ static struct ofono_radio_settings_driver driver = {
.set_rat_mode   = ifx_set_rat_mode
 };
 
-void ifx_radio_settings_init()
+void ifx_radio_settings_init(void)
 {
ofono_radio_settings_driver_register(driver);
 }
 
-void ifx_radio_settings_exit()
+void ifx_radio_settings_exit(void)
 {
ofono_radio_settings_driver_unregister(driver);
 }
diff --git a/drivers/ifxmodem/stk.c b/drivers/ifxmodem/stk.c
index 6494c4d..1a1805c 100644
--- a/drivers/ifxmodem/stk.c
+++ b/drivers/ifxmodem/stk.c
@@ -306,12 +306,12 @@ static struct ofono_stk_driver driver = {
.terminal_response  = ifx_stk_terminal_response,
 };
 
-void ifx_stk_init()
+void ifx_stk_init(void)
 {
ofono_stk_driver_register(driver);
 }
 
-void ifx_stk_exit()
+void ifx_stk_exit(void)
 {
ofono_stk_driver_unregister(driver);
 }
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index d43e6f9..f673624 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -771,12 +771,12 @@ static struct ofono_voicecall_driver driver = {
.send_tones = ifx_send_dtmf
 };
 
-void ifx_voicecall_init()
+void ifx_voicecall_init(void)
 {
ofono_voicecall_driver_register(driver);
 }
 
-void ifx_voicecall_exit()
+void ifx_voicecall_exit(void)
 {
ofono_voicecall_driver_unregister(driver);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 12/16] isimodem: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 drivers/isimodem/audio-settings.c   |4 +-
 drivers/isimodem/call-barring.c |4 +-
 drivers/isimodem/call-forwarding.c  |4 +-
 drivers/isimodem/call-meter.c   |4 +-
 drivers/isimodem/call-settings.c|4 +-
 drivers/isimodem/cbs.c  |4 +-
 drivers/isimodem/devinfo.c  |4 +-
 drivers/isimodem/gprs-context.c |4 +-
 drivers/isimodem/isimodem.h |   68 +++---
 drivers/isimodem/network-registration.c |4 +-
 drivers/isimodem/phonebook.c|4 +-
 drivers/isimodem/radio-settings.c   |4 +-
 drivers/isimodem/sim.c  |4 +-
 drivers/isimodem/sms.c  |4 +-
 drivers/isimodem/ssn.c  |4 +-
 drivers/isimodem/ussd.c |4 +-
 drivers/isimodem/voicecall.c|4 +-
 17 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/drivers/isimodem/audio-settings.c 
b/drivers/isimodem/audio-settings.c
index fa17747..65c596b 100644
--- a/drivers/isimodem/audio-settings.c
+++ b/drivers/isimodem/audio-settings.c
@@ -121,12 +121,12 @@ static struct ofono_audio_settings_driver driver = {
.remove = isi_audio_settings_remove,
 };
 
-void isi_audio_settings_init()
+void isi_audio_settings_init(void)
 {
ofono_audio_settings_driver_register(driver);
 }
 
-void isi_audio_settings_exit()
+void isi_audio_settings_exit(void)
 {
ofono_audio_settings_driver_unregister(driver);
 }
diff --git a/drivers/isimodem/call-barring.c b/drivers/isimodem/call-barring.c
index 26ca545..a78b762 100644
--- a/drivers/isimodem/call-barring.c
+++ b/drivers/isimodem/call-barring.c
@@ -388,12 +388,12 @@ static struct ofono_call_barring_driver driver = {
.set_passwd = isi_set_passwd
 };
 
-void isi_call_barring_init()
+void isi_call_barring_init(void)
 {
ofono_call_barring_driver_register(driver);
 }
 
-void isi_call_barring_exit()
+void isi_call_barring_exit(void)
 {
ofono_call_barring_driver_unregister(driver);
 }
diff --git a/drivers/isimodem/call-forwarding.c 
b/drivers/isimodem/call-forwarding.c
index 3a98449..2fafb26 100644
--- a/drivers/isimodem/call-forwarding.c
+++ b/drivers/isimodem/call-forwarding.c
@@ -480,12 +480,12 @@ static struct ofono_call_forwarding_driver driver = {
.query  = isi_query
 };
 
-void isi_call_forwarding_init()
+void isi_call_forwarding_init(void)
 {
ofono_call_forwarding_driver_register(driver);
 }
 
-void isi_call_forwarding_exit()
+void isi_call_forwarding_exit(void)
 {
ofono_call_forwarding_driver_unregister(driver);
 }
diff --git a/drivers/isimodem/call-meter.c b/drivers/isimodem/call-meter.c
index 66dae47..04a3c10 100644
--- a/drivers/isimodem/call-meter.c
+++ b/drivers/isimodem/call-meter.c
@@ -131,12 +131,12 @@ static struct ofono_call_meter_driver driver = {
.puct_set   = isi_puct_set
 };
 
-void isi_call_meter_init()
+void isi_call_meter_init(void)
 {
ofono_call_meter_driver_register(driver);
 }
 
-void isi_call_meter_exit()
+void isi_call_meter_exit(void)
 {
ofono_call_meter_driver_unregister(driver);
 }
diff --git a/drivers/isimodem/call-settings.c b/drivers/isimodem/call-settings.c
index 51a761f..89270e9 100644
--- a/drivers/isimodem/call-settings.c
+++ b/drivers/isimodem/call-settings.c
@@ -311,12 +311,12 @@ static struct ofono_call_settings_driver driver = {
.cw_set = isi_cw_set
 };
 
-void isi_call_settings_init()
+void isi_call_settings_init(void)
 {
ofono_call_settings_driver_register(driver);
 }
 
-void isi_call_settings_exit()
+void isi_call_settings_exit(void)
 {
ofono_call_settings_driver_unregister(driver);
 }
diff --git a/drivers/isimodem/cbs.c b/drivers/isimodem/cbs.c
index 871e0ea..b969c1f 100644
--- a/drivers/isimodem/cbs.c
+++ b/drivers/isimodem/cbs.c
@@ -219,12 +219,12 @@ static struct ofono_cbs_driver driver = {
.clear_topics   = isi_clear_topics
 };
 
-void isi_cbs_init()
+void isi_cbs_init(void)
 {
ofono_cbs_driver_register(driver);
 }
 
-void isi_cbs_exit()
+void isi_cbs_exit(void)
 {
ofono_cbs_driver_unregister(driver);
 }
diff --git a/drivers/isimodem/devinfo.c b/drivers/isimodem/devinfo.c
index bb30730..3bf05f4 100644
--- a/drivers/isimodem/devinfo.c
+++ b/drivers/isimodem/devinfo.c
@@ -260,12 +260,12 @@ static struct ofono_devinfo_driver driver = {
.query_serial   = isi_query_serial
 };
 
-void isi_devinfo_init()
+void isi_devinfo_init(void)
 {
ofono_devinfo_driver_register(driver);
 }
 
-void isi_devinfo_exit()
+void isi_devinfo_exit(void)
 {
ofono_devinfo_driver_unregister(driver);
 }
diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c
index bfb496c..6d579d8 100644
--- a/drivers/isimodem/gprs-context.c
+++ b/drivers/isimodem/gprs-context.c
@@ -622,12 +622,12 @@ static struct 

[PATCH 16/16] gatchat: M15 coding styles fixes

2011-01-12 Thread Jeevaka Badrappan
---
 gatchat/gatsyntax.c   |4 ++--
 gatchat/gatsyntax.h   |4 ++--
 gatchat/gsmdial.c |4 ++--
 gatchat/test-server.c |4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gatchat/gatsyntax.c b/gatchat/gatsyntax.c
index f5a409b..2fc70b8 100644
--- a/gatchat/gatsyntax.c
+++ b/gatchat/gatsyntax.c
@@ -332,12 +332,12 @@ GAtSyntax *g_at_syntax_new_full(GAtSyntaxFeedFunc feed,
 }
 
 
-GAtSyntax *g_at_syntax_new_gsmv1()
+GAtSyntax *g_at_syntax_new_gsmv1(void)
 {
return g_at_syntax_new_full(gsmv1_feed, gsmv1_hint, GSMV1_STATE_IDLE);
 }
 
-GAtSyntax *g_at_syntax_new_gsm_permissive()
+GAtSyntax *g_at_syntax_new_gsm_permissive(void)
 {
return g_at_syntax_new_full(gsm_permissive_feed, gsm_permissive_hint,
GSM_PERMISSIVE_STATE_IDLE);
diff --git a/gatchat/gatsyntax.h b/gatchat/gatsyntax.h
index d76cf6f..afc0bd3 100644
--- a/gatchat/gatsyntax.h
+++ b/gatchat/gatsyntax.h
@@ -69,13 +69,13 @@ GAtSyntax *g_at_syntax_new_full(GAtSyntaxFeedFunc feed,
  * properly and can be used to detect a modem's deviations from the relevant
  * standards.
  */
-GAtSyntax *g_at_syntax_new_gsmv1();
+GAtSyntax *g_at_syntax_new_gsmv1(void);
 
 /* This syntax implements an extremely lax parser that can handle a variety
  * of modems.  Unfortunately it does not deal with echo at all, so echo must
  * be explicitly turned off before using the parser
  */
-GAtSyntax *g_at_syntax_new_gsm_permissive();
+GAtSyntax *g_at_syntax_new_gsm_permissive(void);
 
 GAtSyntax *g_at_syntax_ref(GAtSyntax *syntax);
 void g_at_syntax_unref(GAtSyntax *syntax);
diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
index 22ff2ff..1be80e3 100644
--- a/gatchat/gsmdial.c
+++ b/gatchat/gsmdial.c
@@ -509,7 +509,7 @@ static void check_mode(gboolean ok, GAtResult *result, 
gpointer user_data)
g_at_chat_send(control, AT+CFUN=1, NULL, check_pin, NULL, NULL);
 }
 
-static int open_serial()
+static int open_serial(void)
 {
GAtSyntax *syntax;
GIOChannel *channel;
@@ -551,7 +551,7 @@ static int open_serial()
return 0;
 }
 
-static int open_ip()
+static int open_ip(void)
 {
int sk, err;
struct sockaddr_in addr;
diff --git a/gatchat/test-server.c b/gatchat/test-server.c
index cb451e9..ffe59d7 100644
--- a/gatchat/test-server.c
+++ b/gatchat/test-server.c
@@ -67,7 +67,7 @@ static GAtServer *server;
 static GAtPPP *ppp;
 unsigned int server_watch;
 
-static gboolean server_cleanup()
+static gboolean server_cleanup(void)
 {
if (server_watch)
g_source_remove(server_watch);
@@ -1090,7 +1090,7 @@ static gboolean signal_cb(GIOChannel *channel, 
GIOCondition cond, gpointer data)
return TRUE;
 }
 
-static int create_signal_io()
+static int create_signal_io(void)
 {
sigset_t mask;
GIOChannel *signal_io;
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 14/16] plugins: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 plugins/bluetooth.h |2 +-
 plugins/hfp.c   |6 +++---
 plugins/push-notification.c |4 ++--
 plugins/smart-messaging.c   |4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index f187529..42b0d13 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -35,7 +35,7 @@ struct bluetooth_profile {
const char *name;
int (*create)(const char *device, const char *dev_addr,
const char *adapter_addr, const char *alias);
-   void (*remove_all)();
+   void (*remove_all)(void);
void (*set_alias)(const char *device, const char *);
 };
 
diff --git a/plugins/hfp.c b/plugins/hfp.c
index d8d30b0..12d3457 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -453,7 +453,7 @@ static gboolean hfp_remove_each_modem(gpointer key, 
gpointer value,
return TRUE;
 }
 
-static void hfp_remove_all_modem()
+static void hfp_remove_all_modem(void)
 {
if (modem_hash == NULL)
return;
@@ -682,7 +682,7 @@ static struct bluetooth_profile hfp_profile = {
.set_alias  = hfp_set_alias,
 };
 
-static int hfp_init()
+static int hfp_init(void)
 {
int err;
 
@@ -707,7 +707,7 @@ static int hfp_init()
return 0;
 }
 
-static void hfp_exit()
+static void hfp_exit(void)
 {
bluetooth_unregister_uuid(HFP_AG_UUID);
ofono_modem_driver_unregister(hfp_driver);
diff --git a/plugins/push-notification.c b/plugins/push-notification.c
index d910f70..218bf8c 100644
--- a/plugins/push-notification.c
+++ b/plugins/push-notification.c
@@ -224,7 +224,7 @@ static void call_modemwatch(struct ofono_modem *modem, void 
*user)
modem_watch(modem, TRUE, user);
 }
 
-static int push_notification_init()
+static int push_notification_init(void)
 {
DBG();
 
@@ -235,7 +235,7 @@ static int push_notification_init()
return 0;
 }
 
-static void push_notification_exit()
+static void push_notification_exit(void)
 {
DBG();
 
diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c
index e7889f2..40af89f 100644
--- a/plugins/smart-messaging.c
+++ b/plugins/smart-messaging.c
@@ -345,7 +345,7 @@ static void call_modemwatch(struct ofono_modem *modem, void 
*user)
modem_watch(modem, TRUE, user);
 }
 
-static int smart_messaging_init()
+static int smart_messaging_init(void)
 {
DBG();
 
@@ -356,7 +356,7 @@ static int smart_messaging_init()
return 0;
 }
 
-static void smart_messaging_exit()
+static void smart_messaging_exit(void)
 {
DBG();
 
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 15/16] unit: M15 coding style fix

2011-01-12 Thread Jeevaka Badrappan
---
 unit/test-common.c  |6 +++---
 unit/test-idmap.c   |4 ++--
 unit/test-mux.c |8 
 unit/test-simutil.c |   14 +++---
 unit/test-sms.c |   26 +-
 unit/test-util.c|   20 ++--
 6 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/unit/test-common.c b/unit/test-common.c
index baed178..0ade9a0 100644
--- a/unit/test-common.c
+++ b/unit/test-common.c
@@ -56,7 +56,7 @@ static const char *invalid_strings[] = {
NULL
 };
 
-static void test_invalid()
+static void test_invalid(void)
 {
char *sc;
char *sia;
@@ -107,7 +107,7 @@ static const char *valid_strings[] = {
NULL
 };
 
-static void test_valid()
+static void test_valid(void)
 {
char *sc;
char *sia;
@@ -158,7 +158,7 @@ static const char *invalid_apns[] = {
NULL
 };
 
-static void test_apn()
+static void test_apn(void)
 {
int i;
gboolean res;
diff --git a/unit/test-idmap.c b/unit/test-idmap.c
index bf428f8..17e767c 100644
--- a/unit/test-idmap.c
+++ b/unit/test-idmap.c
@@ -27,7 +27,7 @@
 
 #include idmap.h
 
-static void test_alloc()
+static void test_alloc(void)
 {
struct idmap *idmap;
unsigned int bit;
@@ -65,7 +65,7 @@ static void test_alloc()
idmap_free(idmap);
 }
 
-static void test_alloc_next()
+static void test_alloc_next(void)
 {
struct idmap *idmap;
unsigned int bit;
diff --git a/unit/test-mux.c b/unit/test-mux.c
index d0e2d32..2efa49d 100644
--- a/unit/test-mux.c
+++ b/unit/test-mux.c
@@ -280,7 +280,7 @@ static const guint8 basic_long_frame_result[] =
0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x88, 0xF9
 };
 
-static void test_fill_basic()
+static void test_fill_basic(void)
 {
guint8 control_frame[6];
guint8 data_frame[128];
@@ -327,7 +327,7 @@ static const guint8 advanced_quoted_data_result[] =
{ 0x7E, 0x07, 0xEF, 0x12, 0x34, 0x56, 0x7D, 0x5E, 0x78,
0x7D, 0x5D, 0x05, 0x7E };
 
-static void test_fill_advanced()
+static void test_fill_advanced(void)
 {
guint8 control_frame[8];
guint8 data_frame[128];
@@ -368,7 +368,7 @@ static int basic_frame_size = 7;
 
 static const guint8 basic_output[] = { 0x12, 0x34, 0x56 };
 
-static void test_extract_basic()
+static void test_extract_basic(void)
 {
int total = 0;
int nread;
@@ -467,7 +467,7 @@ static int advanced_frame_size = 6;
 
 static const guint8 advanced_output[] = { 0x12, 0x34, 0x56 };
 
-static void test_extract_advanced()
+static void test_extract_advanced(void)
 {
int total = 0;
int nread;
diff --git a/unit/test-simutil.c b/unit/test-simutil.c
index 155cddd..7cb5c10 100644
--- a/unit/test-simutil.c
+++ b/unit/test-simutil.c
@@ -80,12 +80,12 @@ static void test_buffer(const unsigned char *buf, size_t 
size)
g_assert(ber_tlv_iter_next(iter) == FALSE);
 }
 
-static void test_ber_tlv_iter()
+static void test_ber_tlv_iter(void)
 {
test_buffer(valid_mms_params, sizeof(valid_mms_params));
 }
 
-static void test_ber_tlv_builder_mms()
+static void test_ber_tlv_builder_mms(void)
 {
struct ber_tlv_iter top_iter, nested_iter;
struct ber_tlv_builder top_builder, nested_builder;
@@ -128,7 +128,7 @@ static void test_ber_tlv_builder_mms()
test_buffer(pdu, pdulen);
 }
 
-static void test_ber_tlv_builder_efpnn()
+static void test_ber_tlv_builder_efpnn(void)
 {
struct sim_eons *eons_info;
unsigned char efpnn0[64], efpnn1[64];
@@ -188,7 +188,7 @@ static void test_ber_tlv_builder_efpnn()
sim_eons_free(eons_info);
 }
 
-static void test_ber_tlv_builder_3g_status()
+static void test_ber_tlv_builder_3g_status(void)
 {
unsigned char buf[512];
struct ber_tlv_builder top_builder, nested_builder;
@@ -351,7 +351,7 @@ const unsigned char valid_efpnn[][28] = {
  0x53, 0x68, 0x6F, 0x72, 0x74, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }
 };
 
-static void test_eons()
+static void test_eons(void)
 {
const struct sim_eons_operator_info *op_info;
struct sim_eons *eons_info;
@@ -383,7 +383,7 @@ static void test_eons()
sim_eons_free(eons_info);
 }
 
-static void test_ef_db()
+static void test_ef_db(void)
 {
struct sim_ef_info *info;
 
@@ -405,7 +405,7 @@ static const char *binary_ef = 
62178202412183022F058A01058B032F060F8002000A
 static const char *record_ef = 62198205422100200483026F408A01058B036F0607
800200808800;
 
-static void test_3g_status_data()
+static void test_3g_status_data(void)
 {
unsigned char *response;
long len;
diff --git a/unit/test-sms.c b/unit/test-sms.c
index 134a4b1..abaed35 100644
--- a/unit/test-sms.c
+++ b/unit/test-sms.c
@@ -143,7 +143,7 @@ static void dump_details(struct sms *sms)
}
 }
 
-static void test_simple_deliver()
+static void test_simple_deliver(void)
 {
struct sms sms;
unsigned char *decoded_pdu;
@@ -214,7 +214,7 @@ static void 

[PATCH] Add CDIP support

2011-01-12 Thread Lucas De Marchi
With CDIP phonesim can tell the Called Line Identification within the
RING comand according to 27.007 section 7.9.
---
 src/callmanager.cpp   |   21 +++--
 src/callmanager.h |8 +---
 src/control.cpp   |8 ++--
 src/control.h |2 +-
 src/default.xml   |   19 +++
 src/hardwaremanipulator.h |2 +-
 src/phonesim.cpp  |4 ++--
 7 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index d746333..be17b83 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -326,6 +326,11 @@ void CallManager::emitRing(const CallInfo info)
 else
 str += \\n\\n+CLIP:  + QAtUtils::encodeNumber( info.number ) + 
0;
 
+if (info.calledNumber.isNull())
+;
+else
+str += \\n\\n+CDIP:  + QAtUtils::encodeNumber( info.calledNumber 
) + ,,,;
+
 if (info.name.isNull())
 ;
else if (info.name.isEmpty())
@@ -338,7 +343,8 @@ void CallManager::emitRing(const CallInfo info)
 }
 
 void CallManager::startIncomingCall( const QString number,
-   const QString name, bool dialBack )
+ const QString calledNumber,
+ const QString name, bool dialBack )
 {
 // Bail out if there is already an incoming call.
 if ( idForIncoming() = 0 ) {
@@ -356,6 +362,7 @@ void CallManager::startIncomingCall( const QString number,
 info.state = CallState_Incoming;
 }
 info.number = number;
+info.calledNumber = calledNumber;
 info.incoming = true;
 info.dialBack = dialBack;
 info.name = name;
@@ -371,9 +378,11 @@ void CallManager::startIncomingCall( const QString number,
 ringTimer-start(2000);
 }
 
-void CallManager::startIncomingCall( const QString number , const QString 
name )
+void CallManager::startIncomingCall( const QString number,
+ const QString calledNumber,
+ const QString name )
 {
-startIncomingCall( number, name, false );
+startIncomingCall( number, calledNumber, name, false );
 }
 
 void CallManager::hangupAll()
@@ -702,18 +711,18 @@ void CallManager::dialingToAlerting()
 
 void CallManager::dialBack()
 {
-startIncomingCall( 1234567, Alice, true );
+startIncomingCall( 1234567, 7654321, Alice, true );
 }
 
 void CallManager::dialBackWithHangup5()
 {
-startIncomingCall( 1234567, Bob, true );
+startIncomingCall( 1234567, 7654321, Bob, true );
 hangupTimer-start( 5000 );
 }
 
 void CallManager::dialBackWithHangup4()
 {
-startIncomingCall( 1234567, Mallory, true );
+startIncomingCall( 1234567, 7654321, Mallory, true );
 hangupTimer-start( 4000 );
 }
 
diff --git a/src/callmanager.h b/src/callmanager.h
index f29bdce..90cb9bd 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -39,6 +39,7 @@ struct CallInfo
 int id;
 CallState   state;
 QString number;
+QString calledNumber;
 boolincoming;
 booldialBack;
 QString name;
@@ -94,9 +95,10 @@ public:
 
 public slots:
 // Start an incoming call simulation.
-void startIncomingCall( const QString number, const QString name,
-   bool dialBack );
-void startIncomingCall( const QString number, const QString name );
+void startIncomingCall( const QString number, const QString calledNumber,
+const QString name, bool dialBack );
+void startIncomingCall( const QString number, const QString calledNumber,
+const QString name );
 
 signals:
 // Send a response to a command.
diff --git a/src/control.cpp b/src/control.cpp
index 68c5584..b70de30 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -119,7 +119,7 @@ Control::Control(const QString ruleFile, SimRules *sr, 
QObject *parent)
  SIGNAL(command(QString))
  SIGNAL(variableChanged(QString,QString))
  SIGNAL(switchTo(QString))
- SIGNAL(startIncomingCall(QString, QString));
+ SIGNAL(startIncomingCall(QString, QString, QString));
 
 foreach (QByteArray sig, proxySignals)
 connect(widget, sig, this, sig);
@@ -282,15 +282,19 @@ void ControlWidget::sendSMSDatagram()
 void ControlWidget::sendCall()
 {
 QString number;
+QString calledNumber;
 QString name;
 
 if (ui-cbCaller-isChecked())
 number = ui-leCaller-text();
 
+if (ui-cbCalledLine-isChecked())
+calledNumber = ui-leCalledLine-text();
+
 if (ui-cbCallerName-isChecked())
 name = ui-leCallerName-text();
 
-emit startIncomingCall( number, name );
+emit startIncomingCall( number, calledNumber, name );
 }
 
 void ControlWidget::handleFromData( const QString cmd )
diff --git a/src/control.h b/src/control.h
index 767baa3..2c14863 

[PATCH 0/9] Add cdip support

2011-01-12 Thread Lucas De Marchi
Following patches add support for cdip in oFono. It's implement in atmodem and
tested with phonesim.

As I understood from 27.007, this property only makes sense for incoming calls,
so the property in voicecall atom is only presented in this case (and if the
network actually sent this field).

Last patch is only a style fix.

Lucas De Marchi (9):
  include: add cdip field in ofono_call
  voicecall: add support for cdip
  atmodem: add cdip to voicecall
  doc: add CalledLineIdentification property to voicecall
  include: add method for querying cdip support
  call-settings: add support for cdip
  atmodem: add cdip to call-settings
  doc: add CalledLinePresentation property to CallSettings
  call-settings: apply rule M11 of coding style

 doc/call-settings-api.txt   |   15 ++
 doc/voicecall-api.txt   |9 +++
 drivers/atmodem/call-settings.c |   26 +
 drivers/atmodem/voicecall.c |   61 +-
 include/call-settings.h |2 +
 include/types.h |1 +
 src/call-settings.c |  107 ---
 src/voicecall.c |   38 +-
 8 files changed, 236 insertions(+), 23 deletions(-)

-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/9] include: add cdip field in ofono_call

2011-01-12 Thread Lucas De Marchi
---
 include/types.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/types.h b/include/types.h
index 9fd174d..769b8f0 100644
--- a/include/types.h
+++ b/include/types.h
@@ -99,6 +99,7 @@ struct ofono_call {
int status;
ofono_bool_t mpty;
struct ofono_phone_number phone_number;
+   struct ofono_phone_number called_number;
char name[OFONO_MAX_CALLER_NAME_LENGTH + 1];
int clip_validity;
int cnap_validity;
-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/9] atmodem: add cdip to voicecall

2011-01-12 Thread Lucas De Marchi
---
 drivers/atmodem/voicecall.c |   61 +-
 1 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 75e0c93..43989f2 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -60,6 +60,7 @@ static const char *atd_prefix[] = { +COLP:, NULL };
 
 #define FLAG_NEED_CLIP 1
 #define FLAG_NEED_CNAP 2
+#define FLAG_NEED_CDIP 4
 
 struct voicecall_data {
GSList *calls;
@@ -202,6 +203,12 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
nc-cnap_validity = oc-cnap_validity;
 
/*
+* CDIP doesn't arrive as part of CLCC, always
+* re-use from the old call
+*/
+   nc-called_number = oc-called_number;
+
+   /*
 * If the CLIP is not provided and the CLIP never
 * arrives, or RING is used, then signal the call
 * here
@@ -654,7 +661,7 @@ static void ring_notify(GAtResult *result, gpointer 
user_data)
 
/* We don't know the call type, we must run clcc */
vd-clcc_source = g_timeout_add(CLIP_INTERVAL, poll_clcc, vc);
-   vd-flags = FLAG_NEED_CLIP | FLAG_NEED_CNAP;
+   vd-flags = FLAG_NEED_CLIP | FLAG_NEED_CNAP | FLAG_NEED_CDIP;
 }
 
 static void cring_notify(GAtResult *result, gpointer user_data)
@@ -705,7 +712,7 @@ static void cring_notify(GAtResult *result, gpointer 
user_data)
 * earlier, we announce the call there
 */
vd-clcc_source = g_timeout_add(CLIP_INTERVAL, poll_clcc, vc);
-   vd-flags = FLAG_NEED_CLIP | FLAG_NEED_CNAP;
+   vd-flags = FLAG_NEED_CLIP | FLAG_NEED_CNAP | FLAG_NEED_CDIP;
 
DBG();
 }
@@ -771,6 +778,54 @@ static void clip_notify(GAtResult *result, gpointer 
user_data)
vd-flags = ~FLAG_NEED_CLIP;
 }
 
+static void cdip_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_voicecall *vc = user_data;
+   struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+   GAtResultIter iter;
+   const char *num;
+   int type;
+   GSList *l;
+   struct ofono_call *call;
+
+   l = g_slist_find_custom(vd-calls, GINT_TO_POINTER(4),
+   at_util_call_compare_by_status);
+   if (l == NULL) {
+   ofono_error(CDIP for unknown call);
+   return;
+   }
+
+   /* We have already saw a CDIP for this call, no need to parse again */
+   if ((vd-flags  FLAG_NEED_CDIP) == 0)
+   return;
+
+   g_at_result_iter_init(iter, result);
+
+   if (!g_at_result_iter_next(iter, +CDIP:))
+   return;
+
+   if (!g_at_result_iter_next_string(iter, num))
+   return;
+
+   if (!g_at_result_iter_next_number(iter, type))
+   return;
+
+   DBG(%s %d, num, type);
+
+   call = l-data;
+
+   strncpy(call-called_number.number, num,
+   OFONO_MAX_PHONE_NUMBER_LENGTH);
+   call-called_number.number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
+   call-called_number.type = type;
+
+   /* Only signal the call here if we already signaled it to the core */
+   if (call-type == 0  (vd-flags  FLAG_NEED_CLIP) == 0)
+   ofono_voicecall_notify(vc, call);
+
+   vd-flags = ~FLAG_NEED_CDIP;
+}
+
 static void cnap_notify(GAtResult *result, gpointer user_data)
 {
struct ofono_voicecall *vc = user_data;
@@ -942,6 +997,7 @@ static void at_voicecall_initialized(gboolean ok, GAtResult 
*result,
g_at_chat_register(vd-chat, RING, ring_notify, FALSE, vc, NULL);
g_at_chat_register(vd-chat, +CRING:, cring_notify, FALSE, vc, NULL);
g_at_chat_register(vd-chat, +CLIP:, clip_notify, FALSE, vc, NULL);
+   g_at_chat_register(vd-chat, +CDIP:, cdip_notify, FALSE, vc, NULL);
g_at_chat_register(vd-chat, +CNAP:, cnap_notify, FALSE, vc, NULL);
g_at_chat_register(vd-chat, +CCWA:, ccwa_notify, FALSE, vc, NULL);
 
@@ -978,6 +1034,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, 
unsigned int vendor,
 
g_at_chat_send(vd-chat, AT+CRC=1, NULL, NULL, NULL, NULL);
g_at_chat_send(vd-chat, AT+CLIP=1, NULL, NULL, NULL, NULL);
+   g_at_chat_send(vd-chat, AT+CDIP=1, NULL, NULL, NULL, NULL);
g_at_chat_send(vd-chat, AT+CNAP=1, NULL, NULL, NULL, NULL);
g_at_chat_send(vd-chat, AT+COLP=1, NULL, NULL, NULL, NULL);
g_at_chat_send(vd-chat, AT+VTD?, NULL,
-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 5/9] include: add method for querying cdip support

2011-01-12 Thread Lucas De Marchi
---
 include/call-settings.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/call-settings.h b/include/call-settings.h
index c1ff668..55300ab 100644
--- a/include/call-settings.h
+++ b/include/call-settings.h
@@ -48,6 +48,8 @@ struct ofono_call_settings_driver {
ofono_call_settings_status_cb_t cb, void *data);
void (*cnap_query)(struct ofono_call_settings *cs,
ofono_call_settings_status_cb_t cb, void *data);
+   void (*cdip_query)(struct ofono_call_settings *cs,
+   ofono_call_settings_status_cb_t cb, void *data);
void (*colp_query)(struct ofono_call_settings *cs,
ofono_call_settings_status_cb_t cb, void *data);
void (*clir_query)(struct ofono_call_settings *cs,
-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 6/9] call-settings: add support for cdip

2011-01-12 Thread Lucas De Marchi
---
 src/call-settings.c |   73 +-
 1 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/src/call-settings.c b/src/call-settings.c
index 4dac2b6..0214abf 100644
--- a/src/call-settings.c
+++ b/src/call-settings.c
@@ -69,6 +69,13 @@ enum colp_status {
COLP_STATUS_UNKNOWN = 2
 };
 
+/* 27.007 Section 7.9 */
+enum cdip_status {
+   CDIP_STATUS_NOT_PROVISIONED =   0,
+   CDIP_STATUS_PROVISIONED =   1,
+   CDIP_STATUS_UNKNOWN =   2
+};
+
 /* This is not defined in 27.007, but presumably the same as CLIP/COLP */
 enum colr_status {
COLR_STATUS_NOT_PROVISIONED = 0,
@@ -79,6 +86,7 @@ enum colr_status {
 enum call_setting_type {
CALL_SETTING_TYPE_CLIP = 0,
CALL_SETTING_TYPE_CNAP,
+   CALL_SETTING_TYPE_CDIP,
CALL_SETTING_TYPE_COLP,
CALL_SETTING_TYPE_COLR,
CALL_SETTING_TYPE_CLIR,
@@ -90,6 +98,7 @@ struct ofono_call_settings {
int colr;
int clip;
int cnap;
+   int cdip;
int colp;
int clir_setting;
int cw;
@@ -117,6 +126,18 @@ static const char *clip_status_to_string(int status)
return unknown;
 }
 
+static const char *cdip_status_to_string(int status)
+{
+   switch (status) {
+   case CDIP_STATUS_NOT_PROVISIONED:
+   return disabled;
+   case CDIP_STATUS_PROVISIONED:
+   return enabled;
+   }
+
+   return unknown;
+}
+
 static const char *cnap_status_to_string(int status)
 {
switch (status) {
@@ -227,6 +248,28 @@ static void set_clir_override(struct ofono_call_settings 
*cs, int override)
DBUS_TYPE_STRING, str);
 }
 
+static void set_cdip(struct ofono_call_settings *cs, int cdip)
+{
+   DBusConnection *conn;
+   const char *path;
+   const char *str;
+
+   if (cs-cdip == cdip)
+   return;
+
+   cs-cdip = cdip;
+
+   conn = ofono_dbus_get_connection();
+   path = __ofono_atom_get_path(cs-atom);
+
+   str = cdip_status_to_string(cdip);
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_CALL_SETTINGS_INTERFACE,
+   CalledLinePresentation,
+   DBUS_TYPE_STRING, str);
+}
+
 static void set_clip(struct ofono_call_settings *cs, int clip)
 {
DBusConnection *conn;
@@ -882,6 +925,10 @@ static DBusMessage *generate_get_properties_reply(struct 
ofono_call_settings *cs
ofono_dbus_dict_append(dict, ConnectedLineRestriction,
DBUS_TYPE_STRING, str);
 
+   str = cdip_status_to_string(cs-cdip);
+   ofono_dbus_dict_append(dict, CalledLinePresentation,
+   DBUS_TYPE_STRING, str);
+
str = clir_status_to_string(cs-clir);
ofono_dbus_dict_append(dict, CallingLineRestriction,
DBUS_TYPE_STRING, str);
@@ -934,6 +981,28 @@ static void query_clir(struct ofono_call_settings *cs)
cs-driver-clir_query(cs, cs_clir_callback, cs);
 }
 
+static void cs_cdip_callback(const struct ofono_error *error,
+   int state, void *data)
+{
+   struct ofono_call_settings *cs = data;
+
+   if (error-type == OFONO_ERROR_TYPE_NO_ERROR)
+   set_cdip(cs, state);
+
+   query_clir(cs);
+}
+
+static void query_cdip(struct ofono_call_settings *cs)
+{
+   if (cs-driver-cdip_query == NULL) {
+   query_clir(cs);
+   return;
+   }
+
+   cs-driver-cdip_query(cs, cs_cdip_callback, cs);
+}
+
+
 static void cs_cnap_callback(const struct ofono_error *error,
int state, void *data)
 {
@@ -942,13 +1011,13 @@ static void cs_cnap_callback(const struct ofono_error 
*error,
if (error-type == OFONO_ERROR_TYPE_NO_ERROR)
set_cnap(cs, state);
 
-   query_clir(cs);
+   query_cdip(cs);
 }
 
 static void query_cnap(struct ofono_call_settings *cs)
 {
if (cs-driver-cnap_query == NULL) {
-   query_clir(cs);
+   query_cdip(cs);
return;
}
 
-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 7/9] atmodem: add cdip to call-settings

2011-01-12 Thread Lucas De Marchi
---
 drivers/atmodem/call-settings.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/call-settings.c b/drivers/atmodem/call-settings.c
index 3340d5a..2529c8e 100644
--- a/drivers/atmodem/call-settings.c
+++ b/drivers/atmodem/call-settings.c
@@ -46,6 +46,7 @@ static const char *clip_prefix[] = { +CLIP:, NULL };
 static const char *ccwa_prefix[] = { +CCWA:, NULL };
 static const char *colr_prefix[] = { +COLR:, NULL };
 static const char *cnap_prefix[] = { +CNAP:, NULL };
+static const char *cdip_prefix[] = { +CDIP:, NULL };
 
 static void ccwa_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
@@ -199,6 +200,30 @@ error:
CALLBACK_WITH_FAILURE(cb, -1, data);
 }
 
+static void cdip_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   query_template(+CDIP:, ok, result, user_data);
+}
+
+static void at_cdip_query(struct ofono_call_settings *cs,
+   ofono_call_settings_status_cb_t cb, void *data)
+{
+   GAtChat *chat = ofono_call_settings_get_data(cs);
+   struct cb_data *cbd = cb_data_new(cb, data);
+
+   if (cbd == NULL)
+   goto error;
+
+   if (g_at_chat_send(chat, AT+CDIP?, cdip_prefix,
+   cdip_query_cb, cbd, g_free)  0)
+   return;
+
+error:
+   g_free(cbd);
+
+   CALLBACK_WITH_FAILURE(cb, -1, data);
+}
+
 static void cnap_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
query_template(+CNAP:, ok, result, user_data);
@@ -387,6 +412,7 @@ static struct ofono_call_settings_driver driver = {
.remove = at_call_settings_remove,
.clip_query = at_clip_query,
.cnap_query = at_cnap_query,
+   .cdip_query = at_cdip_query,
.colp_query = at_colp_query,
.clir_query = at_clir_query,
.clir_set = at_clir_set,
-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 8/9] doc: add CalledLinePresentation property to CallSettings

2011-01-12 Thread Lucas De Marchi
---
 doc/call-settings-api.txt |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/doc/call-settings-api.txt b/doc/call-settings-api.txt
index b6dc1cc..44e0dbb 100644
--- a/doc/call-settings-api.txt
+++ b/doc/call-settings-api.txt
@@ -30,6 +30,21 @@ Properties   string CallingLinePresentation [readonly]
enabled,
unknown
 
+Properties string CalledLinePresentation [readonly]
+
+   Contains the value of the called line identification
+   presentation property.  The value indicates the state
+   of the CDIP supplementary service in the network.  If
+   enabled, when receiving a call the network will provide
+   the identification dialed to makee this call.  This is
+   useful when subscriber can be registered with more than
+   one identification.
+
+   Possible values are:
+   disabled,
+   enabled,
+   unknown
+
string CallingNamePresentation [readonly]
 
Contains the value of the calling name identification
-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 9/9] call-settings: apply rule M11 of coding style

2011-01-12 Thread Lucas De Marchi
---
 src/call-settings.c |   34 +-
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/call-settings.c b/src/call-settings.c
index 0214abf..109f130 100644
--- a/src/call-settings.c
+++ b/src/call-settings.c
@@ -41,32 +41,32 @@ static GSList *g_drivers = NULL;
 
 /* 27.007 Section 7.7 */
 enum clir_status {
-   CLIR_STATUS_NOT_PROVISIONED = 0,
-   CLIR_STATUS_PROVISIONED_PERMANENT,
-   CLIR_STATUS_UNKNOWN,
-   CLIR_STATUS_TEMPORARY_RESTRICTED,
-   CLIR_STATUS_TEMPORARY_ALLOWED
+   CLIR_STATUS_NOT_PROVISIONED =   0,
+   CLIR_STATUS_PROVISIONED_PERMANENT = 1,
+   CLIR_STATUS_UNKNOWN =   2,
+   CLIR_STATUS_TEMPORARY_RESTRICTED =  3,
+   CLIR_STATUS_TEMPORARY_ALLOWED = 4
 };
 
 /* 27.007 Section 7.6 */
 enum clip_status {
-   CLIP_STATUS_NOT_PROVISIONED = 0,
-   CLIP_STATUS_PROVISIONED,
-   CLIP_STATUS_UNKNOWN
+   CLIP_STATUS_NOT_PROVISIONED =   0,
+   CLIP_STATUS_PROVISIONED =   1,
+   CLIP_STATUS_UNKNOWN =   2
 };
 
 /* 27.007 Section 7.30 */
 enum cnap_status {
-   CNAP_STATUS_NOT_PROVISIONED = 0,
-   CNAP_STATUS_PROVISIONED,
-   CNAP_STATUS_UNKNOWN
+   CNAP_STATUS_NOT_PROVISIONED =   0,
+   CNAP_STATUS_PROVISIONED =   1,
+   CNAP_STATUS_UNKNOWN =   2
 };
 
 /* 27.007 Section 7.8 */
 enum colp_status {
-   COLP_STATUS_NOT_PROVISIONED = 0,
-   COLP_STATUS_PROVISIONED = 1,
-   COLP_STATUS_UNKNOWN = 2
+   COLP_STATUS_NOT_PROVISIONED =   0,
+   COLP_STATUS_PROVISIONED =   1,
+   COLP_STATUS_UNKNOWN =   2
 };
 
 /* 27.007 Section 7.9 */
@@ -78,9 +78,9 @@ enum cdip_status {
 
 /* This is not defined in 27.007, but presumably the same as CLIP/COLP */
 enum colr_status {
-   COLR_STATUS_NOT_PROVISIONED = 0,
-   COLR_STATUS_PROVISIONED = 1,
-   COLR_STATUS_UNKNOWN = 2
+   COLR_STATUS_NOT_PROVISIONED =   0,
+   COLR_STATUS_PROVISIONED =   1,
+   COLR_STATUS_UNKNOWN =   2
 };
 
 enum call_setting_type {
-- 
1.7.3.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/5 v3] Cell-info: Atom for obtaining ECID info of cells

2011-01-12 Thread Antti Paila
---
 src/cell-info.c |  485 +++
 1 files changed, 485 insertions(+), 0 deletions(-)
 create mode 100644 src/cell-info.c

diff --git a/src/cell-info.c b/src/cell-info.c
new file mode 100644
index 000..0ba6658
--- /dev/null
+++ b/src/cell-info.c
@@ -0,0 +1,485 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#include errno.h
+
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+
+#include common.h
+#include ofono/cell-info.h
+
+
+struct ofono_cell_info {
+   DBusMessage *pending;
+   struct ofono_atom *atom;
+   const struct ofono_cell_info_driver *driver;
+   void *driver_data;
+};
+
+
+static DBusMessage *ci_get_cells(DBusConnection *, DBusMessage *, void *);
+
+static GSList *g_drivers = NULL;
+
+static GDBusMethodTable ci_methods[] = {
+   { GetNeighbors,   , aa{sv},   ci_get_cells,
+   G_DBUS_METHOD_FLAG_ASYNC },
+   { }
+};
+
+static GDBusSignalTable ci_signals[] = {
+   { }
+};
+
+int ofono_cell_info_driver_register(struct ofono_cell_info_driver *driver)
+{
+   DBG(driver: %p, name: %s, driver, driver-name);
+
+   if (driver-probe == NULL)
+   return -EINVAL;
+
+   g_drivers = g_slist_prepend(g_drivers, (void *) driver);
+
+   return 0;
+}
+
+void ofono_cell_info_driver_unregister(struct ofono_cell_info_driver *driver)
+{
+   DBG(driver: %p, name: %s, driver, driver-name);
+
+   g_drivers = g_slist_remove(g_drivers, (void *) driver);
+}
+
+void ofono_cell_info_remove(struct ofono_cell_info *ci)
+{
+   __ofono_atom_free(ci-atom);
+}
+
+static void cell_info_unregister(struct ofono_atom *atom)
+{
+   struct ofono_cell_info *ci = __ofono_atom_get_data(atom);
+   const char *path = __ofono_atom_get_path(ci-atom);
+   DBusConnection *conn = ofono_dbus_get_connection();
+   struct ofono_modem *modem = __ofono_atom_get_modem(ci-atom);
+
+   ofono_modem_remove_interface(modem, OFONO_CELL_INFO_INTERFACE);
+
+   if (!g_dbus_unregister_interface(conn, path, OFONO_CELL_INFO_INTERFACE))
+   ofono_error(Failed to unregister interface %s,
+   OFONO_CELL_INFO_INTERFACE);
+}
+
+static void cell_info_remove(struct ofono_atom *atom)
+{
+   struct ofono_cell_info *ci = __ofono_atom_get_data(atom);
+   DBG(atom: %p, atom);
+
+   if (ci == NULL)
+   return;
+
+   if (ci-driver  ci-driver-remove)
+   ci-driver-remove(ci);
+
+   g_free(ci);
+}
+
+void ofono_cell_info_register(struct ofono_cell_info *ci)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   struct ofono_modem *modem = __ofono_atom_get_modem(ci-atom);
+   const char *path = __ofono_atom_get_path(ci-atom);
+
+   DBG(Modem: %p, modem);
+
+   if (!g_dbus_register_interface(conn, path,
+   OFONO_CELL_INFO_INTERFACE,
+   ci_methods, ci_signals, NULL,
+   ci, NULL)) {
+   ofono_error(Could not create %s interface,
+   OFONO_CELL_INFO_INTERFACE);
+
+   return;
+   }
+
+   ofono_modem_add_interface(modem, OFONO_CELL_INFO_INTERFACE);
+
+   __ofono_atom_register(ci-atom, cell_info_unregister);
+}
+
+struct ofono_cell_info *ofono_cell_info_create(struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver,
+   void *data)
+{
+   struct ofono_cell_info *ci;
+   GSList *l;
+
+   if (driver == NULL)
+   return NULL;
+
+   ci = g_try_new0(struct ofono_cell_info, 1);
+   if (ci == NULL)
+   return NULL;
+
+   ci-atom = __ofono_modem_add_atom(modem,
+   OFONO_ATOM_TYPE_CELL_INFO,
+   cell_info_remove, ci);
+
+   for (l = g_drivers; l; l = l-next) {
+   const struct ofono_cell_info_driver *drv = l-data;
+
+   if 

[PATCH 5/5 v3] Cell-info: Documentation

2011-01-12 Thread Antti Paila
---
 doc/cell-info.txt |  121 +
 1 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 doc/cell-info.txt

diff --git a/doc/cell-info.txt b/doc/cell-info.txt
new file mode 100644
index 000..64d9db6
--- /dev/null
+++ b/doc/cell-info.txt
@@ -0,0 +1,121 @@
+Cell Info hierarchy
+===
+
+Serviceorg.ofono
+Interface  org.ofono.CellInfo
+Object path[variable prefix]/{modem0,modem1,...}
+
+Methodsaa{sv} GetNeighbors()
+
+   Calling this procedure returns properties of serving
+   and neighboring cells in GSM or WCDMA networks. This
+   information can be used to determine current location
+   using triangulation over neighboring cell tower
+   locations and estimated distances.
+
+   The returned array consists of two parts: 1) first
+   element of the array contains a dictionary of
+   common information about network and serving cell 2)
+   rest of the array comprises dictionaries containing
+   measurement results of neighboring cells. The contents
+   of the dictionaries follow the specification
+   OMA-TS-ULP-V2_0-20100816-C for user plane Location and
+   is described in properties section.
+
+   Possible errors: org.ofono.Error.Failed
+
+Properties
+
+Serving cell
+   string Type
+   Radio access network type of neighbor cell information.
+   The possible values are:
+   geran Measurement results are for the GSM EDGE Radio
+   Access Network.
+   utran Measurement results are for UMTS Radio Access
+   Network.
+
+   string MobileCountryCode
+   Mobile Country Code of serving cell. Possible values:
+   Values: 0...999
+
+   string MobileNetworkCode
+   Mobile Network Code of serving cell.
+   Values: 0...999
+
+   uint16 LocationAreaCode [GERAN]
+   Location area code of serving cell.
+   Values: 0...65535
+
+   uint16 CellId [GERAN]
+   Cell Id of serving cell.
+   Values: 0...65535
+
+   byte TimingAdvance [GERAN, optional]
+   Timing advance.
+   Values: 0...63
+
+   uint32 UniqueCellId [UTRA-FDD]
+   Serving WCDMA unique cell ID.
+   Values: 0...268435455
+
+   uint16 ScramblingCode [UTRA-FDD]
+   Primary scrambling code.
+   Values: 0...511
+
+   uint16 UARFCN-DL [UTRA-FDD]
+   Downlink UTRA Absolute Radio Frequency Channel Number
+   of serving cell.
+   Values: 0...16383
+
+   uint16 UARFCN-UL [UTRA-FDD, optional]
+   Uplink UTRA Absolute Radio Frequency Channel Number.
+   Values: 0...16383
+
+
+Neighbor cell measurement results
+
+   uint16 AbsoluteRadioFrequencyChannelNumber [GERAN]
+   Absolute radio frequency channel number.
+   Values: 0...1023
+
+   byte BaseStationIdentityCode [GERAN]
+   Base station identity code.
+   Values: 0...63.
+
+   byte RXLEV [GERAN]
+   Measured power of the channel.
+   Values: 0...63
+
+   byte ReceivedSignalStrengthIndicator [UTRA-FDD]
+   RX power level.
+   Values: 0...127
+
+   uint16 UARFCN-DL [UTRA-FDD]
+   Downlink UARFCN.
+   Values: 0...16383
+
+   uint16 UARFCN-UL [UTRA-FDD, optional]
+   Uplink UARFCN.
+   Values: 0...16383
+
+   uint16 ScramblingCode [UTRA-FDD]
+   Primary scrambling code.
+   Values: 0...511
+
+   uint32 UniqueCellId [UTRA-FDD, optional]
+   Unique cell ID.
+   Values: 0...268435455
+
+   byte CPICH-ECN0 [UTRA-FDD, optional]
+Common pilot channel RX energy per chip over noise
+density in dB.
+Values: 0...63
+
+   int16 CPICH-RSCP [UTRA-FDD, optional]
+   Common pilot channel RX carrier power in dBm
+   Values: -4...127
+
+   byte Pathloss [UTRA-FDD, optional]
+  

[PATCH 1/5 v3] Cell-info: CellInfo DBUS interface definition

2011-01-12 Thread Antti Paila
---
 include/dbus.h |1 +
 src/ofono.h|1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/dbus.h b/include/dbus.h
index 12768f6..f2e18bf 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -45,6 +45,7 @@ extern C {
 #define OFONO_MESSAGE_WAITING_INTERFACE org.ofono.MessageWaiting
 #define OFONO_NETWORK_REGISTRATION_INTERFACE org.ofono.NetworkRegistration
 #define OFONO_NETWORK_OPERATOR_INTERFACE org.ofono.NetworkOperator
+#define OFONO_CELL_INFO_INTERFACE org.ofono.CellInfo
 #define OFONO_PHONEBOOK_INTERFACE org.ofono.Phonebook
 #define OFONO_RADIO_SETTINGS_INTERFACE org.ofono.RadioSettings
 #define OFONO_AUDIO_SETTINGS_INTERFACE org.ofono.AudioSettings
diff --git a/src/ofono.h b/src/ofono.h
index cab70cd..820e3a3 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -127,6 +127,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_NETTIME = 21,
OFONO_ATOM_TYPE_CTM = 22,
OFONO_ATOM_TYPE_CDMA_VOICECALL_MANAGER = 23,
+   OFONO_ATOM_TYPE_CELL_INFO = 24,
 };
 
 enum ofono_atom_watch_condition {
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 4/5 v3] Cell-info: New files included in compilation

2011-01-12 Thread Antti Paila
---
 Makefile.am |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4dec90a..096450f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,8 @@ include_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/radio-settings.h include/stk.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
-   include/cdma-sms.h
+   include/cdma-sms.h \
+   include/cell-info.h
 
 nodist_include_HEADERS = include/version.h
 
@@ -340,7 +341,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
-   src/cdma-voicecall.c
+   src/cdma-voicecall.c src/cell-info.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
 
@@ -381,7 +382,8 @@ doc_files = doc/overview.txt doc/ofono-paper.txt 
doc/release-faq.txt \
doc/phonebook-api.txt doc/radio-settings-api.txt \
doc/sim-api.txt doc/stk-api.txt \
doc/audio-settings-api.txt doc/text-telephony-api.txt \
-   doc/calypso-modem.txt
+   doc/calypso-modem.txt \
+   doc/cell-info.txt
 
 
 test_scripts = test/backtrace \
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/5 v3] Neighbor Cell Info Atom

2011-01-12 Thread Antti Paila
 This series of patches implements an interface for client
 applications to fetch the ECID information of neighboring
 cells using DBUS. Since the 1st version the DBUS api has
 been refactored to use new naming for method and to use
 flat data format for the cell information. Also, the
 internal datatypes have been optimized. Since the 2nd
 version MNC and MCC are converted to strings and CPICH-RSCP
 re-typed.

Antti Paila (5):
  Cell-info: CellInfo DBUS interface definition
  Cell-info: Header file for Neighbor cell info
  Cell-info: Atom for obtaining ECID info of cells
  Cell-info: New files included in compilation
  Cell-info: Documentation

 Makefile.am |8 +-
 doc/cell-info.txt   |  121 +
 include/cell-info.h |  128 ++
 include/dbus.h  |1 +
 src/cell-info.c |  485 +++
 src/ofono.h |1 +
 6 files changed, 741 insertions(+), 3 deletions(-)
 create mode 100644 doc/cell-info.txt
 create mode 100644 include/cell-info.h
 create mode 100644 src/cell-info.c

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH 2/2] ifxmodem: add enable/disable ctm support

2011-01-12 Thread Jeevaka.Badrappan
Hi Marcel,

ofono-boun...@ofono.org wrote:
 +static void xctms_modify_cb(gboolean ok, GAtResult *result,
 gpointer +user_data) { + struct cb_data *cbd = user_data;
 +ofono_ctm_set_cb_t cb = cbd-cb;
 +struct ofono_error error;
 +const char *setting = NULL;
 +struct ofono_ctm *ctm = cbd-user;
 +struct ctm_data *ctmd = ofono_ctm_get_data(ctm);
 +ofono_bool_t enable = ctmd-enable;
 +
 +decode_at_error(error, g_at_result_final_response(result)); +
 +if (!ok) {
 +cb(error, cbd-data);
 +return;
 +}
 +
 +if (g_strcmp0(ctmd-audio_setting, FULL_DUPLEX) == 0) +
setting
 = 0,0,0,0,0,0,0; + else if (g_strcmp0(ctmd-audio_setting,
 BURSTMODE_48KHZ) == 0) +   setting = 0,0,8,0,2,0,0; +
else if
 (g_strcmp0(ctmd-audio_setting, BURSTMODE_96KHZ) == 0) +
setting
 = 0,0,9,0,2,0,0; + +   if (setting) {
 +char xdrv_buf[64];
 +
 +/* configure source */
 +snprintf(xdrv_buf, sizeof(xdrv_buf),
AT+XDRV=40,4,%d,%d,%s,%s,
 +4, +
0,
 +setting,
 +enable ? 2,5 : 0,0);
 +g_at_chat_send(ctmd-chat, xdrv_buf, xdrv_prefix, NULL,
NULL,
 +NULL); +
 +/* configure destination */
 +snprintf(xdrv_buf, sizeof(xdrv_buf),
AT+XDRV=40,5,%d,%d,%s,%s,
 +3, +
0,
 +setting,
 +enable ? 2,6 : 0,0);
 +
 +g_at_chat_send(ctmd-chat, xdrv_buf, xdrv_prefix, NULL,
NULL,
 +NULL); +}
 
 Now this is something I don't like at all. It is copied code from the
 modem plugin. 

Its the same audio configuration code except that there is a new
parameter added
at the end of the parameter list for TTY case.

 
 The initial discussion was that we need to configure XDRV
 only once during init and never have to touch it again. That
 seems to be not true anymore. So what is the deal here?
 

Audio source/destination parameter includes configuration and transducer
mode

TRANSDUCER is the difference. Incase of voice call it is set to
default(0) whereas
for TTY call it is set to TRANSDUCER TTY( 5 for source and 6 for
destination).

TTY call - Last 2 parameters are 2,5 and 2,6 for the source(uplink) and
destination(downlink) respectively.
Voice call - Last 2 parameters are 0,0.

 Also if this is required, we might need to figure out a
 complete different way of handling this. We can't have this
 in two places since that means a full disconnect. Maybe
 putting this into the audio settings atom might be better.
 However before we can do anything, I have to understand the
 semantics behind XDRV, normal voice calls and TTY calls.
 

Correct me if I'm wrong. If we move this to the audio settings atom,
then I'm
afraid that it will end up in used by only ifx modem. 

 
 We wanna be consistent, so pleace do ifx_ctm_init(void) here.
 
 +ofono_ctm_driver_register(driver);
 +}
 +
 +void ifx_ctm_exit()
 +{
 
 Same here. And for extra bonus points, I accept patches that
 fixes this inside the whole oFono tree ;)
 
 It is coding style rule M15 now.
 

Separate set of patches sent for the M15 coding style rule fix for the
whole oFono tree.

Regards,
Jeevaka
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] plugins-mbm: Combining mbm_disable and reopen_callback

2011-01-12 Thread Tomasz Gregorek
From: Tomasz Gregorek tomasz.grego...@stericsson.com

Combining mbm_disable and reopen_callback into one and removing 1 second
delay between them to avoid call to reopen_callback after modem being
disconnected.
---
 plugins/mbm.c |   41 +++--
 1 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/plugins/mbm.c b/plugins/mbm.c
index dca9bd8..d1529ac 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -66,7 +66,6 @@ struct mbm_data {
gboolean have_sim;
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
-   guint reopen_source;
enum mbm_variant variant;
 };
 
@@ -297,21 +296,26 @@ static GAtChat *create_port(const char *device)
return chat;
 }
 
-static void mbm_disconnect(gpointer user_data);
-
-static gboolean reopen_callback(gpointer user_data)
+static void mbm_disconnect(gpointer user_data)
 {
struct ofono_modem *modem = user_data;
struct mbm_data *data = ofono_modem_get_data(modem);
const char *data_dev;
 
-   data-reopen_source = 0;
+   DBG();
+
+   if (data-gc)
+   ofono_gprs_context_remove(data-gc);
+
+   g_at_chat_unref(data-data_port);
+   data-data_port = NULL;
 
data_dev = ofono_modem_get_string(modem, DataDevice);
 
data-data_port = create_port(data_dev);
+
if (data-data_port == NULL)
-   return FALSE;
+   return;
 
if (getenv(OFONO_AT_DEBUG))
g_at_chat_set_debug(data-data_port, mbm_debug, Data: );
@@ -323,30 +327,12 @@ static gboolean reopen_callback(gpointer user_data)
 
data-gc = ofono_gprs_context_create(modem, 0,
atmodem, data-data_port);
+
if (data-gprs  data-gc) {
ofono_gprs_context_set_type(data-gc,
OFONO_GPRS_CONTEXT_TYPE_MMS);
ofono_gprs_add_context(data-gprs, data-gc);
}
-
-   return FALSE;
-}
-
-static void mbm_disconnect(gpointer user_data)
-{
-   struct ofono_modem *modem = user_data;
-   struct mbm_data *data = ofono_modem_get_data(modem);
-
-   DBG();
-
-   if (data-gc)
-   ofono_gprs_context_remove(data-gc);
-
-   g_at_chat_unref(data-data_port);
-   data-data_port = NULL;
-
-   /* Waiting for the +CGEV: ME DEACT might also work */
-   data-reopen_source = g_timeout_add_seconds(1, reopen_callback, modem);
 }
 
 static int mbm_enable(struct ofono_modem *modem)
@@ -425,11 +411,6 @@ static int mbm_disable(struct ofono_modem *modem)
 
DBG(%p, modem);
 
-   if (data-reopen_source  0) {
-   g_source_remove(data-reopen_source);
-   data-reopen_source = 0;
-   }
-
if (data-modem_port == NULL)
return 0;
 
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] isimodem: fix return from call control requests

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

---
 drivers/isimodem/voicecall.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index c19e64d..6f866a5 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -795,7 +795,7 @@ static void isi_call_control_resp(const GIsiMessage *msg, 
void *data)
}
 
if (cause == CALL_CAUSE_NO_CAUSE) {
-   isi_ctx_return_failure(irc);
+   isi_ctx_return_success(irc);
return;
}
 
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] sim: check if lock is locked after code changing attempt

2011-01-12 Thread Denis Kenzior
Hi Jussi,

 I don't particularly wish to use the retry counters. I was just thinking that 
 same
 information ( PUK required ) could be deduced by counting the retries. 

To my knowledge you cannot.  Correct me if I'm wrong, but the retry
counters are stored on the SIM and the SIM can be removed, and later
re-inserted.  You would not know how the counters have been affected.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] TODO: set owner of Support HFP AG emulator task

2011-01-12 Thread Frédéric Danis
From: Frederic Danis frederic.da...@linux.intel.com

---
 TODO |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index 495d539..28a6c32 100644
--- a/TODO
+++ b/TODO
@@ -106,6 +106,7 @@ Modem Emulator
 
   Complexity: C4
   Priority: Medium
+  Owner: Frédéric Danis frederic.da...@linux.intel.com
 
 - Support extensions to HFP AG emulator.  Some carkits support additional
   AT command extensions to the Bluetooth HFP AG standard.  Refer to CE4A
@@ -116,6 +117,7 @@ Modem Emulator
   Complexity: C4
   Priority: Medium
   Depends: HFP AG emulator
+  Owner: Frédéric Dalleau frederic.dall...@linux.intel.com
 
 - Support HSP AG.  Similar to HFP AG emulator but implements the much reduced
   Bluetooth HSP AG profile.
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: Update interface with variable port numbers?

2011-01-12 Thread Marcel Holtmann
Hi Jessica,

 we could probably use an update in the push_notification_register_agent
 in plugins/push-notification.c so that it would be possible to specify 
 port numbers instead of them being hardcoded with
 
 #define WAP_PUSH_SRC_PORT 9200
 #define WAP_PUSH_DST_PORT 2948
 
 We would like to be able to use the
 oma-ilp   7276/tcpOMA Internal Location Protocol
 
 specified on
 http://www.iana.org/assignments/port-numbers
 
 This could also be used for other WAP based services.
 
 Is this something that you would agree would be useful and we could add 
 to the TODO list?

what is the content of these messages? For WAP Push it is clearly
defined. Are these also WAP Push PDUs?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 00/16] M15 coding style fixes

2011-01-12 Thread Marcel Holtmann
Hi Jeevaka,

  Coding style fix patches for the whole oFono tree.

thank you very much for doing this. All patches have been applied.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] isimodem: fix return from call control requests

2011-01-12 Thread Marcel Holtmann
Hi Pekka,

  drivers/isimodem/voicecall.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

patch has been applied. Thanks.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] TODO: set owner of Support HFP AG emulator task

2011-01-12 Thread Marcel Holtmann
Hi Fred,

  TODO |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

welcome on board. Patch has been applied.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] plugins-mbm: Combining mbm_disable and reopen_callback

2011-01-12 Thread Marcel Holtmann
Hi Tomasz,

 Combining mbm_disable and reopen_callback into one and removing 1 second
 delay between them to avoid call to reopen_callback after modem being
 disconnected.

have you actually tested this? This will not work since you can not
reopen the TTY right away. You need that delay in between.

From my previous email, I remember saying that the right fix would be to
disarm the timer within disable. Why are we not doing that?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] TODO: Add task for main.conf

2011-01-12 Thread Marcel Holtmann
Hi Aki,

  TODO |8 
  1 files changed, 8 insertions(+), 0 deletions(-)

patch has been applied. Thanks.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] test: add set-call-forwarding

2011-01-12 Thread Marcel Holtmann
Hi Jarko,

  Makefile.am  |3 +-
  test/set-call-forwarding |   64 
 ++
  2 files changed, 66 insertions(+), 1 deletions(-)
  create mode 100755 test/set-call-forwarding

patch has been applied. Thanks.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] test: add disable-call-forwarding

2011-01-12 Thread Marcel Holtmann
Hi Jarko,

  Makefile.am  |3 +-
  test/disable-call-forwarding |   53 
 ++
  2 files changed, 55 insertions(+), 1 deletions(-)
  create mode 100755 test/disable-call-forwarding

Applying: test: add disable-call-forwarding
error: patch failed: Makefile.am:449
error: Makefile.am: patch does not apply
Patch failed at 0001 test: add disable-call-forwarding

 diff --git a/Makefile.am b/Makefile.am
 index 4dec90a..2df0fbd 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -449,7 +449,8 @@ test_scripts = test/backtrace \
   test/set-tty \
   test/set-gsm-band \
   test/set-umts-band \
 - test/lockdown-modem
 + test/lockdown-modem \
 + test/disable-call-forwarding

The error message is not surprising actually. You need to send patches
that depend on each other to applied one before the other one as
sequence of patches. This one is conflicting with your previous one ;)

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [RFC 3/5] voicecall: Add ofono_voicecall_tty_notify api

2011-01-12 Thread Marcel Holtmann
Hi Jeevaka,

   include/voicecall.h |2 ++
   src/voicecall.c |   12 
   2 files changed, 14 insertions(+), 0 deletions(-)
  
  diff --git a/include/voicecall.h b/include/voicecall.h index
  e37d73b..6f1bdd2 100644 --- a/include/voicecall.h
  +++ b/include/voicecall.h
  @@ -144,6 +144,8 @@ void ofono_voicecall_notify(struct
  ofono_voicecall *vc,  void ofono_voicecall_disconnected(struct
 ofono_voicecall *vc, int id, enum
 ofono_disconnect_reason
 reason, const struct ofono_error
 *error);
  +void ofono_voicecall_tty_notify(struct ofono_voicecall *vc,
  +  const struct ofono_call *call);
  
  what is the advantage of having this separate and not part of
  the regular voicecall_notify and just extending struct
  ofono_call with a field for TTY?
  
 
 Main reason for separate notification function is to avoid going through
 all
 the cases handled inside voicecall_notify. TTY field in ofono_call is
 basically
 for the GetProperties.

I see. So here is the main question that comes from this now. This seems
to be a bit IFX specific driven API. I still have no idea why they can
not just indicate this via +CRING and have to use CTM CALL for it.

Are we expecting that all modems will just establish a normal voice call
and only later on signal that it is a TTY call? Any input from different
vendors other than IFX. What about STE, ISI?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 05/10] Update documentation for GPRS technology

2011-01-12 Thread Marcel Holtmann
Hi Remi,

   + string Technology [readonly, optional]
   +
   + Contains the data technology as reported by the
   + GPRS service registration (if known).
   +
   + Possible values are the same as for the Technology
   + property the NetworkRegistration object.
   +
  
  we used to have this value and then we removed it since it ended up
  being not useful. So why do you wanna bring it back?
 
 The network registration only ever tells 2G/3G/4G. We need something to tell 
 about EDGE or HS*PA. We cannot rely (only) on the CPSB bearer as it is only 
 defined when there is an active context. Technology is set whenever we are 
 registered to the GPRS service.

as I said, we took the Technology field from the Connection Manager
since it was just duplication.

So why are we not feeding the CPSB bearer information into the Network
Registration and have it just update from GSM - EDGE and UMTS - HSPA
accordingly.

I think that the UI should only require to monitor one location for this
information to display them. And if it jumps from 3.5G to 3G and back
depending if a GPRS context is active or not. That is fine with me.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/4] Bearer documentation

2011-01-12 Thread Marcel Holtmann
Hi Aki,

  As Denis said, the vendor commands indicate that it is a global bearer
  information. If one context is on HSPA, then others will be as well. So
  how does ISI provide this information? Is it globally or per context?
 
 I doubt contexts can even be on different bearers. At least on ISI, the
 indication for HS*PA channel allocations is global, and so is cell
 supported technologies.

that is what I thought. It is just a stupidity in the AT command
specification that they give a CID with it.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [RFC 3/5] voicecall: Add ofono_voicecall_tty_notify api

2011-01-12 Thread Jeevaka.Badrappan
Hi Marcel,

ofono-boun...@ofono.org wrote:
 Main reason for separate notification function is to avoid going
 through all the cases handled inside voicecall_notify. TTY field in
 ofono_call is basically for the GetProperties.
 
 I see. So here is the main question that comes from this now.
 This seems to be a bit IFX specific driven API. I still have
 no idea why they can not just indicate this via +CRING and
 have to use CTM CALL for it.
 
 Are we expecting that all modems will just establish a normal
 voice call and only later on signal that it is a TTY call?
 Any input from different vendors other than IFX. What about STE, ISI?

This notification is to inform the ME that the call is accepted as a TTY
call
on the remote side.

Regards,
Jeevaka




___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC PATCH 1/4] Added GPRS context provisioning driver API sources

2011-01-12 Thread Denis Kenzior
Hi Marcel,

 +
 +/*
 + * Callback from provisioning plugin.
 + * settings: list of struct ofono_gprs_provisioning_data
 + *
 + * It is responsibility of callback function to free settings-list
 + * settings-list elements must be freed with 
 ofono_gprs_provisioning_data_free()
 + */
 +typedef void (*ofono_gprs_provision_cb_t)(GSList *settings, void *userdata);
 +
 +struct ofono_gprs_provision_driver {
 +const char *name;
 +int priority;
 +void (*get_settings) (struct ofono_modem *modem,
 +ofono_gprs_provision_cb_t cb,
 +void *userdata);
 +};
 
 So here is something we need to talk about. The nettime plugin
 infrastructure using a pseudo atom. So do we wanna do the same here or
 do we wanna change the nettime atom to something simple like this.
 
 I like to have consistency here. Aki, Denis, thoughts?
 

The nettime and history plugins can create their own D-Bus interfaces.
Hence the need for probe and remove.  Since the provisioning driver
might want to pre-parse its database, I believe it should follow the
same approach...

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC PATCH 4/4] Dummy example GPRS context provisioning driver

2011-01-12 Thread Denis Kenzior
Hi Jukka,

On 01/12/2011 01:41 AM, Jukka Saunamaki wrote:
 Hello
 
 On Tue, 2011-01-11 at 22:48 -0800, ext Marcel Holtmann wrote:
 +   if (sim != NULL) {
 +   ofono_sim_read(sim, SIM_EFSPN_FILEID,
 +   OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
 +   sim_spn_read_cb, req);
 +   return;
 +   }

 Should this not be provided somehow by the SIM atom?

 Denis, any idea why we are not keeping this information available?

 
 I would guess there was no need for it, since netreg was the only user
 for EFSPN data.
 
 I though of patching the SIM atom to read this during some phase of SIM
 initialization, but was not sure exactly when, and what kind of
 interface (syncronous, asyncronous?) to provide.
 

You're correct that netreg is the only consumer.  There was no need for
anyone else to see this information.  However, this begs the question,
why do you need the SPN data?

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [RFC 3/5] voicecall: Add ofono_voicecall_tty_notify api

2011-01-12 Thread Marcel Holtmann
Hi Jeevaka,

  Main reason for separate notification function is to avoid going
  through all the cases handled inside voicecall_notify. TTY field in
  ofono_call is basically for the GetProperties.
  
  I see. So here is the main question that comes from this now.
  This seems to be a bit IFX specific driven API. I still have
  no idea why they can not just indicate this via +CRING and
  have to use CTM CALL for it.
  
  Are we expecting that all modems will just establish a normal
  voice call and only later on signal that it is a TTY call?
  Any input from different vendors other than IFX. What about STE, ISI?
 
 This notification is to inform the ME that the call is accepted as a TTY
 call
 on the remote side.

I see. Using a +X... IFX style notification would have been much nicer,
but so be it. The question still remains if all other modems do it
similar.

Btw. can you provide the mailing list with an example OFONO_AT_DEBUG=1
trace for a TTY call on IFX. I really like to see one of these.

Denis, do you want an extra voicecall_tty_notify() callback or just have
it go through the voicecall_notify() one?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH 2/2] ifxmodem: add enable/disable ctm support

2011-01-12 Thread Marcel Holtmann
Hi Jeevaka,

  Now this is something I don't like at all. It is copied code from the
  modem plugin. 
 
 Its the same audio configuration code except that there is a new
 parameter added
 at the end of the parameter list for TTY case.

I really hate duplicating magic numbers in two places. Can we do this
without +XDRV for now and put a /* TODO mark */ in the code. I do need
to think about this audio settings handling a bit more.

So you might have to keep the +XDRV local in your code for testing, but
I'd rather get the other TTY logic in place and worry about the audio
stuff in a second round of patches.

  Also if this is required, we might need to figure out a
  complete different way of handling this. We can't have this
  in two places since that means a full disconnect. Maybe
  putting this into the audio settings atom might be better.
  However before we can do anything, I have to understand the
  semantics behind XDRV, normal voice calls and TTY calls.
  
 
 Correct me if I'm wrong. If we move this to the audio settings atom,
 then I'm
 afraid that it will end up in used by only ifx modem. 

I am not following. This whole stuff is IFX specific. So yes, it will
only be used by IFX. All other vendors have to do their own stuff.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 00/21] Resubmit Zhenhua Zhang work on DUN server with btio

2011-01-12 Thread Frédéric Dalleau
This is rebased as of head of today

Zhenhua Zhang (21):
  bluetooth: Add reference count for bluetooth utils
  bluetooth: Add Btio library for DUN
  bluetooth: Add bluetooth server support for DUN
  emulator: Add emulator atom in oFono
  dun_gw: Add DUN server plugin for oFono
  gprs: Rename status_watch to netreg_status_watch
  emulator: Add status watches for ofono emulator
  emulator: Add emulator status watches in gprs atom
  emulator: Add APIs to send GAtServer result
  emulator: Implement dialing up for DUN
  gprs: Make gprs_proto_to/from_string non-static
  gprs: ignore the case of proto str when comparing
  emulator: Register mandatory AT command handlers
  gprs: Refactor to share remove_context method
  gprs: Add DUN +CGATT support in gprs atom
  gprs: Add DUN +CGDCONT support in gprs atom
  gprs: Add DUN server GPRS connect support
  gprs: Add status watch functions
  gprs: Add gprs_get_status
  emulator: Watch GPRS status changes
  emulator: Watch netreg status changes

 Makefile.am|   15 +-
 btio/btio.c| 1299 
 btio/btio.h|   97 
 configure.ac   |5 +
 include/emulator.h |   94 
 include/gprs-context.h |4 +
 include/gprs.h |   11 +
 plugins/bluetooth.c|  441 -
 plugins/bluetooth.h|   15 +
 plugins/dun_gw.c   |  115 +
 src/emulator.c | 1072 +++
 src/gprs.c |  500 +--
 src/modem.c|1 +
 src/ofono.h|   31 ++
 14 files changed, 3636 insertions(+), 64 deletions(-)
 create mode 100644 btio/btio.c
 create mode 100644 btio/btio.h
 create mode 100644 include/emulator.h
 create mode 100644 plugins/dun_gw.c
 create mode 100644 src/emulator.c

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 01/21] bluetooth: Add reference count for bluetooth utils

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Add bluetooth_ref()/bluetooth_unref() to support reference count in
bluetooth utils.
---
 plugins/bluetooth.c |   62 +--
 1 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 602c6da..fe1eaa9 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -40,6 +40,7 @@
 static DBusConnection *connection;
 static GHashTable *uuid_hash = NULL;
 static GHashTable *adapter_address_hash = NULL;
+static gint ref_count;
 
 void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
char *buf, int size)
@@ -504,13 +505,10 @@ static guint adapter_added_watch;
 static guint adapter_removed_watch;
 static guint property_watch;
 
-int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile 
*profile)
+static int bluetooth_init()
 {
int err;
 
-   if (uuid_hash)
-   goto done;
-
connection = ofono_dbus_get_connection();
 
bluetooth_watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE,
@@ -543,13 +541,6 @@ int bluetooth_register_uuid(const char *uuid, struct 
bluetooth_profile *profile)
adapter_address_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
 
-done:
-   g_hash_table_insert(uuid_hash, g_strdup(uuid), profile);
-
-   bluetooth_send_with_reply(/, BLUEZ_MANAGER_INTERFACE, GetProperties,
-   manager_properties_cb, NULL, NULL, -1,
-   DBUS_TYPE_INVALID);
-
return 0;
 
 remove:
@@ -557,14 +548,27 @@ remove:
g_dbus_remove_watch(connection, adapter_added_watch);
g_dbus_remove_watch(connection, adapter_removed_watch);
g_dbus_remove_watch(connection, property_watch);
+
return err;
 }
 
-void bluetooth_unregister_uuid(const char *uuid)
+static int bluetooth_ref()
 {
-   g_hash_table_remove(uuid_hash, uuid);
+   g_atomic_int_inc(ref_count);
+
+   if (ref_count  1)
+   return 0;
+
+   return bluetooth_init();
+}
+
+static void bluetooth_unref()
+{
+   gboolean is_zero;
+
+   is_zero = g_atomic_int_dec_and_test(ref_count);
 
-   if (g_hash_table_size(uuid_hash))
+   if (is_zero == FALSE)
return;
 
g_dbus_remove_watch(connection, bluetooth_watch);
@@ -572,9 +576,33 @@ void bluetooth_unregister_uuid(const char *uuid)
g_dbus_remove_watch(connection, adapter_removed_watch);
g_dbus_remove_watch(connection, property_watch);
 
-   g_hash_table_destroy(uuid_hash);
-   g_hash_table_destroy(adapter_address_hash);
-   uuid_hash = NULL;
+   if (uuid_hash)
+   g_hash_table_destroy(uuid_hash);
+
+   if (adapter_address_hash)
+   g_hash_table_destroy(adapter_address_hash);
+}
+
+int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile 
*profile)
+{
+   int err = bluetooth_ref();
+
+   if (err != 0)
+   return err;
+
+   g_hash_table_insert(uuid_hash, g_strdup(uuid), profile);
+
+   bluetooth_send_with_reply(/, BLUEZ_MANAGER_INTERFACE, GetProperties,
+   manager_properties_cb, NULL, NULL, -1,
+   DBUS_TYPE_INVALID);
+   return 0;
+}
+
+void bluetooth_unregister_uuid(const char *uuid)
+{
+   g_hash_table_remove(uuid_hash, uuid);
+
+   bluetooth_unref();
 }
 
 OFONO_PLUGIN_DEFINE(bluetooth, Bluetooth Utils Plugins, VERSION,
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 02/21] bluetooth: Add Btio library for DUN

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Btio library is the low level socket API for BT RFCOMM connection. We
share the same library among BlueZ, Obex and oFono. So make sure you
synchronize to other two projects when you make changes to btio.[ch].
---
 Makefile.am  |8 +-
 btio/btio.c  | 1299 ++
 btio/btio.h  |   97 +
 configure.ac |5 +
 4 files changed, 1407 insertions(+), 2 deletions(-)
 create mode 100644 btio/btio.c
 create mode 100644 btio/btio.h

diff --git a/Makefile.am b/Makefile.am
index 4dec90a..2a9f340 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,6 +82,8 @@ gisi_sources = gisi/client.c gisi/client.h gisi/common.h \
gisi/server.c gisi/server.h \
gisi/socket.c gisi/socket.h
 
+btio_sources = btio/btio.h btio/btio.c
+
 udev_files = plugins/ofono.rules
 
 if UDEV
@@ -342,7 +344,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/smsagent.c src/smsagent.h src/ctm.c \
src/cdma-voicecall.c
 
-src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
+src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ \
+   @BLUEZ_LIBS@ -ldl
 
 src_ofonod_LDFLAGS = -Wl,--export-dynamic \
-Wl,--version-script=$(srcdir)/src/ofono.ver
@@ -365,7 +368,8 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CAPNG_CFLAGS@ 
@USB_CFLAGS@ \
-DPLUGINDIR=\$(build_plugindir)\
 
 INCLUDES = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/src \
-   -I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat
+   -I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat \
+   -I$(srcdir)/btio
 
 doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
doc/manager-api.txt doc/modem-api.txt doc/network-api.txt \
diff --git a/btio/btio.c b/btio/btio.c
new file mode 100644
index 000..574e224
--- /dev/null
+++ b/btio/btio.c
@@ -0,0 +1,1299 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2009-2010  Marcel Holtmann marcel at holtmann.org
+ *  Copyright (C) 2009-2010  Nokia Corporation
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+#include stdarg.h
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include poll.h
+#include sys/types.h
+#include sys/socket.h
+
+#include bluetooth/bluetooth.h
+#include bluetooth/l2cap.h
+#include bluetooth/rfcomm.h
+#include bluetooth/sco.h
+#include bluetooth/hci.h
+#include bluetooth/hci_lib.h
+
+#include glib.h
+
+#include btio.h
+
+#define ERROR_FAILED(gerr, str, err) \
+   g_set_error(gerr, BT_IO_ERROR, BT_IO_ERROR_FAILED, \
+   str : %s (%d), strerror(err), err)
+
+#define DEFAULT_DEFER_TIMEOUT 30
+
+struct set_opts {
+   bdaddr_t src;
+   bdaddr_t dst;
+   int defer;
+   int sec_level;
+   uint8_t channel;
+   uint16_t psm;
+   uint16_t mtu;
+   uint16_t imtu;
+   uint16_t omtu;
+   int master;
+   uint8_t mode;
+};
+
+struct connect {
+   BtIOConnect connect;
+   gpointer user_data;
+   GDestroyNotify destroy;
+};
+
+struct accept {
+   BtIOConnect connect;
+   gpointer user_data;
+   GDestroyNotify destroy;
+};
+
+struct server {
+   BtIOConnect connect;
+   BtIOConfirm confirm;
+   gpointer user_data;
+   GDestroyNotify destroy;
+};
+
+static void server_remove(struct server *server)
+{
+   if (server-destroy)
+   server-destroy(server-user_data);
+   g_free(server);
+}
+
+static void connect_remove(struct connect *conn)
+{
+   if (conn-destroy)
+   conn-destroy(conn-user_data);
+   g_free(conn);
+}
+
+static void accept_remove(struct accept *accept)
+{
+   if (accept-destroy)
+   accept-destroy(accept-user_data);
+   g_free(accept);
+}
+
+static gboolean check_nval(GIOChannel *io)
+{
+   struct pollfd fds;
+
+   memset(fds, 0, sizeof(fds));
+   fds.fd = g_io_channel_unix_get_fd(io);
+   fds.events = POLLNVAL;
+
+   if (poll(fds, 1, 0)  

[PATCH 04/21] emulator: Add emulator atom in oFono

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Create emulator atom when modem state changes to online. The emulator
driver probes each driver to create specific emulator like DUN, HFP AG,
etc. Once get client connection request, create GAtServer to talk AT
commands with client side.
---
 Makefile.am|4 +-
 include/emulator.h |   54 +++
 src/emulator.c |  189 
 src/modem.c|1 +
 src/ofono.h|5 ++
 5 files changed, 251 insertions(+), 2 deletions(-)
 create mode 100644 include/emulator.h
 create mode 100644 src/emulator.c

diff --git a/Makefile.am b/Makefile.am
index 2a9f340..5dcf253 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,7 @@ include_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/radio-settings.h include/stk.h \
include/audio-settings.h include/nettime.h \
include/ctm.h include/cdma-voicecall.h \
-   include/cdma-sms.h
+   include/cdma-sms.h include/emulator.h
 
 nodist_include_HEADERS = include/version.h
 
@@ -342,7 +342,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) 
src/ofono.ver \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
-   src/cdma-voicecall.c
+   src/cdma-voicecall.c src/emulator.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ \
@BLUEZ_LIBS@ -ldl
diff --git a/include/emulator.h b/include/emulator.h
new file mode 100644
index 000..2691928
--- /dev/null
+++ b/include/emulator.h
@@ -0,0 +1,54 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __OFONO_EMULATOR_H
+#define __OFONO_EMULATOR_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_emulator;
+
+struct ofono_emulator_driver {
+   const char *name;
+   enum ofono_atom_type type;
+   int (*probe)(struct ofono_emulator *emulator,
+   struct ofono_modem *modem);
+   void (*remove)();
+};
+
+int ofono_emulator_enable(struct ofono_emulator *emulator, GIOChannel 
*channel);
+void ofono_emulator_remove(gpointer user_data);
+struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
+   struct ofono_emulator_driver *driver);
+
+int ofono_emulator_driver_register(const struct ofono_emulator_driver *driver);
+void ofono_emulator_driver_unregister(
+   const struct ofono_emulator_driver *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_EMULATOR_H */
diff --git a/src/emulator.c b/src/emulator.c
new file mode 100644
index 000..1ede79a
--- /dev/null
+++ b/src/emulator.c
@@ -0,0 +1,189 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#include stdio.h
+#include string.h
+#include errno.h
+#include glib.h
+#include gdbus.h
+
+#include ofono.h
+#include common.h
+#include gatserver.h
+
+struct ofono_emulator {
+   struct ofono_modem *modem;
+   struct ofono_atom *atom;
+   unsigned int id;
+   GAtServer *server;
+   struct ofono_emulator_driver *driver;
+};
+
+static GSList *emulator_drivers = NULL;
+static unsigned int 

[PATCH 03/21] bluetooth: Add bluetooth server support for DUN

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

It watches Bluetooth adapter property changes and addes DUN record to
listen DUN client connection request.
---
 plugins/bluetooth.c |  379 +++
 plugins/bluetooth.h |   15 ++
 2 files changed, 394 insertions(+), 0 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index fe1eaa9..c20728e 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -35,13 +35,72 @@
 
 #include ofono/dbus.h
 
+#include btio.h
 #include bluetooth.h
 
 static DBusConnection *connection;
 static GHashTable *uuid_hash = NULL;
 static GHashTable *adapter_address_hash = NULL;
+static GSList *server_list = NULL;
 static gint ref_count;
 
+static const gchar *dun_record = ?xml version=\1.0\ encoding=\UTF-8\ ?  
\
+record   
\
+  attribute id=\0x0001\
\
+sequence 
\
+  uuid value=\0x1103\/ 
\
+/sequence
\
+  /attribute 
\
+   
\
+  attribute id=\0x0004\
\
+sequence 
\
+  sequence   
\
+uuid value=\0x0100\/   
\
+  /sequence  
\
+  sequence   
\
+uuid value=\0x0003\/   
\
+uint8 value=\%u\ name=\channel\/ 
\
+  /sequence  
\
+  sequence   
\
+uuid value=\0x0008\/   
\
+  /sequence  
\
+/sequence
\
+  /attribute 
\
+   
\
+  attribute id=\0x0009\
\
+sequence 
\
+  sequence   
\
+uuid value=\0x1103\/   
\
+uint16 value=\0x0100\ name=\version\/
\
+  /sequence  
\
+/sequence
\
+  /attribute 
\
+   
\
+  attribute id=\0x0100\
\
+text value=\%s\ name=\name\/ 
\
+  /attribute 
\
+/record;
+
+#define TIMEOUT (60*1000) /* Timeout for user response (miliseconds) */
+
+struct client {
+   GIOChannel  *io;
+   guint   watch;
+};
+
+struct server {
+   guint16 service;
+   gchar   *name;
+   guint8  channel;
+   GIOChannel  *io;
+   gchar   *adapter;
+   guint   handle;
+   ConnectFunc connect_cb;
+   gpointeruser_data;
+
+   struct client   client;
+};
+
 void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
char *buf, int size)
 {
@@ -371,6 +430,253 @@ static gboolean property_changed(DBusConnection 
*connection, DBusMessage *msg,
return TRUE;
 }
 
+static void disconnect(struct server *server)
+{
+   struct client *client = server-client;
+
+   if (!client-io)
+   return;
+
+   g_io_channel_unref(client-io);
+   client-io = NULL;
+
+   if (client-watch  0) {
+   g_source_remove(client-watch);
+   client-watch = 0;
+   }
+
+   return;
+}
+
+static void server_stop(gpointer data, gpointer user_data)
+{
+   struct server *server = data;
+
+   disconnect(server);
+
+   if (server-handle) {
+   DBusMessage *msg;
+
+   msg = dbus_message_new_method_call(BLUEZ_SERVICE,
+   

[PATCH 05/21] dun_gw: Add DUN server plugin for oFono

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

DUN server is probed when modem state changes to online. It registers
DUN record to Bluetooth adapter and wait for incoming DUN connection.
---
 Makefile.am  |3 +
 plugins/dun_gw.c |  115 ++
 2 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 plugins/dun_gw.c

diff --git a/Makefile.am b/Makefile.am
index 5dcf253..58bf6c4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -291,6 +291,9 @@ builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
 builtin_modules += hfp
 builtin_sources += plugins/hfp.c plugins/bluetooth.h
 
+builtin_modules += dun_gw
+builtin_sources += $(btio_sources) plugins/dun_gw.c plugins/bluetooth.h
+
 builtin_modules += palmpre
 builtin_sources += plugins/palmpre.c
 
diff --git a/plugins/dun_gw.c b/plugins/dun_gw.c
new file mode 100644
index 000..803ae32
--- /dev/null
+++ b/plugins/dun_gw.c
@@ -0,0 +1,115 @@
+/*
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+#include stdio.h
+#include string.h
+#include errno.h
+#include glib.h
+#include ofono.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/log.h
+#include ofono/modem.h
+#include gdbus.h
+
+#include bluetooth.h
+
+#define DUN_GW_CHANNEL 1
+
+static struct server *server;
+
+static void dun_gw_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
+{
+   struct ofono_emulator *emulator = user_data;
+
+   DBG();
+
+   if (err) {
+   DBG(%s, err-message);
+   goto failed;
+   }
+
+   if (ofono_emulator_enable(emulator, io)  0)
+   goto failed;
+
+   return;
+
+failed:
+   g_io_channel_shutdown(io, TRUE, NULL);
+   ofono_emulator_remove(emulator);
+   bluetooth_unregister_server(server);
+   server = NULL;
+}
+
+static int dun_gw_probe(struct ofono_emulator *emulator,
+   struct ofono_modem *modem)
+{
+   struct ofono_atom *gprs;
+
+   if (server)
+   return -1;
+
+   DBG();
+
+   gprs = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_GPRS);
+   /* Make sure the modem has GPRS atom */
+   if (!gprs)
+   return -1;
+
+   server = bluetooth_register_server(DUN_GW, Dial-Up Networking,
+   DUN_GW_CHANNEL, dun_gw_connect_cb, emulator);
+
+   return 0;
+}
+
+static void dun_gw_remove()
+{
+   if (server == NULL)
+   return;
+
+   DBG();
+
+   bluetooth_unregister_server(server);
+   server = NULL;
+}
+
+static struct ofono_emulator_driver emulator_driver = {
+   .name = Dial-Up Networking,
+   .type = OFONO_ATOM_TYPE_EMULATOR_DUN,
+   .probe = dun_gw_probe,
+   .remove = dun_gw_remove,
+};
+
+static int dun_gw_init()
+{
+   return ofono_emulator_driver_register(emulator_driver);
+}
+
+static void dun_gw_exit()
+{
+   ofono_emulator_driver_unregister(emulator_driver);
+}
+
+OFONO_PLUGIN_DEFINE(dun_gw, Dial-up Networking Profile Plugins, VERSION,
+   OFONO_PLUGIN_PRIORITY_DEFAULT, dun_gw_init, dun_gw_exit)
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 07/21] emulator: Add status watches for ofono emulator

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

The status watches monitor the emulator activities. Other atoms like
gprs, netreg could register notification to watch emulator status
changes.
---
 include/emulator.h |6 +
 src/emulator.c |   54 
 src/ofono.h|   11 ++
 3 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/include/emulator.h b/include/emulator.h
index 2691928..99ae218 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -30,6 +30,12 @@ extern C {
 
 struct ofono_emulator;
 
+enum ofono_emulator_status {
+   OFONO_EMULATOR_STATUS_IDLE = 0,
+   OFONO_EMULATOR_STATUS_CREATE,
+   OFONO_EMULATOR_STATUS_DESTROY,
+};
+
 struct ofono_emulator_driver {
const char *name;
enum ofono_atom_type type;
diff --git a/src/emulator.c b/src/emulator.c
index 1ede79a..c68dbf8 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -39,6 +39,8 @@ struct ofono_emulator {
unsigned int id;
GAtServer *server;
struct ofono_emulator_driver *driver;
+   enum ofono_emulator_status status;
+   struct ofono_watchlist *status_watches;
 };
 
 static GSList *emulator_drivers = NULL;
@@ -80,6 +82,20 @@ static void ofono_emulator_release_id(int id)
ofono_emulator_ids = ~(0x1  id);
 }
 
+static void notify_status_watches(struct ofono_emulator *e, void *data)
+{
+   struct ofono_watchlist_item *item;
+   ofono_emulator_status_notify_cb_t notify;
+   GSList *l;
+
+   for (l = e-status_watches-items; l; l = l-next) {
+   item = l-data;
+   notify = item-notify;
+
+   notify(e, e-status, data, item-notify_data);
+   }
+}
+
 int ofono_emulator_enable(struct ofono_emulator *e, GIOChannel *channel)
 {
if (channel == NULL)
@@ -116,6 +132,11 @@ static void emulator_remove(struct ofono_atom *atom)
if (e-server)
emulator_disable(e);
 
+   e-status = OFONO_EMULATOR_STATUS_DESTROY;
+   notify_status_watches(e, NULL);
+
+   __ofono_watchlist_free(e-status_watches);
+
ofono_emulator_release_id(e-id);
 
if (e-driver-remove)
@@ -125,6 +146,37 @@ static void emulator_remove(struct ofono_atom *atom)
e = NULL;
 }
 
+unsigned int __ofono_emulator_add_status_watch(struct ofono_emulator *e,
+   ofono_emulator_status_notify_cb_t notify,
+   void *data, ofono_destroy_func destroy)
+{
+   struct ofono_watchlist_item *item;
+
+   DBG(%p, e);
+
+   if (e == NULL)
+   return 0;
+
+   if (notify == NULL)
+   return 0;
+
+   item = g_new0(struct ofono_watchlist_item, 1);
+
+   item-notify = notify;
+   item-destroy = destroy;
+   item-notify_data = data;
+
+   return __ofono_watchlist_add_item(e-status_watches, item);
+}
+
+gboolean __ofono_emulator_remove_status_watch(struct ofono_emulator *e,
+   unsigned int id)
+{
+   DBG(%p, e);
+
+   return __ofono_watchlist_remove_item(e-status_watches, id);
+}
+
 struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
struct ofono_emulator_driver *driver)
 {
@@ -148,6 +200,8 @@ struct ofono_emulator *ofono_emulator_create(struct 
ofono_modem *modem,
}
 
e-id = ofono_emulator_next_id();
+   e-status_watches = __ofono_watchlist_new(g_free);
+   e-status = OFONO_EMULATOR_STATUS_CREATE;
 
return e;
 }
diff --git a/src/ofono.h b/src/ofono.h
index 64ea625..247152b 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -423,3 +423,14 @@ void __ofono_nettime_info_received(struct ofono_modem 
*modem,
 #include ofono/emulator.h
 
 void __ofono_emulator_probe_drivers(struct ofono_modem *modem);
+
+typedef void (*ofono_emulator_status_notify_cb_t)(struct ofono_emulator *e,
+   enum ofono_emulator_status status,
+   void *data, void *user_data);
+
+unsigned int __ofono_emulator_add_status_watch(struct ofono_emulator *e,
+   ofono_emulator_status_notify_cb_t notify,
+   void *data, ofono_destroy_func destroy);
+
+gboolean __ofono_emulator_remove_status_watch(struct ofono_emulator *e,
+   unsigned int id);
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and 

[PATCH 06/21] gprs: Rename status_watch to netreg_status_watch

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

To be more precise and avoid name conflict with dun_status_watch.
---
 src/gprs.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 0e86bdf..4cb5eaf 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -74,7 +74,7 @@ struct ofono_gprs {
int netreg_status;
struct ofono_netreg *netreg;
unsigned int netreg_watch;
-   unsigned int status_watch;
+   unsigned int netreg_status_watch;
GKeyFile *settings;
char *imsi;
DBusMessage *pending;
@@ -2164,10 +2164,10 @@ static void gprs_unregister(struct ofono_atom *atom)
}
 
if (gprs-netreg_watch) {
-   if (gprs-status_watch) {
+   if (gprs-netreg_status_watch) {
__ofono_netreg_remove_status_watch(gprs-netreg,
-   gprs-status_watch);
-   gprs-status_watch = 0;
+   gprs-netreg_status_watch);
+   gprs-netreg_status_watch = 0;
}
 
__ofono_modem_remove_atom_watch(modem, gprs-netreg_watch);
@@ -2250,15 +2250,16 @@ static void netreg_watch(struct ofono_atom *atom,
struct ofono_gprs *gprs = data;
 
if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
-   gprs-status_watch = 0;
+   gprs-netreg_status_watch = 0;
gprs-netreg = NULL;
return;
}
 
gprs-netreg = __ofono_atom_get_data(atom);
gprs-netreg_status = ofono_netreg_get_status(gprs-netreg);
-   gprs-status_watch = __ofono_netreg_add_status_watch(gprs-netreg,
-   netreg_status_changed, gprs, NULL);
+   gprs-netreg_status_watch = __ofono_netreg_add_status_watch(
+   gprs-netreg, netreg_status_changed,
+   gprs, NULL);
 
gprs_netreg_update(gprs);
 }
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 08/21] emulator: Add emulator status watches in gprs atom

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Add dun_watch to watch emulator status update in gprs atom. So that gprs
atom could get notified when we get request to create new PPP connection
from DUN client;
---
 src/gprs.c |   60 
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 4cb5eaf..c7793ea 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -82,6 +82,9 @@ struct ofono_gprs {
const struct ofono_gprs_driver *driver;
void *driver_data;
struct ofono_atom *atom;
+   struct ofono_emulator *dun;
+   unsigned int dun_watch;
+   unsigned int dun_status_watch;
 };
 
 struct ofono_gprs_context {
@@ -2014,6 +2017,39 @@ void ofono_gprs_context_deactivated(struct 
ofono_gprs_context *gc,
}
 }
 
+static void dun_status_watch(struct ofono_emulator *e,
+   enum ofono_emulator_status status,
+   void *data, void *user_data)
+{
+   if (e == NULL)
+   return;
+
+   switch (status) {
+   default:
+   break;
+   }
+}
+
+static void dun_watch(struct ofono_atom *atom,
+   enum ofono_atom_watch_condition cond,
+   void *data)
+{
+   struct ofono_gprs *gprs = data;
+   struct ofono_emulator *e = __ofono_atom_get_data(atom);
+
+   if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+   gprs-dun_status_watch = 0;
+   gprs-dun = NULL;
+   return;
+   }
+
+   DBG();
+
+   gprs-dun = e;
+   gprs-dun_status_watch = __ofono_emulator_add_status_watch(e,
+   dun_status_watch, gprs, NULL);
+}
+
 int ofono_gprs_context_driver_register(const struct ofono_gprs_context_driver 
*d)
 {
DBG(driver: %p, name: %s, d, d-name);
@@ -2175,6 +2211,18 @@ static void gprs_unregister(struct ofono_atom *atom)
gprs-netreg = NULL;
}
 
+   if (gprs-dun_watch) {
+   if (gprs-dun_status_watch) {
+   __ofono_emulator_remove_status_watch(gprs-dun,
+   gprs-dun_status_watch);
+   gprs-dun_status_watch = 0;
+   }
+
+   __ofono_modem_remove_atom_watch(modem, gprs-dun_watch);
+   gprs-dun_watch = 0;
+   gprs-dun = NULL;
+   }
+
ofono_modem_remove_interface(modem,
OFONO_CONNECTION_MANAGER_INTERFACE);
g_dbus_unregister_interface(conn, path,
@@ -2464,6 +2512,7 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
const char *path = __ofono_atom_get_path(gprs-atom);
struct ofono_atom *netreg_atom;
struct ofono_atom *sim_atom;
+   struct ofono_atom *dun_atom;
 
if (!g_dbus_register_interface(conn, path,
OFONO_CONNECTION_MANAGER_INTERFACE,
@@ -2500,6 +2549,17 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
netreg_watch(netreg_atom,
OFONO_ATOM_WATCH_CONDITION_REGISTERED, gprs);
 
+   gprs-dun_watch = __ofono_modem_add_atom_watch(modem,
+   OFONO_ATOM_TYPE_EMULATOR_DUN,
+   dun_watch, gprs, NULL);
+
+   dun_atom = __ofono_modem_find_atom(modem,
+   OFONO_ATOM_TYPE_EMULATOR_DUN);
+
+   if (dun_atom  __ofono_atom_get_registered(dun_atom))
+   dun_watch(dun_atom,
+   OFONO_ATOM_WATCH_CONDITION_REGISTERED, gprs);
+
__ofono_atom_register(gprs-atom, gprs_unregister);
 }
 
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 09/21] emulator: Add APIs to send GAtServer result

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Defines APIs to send final/intermediate/unsolicited result to DUN
client.
 Please enter the commit message for your changes. Lines starting
---
 include/emulator.h |2 ++
 src/emulator.c |   28 
 src/ofono.h|   15 +++
 3 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/include/emulator.h b/include/emulator.h
index 99ae218..0d5568c 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -36,6 +36,8 @@ enum ofono_emulator_status {
OFONO_EMULATOR_STATUS_DESTROY,
 };
 
+enum _GAtServerResult;
+
 struct ofono_emulator_driver {
const char *name;
enum ofono_atom_type type;
diff --git a/src/emulator.c b/src/emulator.c
index c68dbf8..455af11 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -82,6 +82,34 @@ static void ofono_emulator_release_id(int id)
ofono_emulator_ids = ~(0x1  id);
 }
 
+void ofono_emulator_send_final(struct ofono_emulator *e, GAtServerResult 
result)
+{
+   g_at_server_send_final(e-server, result);
+}
+
+void ofono_emulator_send_ext_final(struct ofono_emulator *e, const char 
*result)
+{
+   g_at_server_send_ext_final(e-server, result);
+}
+
+void ofono_emulator_send_intermediate(struct ofono_emulator *e,
+   const char *result)
+{
+   g_at_server_send_intermediate(e-server, result);
+}
+
+void ofono_emulator_send_unsolicited(struct ofono_emulator *e,
+   const char *result)
+{
+   g_at_server_send_unsolicited(e-server, result);
+}
+
+void ofono_emulator_send_info(struct ofono_emulator *e, const char *line,
+   gboolean last)
+{
+   g_at_server_send_info(e-server, line, last);
+}
+
 static void notify_status_watches(struct ofono_emulator *e, void *data)
 {
struct ofono_watchlist_item *item;
diff --git a/src/ofono.h b/src/ofono.h
index 247152b..4c11e1f 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -434,3 +434,18 @@ unsigned int __ofono_emulator_add_status_watch(struct 
ofono_emulator *e,
 
 gboolean __ofono_emulator_remove_status_watch(struct ofono_emulator *e,
unsigned int id);
+
+void ofono_emulator_send_final(struct ofono_emulator *e,
+   enum _GAtServerResult result);
+
+void ofono_emulator_send_ext_final(struct ofono_emulator *e,
+   const char *result);
+
+void ofono_emulator_send_intermediate(struct ofono_emulator *e,
+   const char *result);
+
+void ofono_emulator_send_unsolicited(struct ofono_emulator *e,
+   const char *result);
+
+void ofono_emulator_send_info(struct ofono_emulator *e, const char *line,
+   gboolean last);
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 11/21] gprs: Make gprs_proto_to/from_string non-static

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

So DUN server could share gprs_proto_to_string and
gprs_proto_from_string.
---
 include/gprs-context.h |4 
 src/gprs.c |4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/gprs-context.h b/include/gprs-context.h
index c29c0dc..19c1b98 100644
--- a/include/gprs-context.h
+++ b/include/gprs-context.h
@@ -95,6 +95,10 @@ struct ofono_modem *ofono_gprs_context_get_modem(struct 
ofono_gprs_context *gc);
 void ofono_gprs_context_set_type(struct ofono_gprs_context *gc,
enum ofono_gprs_context_type type);
 
+gboolean gprs_proto_from_string(const char *str, enum ofono_gprs_proto *proto);
+
+const char *gprs_proto_to_string(enum ofono_gprs_proto proto);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gprs.c b/src/gprs.c
index c7793ea..9e8fae3 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -184,7 +184,7 @@ static gboolean gprs_context_string_to_type(const char *str,
return FALSE;
 }
 
-static const char *gprs_proto_to_string(enum ofono_gprs_proto proto)
+const char *gprs_proto_to_string(enum ofono_gprs_proto proto)
 {
switch (proto) {
case OFONO_GPRS_PROTO_IP:
@@ -196,7 +196,7 @@ static const char *gprs_proto_to_string(enum 
ofono_gprs_proto proto)
return NULL;
 }
 
-static gboolean gprs_proto_from_string(const char *str,
+gboolean gprs_proto_from_string(const char *str,
enum ofono_gprs_proto *proto)
 {
if (g_str_equal(str, ip)) {
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 10/21] emulator: Implement dialing up for DUN

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

It handles client ATD*99# request and complete GPRS connection. Pass
client IP address through IPCP packet to client side.
---
 include/emulator.h |   30 +++
 src/emulator.c |  221 
 2 files changed, 251 insertions(+), 0 deletions(-)

diff --git a/include/emulator.h b/include/emulator.h
index 0d5568c..e6eeb06 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -34,6 +34,9 @@ enum ofono_emulator_status {
OFONO_EMULATOR_STATUS_IDLE = 0,
OFONO_EMULATOR_STATUS_CREATE,
OFONO_EMULATOR_STATUS_DESTROY,
+   OFONO_EMULATOR_STATUS_DUN_CONNECT,
+   OFONO_EMULATOR_STATUS_DUN_CONNECTED,
+   OFONO_EMULATOR_STATUS_DUN_DISCONNECTED,
 };
 
 enum _GAtServerResult;
@@ -46,6 +49,33 @@ struct ofono_emulator_driver {
void (*remove)();
 };
 
+typedef void (*ofono_emulator_cb_t)(enum _GAtServerResult res, void *data);
+
+struct ofono_emulator_req {
+   void *data;
+   ofono_emulator_cb_t cb;
+   void *cb_data;
+};
+
+typedef void (*ofono_emulator_gprs_connect_cb)(const struct ofono_error *error,
+   const char *interface,
+   const char *local,
+   const char *peer,
+   const char **dns, void *data);
+
+struct ofono_emulator_gprs_connect_req {
+   const char *dial_str;
+   ofono_emulator_gprs_connect_cb cb;
+   void *cb_data;
+};
+
+struct ofono_emulator_gprs_context_req {
+   const char *proto;
+   const char *apn;
+   ofono_emulator_cb_t cb;
+   void *cb_data;
+};
+
 int ofono_emulator_enable(struct ofono_emulator *emulator, GIOChannel 
*channel);
 void ofono_emulator_remove(gpointer user_data);
 struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
diff --git a/src/emulator.c b/src/emulator.c
index 455af11..3329b36 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -32,12 +32,30 @@
 #include ofono.h
 #include common.h
 #include gatserver.h
+#include gatppp.h
+
+struct context_settings {
+   char *interface;
+   gboolean static_ip;
+   char *ip;
+   char *netmask;
+   char *gateway;
+   char **dns;
+};
+
+struct dun_context {
+   ofono_bool_t active;
+   struct context_settings settings;
+   struct ofono_gprs_primary_context pri_ctx;
+};
 
 struct ofono_emulator {
struct ofono_modem *modem;
struct ofono_atom *atom;
unsigned int id;
GAtServer *server;
+   GAtPPP *ppp;
+   struct dun_context context;
struct ofono_emulator_driver *driver;
enum ofono_emulator_status status;
struct ofono_watchlist *status_watches;
@@ -124,6 +142,201 @@ static void notify_status_watches(struct ofono_emulator 
*e, void *data)
}
 }
 
+static struct ofono_emulator_req *ofono_emulator_req_new(void *cb,
+   void *cb_data)
+{
+   struct ofono_emulator_req *req;
+
+   req = g_try_new0(struct ofono_emulator_req, 1);
+   if (!req)
+   return req;
+
+   req-cb = cb;
+   req-cb_data = cb_data;
+
+   return req;
+}
+
+static void ppp_connect(const char *interface, const char *local,
+   const char *remote,
+   const char *dns1, const char *dns2,
+   gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   struct dun_context *ctx = e-context;
+   struct context_settings *settings = ctx-settings;
+
+   e-status = OFONO_EMULATOR_STATUS_DUN_CONNECTED;
+   ctx-active = TRUE;
+
+   DBG(DUN server connected!\n);
+
+   DBG(Network Device: %s\n, settings-interface);
+   DBG(IP Address: %s\n, settings-ip);
+   DBG(Remote IP Address: %s\n, settings-gateway);
+   DBG(Primary DNS Server: %s\n, settings-dns[0]);
+   DBG(Secondary DNS Server: %s\n, settings-dns[1]);
+}
+
+static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   struct dun_context *ctx = e-context;
+   struct context_settings *settings = ctx-settings;
+   struct ofono_emulator_req *req;
+
+   DBG();
+
+   g_at_ppp_unref(e-ppp);
+   e-ppp = NULL;
+
+   g_at_server_resume(e-server);
+
+   ctx-active = FALSE;
+
+   g_free(settings-interface);
+   g_free(settings-ip);
+   g_free(settings-netmask);
+   g_free(settings-gateway);
+   g_strfreev(settings-dns);
+
+   req = ofono_emulator_req_new(NULL, NULL);
+   if (!req)
+   return;
+
+   e-status = OFONO_EMULATOR_STATUS_DUN_DISCONNECTED;
+   notify_status_watches(e, req);
+
+   g_free(req);
+}
+
+static gboolean setup_ppp(gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   GAtServer *server = 

[PATCH 12/21] gprs: ignore the case of proto str when comparing

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Use g_ascii_strcasecmp in gprs_proto_from_string when getting the GPRS
protocol from string.
---
 src/gprs.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 9e8fae3..830e143 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -199,10 +199,10 @@ const char *gprs_proto_to_string(enum ofono_gprs_proto 
proto)
 gboolean gprs_proto_from_string(const char *str,
enum ofono_gprs_proto *proto)
 {
-   if (g_str_equal(str, ip)) {
+   if (g_ascii_strcasecmp(str, ip)) {
*proto = OFONO_GPRS_PROTO_IP;
return TRUE;
-   } else if (g_str_equal(str, ipv6)) {
+   } else if (g_ascii_strcasecmp(str, ipv6)) {
*proto = OFONO_GPRS_PROTO_IPV6;
return TRUE;
}
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 14/21] gprs: Refactor to share remove_context method

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Remove duplicated code in gprs_deactivate_for_remove and
gprs_remove_context. So they could share the same remove_context method.
---
 src/gprs.c |   59 +--
 1 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 830e143..05e1c70 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1652,26 +1652,14 @@ static DBusMessage *gprs_add_context(DBusConnection 
*conn,
return NULL;
 }
 
-static void gprs_deactivate_for_remove(const struct ofono_error *error,
-   void *data)
+static void remove_context(struct pri_context *ctx)
 {
-   struct pri_context *ctx = data;
struct ofono_gprs *gprs = ctx-gprs;
DBusConnection *conn;
char *path;
const char *atompath;
 
-   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
-   DBG(Removing context failed with error: %s,
-   telephony_error_to_str(error));
-
-   __ofono_dbus_pending_reply(gprs-pending,
-   __ofono_error_failed(gprs-pending));
-   return;
-   }
-
-   gprs_cid_release(gprs, ctx-context.cid);
-   ctx-context.cid = 0;
+   DBG(%s, ctx-path);
 
if (gprs-settings) {
g_key_file_remove_group(gprs-settings, ctx-key, NULL);
@@ -1684,9 +1672,6 @@ static void gprs_deactivate_for_remove(const struct 
ofono_error *error,
context_dbus_unregister(ctx);
gprs-contexts = g_slist_remove(gprs-contexts, ctx);
 
-   __ofono_dbus_pending_reply(gprs-pending,
-   dbus_message_new_method_return(gprs-pending));
-
atompath = __ofono_atom_get_path(gprs-atom);
conn = ofono_dbus_get_connection();
g_dbus_emit_signal(conn, atompath, OFONO_CONNECTION_MANAGER_INTERFACE,
@@ -1695,13 +1680,38 @@ static void gprs_deactivate_for_remove(const struct 
ofono_error *error,
g_free(path);
 }
 
+
+static void gprs_deactivate_for_remove(const struct ofono_error *error,
+   void *data)
+{
+   struct pri_context *ctx = data;
+   struct ofono_gprs *gprs = ctx-gprs;
+
+   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
+   DBG(Removing context failed with error: %s,
+   telephony_error_to_str(error));
+
+   __ofono_dbus_pending_reply(gprs-pending,
+   __ofono_error_failed(gprs-pending));
+   return;
+   }
+
+   gprs_cid_release(gprs, ctx-context.cid);
+   ctx-context.cid = 0;
+
+   remove_context(ctx);
+
+   if (gprs-pending)
+   __ofono_dbus_pending_reply(gprs-pending,
+   dbus_message_new_method_return(gprs-pending));
+}
+
 static DBusMessage *gprs_remove_context(DBusConnection *conn,
DBusMessage *msg, void *data)
 {
struct ofono_gprs *gprs = data;
struct pri_context *ctx;
const char *path;
-   const char *atompath;
 
if (gprs-pending)
return __ofono_error_busy(msg);
@@ -1730,22 +1740,11 @@ static DBusMessage *gprs_remove_context(DBusConnection 
*conn,
return NULL;
}
 
-   if (gprs-settings) {
-   g_key_file_remove_group(gprs-settings, ctx-key, NULL);
-   storage_sync(gprs-imsi, SETTINGS_STORE, gprs-settings);
-   }
-
DBG(Unregistering context: %s, ctx-path);
-   context_dbus_unregister(ctx);
-   gprs-contexts = g_slist_remove(gprs-contexts, ctx);
+   remove_context(ctx);
 
g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);
 
-   atompath = __ofono_atom_get_path(gprs-atom);
-   g_dbus_emit_signal(conn, atompath, OFONO_CONNECTION_MANAGER_INTERFACE,
-   ContextRemoved, DBUS_TYPE_OBJECT_PATH, path,
-   DBUS_TYPE_INVALID);
-
return NULL;
 }
 
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 13/21] emulator: Register mandatory AT command handlers

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Register mandatory AT command handlers for DUN server.
---
 include/emulator.h |2 +
 src/emulator.c |  380 
 2 files changed, 382 insertions(+), 0 deletions(-)

diff --git a/include/emulator.h b/include/emulator.h
index e6eeb06..71ed78a 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -37,6 +37,8 @@ enum ofono_emulator_status {
OFONO_EMULATOR_STATUS_DUN_CONNECT,
OFONO_EMULATOR_STATUS_DUN_CONNECTED,
OFONO_EMULATOR_STATUS_DUN_DISCONNECTED,
+   OFONO_EMULATOR_STATUS_SET_CGATT,
+   OFONO_EMULATOR_STATUS_SET_CGDCONT,
 };
 
 enum _GAtServerResult;
diff --git a/src/emulator.c b/src/emulator.c
index 3329b36..2a089a1 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -49,6 +49,14 @@ struct dun_context {
struct ofono_gprs_primary_context pri_ctx;
 };
 
+struct modem_settings {
+   int mode;
+   int creg;
+   int cgreg;
+   int cops;
+   int attached;
+};
+
 struct ofono_emulator {
struct ofono_modem *modem;
struct ofono_atom *atom;
@@ -57,6 +65,7 @@ struct ofono_emulator {
GAtPPP *ppp;
struct dun_context context;
struct ofono_emulator_driver *driver;
+   struct modem_settings settings;
enum ofono_emulator_status status;
struct ofono_watchlist *status_watches;
 };
@@ -157,6 +166,370 @@ static struct ofono_emulator_req 
*ofono_emulator_req_new(void *cb,
return req;
 }
 
+static void generic_cb(GAtServerResult res, void *user_data)
+{
+   struct ofono_emulator *e = user_data;
+   GAtServer *server = e-server;
+
+   g_at_server_send_final(server, res);
+
+   e-status = OFONO_EMULATOR_STATUS_IDLE;
+
+   notify_status_watches(e, NULL);
+}
+
+static gboolean send_ok(gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
+
+   return FALSE;
+}
+
+static void cfun_cb(GAtServerRequestType type, GAtResult *cmd,
+   gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+   char buf[50];
+
+   switch (type) {
+   case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+   ofono_emulator_send_info(e, +CFUN: (0-1), TRUE);
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
+   break;
+   case G_AT_SERVER_REQUEST_TYPE_QUERY:
+   snprintf(buf, sizeof(buf), +CFUN: %d, e-settings.mode);
+   ofono_emulator_send_info(e, buf, TRUE);
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
+   break;
+   case G_AT_SERVER_REQUEST_TYPE_SET:
+   {
+   GAtResultIter iter;
+   int mode;
+
+   g_at_result_iter_init(iter, cmd);
+   g_at_result_iter_next(iter, +CFUN=);
+
+   if (g_at_result_iter_next_number(iter, mode) == FALSE)
+   goto error;
+
+   if (mode != 0  mode != 1)
+   goto error;
+
+   DBG(set CFUN to %d, mode);
+
+   e-settings.mode = mode;
+   g_timeout_add_seconds(1, send_ok, e);
+   break;
+   }
+   default:
+   goto error;
+   };
+
+   return;
+
+error:
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_ERROR);
+}
+
+static void cpin_cb(GAtServerRequestType type, GAtResult *result,
+   gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+
+   switch (type) {
+   case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
+   break;
+   case G_AT_SERVER_REQUEST_TYPE_QUERY:
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
+   break;
+   case G_AT_SERVER_REQUEST_TYPE_SET:
+   /* not implement yet*/
+   default:
+   goto error;
+   };
+
+   return;
+
+error:
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_ERROR);
+}
+
+static void creg_cb(GAtServerRequestType type, GAtResult *result,
+   gpointer user_data)
+{
+   struct ofono_emulator *e = user_data;
+
+   switch (type) {
+   case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
+   break;
+   case G_AT_SERVER_REQUEST_TYPE_QUERY:
+   ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
+   break;
+   case G_AT_SERVER_REQUEST_TYPE_SET:
+   {
+   GAtResultIter iter;
+   int mode;
+
+   g_at_result_iter_init(iter, result);
+   g_at_result_iter_next(iter, +CREG=);
+
+   if (g_at_result_iter_next_number(iter, mode) == FALSE)
+   goto error;
+
+   if (mode  0 || mode  2)
+ 

[PATCH 15/21] gprs: Add DUN +CGATT support in gprs atom

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

DUN client may request to attach/deattach GPRS network. Use
gprs_netreg_update to set attach/deattach status.
---
 src/gprs.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 05e1c70..580188e 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -43,6 +43,8 @@
 #include common.h
 #include storage.h
 #include idmap.h
+#include gatserver.h
+
 
 #define GPRS_FLAG_ATTACHING 0x1
 #define GPRS_FLAG_RECHECK 0x2
@@ -2016,14 +2018,31 @@ void ofono_gprs_context_deactivated(struct 
ofono_gprs_context *gc,
}
 }
 
+static void ofono_gprs_set_cgatt(struct ofono_gprs *gprs,
+   struct ofono_emulator_req *req)
+{
+   int *mode = req-data;
+
+   gprs-powered = *mode;
+
+   gprs_netreg_update(gprs);
+
+   req-cb(G_AT_SERVER_RESULT_OK, req-cb_data);
+}
+
 static void dun_status_watch(struct ofono_emulator *e,
enum ofono_emulator_status status,
void *data, void *user_data)
 {
+   struct ofono_gprs *gprs = user_data;
+
if (e == NULL)
return;
 
switch (status) {
+   case OFONO_EMULATOR_STATUS_SET_CGATT:
+   ofono_gprs_set_cgatt(gprs, data);
+   break;
default:
break;
}
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 16/21] gprs: Add DUN +CGDCONT support in gprs atom

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

DUN client may request to define the APN of context. Find the existing
context and update the APN.
---
 src/gprs.c |   46 ++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 580188e..0feb344 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -60,6 +60,13 @@
 static GSList *g_drivers = NULL;
 static GSList *g_context_drivers = NULL;
 
+struct gprs_dun_data {
+   ofono_emulator_gprs_connect_cb cb;
+   void *cb_data;
+   struct pri_context *context;
+   struct pri_context *dun;
+};
+
 struct ofono_gprs {
GSList *contexts;
ofono_bool_t attached;
@@ -87,6 +94,7 @@ struct ofono_gprs {
struct ofono_emulator *dun;
unsigned int dun_watch;
unsigned int dun_status_watch;
+   struct gprs_dun_data dun_data;
 };
 
 struct ofono_gprs_context {
@@ -2030,6 +2038,41 @@ static void ofono_gprs_set_cgatt(struct ofono_gprs *gprs,
req-cb(G_AT_SERVER_RESULT_OK, req-cb_data);
 }
 
+static void ofono_gprs_set_cgdcont(struct ofono_gprs *gprs,
+   struct ofono_emulator_gprs_context_req *req)
+{
+   struct gprs_dun_data *data = gprs-dun_data;
+   struct pri_context *context = NULL;
+   enum ofono_gprs_proto proto;
+   GSList *l;
+
+   gprs_proto_from_string(req-proto, proto);
+
+   for (l = gprs-contexts; l; l = l-next) {
+   struct pri_context *ctx = l-data;
+
+   if (ctx-type != OFONO_GPRS_CONTEXT_TYPE_INTERNET)
+   continue;
+
+   if (proto != ctx-context.proto)
+   continue;
+
+   context = ctx;
+   break;
+   }
+
+   if (context == NULL)
+   goto error;
+
+   strcpy(context-context.apn, req-apn);
+   data-context = context;
+   req-cb(G_AT_SERVER_RESULT_OK, req-cb_data);
+
+   return;
+error:
+   req-cb(G_AT_SERVER_RESULT_ERROR, req-cb_data);
+}
+
 static void dun_status_watch(struct ofono_emulator *e,
enum ofono_emulator_status status,
void *data, void *user_data)
@@ -2043,6 +2086,9 @@ static void dun_status_watch(struct ofono_emulator *e,
case OFONO_EMULATOR_STATUS_SET_CGATT:
ofono_gprs_set_cgatt(gprs, data);
break;
+   case OFONO_EMULATOR_STATUS_SET_CGDCONT:
+   ofono_gprs_set_cgdcont(gprs, data);
+   break;
default:
break;
}
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 18/21] gprs: Add status watch functions

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

So DUN server could watch GPRS status changes and notify client
unsolicited results like +CGREG.
---
 include/gprs.h |9 +
 src/gprs.c |   55 +++
 2 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/include/gprs.h b/include/gprs.h
index ad7925c..7985115 100644
--- a/include/gprs.h
+++ b/include/gprs.h
@@ -36,6 +36,8 @@ typedef void (*ofono_gprs_status_cb_t)(const struct 
ofono_error *error,
 
 typedef void (*ofono_gprs_cb_t)(const struct ofono_error *error, void *data);
 
+typedef void (*ofono_gprs_status_notify_cb_t)(const int status, void *data);
+
 struct ofono_gprs_driver {
const char *name;
int (*probe)(struct ofono_gprs *gprs, unsigned int vendor,
@@ -77,6 +79,13 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
 void ofono_gprs_add_context(struct ofono_gprs *gprs,
struct ofono_gprs_context *gc);
 
+unsigned int __ofono_gprs_add_status_watch(struct ofono_gprs *gprs,
+   ofono_gprs_status_notify_cb_t cb,
+   void *data, ofono_destroy_func destroy);
+
+gboolean __ofono_gprs_remove_status_watch(struct ofono_gprs *gprs,
+   unsigned int id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gprs.c b/src/gprs.c
index e90f043..895d95b 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -95,6 +95,7 @@ struct ofono_gprs {
const struct ofono_gprs_driver *driver;
void *driver_data;
struct ofono_atom *atom;
+   struct ofono_watchlist *status_watches;
struct ofono_emulator *dun;
unsigned int dun_watch;
unsigned int dun_status_watch;
@@ -1925,6 +1926,51 @@ static GDBusSignalTable manager_signals[] = {
{ }
 };
 
+unsigned int __ofono_gprs_add_status_watch(struct ofono_gprs *gprs,
+   ofono_gprs_status_notify_cb_t notify,
+   void *data, ofono_destroy_func destroy)
+{
+   struct ofono_watchlist_item *item;
+
+   DBG(%p, gprs);
+
+   if (gprs == NULL)
+   return 0;
+
+   if (notify == NULL)
+   return 0;
+
+   item = g_new0(struct ofono_watchlist_item, 1);
+
+   item-notify = notify;
+   item-destroy = destroy;
+   item-notify_data = data;
+
+   return __ofono_watchlist_add_item(gprs-status_watches, item);
+}
+
+gboolean __ofono_gprs_remove_status_watch(struct ofono_gprs *gprs,
+   unsigned int id)
+{
+   DBG(%p, gprs);
+
+   return __ofono_watchlist_remove_item(gprs-status_watches, id);
+}
+
+static void notify_status_watches(struct ofono_gprs *gprs)
+{
+   struct ofono_watchlist_item *item;
+   GSList *l;
+   ofono_gprs_status_notify_cb_t notify;
+
+   for (l = gprs-status_watches-items; l; l = l-next) {
+   item = l-data;
+   notify = item-notify;
+
+   notify(gprs-status, item-notify_data);
+   }
+}
+
 void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
 {
DBG(%s, __ofono_atom_get_path(gprs-atom));
@@ -1932,6 +1978,8 @@ void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
gprs-driver_attached = FALSE;
gprs_attached_update(gprs);
 
+   notify_status_watches(gprs);
+
/*
 * TODO: The network forced a detach, we should wait for some time
 * and try to re-attach.  This might also be related to a suspend
@@ -1962,6 +2010,8 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, 
int status)
gprs-driver_attached = TRUE;
gprs_attached_update(gprs);
 
+   notify_status_watches(gprs);
+
return;
 
 detach:
@@ -2464,6 +2514,9 @@ static void gprs_unregister(struct ofono_atom *atom)
const char *path = __ofono_atom_get_path(atom);
GSList *l;
 
+   __ofono_watchlist_free(gprs-status_watches);
+   gprs-status_watches = NULL;
+
if (gprs-settings) {
storage_close(gprs-imsi, SETTINGS_STORE,
gprs-settings, TRUE);
@@ -2816,6 +2869,8 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
ofono_modem_add_interface(modem,
OFONO_CONNECTION_MANAGER_INTERFACE);
 
+   gprs-status_watches = __ofono_watchlist_new(g_free);
+
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
 
if (sim_atom) {
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly 

[PATCH 19/21] gprs: Add gprs_get_status

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

DUN server want to get latest GPRS status.
---
 include/gprs.h |2 ++
 src/gprs.c |9 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/gprs.h b/include/gprs.h
index 7985115..05cc086 100644
--- a/include/gprs.h
+++ b/include/gprs.h
@@ -86,6 +86,8 @@ unsigned int __ofono_gprs_add_status_watch(struct ofono_gprs 
*gprs,
 gboolean __ofono_gprs_remove_status_watch(struct ofono_gprs *gprs,
unsigned int id);
 
+int ofono_gprs_get_status(struct ofono_gprs *gprs);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gprs.c b/src/gprs.c
index 895d95b..4ef33ef 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -2487,6 +2487,15 @@ void ofono_gprs_context_set_type(struct 
ofono_gprs_context *gc,
gc-type = type;
 }
 
+
+int ofono_gprs_get_status(struct ofono_gprs *gprs)
+{
+   if (gprs == NULL)
+   return -1;
+
+   return gprs-status;
+}
+
 int ofono_gprs_driver_register(const struct ofono_gprs_driver *d)
 {
DBG(driver: %p, name: %s, d, d-name);
-- 
1.7.1

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 17/21] gprs: Add DUN server GPRS connect support

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Implement dial up networking in GPRS atom.
---
 src/gprs.c |  229 +++-
 1 files changed, 227 insertions(+), 2 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 0feb344..e90f043 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -57,6 +57,10 @@
 #define MAX_CONTEXTS 256
 #define SUSPEND_TIMEOUT 8
 
+#define DUN_LOCAL 192.168.1.1
+#define DUN_PEER 192.168.1.2
+#define DUN_CONNECT_TIMEOUT 20
+
 static GSList *g_drivers = NULL;
 static GSList *g_context_drivers = NULL;
 
@@ -95,6 +99,9 @@ struct ofono_gprs {
unsigned int dun_watch;
unsigned int dun_status_watch;
struct gprs_dun_data dun_data;
+   int attach_source;
+   int context_source;
+   int timeout_source;
 };
 
 struct ofono_gprs_context {
@@ -136,6 +143,7 @@ struct pri_context {
 };
 
 static void gprs_netreg_update(struct ofono_gprs *gprs);
+static gboolean dun_connect_remove(gpointer user_data);
 static void gprs_deactivate_next(struct ofono_gprs *gprs);
 
 static const char *gprs_context_default_name(enum ofono_gprs_context_type type)
@@ -676,7 +684,9 @@ static void pri_activate_callback(const struct ofono_error 
*error,
if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG(Activating context failed with error: %s,
telephony_error_to_str(error));
-   __ofono_dbus_pending_reply(ctx-pending,
+
+   if (ctx-pending)
+   __ofono_dbus_pending_reply(ctx-pending,
__ofono_error_failed(ctx-pending));
 
gprs_cid_release(ctx-gprs, ctx-context.cid);
@@ -684,11 +694,15 @@ static void pri_activate_callback(const struct 
ofono_error *error,
ctx-context_driver-inuse = FALSE;
ctx-context_driver = NULL;
 
+   if (ctx-gprs-dun)
+   dun_connect_remove(ctx-gprs);
+
return;
}
 
ctx-active = TRUE;
-   __ofono_dbus_pending_reply(ctx-pending,
+   if (ctx-pending)
+   __ofono_dbus_pending_reply(ctx-pending,
dbus_message_new_method_return(ctx-pending));
 
/*
@@ -1967,6 +1981,27 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
gprs-cid_map = idmap_new_from_range(min, max);
 }
 
+static void ofono_gprs_remove_sources(struct ofono_gprs *gprs)
+{
+   if (gprs == NULL)
+   return;
+
+   if (gprs-timeout_source) {
+   g_source_remove(gprs-timeout_source);
+   gprs-timeout_source = 0;
+   }
+
+   if (gprs-attach_source) {
+   g_source_remove(gprs-attach_source);
+   gprs-attach_source = 0;
+   }
+
+   if (gprs-context_source) {
+   g_source_remove(gprs-context_source);
+   gprs-context_source = 0;
+   }
+}
+
 static void gprs_context_unregister(struct ofono_atom *atom)
 {
struct ofono_gprs_context *gc = __ofono_atom_get_data(atom);
@@ -1974,6 +2009,8 @@ static void gprs_context_unregister(struct ofono_atom 
*atom)
if (gc-gprs == NULL)
return;
 
+   ofono_gprs_remove_sources(gc-gprs);
+
gc-gprs-context_drivers = g_slist_remove(gc-gprs-context_drivers,
gc);
gc-gprs = NULL;
@@ -2026,6 +2063,183 @@ void ofono_gprs_context_deactivated(struct 
ofono_gprs_context *gc,
}
 }
 
+static ofono_bool_t set_primary_context_powered(struct pri_context *ctx,
+   ofono_bool_t value)
+{
+   struct ofono_gprs_context *gc = ctx-context_driver;
+
+   if (gc == NULL || gc-driver-activate_primary == NULL ||
+   gc-driver-deactivate_primary == NULL ||
+   ctx-gprs-cid_map == NULL)
+   return FALSE;
+
+   if (ctx-pending)
+   return FALSE;
+
+   if (ctx-active == value)
+   return FALSE;
+
+   if (value  !ctx-gprs-attached)
+   return FALSE;
+
+   if (ctx-gprs-flags  GPRS_FLAG_ATTACHING)
+   return FALSE;
+
+   if (value) {
+   ctx-context.cid = gprs_cid_alloc(ctx-gprs);
+
+   if (ctx-context.cid == 0)
+   return FALSE;
+
+   if (ctx-context.cid !=
+   idmap_get_min(ctx-gprs-cid_map)) {
+   ofono_error(Multiple active contexts are
+not yet supported);
+
+   gprs_cid_release(ctx-gprs, ctx-context.cid);
+   ctx-context.cid = 0;
+
+   return FALSE;
+   }
+   }
+
+   if (value)
+   gc-driver-activate_primary(gc, ctx-context,
+   pri_activate_callback, ctx);
+   else
+   

[PATCH 20/21] emulator: Watch GPRS status changes

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Watch GPRS status update to notify DUN client, such as +CGREG
unsolicited result.
---
 src/emulator.c |   94 
 1 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 2a089a1..7701510 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -55,6 +55,7 @@ struct modem_settings {
int cgreg;
int cops;
int attached;
+   int gprs_status;
 };
 
 struct ofono_emulator {
@@ -68,6 +69,9 @@ struct ofono_emulator {
struct modem_settings settings;
enum ofono_emulator_status status;
struct ofono_watchlist *status_watches;
+   struct ofono_gprs *gprs;
+   unsigned int gprs_watch;
+   unsigned int gprs_status_watch;
 };
 
 static GSList *emulator_drivers = NULL;
@@ -305,12 +309,16 @@ static void cgreg_cb(GAtServerRequestType type, GAtResult 
*result,
gpointer user_data)
 {
struct ofono_emulator *e = user_data;
+   char buf[256];
 
switch (type) {
case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
break;
case G_AT_SERVER_REQUEST_TYPE_QUERY:
+   snprintf(buf, sizeof(buf), +CGREG: %d, %d, e-settings.cgreg,
+   e-settings.gprs_status);
+   ofono_emulator_send_info(e, buf, TRUE);
ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
break;
case G_AT_SERVER_REQUEST_TYPE_SET:
@@ -710,6 +718,78 @@ error:
g_at_server_send_final(server, res);
 }
 
+static void emulator_gprs_update(struct ofono_emulator *e)
+{
+   GAtServer *server = e-server;
+   char buf[256];
+
+   switch (e-settings.cgreg) {
+   case 0:
+   break;
+   case 1:
+   snprintf(buf, sizeof(buf), +CGREG: %d,
+   e-settings.gprs_status);
+   g_at_server_send_unsolicited(server, buf);
+   break;
+   case 2:
+   snprintf(buf, sizeof(buf), +CGREG: %d,
+   e-settings.gprs_status);
+   g_at_server_send_unsolicited(server, buf);
+   break;
+   default:
+   break;
+   }
+}
+
+static void gprs_status_changed(int status, void *data)
+{
+   struct ofono_emulator *e = data;
+
+   DBG(%d, status);
+
+   e-settings.gprs_status = status;
+
+   emulator_gprs_update(e);
+}
+
+static void gprs_watch(struct ofono_atom *atom,
+   enum ofono_atom_watch_condition cond,
+   void *data)
+{
+   struct ofono_emulator *e = data;
+   struct ofono_gprs *gprs;
+
+   if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+   e-gprs_status_watch = 0;
+   e-gprs = NULL;
+   return;
+   }
+
+   gprs = __ofono_atom_get_data(atom);
+   e-gprs = gprs;
+   e-settings.gprs_status = ofono_gprs_get_status(gprs);
+   e-gprs_status_watch = __ofono_gprs_add_status_watch(e-gprs,
+   gprs_status_changed, e, NULL);
+
+   emulator_gprs_update(e);
+}
+
+static void add_gprs_watches(struct ofono_emulator *e)
+{
+   struct ofono_modem *modem = e-modem;
+   struct ofono_atom *gprs_atom;
+
+   e-gprs_watch = __ofono_modem_add_atom_watch(modem,
+   OFONO_ATOM_TYPE_GPRS,
+   gprs_watch, e, NULL);
+
+   gprs_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_GPRS);
+
+   if (gprs_atom  __ofono_atom_get_registered(gprs_atom))
+   gprs_watch(gprs_atom,
+   OFONO_ATOM_WATCH_CONDITION_REGISTERED, e);
+}
+
 int ofono_emulator_enable(struct ofono_emulator *e, GIOChannel *channel)
 {
if (channel == NULL)
@@ -734,6 +814,8 @@ int ofono_emulator_enable(struct ofono_emulator *e, 
GIOChannel *channel)
g_at_server_register(e-server, +CGATT, cgatt_cb, e, NULL);
g_at_server_register(e-server, +CGDCONT, cgdcont_cb, e, NULL);
 
+   add_gprs_watches(e);
+
return 0;
 }
 
@@ -761,6 +843,18 @@ static void emulator_remove(struct ofono_atom *atom)
if (e-server)
emulator_disable(e);
 
+   if (e-gprs_watch) {
+   if (e-gprs_status_watch) {
+   __ofono_gprs_remove_status_watch(e-gprs,
+   e-gprs_status_watch);
+   e-gprs_status_watch = 0;
+   }
+
+   __ofono_modem_remove_atom_watch(e-modem, e-gprs_watch);
+   e-gprs_watch = 0;
+   e-gprs = NULL;
+   }
+
e-status = OFONO_EMULATOR_STATUS_DESTROY;
notify_status_watches(e, NULL);
 
-- 
1.7.1


[PATCH 21/21] emulator: Watch netreg status changes

2011-01-12 Thread Frédéric Dalleau
From: Zhenhua Zhang zhenhua.zh...@intel.com

Watch netreg status update to notify DUN client, such as +CREG
unsolicited result.
---
 src/emulator.c |  106 
 1 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/src/emulator.c b/src/emulator.c
index 7701510..361 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -56,6 +56,9 @@ struct modem_settings {
int cops;
int attached;
int gprs_status;
+   int netreg_status;
+   int netreg_lac;
+   int netreg_ci;
 };
 
 struct ofono_emulator {
@@ -72,6 +75,9 @@ struct ofono_emulator {
struct ofono_gprs *gprs;
unsigned int gprs_watch;
unsigned int gprs_status_watch;
+   struct ofono_netreg *netreg;
+   unsigned int netreg_watch;
+   unsigned int netreg_status_watch;
 };
 
 static GSList *emulator_drivers = NULL;
@@ -265,12 +271,19 @@ static void creg_cb(GAtServerRequestType type, GAtResult 
*result,
gpointer user_data)
 {
struct ofono_emulator *e = user_data;
+   char buf[256];
 
switch (type) {
case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
break;
case G_AT_SERVER_REQUEST_TYPE_QUERY:
+   snprintf(buf, sizeof(buf), +CREG: %d, %x, %x, %x,
+   e-settings.creg,
+   e-settings.netreg_status,
+   e-settings.netreg_lac,
+   e-settings.netreg_ci);
+   ofono_emulator_send_info(e, buf, TRUE);
ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
break;
case G_AT_SERVER_REQUEST_TYPE_SET:
@@ -790,6 +803,86 @@ static void add_gprs_watches(struct ofono_emulator *e)
OFONO_ATOM_WATCH_CONDITION_REGISTERED, e);
 }
 
+static void emulator_netreg_update(struct ofono_emulator *e)
+{
+   GAtServer *server = e-server;
+   char buf[256];
+
+   switch (e-settings.creg) {
+   case 0:
+   break;
+   case 1:
+   snprintf(buf, sizeof(buf), +CREG: %d,
+   e-settings.netreg_status);
+   g_at_server_send_unsolicited(server, buf);
+   break;
+   case 2:
+   snprintf(buf, sizeof(buf), +CREG: %d, %x, %x,
+   e-settings.netreg_status,
+   e-settings.netreg_lac,
+   e-settings.netreg_ci);
+   g_at_server_send_unsolicited(server, buf);
+   break;
+   default:
+   break;
+   }
+}
+
+static void netreg_status_changed(int status, int lac, int ci, int tech,
+   const char *mcc, const char *mnc,
+   void *data)
+{
+   struct ofono_emulator *e = data;
+
+   DBG(%d %d %d, status, lac, ci);
+
+   e-settings.netreg_status = status;
+   e-settings.netreg_lac = lac;
+   e-settings.netreg_ci = ci;
+
+   emulator_netreg_update(e);
+}
+
+static void netreg_watch(struct ofono_atom *atom,
+   enum ofono_atom_watch_condition cond,
+   void *data)
+{
+   struct ofono_emulator *e = data;
+   struct ofono_netreg *netreg;
+
+   if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+   e-netreg_status_watch = 0;
+   e-netreg = NULL;
+   return;
+   }
+
+   netreg = __ofono_atom_get_data(atom);
+   e-netreg = netreg;
+   e-settings.netreg_status = ofono_netreg_get_status(netreg);
+   e-settings.netreg_lac = ofono_netreg_get_location(netreg);
+   e-settings.netreg_ci = ofono_netreg_get_cellid(netreg);
+   e-netreg_status_watch = __ofono_netreg_add_status_watch(e-netreg,
+   netreg_status_changed, e, NULL);
+
+   emulator_netreg_update(e);
+}
+
+static void add_netreg_watches(struct ofono_emulator *e)
+{
+   struct ofono_modem *modem = e-modem;
+   struct ofono_atom *netreg_atom;
+
+   e-netreg_watch = __ofono_modem_add_atom_watch(modem,
+   OFONO_ATOM_TYPE_NETREG,
+   netreg_watch, e, NULL);
+
+   netreg_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_NETREG);
+
+   if (netreg_atom  __ofono_atom_get_registered(netreg_atom))
+   netreg_watch(netreg_atom,
+   OFONO_ATOM_WATCH_CONDITION_REGISTERED, e);
+}
+
 int ofono_emulator_enable(struct ofono_emulator *e, GIOChannel *channel)
 {
if (channel == NULL)
@@ -815,6 +908,7 @@ int ofono_emulator_enable(struct ofono_emulator 

Re: [PATCH] plugins-mbm: Combining mbm_disable and reopen_callback

2011-01-12 Thread Marcel Holtmann
Hi Tomasz,

 I already had my solution in head and misunderstood you. I will
 correct and retest it.

please do so.

And NO top posting on this mailing list. Keep that in mind.

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] plugins-mbm: Combining mbm_disable and reopen_callback

2011-01-12 Thread Sjur Brændeland
Hi Tomasz, don't worry the tone on the list is quite rough. If you
like marit or I can review tomorrow, but feel free to send patch as
well if you like. :) Sjur

2011/1/12, Tomasz Gregorek tomasz.grego...@gmail.com:
 Hi Marcel
 I already had my solution in head and misunderstood you. I will correct and
 retest it.
 Br
 Tomasz

 2011/1/12 Marcel Holtmann mar...@holtmann.org

 Hi Tomasz,

  Combining mbm_disable and reopen_callback into one and removing 1 second
  delay between them to avoid call to reopen_callback after modem being
  disconnected.

 have you actually tested this? This will not work since you can not
 reopen the TTY right away. You need that delay in between.

 From my previous email, I remember saying that the right fix would be to
 disarm the timer within disable. Why are we not doing that?

 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


[PATCH] phonesim: Add +CUAD command and EFdir EF.

2011-01-12 Thread Andrzej Zaborowski
Add +PTTY in +CLAC output too.
---
 src/default.xml   |   23 +++
 src/simfilesystem.cpp |5 +
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/default.xml b/src/default.xml
index ab1ed06..803c539 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -3165,6 +3165,7 @@
 +CMEE
 +CMGF
 +CMGS
++CUAD
 +DR
 +DS
 +GCAP
@@ -3179,6 +3180,7 @@
 +ILRR
 +IPR
 +FCLASS
++PTTY
 +VBT
 +VCID
 +VGR
@@ -3234,6 +3236,20 @@ OK/response
 response+PTTY: ${PTTY}\n\nOK/response
 /chat
 
+chat
+!-- Discover UICC applications --
+!-- the response is in sync with the EFdir contents in the filesystem
+definition below --
+commandAT+CUAD/command
+response+CUAD: 
611B4F10A000871002890508FF611F4F0CA00063504B43532D313550094D49445066696C657351043F007F80\n\nOK/response
+/chat
+
+chat
+!-- Query Discover UICC applications support --
+commandAT+CUAD=?/command
+responseOK/response
+/chat
+
 !-- SIM filesystem definition, based on standard test strings
  presented in GSM 11.10-4.  This is primarily intended for
  testing icon definitions within SIM toolkit applications --
@@ -3476,6 +3492,13 @@ OK/response
 5A 55
 /file
 
+file name=EFdir recordsize=33
+61 1B 4F 10 A0 00 00 00 87 10 02 FF FF FF FF 89 05 08 00 00 FF FF
+FF FF FF FF FF FF FF FF FF FF FF
+61 1F 4F 0C A0 00 00 00 63 50 4B 43 53 2D 31 35 50 09 4D 49 44 50
+66 69 6C 65 73 51 04 3F 00 7F 80
+/file
+
 /filesystem
 
 /simulator
diff --git a/src/simfilesystem.cpp b/src/simfilesystem.cpp
index 6e05039..46f3b1f 100644
--- a/src/simfilesystem.cpp
+++ b/src/simfilesystem.cpp
@@ -121,6 +121,11 @@ static SimFileInfo const knownFiles[] =
 {6F16,7F20, EFcphs_info, 0x14ff44,  
FILE_TYPE_TRANSPARENT},
 {6F17,7F20, EFcphs_mbdn, 0x11ff44,  
FILE_TYPE_LINEAR_FIXED},
 {6F11,7F20, EFcphs_mwis, 0x11ff44,  
FILE_TYPE_TRANSPARENT},
+
+// TS 102.221
+{2F00,3F00, EFdir,   0x04ff44,  
FILE_TYPE_LINEAR_FIXED},
+{2F06,3F00, EFarr,   0x04ff44,  
FILE_TYPE_LINEAR_FIXED},
+
 {0, 0,  0, 0, 
FILE_TYPE_TRANSPARENT}
 };
 
-- 
1.7.1.86.g0e460.dirty

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] phonesim: Fix access bits for EFiccid, EFpl.

2011-01-12 Thread Andrzej Zaborowski
---
 src/simfilesystem.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/simfilesystem.cpp b/src/simfilesystem.cpp
index 46f3b1f..2264c44 100644
--- a/src/simfilesystem.cpp
+++ b/src/simfilesystem.cpp
@@ -106,8 +106,8 @@ static SimFileInfo const knownFiles[] =
 {6FDE,7F20, EFspni,  0x04ff44,  
FILE_TYPE_TRANSPARENT},
 {6FDF,7F20, EFpnni,  0x04ff44,  
FILE_TYPE_LINEAR_FIXED},
 
-{2FE2,3F00, EFiccid, 0x04ff44,  
FILE_TYPE_TRANSPARENT},
-{2F05,3F00, EFpl,0x11ff44,  
FILE_TYPE_TRANSPARENT},
+{2FE2,3F00, EFiccid, 0x0fff44,  
FILE_TYPE_TRANSPARENT},
+{2F05,3F00, EFpl,0x01ff44,  
FILE_TYPE_TRANSPARENT},
 
 {5F50,7F10, DFgraphics,  0, 
FILE_TYPE_TRANSPARENT},
 {4F20,5F50, EFimg,   0x14ff44,  
FILE_TYPE_LINEAR_FIXED},
-- 
1.7.1.86.g0e460.dirty

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

Client or server mark their pending objects with g_isi_pending_own().

The g_isi_remove_all_my_pending() is used to remove pending objects by
client or server when they get destroyed or reset.
---
 gisi/client.c |  199 ++---
 gisi/modem.c  |   52 +--
 gisi/modem.h  |4 +-
 gisi/server.c |   73 ++---
 4 files changed, 88 insertions(+), 240 deletions(-)

diff --git a/gisi/client.c b/gisi/client.c
index 85e1fa7..58fe0f3 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -32,58 +32,12 @@
 
 #include client.h
 
-struct pending_data {
-   GIsiClient *client;
-   GIsiNotifyFunc notify;
-   void *data;
-   GDestroyNotify destroy;
-};
-
 struct _GIsiClient {
GIsiModem *modem;
unsigned timeout;
uint8_t resource;
-   GSList *pending;
 };
 
-static void pending_destroy(gpointer data)
-{
-   struct pending_data *pd = data;
-
-   if (pd == NULL)
-   return;
-
-   if (pd-destroy != NULL)
-   pd-destroy(pd-data);
-
-   g_free(pd);
-}
-
-static void pending_resp_notify(const GIsiMessage *msg, void *data)
-{
-   struct pending_data *pd = data;
-
-   if (pd == NULL)
-   return;
-
-   pd-client-pending = g_slist_remove(pd-client-pending,
-   g_isi_pending_from_msg(msg));
-
-   if (pd-notify != NULL)
-   pd-notify(msg, pd-data);
-}
-
-static void pending_notify(const GIsiMessage *msg, void *data)
-{
-   struct pending_data *pd = data;
-
-   if (pd == NULL)
-   return;
-
-   if (pd-notify != NULL)
-   pd-notify(msg, pd-data);
-}
-
 uint8_t g_isi_client_resource(GIsiClient *client)
 {
return client != NULL ? client-resource : 0;
@@ -112,31 +66,13 @@ GIsiClient *g_isi_client_create(GIsiModem *modem, uint8_t 
resource)
client-timeout = G_ISI_CLIENT_DEFAULT_TIMEOUT;
client-resource = resource;
client-modem = modem;
-   client-pending = NULL;
 
return client;
 }
 
-static void foreach_destroy(gpointer value, gpointer user)
-{
-   GIsiPending *op = value;
-   GIsiClient *client = user;
-
-   if (op == NULL || client == NULL)
-   return;
-
-   client-pending = g_slist_remove(client-pending, op);
-   g_isi_pending_remove(op);
-}
-
 void g_isi_client_reset(GIsiClient *client)
 {
-   if (client == NULL || client-pending == NULL)
-   return;
-
-   g_slist_foreach(client-pending, foreach_destroy, client);
-   g_slist_free(client-pending);
-   client-pending = NULL;
+   g_isi_remove_all_my_pending(client-modem, client-resource, client);
 };
 
 void g_isi_client_destroy(GIsiClient *client)
@@ -156,43 +92,19 @@ void g_isi_client_set_timeout(GIsiClient *client, unsigned 
timeout)
client-timeout = timeout;
 }
 
-static struct pending_data *pending_data_create(GIsiClient *client,
-   GIsiNotifyFunc notify,
-   void *data,
-   GDestroyNotify destroy)
-{
-   struct pending_data *pd;
-
-   if (client == NULL) {
-   errno = EINVAL;
-   return NULL;
-   }
-
-   pd = g_try_new0(struct pending_data, 1);
-   if (pd == NULL) {
-   errno = ENOMEM;
-   return NULL;
-   }
-
-   pd-client = client;
-   pd-notify = notify;
-   pd-data = data;
-   pd-destroy = destroy;
-
-   return pd;
-}
-
 gboolean g_isi_client_send(GIsiClient *client,
const void *__restrict msg, size_t len,
GIsiNotifyFunc notify, void *data,
GDestroyNotify destroy)
 {
-   if (client == NULL)
-   return FALSE;
+   GIsiPending *op;
+
+   op = g_isi_request_send(client-modem, client-resource, msg, len,
+   client-timeout, notify, data, destroy);
 
-   return g_isi_client_send_with_timeout(client, msg, len,
-   client-timeout,
-   notify, data, destroy);
+   g_isi_pending_own(op, client);
+
+   return op != NULL;
 }
 
 gboolean g_isi_client_send_with_timeout(GIsiClient *client,
@@ -201,23 +113,14 @@ gboolean g_isi_client_send_with_timeout(GIsiClient 
*client,
GIsiNotifyFunc notify, void *data,
GDestroyNotify destroy)
 {
-   struct pending_data *pd;
GIsiPending *op;
 
-   pd = pending_data_create(client, notify, data, destroy);
-   if (pd == NULL)
-   return FALSE;
-
op = g_isi_request_send(client-modem, client-resource, buf, len,
-   timeout, pending_resp_notify, pd,
-   

[gisi-notify-fix PATCH 0/4]

2011-01-12 Thread Pekka . Pessi
Hi Aki,

Here are patches simplifying the gisi client/server implementation and
also making it more robust.

--Pekka

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[gisi-notify-fix PATCH 4/4] isimodem: fix crash in gprs

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

There was a crash if gprs was removed while creating context.
---
 drivers/isimodem/gprs.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/isimodem/gprs.c b/drivers/isimodem/gprs.c
index e614ac9..1550f24 100644
--- a/drivers/isimodem/gprs.c
+++ b/drivers/isimodem/gprs.c
@@ -199,6 +199,9 @@ static void info_pp_read_resp_cb(const GIsiMessage *msg, 
void *opaque)
uint8_t count = GPDS_MAX_CONTEXT_COUNT;
GIsiSubBlockIter iter;
 
+   if (g_isi_msg_error(msg) == -ESHUTDOWN)
+   return;
+
if (g_isi_msg_error(msg)  0)
goto out;
 
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[gisi-notify-fix PATCH 3/4] gisi: remove g_isi_pending_from_msg()

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

---
 gisi/modem.c |9 -
 gisi/modem.h |2 --
 2 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/gisi/modem.c b/gisi/modem.c
index ba79a31..0d19acd 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -156,8 +156,6 @@ static void pending_dispatch(GIsiPending *pend, GIsiMessage 
*msg)
g_isi_msg_resource(msg), g_isi_msg_id(msg),
g_isi_msg_utid(msg));
 
-   msg-private = pend;
-
pend-notify(msg, pend-data);
 }
 
@@ -177,8 +175,6 @@ static void pending_remove_and_dispatch(GIsiPending *op, 
GIsiMessage *msg)
g_isi_msg_resource(msg), g_isi_msg_id(msg),
g_isi_msg_utid(msg));
 
-   msg-private = op;
-
op-notify(msg, op-data);
 
 destroy:
@@ -770,11 +766,6 @@ uint8_t g_isi_request_utid(GIsiPending *resp)
return resp != NULL ? resp-utid : 0;
 }
 
-GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg)
-{
-   return msg != NULL ? msg-private : NULL;
-}
-
 static void foreach_destroy(GIsiPending *op)
 {
if (op-type == GISI_MESSAGE_TYPE_IND)
diff --git a/gisi/modem.h b/gisi/modem.h
index 91fe3d0..52de7ab 100644
--- a/gisi/modem.h
+++ b/gisi/modem.h
@@ -107,8 +107,6 @@ int g_isi_response_vsend(GIsiModem *modem, const 
GIsiMessage *req,
const struct iovec *__restrict iov,
size_t iovlen);
 
-GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg);
-
 void g_isi_pending_own(GIsiPending *op, gpointer owner);
 void g_isi_remove_all_my_pending(GIsiModem *modem, uint8_t resource,
gpointer owner);
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[gisi-notify-fix PATCH 1/4] gisi: remove before notify

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

Just in case, remove pending operations before calling notifys.
The notify function can remove client, service or modem.
---
 gisi/client.c |6 ++--
 gisi/modem.c  |   71 +
 2 files changed, 49 insertions(+), 28 deletions(-)

diff --git a/gisi/client.c b/gisi/client.c
index 03ed5de..85e1fa7 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -66,11 +66,11 @@ static void pending_resp_notify(const GIsiMessage *msg, 
void *data)
if (pd == NULL)
return;
 
-   if (pd-notify != NULL)
-   pd-notify(msg, pd-data);
-
pd-client-pending = g_slist_remove(pd-client-pending,
g_isi_pending_from_msg(msg));
+
+   if (pd-notify != NULL)
+   pd-notify(msg, pd-data);
 }
 
 static void pending_notify(const GIsiMessage *msg, void *data)
diff --git a/gisi/modem.c b/gisi/modem.c
index 0682666..14827d8 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -155,9 +155,41 @@ static void pending_dispatch(GIsiPending *pend, 
GIsiMessage *msg)
g_isi_msg_resource(msg), g_isi_msg_id(msg),
g_isi_msg_utid(msg));
 
+   msg-private = pend;
+
pend-notify(msg, pend-data);
 }
 
+static void pending_remove_and_dispatch(GIsiPending *op, GIsiMessage *msg)
+{
+   GIsiModem *modem;
+
+   op-service-pending = g_slist_remove(op-service-pending, op);
+
+   if (op-notify == NULL || msg == NULL)
+   goto destroy;
+
+   modem = op-service-modem;
+
+   ISIDBG(modem, %s %s to %p [res=0x%02X, id=0x%02X, utid=0x%02X],
+   g_isi_msg_strerror(msg), pend_type_to_str(op-type), op,
+   g_isi_msg_resource(msg), g_isi_msg_id(msg),
+   g_isi_msg_utid(msg));
+
+   msg-private = op;
+
+   op-notify(msg, op-data);
+
+destroy:
+   if (op-timeout  0)
+   g_source_remove(op-timeout);
+
+   if (op-destroy != NULL)
+   op-destroy(op-data);
+
+   g_free(op);
+}
+
 static void service_dispatch(GIsiServiceMux *mux, GIsiMessage *msg,
gboolean is_indication)
 {
@@ -169,7 +201,6 @@ static void service_dispatch(GIsiServiceMux *mux, 
GIsiMessage *msg,
while (l != NULL) {
GSList *next = l-next;
GIsiPending *pend = l-data;
-   msg-private = pend;
 
/*
 * REQs, NTFs and INDs are dispatched on message ID.  While
@@ -192,24 +223,18 @@ static void service_dispatch(GIsiServiceMux *mux, 
GIsiMessage *msg,
pending_dispatch(pend, msg);
 
} else if (pend-type == GISI_MESSAGE_TYPE_RESP 
-   !is_indication  pend-utid == utid) {
+!is_indication  pend-utid == utid) {
 
-   pending_dispatch(pend, msg);
-   pend-notify = NULL;
-
-   g_isi_pending_remove(pend);
+   pending_remove_and_dispatch(pend, msg);
break;
 
} else if (pend-type == GISI_MESSAGE_TYPE_COMMON 
msgid == COMMON_MESSAGE 
pend-msgid == COMM_ISI_VERSION_GET_REQ) {
 
-   pending_dispatch(pend, msg);
-   pend-notify = NULL;
-
-   g_isi_pending_remove(pend);
-
+   pending_remove_and_dispatch(pend, msg);
}
+
l = next;
}
 }
@@ -634,16 +659,15 @@ static void vtrace(struct sockaddr_pn *dst,
 
 static gboolean resp_timeout(gpointer data)
 {
-   GIsiPending *resp = data;
+   GIsiPending *op = data;
GIsiMessage msg = {
.error = ETIMEDOUT,
-   .private = resp,
};
 
-   pending_dispatch(resp, msg);
-   resp-notify = NULL;
+   op-timeout = 0;
+
+   pending_remove_and_dispatch(op, msg);
 
-   g_isi_pending_remove(resp);
return FALSE;
 }
 
@@ -755,8 +779,6 @@ void g_isi_pending_remove(GIsiPending *op)
if (op == NULL)
return;
 
-   op-service-pending = g_slist_remove(op-service-pending, op);
-
if (op-type == GISI_MESSAGE_TYPE_IND)
service_subs_decr(op-service);
 
@@ -766,12 +788,14 @@ void g_isi_pending_remove(GIsiPending *op)
if (op-type == GISI_MESSAGE_TYPE_RESP  op-notify != NULL) {
GIsiMessage msg = {
.error = ESHUTDOWN,
-   .private = op,
};
-   op-notify(msg, op-data);
-   op-notify = NULL;
+
+   pending_remove_and_dispatch(op, msg);
+   return;
}
 
+   op-service-pending = g_slist_remove(op-service-pending, op);
+
pending_destroy(op, NULL);
 }
 
@@ -1045,14 +1069,11 @@ static gboolean 

[sim-ready-nofify-v4 PATCH 1/3] sim: add ofono_sim_ready_notify

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

The sim atom waits for ofono_sim_ready_notify() after the callback
to query_passwd_state.

Upon call to ofono_sim_ready_notify(), SIM atom either continues
initialization or rechecks if the SIM still requires a pin code.

Based on patches by Kristen Accardi and Denis Kenzior.
---
 include/sim.h |2 ++
 src/sim.c |   35 +--
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/include/sim.h b/include/sim.h
index 830322a..ed752b2 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -193,6 +193,8 @@ enum ofono_sim_state ofono_sim_get_state(struct ofono_sim 
*sim);
 
 void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted);
 
+void ofono_sim_ready_notify(struct ofono_sim *sim);
+
 /* This will queue an operation to read all available records with id from the
  * SIM.  Callback cb will be called every time a record has been read, or once
  * if an error has occurred.  For transparent files, the callback will only
diff --git a/src/sim.c b/src/sim.c
index d627647..7d4c715 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -45,6 +45,8 @@
 #include simfs.h
 #include stkutil.h
 
+#define SIM_FLAG_WAIT_FOR_READY (1  0)
+
 static GSList *g_drivers = NULL;
 
 static void sim_own_numbers_update(struct ofono_sim *sim);
@@ -76,6 +78,7 @@ struct ofono_sim {
unsigned char efsst_length;
gboolean fixed_dialing;
gboolean barred_dialing;
+   guint flags;
 
char *imsi;
 
@@ -1627,6 +1630,8 @@ static void sim_efphase_read_cb(int ok, int length, int 
record,
 
 static void sim_initialize_after_pin(struct ofono_sim *sim)
 {
+   sim-flags = SIM_FLAG_WAIT_FOR_READY;
+
ofono_sim_read(sim, SIM_EFPHASE_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_efphase_read_cb, sim);
@@ -1653,10 +1658,11 @@ static void sim_pin_query_cb(const struct ofono_error 
*error,
const char *path = __ofono_atom_get_path(sim-atom);
const char *pin_name;
 
+   sim-flags |= SIM_FLAG_WAIT_FOR_READY;
+
if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error(Querying PIN authentication state failed);
-
-   goto checkdone;
+   return;
}
 
if (sim-pin_type != pin_type) {
@@ -1677,10 +1683,6 @@ static void sim_pin_query_cb(const struct ofono_error 
*error,
}
 
sim_pin_retries_check(sim);
-
-checkdone:
-   if (pin_type == OFONO_SIM_PASSWORD_NONE)
-   sim_initialize_after_pin(sim);
 }
 
 static void sim_pin_check(struct ofono_sim *sim)
@@ -1693,6 +1695,25 @@ static void sim_pin_check(struct ofono_sim *sim)
sim-driver-query_passwd_state(sim, sim_pin_query_cb, sim);
 }
 
+void ofono_sim_ready_notify(struct ofono_sim *sim)
+{
+   DBG();
+
+   if (sim == NULL)
+   return;
+
+   if (sim-state != OFONO_SIM_STATE_INSERTED)
+   return;
+
+   if (!(sim-flags  SIM_FLAG_WAIT_FOR_READY))
+   return;
+
+   if (sim-pin_type == OFONO_SIM_PASSWORD_NONE)
+   sim_initialize_after_pin(sim);
+   else
+   sim_pin_check(sim);
+}
+
 static void sim_efli_read_cb(int ok, int length, int record,
const unsigned char *data,
int record_length, void *userdata)
@@ -2115,6 +2136,8 @@ static void sim_free_state(struct ofono_sim *sim)
 
sim-fixed_dialing = FALSE;
sim-barred_dialing = FALSE;
+
+   sim-flags = 0;
 }
 
 void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[sim-ready-nofify-v4 PATCH 2/3] atmodem/sim: use ofono_sim_ready_notify

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

Schedule a call to ofono_sim_ready_notify after pin code query returns
SIM READY.

Vendor quirks:
- IFX: register unsolicated +XSIM result code
- MBM: register unsolicated *EPEV result code
---
 drivers/atmodem/sim.c |  166 ++--
 1 files changed, 117 insertions(+), 49 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index b1d971d..44d9047 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -46,10 +46,14 @@
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
+#define READY_TIMEOUT  5000
+
 struct sim_data {
GAtChat *chat;
unsigned int vendor;
guint ready_id;
+   guint ready_source;
+   ofono_bool_t ready;
 };
 
 static const char *crsm_prefix[] = { +CRSM:, NULL };
@@ -558,10 +562,55 @@ static void at_pin_retries_query(struct ofono_sim *sim,
}
 }
 
+static void ready_unregister_and_notify(struct ofono_sim *sim)
+{
+   struct sim_data *sd = ofono_sim_get_data(sim);
+
+   DBG();
+
+   if (sd-ready_source  0) {
+   g_source_remove(sd-ready_source);
+   sd-ready_source = 0;
+   }
+
+   ofono_sim_ready_notify(sim);
+}
+
+static gboolean ready_timeout(gpointer user_data)
+{
+   struct ofono_sim *sim = user_data;
+   struct sim_data *sd = ofono_sim_get_data(sim);
+
+   DBG();
+
+   sd-ready_source = 0;
+
+   ofono_sim_ready_notify(sim);
+
+   return FALSE;
+}
+
+static void at_wait_for_ready(struct ofono_sim *sim)
+{
+   struct sim_data *sd = ofono_sim_get_data(sim);
+   guint timeout;
+
+   if (sd-ready_source  0)
+   return;
+
+   if (!sd-ready  sd-ready_id  0)
+   timeout = READY_TIMEOUT;
+   else
+   timeout = 0;
+
+   sd-ready_source = g_timeout_add(timeout, ready_timeout, sim);
+}
+
 static void at_cpin_cb(gboolean ok, GAtResult *result, gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   struct sim_data *sd = ofono_sim_get_data(cbd-user);
+   struct ofono_sim *sim = cbd-user;
+   struct sim_data *sd = ofono_sim_get_data(sim);
GAtResultIter iter;
ofono_sim_passwd_cb_t cb = cbd-cb;
struct ofono_error error;
@@ -608,6 +657,11 @@ static void at_cpin_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
return;
}
 
+   if (pin_type == OFONO_SIM_PASSWORD_NONE)
+   at_wait_for_ready(sim);
+   else
+   sd-ready = FALSE;
+
DBG(crsm_pin_cb: %s, pin_required);
 
cb(error, pin_type, cbd-data);
@@ -636,13 +690,13 @@ error:
 
 static void at_xsim_notify(GAtResult *result, gpointer user_data)
 {
-   struct cb_data *cbd = user_data;
-   struct sim_data *sd = cbd-user;
-   ofono_sim_lock_unlock_cb_t cb = cbd-cb;
-   struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR };
+   struct ofono_sim *sim = user_data;
+   struct sim_data *sd = ofono_sim_get_data(sim);
GAtResultIter iter;
int state;
 
+   DBG();
+
g_at_result_iter_init(iter, result);
 
if (!g_at_result_iter_next(iter, +XSIM:))
@@ -659,65 +713,40 @@ static void at_xsim_notify(GAtResult *result, gpointer 
user_data)
return;
}
 
-   cb(error, cbd-data);
+   sd-ready = TRUE;
 
-   g_at_chat_unregister(sd-chat, sd-ready_id);
-   sd-ready_id = 0;
+   if (sd-ready_source  0)
+   ready_unregister_and_notify(sim);
 }
 
 static void at_epev_notify(GAtResult *result, gpointer user_data)
 {
-   struct cb_data *cbd = user_data;
-   struct sim_data *sd = cbd-user;
-   ofono_sim_lock_unlock_cb_t cb = cbd-cb;
-   struct ofono_error error = { .type = OFONO_ERROR_TYPE_NO_ERROR };
+   struct ofono_sim *sim = user_data;
+   struct sim_data *sd = ofono_sim_get_data(sim);
 
-   cb(error, cbd-data);
+   DBG();
 
-   g_at_chat_unregister(sd-chat, sd-ready_id);
-   sd-ready_id = 0;
+   sd-ready = TRUE;
+
+   if (sd-ready_source  0)
+   ready_unregister_and_notify(sim);
 }
 
 static void at_pin_send_cb(gboolean ok, GAtResult *result,
gpointer user_data)
 {
struct cb_data *cbd = user_data;
-   struct sim_data *sd = cbd-user;
+   struct ofono_sim *sim = cbd-user;
+   struct sim_data *sd = ofono_sim_get_data(sim);
ofono_sim_lock_unlock_cb_t cb = cbd-cb;
struct ofono_error error;
 
-   decode_at_error(error, g_at_result_final_response(result));
+   if (ok  sd-ready_id)
+   at_wait_for_ready(sim);
 
-   if (!ok)
-   goto done;
-
-   switch (sd-vendor) {
-   case OFONO_VENDOR_IFX:
-   /*
-* On the IFX modem, AT+CPIN? can return READY too
-* early and so use +XSIM notification to detect
-* the ready state of the SIM.
-  

[sim-ready-nofify-v4 PATCH 0/3] ofono_sim_ready_notify()

2011-01-12 Thread Pekka . Pessi
Hi all,

Here is my 5th stab at the ofono_sim_ready_notify().

The main difference to the patches submitted 16th December last year is
that the isimodem sim driver has been refactored to the new SIM API. The
AT modem driver and core has been rebased to current master, too.

The ofono_sim_ready_notify() is now always expected after call to
query_passwd_state.

When ofono_sim_ready_notify() is invoked, it checks that the call is
expected and if needed, retries the query_passwd_state, otherwise it
proceeds with sim initialization.

The patches has now been tested with the PIN and PUK codes with mbm, ifx
on NCDK and with N900 using Jukka's new isimodem sim driver.

--Pekka

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/5] sim: Cache flushing functions.

2011-01-12 Thread Denis Kenzior
Hi Andrew,

On 01/10/2011 05:01 AM, Andrzej Zaborowski wrote:
 ---
  src/sim.c   |   23 
  src/simfs.c |   68 --
  src/simfs.h |5 
  3 files changed, 79 insertions(+), 17 deletions(-)
 

So I applied this patch but...:

 +
 +static void sim_file_changed_flush(struct ofono_sim *sim, int id)
 +{
 + int i, imgid;
 +
 + if (id == SIM_EFIMG_FILEID)
 + /* All cached images become invalid */
 + sim_fs_image_cache_flush(sim-simfs);
 + else if (sim-efimg)
 + /*
 +  * Data and CLUT for image instances stored in the changed
 +  * file need to be re-read.
 +  */
 + for (i = sim-efimg_length / 9 - 1; i = 0; i--) {
 + imgid = (sim-efimg[i * 9 + 3]  8) |
 + sim-efimg[i * 9 + 4];
 +
 + if (imgid == id)
 + sim_fs_image_cache_flush_file(sim-simfs, i);
 + }
 +
 + sim_fs_cache_flush_file(sim-simfs, id);
 +}

This function seems extraneous to this patch.  I assumed that it was
meant to be included in patch 4 and I left it out.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/5] sim: Implement file watching and basic refresh.

2011-01-12 Thread Denis Kenzior
Hi Andrew,

 +void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
 + ofono_bool_t full_file_change, ofono_bool_t naa_init)
 +{
 + GSList *l, *filel;
 + enum sim_reset_state {
 + RESET_STATE_NOT_PRESENT = OFONO_SIM_STATE_NOT_PRESENT,
 + RESET_STATE_INSERTED= OFONO_SIM_STATE_INSERTED,
 + RESET_STATE_READY   = OFONO_SIM_STATE_READY,
 + RESET_STATE_NONE,
 + } reset_state = RESET_STATE_NONE;
 +
 + /* Flush cached content for affected files */
 + if (full_file_change)
 + sim_fs_cache_flush(sim-simfs);
 + else
 + for (filel = file_list; filel; filel = filel-next) {
 + struct stk_file *file = filel-data;
 + int id = (file-file[file-len - 2]  8) |
 + (file-file[file-len - 1]  0);
 +
 + sim_file_changed_flush(sim, id);
 + }

Just a nitpick, but when you have such compound statements inside
if/while/for, could you enclose them in parentheses?  I think that makes
the code a bit more readable.

e.g.
if (foo)
else {
for () {

}
}

 +
 + if (naa_init)
 + reset_state = RESET_STATE_INSERTED;
 +
 + /*
 +  * Check if we have file change handlers for all of the affected
 +  * files.  If not, we will fall back to re-initialising the
 +  * application which ensures that all files are re-read.
 +  */
 + for (l = sim-fs_watches; l; l = l-next) {
 + struct fs_watch *w = l-data;
 +
 + if (full_file_change) {
 + if (w-notify)
 + continue;
 +
 + if (w-reset_state  reset_state)
 + reset_state = reset_state;
 +
 + continue;
 + }
 +
 + for (filel = file_list; filel; filel = filel-next) {
 + struct stk_file *file = filel-data;
 + int id = (file-file[file-len - 2]  8) |
 + (file-file[file-len - 1]  0);
 +
 + if (id != w-id)
 + continue;
 +
 + if (w-notify)
 + break;
 +
 + if (w-reset_state  reset_state)
 + reset_state = reset_state;
 +
 + break;
 + }
 + }
 +
 + /*
 +  * Notify the subscribers of files that have changed unless we
 +  * have determined that a re-initialisation is necessary and
 +  * will trigger re-reading of those files anyway.
 +  */
 + for (l = sim-fs_watches; l; l = l-next) {
 + struct fs_watch *w = l-data;
 +
 + if (full_file_change) {
 + if (w-reset_state  reset_state)
 + w-notify(w-id, w-notify_data);
 +
 + continue;
 + }
 +
 + for (filel = file_list; filel; filel = filel-next) {
 + struct stk_file *file = filel-data;
 + int id = (file-file[file-len - 2]  8) |
 + (file-file[file-len - 1]  0);
 +
 + if (id != w-id)
 + continue;
 +
 + if (w-reset_state  reset_state)
 + w-notify(w-id, w-notify_data);
 +
 + break;
 + }
 + }
 +
 + switch (reset_state) {
 + case RESET_STATE_NOT_PRESENT:
 + ofono_sim_inserted_notify(sim, FALSE);
 + ofono_sim_inserted_notify(sim, TRUE);

Are you sure we can do it this way?  I would assume that the modem might
require some time to perform its own SIM initialization and would have
to signal the sim_inserted itself...

 + break;
 + case RESET_STATE_INSERTED:
 + sim_free_state(sim);
 + sim-state = OFONO_SIM_STATE_INSERTED;
 + sim_initialize(sim);

What about removing all the post_sim / online atoms?  In theory
something like EFfdn could have been changed and now we're stuck in
fixed dialing mode.  We should not keep the atoms around in this case.

 + break;
 + case RESET_STATE_READY:
 + sim-state = OFONO_SIM_STATE_INSERTED;
 + for (l = sim-state_watches-items; l; l = l-next) {
 + struct ofono_watchlist_item *item = l-data;
 + ofono_sim_state_event_cb_t notify = item-notify;
 +
 + notify(sim-state, item-notify_data);

I'm having trouble understanding the need for this for loop.  Isn't the
SIM already inserted?

 + }
 +
 + sim_set_ready(sim);
 + break;
 + case RESET_STATE_NONE:
 + break;
 + }
 +}

Overall it seems like there are two categories of files that we should
worry about:

- Those handled inside sim.c that affect sim 

Re: [PATCH 0/2] Add additional information for mandatory general result

2011-01-12 Thread Denis Kenzior
Hi Jeevaka,

On 01/06/2011 01:41 PM, Jeevaka Badrappan wrote:
 Hi,
 
  As per the ETSI TS 102 223 specification section 8.12.2,
 
 For the general result terminal currently unable to process command,
 it is mandatory for the terminal to provide additional information.
 Defined values for additional information can be found in the same
 section. Coding '00' shall be used by the terminal if none of the defined
 values apply.
 
  Following set of patches, introduce a macro for adding the additional
 information and changes done to existing code to make use of added macro.
 

Both patches have been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC 1/4] network: __ofono_netreg_registration_status internal api

2011-01-12 Thread Denis Kenzior
Hi Jeevaka,

On 01/10/2011 03:43 AM, Jeevaka Badrappan wrote:
 ---
  src/network.c |8 
  src/ofono.h   |2 ++
  2 files changed, 10 insertions(+), 0 deletions(-)
 
 diff --git a/src/network.c b/src/network.c
 index eb0f797..640391d 100644
 --- a/src/network.c
 +++ b/src/network.c
 @@ -1864,3 +1864,11 @@ void *ofono_netreg_get_data(struct ofono_netreg 
 *netreg)
  {
   return netreg-driver_data;
  }
 +
 +int __ofono_netreg_registration_status(struct ofono_netreg *netreg)
 +{
 + if (netreg == NULL)
 + return NETWORK_REGISTRATION_STATUS_UNKNOWN;
 +

For internal API I suggest skipping the NULL check.  I'd rather see us
crash early.

 + return netreg-status;
 +}
 diff --git a/src/ofono.h b/src/ofono.h
 index cab70cd..91f737f 100644
 --- a/src/ofono.h
 +++ b/src/ofono.h
 @@ -375,6 +375,8 @@ gboolean __ofono_netreg_remove_status_watch(struct 
 ofono_netreg *netreg,
  void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
   const char *name);
  
 +int __ofono_netreg_registration_status(struct ofono_netreg *netreg);
 +

Please name this __ofono_netreg_get_registration_status

  #include ofono/history.h
  
  void __ofono_history_probe_drivers(struct ofono_modem *modem);

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC 4/4] doc: Describe LaunchBrowser method

2011-01-12 Thread Denis Kenzior
Hi Jeevaka,

On 01/10/2011 03:43 AM, Jeevaka Badrappan wrote:
 ---
  doc/stk-api.txt |8 
  1 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/doc/stk-api.txt b/doc/stk-api.txt
 index 425ee23..347e39d 100644
 --- a/doc/stk-api.txt
 +++ b/doc/stk-api.txt
 @@ -257,6 +257,14 @@ Methods  byte RequestSelection(string title, 
 byte icon_id,
   until the call is canceled using Cancel().  This
   method should not return.
  
 + boolean LaunchBrowser() (string information, byte icon_id,
 + string url)
 +
 + Asks the agent to request user to confirm launch
 + browser. If confirmed, then the agent should send
 + confirmation message to oFono and then should open
 + the launch browser with the given url.
 +

Let us call this ConfirmLaunchBrowser

   void Cancel() [noreply]
  
   Asks the agent to cancel any ongoing operation in

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC 2/4] stk: Handle Launch Browser proactive command

2011-01-12 Thread Denis Kenzior
Hi Jeevaka,

 +static gboolean handle_command_launch_browser(const struct stk_command *cmd,
 + struct stk_response *rsp,
 + struct ofono_stk *stk)
 +{
 + const struct stk_command_launch_browser *lb = cmd-launch_browser;
 + struct ofono_modem *modem = __ofono_atom_get_modem(stk-atom);
 + static unsigned char no_cause[] = { 0x00 };
 + static unsigned char no_service[] = { 0x04 };
 + struct ofono_atom *netreg_atom;
 + struct ofono_netreg *netreg;
 + int qualifier = cmd-qualifier;
 + char *alpha_id;
 + int err;
 + int status;
 +
 + if (qualifier  3 || qualifier == 1) {
 + rsp-result.type = STK_RESULT_TYPE_COMMAND_NOT_UNDERSTOOD;
 + return TRUE;
 + }
 +
 + if ( lb-browser_id  4) {
 + rsp-result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
 + return TRUE;
 + }
 +
 + if (ofono_modem_get_online(modem) == FALSE) {
 + ADD_ERROR_RESULT(rsp-result, STK_RESULT_TYPE_TERMINAL_BUSY,
 + no_service);
 + return TRUE;
 + }
 +
 + netreg_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_NETREG);
 + if (netreg_atom == NULL) {
 + rsp-result.type = STK_RESULT_TYPE_NOT_CAPABLE;
 + return TRUE;
 + }
 +
 + netreg = __ofono_atom_get_data(netreg_atom);
 + status = __ofono_netreg_registration_status(netreg);
 +
 + if (status != NETWORK_REGISTRATION_STATUS_REGISTERED 
 + status != NETWORK_REGISTRATION_STATUS_ROAMING) {
 + ADD_ERROR_RESULT(rsp-result, STK_RESULT_TYPE_TERMINAL_BUSY,
 + no_service);
 + return TRUE;
 + }
 +

So a question about this.  Why are we checking the netreg atom?
Shouldn't we be checking the gprs atom's attached property?  But this
brings up an even more interesting question, do we even need to assume
that we have to be attached to the cellular network to perform these
operations?  We could in theory go over wifi.

Thoughts?

 + alpha_id = dbus_apply_text_attributes(lb-alpha_id ? lb-alpha_id : ,
 + lb-text_attr);
 + if (alpha_id == NULL) {
 + rsp-result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
 + return TRUE;
 + }
 +
 + err = stk_agent_launch_browser(stk-current_agent, alpha_id,
 + lb-icon_id.id, lb-url,
 + confirm_launch_browser_cb,
 + stk, NULL, stk-timeout * 1000);
 + g_free(alpha_id);
 +
 + if (err  0) {
 + /*
 +  * We most likely got an out of memory error, tell SIM
 +  * to retry
 +  */
 + ADD_ERROR_RESULT(rsp-result, STK_RESULT_TYPE_TERMINAL_BUSY,
 + no_cause);
 + return TRUE;
 + }
 +
 + stk-respond_on_exit = TRUE;
 + stk-cancel_cmd = stk_request_cancel;
 +
 + return FALSE;
 +}
 +

Rest seems reasonable to me.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [RFC 2/4] stk: Handle Launch Browser proactive command

2011-01-12 Thread andrzej zaborowski
Hi,

On 12 January 2011 23:31, Denis Kenzior denk...@gmail.com wrote:
 +static gboolean handle_command_launch_browser(const struct stk_command *cmd,
 +                                             struct stk_response *rsp,
 +                                             struct ofono_stk *stk)
 +{
 +     const struct stk_command_launch_browser *lb = cmd-launch_browser;
 +     struct ofono_modem *modem = __ofono_atom_get_modem(stk-atom);
 +     static unsigned char no_cause[] = { 0x00 };
 +     static unsigned char no_service[] = { 0x04 };
 +     struct ofono_atom *netreg_atom;
 +     struct ofono_netreg *netreg;
 +     int qualifier = cmd-qualifier;
 +     char *alpha_id;
 +     int err;
 +     int status;
 +
 +     if (qualifier  3 || qualifier == 1) {
 +             rsp-result.type = STK_RESULT_TYPE_COMMAND_NOT_UNDERSTOOD;
 +             return TRUE;
 +     }
 +
 +     if ( lb-browser_id  4) {
 +             rsp-result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
 +             return TRUE;
 +     }
 +
 +     if (ofono_modem_get_online(modem) == FALSE) {
 +             ADD_ERROR_RESULT(rsp-result, STK_RESULT_TYPE_TERMINAL_BUSY,
 +                                     no_service);
 +             return TRUE;
 +     }
 +
 +     netreg_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_NETREG);
 +     if (netreg_atom == NULL) {
 +             rsp-result.type = STK_RESULT_TYPE_NOT_CAPABLE;
 +             return TRUE;
 +     }
 +
 +     netreg = __ofono_atom_get_data(netreg_atom);
 +     status = __ofono_netreg_registration_status(netreg);
 +
 +     if (status != NETWORK_REGISTRATION_STATUS_REGISTERED 
 +                     status != NETWORK_REGISTRATION_STATUS_ROAMING) {
 +             ADD_ERROR_RESULT(rsp-result, STK_RESULT_TYPE_TERMINAL_BUSY,
 +                                     no_service);
 +             return TRUE;
 +     }
 +

 So a question about this.  Why are we checking the netreg atom?
 Shouldn't we be checking the gprs atom's attached property?  But this
 brings up an even more interesting question, do we even need to assume
 that we have to be attached to the cellular network to perform these
 operations?  We could in theory go over wifi.

I agree that the modem online property is unrelated to this.  Also the
card may in theory specify a URL that designates a local file or
something on a local network, not the internet.

Best regards
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[sim-auth RFCv2 4/4] Include doc/sim-authentication-api.txt in dist.

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

---
 Makefile.am |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4dec90a..f3afb20 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -380,6 +380,7 @@ doc_files = doc/overview.txt doc/ofono-paper.txt 
doc/release-faq.txt \
doc/message-api.txt doc/message-waiting-api.txt \
doc/phonebook-api.txt doc/radio-settings-api.txt \
doc/sim-api.txt doc/stk-api.txt \
+   doc/sim-authentication-api.txt \
doc/audio-settings-api.txt doc/text-telephony-api.txt \
doc/calypso-modem.txt
 
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[sim-auth RFCv2 2/4] Added doc/sim-authentication-api.txt.

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

The authentication mechanisms include SIM authentication (basic A8
authentication used with GSM), AKA authentication and UICC-based GBA
authentication.

The SIM and AKA can be used to implement EAP and GBA authentication
algorithms.

The interface can be applied to both SIM/USIM or ISIMs.
---
 doc/sim-authentication-api.txt |  186 
 1 files changed, 186 insertions(+), 0 deletions(-)
 create mode 100644 doc/sim-authentication-api.txt

diff --git a/doc/sim-authentication-api.txt b/doc/sim-authentication-api.txt
new file mode 100644
index 000..97f4fac
--- /dev/null
+++ b/doc/sim-authentication-api.txt
@@ -0,0 +1,186 @@
+SimAuthentication hierarchy
+===
+
+Serviceorg.ofono
+Interface  org.ofono.SimAuthentication
+Object path[variable prefix]/{modem0,modem1,...} for SIM/USIM
+   [variable prefix]/{modem0,modem1,...}/{isim01,...} for 
ISIM
+
+Methodsdict GetProperties()
+
+   Returns all properties for this object. See the
+   properties section for available properties.
+
+   Possible Errors: [service].Error.InvalidArguments
+
+   dict Authenticate(string suite, dict input)
+
+   Executes the requested authentication suite.
+   The input and returned result depend on the
+   authentication suite.
+
+   See the suite sections for input and results for
+   each suite.
+
+   Possible Errors: [service].Error.InvalidArguments
+[service].Error.NotImplemented
+
+Properties array{string} Suites [readonly]
+
+   Contains the list of supported authentication
+   suites and applications. The possible values are:
+
+   SIM - SIM authentication
+   AKA - AKA authentication
+   GBA_U - UICC-based GBA authentication
+
+   string IPMultimediaPrivateIdentity [readonly, optional]
+
+   GBA identity read from ISIM or derived from IMSI.
+
+   string BootstrappingServerFunctionAddress [readonly, optional]
+
+   FQDN read from ISIM or derived from IMSI,
+   used with GBA.
+
+   string TMPI [readonly, optional]
+
+   Temporary identity used in GBA bootstrapping.
+
+   string BTID [readonly, optional]
+
+   Unique identity obtained from BSF server.
+
+SIM Authentication Suite
+
+
+   SIM authentication can be used to implement EAP SIM or
+   GBA_ME authentication.
+
+   In case of successful SIM authentication the returned
+   dictionary contains following items:
+
+   byte{array} SRES - SRES parameter
+
+   byte{array} Kc - Kc ciphering key
+
+   The SRES parameter is a 4-byte array.
+   The Kc parameter is a 8-byte array.
+
+AKA Authentication Suite
+
+
+   AKA authentication can be used to implement EAP AKA, AKA
+   digest or GBA_ME authentication.
+
+   The input dictionary must contain following input
+   parameters:
+
+   byte{array} RAND - RAND parameter
+
+   byte{array} AUTN - AUTN parameter
+
+   In case of successful AKA authentication the returned
+   dictionary contains following items:
+
+   byte{array} RES - AKA RES parameter
+
+   byte{array} CK - AKA Ciphering key
+
+   byte{array} IK - AKA Integrity key
+
+   AKA is a mutual authentication algorithm: terminal and
+   network authenticate each other. In case the terminal
+   rejects the AUTN from network, the returned dictionary
+   contain following item:
+
+   byte{array} AUTS - AKA AUTS parameter
+
+   All the AKA parameters and keys are 16-byte arrays.
+
+UICC-based GBA Authentication Suite
+---
+
+   GBA is used to establish a unique identity and a shared
+   secret between SIM card and a network service.
+
+   The GBA_ME variant where the Ks key is stored outside
+   SIM card can be implemented using ordinary SIM or AKA
+   authentication.
+
+   The UICC-based GBA variant, GBA_U, keeps the Ks key
+   stored on the SIM card (UICC) and lets the SIM card
+   calculate the NAF keys.
+
+   For further reference on GBA, see 3GPP TS 33.220
+   and 3GPP TS 24.109.
+
+ 

[sim-auth RFCv2 1/4] TODO: add SIM authentication

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

---
 TODO |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/TODO b/TODO
index 6ad972e..11330b6 100644
--- a/TODO
+++ b/TODO
@@ -97,6 +97,12 @@ SIM / SIM File system
   Complexity: C1
   Owner: Marit Henriksen marit.henrik...@stericsson.com
 
+- Support SIM authentication: SIM, AKA, and GBA suites.
+
+  Priority: Medium
+  Complexity: C3
+  Owner: Pekka Pessi pekka.pe...@nokia.com
+
 Modem Emulator
 ==
 
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[sim-auth RFCv2 3/4] Add GBA documents to doc/standards.txt

2011-01-12 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

---
 doc/standards.txt |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/doc/standards.txt b/doc/standards.txt
index 2b85cb0..e8ec19f 100644
--- a/doc/standards.txt
+++ b/doc/standards.txt
@@ -55,6 +55,19 @@ Describes 3GPP specific aspects of Card Application Toolkit 
(CAT) / STK.
 Describes the testing parameters and test cases for 31.111.
 
 
+Security Specifications
+===
+
+- 33.220  Generic bootstrapping architecture (GBA)
+
+Describes the generic bootstrapping architecture used to leverage
+SIM-based authentication.
+
+- 24.109  Bootstrapping interface (Ub) and NAF interface (Ua)
+
+Describes how the GBA authentication is used with, e.g., HTTP.
+
+
 3GPP Specific Services
 ==
 
-- 
1.7.1

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] phonesim: Add +CUAD command and EFdir EF.

2011-01-12 Thread Denis Kenzior
Hi Andrew,

On 01/12/2011 02:00 AM, Andrzej Zaborowski wrote:
 Add +PTTY in +CLAC output too.
 ---
  src/default.xml   |   23 +++
  src/simfilesystem.cpp |5 +
  2 files changed, 28 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] phonesim: Fix access bits for EFiccid, EFpl.

2011-01-12 Thread Denis Kenzior
Hi Andrew,

On 01/12/2011 02:00 AM, Andrzej Zaborowski wrote:
 ---
  src/simfilesystem.cpp |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 

Good catch.  Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 0/6] Add conformance sim application

2011-01-12 Thread Denis Kenzior
Hi Jeevaka,

On 01/11/2011 08:16 AM, Jeevaka Badrappan wrote:
 Hi,
 
  Following set of patches adds the ui support for selecting
 sim applications and also adds conformance sim application.
 DisplayText, Get Inkey, Get Input and MoreTime test cases
 are added to the conformance sim application. Logging of the
 result in a file can be done but it is not part of this patch.
 
 Regards,
 Jeevaka
 

Looks good to me, all 6 patches have been applied.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


  1   2   >