Re: ConnectionContext creation for LTE PDN Connection.

2010-11-30 Thread Remi.Denis-Courmont
- Message d'origine -
 why would bringing an interface up interfere? We are doing this right
 now. Just the IP assignment is done by ConnMan, but the interface
 up/down status is controlled by oFono or even BlueZ in case of
 Bluetooth.

Logically whoever sets the IP parameters should bring the interface 
administratively up. This is layer 3.

oFono does layer 2. It should either create/remove the interface and/or play 
with the dormant and/or carrier flags.

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


Re: [PATCH] Add voice call boolean property for MO/MT distinction

2010-11-30 Thread Remi.Denis-Courmont
- Message d'origine -
  * AT+CPBR and friends is hooked to the phonebook, which is Qt-based,
 and
  therefore inadequate inside oFono.

 I am not buying into the AT+CPBR for the local and user specific
 phonebook. That one is inside Tracker anyway and also inside the user
 session. Trying to really support this is a broken idea. CPBR can not
 expose the information of modern contacts storage anyway, so just don't
 bother.

I can see how AT+CPBW could be problematic, more so than AT+CPBR. But that is 
not relevant. If a big enough customer wants it badly enough, it has to be 
done. I do not want to end up with an architecture that forbids satisfying some 
of my employer's potential major customers. 

 If you really care about it then use Bluetooth PBAP via obexd which we
 have enabled already.

  * At Nokia, we also have some non-standard commands for internal use.
  * Some operators require some funky AT commands of their own. It might
 not be
  possible to open-source them, even if we want to.

 And these should be on an engineering mode only USB CDC ACM interface
 with a different backend anyway.

I already mentioned that the same software must run in certification and in 
user's hands for whole device certification to be valid. But anyway, some of 
those commands were requested as DUN extensions, not as testing stuff. So no no 
no.

 Only because someone wants to shoehorn this into something nasty,
 doesn't mean we should do it. And I am not going to scarifies the
 simplicity of the oFono D-Bus API for this.

We are talking about the Originated boolean call property?!

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


RE: [PATCH] stk: Add busy error for the display text command

2010-11-30 Thread Lucas, GuillaumeX
Hi Andrzej

 
 Hi Guillaume,
 
 On 25 November 2010 09:44, Lucas, GuillaumeX
 guillaumex.lu...@intel.com wrote:
  From: Guillaume Lucas guillaumex.lu...@intel.com
 
  According to the sequence 1.2 of the ETSI TS 102 384 a busy
  screen error type must be returned for the display text
  proactive command when the message is not urgent and if the
  ME is not able to display the text.
  ---
   doc/stk-api.txt |    1 +
   src/stk.c       |    7 +++
   src/stkagent.c  |   12 ++--
   src/stkagent.h  |    1 +
   4 files changed, 19 insertions(+), 2 deletions(-)
 
  diff --git a/doc/stk-api.txt b/doc/stk-api.txt
  index b9ca592..79daee6 100644
  --- a/doc/stk-api.txt
  +++ b/doc/stk-api.txt
  @@ -116,6 +116,7 @@ Methods             byte RequestSelection(string
 title, byte icon_id,
                         cleared prior to the display of this text.
 
                         Possible Errors:
 [service].Error.SimToolkit.GoBack
  +
  [service].Error.SimToolkit.Busy
 
                         Implementation notes:
 
  diff --git a/src/stk.c b/src/stk.c
  index ac2e646..e6b78a4 100644
  --- a/src/stk.c
  +++ b/src/stk.c
  @@ -1250,6 +1250,10 @@ static void display_text_cb(enum
 stk_agent_result result, void *user_data)
                         STK_RESULT_TYPE_NO_RESPONSE :
 STK_RESULT_TYPE_SUCCESS);
                 break;
 
  +       case STK_AGENT_RESULT_BUSY:
  +               send_simple_response(stk,
 STK_RESULT_TYPE_TERMINAL_BUSY);
  +               break;
  +
 
 According to TS 102.223 on Screen Busy we also need to append a
 additional info field in the Terminal Busy response with a 1-byte
 value 01 (screen is busy).

Yes you're right. I've seen this but after sending my patch.
I've another patch in my pipe regarding this but in top of the current busy 
patch.
I'm waiting the integration of the busy patch to submit it.

 
 Denis on IRC also wondered if this response should be allowed when the
 message is flagged urgent.
 

According to the spec I think no, this type of response is not allowed when the 
message is fluffed urgent.

         case STK_AGENT_RESULT_TERMINATE:
         default:
                 send_simple_response(stk,
 STK_RESULT_TYPE_USER_TERMINATED);
  @@ -1363,6 +1367,7 @@ static void request_confirmation_cb(enum
 stk_agent_result result,
                 break;
 
         case STK_AGENT_RESULT_TERMINATE:
  +       default:
                 send_simple_response(stk,
 STK_RESULT_TYPE_USER_TERMINATED);
                 break;
 
 Most of the other commands also allow a Terminal busy response in
 table 6.1 in section 6.11, without giving a specific additional info
 value.  I think it would be ok to treat them the same way as
 DisplayText and supply the screen is busy value, what do you think?
 

You're right for the other commands but those cases are already handled by 
ofono.
In fact there is only for the display text proactive command that we can have 
this error for a busy screen reason.

Regards,
Guillaume
-
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


RE: [PATCH] stk: Add busy error for the display text command

2010-11-30 Thread Jeevaka.Badrappan
 
Hi Guillaume,

  
  Denis on IRC also wondered if this response should be 
 allowed when the 
  message is flagged urgent.
  
 
 According to the spec I think no, this type of response is 
 not allowed when the message is fluffed urgent.
 

As per the ETSI TS 102 223 V9.0.0 section 6.4.1, screen is busy
applies to high priority text as well. If urgent refers to 
higher priority text which is the case, then I think screen busy is
possible. Find below the information from specification.

High priority text shall be displayed on the screen immediately, except
if there is a conflict of priority level of alerting
such as incoming calls or a low battery warning. In that situation, the
resolution is left to the terminal. If the command is
rejected in spite of the high priority, the terminal shall inform the
UICC using TERMINAL RESPONSE (terminal
currently unable to process command - screen is busy).

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


[PATCH] Simulate provide local info command in sim app

2010-11-30 Thread Yang Gu
---
 src/simapplication.cpp |   68 
 src/simapplication.h   |2 +
 2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 05ae21f..bc96a8c 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -288,6 +288,7 @@ const QString DemoSimApplication::getName()
 #define MainMenu_SendUSSD   13
 #define MainMenu_SendSMS14
 #define MainMenu_Polling15
+#define MainMenu_LocalInfo  16
 
 #define SportsMenu_Chess1
 #define SportsMenu_Painting 2
@@ -346,6 +347,9 @@ const QString DemoSimApplication::getName()
 #define SendUSSD_Error  4
 #define SendUSSD_Main   5
 
+#define LocalInfoMenu_Time  1
+#define LocalInfoMenu_Lang  2
+
 enum SendSMSMenuItems {
SendSMS_Unpacked = 1,
SendSMS_Packed,
@@ -426,6 +430,10 @@ void DemoSimApplication::mainMenu()
 item.setLabel( SIM Polling );
 items += item;
 
+item.setIdentifier( MainMenu_LocalInfo );
+item.setLabel( Provide Local Information );
+items += item;
+
 cmd.setMenuItems( items );
 
 command( cmd, 0, 0 );
@@ -550,6 +558,12 @@ void DemoSimApplication::mainMenuSelection( int id )
 }
 break;
 
+case MainMenu_LocalInfo:
+{
+sendLocalInfoMenu();
+}
+break;
+
 default:
 {
 // Don't know what this item is, so just re-display the main menu.
@@ -2044,3 +2058,57 @@ void DemoSimApplication::pollingMenuResp( const 
QSimTerminalResponse resp )
 break;
 }
 }
