Can I modify CallingLineRestriction(the Property of CallSetting) value to disabled or enabled
Hi, Can I modify CallingLineRestriction(the Property of CallSetting) value to disalbed or enabled. I refer to the newest doc for CallSettings and found the CallingLineRestriction is a read-only property, is it means ofono does not support enable or disable CLIP. Thanks a lot:) Haitao ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/4] doc: Add ModemAccessTechnology property
--- doc/modem-api.txt |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/doc/modem-api.txt b/doc/modem-api.txt index c48375e..f5a3026 100644 --- a/doc/modem-api.txt +++ b/doc/modem-api.txt @@ -43,6 +43,15 @@ Properties boolean Powered [readwrite] modem. The Emergency is true if an emergency call or related operation is currently active. + string ModemAccessTechnology [readonly] + + Contains current access techonology of the modem. + Possible values are: + gsm - the current modem access technology is GSM + cdma - the current modem access technology is CDMA + + By default oFono uses gsm setting. + string Name [readonly, optional] Friendly name of the modem device. -- 1.7.0.4 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Add ModemAccessTechnology property handling
Hi, This patch will add modem access technology property and its handling. BR, Rajesh ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 1/4] doc: Add ModemAccessTechnology property
Hi Rajesh, doc/modem-api.txt |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/doc/modem-api.txt b/doc/modem-api.txt index c48375e..f5a3026 100644 --- a/doc/modem-api.txt +++ b/doc/modem-api.txt @@ -43,6 +43,15 @@ Properties boolean Powered [readwrite] modem. The Emergency is true if an emergency call or related operation is currently active. + string ModemAccessTechnology [readonly] + + Contains current access techonology of the modem. + Possible values are: + gsm - the current modem access technology is GSM + cdma - the current modem access technology is CDMA + + By default oFono uses gsm setting. + so you are in the org.ofono.Modem interface and its properties and you wanna prefix the property with Modem. That is rather pointless duplication of information. So just strip that. The obvious question we have to discuss, if we really wanna do it this way. What are the pros and what are the cons? Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: Can I modify CallingLineRestriction(the Property of CallSetting) value to disabled or enabled
Hi Haitao, From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf Of Ding, HaitaoX Sent: Thursday, October 28, 2010 3:29 PM To: ofono@ofono.org Subject: Can I modify CallingLineRestriction(the Property of CallSetting) value to disabled or enabled Hi, Can I modify CallingLineRestriction(the Property of CallSetting) value to disalbed or enabled. I refer to the newest doc for CallSettings and found the CallingLineRestriction is a read-only property, is it means ofono does not support enable or disable CLIP. Thanks a lot☺ You may set the property HideCallerId to default, disabled or enabled. Regards, -Yang ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH 3/6] radio settings: add FastDormancy property
Hi Denis, Patch has been applied, thanks. I did make a couple of minor tweaks afterwards. Thanks. A question regarding this particular tweak: diff --git a/src/radio-settings.c b/src/radio-settings.c index cb0a598..eb2a42d 100644 --- a/src/radio-settings.c +++ b/src/radio-settings.c @@ -126,8 +126,7 @@ static void radio_set_fast_dormancy(struct ofono_radio_settings *rs, const char *path = __ofono_atom_get_path(rs-atom); dbus_bool_t value = enable; - if ((rs-flags RADIO_SETTINGS_FLAG_CACHED) - rs-fast_dormancy == enable) + if (rs-fast_dormancy == enable) return; ofono_dbus_signal_property_changed(conn, path, The fundamental problem here is that there is only a single CACHED flag for multiple properties, which may be modified individually. So, either you get extra signals or you get too few. I checked the CACHED flag here because otherwise the following might happen: 1. client tries to GetProperties() and gets the Operation already in progress error. 2. client waits for PropertyChanged signal to get the FastDormancy value 3. signal never comes because the default value happens to match the one returned by the driver and the signal is suppressed I do agree that sending extra signals is bad but I think that not sending a signal is even worse. If the client cannot rely on getting a PropertyChanged signal after a busy error, all it can do is resort to polling. I.e., every client has to implement a polling pattern for GetProperties: while (GetProperties() == BUSY) sleep(FOR_A_WHILE); Having a separate CACHED flag for each value would solve this optimally. Failing that, I don't think a few extra signals is so bad. Forcing clients to poll is just ugly. Am I missing something? MikaL ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/4] stemodem: Add rtnl header file.
From: Sjur Brændeland sjur.brandel...@stericsson.com Add new asynchronous rtnl interface for creating and deleting CAIF Network interfaces. Creation takes struct rtnl_req_param as input containing ip type (v4/v6), channel id etc. The result is returned in struct rtnl_rsp_param containing the interface name and interface index. --- drivers/stemodem/rtnl.h | 41 + 1 files changed, 41 insertions(+), 0 deletions(-) create mode 100644 drivers/stemodem/rtnl.h diff --git a/drivers/stemodem/rtnl.h b/drivers/stemodem/rtnl.h new file mode 100644 index 000..566452b --- /dev/null +++ b/drivers/stemodem/rtnl.h @@ -0,0 +1,41 @@ +/* + * + * 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 + * + */ +struct rtnl_rsp_param { + int result; + gpointer user_data; + char ifname[IF_NAMESIZE]; + int ifindex; +}; + +struct rtnl_req_param { + void (*callback)(struct rtnl_rsp_param *param); + gpointer user_data; + int type; + int conn_id; + gboolean loop_enabled; +}; + +extern int rtnl_create_caif_interface(struct rtnl_req_param *req); +extern int rtnl_delete_caif_interface(int ifid); + +extern int rtnl_init(void); +extern void rtnl_exit(void); + -- 1.6.3.3 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 2/4] stemodem: Add RTNL functionality for CAIF Netw Interface.
From: Sjur Brændeland sjur.brandel...@stericsson.com Add file rtnl.c for creating and deleting CAIF network interfaces using the RTNL protocol. The interface is asynchronous. Only RTNL NEWLINK and DELLINK commands are implemented. CAIF requires NEWLINK to contain channel-id and ip-type (ipv4/ipv6) as arguments. --- drivers/stemodem/rtnl.c | 365 +++ 1 files changed, 365 insertions(+), 0 deletions(-) create mode 100644 drivers/stemodem/rtnl.c diff --git a/drivers/stemodem/rtnl.c b/drivers/stemodem/rtnl.c new file mode 100644 index 000..38f7f43 --- /dev/null +++ b/drivers/stemodem/rtnl.c @@ -0,0 +1,365 @@ +/* + * + * 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 string.h +#include unistd.h +#include errno.h +#include net/if.h +#include net/if_arp.h +#include linux/rtnetlink.h + +#include glib.h + +#include ofono/log.h + +#include if_caif.h +#include rtnl.h + +#define NLMSG_TAIL(nmsg) \ + ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)-nlmsg_len))) + +struct iplink_req { + struct nlmsghdr n; + struct ifinfomsg i; + char pad[1024]; + int request_id; + struct rtnl_req_param req; + struct rtnl_rsp_param rsp; +}; + +static GSList *pending_requests; +static GIOChannel *channel; +static guint32 rtnl_seqnr; +static guint rtnl_watch; + +static gboolean get_ifname(struct ifinfomsg *msg, int bytes, + const char **ifname) +{ + struct rtattr *attr; + + for (attr = IFLA_RTA(msg); RTA_OK(attr, bytes); + attr = RTA_NEXT(attr, bytes)) + + if (attr-rta_type == IFLA_IFNAME + ifname != NULL) { + *ifname = RTA_DATA(attr); + return TRUE; + } + + return FALSE; +} + +static void store_newlink_param(struct iplink_req *req, unsigned short type, + int index, unsigned flags, + unsigned change, struct ifinfomsg *msg, + int bytes) +{ + const char *ifname = NULL; + + get_ifname(msg, bytes, ifname); + strncpy(req-rsp.ifname, ifname, + sizeof(req-rsp.ifname)); + req-rsp.ifname[sizeof(req-rsp.ifname)-1] = '\0'; + req-rsp.ifindex = index; +} + +static int send_rtnl_req(struct iplink_req *req) +{ + struct sockaddr_nl addr; + int sk, ret; + + sk = g_io_channel_unix_get_fd(channel); + + memset(addr, 0, sizeof(addr)); + addr.nl_family = AF_NETLINK; + + ret = sendto(sk, req, req-n.nlmsg_len, 0, + (struct sockaddr *) addr, sizeof(addr)); + if (ret 0) + return ret; + return 0; +} + +static struct iplink_req *find_request(guint32 seq) +{ + GSList *list; + + for (list = pending_requests; list; list = list-next) { + struct iplink_req *req = list-data; + + if (req-n.nlmsg_seq == seq) + return req; + } + + return NULL; +} + +static void rtnl_client_response(struct iplink_req *req) +{ + + if (req-req.callback req-n.nlmsg_type == RTM_NEWLINK) + req-req.callback(req-rsp); + + pending_requests = g_slist_remove(pending_requests, req); + g_free(req); +} + +static void parse_rtnl_message(void *buf, size_t len) +{ + struct ifinfomsg *msg; + struct iplink_req *req; + + while (len 0) { + struct nlmsghdr *hdr = buf; + if (!NLMSG_OK(hdr, len)) + break; + if (hdr-nlmsg_type == RTM_NEWLINK) { + req = g_slist_nth_data(pending_requests, 0); + DBG(NEWLINK req:%p\n, req); + if (req == NULL) + break; + msg = (struct ifinfomsg *) NLMSG_DATA(hdr); + store_newlink_param(req, msg-ifi_type, + msg-ifi_index, msg-ifi_flags, + msg-ifi_change, msg, +
[PATCH 3/4] stemodem: Update gprs-context to use rtnl
From: Sjur Brændeland sjur.brandel...@stericsson.com RTNL is now used to create and remove CAIF network interfaces. The created CAIF interface is assigned a channel-id which is used as parameter in the AT*EPPSD command used to activate the PDP-Context. The CAIF Network interfaces are created when gprs-context is probed initially. Some refactoring and bug-fixes are also included. --- drivers/stemodem/gprs-context.c | 210 +- 1 files changed, 138 insertions(+), 72 deletions(-) diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c index d3a50a9..7e956d3 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 @@ -46,10 +47,11 @@ #include stemodem.h #include caif_socket.h #include if_caif.h +#include rtnl.h -#define MAX_CAIF_DEVICES 7 +#define MAX_CAIF_DEVICES 4 #define MAX_DNS 2 -#define MAX_ELEM 20 +#define IP_ADDR_LEN 20 #define AUTH_BUF_LENGTH (OFONO_GPRS_MAX_USERNAME_LENGTH + \ OFONO_GPRS_MAX_PASSWORD_LENGTH + 128) @@ -65,21 +67,29 @@ 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 { char *current; - char ip_address[MAX_ELEM]; - char subnet_mask[MAX_ELEM]; - char mtu[MAX_ELEM]; - char default_gateway[MAX_ELEM]; - char dns_server1[MAX_ELEM]; - char dns_server2[MAX_ELEM]; - char p_cscf_server[MAX_ELEM]; + 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]; }; static void start_element_handler(GMarkupParseContext *context, @@ -122,8 +132,8 @@ static void text_handler(GMarkupParseContext *context, struct eppsd_response *rsp = user_data; if (rsp-current) { - strncpy(rsp-current, text, MAX_ELEM); - rsp-current[MAX_ELEM] = 0; + strncpy(rsp-current, text, IP_ADDR_LEN); + rsp-current[IP_ADDR_LEN] = 0; } } @@ -153,8 +163,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,26 +171,64 @@ 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; } +static void rtnl_callback(struct rtnl_rsp_param *param) +{ + struct conn_info *conn = param-user_data; + + strncpy(conn-interface, param-ifname, sizeof(conn-interface)); + conn-ifindex = param-ifindex; + + if (param-result == 0) + conn-created = TRUE; + else { + conn-created = FALSE; + DBG(Could not create CAIF Interface); + } +} + /* * 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; + struct rtnl_req_param req_param = { + .type = IFLA_CAIF_IPV4_CONNID, + .conn_id = conn-channel_id, + .user_data = conn, + .callback = rtnl_callback, + .loop_enabled = FALSE + }; + + if (rtnl_create_caif_interface(req_param) 0) { + DBG(Failed to create IP interface for CAIF); + return FALSE; + } + + return TRUE; } /* * 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; + if (!conn-created) + return; + + if (rtnl_delete_caif_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, +
[PATCH 4/4] stemodem: Add rtnl to Makefile.
From: Sjur Brændeland sjur.brandel...@stericsson.com --- Makefile.am |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2562160..1b09a3c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -226,6 +226,8 @@ builtin_sources += drivers/atmodem/atutil.h \ drivers/stemodem/stemodem.c \ drivers/stemodem/voicecall.c \ drivers/stemodem/radio-settings.c \ + drivers/stemodem/rtnl.c \ + drivers/stemodem/rtnl.h \ drivers/stemodem/gprs-context.c \ drivers/stemodem/caif_socket.h \ drivers/stemodem/if_caif.h -- 1.6.3.3 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH 3/6] radio settings: add FastDormancy property
Hi Mika, On 10/28/2010 08:32 AM, mika.liljeb...@nokia.com wrote: Hi Denis, Patch has been applied, thanks. I did make a couple of minor tweaks afterwards. Thanks. A question regarding this particular tweak: diff --git a/src/radio-settings.c b/src/radio-settings.c index cb0a598..eb2a42d 100644 --- a/src/radio-settings.c +++ b/src/radio-settings.c @@ -126,8 +126,7 @@ static void radio_set_fast_dormancy(struct ofono_radio_settings *rs, const char *path = __ofono_atom_get_path(rs-atom); dbus_bool_t value = enable; - if ((rs-flags RADIO_SETTINGS_FLAG_CACHED) - rs-fast_dormancy == enable) + if (rs-fast_dormancy == enable) return; ofono_dbus_signal_property_changed(conn, path, The fundamental problem here is that there is only a single CACHED flag for multiple properties, which may be modified individually. So, either you get extra signals or you get too few. I checked the CACHED flag here because otherwise the following might happen: Yes, I know. But this problem is present in every single atom. oFono does not guarantee that every attribute is signaled when the atom is initialized. 1. client tries to GetProperties() and gets the Operation already in progress error. 2. client waits for PropertyChanged signal to get the FastDormancy value 3. signal never comes because the default value happens to match the one returned by the driver and the signal is suppressed In general I think that for interfaces where this can happen, the likelihood is very low that it actually will in the real world. Do note that I have had the same argument with myself off and on for the past two years. So far this was never raised as an issue. If this ever becomes a problem, we can fix it properly using an appropriate idiom. I do agree that sending extra signals is bad but I think that not sending a signal is even worse. If the client cannot rely on getting a PropertyChanged signal after a busy error, all it can do is resort to polling. I.e., every client has to implement a polling pattern for GetProperties: while (GetProperties() == BUSY) sleep(FOR_A_WHILE); Having a separate CACHED flag for each value would solve this optimally. Failing that, I don't think a few extra signals is so bad. Forcing clients to poll is just ugly. Honestly, if you expect multiple applications to battle over the FastDormancy property, then it should be modeled differently. Perhaps with application registration and lifetime tracking over D-Bus, similar to how agents work. Am I missing something? MikaL Regards, -Denis ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH 1/4] doc: Add ModemAccessTechnology property
Hi Marcel, Hi Rajesh, doc/modem-api.txt |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/doc/modem-api.txt b/doc/modem-api.txt index c48375e..f5a3026 100644 --- a/doc/modem-api.txt +++ b/doc/modem-api.txt @@ -43,6 +43,15 @@ Properties boolean Powered [readwrite] modem. The Emergency is true if an emergency call or related operation is currently active. + string ModemAccessTechnology [readonly] + + Contains current access techonology of the modem. + Possible values are: + gsm - the current modem access technology is GSM + cdma - the current modem access technology is CDMA + + By default oFono uses gsm setting. + so you are in the org.ofono.Modem interface and its properties and you wanna prefix the property with Modem. That is rather pointless duplication of information. So just strip that. I prefix it with Modem just not to mix with the Network Access Technology. From the property name prespective I agree with you, its an redundant info as we are in org.ofono.Modem interface The obvious question we have to discuss, if we really wanna do it this way. What are the pros and what are the cons? I quite didnt get this query, pros and cons about this property usage or ? BR, Rajesh ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono