[PATCH] Fix change state immediately when meet the slash

2010-02-02 Thread Zhenhua Zhang
According to V.250 spec section 5.2.4 Repeating a command line, if
the prefix A/ or a/ is received, we should execute the last
command immediately. No need to meet \r.
---
 gatchat/gatserver.c |   20 +---
 1 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index fe5c3a8..eb33605 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -35,7 +35,6 @@
 enum ParserState {
PARSER_STATE_IDLE,
PARSER_STATE_A,
-   PARSER_STATE_SLASH,
PARSER_STATE_COMMAND,
PARSER_STATE_GARBAGE,
 };
@@ -214,22 +213,14 @@ static enum ParserResult server_feed(GAtServer *server,
i += 1;
res = PARSER_RESULT_GARBAGE;
goto out;
-   } else if (byte == '/')
-   server-parser_state = PARSER_STATE_SLASH;
-   else if (byte == 'T' || byte == 't')
+   } else if (byte == '/') {
server-parser_state = PARSER_STATE_COMMAND;
-   else
-   server-parser_state = PARSER_STATE_GARBAGE;
-
-   break;
-
-   case PARSER_STATE_SLASH:
-   if (byte == s3) {
-   server-parser_state = PARSER_STATE_IDLE;
-   i+= 1;
+   i += 1;
res = PARSER_RESULT_REPEAT_LAST;
goto out;
-   } else if (byte != ' '  byte != '\t')
+   } else if (byte == 'T' || byte == 't')
+   server-parser_state = PARSER_STATE_COMMAND;
+   else
server-parser_state = PARSER_STATE_GARBAGE;
 
break;
@@ -246,7 +237,6 @@ static enum ParserResult server_feed(GAtServer *server,
case PARSER_STATE_GARBAGE:
if (byte == s3) {
server-parser_state = PARSER_STATE_IDLE;
-
i += 1;
res = PARSER_RESULT_GARBAGE;
goto out;
-- 
1.6.6.1

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


Re: [RFC] [PATCH 0/2] HFP AG integration with PulseAudio

2010-02-02 Thread Luiz Augusto von Dentz
Hi,

2010/1/29 João Paulo Rechi Vita jprv...@gmail.com:
 Hi all,

 I'm trying to add support for the Handsfree Gateway role Gustavo just added
 to BlueZ and oFono. The BlueZ patches can be found on [1] and [2] and the
 oFono part was just merged upstream.

 But when it comes to integrate them with Pulse, I'm getting a POLLHUP when
 trying to write on the fd. Also, it seems different gateways have different
 behaviours regarding when they connect the SCO link. Some phone connect
 them just after the RFCOMM link (some Nokia phones), when there is no call
 going on yet, and others just when a call is started (Android 1.5).

 Also, right now the same property (State) is beeing used to refer when the
 RFCOOM link is established (State=Connected) and when the SCO link is
 established (State=Playing). Shouldn't this be handled by separate props?

 And last but not least, is the new Media API intended to handle the audio
 part of handsfree gateways too? If so, maybe we should use all this work
 as a prototype for latter integration with the new API.

Yep, Media API is supposed to handle this, that why I asked them to be
though in an integrated manner maybe being registered in the same
interface (although hfp is not really media only), anyway basically we
should have pa acting as a2dp source/sink and/or hfp gateway/headset
endpoint handling the audio. So in essence ofono is acting as a
controller/target in a very similar way as avrcp does for a2dp,
although for avrcp we don't really need an agent as we use uinput.

 Any help on testing and getting this working together or comments on the
 topic would be appreciated.

There is already some code in my git tree:
http://gitorious.org/~vudentz/bluez/vudentzs-clone/commits/for-upstream

-- 
Luiz Augusto von Dentz
Engenheiro de Computação
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] Fix change state immediately when meet the slash

2010-02-02 Thread Denis Kenzior
Hi Zhenhua,

 According to V.250 spec section 5.2.4 Repeating a command line, if
 the prefix A/ or a/ is received, we should execute the last
 command immediately. No need to meet \r.

Yes you're right.

 @@ -214,22 +213,14 @@ static enum ParserResult server_feed(GAtServer
  *server, i += 1;
   res = PARSER_RESULT_GARBAGE;
   goto out;
 - } else if (byte == '/')
 - server-parser_state = PARSER_STATE_SLASH;
 - else if (byte == 'T' || byte == 't')
 + } else if (byte == '/') {
   server-parser_state = PARSER_STATE_COMMAND;

I changed this to PARSER_STATE_IDLE and applied the patch.

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


FW: FW: [RFC 3/3] STE-plugin: Adding STE plugin

2010-02-02 Thread Sjur Brændeland
Hi Denis.

We have done some testing with the STE modem for call termination,
and this is the result:

TC |Call #1 | Call #2 | Call #3  | Command   | Result
---|
1  |ACTIVE  | ACTIVE  | ..   | ATH | call 1, 2 terminated   
2  |ACTIVE  | ACTIVE  | ..   | AT+CHUP | call 1, 2 terminated   
3  |ACTIVE  | ACTIVE  | HELD | ATH | call 1, 2 terminated   
4  |ACTIVE  | ACTIVE  | HELD | AT+CHUP | call 1, 2 terminated
5  |ACTIVE  | ACTIVE  | HELD | AT+CHLD=0;H | call 1, 2 and 3 terminated
6  |ACTIVE  | ACTIVE  | WAITING  | ATH | call 1, 2 terminated
7  |ACTIVE  | ACTIVE  | WAITING  | AT+CHUP | call 1, 2 terminated
8  |ACTIVE  | HELD| WAITING  | CHLD=0  | call 3 terminated, 
9  |ACTIVE  | HELD| WAITING  | ATH | call 1 terminated
10 |ACTIVE  | HELD| WAITING  | AT+CHUP | call 1 terminated
11 |HELD| HELD| ACTIVE   | AT+CHLD=0   | call 1, 2 terminated
12 |HELD| HELD| ACTIVE   | AT+CHLD=0;H | call 1, 2 and 3 terminated
13 |HELD| DIALING | ..   | ATH | call 2 (MO) terminated
14 |HELD| DIALING | ..   | CHUP| call 2 (MO) terminated
15 |HELD| DIALING | ..   | AT+CHLD=12  | call 2 (MO) NOT terminated
16 |HELD| WAITING | ..   | AT+CHLD=0   | call 2 terminated
17 |HELD| ..  | ..   | ATH | call 1 NOT terminated  


Denis Kenzior wrote:
 oFono already takes care of this for single calls (see
 src/voicecall.c voicecall_hangup.)  So this is only an issue in the
 case of three way calls, is this what you're referring to here?
 
 Kind of. This is very good, it takes care of the situation with
 emergency  call which cannot be terminated with CHLD commands.
 
 But I think there are more issues. If I am not mistaken STE-modems
 have the following behavior:
 CHLD=1X can only terminate call in state ACTIVE or HELD. (I think
 this 
 is as STE interprets the standards).
 
 The standards specify that CHLD=1X can only terminate an ACTIVE call.
 Most modems implement it this way.  There are vendor extensions that
 provide this functionality (e.g. CHLD=7X on TI.)  By default oFono
 assumes that release_specific will simply fail if a user attempts to
 use it on an e.g. HELD call with no modem support.

For the STE modem, AT+CHLD=1x terminates calls in state ACTIVE and HELD.

 
 a) If you are in a active call and receives a new incoming call
 (ALERTING) and want to reject the new ALERTING call, then STE modem
 cannot terminate this call with CHLD=1X. It has to be terminated
 with CHLD=0 (cause=BUSY) or ATH (possible CHUP).
 
 Ok, lets get the terminology clear here.  In this case the incoming
 call is not ALERTING, it is WAITING.  WAITING calls are always
 rejected by using CHLD=0.  ALERTING calls are always outgoing calls
 that transitioned from DIALING to alerting the user.   
 
 
 b) Or you may have the following situation. One call on HOLD,
 another ACTIVE call, and then you receive a new incoming call
 ALERTING. If you try to terminate the new incoming (ALERTING) call
 with CHLD=0, 
 I think you as a side effect will terminate the call on hold as well.
 If I am not mistaken ATH (possible CHUP) would be the correct in this
 situation for STE modems
 
 The standards are quite clear here, the WAITING call always takes
 precedence 
 and thus only the WAITING call is affected. Can you check that STE
 modems do 
 indeed get this wrong?  If the modem is standards compliant, oFono
 does the 
 right thing here.

STE is standard compliant, only the WAITING call is terminated with AT+CHLD=0. 
(TC 8)
 
 
 c) If you have an call on hold and initiate a new call, but want to
 terminate the newly initiated call (DIALING), then this call cannot
 be terminated with CHLD=1X, but you would have to use ATH (or
 possible CHUP). 
 
 Yes, so this is the case that we do need to take care of in the core.
 Most 
 modems let us get away with sending release_specific up to this point.
 

For the STE modem, calls in state DIALING and ALERTING will have to be 
terminated with ATH or AT+CHUP, AT+CHLD=1x does not work.
This means that the current implementation, using release_specific 
(and thus AT+CHLD=1x) will not work. 

 What I have been considering to take care of this case is to add
 end_all and end_all_active callbacks.  According to 27.007/22.030
 ATH should end all calls (active + held) except waiting calls, while
 +CHUP should only end the currently active call.  At least on one TI
 modem I tried this works as expected.  Do your modems implement the
 same behavior?
 
 No, I don't think so. I think ATH will only terminate one call.
 In order to terminate all calls you would probably need to do
 something like: AT+CHLD=0;H But I'm not sure this works in all
 possible scenarios either...
 
 Can you check the behavior of ATH vs CHUP on STE modems?  We need to
 send the 
 right one here or both HELD and ACTIVE/DIALING/ALERTING 

[PATCH] hfp: create modem for new devices paired on runtime

2010-02-02 Thread Gustavo F. Padovan
It listens the Paired property to create a modem to the recently paired
devices. It also renames added_watch to adapter_watch, a more proper
name.
---
 plugins/hfp.c |   47 ++-
 1 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/plugins/hfp.c b/plugins/hfp.c