+
+void DemoSimApplication::sendLocalInfoMenu()
+{
+QSimCommand cmd;
+QSimMenuItem item;
+QListQSimMenuItem items;
+
+cmd.setType( QSimCommand::SelectItem );
+cmd.setTitle( Provide Local Information );
+
+item.setIdentifier( LocalInfoMenu_Time );
+item.setLabel( Date, time and time zone );
+items += item;
+
+item.setIdentifier( LocalInfoMenu_Lang );
+item.setLabel( Language setting );
+items += item;
+
+cmd.setMenuItems( items );
+
+command( cmd, this, SLOT(localInfoMenu(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::localInfoMenu( const QSimTerminalResponse resp )
+{
+QSimCommand cmd;
+
+if ( resp.result() == QSimTerminalResponse::Success ) {
+switch ( resp.menuItem() ) {
+
+case LocalInfoMenu_Time:
+{
+cmd.setType( QSimCommand::ProvideLocalInformation );
+cmd.setQualifier( 0x03 );
+command( cmd, this, SLOT(sendLocalInfoMenu()) );
+}
+break;
+
+case LocalInfoMenu_Lang:
+{
+cmd.setType( QSimCommand::ProvideLocalInformation );
+cmd.setQualifier( 0x04 );
+command( cmd, this, SLOT(sendLocalInfoMenu()) );
+}
+break;
+
+default:
+endSession();
+break;
+}
+} else {
+endSession();
+}
+}
\ No newline at end of file
diff --git a/src/simapplication.h b/src/simapplication.h
index 4a2430f..6f90a1f 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -119,6 +119,8 @@ protected slots:
 void smsSetTextResp( const QSimTerminalResponse resp );
 void sendPollingMenu();
 void pollingMenuResp( const QSimTerminalResponse resp );
+void sendLocalInfoMenu();
+void localInfoMenu ( const QSimTerminalResponse resp );
 
 private:
 int sticksLeft;
-- 
1.7.2.3

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


[PATCH 1/3] smsutil: Change the range of time zone

2010-11-30 Thread Yang Gu
---
 src/smsutil.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index b06e9bf..644e3e0 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -51,6 +51,13 @@
 #define SMS_ADDR_FMT %24[0-9A-F]
 #define SMS_MSGID_FMT %40[0-9A-F]
 
+/*
+ * Time zone accounts for daylight saving time, and the two extreme time
+ * zones on earth are UTC-12 and UTC+14.
+ */
+#define MAX_TIMEZONE 56
+#define MIN_TIMEZONE -48
+
 static GSList *sms_assembly_add_fragment_backup(struct sms_assembly *assembly,
const struct sms *sms, time_t ts,
const struct sms_address *addr,
@@ -339,7 +346,7 @@ gboolean sms_encode_scts(const struct sms_scts *in, 
unsigned char *pdu,
if (in-second  59)
return FALSE;
 
-   if ((in-timezone  12*4-1) || (in-timezone  -(12*4-1)))
+   if ((in-timezone  MAX_TIMEZONE) || (in-timezone  MIN_TIMEZONE))
return FALSE;
 
pdu = pdu + *offset;
@@ -426,7 +433,7 @@ gboolean sms_decode_scts(const unsigned char *pdu, int len,
if (oct  0x08)
out-timezone = out-timezone * -1;
 
-   if ((out-timezone  12*4-1) || (out-timezone  -(12*4-1)))
+   if ((out-timezone  MAX_TIMEZONE) || (out-timezone  MIN_TIMEZONE))
return FALSE;
 
return TRUE;
-- 
1.7.2.3

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


[PATCH 2/3] Make timezone an optional field

2010-11-30 Thread Yang Gu
---
 src/smsutil.c |   11 ++-
 src/smsutil.h |1 +
 src/stkutil.c |   13 ++---
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index 644e3e0..20af30a 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -346,7 +346,8 @@ gboolean sms_encode_scts(const struct sms_scts *in, 
unsigned char *pdu,
if (in-second  59)
return FALSE;
 
-   if ((in-timezone  MAX_TIMEZONE) || (in-timezone  MIN_TIMEZONE))
+   if ((in-timezone  MAX_TIMEZONE || in-timezone  MIN_TIMEZONE) 
+   in-has_timezone == TRUE)
return FALSE;
 
pdu = pdu + *offset;
@@ -358,6 +359,11 @@ gboolean sms_encode_scts(const struct sms_scts *in, 
unsigned char *pdu,
pdu[4] = ((in-minute / 10)  0x0f) | (((in-minute % 10)  0x0f)  4);
pdu[5] = ((in-second / 10)  0x0f) | (((in-second % 10)  0x0f)  4);
 
+   if (in-has_timezone == FALSE) {
+   pdu[6] = 0xff;
+   goto out;
+   }
+
timezone = abs(in-timezone);
 
pdu[6] = ((timezone / 10)  0x07) | (((timezone % 10)  0x0f)  4);
@@ -365,6 +371,7 @@ gboolean sms_encode_scts(const struct sms_scts *in, 
unsigned char *pdu,
if (in-timezone  0)
pdu[6] |= 0x8;
 
+out:
*offset += 7;
 
return TRUE;
@@ -436,6 +443,8 @@ gboolean sms_decode_scts(const unsigned char *pdu, int len,
if ((out-timezone  MAX_TIMEZONE) || (out-timezone  MIN_TIMEZONE))
return FALSE;
 
+   out-has_timezone = TRUE;
+
return TRUE;
 }
 
diff --git a/src/smsutil.h b/src/smsutil.h
index 4b05313..4b6159f 100644
--- a/src/smsutil.h
+++ b/src/smsutil.h
@@ -223,6 +223,7 @@ struct sms_scts {
guint8 hour;
guint8 minute;
guint8 second;
+   gboolean has_timezone;
gint8 timezone;
 };
 
diff --git a/src/stkutil.c b/src/stkutil.c
index a211462..01a0021 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -4548,7 +4548,6 @@ static gboolean build_dataobj_datetime_timezone(struct 
stk_tlv_builder *tlv,
const void *data, gboolean cr)
 {
const struct sms_scts *scts = data;
-   struct sms_scts timestamp;
unsigned char value[7];
int offset = 0;
unsigned char tag = STK_DATA_OBJECT_TYPE_DATETIME_TIMEZONE;
@@ -4556,16 +4555,8 @@ static gboolean build_dataobj_datetime_timezone(struct 
stk_tlv_builder *tlv,
if (scts-month == 0  scts-day == 0)
return TRUE;
 
-   /* Time zone information is optional */
-   if (scts-timezone == (gint8) 0xff) {
-   memcpy(timestamp, scts, sizeof(timestamp));
-   timestamp.timezone = 0;
-   if (sms_encode_scts(timestamp, value, offset) != TRUE)
-   return FALSE;
-   value[6] = 0xff;
-   } else
-   if (sms_encode_scts(scts, value, offset) != TRUE)
-   return FALSE;
+   if (sms_encode_scts(scts, value, offset) != TRUE)
+   return FALSE;
 
return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) 
stk_tlv_builder_append_bytes(tlv, value, 7) 
-- 
1.7.2.3

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


[PATCH 3/3] stk: Handle provide local info proactive command

2010-11-30 Thread Yang Gu
---
 src/stk.c |   77 +
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index a4abb7d..08353f2 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -26,6 +26,7 @@
 #define _GNU_SOURCE
 #include string.h
 #include stdio.h
+#include stdlib.h
 #include stdint.h
 
 #include glib.h
@@ -1995,6 +1996,77 @@ static gboolean handle_command_refresh(const struct 
stk_command *cmd,
return TRUE;
 }
 
+static void get_time(struct stk_response *rsp)
+{
+   time_t now;
+   struct tm *t;
+
+   time(now);
+   t = localtime(now);
+
+   rsp-result.type = STK_RESULT_TYPE_SUCCESS;
+
+   if (t-tm_year  100)
+   rsp-provide_local_info.datetime.year = t-tm_year - 100;
+   else
+   rsp-provide_local_info.datetime.year = t-tm_year;
+
+   rsp-provide_local_info.datetime.month = t-tm_mon + 1;
+   rsp-provide_local_info.datetime.day = t-tm_mday;
+   rsp-provide_local_info.datetime.hour = t-tm_hour;
+   rsp-provide_local_info.datetime.minute = t-tm_min;
+   rsp-provide_local_info.datetime.second = t-tm_sec;
+   rsp-provide_local_info.datetime.timezone = t-tm_gmtoff / 900;
+   rsp-provide_local_info.datetime.has_timezone = TRUE;
+
+   return;
+}
+
+static void get_lang(struct stk_response *rsp, struct ofono_stk *stk)
+{
+   char *l;
+   char lang[3];
+   struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
+
+   l = getenv(LANG);
+   if (l == NULL) {
+   rsp-result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+   goto out;
+   }
+
+   memcpy(lang, l, 2);
+   lang[2] = '\0';
+
+   rsp-result.type = STK_RESULT_TYPE_SUCCESS;
+   rsp-provide_local_info.language = lang;
+
+out:
+   if (stk_respond(stk, rsp, stk_command_cb))
+   stk_command_cb(failure, stk);
+}
+
+static gboolean handle_command_provide_local_info(const struct stk_command 
*cmd,
+   struct stk_response *rsp, struct ofono_stk *stk)
+{
+   switch (cmd-qualifier) {
+   case 3:
+   DBG(Date, time and time zone);
+   get_time(rsp);
+   return TRUE;
+
+   case 4:
+   DBG(Language setting);
+   get_lang(rsp, stk);
+   return FALSE;
+
+   default:
+   ofono_info(Unsupported Provide Local Info qualifier: %d,
+   cmd-qualifier);
+   rsp-result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+   return TRUE;
+   }
+}
+
 static void send_dtmf_cancel(struct ofono_stk *stk)
 {
struct ofono_voicecall *vc = NULL;
@@ -2427,6 +2499,11 @@ void ofono_stk_proactive_command_notify(struct ofono_stk 
*stk,
rsp, stk);
break;
 
+   case STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO:
+   respond = handle_command_provide_local_info(stk-pending_cmd,
+   rsp, stk);
+   break;
+
case STK_COMMAND_TYPE_SEND_DTMF:
respond = handle_command_send_dtmf(stk-pending_cmd,
rsp, stk);
-- 
1.7.2.3

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


Re: [PATCH] Add voice call boolean property for MO/MT distinction

2010-11-30 Thread Marcel Holtmann
Hi Remi,

do me a favor and try not to break the threading next time.

   * At Nokia, we also have some non-standard commands for internal use.
   * Some operators require some funky AT commands of their own. It might
  not be
   possible to open-source them, even if we want to.
 
  And these should be on an engineering mode only USB CDC ACM interface
  with a different backend anyway.
 
 I already mentioned that the same software must run in certification and in 
 user's hands for whole device certification to be valid. But anyway, some 
 of those commands were requested as DUN extensions, not as testing stuff. So 
 no no no.

I am getting a bit sick of this secrecy. oFono is for all intense and
purposes open source. So if you want a proper discussion here then
please list the AT command in question.

Since you are clearly working on this right now, please compile a list
of required AT commands and share it. A good place to list the required
commands for whole device certification would be the doc/ directory.

Regards

Marcel


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


Re: ConnectionContext creation for LTE PDN Connection.

2010-11-30 Thread Marcel Holtmann
Hi Remi,

as I mentioned before, please do NOT break threading.

  why would bringing an interface up interfere? We are doing this right
  now. Just the IP assignment is done by ConnMan, but the interface
  up/down status is controlled by oFono or even BlueZ in case of
  Bluetooth.
 
 Logically whoever sets the IP parameters should bring the interface 
 administratively up. This is layer 3.
 
 oFono does layer 2. It should either create/remove the interface and/or play 
 with the dormant and/or carrier flags.

If you think we should change the current behavior, then please send
patches for oFono and BlueZ and also ConnMan to fix this.

Regards

Marcel


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


Re: [PATCH] Add voice call boolean property for MO/MT distinction

2010-11-30 Thread Aki Niemi
Hi Marcel,

2010/11/30 Marcel Holtmann mar...@holtmann.org:
 I am getting a bit sick of this secrecy. oFono is for all intense and
 purposes open source. So if you want a proper discussion here then
 please list the AT command in question.

So this patch seems to be to enable reporting call direction as part
of reporting call status using AT+CLCC.  It is needed by HFP as well
as a conformance suite for USB ACM that Rémi is working on.

In addition, I think it is good API design to provide call direction
as a property via a GetProperties() call, as it is already available
by witnessing call progress in the State property.  A user restarting
in the middle of an ongoing call will otherwise miss this state
information.

So technically, this patch should go in, especially given it is a
property without which these two users of oFono won't work properly.

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


Re: ConnectionContext creation for LTE PDN Connection.

2010-11-30 Thread Sjur Brændeland
Hi Marcel,

Marcel Holtmann wrote:
  Or should oFono automatically create a Connection Context?
 
  Furthermore, should oFono automatically proceed and
  set Active=true, bind the connection to a network interface
  and set network interface in state UP,

 Definitely not. This would interfere with any other existing IP connection, 
 say
 WiFi.

 why would bringing an interface up interfere? We are doing this right
 now. Just the IP assignment is done by ConnMan, but the interface
 up/down status is controlled by oFono or even BlueZ in case of
 Bluetooth.

So does this imply that you think oFono should set Active=true and
and bring up the interface as soon as the Initial PDN  is avilable?

What about the ConnectionContext, should oFono automatically create a
new one if needed?

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


Re: [PATCH] Add voice call boolean property for MO/MT distinction

2010-11-30 Thread Marcel Holtmann
Hi Aki,

  I am getting a bit sick of this secrecy. oFono is for all intense and
  purposes open source. So if you want a proper discussion here then
  please list the AT command in question.
 
 So this patch seems to be to enable reporting call direction as part
 of reporting call status using AT+CLCC.  It is needed by HFP as well
 as a conformance suite for USB ACM that Rémi is working on.

as I said before, someone has to do the due diligence and start listing
all required AT commands for conformance testing. I want to see the full
picture and not some random patches here and there.

I am still not convinced that these details should be exposed via D-Bus
APIs at all. Using the internal AT emulator would be a way better fit.

So can you guys come up with a detailed list of AT commands for this? I
want to have this documented. Then we can have a proper discussion since
this is not getting anywhere.

Regards

Marcel


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


Re: ConnectionContext creation for LTE PDN Connection.

2010-11-30 Thread Denis Kenzior
Hi Sjur,

On 11/30/2010 05:26 AM, Sjur Brændeland wrote:
 Hi Marcel,
 
 Marcel Holtmann wrote:
 Or should oFono automatically create a Connection Context?

 Furthermore, should oFono automatically proceed and
 set Active=true, bind the connection to a network interface
 and set network interface in state UP,

 Definitely not. This would interfere with any other existing IP connection, 
 say
 WiFi.

 why would bringing an interface up interfere? We are doing this right
 now. Just the IP assignment is done by ConnMan, but the interface
 up/down status is controlled by oFono or even BlueZ in case of
 Bluetooth.
 
 So does this imply that you think oFono should set Active=true and
 and bring up the interface as soon as the Initial PDN  is avilable?
 
 What about the ConnectionContext, should oFono automatically create a
 new one if needed?

I think it is too early to tell, we need more information about how LTE
works.  Right now I'm not convinced LTE belongs on the ConnectionManager
interface at all.

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


Re: [ofono] vendor code

2010-11-30 Thread Denis Kenzior
Hi Tonny,

On 11/30/2010 04:45 AM, Tonny Tzeng wrote:
 Hi List,
 
 While debugging a connection issue using huawei EM770W modem, I added
 a DBG code to print out the status value received in at_cgreg_cb() in
 drivers/atmodem/gprs.c, I found the status got from the
 at_util_parse_reg() is incorrect sometimes, because ofono does not set
 vendor ID in the gprs_data, and it looks to me the vendor code is
 required so that the at_util_parse_reg() will read unquoted strings in
 the solicited events for huawei modem.  For example, when we got
 +CGREG: 1, 2833, 1231B60 followed by +CGREG: 2,1, 2733, 1B60
 unsolicited codes, the status parsed from this code is 2833 (i.e. the
 1st code), instead of the expected 1 in the 2nd code.
 

I suggest you complain to the vendor that they do not follow standards,
and ask them to fix their firmware.

 It looks like all modem plugins invoke ofono_gprs_context_create()
 with vendor=0, is this on purpose?  then how could at_util_parse_reg()
 parses strings correctly without knowing vendor code?

This can be added to the huawei driver, however this won't help you
completely as the firmware still reports bizarre values.  Care to send a
patch?

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


Re: [PATCH] stk: Add busy error for the display text command

2010-11-30 Thread Denis Kenzior
Hi Guillaume,

 According to TS 102.223 on Screen Busy we also need to append a
 additional info field in the Terminal Busy response with a 1-byte
 value 01 (screen is busy).
 
 Yes you're right. I've seen this but after sending my patch.
 I've another patch in my pipe regarding this but in top of the current busy 
 patch.
 I'm waiting the integration of the busy patch to submit it.

This is not how it works ;)  Please resubmit this patch with the code to
send 'Screen is Busy' additional info included.  You can even submit
your other pending patches in a series along with this one...

So e.g.

patch 1/n - reworked add busy error...
patch 2/n - pending patch 1,
etc

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


RE: [PATCH] stk: Add busy error for the display text command

2010-11-30 Thread Lucas, GuillaumeX
Hi Denis,

 -Original Message-
 From: Denis Kenzior [mailto:denk...@gmail.com]
 Sent: Tuesday, November 30, 2010 1:25 PM
 To: ofono@ofono.org
 Cc: Lucas, GuillaumeX
 Subject: Re: [PATCH] stk: Add busy error for the display text command
 
 Hi Guillaume,
 
  According to TS 102.223 on Screen Busy we also need to append a
  additional info field in the Terminal Busy response with a 1-byte
  value 01 (screen is busy).
 
  Yes you're right. I've seen this but after sending my patch.
  I've another patch in my pipe regarding this but in top of the
 current busy patch.
  I'm waiting the integration of the busy patch to submit it.
 
 This is not how it works ;)  Please resubmit this patch with the code
 to
 send 'Screen is Busy' additional info included.  You can even submit
 your other pending patches in a series along with this one...
 
 So e.g.
 
 patch 1/n - reworked add busy error...
 patch 2/n - pending patch 1,
 etc
 

Ok, I'll resubmmit my patch with all the necessary changes.

Regards,
Guillaume
-
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


Re: [PATCH] Add voice call boolean property for MO/MT distinction

2010-11-30 Thread Remi.Denis-Courmont
- Message d'origine -
 do me a favor and try not to break the threading next time.

When I am away from my laptop, I use whatever MUA I can. This is obviously not 
deliberate a choice.

 I am getting a bit sick of this secrecy. oFono is for all intense and
 purposes open source.

And I am sick of arguing for something as simple and obvious as exposing the 
call direction in the calls list.

 So if you want a proper discussion here then
 please list the AT command in question.

Operator requirements are typically confidential. Since they are copyighted by 
their originator, not by me or my employer, I cannot fix that. Or rather, I can 
try (it is ongoing) but I cannot promise anything.

But this is only a side issue. We have a working AT commands DCE implementation 
that supports both cellular/oFono stuff and all the other that we need. 
Open-sourcing as much as we can is an ongoing process. I am not interested in 
rewriting that (and the BlueZ HFP code) into oFono just for the heck of it.

Furthermore providing some useful features (like call direction) only via a 
would-be oFono AT commands but not via the _preferred_ D-Bus interface seems 
silly and counter-productive to me.

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


[PATCH] stk: Add busy error for the display text command

2010-11-30 Thread Lucas, GuillaumeX
From: Guillaume Lucas guillaumex.lu...@intel.com

According to the sequence 1.2 of the ETSI TS 102 384 a busy
screen error should be returns for the display text proactive
command when the ME is not able to display the text.
---
 doc/stk-api.txt |1 +
 src/stk.c   |   15 +++
 src/stkagent.c  |   12 ++--
 src/stkagent.h  |1 +
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/doc/stk-api.txt b/doc/stk-api.txt
index b9ca592..79daee6 100644
--- a/doc/stk-api.txt
+++ b/doc/stk-api.txt
@@ -116,6 +116,7 @@ Methods byte RequestSelection(string title, 
byte icon_id,
cleared prior to the display of this text.
 
Possible Errors: [service].Error.SimToolkit.GoBack
+[service].Error.SimToolkit.Busy
 
Implementation notes:
 
diff --git a/src/stk.c b/src/stk.c
index a4abb7d..7b39f7e 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1203,6 +1203,9 @@ static void display_text_cb(enum stk_agent_result result, 
void *user_data)
 {
struct ofono_stk *stk = user_data;
gboolean confirm;
+   struct stk_response rsp;
+   static unsigned char screen_busy_result[] = { 0x01 };
+   static struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
 
stk-respond_on_exit = FALSE;
 
@@ -1250,6 +1253,15 @@ static void display_text_cb(enum stk_agent_result 
result, void *user_data)
STK_RESULT_TYPE_NO_RESPONSE : STK_RESULT_TYPE_SUCCESS);
break;
 
+   case STK_AGENT_RESULT_BUSY:
+   memset(rsp, 0, sizeof(rsp));
+   rsp.result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+   rsp.result.additional_len = sizeof(screen_busy_result);
+   rsp.result.additional = screen_busy_result;
+   if (stk_respond(stk, rsp, stk_command_cb))
+   stk_command_cb(error, stk);
+   break;
+
case STK_AGENT_RESULT_TERMINATE:
default:
send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED);
@@ -1366,6 +1378,7 @@ static void request_confirmation_cb(enum stk_agent_result 
result,
break;
 
case STK_AGENT_RESULT_TERMINATE:
+   default:
send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED);
break;
}
@@ -1408,6 +1421,7 @@ static void request_key_cb(enum stk_agent_result result, 
char *string,
break;
 
case STK_AGENT_RESULT_TERMINATE:
+   default:
send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED);
break;
}
@@ -1505,6 +1519,7 @@ static void request_string_cb(enum stk_agent_result 
result, char *string,
break;
 
case STK_AGENT_RESULT_TERMINATE:
+   default:
send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED);
break;
}
diff --git a/src/stkagent.c b/src/stkagent.c
index 8315040..874b6dd 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -41,6 +41,7 @@
 enum allowed_error {
ALLOWED_ERROR_GO_BACK   = 0x1,
ALLOWED_ERROR_TERMINATE = 0x2,
+   ALLOWED_ERROR_BUSY  = 0x4,
 };
 
 struct stk_agent {
@@ -62,6 +63,7 @@ struct stk_agent {
 #define ERROR_PREFIX OFONO_SERVICE .Error
 #define GOBACK_ERROR ERROR_PREFIX .GoBack
 #define TERMINATE_ERROR ERROR_PREFIX .EndSession
+#define BUSY_ERROR ERROR_PREFIX .Busy
 
 static void stk_agent_send_noreply(struct stk_agent *agent, const char *method)
 {
@@ -194,6 +196,12 @@ static int check_error(struct stk_agent *agent, 
DBusMessage *reply,
goto out;
}
 
+   if ((allowed_errors  ALLOWED_ERROR_BUSY) 
+   g_str_equal(err.name, BUSY_ERROR)) {
+   *out_result = STK_AGENT_RESULT_BUSY;
+   goto out;
+   }
+
result = -EINVAL;
 
 out:
@@ -376,8 +384,8 @@ static void display_text_cb(DBusPendingCall *call, void 
*data)
gboolean remove_agent;
 
if (check_error(agent, reply,
-   ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
-   result) == -EINVAL) {
+   ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE | 
+   ALLOWED_ERROR_BUSY, result) == -EINVAL) {
remove_agent = TRUE;
goto error;
}
diff --git a/src/stkagent.h b/src/stkagent.h
index c8e1886..517bcfe 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -26,6 +26,7 @@ enum stk_agent_result {
STK_AGENT_RESULT_BACK,
STK_AGENT_RESULT_TERMINATE,
STK_AGENT_RESULT_TIMEOUT,
+   STK_AGENT_RESULT_BUSY,
 };
 
 struct stk_menu_item {
-- 
1.7.0.4

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France

Re: [RFCv2] doc: Assisted Satellite Navigation API and Agent API

2010-11-30 Thread Denis Kenzior
Hi Sjur  Simon,

 diff --git a/doc/assisted-sattelite-navigation.txt 
 b/doc/assisted-sattelite-navigation.txt
 new file mode 100755
 index 000..6c85a7f
 --- /dev/null
 +++ b/doc/assisted-sattelite-navigation.txt
 @@ -0,0 +1,56 @@
 +AssistedSatelliteNavigation hierarchy
 +=

What do you think of naming this AssistedNavigation?  I think the
current name might be a bit too long.

 +
 +Service  org.ofono
 +Interfaceorg.ofono.AssistedSatelliteNavigation
 +Object path  [variable prefix]/{modem0,modem1,...}
 +
 +Methods  void SendPositioningControl(string xml_element)

What do you think of SendPositioningElement?

 +
 + Send an XML element conforming to the XML DTD for pos
 + as defined in 3GPP 27.007 Table 8.55-2. This xml is
 + used for transferring data associated with positioning
 + requests received via control plane from the network.
 + This includes assistance data requests and the results
 + of positioning procedures. This method maps directly to
 + the 3GPP 27.007 AT+CPOS command.
 +
 + void RegisterPositioningRequestAgent(object path)
 +
 + Registers an agent which will be called whenever a
 + CPOSR AT response is received. The Agent must respond
 + to requests using SendPositioningControl.
 +
 + void UnregisterPositioningRequestAgent(object path)
 +
 + Unregisters the agent.
 +
 +PositioningRequestAgent hierarchy
 +==
 +
 +Service  unique name
 +Interfaceorg.ofono.PositioningRequestAgent
 +Object path  freely definable
 +
 +Methods  void PositioningRequest(string xml_element)

I think that 'Request' will be sufficient.  Positioning is already part
of the agent name.

 +
 + Receive an XML element conforming to the XML DTD for
 + pos in 3GPP 27.007. This xml is used for transferring
 + data associated with positioning requests received, via
 + control plane, from the network. This includes
 + measurement requests and assistance data. This method
 + maps directly to the 3GPP defined +CPOSR unsolicited
 + result code.
 +
 + void AssistanceDataReset()

I suggest ResetAssistanceData here.

 +
 + A request has been received from the network that all
 + assistance data should be reset.  This is used for 3gpp
 + performance tests.
 +
 + void Release()
 +
 + Agent is being released, possibly because of oFono
 + terminating, AssistedSatelliteNavigation interface
 + is being torn down or modem off.
 + No UnregisterAgent call is needed.

The only other change I'd make is to mark the entire interface
'experimental', but I can take care of that as well.

Otherwise the proposal looks good to me.

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


Re: Need clarification in querying the pin status

2010-11-30 Thread Sankar
Hi Denis,

On Tue, Oct 19, 2010 at 8:31 PM, Denis Kenzior denk...@gmail.com wrote:

 Hi Mamata,

 On 10/19/2010 09:20 AM, mamata l wrote:
  Hi,
 
  I need clarification for querying the pin status when enabling/disabling
  pin fails and the maximum number of attempts of wrong password are
  reached in the modem.
 
  I am trying to enable pin with the wrong password, and trying to get the
  pin status. I observe that the maximum number of attempts for wrong
  password
  have reached and the modem has reached to puk state and also the modem
  de-registers from network.
  In this case when i tried to get the properties using GetProperties,
  the properties from the ofono core are received without querying the
  information
  from the modem. The PinRequired received is none .
 
  Could you please provide some info how to get the sim pin state when sim
  is blocked on puk at run-time and is there any way for app to know the
  number of attempts remaining.

 This is actually a bug in oFono, somehow we missed the fact that
 ChangePin with the wrong PIN will decrease the retry counts.  The core
 needs to be fixed to query the current PIN state and reset the state to
 pre-sim if the retry limit is reached.


Can you please let us know if this is already addressed or this will be
addressed in future.


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

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


Re: Need clarification in querying the pin status

2010-11-30 Thread Denis Kenzior
Hi Sankar,

 This is actually a bug in oFono, somehow we missed the fact that
 ChangePin with the wrong PIN will decrease the retry counts.  The core
 needs to be fixed to query the current PIN state and reset the state to
 pre-sim if the retry limit is reached.
 
 
 Can you please let us know if this is already addressed or this will be
 addressed in future.
 

This task is still pending, see the last task in the SIM / SIM File
System section of the TODO list.

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


Re: [PATCH] stk: Add busy error for the display text command

2010-11-30 Thread Denis Kenzior
Hi Guillaume,

On 11/30/2010 07:21 AM, Lucas, GuillaumeX wrote:
 From: Guillaume Lucas guillaumex.lu...@intel.com
 
 According to the sequence 1.2 of the ETSI TS 102 384 a busy
 screen error should be returns for the display text proactive
 command when the ME is not able to display the text.
 ---
  doc/stk-api.txt |1 +
  src/stk.c   |   15 +++
  src/stkagent.c  |   12 ++--
  src/stkagent.h  |1 +
  4 files changed, 27 insertions(+), 2 deletions(-)
 

Patch has been applied, however I fixed one minor booboo for you:

Applying: stk: Add busy error for the display text command
/home/denkenz/ofono-master/.git/rebase-apply/patch:113: trailing whitespace.
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE |
fatal: 1 line adds whitespace errors.
Patch failed at 0001 stk: Add busy error for the display text command

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


RE: [RFC] AGPS Support

2010-11-30 Thread Marko.Ovaska


: -Original Message-
: Behalf Of ext Joly, Frederic

:  -Original Message-
:  From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of 
Marcel Holtmann
:  Sent: Wednesday, November 03, 2010 11:40 AM
--
:  Or do we expect oFono core to do something with this data? I am under
:  the impression that oFono core is just a pipe here.


I would not expect oFono core to do anything with assistance data, last I 
looked oFono does not have positioning engine that needs helper data to enhance 
fix time. 

Positioning engine, whether in Linux or in GPR chip, interfaces user plane 
A-GPS OMA SUPL servers and control plane A-GPS (plus 3GPP commands) to cellular 
network residing servers. Both interfaces, in the end, point to 3GPP TS's with 
ASN.1 BER encoded content for assistance data. Control plane or user plane 
A-GPS servers do not do XML formats. Only 27.007 introduces format conversion.
So raw pipe, as Sjur proposed, but with ASN.1 formatted payload without payload 
conversions in modem NOR in Linux side (oFono core, modem plugin or positioning 
engine) to XML.


 
:  And in conclusion we have XML and ASN.1 adding some overhead to the
:  actual data that is encoded. None of them is coming for free.
: 
:  If we wanna look at this not from the 27.007 standard angle, then we
:  have to look at what the users of this D-Bus are talking and what
: would
:  be easiest for them.

OMA SUPL specifications point to 3GPP 44.031 and TS 25.331. The common 
nominator for positioning engines is OMA and non-27.007 TS's use of ASN.1 
formatted data. TS 27.007 from positioning user view is the odd standard. 

 
: As of today, I'm suspicious about proposing the XML format as the only
: ofono solution.
: Do we have commitments from GPS vendors or positioning framework
: vendors or telephone integrators that they are going to use the XML
: format?
: Does STE GPS framework supports these XML formats?

As above, positioning engine has to be ASN.1 capable when user plane A-GPS is 
used. Products over different mobile platforms do user plane A-GPS, control 
plane with AT interface introduced XML just adds overhead.

  Marko


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


[PATCH 1/2] huaweimodem: Add support for radio settings

2010-11-30 Thread Lucas De Marchi
From: Marcel Holtmann marcel.holtm...@intel.com

---
 Makefile.am  |3 +-
 drivers/huaweimodem/huaweimodem.c|2 +
 drivers/huaweimodem/huaweimodem.h|3 +
 drivers/huaweimodem/radio-settings.c |  212 ++
 4 files changed, 219 insertions(+), 1 deletions(-)
 create mode 100644 drivers/huaweimodem/radio-settings.c

diff --git a/Makefile.am b/Makefile.am
index a4c47e8..5d39c23 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,7 +180,8 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/huaweimodem/huaweimodem.c \
drivers/huaweimodem/voicecall.c \
drivers/huaweimodem/audio-settings.c \
-   drivers/huaweimodem/gprs-context.c
+   drivers/huaweimodem/gprs-context.c \
+   drivers/huaweimodem/radio-settings.c
 
 builtin_modules += calypsomodem
 builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/huaweimodem/huaweimodem.c 
b/drivers/huaweimodem/huaweimodem.c
index c8b6522..8097a9c 100644
--- a/drivers/huaweimodem/huaweimodem.c
+++ b/drivers/huaweimodem/huaweimodem.c
@@ -36,6 +36,7 @@ static int huaweimodem_init(void)
 {
huawei_voicecall_init();
huawei_audio_settings_init();
+   huawei_radio_settings_init();
huawei_gprs_context_init();
 
return 0;
@@ -44,6 +45,7 @@ static int huaweimodem_init(void)
 static void huaweimodem_exit(void)
 {
huawei_gprs_context_exit();
+   huawei_radio_settings_exit();
huawei_audio_settings_exit();
huawei_voicecall_exit();
 }
diff --git a/drivers/huaweimodem/huaweimodem.h 
b/drivers/huaweimodem/huaweimodem.h
index 03d52ef..596aa08 100644
--- a/drivers/huaweimodem/huaweimodem.h
+++ b/drivers/huaweimodem/huaweimodem.h
@@ -27,5 +27,8 @@ extern void huawei_voicecall_exit();
 extern void huawei_audio_settings_init();
 extern void huawei_audio_settings_exit();
 
+extern void huawei_radio_settings_init();
+extern void huawei_radio_settings_exit();
+
 extern void huawei_gprs_context_init();
 extern void huawei_gprs_context_exit();
diff --git a/drivers/huaweimodem/radio-settings.c 
b/drivers/huaweimodem/radio-settings.c
new file mode 100644
index 000..7f0b223
--- /dev/null
+++ b/drivers/huaweimodem/radio-settings.c
@@ -0,0 +1,212 @@
+/*
+ *
+ *  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
+
+#define _GNU_SOURCE
+#include string.h
+#include stdlib.h
+#include stdio.h
+#include errno.h
+
+#include glib.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/radio-settings.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include huaweimodem.h
+
+static const char *none_prefix[] = { NULL };
+static const char *xrat_prefix[] = { ^SYSCFG:, NULL };
+
+struct radio_settings_data {
+   GAtChat *chat;
+};
+
+static void xrat_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_radio_settings_rat_mode_query_cb_t cb = cbd-cb;
+   enum ofono_radio_access_mode mode;
+   struct ofono_error error;
+   GAtResultIter iter;
+   int value;
+
+   decode_at_error(error, g_at_result_final_response(result));
+
+   if (!ok) {
+   cb(error, -1, cbd-data);
+   return;
+   }
+
+   g_at_result_iter_init(iter, result);
+
+   if (g_at_result_iter_next(iter, ^SYSCFG:) == FALSE)
+   goto error;
+
+   if (g_at_result_iter_next_number(iter, value) == FALSE)
+   goto error;
+
+   switch (value) {
+   case 2:
+   mode = OFONO_RADIO_ACCESS_MODE_ANY;
+   break;
+   case 13:
+   mode = OFONO_RADIO_ACCESS_MODE_GSM;
+   break;
+   case 14:
+   mode = OFONO_RADIO_ACCESS_MODE_UMTS;
+   break;
+   default:
+   CALLBACK_WITH_FAILURE(cb, -1, cbd-data);
+   return;
+   }
+
+   cb(error, mode, cbd-data);
+
+   return;
+
+error:
+   CALLBACK_WITH_FAILURE(cb, -1, cbd-data);
+}
+
+static void huawei_query_rat_mode(struct ofono_radio_settings *rs,
+   

Re: [PATCH 1/2] huaweimodem: Add support for radio settings

2010-11-30 Thread Lucas De Marchi
On Tue, Nov 30, 2010 at 4:25 PM, Lucas De Marchi
lucas.demar...@profusion.mobi wrote:
 diff --git a/drivers/huaweimodem/radio-settings.c 
 b/drivers/huaweimodem/radio-settings.c
 new file mode 100644
 index 000..7f0b223
 --- /dev/null
 +++ b/drivers/huaweimodem/radio-settings.c
 @@ -0,0 +1,212 @@
 +/*
 + *
 + *  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
 +
 +#define _GNU_SOURCE
 +#include string.h
 +#include stdlib.h
 +#include stdio.h
 +#include errno.h
 +
 +#include glib.h
 +
 +#include ofono/log.h
 +#include ofono/modem.h
 +#include ofono/radio-settings.h
 +
 +#include gatchat.h
 +#include gatresult.h
 +
 +#include huaweimodem.h
 +
 +static const char *none_prefix[] = { NULL };
 +static const char *xrat_prefix[] = { ^SYSCFG:, NULL };
 +
 +struct radio_settings_data {
 +       GAtChat *chat;
 +};

I left chat inside a radio_settings_data struct because I plan to
extend it in a follow up patch, when this one is accepted and I finish
my tests with Frequency Band Selection.


Marcel, sorry... I've made a git commit -c in one commit of yours
(to re-use the commit message), so this actually came with your name.

I'll send again this patch



regards,

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


[RESEND PATCHv2 1/2] stemodem: Create network interfaces statically

2010-11-30 Thread Sjur Brændeland
From: Sjur Brændeland sjur.brandel...@stericsson.com

Changes:
o Restructure code so interfaces are created statically when probe is called,
  instead of creating interfaces dynamically at activation.
o Changed debug messages.
o Removed some of the unnecessary initializations at declaration.
o No longer reporting default gateway for PtP IP Interface.
o Bugfix: Handle network initiated deactivation.
---
Resend after re-basing with latest commit:
drivers: explicitly compare pointers to NULL.

 drivers/stemodem/gprs-context.c |  149 +-
 1 files changed, 82 insertions(+), 67 deletions(-)

diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index faa3124..7bdcdb8 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -28,6 +28,7 @@
 #include string.h
 #include stdlib.h
 #include stdio.h
+#include errno.h
 
 #include glib.h
 
@@ -65,10 +66,18 @@ struct gprs_context_data {
 };
 
 struct conn_info {
+   /*
+* cid is allocated in oFono Core and is identifying
+* the Account. cid = 0 indicates that it is currently unused.
+*/
unsigned int cid;
-   unsigned int device;
+   /* Id used by CAIF and EPPSD to identify the CAIF channel*/
unsigned int channel_id;
-   char interface[10];
+   /* Linux Interface Id */
+   unsigned int ifindex;
+   /* Linux Interface name */
+   char interface[IF_NAMESIZE];
+   gboolean created;
 };
 
 struct eppsd_response {
@@ -76,7 +85,6 @@ struct eppsd_response {
char ip_address[IP_ADDR_LEN];
char subnet_mask[IP_ADDR_LEN];
char mtu[IP_ADDR_LEN];
-   char default_gateway[IP_ADDR_LEN];
char dns_server1[IP_ADDR_LEN];
char dns_server2[IP_ADDR_LEN];
char p_cscf_server[IP_ADDR_LEN];
@@ -96,8 +104,6 @@ static void start_element_handler(GMarkupParseContext 
*context,
rsp-current = rsp-subnet_mask;
else if (!strcmp(element_name, mtu))
rsp-current = rsp-mtu;
-   else if (!strcmp(element_name, default_gateway))
-   rsp-current = rsp-default_gateway;
else if (!strcmp(element_name, dns_server) 
rsp-dns_server1[0] == '\0')
rsp-current = rsp-dns_server1;
@@ -123,7 +129,7 @@ static void text_handler(GMarkupParseContext *context,
 
if (rsp-current) {
strncpy(rsp-current, text, IP_ADDR_LEN);
-   rsp-current[IP_ADDR_LEN] = 0;
+   rsp-current[IP_ADDR_LEN] = '\0';
}
 }
 
@@ -153,8 +159,7 @@ static gint conn_compare_by_cid(gconstpointer a, 
gconstpointer b)
return 0;
 }
 
-static struct conn_info *conn_info_create(unsigned int device,
-   unsigned int channel_id)
+static struct conn_info *conn_info_create(unsigned int channel_id)
 {
struct conn_info *connection = g_try_new0(struct conn_info, 1);
 
@@ -162,7 +167,6 @@ static struct conn_info *conn_info_create(unsigned int 
device,
return NULL;
 
connection-cid = 0;
-   connection-device = device;
connection-channel_id = channel_id;
 
return connection;
@@ -171,7 +175,7 @@ static struct conn_info *conn_info_create(unsigned int 
device,
 /*
  * Creates a new IP interface for CAIF.
  */
-static gboolean caif_if_create(const char *interface, unsigned int connid)
+static gboolean caif_if_create(struct conn_info *conn)
 {
return FALSE;
 }
@@ -179,9 +183,8 @@ static gboolean caif_if_create(const char *interface, 
unsigned int connid)
 /*
  * Removes IP interface for CAIF.
  */
-static gboolean caif_if_remove(const char *interface, unsigned int connid)
+static void caif_if_remove(struct conn_info *conn)
 {
-   return FALSE;
 }
 
 static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
@@ -210,21 +213,13 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult 
*result,
DBG(Did not find data (used caif device) for
connection with cid; %d,
gcd-active_context);
-   goto error;
+   CALLBACK_WITH_FAILURE(cb, cbd-data);
+   return;
}
 
conn = l-data;
-
-   if (!caif_if_remove(conn-interface, conn-channel_id)) {
-   DBG(Failed to remove caif interface %s.,
-   conn-interface);
-   }
-
conn-cid = 0;
-   return;
-
-error:
-   CALLBACK_WITH_FAILURE(cb, cbd-data);
+   CALLBACK_WITH_SUCCESS(cb, cbd-data);
 }
 
 static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -233,7 +228,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
ofono_gprs_context_up_cb_t cb = cbd-cb;
struct ofono_gprs_context *gc = cbd-user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
-

[RESEND PATCHv2 2/2] stemodem: Use RTNL to create network interfaces.

2010-11-30 Thread Sjur Brændeland
From: Sjur Brændeland sjur.brandel...@stericsson.com

---
 drivers/stemodem/gprs-context.c |   44 --
 1 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index bfc0d65..21ca126 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -47,6 +47,7 @@
 #include stemodem.h
 #include caif_socket.h
 #include if_caif.h
+#include caif_rtnl.h
 
 #define MAX_CAIF_DEVICES 4
 #define MAX_DNS 2
@@ -172,12 +173,20 @@ static struct conn_info *conn_info_create(unsigned int 
channel_id)
return connection;
 }
 
-/*
- * Creates a new IP interface for CAIF.
- */
-static gboolean caif_if_create(struct conn_info *conn)
+static void rtnl_callback(int ifindex, const char *ifname, void *user_data)
 {
-   return FALSE;
+   struct conn_info *conn = user_data;
+
+   if (ifindex  0) {
+   conn-created = FALSE;
+   ofono_error(Failed to create caif interface %s,
+   conn-interface);
+   return;
+   }
+
+   strncpy(conn-interface, ifname, sizeof(conn-interface));
+   conn-ifindex = ifindex;
+   conn-created = TRUE;
 }
 
 /*
@@ -185,6 +194,18 @@ static gboolean caif_if_create(struct conn_info *conn)
  */
 static void caif_if_remove(struct conn_info *conn)
 {
+   if (!conn-created)
+   return;
+
+   if (caif_rtnl_delete_interface(conn-ifindex)  0) {
+   ofono_error(Failed to delete caif interface %s,
+   conn-interface);
+   return;
+   }
+
+   DBG(removed CAIF interface ch:%d ifname:%s ifindex:%d\n,
+   conn-channel_id, conn-interface, conn-ifindex);
+   return;
 }
 
 static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
@@ -526,7 +547,7 @@ static int ste_gprs_context_probe(struct ofono_gprs_context 
*gc,
GAtChat *chat = data;
struct gprs_context_data *gcd;
struct conn_info *ci;
-   int i;
+   int i,err;
 
gcd = g_new0(struct gprs_context_data, 1);
gcd-chat = g_at_chat_clone(chat);
@@ -539,7 +560,14 @@ static int ste_gprs_context_probe(struct 
ofono_gprs_context *gc,
ci = conn_info_create(i+1);
if (!ci)
return -ENOMEM;
-   caif_if_create(ci);
+   err = caif_rtnl_create_interface(IFLA_CAIF_IPV4_CONNID,
+   ci-channel_id, FALSE,
+   rtnl_callback, ci);
+   if (err  0) {
+   DBG(Failed to create IP interface for CAIF);
+   return err;
+   }
+
g_caif_devices = g_slist_append(g_caif_devices, ci);
}
 
@@ -571,10 +599,12 @@ static struct ofono_gprs_context_driver driver = {
 
 void ste_gprs_context_init()
 {
+   caif_rtnl_init();
ofono_gprs_context_driver_register(driver);
 }
 
 void ste_gprs_context_exit()
 {
+   caif_rtnl_exit();
ofono_gprs_context_driver_unregister(driver);
 }
-- 
1.6.3.3

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


[RESEND PATCH] plugin: Add ste modem initd integration

2010-11-30 Thread Sjur Brændeland
From: Sjur Brændeland sjur.brandel...@stericsson.com

This patch introduces auto discovery of ST-Ericsson modems.
ST-Ericsson modems (M57XX, M7XX, M74XX) are managed by a 
Modem Init Daemon that is responsible for start/stop/restart
flashing etc. This STE plugin monitors the modem state exposed
from the Modem Init Damon Dbus API. When the modem is in state
on the STE modem is created and registered.

Currently only a single modem instance is supported,
support for multiple modems should be added in the future.

---
 Makefile.am  |5 ++
 configure.ac |6 ++
 plugins/stemid.c |  195 ++
 3 files changed, 206 insertions(+), 0 deletions(-)
 create mode 100644 plugins/stemid.c

diff --git a/Makefile.am b/Makefile.am
index f841b4c..aaf5de5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,11 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \
 
 udev_files = plugins/ofono.rules
 
+if STE_MODEM_INITD
+builtin_modules += stemid
+builtin_sources += plugins/stemid.c
+endif
+
 if UDEV
 builtin_modules += udev
 builtin_sources += plugins/udev.c
diff --git a/configure.ac b/configure.ac
index c0f4217..4dff372 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,6 +175,12 @@ AC_ARG_ENABLE(datafiles, 
AC_HELP_STRING([--disable-datafiles],
 
 AM_CONDITIONAL(DATAFILES, test ${enable_datafiles} != no)
 
+AC_ARG_ENABLE(ste_modem_initd, AC_HELP_STRING([--disable-ste-modem-initd],
+   [disable auto discovery of STE modem using modem init 
daemon]),
+   [enable_ste_modem_initd=${enableval}])
+
+AM_CONDITIONAL(STE_MODEM_INITD, test ${enable_ste_modem_initd} != no)
+
 if (test ${prefix} = NONE); then
dnl no prefix and no localstatedir, so default to /var
if (test $localstatedir = '${prefix}/var'); then
diff --git a/plugins/stemid.c b/plugins/stemid.c
new file mode 100644
index 000..7041e5e
--- /dev/null
+++ b/plugins/stemid.c
@@ -0,0 +1,195 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 ST-Ericsson AB.
+ *
+ *  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 stdio.h
+#include fcntl.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+#include net/if.h
+
+#include gdbus.h
+#include glib.h
+#include gatchat.h
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include ofono/plugin.h
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/dbus.h
+#include ofono/version.h
+
+/*
+ * ST-Ericsson's modem init daemon defines the signal StateChange
+ * and the method GetState. When state is on the STE modem is
+ * created and registered.
+ */
+#define STATUS_CHANGED StateChange
+#define MID_SERVICEcom.stericsson.modeminit
+#define MID_INTERFACE  MID_SERVICE .Modem
+#define GET_STATE  GetState
+#define MID_STATE_ON   on
+#define MID_STATE_DISCONNECT   disconnect
+#define TIMEOUT5000
+
+static struct ofono_modem *ste_modem;
+static guint mid_api_watch;
+static guint mid_state_watch;
+
+static void handle_stemodem(const char *state)
+{
+
+   DBG(state:%s, state);
+
+   if (strcmp(state, MID_STATE_ON) == 0) {
+   int err;
+
+   if (ste_modem != NULL)
+   return;
+
+   ste_modem = ofono_modem_create(ste, ste);
+   DBG(register STE modem);
+   err = ofono_modem_register(ste_modem);
+   } else {
+
+   if (ste_modem == NULL)
+   return;
+
+   ofono_modem_remove(ste_modem);
+   ste_modem = NULL;
+   }
+}
+
+static void mid_getstate_reply(DBusPendingCall *call, void *user_data)
+{
+   DBusMessage *reply;
+   char *state;
+
+   reply = dbus_pending_call_steal_reply(call);
+
+   if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
+   ofono_error(STE Modem Init Daemon is unavailable);
+   goto error;
+   }
+
+   if (dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, state,
+   DBUS_TYPE_INVALID) == FALSE) {
+   ofono_error(STE Modem Init Damon: bad signature for GetState);
+   goto error;
+   }
+
+   handle_stemodem(state);
+
+error:
+   dbus_message_unref(reply);
+}
+
+static 

[PATCH 2/2] huawei: Add support for radio settings

2010-11-30 Thread Lucas De Marchi
---
 plugins/huawei.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/huawei.c b/plugins/huawei.c
index 25dfaca..3c58c7f 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -43,6 +43,7 @@
 #include ofono/gprs.h
 #include ofono/gprs-context.h
 #include ofono/audio-settings.h
+#include ofono/radio-settings.h
 #include ofono/voicecall.h
 #include ofono/call-forwarding.h
 #include ofono/call-settings.h
@@ -629,6 +630,9 @@ static void huawei_post_online(struct ofono_modem *modem)
ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
atmodem, data-pcui);
 
+   ofono_radio_settings_create(modem, OFONO_VENDOR_HUAWEI, huaweimodem,
+   data-pcui);
+
if (data-sim_state == HUAWEI_SIM_STATE_VALID ||
data-sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
data-gprs = ofono_gprs_create(modem, 0, atmodem, data-pcui);
-- 
1.7.3.2

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


[PATCH 1/2] huaweimodem: Add support for radio settings

2010-11-30 Thread Lucas De Marchi
---
 Makefile.am  |3 +-
 drivers/huaweimodem/huaweimodem.c|2 +
 drivers/huaweimodem/huaweimodem.h|3 +
 drivers/huaweimodem/radio-settings.c |  212 ++
 4 files changed, 219 insertions(+), 1 deletions(-)
 create mode 100644 drivers/huaweimodem/radio-settings.c

diff --git a/Makefile.am b/Makefile.am
index a4c47e8..5d39c23 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,7 +180,8 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/huaweimodem/huaweimodem.c \
drivers/huaweimodem/voicecall.c \
drivers/huaweimodem/audio-settings.c \
-   drivers/huaweimodem/gprs-context.c
+   drivers/huaweimodem/gprs-context.c \
+   drivers/huaweimodem/radio-settings.c
 
 builtin_modules += calypsomodem
 builtin_sources += drivers/atmodem/atutil.h \
diff --git a/drivers/huaweimodem/huaweimodem.c 
b/drivers/huaweimodem/huaweimodem.c
index c8b6522..8097a9c 100644
--- a/drivers/huaweimodem/huaweimodem.c
+++ b/drivers/huaweimodem/huaweimodem.c
@@ -36,6 +36,7 @@ static int huaweimodem_init(void)
 {
huawei_voicecall_init();
huawei_audio_settings_init();
+   huawei_radio_settings_init();
huawei_gprs_context_init();
 
return 0;
@@ -44,6 +45,7 @@ static int huaweimodem_init(void)
 static void huaweimodem_exit(void)
 {
huawei_gprs_context_exit();
+   huawei_radio_settings_exit();
huawei_audio_settings_exit();
huawei_voicecall_exit();
 }
diff --git a/drivers/huaweimodem/huaweimodem.h 
b/drivers/huaweimodem/huaweimodem.h
index 03d52ef..596aa08 100644
--- a/drivers/huaweimodem/huaweimodem.h
+++ b/drivers/huaweimodem/huaweimodem.h
@@ -27,5 +27,8 @@ extern void huawei_voicecall_exit();
 extern void huawei_audio_settings_init();
 extern void huawei_audio_settings_exit();
 
+extern void huawei_radio_settings_init();
+extern void huawei_radio_settings_exit();
+
 extern void huawei_gprs_context_init();
 extern void huawei_gprs_context_exit();
diff --git a/drivers/huaweimodem/radio-settings.c 
b/drivers/huaweimodem/radio-settings.c
new file mode 100644
index 000..7f0b223
--- /dev/null
+++ b/drivers/huaweimodem/radio-settings.c
@@ -0,0 +1,212 @@
+/*
+ *
+ *  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
+
+#define _GNU_SOURCE
+#include string.h
+#include stdlib.h
+#include stdio.h
+#include errno.h
+
+#include glib.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/radio-settings.h
+
+#include gatchat.h
+#include gatresult.h
+
+#include huaweimodem.h
+
+static const char *none_prefix[] = { NULL };
+static const char *xrat_prefix[] = { ^SYSCFG:, NULL };
+
+struct radio_settings_data {
+   GAtChat *chat;
+};
+
+static void xrat_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+   struct cb_data *cbd = user_data;
+   ofono_radio_settings_rat_mode_query_cb_t cb = cbd-cb;
+   enum ofono_radio_access_mode mode;
+   struct ofono_error error;
+   GAtResultIter iter;
+   int value;
+
+   decode_at_error(error, g_at_result_final_response(result));
+
+   if (!ok) {
+   cb(error, -1, cbd-data);
+   return;
+   }
+
+   g_at_result_iter_init(iter, result);
+
+   if (g_at_result_iter_next(iter, ^SYSCFG:) == FALSE)
+   goto error;
+
+   if (g_at_result_iter_next_number(iter, value) == FALSE)
+   goto error;
+
+   switch (value) {
+   case 2:
+   mode = OFONO_RADIO_ACCESS_MODE_ANY;
+   break;
+   case 13:
+   mode = OFONO_RADIO_ACCESS_MODE_GSM;
+   break;
+   case 14:
+   mode = OFONO_RADIO_ACCESS_MODE_UMTS;
+   break;
+   default:
+   CALLBACK_WITH_FAILURE(cb, -1, cbd-data);
+   return;
+   }
+
+   cb(error, mode, cbd-data);
+
+   return;
+
+error:
+   CALLBACK_WITH_FAILURE(cb, -1, cbd-data);
+}
+
+static void huawei_query_rat_mode(struct ofono_radio_settings *rs,
+   ofono_radio_settings_rat_mode_query_cb_t cb,
+  

[PATCH] voicecall: fix DBG message

2010-11-30 Thread Gustavo F. Padovan
---
 drivers/atmodem/voicecall.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 10b8f4b..3c31d72 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -723,7 +723,7 @@ static void clip_notify(GAtResult *result, gpointer 
user_data)
/* If we have CLI validity field, override our guessed value */
g_at_result_iter_next_number(iter, validity);
 
-   DBG(clip_notify: %s %d %d, num, type, validity);
+   DBG(%s %d %d, num, type, validity);
 
call = l-data;
 
-- 
1.7.3.2

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


RE: [PATCH 3/3] stk: Handle provide local info proactive command

2010-11-30 Thread Jeevaka.Badrappan
 
Hi Yang,

  
 +static void get_time(struct stk_response *rsp) {
 + time_t now;
 + struct tm *t;
 +
 + time(now);
 + t = localtime(now);
 +
 + rsp-result.type = STK_RESULT_TYPE_SUCCESS;
 +
 + if (t-tm_year  100)
 + rsp-provide_local_info.datetime.year = 
 t-tm_year - 100;
 + else
 + rsp-provide_local_info.datetime.year = t-tm_year;
 +

Incase of error, localtime shall return a null pointer. I think its
better to add the NULL check. 

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


[PATCH] HACKING: Add ofono.conf file copy command required

2010-11-30 Thread Rafael Ignacio Zurita

Add ofono.conf copy command required for oFono core daemon to work.

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

diff --git a/HACKING b/HACKING
index e825185..e632279 100644
--- a/HACKING
+++ b/HACKING
@@ -76,6 +76,9 @@ use the plugins directly from within the repository. This 
removes the need
 to use make install when testing ofonod. The bootstrap-configure
 automatically includes this option.
 
+  Copy configuration file which specifies the required security policies
+# sudo cp ./src/ofono.conf /etc/dbus-1/system.d/
+
   Run daemon in foreground with debugging
 # sudo ./src/ofonod -n -d 'plugins/*'
 
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] atmodem: fix DBG message

2010-11-30 Thread Gustavo F. Padovan
---
 drivers/atmodem/voicecall.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 10b8f4b..f6714cb 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -679,7 +679,7 @@ static void cring_notify(GAtResult *result, gpointer 
user_data)
 */
vd-clcc_source = g_timeout_add(CLIP_INTERVAL, poll_clcc, vc);
 
-   DBG(cring_notify);
+   DBG();
 }
 
 static void clip_notify(GAtResult *result, gpointer user_data)
@@ -723,7 +723,7 @@ static void clip_notify(GAtResult *result, gpointer 
user_data)
/* If we have CLI validity field, override our guessed value */
g_at_result_iter_next_number(iter, validity);
 
-   DBG(clip_notify: %s %d %d, num, type, validity);
+   DBG(%s %d %d, num, type, validity);
 
call = l-data;
 
@@ -784,7 +784,7 @@ static void ccwa_notify(GAtResult *result, gpointer 
user_data)
/* If we have CLI validity field, override our guessed value */
g_at_result_iter_next_number(iter, validity);
 
-   DBG(ccwa_notify: %s %d %d %d, num, num_type, cls, validity);
+   DBG(%s %d %d %d, num, num_type, cls, validity);
 
call = create_call(vc, class_to_call_type(cls), 1, 5,
num, num_type, validity);
-- 
1.7.3.2

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


Re: [PATCH] voicecall: fix DBG message

2010-11-30 Thread Gustavo F. Padovan
* Gustavo F. Padovan pado...@profusion.mobi [2010-11-30 17:40:24 -0200]:

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

Ignore this one, I found more similar issues and sent a new patch.


-- 
Gustavo F. Padovan
http://profusion.mobi
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 3/3] stk: Handle provide local info proactive command

2010-11-30 Thread Yang Gu
---
 src/stk.c |   85 +
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index a4abb7d..53eca78 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -26,6 +26,7 @@
 #define _GNU_SOURCE
 #include string.h
 #include stdio.h
+#include stdlib.h
 #include stdint.h
 
 #include glib.h
@@ -1995,6 +1996,85 @@ static gboolean handle_command_refresh(const struct 
stk_command *cmd,
return TRUE;
 }
 
+static void get_time(struct stk_response *rsp, struct ofono_stk *stk)
+{
+   time_t now;
+   struct tm *t;
+   struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
+
+   time(now);
+   t = localtime(now);
+
+   if (t == NULL) {
+   rsp-result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+   goto out;
+   }
+
+   rsp-result.type = STK_RESULT_TYPE_SUCCESS;
+
+   if (t-tm_year  100)
+   rsp-provide_local_info.datetime.year = t-tm_year - 100;
+   else
+   rsp-provide_local_info.datetime.year = t-tm_year;
+
+   rsp-provide_local_info.datetime.month = t-tm_mon + 1;
+   rsp-provide_local_info.datetime.day = t-tm_mday;
+   rsp-provide_local_info.datetime.hour = t-tm_hour;
+   rsp-provide_local_info.datetime.minute = t-tm_min;
+   rsp-provide_local_info.datetime.second = t-tm_sec;
+   rsp-provide_local_info.datetime.timezone = t-tm_gmtoff / 900;
+   rsp-provide_local_info.datetime.has_timezone = TRUE;
+
+out:
+   if (stk_respond(stk, rsp, stk_command_cb))
+   stk_command_cb(failure, stk);
+}
+
+static void get_lang(struct stk_response *rsp, struct ofono_stk *stk)
+{
+   char *l;
+   char lang[3];
+   struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
+
+   l = getenv(LANG);
+   if (l == NULL) {
+   rsp-result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+   goto out;
+   }
+
+   memcpy(lang, l, 2);
+   lang[2] = '\0';
+
+   rsp-result.type = STK_RESULT_TYPE_SUCCESS;
+   rsp-provide_local_info.language = lang;
+
+out:
+   if (stk_respond(stk, rsp, stk_command_cb))
+   stk_command_cb(failure, stk);
+}
+
+static gboolean handle_command_provide_local_info(const struct stk_command 
*cmd,
+   struct stk_response *rsp, struct ofono_stk *stk)
+{
+   switch (cmd-qualifier) {
+   case 3:
+   DBG(Date, time and time zone);
+   get_time(rsp, stk);
+   return FALSE;
+
+   case 4:
+   DBG(Language setting);
+   get_lang(rsp, stk);
+   return FALSE;
+
+   default:
+   ofono_info(Unsupported Provide Local Info qualifier: %d,
+   cmd-qualifier);
+   rsp-result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+   return TRUE;
+   }
+}
+
 static void send_dtmf_cancel(struct ofono_stk *stk)
 {
struct ofono_voicecall *vc = NULL;
@@ -2427,6 +2507,11 @@ void ofono_stk_proactive_command_notify(struct ofono_stk 
*stk,
rsp, stk);
break;
 
+   case STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO:
+   respond = handle_command_provide_local_info(stk-pending_cmd,
+   rsp, stk);
+   break;
+
case STK_COMMAND_TYPE_SEND_DTMF:
respond = handle_command_send_dtmf(stk-pending_cmd,
rsp, stk);
-- 
1.7.2.3

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


RE: [PATCH 3/3] stk: Handle provide local info proactive command

2010-11-30 Thread Gu, Yang
Hi Jeevaka,


-Original Message-
From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of
jeevaka.badrap...@elektrobit.com
Sent: Wednesday, December 01, 2010 4:43 AM
To: ofono@ofono.org
Subject: RE: [PATCH 3/3] stk: Handle provide local info proactive command


Hi Yang,


 +static void get_time(struct stk_response *rsp) {
 +time_t now;
 +struct tm *t;
 +
 +time(now);
 +t = localtime(now);
 +
 +rsp-result.type = STK_RESULT_TYPE_SUCCESS;
 +
 +if (t-tm_year  100)
 +rsp-provide_local_info.datetime.year =
 t-tm_year - 100;
 +else
 +rsp-provide_local_info.datetime.year = t-tm_year;
 +

Incase of error, localtime shall return a null pointer. I think its
better to add the NULL check.


Thanks for the comment. I have sent out the modified version. 




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


Re: [ofono] vendor code

2010-11-30 Thread Tonny Tzeng
Hi Dennis,

On Tue, Nov 30, 2010 at 8:22 PM, Denis Kenzior denk...@gmail.com wrote:
 While debugging a connection issue using huawei EM770W modem, I added
 a DBG code to print out the status value received in at_cgreg_cb() in
 drivers/atmodem/gprs.c, I found the status got from the
 at_util_parse_reg() is incorrect sometimes, because ofono does not set
 vendor ID in the gprs_data, and it looks to me the vendor code is
 required so that the at_util_parse_reg() will read unquoted strings in
 the solicited events for huawei modem.  For example, when we got
 +CGREG: 1, 2833, 1231B60 followed by +CGREG: 2,1, 2733, 1B60
 unsolicited codes, the status parsed from this code is 2833 (i.e. the
 1st code), instead of the expected 1 in the 2nd code.

 I suggest you complain to the vendor that they do not follow standards,
 and ask them to fix their firmware.

Any possibility that this is a race condition?  Just while ofono
sending AT+CGREG? to poll the CGREG state, modem already sent out
unsolicited CGREG?  I saw at_util_parse_reg() also tries to skip
unsolicited CREG/CGREG, so it looks like this is valid concern?

 It looks like all modem plugins invoke ofono_gprs_context_create()
 with vendor=0, is this on purpose?  then how could at_util_parse_reg()
 parses strings correctly without knowing vendor code?

 This can be added to the huawei driver, however this won't help you
 completely as the firmware still reports bizarre values.  Care to send a
 patch?

Sure I will patch and send out the huawei plugins patch, but since I
am not familiar with the overall ofono code, so I'd like to verify
what my understanding so far -- modem plugins should send the vendor
ID while invoke ofono_gprs_context_create()?  Would you please
confirm?  Thanks.


 Regards,
 -Denis

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