RE: [PATCH 1/4] radio settings: allow for more than one property

2010-10-25 Thread Mika.Liljeberg
Hi Denis,

 I really don't want to argue about this.
 
 SetProperty(TechnologyPreference, ..)
 - Sets RADIO_SETTINGS_MODE_CACHED
 
 GetProperties() - queries Fast dormancy
 GetProperties() - queries Fast dormancy
 -
 
 + } else if (rs-driver-query_fast_dormancy) {
 + rs-driver-query_fast_dormancy(rs,
 + 
 fast_dormancy_query_callback, rs);
 + dbus_message_unref(reply);
 + return NULL;
 + }
 +
 
 You never set pending in the FastDormancy case.

Good catch. That's a bug, of course. Doesn't invalidate the approach, though.

  Understandable. Makes it difficult to improve on design 
 patterns that have already been replicated, though.
  
 
 Nobody is against improving things, but please try to do it in the
 appropriate forum.  E.g. and RFC to the mailing list or an 
 IRC discussion.

Of course. This time I wasn't conciously trying to improve things, though. 
Anyway, enough yakking. I'll do the rewrite sicne you're adamant.

Br,

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


Re: [PATCH] hso: Set modem name based on udev network interface name

2010-10-25 Thread Benoît Monin
Hi Denis,

 De : Denis Kenzior
 
 Hi Benoît,
 
 I prefer you do this in plugins/hso and not in udev.
 
Is the patch below correct ? I moved the call to set_name
to hso_probe.

Benoît
--
Subject: [PATCH] hso: Set modem name based on udev network interface name

Useful if you have multiple identical modems and you need a way
to know which modem you're talking to.
---
 plugins/hso.c |    6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/plugins/hso.c b/plugins/hso.c