index 0e2e359..6f2000a 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -594,6 +594,34 @@ static gboolean adapter_added(DBusConnection *connection, 
DBusMessage *message,
return TRUE;
 }
 
+static gboolean new_device_added(DBusConnection *connection, DBusMessage 
*message,
+   void *user_data)
+{
+   const char *device, *property;
+   DBusMessageIter iter;
+
+   dbus_message_iter_init(message, iter);
+
+   if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+   return FALSE;
+
+   dbus_message_iter_get_basic(iter, property);
+   if (g_str_equal(property, UUIDs) == FALSE)
+   return TRUE;
+
+   if (!dbus_message_iter_next(iter))
+   return FALSE;
+
+   if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT)
+   return FALSE;
+
+   device = dbus_message_get_path(message);
+
+   parse_uuids(iter, device);
+
+   return TRUE;
+}
+
 static void list_adapters_cb(DBusPendingCall *call, gpointer user_data)
 {
DBusError err;
@@ -801,7 +829,8 @@ static struct ofono_modem_driver hfp_driver = {
.post_sim   = hfp_post_sim,
 };
 
-static guint added_watch;
+static guint adapter_watch;
+static guint device_watch;
 
 static int hfp_init(void)
 {
@@ -812,12 +841,18 @@ static int hfp_init(void)
 
connection = ofono_dbus_get_connection();
 
-   added_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
+   adapter_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
BLUEZ_MANAGER_INTERFACE,
AdapterAdded,
adapter_added, NULL, NULL);
 
-   if (added_watch == 0) {
+   device_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
+   BLUEZ_DEVICE_INTERFACE,
+   PropertyChanged,
+   new_device_added, NULL, NULL);
+
+
+   if (adapter_watch == 0 || device_watch == 0) {
err = -EIO;
goto remove;
}
@@ -831,7 +866,8 @@ static int hfp_init(void)
return 0;
 
 remove:
-   g_dbus_remove_watch(connection, added_watch);
+   g_dbus_remove_watch(connection, adapter_watch);
+   g_dbus_remove_watch(connection, device_watch);
 
dbus_connection_unref(connection);
 
@@ -840,7 +876,8 @@ remove:
 
 static void hfp_exit(void)
 {
-   g_dbus_remove_watch(connection, added_watch);
+   g_dbus_remove_watch(connection, adapter_watch);
+   g_dbus_remove_watch(connection, device_watch);
 
ofono_modem_driver_unregister(hfp_driver);
 }
-- 
1.6.4.4

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


[PATCH 2/2] Remove dead assignments at gatchat

2010-02-02 Thread Gustavo F. Padovan
---
 gatchat/gatchat.c |8 +---
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 5b0851b..d5362db 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -312,7 +312,6 @@ static gboolean g_at_chat_match_notify(GAtChat *chat, char 
*line)
 {
GHashTableIter iter;
struct at_notify *notify;
-   char *prefix;
gpointer key, value;
gboolean ret = FALSE;
GAtResult result;
@@ -322,7 +321,6 @@ static gboolean g_at_chat_match_notify(GAtChat *chat, char 
*line)
result.final_or_pdu = 0;
 
while (g_hash_table_iter_next(iter, key, value)) {
-   prefix = key;
notify = value;
 
if (!g_str_has_prefix(line, key))
@@ -753,7 +751,7 @@ static void wakeup_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
 static gboolean wakeup_no_response(gpointer user)
 {
GAtChat *chat = user;
-   struct at_command *cmd = g_queue_peek_head(chat-command_queue);
+   struct at_command *cmd;
 
if (chat-debugf)
chat-debugf(Wakeup got no response\n, chat-debug_data);
@@ -1259,7 +1257,6 @@ gboolean g_at_chat_unregister(GAtChat *chat, guint id)
 {
GHashTableIter iter;
struct at_notify *notify;
-   char *prefix;
gpointer key, value;
GSList *l;
 
@@ -1269,7 +1266,6 @@ gboolean g_at_chat_unregister(GAtChat *chat, guint id)
g_hash_table_iter_init(iter, chat-notify_list);
 
while (g_hash_table_iter_next(iter, key, value)) {
-   prefix = key;
notify = value;
 
l = g_slist_find_custom(notify-nodes, GUINT_TO_POINTER(id),
@@ -1294,7 +1290,6 @@ gboolean g_at_chat_unregister_all(GAtChat *chat)
 {
GHashTableIter iter;
struct at_notify *notify;
-   char *prefix;
gpointer key, value;
GSList *l;
 
@@ -1304,7 +1299,6 @@ gboolean g_at_chat_unregister_all(GAtChat *chat)
g_hash_table_iter_init(iter, chat-notify_list);
 
while (g_hash_table_iter_next(iter, key, value)) {
-   prefix = key;
notify = value;
 
for (l = notify-nodes; l; l = l-next)
-- 
1.6.4.4

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


[PATCH 2/3] Add PN_GSS code points and debugging

2010-02-02 Thread Aki Niemi
---
 Makefile.am  |3 +-
 drivers/isimodem/debug.c |   25 +++
 drivers/isimodem/debug.h |5 
 drivers/isimodem/gss.h   |   58 ++
 4 files changed, 90 insertions(+), 1 deletions(-)
 create mode 100644 drivers/isimodem/gss.h

diff --git a/Makefile.am b/Makefile.am
index a18e4b9..5f67878 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -102,7 +102,8 @@ builtin_sources += $(gisi_sources) \
drivers/isimodem/call-settings.c \
drivers/isimodem/call-barring.c \
drivers/isimodem/call-meter.c \
-   drivers/isimodem/ss.h
+   drivers/isimodem/ss.h \
+   drivers/isimodem/gss.h
 endif
 
 if ATMODEM
diff --git a/drivers/isimodem/debug.c b/drivers/isimodem/debug.c
index 2f8f1f4..401de9d 100644
--- a/drivers/isimodem/debug.c
+++ b/drivers/isimodem/debug.c
@@ -746,6 +746,25 @@ const char *net_subblock_name(enum net_subblock value)
return NET_UNKNOWN;
 }
 
+const char *gss_message_id_name(enum gss_message_id value)
+{
+   switch (value) {
+   _(GSS_CS_SERVICE_REQ);
+   _(GSS_CS_SERVICE_RESP);
+   _(GSS_CS_SERVICE_FAIL_RESP);
+   _(GSS_SELECTED_RAT_IND);
+   }
+   return GSS_UNKNOWN;
+}
+
+const char *gss_subblock_name(enum gss_subblock value)
+{
+   switch (value) {
+   _(GSS_RAT_INFO);
+   }
+   return GSS_UNKNOWN;
+}
+
 #undef _
 
 static void hex_dump(const char *name, const uint8_t m[], size_t len)
@@ -816,3 +835,9 @@ void net_debug(const void *restrict buf, size_t len, void 
*data)
const uint8_t *m = buf;
hex_dump(net_message_id_name(m[0]), m, len);
 }
+
+void gss_debug(const void *restrict buf, size_t len, void *data)
+{
+   const uint8_t *m = buf;
+   hex_dump(gss_message_id_name(m[0]), m, len);
+}
diff --git a/drivers/isimodem/debug.h b/drivers/isimodem/debug.h
index b9ee39a..fa316ba 100644
--- a/drivers/isimodem/debug.h
+++ b/drivers/isimodem/debug.h
@@ -29,6 +29,7 @@
 #include info.h
 #include call.h
 #include network.h
+#include gss.h
 
 const char *ss_message_id_name(enum ss_message_id value);
 const char *ss_subblock_name(enum ss_subblock value);
@@ -61,6 +62,9 @@ const char *net_status_name(enum net_reg_status value);
 const char *net_message_id_name(enum net_message_id value);
 const char *net_subblock_name(enum net_subblock value);
 
+const char *gss_message_id_name(enum gss_message_id value);
+const char *gss_subblock_name(enum gss_subblock value);
+
 void ss_debug(const void *restrict buf, size_t len, void *data);
 void mtc_debug(const void *restrict buf, size_t len, void *data);
 void sms_debug(const void *restrict buf, size_t len, void *data);
@@ -68,6 +72,7 @@ void sim_debug(const void *restrict buf, size_t len, void 
*data);
 void info_debug(const void *restrict buf, size_t len, void *data);
 void call_debug(const void *restrict buf, size_t len, void *data);
 void net_debug(const void *restrict buf, size_t len, void *data);
+void gss_debug(const void *restrict buf, size_t len, void *data);
 
 const char *pn_resource_name(int value);
 
diff --git a/drivers/isimodem/gss.h b/drivers/isimodem/gss.h
new file mode 100644
index 000..a61c0b0
--- /dev/null
+++ b/drivers/isimodem/gss.h
@@ -0,0 +1,58 @@
+/*
+ * This file is part of oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __ISIMODEM_GSS_H
+#define __ISIMODEM_GSS_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#define PN_GSS 0x32
+#define GSS_TIMEOUT5
+
+enum gss_message_id {
+   GSS_CS_SERVICE_REQ = 0x00,
+   GSS_CS_SERVICE_RESP = 0x01,
+   GSS_CS_SERVICE_FAIL_RESP = 0x02,
+   GSS_SELECTED_RAT_IND = 0x14
+};
+
+enum gss_subblock {
+   GSS_RAT_INFO = 0x0B
+};
+
+enum gss_selection_mode {
+   GSS_DUAL_RAT = 0x00,
+   GSS_GSM_RAT = 0x01,
+   GSS_UMTS_RAT = 0x02
+};
+
+enum gss_operation {
+   GSS_SELECTED_RAT_WRITE = 0x0E,
+   GSS_SELECTED_RAT_READ = 0x9C
+};
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* !__ISIMODEM_GSS_H */
-- 
1.6.3.3

___
ofono 

[PATCH 3/3] Add isimodem radio access driver

2010-02-02 Thread Aki Niemi
---
 Makefile.am |1 +
 drivers/isimodem/isimodem.c |4 +
 drivers/isimodem/isimodem.h |3 +
 drivers/isimodem/radio-access.c |  299 +++
 4 files changed, 307 insertions(+), 0 deletions(-)
 create mode 100644 drivers/isimodem/radio-access.c

diff --git a/Makefile.am b/Makefile.am
index 5f67878..235aa86 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -103,6 +103,7 @@ builtin_sources += $(gisi_sources) \
drivers/isimodem/call-barring.c \
drivers/isimodem/call-meter.c \
drivers/isimodem/ss.h \
+   drivers/isimodem/radio-access.c \
drivers/isimodem/gss.h
 endif
 
diff --git a/drivers/isimodem/isimodem.c b/drivers/isimodem/isimodem.c
index 48f41c3..4b65d21 100644
--- a/drivers/isimodem/isimodem.c
+++ b/drivers/isimodem/isimodem.c
@@ -49,6 +49,7 @@
 #include ofono/call-settings.h
 #include ofono/call-barring.h
 #include ofono/call-meter.h
+#include ofono/radio-access.h
 
 #include isimodem.h
 #include isiutil.h
@@ -310,6 +311,7 @@ static void isi_modem_post_sim(struct ofono_modem *modem)
ofono_call_settings_create(isi-modem, 0, isimodem, isi-idx);
ofono_call_barring_create(isi-modem, 0, isimodem, isi-idx);
ofono_call_meter_create(isi-modem, 0, isimodem, isi-idx);
+   ofono_radio_access_create(isi-modem, 0, isimodem, isi-idx);
 }
 
 static struct ofono_modem_driver driver = {
@@ -339,6 +341,7 @@ static int isimodem_init(void)
isi_call_settings_init();
isi_call_barring_init();
isi_call_meter_init();
+   isi_radio_access_init();
 
ofono_modem_driver_register(driver);
 
@@ -379,6 +382,7 @@ static void isimodem_exit(void)
isi_call_settings_exit();
isi_call_barring_exit();
isi_call_meter_exit();
+   isi_radio_access_exit();
 }
 
 OFONO_PLUGIN_DEFINE(isimodem, PhoNet / ISI modem driver, VERSION,
diff --git a/drivers/isimodem/isimodem.h b/drivers/isimodem/isimodem.h
index 3eb2fbe..2b3d756 100644
--- a/drivers/isimodem/isimodem.h
+++ b/drivers/isimodem/isimodem.h
@@ -57,3 +57,6 @@ extern void isi_call_barring_exit();
 
 extern void isi_call_meter_init();
 extern void isi_call_meter_exit();
+
+extern void isi_radio_access_init();
+extern void isi_radio_access_exit();
diff --git a/drivers/isimodem/radio-access.c b/drivers/isimodem/radio-access.c
new file mode 100644
index 000..8c9e0b5
--- /dev/null
+++ b/drivers/isimodem/radio-access.c
@@ -0,0 +1,299 @@
+/*
+ * This file is part of oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#define _GNU_SOURCE
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include errno.h
+
+#include glib.h
+
+#include gisi/client.h
+#include gisi/iter.h
+
+#include ofono/log.h
+#include ofono/modem.h
+#include ofono/radio-access.h
+
+#include isimodem.h
+#include isiutil.h
+#include debug.h
+#include gss.h
+
+struct access_data {
+   GIsiClient *client;
+};
+
+static bool rat_mode_read_resp_cb(GIsiClient *client, const void *restrict 
data,
+   size_t len, uint16_t object, void 
*opaque)
+{
+   const unsigned char *msg = data;
+   struct isi_cb_data *cbd = opaque;
+   ofono_radio_access_mode_query_cb_t cb = cbd-cb;
+   int mode = -1;
+
+   if (!msg) {
+   DBG(ISI client error: %d, g_isi_client_error(client));
+   goto error;
+   }
+
+   if (len  3) {
+   DBG(truncated message);
+   return false;
+   }
+
+   if (msg[0] == GSS_CS_SERVICE_FAIL_RESP)
+   goto error;
+
+   if (msg[0] == GSS_CS_SERVICE_RESP) {
+   GIsiSubBlockIter iter;
+
+   for (g_isi_sb_iter_init(iter, msg, len, 3);
+   g_isi_sb_iter_is_valid(iter);
+   g_isi_sb_iter_next(iter)) {
+
+   switch (g_isi_sb_iter_get_id(iter)) {
+
+   case GSS_RAT_INFO: {
+
+   guint8 byte;
+
+   if (!g_isi_sb_iter_get_byte(iter, byte, 2))
+ 

[PATCH 1/3] Add radio access atom and driver API

2010-02-02 Thread Aki Niemi
This atom provides access to the modem's radio access properties. It
currently includes a single rw property, namely the radio access
selection mode setting.

This allows the user to query and select the used radio access
technology preference. In dual mode, either 2G or 3G is used depending
on reception. 2G only mode or 3G only mode force selection of the
respective access only.

In the future, this atom could be extended, if necessary, to handle
other radio access related modem features such as CELL_DCH status,
UTRAN channel, or frequency band.
---
 Makefile.am|6 +-
 include/radio-access.h |   72 ++
 src/ofono.h|2 +
 src/radio-access.c |  354 
 4 files changed, 432 insertions(+), 2 deletions(-)
 create mode 100644 include/radio-access.h
 create mode 100644 src/radio-access.c

diff --git a/Makefile.am b/Makefile.am
index 9df..a18e4b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,8 @@ include_HEADERS = include/log.h include/plugin.h 
include/history.h \
include/sms.h include/sim.h include/message-waiting.h \
include/netreg.h include/voicecall.h include/devinfo.h \
include/cbs.h include/call-volume.h \
-   include/gprs.h include/gprs-context.h
+   include/gprs.h include/gprs-context.h \
+   include/radio-access.h
 
 nodist_include_HEADERS = include/version.h
 
@@ -224,7 +225,8 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) \
src/phonebook.c src/history.c src/message-waiting.c \
src/simutil.h src/simutil.c src/storage.h \
src/storage.c src/cbs.c src/watch.c src/call-volume.c \
-   src/gprs.c src/idmap.h src/idmap.c
+   src/gprs.c src/idmap.h src/idmap.c \
+   src/radio-access.c
 
 src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ -ldl
 
diff --git a/include/radio-access.h b/include/radio-access.h
new file mode 100644
index 000..6677573
--- /dev/null
+++ b/include/radio-access.h
@@ -0,0 +1,72 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef __OFONO_RADIO_ACCESS_H
+#define __OFONO_RADIO_ACCESS_H
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include ofono/types.h
+
+struct ofono_radio_access;
+
+typedef void (*ofono_radio_access_mode_set_cb_t)(const struct ofono_error 
*error,
+   void *data);
+typedef void (*ofono_radio_access_mode_query_cb_t)(const struct ofono_error 
*error,
+   int mode, void *data);
+
+struct ofono_radio_access_driver {
+   const char *name;
+   int (*probe)(struct ofono_radio_access *radio_access,
+   unsigned int vendor,
+   void *data);
+   void (*remove)(struct ofono_radio_access *radio_access);
+   void (*query_mode)(struct ofono_radio_access *radio_access,
+   ofono_radio_access_mode_query_cb_t cb, void 
*data);
+   void (*set_mode)(struct ofono_radio_access *radio_access, int mode,
+   ofono_radio_access_mode_set_cb_t cb, void 
*data);
+};
+
+void ofono_radio_access_mode_notify(struct ofono_radio_access *radio_access,
+   int mode);
+
+int ofono_radio_access_driver_register(const struct ofono_radio_access_driver 
*d);
+void ofono_radio_access_driver_unregister(const struct 
ofono_radio_access_driver *d);
+
+struct ofono_radio_access *ofono_radio_access_create(struct ofono_modem *modem,
+   unsigned int vendor,
+   const char *driver,
+   void *data);
+
+void ofono_radio_access_register(struct ofono_radio_access *radio_access);
+void ofono_radio_access_remove(struct ofono_radio_access *radio_access);
+
+void ofono_radio_access_set_data(struct ofono_radio_access *radio_access,
+   void *data);
+void 

Re: [RFC 3/3] STE-plugin: Adding STE plugin

2010-02-02 Thread Denis Kenzior
Hi Sjur,

 Hi Denis.
 
 We have done some testing with the STE modem for call termination, and this
  is the result:
 
 TC |Call #1 | Call #2 | Call #3  | Command   | Result
 ---|
 1  |ACTIVE  | ACTIVE  | ..   | ATH | call 1, 2 terminated
 2  |ACTIVE  | ACTIVE  | ..   | AT+CHUP | call 1, 2 terminated
 3  |ACTIVE  | ACTIVE  | HELD | ATH | call 1, 2 terminated
 4  |ACTIVE  | ACTIVE  | HELD | AT+CHUP | call 1, 2 terminated
 5  |ACTIVE  | ACTIVE  | HELD | AT+CHLD=0;H | call 1, 2 and 3 terminated
 6  |ACTIVE  | ACTIVE  | WAITING  | ATH | call 1, 2 terminated
 7  |ACTIVE  | ACTIVE  | WAITING  | AT+CHUP | call 1, 2 terminated
 8  |ACTIVE  | HELD| WAITING  | CHLD=0  | call 3 terminated,
 9  |ACTIVE  | HELD| WAITING  | ATH | call 1 terminated
 10 |ACTIVE  | HELD| WAITING  | AT+CHUP | call 1 terminated
 11 |HELD| HELD| ACTIVE   | AT+CHLD=0   | call 1, 2 terminated
 12 |HELD| HELD| ACTIVE   | AT+CHLD=0;H | call 1, 2 and 3 terminated
 13 |HELD| DIALING | ..   | ATH | call 2 (MO) terminated
 14 |HELD| DIALING | ..   | CHUP| call 2 (MO) terminated
 15 |HELD| DIALING | ..   | AT+CHLD=12  | call 2 (MO) NOT terminated
 16 |HELD| WAITING | ..   | AT+CHLD=0   | call 2 terminated
 17 |HELD| ..  | ..   | ATH | call 1 NOT terminated

Great table, makes it very easy to see what is going on.  It looks like STE 
modems treat ATH and CHUP as only affecting dialing/alerting/active calls and 
incoming calls, not held calls or waiting calls.

  The standards are quite clear here, the WAITING call always takes
  precedence and thus only the WAITING call is affected. Can you check
  that STE modems do indeed get this wrong?  If the modem is standards
  compliant, oFono does the right thing here.
 
 STE is standard compliant, only the WAITING call is terminated with
  AT+CHLD=0. (TC 8)

Excellent, I would have been surprised if STE behaved otherwise :)

 
  c) If you have an call on hold and initiate a new call, but want to
  terminate the newly initiated call (DIALING), then this call cannot
  be terminated with CHLD=1X, but you would have to use ATH (or
  possible CHUP).
 
  Yes, so this is the case that we do need to take care of in the core.
  Most
  modems let us get away with sending release_specific up to this point.
 
 For the STE modem, calls in state DIALING and ALERTING will have to be
  terminated with ATH or AT+CHUP, AT+CHLD=1x does not work. This means that
  the current implementation, using release_specific (and thus AT+CHLD=1x)
  will not work.

Yep, so please critique my earlier suggestion of splitting up hangup into two 
methods: hangup_all and hangup_active.  Modem drivers will need to provide one 
or the other or both.

The core can then use the hangup_active (if available) in those cases where 
release_specific might not work.  The condition for hangup_active will be that 
it does not affect held or waiting calls.  For ST-E the hangup_active 
implementation will simply be +CHUP.  For modems that do not have this 
available we will fall back to release_specific and assume that on those 
CHLD=1X or equivalent can affect dialing/alerting calls.

hangup_all can also be used for cases where we loop release_specific over all 
active/dialing/alerting/held/incoming calls.  For ST-E the hangup_all 
implementation might be +CHUP;CHLD=1n;...;+CHLD=1m where n, m, etc are ids of 
the HELD calls.  We should not hangup waiting calls to be compliant with 
section 6.5.5.1 of 3GPP 22.030: Entering END   -   Releases the subscriber 
from 
all calls (except a possible waiting call).

If this sounds OK then I will work on implementing the logic in the next few 
days.

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


Re: [PATCH 1/3] Add radio access atom and driver API

2010-02-02 Thread Denis Kenzior
Hi Aki,

 This atom provides access to the modem's radio access properties. It
 currently includes a single rw property, namely the radio access
 selection mode setting.

It might be helpful to include the API documentation too.  One thing I don't 
like is the name RadioAccess.  The connotation is a bit too low-level.  
Perhaps BandSelection? RadioBandSelection?

 
 This allows the user to query and select the used radio access
 technology preference. In dual mode, either 2G or 3G is used depending
 on reception. 2G only mode or 3G only mode force selection of the
 respective access only.
 
 In the future, this atom could be extended, if necessary, to handle
 other radio access related modem features such as CELL_DCH status,
 UTRAN channel, or frequency band.
 ---
  Makefile.am|6 +-
  include/radio-access.h |   72 ++
  src/ofono.h|2 +
  src/radio-access.c |  354
   4 files changed, 432
  insertions(+), 2 deletions(-)
  create mode 100644 include/radio-access.h
  create mode 100644 src/radio-access.c
 
 diff --git a/Makefile.am b/Makefile.am
 index 9df..a18e4b9 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -11,7 +11,8 @@ include_HEADERS = include/log.h include/plugin.h
  include/history.h \ include/sms.h include/sim.h include/message-waiting.h
  \
   include/netreg.h include/voicecall.h include/devinfo.h \
   include/cbs.h include/call-volume.h \
 - include/gprs.h include/gprs-context.h
 + include/gprs.h include/gprs-context.h \
 + include/radio-access.h
 
  nodist_include_HEADERS = include/version.h
 
 @@ -224,7 +225,8 @@ src_ofonod_SOURCES = $(gdbus_sources)
  $(builtin_sources) \ src/phonebook.c src/history.c src/message-waiting.c \
   src/simutil.h src/simutil.c src/storage.h \
   src/storage.c src/cbs.c src/watch.c src/call-volume.c \
 - src/gprs.c src/idmap.h src/idmap.c
 + src/gprs.c src/idmap.h src/idmap.c \
 + src/radio-access.c
 
  src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ -ldl
 
 diff --git a/include/radio-access.h b/include/radio-access.h
 new file mode 100644
 index 000..6677573
 --- /dev/null
 +++ b/include/radio-access.h
 @@ -0,0 +1,72 @@
 +/*
 + *
 + *  oFono - Open Source Telephony
 + *
 + *  Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 + *
 + *  This program is free software; you can redistribute it and/or modify
 + *  it under the terms of the GNU General Public License version 2 as
 + *  published by the Free Software Foundation.
 + *
 + *  This program is distributed in the hope that it will be useful,
 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + *  GNU General Public License for more details.
 + *
 + *  You should have received a copy of the GNU General Public License
 + *  along with this program; if not, write to the Free Software
 + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
  USA + *
 + */
 +
 +#ifndef __OFONO_RADIO_ACCESS_H
 +#define __OFONO_RADIO_ACCESS_H
 +
 +#ifdef __cplusplus
 +extern C {
 +#endif
 +
 +#include ofono/types.h
 +
 +struct ofono_radio_access;
 +
 +typedef void (*ofono_radio_access_mode_set_cb_t)(const struct ofono_error
  *error, +void *data);
 +typedef void (*ofono_radio_access_mode_query_cb_t)(const struct
  ofono_error *error, +
 int mode, void *data);

I really prefer mode to be an enum here.  There's no standard to reference 
here...

 +
 +struct ofono_radio_access_driver {
 + const char *name;
 + int (*probe)(struct ofono_radio_access *radio_access,
 + unsigned int vendor,
 + void *data);
 + void (*remove)(struct ofono_radio_access *radio_access);
 + void (*query_mode)(struct ofono_radio_access *radio_access,
 + ofono_radio_access_mode_query_cb_t cb, void 
 *data);
 + void (*set_mode)(struct ofono_radio_access *radio_access, int mode,
 + ofono_radio_access_mode_set_cb_t cb, void 
 *data);

Same here, mode should be an enum.

 +};
 +
 +void ofono_radio_access_mode_notify(struct ofono_radio_access
  *radio_access, + int mode);

Why do we have this function, can the radio mode be changed outside oFono's 
control?

 +
 +int ofono_radio_access_driver_register(const struct
  ofono_radio_access_driver *d); +void
  ofono_radio_access_driver_unregister(const struct
  ofono_radio_access_driver *d); +
 +struct ofono_radio_access *ofono_radio_access_create(struct ofono_modem
  *modem, +unsigned int vendor,
 + 

RE: [PATCH 1/3] Add radio access atom and driver API

2010-02-02 Thread Bastian, Waldo
  This atom provides access to the modem's radio access properties. It
  currently includes a single rw property, namely the radio access
  selection mode setting.
 
 It might be helpful to include the API documentation too.  One thing I
 don't like is the name RadioAccess.  The connotation is a bit too
 low-level. Perhaps BandSelection? RadioBandSelection?

Radio access is a pretty broad high level concept. It's one of those black 
boxes you draw somewhere near the bottom of a phone architecture diagram, so in 
that sense it is low-level but that comes with the territory. BandSelection in 
my mind implies frequency band selection, which is a narrow aspect of radio 
access. The 2G/3G selection covered with this patch is about radio access 
_technology_, which is distinct from the actual frequency bands used by those 
technologies. I think RadioAccess is a fairly good name for an interface that 
has the potential to cover various radio related settings.

Use case for 2G/3G selection:
http://androidcommunity.com/forums/archive/index.php/t-11857.html

Use case for band selection:
http://support.t-mobile.com/doc/tm53294.xml?docid=5222referring%20topicid=67A2L.SERVICE=Referring%20TopicID/DocID%20List%20Index=ynavtypeid=2pagetypeid=26prevPageIndex=3

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


Re: [PATCH 1/3] Add radio access atom and driver API

2010-02-02 Thread Denis Kenzior
Hi Waldo,

   This atom provides access to the modem's radio access properties. It
   currently includes a single rw property, namely the radio access
   selection mode setting.
 
  It might be helpful to include the API documentation too.  One thing I
  don't like is the name RadioAccess.  The connotation is a bit too
  low-level. Perhaps BandSelection? RadioBandSelection?
 
 Radio access is a pretty broad high level concept. It's one of those black
  boxes you draw somewhere near the bottom of a phone architecture diagram,
  so in that sense it is low-level but that comes with the territory.
  BandSelection in my mind implies frequency band selection, which is a
  narrow aspect of radio access. The 2G/3G selection covered with this patch
  is about radio access _technology_, which is distinct from the actual
  frequency bands used by those technologies. I think RadioAccess is a
  fairly good name for an interface that has the potential to cover various
  radio related settings.

People on this list keep forgetting two things:
1. We're not designing a kitchen sink API here.  Most of the 'radio related 
settings' will simply never be exposed, nobody really cares what UMTS channel 
he/she is currently on.
2. We're designing the API to be easy to use for everyone, not just GSM geeks.

In your AM/FM Tuner the 'Band' button switches between AM and FM.  You 
immediately know what the button does.  The interface name in oFono should 
ideally give the user an immediate idea of what it is for.  In my view 
RadioAccess does not fit this ideal.  Perhaps BandSelection is the wrong 
name too, lets come up with a better one.

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


RE: [PATCH 1/3] Add radio access atom and driver API

2010-02-02 Thread Bastian, Waldo
 People on this list keep forgetting two things:
 1. We're not designing a kitchen sink API here.  Most of the 'radio
 related
 settings' will simply never be exposed, nobody really cares what UMTS
 channel
 he/she is currently on.
 2. We're designing the API to be easy to use for everyone, not just GSM
 geeks.
 
 In your AM/FM Tuner the 'Band' button switches between AM and FM.  You
 immediately know what the button does.  The interface name in oFono should
 ideally give the user an immediate idea of what it is for.  In my view
 RadioAccess does not fit this ideal.  Perhaps BandSelection is the
 wrong name too, lets come up with a better one.

StuffThatCustomerServiceTellsYouToUseWhenThingsDontQuiteWork

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