index 055c63b..a9fb1ba 100644
--- a/plugins/hso.c
+++ b/plugins/hso.c
@@ -59,6 +59,7 @@ struct hso_data {
 static int hso_probe(struct ofono_modem *modem)
 {
        struct hso_data *data;
+       const char *interface;

        DBG(%p, modem);

@@ -68,6 +69,11 @@ static int hso_probe(struct ofono_modem *modem)

        ofono_modem_set_data(modem, data);

+       /* Set name based on network interface name */
+       interface = ofono_modem_get_string(modem, NetworkInterface);
+       if (interface)
+               ofono_modem_set_name(modem, interface);
+
        return 0;
 }

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


Re: [PATCH] hso: Set modem name based on udev network interface name

2010-10-25 Thread Marcel Holtmann
Hi Benoit,

 Subject: [PATCH] hso: Set modem name based on udev network interface name
 
 Useful if you have multiple identical modems and you need a way
 to know which modem you're talking to.
 ---
  plugins/hso.c |6 ++
  1 files changed, 6 insertions(+), 0 deletions(-)
 
 diff --git a/plugins/hso.c b/plugins/hso.c
 index 055c63b..a9fb1ba 100644
 --- a/plugins/hso.c
 +++ b/plugins/hso.c
 @@ -59,6 +59,7 @@ struct hso_data {
  static int hso_probe(struct ofono_modem *modem)
  {
 struct hso_data *data;
 +   const char *interface;
 
 DBG(%p, modem);
 
 @@ -68,6 +69,11 @@ static int hso_probe(struct ofono_modem *modem)
 
 ofono_modem_set_data(modem, data);
 
 +   /* Set name based on network interface name */
 +   interface = ofono_modem_get_string(modem, NetworkInterface);
 +   if (interface)
 +   ofono_modem_set_name(modem, interface);
 +
 return 0;
  }

the friendly modem name is for devices that do have a friendly name,
like Bluetooth headsets. Why do you wanna misuse the interface name
here. I am a bit against this, because it leads to speculation and
assumptions in userspace programs.

Regards

Marcel


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


Add Barred Dialing Support

2010-10-25 Thread Jeevaka Badrappan


Hi,

 This patch adds the barred dialing support. If Barred Dialing service is
enabled, then oFono will go into emergency mode. Patch has been tested with the 
phonesim. 

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


[PATCH 1/4] simutil: add Efbdn fileid to sim_fileid enum

2010-10-25 Thread Jeevaka Badrappan
---
 src/simutil.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/simutil.h b/src/simutil.h
index 50ad418..5b56099 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -32,6 +32,7 @@ enum sim_fileid {
SIM_EFMSISDN_FILEID = 0x6f40,
SIM_EFSPN_FILEID = 0x6f46,
SIM_EFSDN_FILEID = 0x6f49,
+   SIM_EFBDN_FILEID = 0x6f4d,
SIM_EFADN_FILEID = 0x6f3a,
SIM_EFEST_FILEID = 0x6f56,
SIM_EFAD_FILEID = 0x6fad,
-- 
1.7.0.4

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


[PATCH 3/4] doc: Add BarredDialing property

2010-10-25 Thread Jeevaka Badrappan
---
 doc/sim-api.txt |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/doc/sim-api.txt b/doc/sim-api.txt
index 6dc5e0b..d4d2b1b 100644
--- a/doc/sim-api.txt
+++ b/doc/sim-api.txt
@@ -138,3 +138,10 @@ Properties boolean Present [readonly]
 
If FDN is enabled, oFono halts the SIM initialization
procedure and only emergency calls are allowed.
+
+   boolean BarredDialing [readonly]
+
+   True if Barred Dialing service is enabled in SIM card.
+
+   If BDN is enabled, oFono halts the SIM initialization
+   procedure and only emergency calls are allowed.
-- 
1.7.0.4

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


[PATCH 2/4] sim: add barred dialing support

2010-10-25 Thread Jeevaka Badrappan
---
 src/sim.c |   87 +++-
 1 files changed, 79 insertions(+), 8 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index 699ebe9..c631e31 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -73,6 +73,7 @@ struct ofono_sim {
unsigned char *efsst;
unsigned char efsst_length;
gboolean fixed_dialing;
+   gboolean barred_dialing;
 
char *imsi;
 
@@ -288,6 +289,7 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
const char *pin_name;
dbus_bool_t present = sim-state != OFONO_SIM_STATE_NOT_PRESENT;
dbus_bool_t fdn;
+   dbus_bool_t bdn;
 
reply = dbus_message_new_method_return(msg);
if (!reply)
@@ -315,6 +317,9 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
fdn = sim-fixed_dialing;
ofono_dbus_dict_append(dict, FixedDialing, DBUS_TYPE_BOOLEAN, fdn);
 
+   bdn = sim-barred_dialing;
+   ofono_dbus_dict_append(dict, BarredDialing, DBUS_TYPE_BOOLEAN, bdn);
+
if (sim-mnc_length  sim-imsi) {
char mcc[OFONO_MAX_MCC_LENGTH + 1];
char mnc[OFONO_MAX_MNC_LENGTH + 1];
@@ -1261,6 +1266,57 @@ static void sim_fdn_enabled(struct ofono_sim *sim)
DBUS_TYPE_BOOLEAN, val);
 }
 
+static void sim_bdn_enabled(struct ofono_sim *sim)
+{
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = __ofono_atom_get_path(sim-atom);
+   dbus_bool_t val;
+
+   sim-barred_dialing = TRUE;
+
+   val = sim-barred_dialing;
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_SIM_MANAGER_INTERFACE,
+   BarredDialing,
+   DBUS_TYPE_BOOLEAN, val);
+}
+
+static void sim_efbdn_info_read_cb(int ok, unsigned char file_status,
+   int total_length, int record_length,
+   void *userdata)
+{
+   struct ofono_sim *sim = userdata;
+
+   if (!ok)
+   goto out;
+
+   if (file_status == SIM_FILE_STATUS_VALID)
+   sim_bdn_enabled(sim);
+
+out:
+   if (sim-fixed_dialing != TRUE 
+   sim-barred_dialing != TRUE)
+   sim_retrieve_imsi(sim);
+}
+
+static gboolean check_bdn_status(struct ofono_sim *sim)
+{
+   /*
+* Check the status of Barred Dialing in the SIM-card
+* (TS 11.11/TS 51.011, Section 11.5.1: BDN capability request).
+* If BDN is allocated, activated in EFsst and EFbdn is validated,
+* halt the SIM initialization.
+*/
+   if (sim_sst_is_active(sim-efsst, sim-efsst_length,
+   SIM_SST_SERVICE_BDN)) {
+   sim_fs_read_info(sim-simfs, SIM_EFBDN_FILEID,
+   OFONO_SIM_FILE_STRUCTURE_FIXED,
+   sim_efbdn_info_read_cb, sim);
+   return TRUE;
+   }
+   return FALSE;
+}
+
 static void sim_efadn_info_read_cb(int ok, unsigned char file_status,
int total_length, int record_length,
void *userdata)
@@ -1270,13 +1326,15 @@ static void sim_efadn_info_read_cb(int ok, unsigned 
char file_status,
if (!ok)
goto out;
 
-   if (file_status != SIM_FILE_STATUS_VALID) {
+   if (file_status != SIM_FILE_STATUS_VALID)
sim_fdn_enabled(sim);
-   return;
-   }
 
 out:
-   sim_retrieve_imsi(sim);
+   if (check_bdn_status(sim) != TRUE) {
+   if (sim-fixed_dialing != TRUE 
+   sim-barred_dialing != TRUE)
+   sim_retrieve_imsi(sim);
+   }
 }
 
 static void sim_efsst_read_cb(int ok, int length, int record,
@@ -1310,6 +1368,9 @@ static void sim_efsst_read_cb(int ok, int length, int 
record,
return;
}
 
+   if (check_bdn_status(sim) == TRUE)
+   return;
+
 out:
sim_retrieve_imsi(sim);
 }
@@ -1337,13 +1398,22 @@ static void sim_efest_read_cb(int ok, int length, int 
record,
 * If FDN is activated, don't continue initialization routine.
 */
if (sim_est_is_active(sim-efest, sim-efest_length,
-   SIM_EST_SERVICE_FDN)) {
+   SIM_EST_SERVICE_FDN))
sim_fdn_enabled(sim);
-   return;
-   }
+
+   /*
+* Check the status of Barred Dialing in the USIM-card
+* (TS 31.102, Section 5.3.2: BDN capability request).
+* If BDN service is enabled, halt the USIM initialization.
+*/
+   if (sim_est_is_active(sim-efest, sim-efest_length,
+   SIM_EST_SERVICE_BDN))
+   sim_bdn_enabled(sim);
 
 out:
-   sim_retrieve_imsi(sim);
+   

[PATCH 4/4] TODO: Marking the Barred Dialing task as done

2010-10-25 Thread Jeevaka Badrappan
---
 TODO |7 ---
 doc/features.txt |5 +
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/TODO b/TODO
index d9a6580..ad96241 100644
--- a/TODO
+++ b/TODO
@@ -110,13 +110,6 @@ SMS
 SIM / SIM File system
 =
 
-- Barred Dialing numbers support.  BDN will not be supported by oFono.
-  If BDN service enabled SIM is used, oFono will go into emergency mode.
-
-  Priority: Low
-  Complexity: C2
-  Owner: Jeevaka Badrappan jeevaka.badrap...@elektrobit.com
-
 - Read / Write EFcfis.  Call forwarding settings can be bootstrapped on the
   SIM for faster notification of the user that call forwarding is active.
   These settings are stored in EFcfis.  oFono should read these settings and
diff --git a/doc/features.txt b/doc/features.txt
index 3524e79..12be037 100644
--- a/doc/features.txt
+++ b/doc/features.txt
@@ -135,3 +135,8 @@ SIM
   check if FDN support is allocated and enabled in the SIM.  If enabled,
   oFono halts the SIM initialization procedure and the modem remains in the
   PRESIM state.  In this state oFono will only allow emergency calls.
+
+- Barred Dialing support.  oFono reads the necessary bits from the SIM to
+  check if BDN support is allocated and enabled in the SIM.  If enabled,
+  oFono halts the SIM initialization procedure and the modem remains in the
+  PRESIM state.  In this state oFono will only allow emergency calls.
-- 
1.7.0.4

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


Re: [PATCH] hso: Set modem name based on udev network interface name

2010-10-25 Thread Benoît Monin
Hi Marcel,

 De : Marcel Holtmann
 
 Hi Benoit,
 
 the friendly modem name is for devices that do have a friendly name,
 like Bluetooth headsets. Why do you wanna misuse the interface name
 here. I am a bit against this, because it leads to speculation and
 assumptions in userspace programs.
 
Maybe I should give some details of what I'm trying to achieve. The
device we're building has 2 identical modems with fixed position on
USB. We also have the possibility to drive their power supply
independently and to swap the sim cards.

I need a way to know which one is modem A and which one is modem B
and I have no easy way of knowing the modem serial number or the
sim subscriber id beforehand. With an udev rule, I can easily set
a fixed name for the network interface of each modem. But under
ofono, I can't tell which modem is which. That's why I added this
not-so-friendly name.

Is there a way of knowing which physical modem ofono is refering to ?
I recognize that our case may not be the most common and I understand
that you don't want to abuse the Name property. Maybe exposing the
NetworkInterface as a modem property would be ok ? or exposing
a PhysicalName ?

--
Benoît.
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Call counters proposal (TODO patch)

2010-10-25 Thread Andras Domokos

I am proposing adding Call counters to Voicecall. Here is the TODO patch:

diff --git a/TODO b/TODO
index d9a6580..89e180c 100644
--- a/TODO
+++ b/TODO
@@ -329,6 +329,15 @@ Voicecall
   Complexity: C2
   Owner: Pekka Pessi pekka.pe...@nokia.com

+- Call counters. Provide total outgoing and incoming call duration 
information.
+  Separate call counters will be maintained for each SIM card. Call 
counters

+  can be read and reset to 0, and must be backed up periodically to a
+  non-volatile storage place.
+
+  Priority: Medium
+  Complexity: C2
+  Owner: Andras Domokos andras.domo...@nokia.com
+

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


[PATCH 0/6] radio settings: fast dormancy support

2010-10-25 Thread Mika Liljeberg
Hi All,

Here's another go at fast dormancy. I hope I managed to address
the concerns about the previous patch set. A driver implementation
for isimodem is now included.

Br,

MikaL


[PATCH 1/6] radio settings: add FastDormancy property
[PATCH 2/6] radio settings: document FastDormancy property
[PATCH 3/6] test: add scripts to enable and disable fast dormancy
[PATCH 4/6] isimodem: add support for FastDormancy property
[PATCH 5/6] TODO: mark fast dormancy as done
[PATCH 6/6] AUTHORS: add myself

 AUTHORS   |1 +
 Makefile.am   |4 +-
 TODO  |   20 --
 doc/features.txt  |8 ++
 doc/radio-settings-api.txt|   59 +++-
 drivers/isimodem/radio-settings.c |   91 +-
 include/radio-settings.h  |   11 +++
 src/radio-settings.c  |  134 +---
 test/disable-fast-dormancy|   20 ++
 test/enable-fast-dormancy |   20 ++
 10 files changed, 316 insertions(+), 52 deletions(-)
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/6] radio settings: add FastDormancy property

2010-10-25 Thread Mika Liljeberg
---
 include/radio-settings.h |   11 
 src/radio-settings.c |  134 +
 2 files changed, 133 insertions(+), 12 deletions(-)

diff --git a/include/radio-settings.h b/include/radio-settings.h
index d41ec0b..a6b19d0 100644
--- a/include/radio-settings.h
+++ b/include/radio-settings.h
@@ -42,6 +42,10 @@ typedef void (*ofono_radio_settings_rat_mode_set_cb_t)(const 
struct ofono_error
 typedef void (*ofono_radio_settings_rat_mode_query_cb_t)(const struct 
ofono_error *error,
enum ofono_radio_access_mode 
mode,
void *data);
+typedef void (*ofono_radio_settings_fast_dormancy_set_cb_t)(const struct 
ofono_error *error,
+   void *data);
+typedef void (*ofono_radio_settings_fast_dormancy_query_cb_t)(const struct 
ofono_error *error,
+   int enable, void *data);
 
 struct ofono_radio_settings_driver {
const char *name;
@@ -55,6 +59,13 @@ struct ofono_radio_settings_driver {
enum ofono_radio_access_mode mode,
ofono_radio_settings_rat_mode_set_cb_t cb,
void *data);
+   void (*query_fast_dormancy)(struct ofono_radio_settings *rs,
+   ofono_radio_settings_fast_dormancy_query_cb_t cb,
+   void *data);
+   void (*set_fast_dormancy)(struct ofono_radio_settings *rs,
+   int enable,
+   ofono_radio_settings_fast_dormancy_set_cb_t,
+   void *data);
 };
 
 int ofono_radio_settings_driver_register(const struct 
ofono_radio_settings_driver *d);
diff --git a/src/radio-settings.c b/src/radio-settings.c
index 3306be6..5441481 100644
--- a/src/radio-settings.c
+++ b/src/radio-settings.c
@@ -33,7 +33,7 @@
 #include ofono.h
 #include common.h
 
-#define RADIO_SETTINGS_MODE_CACHED 0x1
+#define RADIO_SETTINGS_FLAG_CACHED 0x1
 
 static GSList *g_drivers = NULL;
 
@@ -42,6 +42,8 @@ struct ofono_radio_settings {
int flags;
enum ofono_radio_access_mode mode;
enum ofono_radio_access_mode pending_mode;
+   int fast_dormancy;
+   int fast_dormancy_pending;
const struct ofono_radio_settings_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -91,8 +93,6 @@ static DBusMessage *radio_get_properties_reply(DBusMessage 
*msg,
DBusMessageIter iter;
DBusMessageIter dict;
 
-   const char *mode = radio_access_mode_to_string(rs-mode);
-
reply = dbus_message_new_method_return(msg);
if (!reply)
return NULL;
@@ -103,14 +103,60 @@ static DBusMessage 
*radio_get_properties_reply(DBusMessage *msg,
OFONO_PROPERTIES_ARRAY_SIGNATURE,
dict);
 
-   ofono_dbus_dict_append(dict, TechnologyPreference,
+   if ((int)rs-mode != -1) {
+   const char *mode = radio_access_mode_to_string(rs-mode);
+   ofono_dbus_dict_append(dict, TechnologyPreference,
DBUS_TYPE_STRING, mode);
+   }
+
+   if (rs-fast_dormancy != -1) {
+   dbus_bool_t value = (rs-fast_dormancy != 0);
+   ofono_dbus_dict_append(dict, FastDormancy,
+   DBUS_TYPE_BOOLEAN, value);
+   }
 
dbus_message_iter_close_container(iter, dict);
 
return reply;
 }
 
+static void radio_set_fast_dormancy(struct ofono_radio_settings *rs, int 
enable)
+{
+   if (rs-fast_dormancy != enable) {
+
+   DBusConnection *conn = ofono_dbus_get_connection();
+   const char *path = __ofono_atom_get_path(rs-atom);
+   dbus_bool_t value = (enable != 0);
+
+   ofono_dbus_signal_property_changed(conn, path,
+   OFONO_RADIO_SETTINGS_INTERFACE,
+   FastDormancy,
+   DBUS_TYPE_BOOLEAN, value);
+   }
+
+   rs-fast_dormancy = enable;
+}
+
+static void radio_fast_dormancy_set_callback(const struct ofono_error *error,
+   void *data)
+{
+   struct ofono_radio_settings *rs = data;
+   DBusMessage *reply;
+
+   if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
+   DBG(Error setting fast dormancy);
+   rs-fast_dormancy_pending = rs-fast_dormancy;
+   reply = __ofono_error_failed(rs-pending);
+   __ofono_dbus_pending_reply(rs-pending, reply);
+   return;
+   }
+
+   reply = dbus_message_new_method_return(rs-pending);
+   __ofono_dbus_pending_reply(rs-pending, reply);
+
+   radio_set_fast_dormancy(rs, 

[PATCH 2/6] radio settings: document FastDormancy property

2010-10-25 Thread Mika Liljeberg
---
 doc/radio-settings-api.txt |   59 ++-
 1 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/doc/radio-settings-api.txt b/doc/radio-settings-api.txt
index f1b91ad..00eca54 100644
--- a/doc/radio-settings-api.txt
+++ b/doc/radio-settings-api.txt
@@ -44,22 +44,45 @@ Properties  string TechnologyPreference [read-write]
 
boolean FastDormancy [read-write, optional]
 
-   This property will enable or disable fast
-   dormancy. Fast dormancy refers to UE initiated
-   release of radio resources quickly after a
-   burst of data transfer has ended. Normally,
+   This property will enable or disable the fast
+   dormancy feature in the modem. Fast dormancy
+   refers to a modem feature that allows the
+   modem to quickly release radio resources after
+   a burst of data transfer has ended. Normally,
radio resources are released by the network
-   after a timeout configured by the network
-   operator. Fast dormancy allows the modem to
-   release radio resources more quickly.
-   Typically, fast dormancy would be enabled if
-   no data transfer is predicted to occur in the
-   near future, for instance, when the end user
-   is not actively using the device. This is a
-   major power-saving feature for mobile devices,
-   but can be ignored for USB sticks or PCI
-   devices.
-
-   If the modem does not support such a feature
-   the property should never be exposed to the
-   user.
+   after a timeout configured by the network.
+   Fast dormancy allows the modem to release the
+   radio resources more quickly.
+
+   Fast dormancy is a major power-saving feature
+   for mobile devices. Typically, fast dormancy
+   would be enabled when the device is not being
+   interactively used by a human user and only
+   networking applications with keep-alive
+   traffic are active (e.g. mail client or a
+   presence application). In this case it is
+   desirable to release radio resources quickly
+   after a keep-alive transaction has ended,
+   since typically no network traffic will occur
+   until the next keep-alive transaction. Fast
+   dormancy should not be enabled during
+   interactive use because the release and setup
+   of radio resources introduces perceivable
+   delay for the end user.
+
+   The fast dormancy implementation in the modem
+   is vendor specific. The implementation should
+   try to release radio resources more quickly,
+   when the situation allows it, but should also
+   take care not to increase the signalling load
+   on the cellular network by releasing and
+   re-establishing radio resources too often. The
+   modem should adjust its behaviour to the 3GPP
+   release supported by the network and the
+   parameters set by the operator.
+
+   Fast dormancy can be ignored for externally
+   powered modems such as USB sticks or PCI
+   devices. If the modem does not support such a
+   feature the property should never be exposed
+   to the user.
-- 
1.7.0.4

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


[PATCH 6/6] AUTHORS: add myself

2010-10-25 Thread Mika Liljeberg
---
 AUTHORS |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 654b314..c0218c6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -37,3 +37,4 @@ Petteri Tikander petteri.tikan...@ixonos.com
 Jeevaka Badrappan jeevaka.badrap...@elektrobit.com
 Frank Gau f...@gau-net.de
 Kai Vehmanen kai.vehma...@nokia.com
+Mika Liljeberg mika.liljeb...@nokia.com
-- 
1.7.0.4

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


[PATCH 3/6] test: add scripts to enable and disable fast dormancy

2010-10-25 Thread Mika Liljeberg
---
 Makefile.am|4 +++-
 test/disable-fast-dormancy |   20 
 test/enable-fast-dormancy  |   20 
 3 files changed, 43 insertions(+), 1 deletions(-)
 create mode 100755 test/disable-fast-dormancy
 create mode 100755 test/enable-fast-dormancy

diff --git a/Makefile.am b/Makefile.am
index 25c18bd..cd2cf78 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -410,7 +410,9 @@ test_scripts = test/backtrace \
test/unlock-pin \
test/enable-gprs \
test/disable-gprs \
-   test/get-icon
+   test/get-icon \
+   test/enable-fast-dormancy \
+   test/disable-fast-dormancy
 
 if TEST
 testdir = $(pkglibdir)/test
diff --git a/test/disable-fast-dormancy b/test/disable-fast-dormancy
new file mode 100755
index 000..a9d7286
--- /dev/null
+++ b/test/disable-fast-dormancy
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+   path = sys.argv[1]
+else:
+   manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+   modems = manager.GetModems()
+   path = modems[0][0]
+
+print Disabling fast dormancy on modem %s... % path
+rs = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.RadioSettings')
+
+rs.SetProperty(FastDormancy, dbus.Boolean(0))
diff --git a/test/enable-fast-dormancy b/test/enable-fast-dormancy
new file mode 100755
index 000..518a662
--- /dev/null
+++ b/test/enable-fast-dormancy
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import dbus
+import sys
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+   path = sys.argv[1]
+else:
+   manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+   'org.ofono.Manager')
+   modems = manager.GetModems()
+   path = modems[0][0]
+
+print Enabling fast dormancy on modem %s... % path
+rs = dbus.Interface(bus.get_object('org.ofono', path),
+   'org.ofono.RadioSettings')
+
+rs.SetProperty(FastDormancy, dbus.Boolean(1))
-- 
1.7.0.4

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


[PATCH 4/6] isimodem: add support for FastDormancy property

2010-10-25 Thread Mika Liljeberg
---
 drivers/isimodem/radio-settings.c |   91 -
 1 files changed, 90 insertions(+), 1 deletions(-)

diff --git a/drivers/isimodem/radio-settings.c 
b/drivers/isimodem/radio-settings.c
index d220476..558e032 100644
--- a/drivers/isimodem/radio-settings.c
+++ b/drivers/isimodem/radio-settings.c
@@ -41,11 +41,16 @@
 #include isimodem.h
 #include isiutil.h
 #include debug.h
+#include gpds.h
 #include gss.h
 #include network.h
 
+#define PN_WRAN 0xb4
+
 struct radio_data {
GIsiClient *client;
+   uint16_t wran_object;
+   uint16_t quick_release:1;
 };
 
 static enum ofono_radio_access_mode isi_mode_to_ofono_mode(guint8 mode)
@@ -236,6 +241,65 @@ error:
g_free(cbd);
 }
 
+static void update_fast_dormancy(struct radio_data *rd)
+{
+   struct sockaddr_pn dst = {
+   .spn_family = AF_PHONET,
+   .spn_resource = 0x3a,
+   .spn_dev = rd-wran_object  8,
+   .spn_obj = rd-wran_object  0xff,
+   };
+
+   if (!rd-wran_object)
+   return;
+
+   if (rd-quick_release) {
+   const unsigned char msg[] = {
+   0x1f, 0x00, 0x01, 0x01, 0x01, 0x00
+   };
+
+   g_isi_sendto(rd-client, dst, msg, sizeof(msg), 0,
+   NULL, NULL, NULL);
+   } else {
+   const unsigned char msg[] = {
+   0x1f, 0x00, 0x01, 0x01, 0x02, 0x0a
+   };
+
+   g_isi_sendto(rd-client, dst, msg, sizeof(msg), 0,
+   NULL, NULL, NULL);
+   }
+
+   DBG(3G PS quick release %s,
+   rd-quick_release ? enabled : disabled);
+}
+
+static void gpds_context_activating_ind_cb(GIsiClient *client,
+   const void *restrict data, size_t len,
+   uint16_t object, void *opaque)
+{
+   struct radio_data *rd = opaque;
+   update_fast_dormancy(rd);
+}
+
+static void isi_query_fast_dormancy(struct ofono_radio_settings *rs,
+   ofono_radio_settings_fast_dormancy_query_cb_t cb,
+   void *data)
+{
+   struct radio_data *rd = ofono_radio_settings_get_data(rs);
+   CALLBACK_WITH_SUCCESS(cb, rd-quick_release, data);
+}
+
+static void isi_set_fast_dormancy(struct ofono_radio_settings *rs,
+   int enable,
+   ofono_radio_settings_fast_dormancy_set_cb_t cb,
+   void *data)
+{
+   struct radio_data *rd = ofono_radio_settings_get_data(rs);
+   rd-quick_release = enable;
+   update_fast_dormancy(rd);
+   CALLBACK_WITH_SUCCESS(cb, data);
+}
+
 static gboolean isi_radio_settings_register(gpointer user)
 {
struct ofono_radio_settings *rs = user;
@@ -249,9 +313,31 @@ static gboolean isi_radio_settings_register(gpointer user)
 
ofono_radio_settings_register(rs);
 
+   g_isi_add_subscription(rd-client,
+   PN_GPDS, GPDS_CONTEXT_ACTIVATING_IND,
+   gpds_context_activating_ind_cb, rd);
+   g_isi_commit_subscriptions(rd-client);
+
return FALSE;
 }
 
+static void wran_reachable_cb(GIsiClient *client, gboolean alive,
+   uint16_t object, void *opaque)
+{
+   struct radio_data *rd = opaque;
+
+   if (!alive) {
+   DBG(fast dormancy support disabled);
+   return;
+   }
+
+   rd-wran_object = object;
+
+   DBG(PN_WRAN reachable, object=0x%04x, object);
+
+   update_fast_dormancy(rd);
+}
+
 static void reachable_cb(GIsiClient *client, gboolean alive, uint16_t object,
void *opaque)
 {
@@ -289,6 +375,7 @@ static int isi_radio_settings_probe(struct 
ofono_radio_settings *rs,
ofono_radio_settings_set_data(rs, rd);
 
g_isi_verify(rd-client, reachable_cb, rs);
+   g_isi_verify_resource(rd-client, PN_WRAN, wran_reachable_cb, rd);
 
return 0;
 }
@@ -310,7 +397,9 @@ static struct ofono_radio_settings_driver driver = {
.probe  = isi_radio_settings_probe,
.remove = isi_radio_settings_remove,
.query_rat_mode = isi_query_rat_mode,
-   .set_rat_mode   = isi_set_rat_mode
+   .set_rat_mode   = isi_set_rat_mode,
+   .query_fast_dormancy= isi_query_fast_dormancy,
+   .set_fast_dormancy  = isi_set_fast_dormancy,
 };
 
 void isi_radio_settings_init()
-- 
1.7.0.4

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


[PATCH 5/6] TODO: mark fast dormancy as done

2010-10-25 Thread Mika Liljeberg
---
 TODO |   20 
 doc/features.txt |8 
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/TODO b/TODO
index d9a6580..d3d6687 100644
--- a/TODO
+++ b/TODO
@@ -519,26 +519,6 @@ Miscellaneous
   Priority: Medium
   Complexity: C2
 
-- Add a property for Fast Dormancy in the RadioSettings atom. This property
-  will enable or disable Fast Dormancy. Fast Dormancy refers to UE initiated
-  release of radio resources quickly after a burst of data transfer has ended.
-  Normally, radio resources are released by the network after a timeout
-  configured by the network operator. Fast Dormancy allows the modem to release
-  radio resources more quickly. Typically, fast dormancy would be enabled
-  if no data transfer is predicted to occur in the near future (e.g. end user
-  is not actively using the device). This is a major power-saving feature for
-  mobile devices, but can be ignored for USB sticks or PCI devices.
-
-  If the modem does not support such a feature the property should never be
-  exposed to the user.
-
-  This feature is not discussed in 27.007, thus manufacturer specific commands
-  are required.
-
-  Priority: High
-  Complexity: C1
-  Owner: Mika Liljeberg mika.liljeb...@nokia.com
-
 - TTY (hearing impaired) support.  Add a new oFono atom type that will enable
   the user to enable or disable the TTY support on the modem.  Support for
   automatic detection of TTY (signaled by the driver) is also desired.
diff --git a/doc/features.txt b/doc/features.txt
index 3524e79..deb1fea 100644
--- a/doc/features.txt
+++ b/doc/features.txt
@@ -135,3 +135,11 @@ SIM
   check if FDN support is allocated and enabled in the SIM.  If enabled,
   oFono halts the SIM initialization procedure and the modem remains in the
   PRESIM state.  In this state oFono will only allow emergency calls.
+
+Radio settings
+==
+
+- Fast dormancy support. A fast dormancy feature can be enabled in the
+  cellular modem to conserve power when the end user is not actively
+  using the device but some networking applications are online using
+  packet data.
-- 
1.7.0.4

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


Re: Call counters proposal (TODO patch)

2010-10-25 Thread Marcel Holtmann
Hi Andras,

 I am proposing adding Call counters to Voicecall. Here is the TODO patch:
 
 diff --git a/TODO b/TODO
 index d9a6580..89e180c 100644
 --- a/TODO
 +++ b/TODO
 @@ -329,6 +329,15 @@ Voicecall
 Complexity: C2
 Owner: Pekka Pessi pekka.pe...@nokia.com
 
 +- Call counters. Provide total outgoing and incoming call duration 
 information.
 +  Separate call counters will be maintained for each SIM card. Call 
 counters
 +  can be read and reset to 0, and must be backed up periodically to a
 +  non-volatile storage place.

what is wrong with using the history plugin API and working towards a
bridge to get these information into tracker.

I did propose to use obexd for this task since it already has to handle
call history for PBAP anyway and it has a different backends already. So
if you don't wanna use tracker you can use EDS or others.

Regards

Marcel


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


Re: [PATCH 1/6] radio settings: add FastDormancy property

2010-10-25 Thread Marcel Holtmann
Hi Mika,

  include/radio-settings.h |   11 
  src/radio-settings.c |  134 +
  2 files changed, 133 insertions(+), 12 deletions(-)
 
 diff --git a/include/radio-settings.h b/include/radio-settings.h
 index d41ec0b..a6b19d0 100644
 --- a/include/radio-settings.h
 +++ b/include/radio-settings.h
 @@ -42,6 +42,10 @@ typedef void 
 (*ofono_radio_settings_rat_mode_set_cb_t)(const struct ofono_error
  typedef void (*ofono_radio_settings_rat_mode_query_cb_t)(const struct 
 ofono_error *error,
   enum ofono_radio_access_mode 
 mode,
   void *data);
 +typedef void (*ofono_radio_settings_fast_dormancy_set_cb_t)(const struct 
 ofono_error *error,
 + void *data);
 +typedef void (*ofono_radio_settings_fast_dormancy_query_cb_t)(const struct 
 ofono_error *error,
 + int enable, void *data);
  
  struct ofono_radio_settings_driver {
   const char *name;
 @@ -55,6 +59,13 @@ struct ofono_radio_settings_driver {
   enum ofono_radio_access_mode mode,
   ofono_radio_settings_rat_mode_set_cb_t cb,
   void *data);
 + void (*query_fast_dormancy)(struct ofono_radio_settings *rs,
 + ofono_radio_settings_fast_dormancy_query_cb_t cb,
 + void *data);
 + void (*set_fast_dormancy)(struct ofono_radio_settings *rs,
 + int enable,
 + ofono_radio_settings_fast_dormancy_set_cb_t,
 + void *data);
  };
  
  int ofono_radio_settings_driver_register(const struct 
 ofono_radio_settings_driver *d);
 diff --git a/src/radio-settings.c b/src/radio-settings.c
 index 3306be6..5441481 100644
 --- a/src/radio-settings.c
 +++ b/src/radio-settings.c
 @@ -33,7 +33,7 @@
  #include ofono.h
  #include common.h
  
 -#define RADIO_SETTINGS_MODE_CACHED 0x1
 +#define RADIO_SETTINGS_FLAG_CACHED 0x1
  
  static GSList *g_drivers = NULL;
  
 @@ -42,6 +42,8 @@ struct ofono_radio_settings {
   int flags;
   enum ofono_radio_access_mode mode;
   enum ofono_radio_access_mode pending_mode;
 + int fast_dormancy;
 + int fast_dormancy_pending;
   const struct ofono_radio_settings_driver *driver;
   void *driver_data;
   struct ofono_atom *atom;
 @@ -91,8 +93,6 @@ static DBusMessage *radio_get_properties_reply(DBusMessage 
 *msg,
   DBusMessageIter iter;
   DBusMessageIter dict;
  
 - const char *mode = radio_access_mode_to_string(rs-mode);
 -
   reply = dbus_message_new_method_return(msg);
   if (!reply)
   return NULL;
 @@ -103,14 +103,60 @@ static DBusMessage 
 *radio_get_properties_reply(DBusMessage *msg,
   OFONO_PROPERTIES_ARRAY_SIGNATURE,
   dict);
  
 - ofono_dbus_dict_append(dict, TechnologyPreference,
 + if ((int)rs-mode != -1) {
 + const char *mode = radio_access_mode_to_string(rs-mode);
 + ofono_dbus_dict_append(dict, TechnologyPreference,
   DBUS_TYPE_STRING, mode);

what is up with this (int) rs-mode cast here. That looks highly wrong
to me. The mode is an enum so please don't hack around it like this.

If mode can be invalid or not present then we need to extend this enum
with an initial value of OFONO_RADIO_ACCESS_MODE_UNKNOWN, but not hack
some cast magic into it.

Or you use some flags like for the cached value.

And I would propose the same for fast dormancy value. Lets store it as a
boolean and have a flag if it is present or not.

Regards

Marcel


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


Re: [PATCH 2/6] radio settings: document FastDormancy property

2010-10-25 Thread Marcel Holtmann
Hi Mika,

  doc/radio-settings-api.txt |   59 ++-
  1 files changed, 41 insertions(+), 18 deletions(-)

sounds good to me. And I just went ahead and applied this patch.

Regards

Marcel


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


Re: [PATCH 3/6] test: add scripts to enable and disable fast dormancy

2010-10-25 Thread Marcel Holtmann
Hi Mika,

  Makefile.am|4 +++-
  test/disable-fast-dormancy |   20 
  test/enable-fast-dormancy  |   20 
  3 files changed, 43 insertions(+), 1 deletions(-)
  create mode 100755 test/disable-fast-dormancy
  create mode 100755 test/enable-fast-dormancy

what about just using a set-fast-dormancy script that takes a parameter.

I know we were not really consistent with the test directory, but since
we have set-tech-preference and get-tech-preference, I think we should
do it that way.

Regards

Marcel


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


Re: [PATCH 6/6] AUTHORS: add myself

2010-10-25 Thread Marcel Holtmann
Hi Mika,

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

nobody should need to add themselves to the AUTHORS file. I apologize
for this oversight. You are added now.

Regards

Marcel


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


RE: [PATCH 1/6] radio settings: add FastDormancy property

2010-10-25 Thread Mika.Liljeberg
Hi Marcel,

  @@ -103,14 +103,60 @@ static DBusMessage 
 *radio_get_properties_reply(DBusMessage *msg,
  
 OFONO_PROPERTIES_ARRAY_SIGNATURE,
  dict);
   
  -   ofono_dbus_dict_append(dict, TechnologyPreference,
  +   if ((int)rs-mode != -1) {
  +   const char *mode = 
 radio_access_mode_to_string(rs-mode);
  +   ofono_dbus_dict_append(dict, TechnologyPreference,
  DBUS_TYPE_STRING, mode);
 
 what is up with this (int) rs-mode cast here. That looks highly wrong
 to me. The mode is an enum so please don't hack around it like this.

 If mode can be invalid or not present then we need to extend this enum
 with an initial value of OFONO_RADIO_ACCESS_MODE_UNKNOWN, but not hack
 some cast magic into it.

Yes, it's fishy. Denis introduced the enum in commit 
81bc8884b414e6c2d511789d2e183cdad55182f0 but left mode initialized as -1. I'm 
not sure what's up with that but I did not want to start fixing it. I suppose 
the initializer could be added to the enum, as you say, or the whole patch 
could be reverted. Not my call, though.

 Or you use some flags like for the cached value.

 And I would propose the same for fast dormancy value. Lets 
 store it as a
 boolean and have a flag if it is present or not.

That's what I did in the previous patch but Denis wanted a single CACHED flag. 
Guys, please try to agree on this.

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


Re: [PATCH 1/6] radio settings: add FastDormancy property

2010-10-25 Thread Denis Kenzior
Hi Mika,

On 10/25/2010 10:05 AM, mika.liljeb...@nokia.com wrote:
 Hi Marcel,
 
 @@ -103,14 +103,60 @@ static DBusMessage 
 *radio_get_properties_reply(DBusMessage *msg,
 
 OFONO_PROPERTIES_ARRAY_SIGNATURE,
 dict);
  
 -   ofono_dbus_dict_append(dict, TechnologyPreference,
 +   if ((int)rs-mode != -1) {
 +   const char *mode = 
 radio_access_mode_to_string(rs-mode);
 +   ofono_dbus_dict_append(dict, TechnologyPreference,
 DBUS_TYPE_STRING, mode);

 what is up with this (int) rs-mode cast here. That looks highly wrong
 to me. The mode is an enum so please don't hack around it like this.

 If mode can be invalid or not present then we need to extend this enum
 with an initial value of OFONO_RADIO_ACCESS_MODE_UNKNOWN, but not hack
 some cast magic into it.
 
 Yes, it's fishy. Denis introduced the enum in commit 
 81bc8884b414e6c2d511789d2e183cdad55182f0 but left mode initialized as -1. I'm 
 not sure what's up with that but I did not want to start fixing it. I suppose 
 the initializer could be added to the enum, as you say, or the whole patch 
 could be reverted. Not my call, though.

I must have missed the -1 initialization.  In general the preference is
as follows:

- If the property is queried at the network, then set to a value that
means unknown.  Otherwise set to a default sane value.
- Only set to the new value if the query succeeds
- If the query fails (a bizarre case if querying the modem), don't reset
the sane value and don't set cached.  The next GetProperties will try to
re-query the setting.
- Don't show the attribute if the query_ method is not provided by the
driver.

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


Re: [PATCH 1/6] radio settings: add FastDormancy property

2010-10-25 Thread Denis Kenzior
Hi Mika,

On 10/25/2010 08:28 AM, Mika Liljeberg wrote:
 ---
  include/radio-settings.h |   11 
  src/radio-settings.c |  134 +
  2 files changed, 133 insertions(+), 12 deletions(-)
 
 diff --git a/include/radio-settings.h b/include/radio-settings.h
 index d41ec0b..a6b19d0 100644
 --- a/include/radio-settings.h
 +++ b/include/radio-settings.h
 @@ -42,6 +42,10 @@ typedef void 
 (*ofono_radio_settings_rat_mode_set_cb_t)(const struct ofono_error
  typedef void (*ofono_radio_settings_rat_mode_query_cb_t)(const struct 
 ofono_error *error,
   enum ofono_radio_access_mode 
 mode,
   void *data);
 +typedef void (*ofono_radio_settings_fast_dormancy_set_cb_t)(const struct 
 ofono_error *error,
 + void *data);
 +typedef void (*ofono_radio_settings_fast_dormancy_query_cb_t)(const struct 
 ofono_error *error,
 + int enable, void *data);
  
  struct ofono_radio_settings_driver {
   const char *name;
 @@ -55,6 +59,13 @@ struct ofono_radio_settings_driver {
   enum ofono_radio_access_mode mode,
   ofono_radio_settings_rat_mode_set_cb_t cb,
   void *data);
 + void (*query_fast_dormancy)(struct ofono_radio_settings *rs,
 + ofono_radio_settings_fast_dormancy_query_cb_t cb,
 + void *data);
 + void (*set_fast_dormancy)(struct ofono_radio_settings *rs,
 + int enable,
 + ofono_radio_settings_fast_dormancy_set_cb_t,
 + void *data);
  };
  
  int ofono_radio_settings_driver_register(const struct 
 ofono_radio_settings_driver *d);
 diff --git a/src/radio-settings.c b/src/radio-settings.c
 index 3306be6..5441481 100644
 --- a/src/radio-settings.c
 +++ b/src/radio-settings.c
 @@ -33,7 +33,7 @@
  #include ofono.h
  #include common.h
  
 -#define RADIO_SETTINGS_MODE_CACHED 0x1
 +#define RADIO_SETTINGS_FLAG_CACHED 0x1
  
  static GSList *g_drivers = NULL;
  
 @@ -42,6 +42,8 @@ struct ofono_radio_settings {
   int flags;
   enum ofono_radio_access_mode mode;
   enum ofono_radio_access_mode pending_mode;
 + int fast_dormancy;
 + int fast_dormancy_pending;

I suggest simply using ofono_bool_t here.

   const struct ofono_radio_settings_driver *driver;
   void *driver_data;
   struct ofono_atom *atom;
 @@ -91,8 +93,6 @@ static DBusMessage *radio_get_properties_reply(DBusMessage 
 *msg,
   DBusMessageIter iter;
   DBusMessageIter dict;
  
 - const char *mode = radio_access_mode_to_string(rs-mode);
 -
   reply = dbus_message_new_method_return(msg);
   if (!reply)
   return NULL;
 @@ -103,14 +103,60 @@ static DBusMessage 
 *radio_get_properties_reply(DBusMessage *msg,
   OFONO_PROPERTIES_ARRAY_SIGNATURE,
   dict);
  
 - ofono_dbus_dict_append(dict, TechnologyPreference,
 + if ((int)rs-mode != -1) {
 + const char *mode = radio_access_mode_to_string(rs-mode);
 + ofono_dbus_dict_append(dict, TechnologyPreference,
   DBUS_TYPE_STRING, mode);
 + }
 +

I suggest always showing this property, otherwise RadioSettings
interface is pretty pointless.

 + if (rs-fast_dormancy != -1) {
 + dbus_bool_t value = (rs-fast_dormancy != 0);
 + ofono_dbus_dict_append(dict, FastDormancy,
 + DBUS_TYPE_BOOLEAN, value);
 + }

This should be guarded by the query_fast_dormancy implementation
availability.

  
   dbus_message_iter_close_container(iter, dict);
  
   return reply;
  }
  
 +static void radio_set_fast_dormancy(struct ofono_radio_settings *rs, int 
 enable)
 +{

I really suggest something like:

if (rs-fast_dormancy == enable)
return;

...

 + if (rs-fast_dormancy != enable) {
 +

In general, please don't add empty lines like this

 + DBusConnection *conn = ofono_dbus_get_connection();
 + const char *path = __ofono_atom_get_path(rs-atom);
 + dbus_bool_t value = (enable != 0);
 +
 + ofono_dbus_signal_property_changed(conn, path,
 + OFONO_RADIO_SETTINGS_INTERFACE,
 + FastDormancy,
 + DBUS_TYPE_BOOLEAN, value);
 + }
 +
 + rs-fast_dormancy = enable;
 +}
 +
 +static void radio_fast_dormancy_set_callback(const struct ofono_error *error,
 + void *data)
 +{
 + struct ofono_radio_settings *rs = data;
 + DBusMessage *reply;
 +
 + if (error-type != OFONO_ERROR_TYPE_NO_ERROR) {
 +  

[ANNOUNCE] oFono 0.33

2010-10-25 Thread Denis Kenzior
Hi Everyone,

oFono 0.33 is out.  This release is mostly a mixed development and bug
fix release.  The main new features are Fixed Dialing support and Send
DTMF support.  Another major feature is GPRS support on Infineon modems.

ChangeLog:
- Fix wrong string to enum mapping of radio settings.
- Fix issue with MMI code to bearer class mappings.
- Fix issue with setting correct phase from EFphase.
- Fix issue with phonebook handling and Infineon modems.
- Fix issue with STK session end handling and Infineon modems.
- Fix issue with SMS handling and ISI modems.
- Fix issue with setting SCA type and ISI modems.
- Add support for FastDormancy property.
- Add support for FixedDialing property to indicate FDN.
- Add support for Infineon specific M-RAW_IP GPRS context.
- Add support for handling Send DTMF proactive command.
- Add support for handling SIM Toolkit text attributes.

The signed tarballs for oFono 0.33 can be found on kernel.org [1] [2].

[1] http://www.kernel.org/pub/linux/network/ofono/ofono-0.33.tar.bz2
[2] http://www.kernel.org/pub/linux/network/ofono/ofono-0.33.tar.bz2.sign
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] voicecall: Limit tone string length per request.

2010-10-25 Thread Andrzej Zaborowski
Also change to avoid memcpying into a buffer.
---
 src/voicecall.c |   17 ++---
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 26cfb9a..bd64432 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2472,7 +2472,7 @@ static gboolean tone_request_run(gpointer user_data)
 {
struct ofono_voicecall *vc = user_data;
struct tone_queue_entry *entry = g_queue_peek_head(vc-toneq);
-   char buf[256];
+   char final;
unsigned len;
 
vc-tone_source = 0;
@@ -2483,14 +2483,17 @@ static gboolean tone_request_run(gpointer user_data)
len = strcspn(entry-left, pP);
 
if (len) {
-   if (len = sizeof(buf))
-   len = sizeof(buf) - 1;
+   if (len  8) /* Arbitrary length limit per request */
+   len = 8;
 
-   memcpy(buf, entry-left, len);
-   buf[len] = '\0';
-   entry-left += len;
+   /* Temporarily move the end of the string */
+   final = entry-left[len];
+   entry-left[len] = '\0';
+
+   vc-driver-send_tones(vc, entry-left, tone_request_cb, vc);
 
-   vc-driver-send_tones(vc, buf, tone_request_cb, vc);
+   entry-left += len;
+   entry-left[0] = final;
} else
tone_request_cb(NULL, vc);
 
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 1/2] stk: Add duration_to_msecs to reduce duplication.

2010-10-25 Thread Andrzej Zaborowski
---
 src/stk.c |   61 ++---
 1 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 82bc91e..ebd3801 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -437,6 +437,24 @@ static void stk_alpha_id_unset(struct ofono_stk *stk)
/* TODO */
 }
 
+static int duration_to_msecs(const struct stk_duration *duration)
+{
+   int msecs = duration-interval;
+
+   switch (duration-unit) {
+   case STK_DURATION_TYPE_MINUTES:
+   msecs *= 60;
+   /* Fall through.  */
+   case STK_DURATION_TYPE_SECONDS:
+   msecs *= 10;
+   /* Fall through.  */
+   case STK_DURATION_TYPE_SECOND_TENTHS:
+   msecs *= 100;
+   }
+
+   return msecs;
+}
+
 static DBusMessage *stk_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
 {
@@ -1000,23 +1018,14 @@ static gboolean handle_command_poll_interval(const 
struct stk_command *cmd,
struct ofono_modem *modem = __ofono_atom_get_modem(stk-atom);
int seconds;
 
-   switch (cmd-poll_interval.duration.unit) {
-   case STK_DURATION_TYPE_MINUTES:
-   seconds = cmd-poll_interval.duration.interval * 60;
-   break;
-   case STK_DURATION_TYPE_SECONDS:
-   seconds = cmd-poll_interval.duration.interval;
-   break;
-   case STK_DURATION_TYPE_SECOND_TENTHS:
-   seconds = (4 + cmd-poll_interval.duration.interval) / 10;
-   if (seconds  1)
-   seconds = 1;
-   break;
-   default:
+   if (!cmd-poll_interval.duration.interval) {
rsp-result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
}
 
+   seconds = MAX(duration_to_msecs(cmd-poll_interval.duration) / 1000,
+   1);
+
ofono_modem_set_integer(modem, status-poll-interval, seconds);
 
if (seconds  255) {
@@ -1219,17 +1228,8 @@ static gboolean handle_command_display_text(const struct 
stk_command *cmd,
return TRUE;
}
 
-   if (dt-duration.interval) {
-   timeout = dt-duration.interval;
-   switch (dt-duration.unit) {
-   case STK_DURATION_TYPE_MINUTES:
-   timeout *= 60;
-   case STK_DURATION_TYPE_SECONDS:
-   timeout *= 10;
-   case STK_DURATION_TYPE_SECOND_TENTHS:
-   timeout *= 100;
-   }
-   }
+   if (dt-duration.interval)
+   timeout = duration_to_msecs(dt-duration);
 
err = stk_agent_display_text(stk-current_agent, text, dt-icon_id,
priority, display_text_cb, stk,
@@ -1387,17 +1387,8 @@ static gboolean handle_command_get_inkey(const struct 
stk_command *cmd,
return TRUE;
}
 
-   if (gi-duration.interval) {
-   timeout = gi-duration.interval;
-   switch (gi-duration.unit) {
-   case STK_DURATION_TYPE_MINUTES:
-   timeout *= 60;
-   case STK_DURATION_TYPE_SECONDS:
-   timeout *= 10;
-   case STK_DURATION_TYPE_SECOND_TENTHS:
-   timeout *= 100;
-   }
-   }
+   if (gi-duration.interval)
+   timeout = duration_to_msecs(gi-duration);
 
gettimeofday(stk-get_inkey_start_ts, NULL);
 
-- 
1.7.1.86.g0e460.dirty

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


[PATCH 2/2] stk: Handle the Play Tone proactive command.

2010-10-25 Thread Andrzej Zaborowski
---
 src/stk.c |  131 +
 1 files changed, 131 insertions(+), 0 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index ebd3801..24326ae 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -2081,6 +2081,132 @@ static gboolean handle_command_send_dtmf(const struct 
stk_command *cmd,
return FALSE;
 }
 
+static void play_tone_cb(enum stk_agent_result result, void *user_data)
+{
+   struct ofono_stk *stk = user_data;
+
+   stk-respond_on_exit = FALSE;
+
+   switch (result) {
+   case STK_AGENT_RESULT_OK:
+   case STK_AGENT_RESULT_TIMEOUT:
+   send_simple_response(stk, STK_RESULT_TYPE_SUCCESS);
+   break;
+
+   default:
+   send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED);
+   break;
+   }
+}
+
+static gboolean handle_command_play_tone(const struct stk_command *cmd,
+   struct stk_response *rsp,
+   struct ofono_stk *stk)
+{
+   static int manufacturer_timeout = 1; /* 10 seconds */
+   static const struct {
+   const char *name;
+   /* Continuous true/false according to 02.40 */
+   gboolean continuous;
+   } tone_infos[] = {
+   /* Default */
+   [0x00] = { dial-tone, TRUE },
+
+   /* Standard */
+   [0x01] = { dial-tone, TRUE },
+   [0x02] = { busy, TRUE },
+   [0x03] = { congestion, TRUE },
+   [0x04] = { radio-path-acknowledge, FALSE },
+   [0x05] = { radio-path-not-available, FALSE },
+   [0x06] = { error, TRUE },
+   [0x07] = { call-waiting, FALSE },
+   [0x08] = { ringing-tone, TRUE },
+
+   /* Proprietary */
+   [0x10] = { general-beep, FALSE },
+   [0x11] = { positive-acknowledgement, FALSE },
+   [0x12] = { negative-acknowledgement, FALSE },
+   [0x13] = { user-ringing-tone, TRUE },
+   [0x14] = { user-sms-alert, FALSE },
+   [0x15] = { critical, FALSE },
+   [0x20] = { vibrate, TRUE },
+
+   /* Themed */
+   [0x30] = { happy, FALSE },
+   [0x31] = { sad, FALSE },
+   [0x32] = { urgent-action, FALSE },
+   [0x33] = { question, FALSE },
+   [0x34] = { message-received, FALSE },
+
+   /* Melody */
+   [0x40] = { melody-1, FALSE },
+   [0x41] = { melody-2, FALSE },
+   [0x42] = { melody-3, FALSE },
+   [0x43] = { melody-4, FALSE },
+   [0x44] = { melody-5, FALSE },
+   [0x45] = { melody-6, FALSE },
+   [0x46] = { melody-7, FALSE },
+   [0x47] = { melody-8, FALSE },
+   };
+
+   const struct stk_command_play_tone *pt = cmd-play_tone;
+   uint8_t qualifier = stk-pending_cmd-qualifier;
+   gboolean vibrate = (qualifier  (1  0)) != 0;
+   char *text;
+   int timeout;
+   int err;
+
+   if (pt-tone  sizeof(tone_infos) / sizeof(*tone_infos) ||
+   !tone_infos[pt-tone].name) {
+   rsp-result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
+
+   return TRUE;
+   }
+
+   text = dbus_apply_text_attributes(pt-alpha_id ? pt-alpha_id : ,
+   pt-text_attr);
+   if (!text) {
+   rsp-result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
+
+   return TRUE;
+   }
+
+   if (pt-duration.interval)
+   timeout = duration_to_msecs(pt-duration);
+   else
+   timeout = manufacturer_timeout;
+
+   if (!tone_infos[pt-tone].continuous)
+   /* Duration ignored */
+   err = stk_agent_play_tone(stk-current_agent, text,
+   pt-icon_id, vibrate,
+   tone_infos[pt-tone].name,
+   play_tone_cb, stk, NULL,
+   stk-timeout * 1000);
+   else
+   err = stk_agent_loop_tone(stk-current_agent, text,
+   pt-icon_id, vibrate,
+   tone_infos[pt-tone].name,
+   play_tone_cb, stk, NULL,
+   timeout);
+
+   g_free(text);
+
+   if (err  0) {
+   /*
+* We most likely got an out of memory error, tell SIM
+* to retry
+*/
+   rsp-result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+   return TRUE;
+   }
+
+   stk-respond_on_exit = TRUE;
+   stk-cancel_cmd = stk_request_cancel;
+
+   return FALSE;
+}
+
 static 

Re: Call counters proposal (TODO patch)

2010-10-25 Thread Aki Niemi
Hi,

2010/10/25 Marcel Holtmann mar...@holtmann.org:
 I am proposing adding Call counters to Voicecall. Here is the TODO patch:

 diff --git a/TODO b/TODO
 index d9a6580..89e180c 100644
 --- a/TODO
 +++ b/TODO
 @@ -329,6 +329,15 @@ Voicecall
     Complexity: C2
     Owner: Pekka Pessi pekka.pe...@nokia.com

 +- Call counters. Provide total outgoing and incoming call duration
 information.
 +  Separate call counters will be maintained for each SIM card. Call
 counters
 +  can be read and reset to 0, and must be backed up periodically to a
 +  non-volatile storage place.

 what is wrong with using the history plugin API and working towards a
 bridge to get these information into tracker.

I think what Andras is suggesting here are per-IMSI properties. This
can be done as a history plugin, sure, but probably a more natural
place would be the voicecall atom.

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


Re: Call counters proposal (TODO patch)

2010-10-25 Thread Denis Kenzior
Hi Aki,

On 10/25/2010 02:43 PM, Aki Niemi wrote:
 Hi,
 
 2010/10/25 Marcel Holtmann mar...@holtmann.org:
 I am proposing adding Call counters to Voicecall. Here is the TODO patch:

 diff --git a/TODO b/TODO
 index d9a6580..89e180c 100644
 --- a/TODO
 +++ b/TODO
 @@ -329,6 +329,15 @@ Voicecall
 Complexity: C2
 Owner: Pekka Pessi pekka.pe...@nokia.com

 +- Call counters. Provide total outgoing and incoming call duration
 information.
 +  Separate call counters will be maintained for each SIM card. Call
 counters
 +  can be read and reset to 0, and must be backed up periodically to a
 +  non-volatile storage place.

 what is wrong with using the history plugin API and working towards a
 bridge to get these information into tracker.
 
 I think what Andras is suggesting here are per-IMSI properties. This
 can be done as a history plugin, sure, but probably a more natural
 place would be the voicecall atom.

voicecall atom is already pretty complicated, so if possible this should
be done outside of the voicecall atom.  Or does the call tracking
require access to the call state information that history api does not
provide?

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


Re: [PATCH] voicecall: Limit tone string length per request.

2010-10-25 Thread Denis Kenzior
Hi Andrew,

On 10/25/2010 12:51 AM, Andrzej Zaborowski wrote:
 Also change to avoid memcpying into a buffer.
 ---
  src/voicecall.c |   17 ++---
  1 files changed, 10 insertions(+), 7 deletions(-)
 

Patch has been applied, thanks.

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


Re: [PATCH 1/2] stk: Add duration_to_msecs to reduce duplication.

2010-10-25 Thread Denis Kenzior
Hi Andrew,

On 10/25/2010 12:51 AM, Andrzej Zaborowski wrote:
 ---
  src/stk.c |   61 
 ++---
  1 files changed, 26 insertions(+), 35 deletions(-)
 

Patch has been applied, thanks.

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


Re: [PATCH 2/2] stk: Handle the Play Tone proactive command.

2010-10-25 Thread Denis Kenzior
Hi Andrew,

On 10/25/2010 12:51 AM, Andrzej Zaborowski wrote:
 ---
  src/stk.c |  131 
 +
  1 files changed, 131 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

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


Re: modem atom api change request for support GSMCDMA dual mode

2010-10-25 Thread Rajesh.Nagaiah
Hi Caiwen,

Zhang, Caiwen to ofono

Hi all,
 
Considering support GSM + CDMA dual mode, it is necessary to let upper
layer to
know the type of the modem currently in use. My proposed solution is
add a 
property 'Type' in modem atom to indicate it. The following is the
definition 
of the property:
 
string Type [readonly]  
   
Type of the modem. The possible values are:
 gsm - the modem is a GSM modem
 cdma - the modem is a CDMA modem
 unknown - the modem is neither a GSM modem nor
 a CDMA modem

As there are also Multimode modems(both GSM and CDMA), Property name
Type would be misleading.

string ModemAccessTechnology [readonly]

Current Access Technology of the Modem. 
The Possible values are:
gsm - the current modem access technology is GSM
cdma - the current modem access technology is CDMA

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


RE: modem atom api change request for support GSMCDMA dual mode

2010-10-25 Thread Zhang, Caiwen
Hi Rajesh,

 
 Considering support GSM + CDMA dual mode, it is necessary to let
upper
 layer to
 know the type of the modem currently in use. My proposed solution is
 add a
 property 'Type' in modem atom to indicate it. The following is the
 definition
 of the property:
 
 string Type [readonly]
 
 Type of the modem. The possible values are:
  gsm - the modem is a GSM modem
  cdma - the modem is a CDMA modem
  unknown - the modem is neither a GSM modem nor
  a CDMA modem
 
 As there are also Multimode modems(both GSM and CDMA), Property name
 Type would be misleading.


Generally, Multimode modem will have different devices. So it can be
regarded as
two different modems. E.g. There is a multimode modem, there are two
device files for
Echo mode: such as /dev/ttyUSB0(for GSM) and /dev/ttyUSB1(for CDMA).

Of course, there may be multimode modem that only offers one device
file, or other 
similar cases. It seems it is very hard to support this case in ofono
currently.

 string ModemAccessTechnology [readonly]
 
 Current Access Technology of the Modem.
 The Possible values are:
 gsm - the current modem access technology is GSM
 cdma - the current modem access technology is CDMA
 

Best regards
Caiwen

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