extended support for LTE and NR. Some minor fixes. part 1 of 7
PATCH 1/7 extended support for LTE and NR. Some minor fixes. part 1 of 7
--- include/gprs-context.h | 1 + include/lte.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
include/gprs-context.h +1 -0
@@ -57,6 +57,7 @@ enum ofono_gprs_context_type {enum ofono_gprs_auth_method {OFONO_GPRS_AUTH_METHOD_CHAP =0 ,OFONO_GPRS_AUTH_METHOD_PAP , +OFONO_GPRS_AUTH_METHOD_NONE , };struct ofono_gprs_primary_context {
include/lte.h +9 -2
@@ -3,6 +3,7 @@* oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. +* Copyright (C) 2018 Gemalto M2M * * 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
@@ -28,14 +29,18 @@ extern "C" {#include <ofono/types.h> -struct ofono_lte ; -struct ofono_lte_default_attach_info {char apn[OFONO_GPRS_MAX_APN_LENGTH +1 ]; +enum ofono_gprs_proto proto; +enum ofono_gprs_auth_method auth_method; +char username[OFONO_GPRS_MAX_USERNAME_LENGTH +1 ]; +char password[OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ]; };typedef void (*ofono_lte_cb_t )(const struct ofono_error *error,void *data); +struct ofono_lte ; +struct ofono_lte_driver {const char *name;int (*probe)(struct ofono_lte *lte,unsigned int vendor,void *data);
@@ -61,6 +66,8 @@ void ofono_lte_set_data(struct ofono_lte *lte, void *data);void *ofono_lte_get_data (const struct ofono_lte *lte); +struct ofono_modem *ofono_lte_get_modem (const struct ofono_lte *lte); + #ifdef __cplusplus }#endif
Signature · 1 line
1.9.1
PATCH 2/7 extended support for LTE and NR. Some minor fixes. part 2 of 7
--- src/gprs.c | 13 ++- src/lte.c | 372 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------- src/main.c | 5 - 3 files changed, 341 insertions(+), 49 deletions(-)
src/gprs.c +12 -1
@@ -261,6 +261,10 @@ static const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth)return "chap" ;case OFONO_GPRS_AUTH_METHOD_PAP :return "pap" ; +case OFONO_GPRS_AUTH_METHOD_NONE : +return "none" ; +default : +return NULL ; };return NULL ;
@@ -275,6 +279,9 @@ static gboolean gprs_auth_method_from_string(const char *str, }else if (g_str_equal (str,"pap" )) { *auth =OFONO_GPRS_AUTH_METHOD_PAP ;return TRUE; + }else if (g_str_equal (str,"none" )) { + *auth =OFONO_GPRS_AUTH_METHOD_NONE ; +return TRUE; }return FALSE;
@@ -1008,7 +1015,7 @@ static void pri_read_settings_callback(const struct ofono_error *error, value = pri_ctx->active; - gprs->flags &= !GPRS_FLAG_ATTACHING ; + gprs->flags &= ~GPRS_FLAG_ATTACHING ; gprs->driver_attached = TRUE;gprs_set_attached_property (gprs, TRUE);
@@ -1635,6 +1642,9 @@ static void release_active_contexts(struct ofono_gprs *gprs)if (gc->driver->detach_shutdown !=NULL ) gc->driver->detach_shutdown (gc, ctx->context.cid); + +/* Make sure the context is properly cleared */ +release_context (ctx); } }
@@ -2234,6 +2244,7 @@ static DBusMessage *gprs_remove_context(DBusConnection *conn, }DBG ("Unregistering context: %s" , ctx->path); +release_context (ctx);context_dbus_unregister (ctx); gprs->contexts =g_slist_remove (gprs->contexts, ctx);
src/lte.c +329 -43
486 lines not on this page · raw message
src/main.c +0 -5
@@ -211,11 +211,6 @@ int main(int argc, char **argv)struct ell_event_source *source;#endif -#ifdef NEED_THREADS -if (g_thread_supported () == FALSE) -g_thread_init (NULL ); -#endif - context =g_option_context_new (NULL );g_option_context_add_main_entries (context, options,NULL );
Signature · 1 line
1.9.1
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Giacinto,
Quoted 5 lines · Giacinto Cifelli
--- src/gprs.c | 13 ++- src/lte.c | 372 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------- src/main.c | 5 - 3 files changed, 341 insertions(+), 49 deletions(-)
So you seem to have 3 completely unrelated things going on here... At the very minimum this should be 3 commits.
Also, you're adding LTE D-Bus implementation without updating or proposing changes to doc/lte-api.txt.
Quoted 6 lines
src/gprs.c +0
-0
src/gprs.c static const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth) · line 268
Quoted 8 lines
src/gprs.c +4
-0@@ -261,6 +261,10 @@ static const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth)return "chap" ;case OFONO_GPRS_AUTH_METHOD_PAP :return "pap" ; +case OFONO_GPRS_AUTH_METHOD_NONE : +return "none" ; +default : +return NULL ; };
Okay, but this patch likely needs to also ensure that username / password are not settable if method is NONE. And follow up with an update of all things that depend on OFONO_GPRS_AUTH_METHOD usage. E.g. drivers, provisioning plugins, etc.
Quoted 13 lines
src/gprs.c +3
-0return NULL ;@@ -275,6 +279,9 @@ static gboolean gprs_auth_method_from_string(const char *str, }else if (g_str_equal (str,"pap" )) { *auth =OFONO_GPRS_AUTH_METHOD_PAP ;return TRUE; + }else if (g_str_equal (str,"none" )) { + *auth =OFONO_GPRS_AUTH_METHOD_NONE ; +return TRUE; }return FALSE;
src/gprs.c static void pri_read_settings_callback(const struct ofono_error *error, · line 1018
Quoted 5 lines
src/gprs.c +1
-1@@ -1008,7 +1015,7 @@ static void pri_read_settings_callback(const struct ofono_error *error, value = pri_ctx->active; - gprs->flags &= !GPRS_FLAG_ATTACHING ; + gprs->flags &= ~GPRS_FLAG_ATTACHING ;
Okay, but this is a separate fix and should be documented properly.
src/gprs.c static void release_active_contexts(struct ofono_gprs *gprs) · line 1647
Quoted 10 lines
src/gprs.c +3
-0gprs->driver_attached = TRUE;gprs_set_attached_property (gprs, TRUE);@@ -1635,6 +1642,9 @@ static void release_active_contexts(struct ofono_gprs *gprs)if (gc->driver->detach_shutdown !=NULL ) gc->driver->detach_shutdown (gc, ctx->context.cid); + +/* Make sure the context is properly cleared */ +release_context (ctx);
As above, seems to be an unrelated fix.
src/gprs.c static DBusMessage *gprs_remove_context(DBusConnection *conn, · line 2247
Quoted 8 lines
src/gprs.c +1
-0} }@@ -2234,6 +2244,7 @@ static DBusMessage *gprs_remove_context(DBusConnection *conn, }DBG ("Unregistering context: %s" , ctx->path); +release_context (ctx);
As above. You can't just lump these changes into something unrelated. You need to submit these fixes separately and describe what each one is fixing and why.
Quoted 16 lines
src/gprs.c +0
-0context_dbus_unregister (ctx); gprs->contexts =g_slist_remove (gprs->contexts, ctx);src/lte.c +1
-0@@ -3,6 +3,7 @@* oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. +* Copyright (C) 2018 Gemalto M2M * * 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
src/lte.c line 43
Quoted 5 lines
src/lte.c +1
-1@@ -39,7 +40,11 @@#define SETTINGS_STORE "lte"#define SETTINGS_GROUP "Settings" -#define DEFAULT_APN_KEY "DefaultAccessPointName" +#define LTE_APN "AccessPointName"
No. You can't do that. The D-Bus API is stable and cannot be changed. This is why you propose D-Bus API changes first, so that they can be reviewed separately for any impacts.
src/lte.c struct ofono_lte { · line 58
Quoted 12 lines
src/lte.c +5
-0+#define LTE_PROTO "Protocol" +#define LTE_USERNAME "Username" +#define LTE_PASSWORD "Password" +#define LTE_AUTH_METHOD "AuthenticationMethod"struct ofono_lte {const struct ofono_lte_driver *driver;@@ -50,13 +55,82 @@ struct ofono_lte {DBusMessage *pending;struct ofono_lte_default_attach_info pending_info;struct ofono_lte_default_attach_info info; +const char *prop_changed;
?? What memory location is this const char pointing to?
Why don't you just use an enum. Or even better, don't do this at all and simply compare pending_info & info to generate the right signal.
Quoted 7 lines
src/lte.c +3
-0};static GSList *g_drivers =NULL ; +static const char *gprs_proto_to_string (enum ofono_gprs_proto proto) +{ +switch (proto) {
src/lte.c struct ofono_lte { · line 75
Quoted 10 lines
src/lte.c +10
-0+case OFONO_GPRS_PROTO_IP : +return "ip" ; +case OFONO_GPRS_PROTO_IPV6 : +return "ipv6" ; +case OFONO_GPRS_PROTO_IPV4V6 : +return "dual" ; + }; + +return NULL ; +}
This needs to be moved to common.c
Quoted 41 lines
src/lte.c +41
-0+ +static gboolean gprs_proto_from_string (const char *str, +enum ofono_gprs_proto *proto) +{ +if (g_str_equal (str,"ip" )) { + *proto =OFONO_GPRS_PROTO_IP ; +return TRUE; + }else if (g_str_equal (str,"ipv6" )) { + *proto =OFONO_GPRS_PROTO_IPV6 ; +return TRUE; + }else if (g_str_equal (str,"dual" )) { + *proto =OFONO_GPRS_PROTO_IPV4V6 ; +return TRUE; + } + +return FALSE; +} + +static const char *gprs_auth_method_to_string (enum ofono_gprs_auth_method auth) +{ +switch (auth) { +case OFONO_GPRS_AUTH_METHOD_CHAP : +return "chap" ; +case OFONO_GPRS_AUTH_METHOD_PAP : +return "pap" ; +case OFONO_GPRS_AUTH_METHOD_NONE : +return "none" ; +default : +return NULL ; + }; + +return NULL ; +} + +static gboolean gprs_auth_method_from_string (const char *str, +enum ofono_gprs_auth_method *auth) +{ +if (g_str_equal (str,"chap" )) { + *auth =OFONO_GPRS_AUTH_METHOD_CHAP ; +return TRUE; + }else if (g_str_equal (str,"pap" )) {
src/lte.c struct ofono_lte { · line 126
Quoted 10 lines
src/lte.c +10
-0+ *auth =OFONO_GPRS_AUTH_METHOD_PAP ; +return TRUE; + }else if (g_str_equal (str,"none" )) { + *auth =OFONO_GPRS_AUTH_METHOD_NONE ; +return TRUE; + } + +return FALSE; +} +
And all these as well
Quoted 11 lines
src/lte.c +4
-0static void lte_load_settings (struct ofono_lte *lte) { +char *proto_str;char *apn; +char *auth_method_str; +char *username; +char *password;if (lte->imsi ==NULL )return ;
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 149
Quoted 10 lines
src/lte.c +4
-3@@ -69,114 +143,276 @@ static void lte_load_settings(struct ofono_lte *lte)return ; } - apn =g_key_file_get_string (lte->settings,SETTINGS_GROUP , -DEFAULT_APN_KEY ,NULL ); -if (apn) { + proto_str =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_PROTO ,NULL ); + apn =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_APN ,NULL );
And now you broke the default attach APN setting of every existing oFono user. No, you cannot do that.
Quoted 45 lines
src/lte.c +35
-2+ auth_method_str =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_AUTH_METHOD ,NULL ); + username =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_USERNAME ,NULL ); + password =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_PASSWORD ,NULL ); +if (proto_str ==NULL ) + proto_str =g_strdup ("ip" ); + +/* this must have a valid default */ +if (!gprs_proto_from_string (proto_str, <e->info.proto)) + lte->info.proto =OFONO_GPRS_PROTO_IP ; + +if (apn)strcpy (lte->info.apn, apn); -g_free (apn); - } + +if (auth_method_str ==NULL ) + auth_method_str =g_strdup ("none" ); + +/* this must have a valid default */ +if (!gprs_auth_method_from_string (auth_method_str, + <e->info.auth_method)) + lte->info.auth_method =OFONO_GPRS_AUTH_METHOD_NONE ; + +if (username) +strcpy (lte->info.username, username); + +if (password) +strcpy (lte->info.password, password); + +g_free (proto_str); +g_free (apn); +g_free (auth_method_str); +g_free (username); +g_free (password); }static DBusMessage *lte_get_properties (DBusConnection *conn,DBusMessage *msg,void *data) {struct ofono_lte *lte = data; +const char *proto =gprs_proto_to_string (lte->info.proto);const char *apn = lte->info.apn;
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 202
Quoted 10 lines
src/lte.c +5
-0+const char * auth_method = +gprs_auth_method_to_string (lte->info.auth_method); +const char *username = lte->info.username; +const char *password = lte->info.password;DBusMessage *reply;DBusMessageIter iter;DBusMessageIter dict; reply =dbus_message_new_method_return (msg); +
Don't change random code that doesn't need to be changed. You should be keeping your changes minimal and on-point. Any changes unrelated to the purpose of the patch need to be submitted separately.
Quoted 26 lines
src/lte.c +9
-4if (reply ==NULL )return NULL ;dbus_message_iter_init_append (reply, &iter); -dbus_message_iter_open_container (&iter,DBUS_TYPE_ARRAY ,OFONO_PROPERTIES_ARRAY_SIGNATURE , &dict); -ofono_dbus_dict_append (&dict,DEFAULT_APN_KEY ,DBUS_TYPE_STRING , &apn); +ofono_dbus_dict_append (&dict,LTE_PROTO ,DBUS_TYPE_STRING , &proto); +ofono_dbus_dict_append (&dict,LTE_APN ,DBUS_TYPE_STRING , &apn); +ofono_dbus_dict_append (&dict,LTE_AUTH_METHOD ,DBUS_TYPE_STRING , + &auth_method); +ofono_dbus_dict_append (&dict,LTE_USERNAME ,DBUS_TYPE_STRING , + &username); +ofono_dbus_dict_append (&dict,LTE_PASSWORD ,DBUS_TYPE_STRING , + &password);dbus_message_iter_close_container (&iter, &dict); -return reply; }static void lte_set_default_attach_info_cb (const struct ofono_error *error, -void *data) +void *data) {
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 232
Quoted 10 lines
src/lte.c +3
-2struct ofono_lte *lte = data;const char *path =__ofono_atom_get_path (lte->atom);DBusConnection *conn =ofono_dbus_get_connection ();DBusMessage *reply; -const char *apn = lte->info.apn; +const char *propstr; -DBG ("%s error %d" , path, error->type); +if (error !=NULL ) { +DBG ("%s error %d" , path, error->type);
Why? Error should never be NULL. If you're faking a call to this function, why don't you just pass a proper error structure in instead of messing with this? And even then I would think it would be much cleaner not to do this in the first place...
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 238
Quoted 10 lines
src/lte.c +5
-4-if (error->type !=OFONO_ERROR_TYPE_NO_ERROR ) { -__ofono_dbus_pending_reply (<e->pending, -__ofono_error_failed (lte->pending)); -return ; +if (error->type !=OFONO_ERROR_TYPE_NO_ERROR ) { +__ofono_dbus_pending_reply (<e->pending, +__ofono_error_failed (lte->pending)); +return ; + }
This change is non-sense.
Quoted 51 lines
src/lte.c +36
-10} -g_strlcpy (lte->info.apn, lte->pending_info.apn, -OFONO_GPRS_MAX_APN_LENGTH +1 ); +if (g_str_equal (lte->prop_changed,LTE_PROTO )) { + lte->info.proto = lte->pending_info.proto; + propstr =gprs_proto_to_string (lte->info.proto); -if (lte->settings) { -if (strlen (lte->info.apn) ==0 ) -/* Clear entry on empty APN. */ -g_key_file_remove_key (lte->settings,SETTINGS_GROUP , -DEFAULT_APN_KEY ,NULL ); -else +if (lte->settings)g_key_file_set_string (lte->settings,SETTINGS_GROUP , -DEFAULT_APN_KEY , lte->info.apn); +LTE_PROTO , propstr); -storage_sync (lte->imsi,SETTINGS_STORE , lte->settings); + }else if (g_str_equal (lte->prop_changed,LTE_APN )) { +g_strlcpy (lte->info.apn, lte->pending_info.apn, +OFONO_GPRS_MAX_APN_LENGTH +1 ); + propstr = lte->info.apn; + +if (lte->settings) { + +if (!*lte->info.apn) +/* Clear entry on empty APN. */ +g_key_file_remove_key (lte->settings, +SETTINGS_GROUP ,LTE_APN ,NULL ); +else +g_key_file_set_string (lte->settings, +SETTINGS_GROUP ,LTE_APN , lte->info.apn); + } + + }else if (g_str_equal (lte->prop_changed,LTE_AUTH_METHOD )) { + lte->info.auth_method = lte->pending_info.auth_method; + propstr =gprs_auth_method_to_string (lte->info.auth_method); + +if (lte->settings) +g_key_file_set_string (lte->settings,SETTINGS_GROUP , +LTE_AUTH_METHOD , propstr); + + }else if (g_str_equal (lte->prop_changed,LTE_USERNAME )) { +g_strlcpy (lte->info.username, lte->pending_info.username, +OFONO_GPRS_MAX_USERNAME_LENGTH +1 ); + propstr = lte->info.username; + +if (lte->settings) { +
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 289
Quoted 10 lines
src/lte.c +10
-0+if (!*lte->info.username) +/* Clear entry on empty Username. */ +g_key_file_remove_key (lte->settings, +SETTINGS_GROUP ,LTE_USERNAME ,NULL ); +else +g_key_file_set_string (lte->settings, +SETTINGS_GROUP , +LTE_USERNAME , lte->info.username); + } +
You have boiler-plate code for nearly all of these settings. Why don't you actually use a function for this?
Quoted 9 lines
src/lte.c +9
-0+ }else if (g_str_equal (lte->prop_changed,LTE_PASSWORD )) { +g_strlcpy (lte->info.password, lte->pending_info.password, +OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ); + propstr = lte->info.password; + +if (lte->settings) { + +if (strlen (lte->info.password) ==0 ) +/* Clear entry on empty Password. */
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 308
Quoted 10 lines
src/lte.c +10
-0+g_key_file_remove_key (lte->settings, +SETTINGS_GROUP ,LTE_PASSWORD ,NULL ); + else + g_key_file_set_string(lte->settings, +SETTINGS_GROUP , + LTE_PASSWORD, lte->info.password); + } + + }else { +return ;
You have a dbus message pending, you can't do that...
Quoted 27 lines
src/lte.c +7
-10} +if (lte->settings) +storage_sync (lte->imsi,SETTINGS_STORE , lte->settings); + reply =dbus_message_new_method_return (lte->pending);__ofono_dbus_pending_reply (<e->pending, reply); -ofono_dbus_signal_property_changed (conn, path,OFONO_CONNECTION_CONTEXT_INTERFACE , -DEFAULT_APN_KEY , -DBUS_TYPE_STRING , &apn); + lte->prop_changed, +DBUS_TYPE_STRING , &propstr); } -static DBusMessage *lte_set_default_apn (struct ofono_lte *lte, +static DBusMessage *lte_set_proto (struct ofono_lte *lte,DBusConnection *conn,DBusMessage *msg, -const char *apn) +enum ofono_gprs_proto proto) { -if (lte->driver->set_default_attach_info ==NULL ) -return __ofono_error_not_implemented (msg); - -if (lte->pending) -return __ofono_error_busy (msg);
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 334
Quoted 10 lines
src/lte.c +6
-1+void *data = lte; -if (g_str_equal (apn, lte->info.apn)) +if (proto == lte->info.proto)return dbus_message_new_method_return (msg); + lte->pending =dbus_message_ref (msg); + lte->pending_info.proto = proto; +lte_set_default_attach_info_cb (NULL , data); +return dbus_message_ref (msg);;
I have no idea what is happening here. Whatever it is, it is wrong.
Quoted 56 lines
src/lte.c +44
-4+} + +static DBusMessage *lte_set_default_apn (struct ofono_lte *lte, +DBusConnection *conn,DBusMessage *msg, +const char *apn) +{/* We do care about empty value: it can be used for reset. */ if (is_valid_apn (apn) == FALSE && apn[0 ] !='\0' )return __ofono_error_invalid_format (msg); lte->pending =dbus_message_ref (msg); +g_strlcpy (lte->info.apn, apn,OFONO_GPRS_MAX_APN_LENGTH +1 ); + lte->driver->set_default_attach_info (lte, <e->info, + lte_set_default_attach_info_cb, lte); +return dbus_message_ref (msg); +} -g_strlcpy (lte->pending_info.apn, apn,OFONO_GPRS_MAX_APN_LENGTH +1 ); +static DBusMessage *lte_set_auth_method (struct ofono_lte *lte, +DBusConnection *conn,DBusMessage *msg, +enum ofono_gprs_auth_method auth_method) +{ +void *data = lte; - lte->driver->set_default_attach_info (lte, <e->pending_info, - lte_set_default_attach_info_cb, lte); +if (auth_method == lte->info.auth_method) +return dbus_message_new_method_return (msg); -return NULL ; + lte->pending =dbus_message_ref (msg); + lte->pending_info.auth_method = auth_method; +lte_set_default_attach_info_cb (NULL , data); +return dbus_message_ref (msg);; +} + +static DBusMessage *lte_set_username (struct ofono_lte *lte, +DBusConnection *conn,DBusMessage *msg, +const char *username) +{ +void *data = lte; + +if (g_str_equal (username, lte->info.username)) +return dbus_message_new_method_return (msg); + + lte->pending =dbus_message_ref (msg); +g_strlcpy (lte->pending_info.username, username, +OFONO_GPRS_MAX_USERNAME_LENGTH +1 ); +lte_set_default_attach_info_cb (NULL , data); +return dbus_message_ref (msg);; +} + +static DBusMessage *lte_set_password (struct ofono_lte *lte, +DBusConnection *conn,DBusMessage *msg, +const char *password) +{
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 396
Quoted 10 lines
src/lte.c +10
-0+void *data = lte; + +if (g_str_equal (password, lte->info.password)) +return dbus_message_new_method_return (msg); + + lte->pending =dbus_message_ref (msg); +g_strlcpy (lte->pending_info.password, password, +OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ); +lte_set_default_attach_info_cb (NULL , data); +
You do realize you're never actually calling into the driver method, right? So none of these changes actually go out to the modem. Have you actually tested any of this?
Quoted 29 lines
src/lte.c +11
-2+return dbus_message_ref (msg);; }static DBusMessage *lte_set_property (DBusConnection *conn, -DBusMessage *msg,void *data) +DBusMessage *msg,void *data) {struct ofono_lte *lte = data;DBusMessageIter iter;DBusMessageIter var;const char *property;const char *str; +enum ofono_gprs_auth_method auth_method; +enum ofono_gprs_proto proto; + +if (lte->driver->set_default_attach_info ==NULL ) +return __ofono_error_not_implemented (msg); + +if (lte->pending) +return __ofono_error_busy (msg);if (!dbus_message_iter_init (msg, &iter))return __ofono_error_invalid_args (msg);@@ -192,13 +428,58 @@ static DBusMessage *lte_set_property(DBusConnection *conn,dbus_message_iter_recurse (&iter, &var); -if (!strcmp (property,DEFAULT_APN_KEY )) { + lte->prop_changed=property;
src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn, · line 441
Quoted 10 lines
src/lte.c +10
-0+ +if (!strcmp (property,LTE_PROTO )) { + +if (dbus_message_iter_get_arg_type (&var) !=DBUS_TYPE_STRING ) +return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +if (gprs_proto_from_string (str, &proto)) +return lte_set_proto (lte, conn, msg, proto);
The return from this callback is always supposed to be a method_return or NULL if the method_return will be done asynchronously (in your case always) You're somehow returning the method_call itself...
Quoted 45 lines
src/lte.c +35
-0+else +return __ofono_error_invalid_format (msg); + + }else if (!strcmp (property,LTE_APN )) { +if (dbus_message_iter_get_arg_type (&var) !=DBUS_TYPE_STRING )return __ofono_error_invalid_args (msg);dbus_message_iter_get_basic (&var, &str);return lte_set_default_apn (lte, conn, msg, str); + + }else if (!strcmp (property,LTE_AUTH_METHOD )) { + +if (dbus_message_iter_get_arg_type (&var) !=DBUS_TYPE_STRING ) +return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +if (gprs_auth_method_from_string (str, &auth_method)) +return lte_set_auth_method (lte, conn, msg, auth_method); +else +return __ofono_error_invalid_format (msg); + + }else if (!strcmp (property,LTE_USERNAME )) { + +if (dbus_message_iter_get_arg_type (&var) !=DBUS_TYPE_STRING ) +return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +return lte_set_username (lte, conn, msg, str); + + }else if (!strcmp (property,LTE_PASSWORD )) { + +if (dbus_message_iter_get_arg_type (&var) !=DBUS_TYPE_STRING ) +return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +return lte_set_password (lte, conn, msg, str); }return __ofono_error_invalid_args (msg);
src/lte.c void *ofono_lte_get_data(const struct ofono_lte *lte) · line 661
Quoted 9 lines
src/lte.c +5
-0@@ -373,3 +654,8 @@ void *ofono_lte_get_data(const struct ofono_lte *lte) {return lte->driver_data; } + +struct ofono_modem *ofono_lte_get_modem (const struct ofono_lte *lte) +{ +return __ofono_atom_get_modem (lte->atom); +}
Fix this.
src/main.c int main(int argc, char **argv) · line 218
Quoted 13 lines
src/main.c +0
-5@@ -211,11 +211,6 @@ int main(int argc, char **argv)struct ell_event_source *source;#endif -#ifdef NEED_THREADS -if (g_thread_supported () == FALSE) -g_thread_init (NULL ); -#endif -
Why? This is completely unrelated and can be turned off via configure.
src/main.c int main(int argc, char **argv) · line 216
Quoted 4 lines
src/main.c +0
-0context =g_option_context_new (NULL );g_option_context_add_main_entries (context, options,NULL );
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Denis,
Quoted 7 lines · Denis Kenzior
Hi Giacinto,
Quoted 3 lines · Giacinto Cifelli
--- src/gprs.c | 13 ++- src/lte.c | 372++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
Quoted 9 lines
Quoted 2 lines
src/main.c | 5 - 3 files changed, 341 insertions(+), 49 deletions(-)So you seem to have 3 completely unrelated things going on here... At the very minimum this should be 3 commits.
Also, you're adding LTE D-Bus implementation without updating or proposing changes to
doc/lte-api.txt.
so, first the documentation?
Quoted 16 lines
src/gprs.c static const char *gprs_auth_method_to_string(enum
Quoted 6 lines
src/gprs.c +0
-0@@ -261,6 +261,10 @@ static const char *gprs_auth_method_to_string(enum
ofono_gprs_auth_methodauth)src/gprs.c static const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth) · line 268
Quoted 8 lines
src/gprs.c +4
-0return "chap" ;case OFONO_GPRS_AUTH_METHOD_PAP :return "pap" ; +case OFONO_GPRS_AUTH_METHOD_NONE : +return "none" ; +default : +return NULL ; };
Quoted 5 lines
Okay, but this patch likely needs to also ensure that username / password are not settable if method is NONE. And follow up with an update of all things that depend on
OFONO_GPRS_AUTH_METHODusage. E.g. drivers, provisioning plugins, etc.
Ok, I will take care of this as well.
Quoted 16 lines
src/gprs.c static gboolean gprs_auth_method_from_string(const
Quoted 3 lines
src/gprs.c +0
-0return NULL ;@@ -275,6 +279,9 @@ static gboolean gprs_auth_method_from_string(constchar *str,
src/gprs.c static void pri_read_settings_callback(const
Quoted 10 lines
src/gprs.c +3
-0}else if (g_str_equal (str,"pap" )) { *auth =OFONO_GPRS_AUTH_METHOD_PAP ;return TRUE; + }else if (g_str_equal (str,"none" )) { + *auth =OFONO_GPRS_AUTH_METHOD_NONE ; +return TRUE; }return FALSE;@@ -1008,7 +1015,7 @@ static void pri_read_settings_callback(conststruct
ofono_error*error,Quoted 1 line
Quoted 7 lines
src/gprs.c static void pri_read_settings_callback(const struct ofono_error *error, · line 1018
Quoted 4 lines
value = pri_ctx->active;src/gprs.c +1
-1- gprs->flags &= !GPRS_FLAG_ATTACHING ; + gprs->flags &= ~GPRS_FLAG_ATTACHING ;Okay, but this is a separate fix and should be documented properly.
Okay
Quoted 7 lines
src/gprs.c static void release_active_contexts(struct
Quoted 5 lines
gprs->driver_attached = TRUE; gprs_set_attached_property(gprs, TRUE);src/gprs.c +0
-0@@ -1635,6 +1642,9 @@ static void release_active_contexts(struct
ofono_gprs*gprs)Quoted 1 line
Quoted 8 lines
src/gprs.c static void release_active_contexts(struct ofono_gprs *gprs) · line 1647
Quoted 5 lines
if (gc->driver->detach_shutdown != NULL) gc->driver->detach_shutdown(gc, ctx->context.cid);src/gprs.c +3
-0+ +/* Make sure the context is properly cleared */ +release_context (ctx);As above, seems to be an unrelated fix.
It is. I will submit another patch. the same below.
Quoted 32 lines
src/gprs.c static DBusMessage
Quoted 4 lines
}}
src/gprs.c +0
-0@@ -2234,6 +2244,7 @@ static DBusMessage*gprs_remove_context(DBusConnection *conn,
src/gprs.c static DBusMessage *gprs_remove_context(DBusConnection *conn, · line 2247
Quoted 4 lines
src/gprs.c +1
-0}DBG ("Unregistering context: %s" , ctx->path); +release_context (ctx);As above. You can't just lump these changes into something unrelated. You need to submit these fixes separately and describe what each one is fixing and why.
Quoted 8 lines
src/gprs.c +0
-0context_dbus_unregister (ctx); gprs->contexts =g_slist_remove (gprs->contexts, ctx);src/lte.c +0
-0src/lte.c line 8
Quoted 6 lines
src/lte.c +1
-0@@ -3,6 +3,7 @@* oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. +* Copyright (C) 2018 Gemalto M2M * * This program is free software; you can redistribute it and/or modify
Quoted 3 lines
src/lte.c +0
-0* it under the terms of the GNU General Public License version 2 as @@ -39,7 +40,11 @@
Quoted 9 lines
src/lte.c line 43
Quoted 4 lines
src/lte.c +1
-1#define SETTINGS_STORE "lte"#define SETTINGS_GROUP "Settings" -#define DEFAULT_APN_KEY "DefaultAccessPointName" +#define LTE_APN "AccessPointName"No. You can't do that. The D-Bus API is stable and cannot be changed. This is why you propose D-Bus API changes first, so that they can be reviewed separately for any impacts.
So there can be no unification with the GPRS naming now that the D-Bus API is set?
Quoted 5 lines
Quoted 5 lines
src/lte.c +4
-0+#define LTE_PROTO "Protocol" +#define LTE_USERNAME "Username" +#define LTE_PASSWORD "Password" +#define LTE_AUTH_METHOD "AuthenticationMethod"
Quoted 10 lines
src/lte.c struct ofono_lte { · line 58
Quoted 7 lines
src/lte.c +1
-0struct ofono_lte {const struct ofono_lte_driver *driver;@@ -50,13 +55,82 @@ struct ofono_lte {DBusMessage *pending;struct ofono_lte_default_attach_info pending_info;struct ofono_lte_default_attach_info info; +const char *prop_changed;?? What memory location is this const char pointing to?
it is initialized to null with the containing structure.
Quoted 3 lines
Why don't you just use an enum. Or even better, don't do this at all and simply compare
pending_info& info to generate the right signal.
I will try to change it this way.
Quoted 5 lines
Quoted 5 lines
src/lte.c +0
-0};static GSList *g_drivers =NULL ;
Quoted 16 lines
src/lte.c struct ofono_lte { · line 75
Quoted 13 lines
src/lte.c +13
-0+static const char *gprs_proto_to_string (enum ofono_gprs_proto proto) +{ +switch (proto) { +case OFONO_GPRS_PROTO_IP : +return "ip" ; +case OFONO_GPRS_PROTO_IPV6 : +return "ipv6" ; +case OFONO_GPRS_PROTO_IPV4V6 : +return "dual" ; + }; + +return NULL ; +}This needs to be moved to
common.c
I have tried and failed miserably. But in your email to Slava you have mentioned moving also stuff to types.h, maybe that is the key.
Quoted 79 lines
Quoted 10 lines
src/lte.c +9
-0+ +static gboolean gprs_proto_from_string (const char *str, +enum ofono_gprs_proto *proto) +{ +if (g_str_equal (str,"ip" )) { + *proto =OFONO_GPRS_PROTO_IP ; +return TRUE; + }else if (g_str_equal (str,"ipv6" )) { + *proto =OFONO_GPRS_PROTO_IPV6 ;src/lte.c struct ofono_lte {
Quoted 10 lines
src/lte.c +10
-0+return TRUE; + }else if (g_str_equal (str,"dual" )) { + *proto =OFONO_GPRS_PROTO_IPV4V6 ; +return TRUE; + } + +return FALSE; +} + +static const char *gprs_auth_method_to_string(enum
ofono_gprs_auth_methodauth)Quoted 22 lines
src/lte.c +22
-0+{ +switch (auth) { +case OFONO_GPRS_AUTH_METHOD_CHAP : +return "chap" ; +case OFONO_GPRS_AUTH_METHOD_PAP : +return "pap" ; +case OFONO_GPRS_AUTH_METHOD_NONE : +return "none" ; +default : +return NULL ; + }; + +return NULL ; +} + +static gboolean gprs_auth_method_from_string (const char *str, +enum ofono_gprs_auth_method *auth) +{ +if (g_str_equal (str,"chap" )) { + *auth =OFONO_GPRS_AUTH_METHOD_CHAP ; +return TRUE; + }else if (g_str_equal (str,"pap" )) {src/lte.c struct ofono_lte { · line 126
Quoted 10 lines
src/lte.c +10
-0+ *auth =OFONO_GPRS_AUTH_METHOD_PAP ; +return TRUE; + }else if (g_str_equal (str,"none" )) { + *auth =OFONO_GPRS_AUTH_METHOD_NONE ; +return TRUE; + } + +return FALSE; +} +And all these as well
src/lte.c static void lte_load_settings(struct ofono_lte
Quoted 11 lines
src/lte.c +4
-0static void lte_load_settings (struct ofono_lte *lte) { +char *proto_str;char *apn; +char *auth_method_str; +char *username; +char *password;if (lte->imsi ==NULL )return ;@@ -69,114 +143,276 @@ static void lte_load_settings(struct ofono_lte*lte)
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 149
Quoted 10 lines
src/lte.c +4
-3return ; } - apn =g_key_file_get_string (lte->settings,SETTINGS_GROUP , -DEFAULT_APN_KEY ,NULL ); -if (apn) { + proto_str =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_PROTO ,NULL ); + apn =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_APN ,NULL );
Quoted 3 lines
And now you broke the default attach APN setting of every existing oFono user. No, you cannot do that.
What about reading also the previous key?
Quoted 55 lines
+
auth_method_str= g_key_file_get_string(lte->settings,SETTINGS_GROUP,Quoted 13 lines
src/lte.c +13
-0+ LTE_AUTH_METHOD, NULL); + username =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_USERNAME ,NULL ); + password =g_key_file_get_string (lte->settings,SETTINGS_GROUP , +LTE_PASSWORD ,NULL ); +if (proto_str ==NULL ) + proto_str =g_strdup ("ip" ); + +/* this must have a valid default */ +if (!gprs_proto_from_string (proto_str, <e->info.proto)) + lte->info.proto =OFONO_GPRS_PROTO_IP ; + +if (apn)src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 173
Quoted 10 lines
src/lte.c +7
-2strcpy (lte->info.apn, apn); -g_free (apn); - } + +if (auth_method_str ==NULL ) + auth_method_str =g_strdup ("none" ); + +/* this must have a valid default */ + if (!gprs_auth_method_from_string(auth_method_str, +
<e->info.auth_method))Quoted 29 lines
src/lte.c +18
-0+ lte->info.auth_method =OFONO_GPRS_AUTH_METHOD_NONE ; + +if (username) +strcpy (lte->info.username, username); + +if (password) +strcpy (lte->info.password, password); + +g_free (proto_str); +g_free (apn); +g_free (auth_method_str); +g_free (username); +g_free (password); }static DBusMessage *lte_get_properties (DBusConnection *conn,DBusMessage *msg,void *data) {struct ofono_lte *lte = data; +const char *proto =gprs_proto_to_string (lte->info.proto);const char *apn = lte->info.apn; +const char * auth_method = +gprs_auth_method_to_string (lte->info.auth_method); +const char *username = lte->info.username; +const char *password = lte->info.password;DBusMessage *reply;DBusMessageIter iter;DBusMessageIter dict;
Quoted 7 lines
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 202
Quoted 2 lines
src/lte.c +1
-0reply =dbus_message_new_method_return (msg); +Don't change random code that doesn't need to be changed. You should be keeping your changes minimal and on-point. Any changes unrelated to the purpose of the patch need to be submitted separately.
ok.
Quoted 35 lines
src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 9 lines
src/lte.c +0
-2if (reply ==NULL )return NULL ;dbus_message_iter_init_append (reply, &iter); -dbus_message_iter_open_container (&iter,DBUS_TYPE_ARRAY ,OFONO_PROPERTIES_ARRAY_SIGNATURE , &dict); - ofono_dbus_dict_append(&dict, DEFAULT_APN_KEY, DBUS_TYPE_STRING,&apn);
Quoted 4 lines
src/lte.c +4
-0+ofono_dbus_dict_append (&dict,LTE_PROTO ,DBUS_TYPE_STRING , &proto); +ofono_dbus_dict_append (&dict,LTE_APN ,DBUS_TYPE_STRING , &apn); +ofono_dbus_dict_append (&dict,LTE_AUTH_METHOD ,DBUS_TYPE_STRING , + &auth_method);src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 10 lines
src/lte.c +4
-1+ofono_dbus_dict_append (&dict,LTE_USERNAME ,DBUS_TYPE_STRING , + &username); +ofono_dbus_dict_append (&dict,LTE_PASSWORD ,DBUS_TYPE_STRING , + &password);dbus_message_iter_close_container (&iter, &dict); -return reply; } static void lte_set_default_attach_info_cb(const struct ofono_error*error,
Quoted 10 lines
src/lte.c +2
-2- void *data) + void *data) {struct ofono_lte *lte = data;const char *path =__ofono_atom_get_path (lte->atom);DBusConnection *conn =ofono_dbus_get_connection ();DBusMessage *reply; -const char *apn = lte->info.apn; +const char *propstr;
Quoted 9 lines
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 232
Quoted 3 lines
src/lte.c +2
-1-DBG ("%s error %d" , path, error->type); +if (error !=NULL ) { +DBG ("%s error %d" , path, error->type);Why? Error should never be NULL. If you're faking a call to this function, why don't you just pass a proper error structure in instead of messing with this? And even then I would think it would be much cleaner not to do this in the first place...
ok.
Quoted 86 lines
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 253
Quoted 9 lines
src/lte.c +3
-4-if (error->type !=OFONO_ERROR_TYPE_NO_ERROR ) { -__ofono_dbus_pending_reply (<e->pending, -__ofono_error_failed (lte->pending)); -return ; +if (error->type !=OFONO_ERROR_TYPE_NO_ERROR ) { + __ofono_dbus_pending_reply(<e->pending, +
__ofono_error_failed(lte->pending));src/lte.c static void lte_load_settings(struct ofono_lte · line 236
Quoted 2 lines
src/lte.c +2
-0+return ; + }This change is non-sense.
src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 12 lines
src/lte.c +3
-6} -g_strlcpy (lte->info.apn, lte->pending_info.apn, -OFONO_GPRS_MAX_APN_LENGTH +1 ); +if (g_str_equal (lte->prop_changed,LTE_PROTO )) { + lte->info.proto = lte->pending_info.proto; + propstr =gprs_proto_to_string (lte->info.proto); -if (lte->settings) { -if (strlen (lte->info.apn) ==0 ) -/* Clear entry on empty APN. */ - g_key_file_remove_key(lte->settings,
SETTINGS_GROUP,src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 4 lines
src/lte.c +1
-2- DEFAULT_APN_KEY, NULL); - else +if (lte->settings) g_key_file_set_string(lte->settings,
SETTINGS_GROUP,src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 141
Quoted 1 line
src/lte.c +0
-1- DEFAULT_APN_KEY,
lte->info.apn);src/lte.c static void lte_load_settings(struct ofono_lte · line 245
Quoted 1 line
src/lte.c +1
-0+ LTE_PROTO,propstr);
src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 5 lines
src/lte.c +3
-1-storage_sync (lte->imsi,SETTINGS_STORE , lte->settings); + }else if (g_str_equal (lte->prop_changed,LTE_APN )) { +g_strlcpy (lte->info.apn, lte->pending_info.apn, + OFONO_GPRS_MAX_APN_LENGTH+ 1);
src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 11 lines
src/lte.c +11
-0+ propstr = lte->info.apn; + +if (lte->settings) { + +if (!*lte->info.apn) +/* Clear entry on empty APN. */ +g_key_file_remove_key (lte->settings, +SETTINGS_GROUP ,LTE_APN ,NULL ); +else + g_key_file_set_string(lte->settings, + SETTINGS_GROUP, LTE_APN,
lte->info.apn);src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 5 lines
src/lte.c +5
-0+ } + + }else if (g_str_equal (lte->prop_changed,LTE_AUTH_METHOD )) { + lte->info.auth_method = lte->pending_info.auth_method; + propstr =
gprs_auth_method_to_string(lte->info.auth_method);src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 261
Quoted 3 lines
src/lte.c +3
-0+ +if (lte->settings) + g_key_file_set_string(lte->settings,
SETTINGS_GROUP,src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 13 lines
src/lte.c +13
-0+ LTE_AUTH_METHOD, propstr); + + }else if (g_str_equal (lte->prop_changed,LTE_USERNAME )) { +g_strlcpy (lte->info.username, lte->pending_info.username, +OFONO_GPRS_MAX_USERNAME_LENGTH +1 ); + propstr = lte->info.username; + +if (lte->settings) { + +if (!*lte->info.username) +/* Clear entry on empty Username. */ + g_key_file_remove_key(lte->settings, + SETTINGS_GROUP, LTE_USERNAME,NULL);
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 289
Quoted 6 lines
src/lte.c +6
-0+else +g_key_file_set_string (lte->settings, +SETTINGS_GROUP , +LTE_USERNAME , lte->info.username); + } +
Quoted 3 lines
You have boiler-plate code for nearly all of these settings. Why don't you actually use a function for this?
Yes.
Quoted 22 lines
src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 12 lines
src/lte.c +11
-0+ }else if (g_str_equal (lte->prop_changed,LTE_PASSWORD )) { +g_strlcpy (lte->info.password, lte->pending_info.password, +OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ); + propstr = lte->info.password; + +if (lte->settings) { + +if (strlen (lte->info.password) ==0 ) +/* Clear entry on empty Password. */ + g_key_file_remove_key(lte->settings, + SETTINGS_GROUP, LTE_PASSWORD,NULL);
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 308
Quoted 8 lines
src/lte.c +8
-0+else +g_key_file_set_string (lte->settings, +SETTINGS_GROUP , +LTE_PASSWORD , lte->info.password); + } + + }else { +return ;
Quoted 2 lines
You have a dbus message pending, you can't do that...
I looked at this line for a long time, and looked bad, but couldn't put my finger on it.
Thank you for highlighting the issue.
Quoted 34 lines
Quoted 34 lines
src/lte.c +9
-11} +if (lte->settings) +storage_sync (lte->imsi,SETTINGS_STORE , lte->settings); + reply =dbus_message_new_method_return (lte->pending);__ofono_dbus_pending_reply (<e->pending, reply); -ofono_dbus_signal_property_changed (conn, path,OFONO_CONNECTION_CONTEXT_INTERFACE , -DEFAULT_APN_KEY , -DBUS_TYPE_STRING , &apn); + lte->prop_changed, +DBUS_TYPE_STRING , &propstr); } -static DBusMessage *lte_set_default_apn (struct ofono_lte *lte, +static DBusMessage *lte_set_proto (struct ofono_lte *lte,DBusConnection *conn,DBusMessage *msg, -const char *apn) +enum ofono_gprs_proto proto) { -if (lte->driver->set_default_attach_info ==NULL ) -return __ofono_error_not_implemented (msg); - -if (lte->pending) -return __ofono_error_busy (msg); +void *data = lte; -if (g_str_equal (apn, lte->info.apn)) +if (proto == lte->info.proto)return dbus_message_new_method_return (msg);
Quoted 7 lines
src/lte.c static void lte_load_settings(struct ofono_lte *lte) · line 334
Quoted 4 lines
src/lte.c +4
-0+ lte->pending =dbus_message_ref (msg); + lte->pending_info.proto = proto; +lte_set_default_attach_info_cb (NULL , data); +return dbus_message_ref (msg);;I have no idea what is happening here. Whatever it is, it is wrong.
It works.
Quoted 70 lines
Quoted 5 lines
src/lte.c +4
-0+} + +static DBusMessage *lte_set_default_apn(struct ofono_lte *lte, + DBusConnection *conn, DBusMessage *msg,src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 10 lines
src/lte.c +5
-0+ const char *apn) +{/* We do care about empty value: it can be used for reset. */ if (is_valid_apn (apn) == FALSE && apn[0 ] !='\0' )return __ofono_error_invalid_format (msg); lte->pending =dbus_message_ref (msg); +g_strlcpy (lte->info.apn, apn,OFONO_GPRS_MAX_APN_LENGTH +1 ); + lte->driver->set_default_attach_info(lte, <e->info, + lte_set_default_attach_info_cb,lte);
src/lte.c struct ofono_lte {
Quoted 4 lines
src/lte.c +2
-1+return dbus_message_ref (msg); +} - g_strlcpy(lte->pending_info.apn, apn, OFONO_GPRS_MAX_APN_LENGTH +1);
src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 8 lines
src/lte.c +5
-2+static DBusMessage *lte_set_auth_method (struct ofono_lte *lte, +DBusConnection *conn,DBusMessage *msg, +enum ofono_gprs_auth_method auth_method) +{ +void *data = lte; - lte->driver->set_default_attach_info(lte, <e->pending_info, - lte_set_default_attach_info_cb,lte);
Quoted 12 lines
src/lte.c +10
-1+if (auth_method == lte->info.auth_method) +return dbus_message_new_method_return (msg); -return NULL ; + lte->pending =dbus_message_ref (msg); + lte->pending_info.auth_method = auth_method; +lte_set_default_attach_info_cb (NULL , data); +return dbus_message_ref (msg);; +} + +static DBusMessage *lte_set_username(struct ofono_lte *lte, + DBusConnection *conn, DBusMessage *msg,src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 10 lines
src/lte.c +10
-0+ const char *username) +{ +void *data = lte; + +if (g_str_equal (username, lte->info.username)) +return dbus_message_new_method_return (msg); + + lte->pending =dbus_message_ref (msg); + g_strlcpy(lte->pending_info.username, username, + OFONO_GPRS_MAX_USERNAME_LENGTH +1);
Quoted 6 lines
src/lte.c +6
-0+lte_set_default_attach_info_cb (NULL , data); +return dbus_message_ref (msg);; +} + +static DBusMessage *lte_set_password(struct ofono_lte *lte, + DBusConnection *conn, DBusMessage *msg,src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 10 lines
src/lte.c +10
-0+ const char *password) +{ +void *data = lte; + +if (g_str_equal (password, lte->info.password)) +return dbus_message_new_method_return (msg); + + lte->pending =dbus_message_ref (msg); + g_strlcpy(lte->pending_info.password, password, + OFONO_GPRS_MAX_PASSWORD_LENGTH +1);
Quoted 7 lines
src/lte.c static void lte_load_settings(struct ofono_lte · line 393
Quoted 2 lines
src/lte.c +2
-0+lte_set_default_attach_info_cb (NULL , data); +You do realize you're never actually calling into the driver method, right? So none of these changes actually go out to the modem. Have you actually tested any of this?
Yes, it works. Actually the only call is when the APN is set, as mentioned in the lte-api.txt.
And at that point all parameters are also set in the module. It is not possible to set separately protocol and apn, and auth_method, username, and password.
For ublox modules, the auth_method is also part of the APN name.
So we kept the call into the module when the APN is set, and previously to it all other parameters are set.
You have also mentioned that somewhere we should also verify that with AUTH_NONE there are no user/pwd.
This also can only be verified at the end.
Any suggestions to improve this, given these limitations?
Quoted 36 lines
+ return
dbus_message_ref(msg);;src/lte.c static void lte_load_settings(struct ofono_lte *lte)
Quoted 5 lines
src/lte.c +1
-1}static DBusMessage *lte_set_property (DBusConnection *conn, -DBusMessage *msg,void *data) + DBusMessage *msg, void*data)
src/lte.c static DBusMessage
Quoted 18 lines
src/lte.c +8
-0{struct ofono_lte *lte = data;DBusMessageIter iter;DBusMessageIter var;const char *property;const char *str; +enum ofono_gprs_auth_method auth_method; +enum ofono_gprs_proto proto; + +if (lte->driver->set_default_attach_info ==NULL ) +return __ofono_error_not_implemented (msg); + +if (lte->pending) +return __ofono_error_busy (msg);if (!dbus_message_iter_init (msg, &iter))return __ofono_error_invalid_args (msg);@@ -192,13 +428,58 @@ static DBusMessage*lte_set_property(DBusConnection *conn,
src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn,
Quoted 9 lines
src/lte.c +5
-1dbus_message_iter_recurse (&iter, &var); -if (!strcmp (property,DEFAULT_APN_KEY )) { + lte->prop_changed=property; + +if (!strcmp (property,LTE_PROTO )) { + + if (dbus_message_iter_get_arg_type(&var) !=
DBUS_TYPE_STRING)
Quoted 11 lines
src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn, · line 441
Quoted 6 lines
src/lte.c +6
-0+return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +if (gprs_proto_from_string (str, &proto)) +return lte_set_proto (lte, conn, msg, proto);The return from this callback is always supposed to be a
method_returnor NULL if themethod_returnwill be done asynchronously (in your case always) You're somehow returning themethod_callitself...
I am not sure I follow you, but you suggested to restructure the code, so I will come back on this later.
Quoted 49 lines
src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn,
Quoted 7 lines
src/lte.c +5
-0+else +return __ofono_error_invalid_format (msg); + + }else if (!strcmp (property,LTE_APN )) { + if (dbus_message_iter_get_arg_type(&var) !=
DBUS_TYPE_STRING)src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn,
Quoted 9 lines
src/lte.c +4
-0return __ofono_error_invalid_args (msg);dbus_message_iter_get_basic (&var, &str);return lte_set_default_apn (lte, conn, msg, str); + + }else if (!strcmp (property,LTE_AUTH_METHOD )) { + + if (dbus_message_iter_get_arg_type(&var) !=
DBUS_TYPE_STRING)src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn,
Quoted 6 lines
src/lte.c +6
-0+return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +if (gprs_auth_method_from_string (str, &auth_method)) + return lte_set_auth_method(lte, conn, msg,
auth_method);src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn,
Quoted 6 lines
src/lte.c +6
-0+else +return __ofono_error_invalid_format (msg); + + }else if (!strcmp (property,LTE_USERNAME )) { + + if (dbus_message_iter_get_arg_type(&var) !=
DBUS_TYPE_STRING)src/lte.c static DBusMessage *lte_set_property(DBusConnection *conn,
Quoted 9 lines
src/lte.c +9
-0+return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +return lte_set_username (lte, conn, msg, str); + + }else if (!strcmp (property,LTE_PASSWORD )) { + + if (dbus_message_iter_get_arg_type(&var) !=
DBUS_TYPE_STRING)Quoted 7 lines
src/lte.c +5
-0+return __ofono_error_invalid_args (msg); + +dbus_message_iter_get_basic (&var, &str); + +return lte_set_password (lte, conn, msg, str); }
Quoted 14 lines
src/lte.c void *ofono_lte_get_data(const struct ofono_lte *lte) · line 661
Quoted 11 lines
src/lte.c +5
-0return __ofono_error_invalid_args (msg);@@ -373,3 +654,8 @@ void *ofono_lte_get_data(const struct ofono_lte *lte) {return lte->driver_data; } + +struct ofono_modem *ofono_lte_get_modem (const struct ofono_lte *lte) +{ +return __ofono_atom_get_modem (lte->atom); +}Fix this.
?
Quoted 9 lines
Quoted 9 lines
src/main.c +0
-0@@ -211,11 +211,6 @@ int main(int argc, char **argv)struct ell_event_source *source;#endif
Quoted 14 lines
src/main.c int main(int argc, char **argv) · line 218
Quoted 5 lines
src/main.c +0
-5-#ifdef NEED_THREADS -if (g_thread_supported () == FALSE) -g_thread_init (NULL ); -#endif -Why? This is completely unrelated and can be turned off via configure.
Quoted 4 lines
src/main.c +0
-0context =g_option_context_new (NULL );g_option_context_add_main_entries (context, options,NULL );
I agree it is unrelated, I will post a separate post, but I turn on NEED_THREADS, and the build fails. Looking at the g_thread documentations, nowadays it has to come out of the code:
g_thread_init has been deprecated since version 2.32 and should not be used in newly-written code.
This function is no longer necessary. The GLib threading system is automatically initialized at the start of your program.
Quoted 3 lines
Regards,
-Denis
Regards,
Giacinto
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Giacinto,
Quoted 1 line
so, first the documentation?
Correct. Whenever you touch something that affects the D-Bus API, it is really preferable to have the D-Bus API changes in the preceding commit.
That way the reviewers can cross-reference what is being proposed to
the actual implementation. Anything that breaks the D-Bus API can also be spotted much earlier.
oFono's D-Bus API is stable. That means we can add new things, but we cannot change existing ones as that will break existing clients.
We also cannot break existing settings, as that would break oFono installations on existing devices if they are upgraded.
This is a handicap that we have to live with right now.
<snip>
Quoted 3 lines
So there can be no unification with the GPRS naming now that the D-Bus API is set?
I'm afraid not. But I'm not sure why this is a problem?
Quoted 17 lines
> +#define LTE_PROTO "Protocol"
> +#define LTE_USERNAME "Username"
> +#define LTE_PASSWORD "Password"
> +#define LTE_AUTH_METHOD "AuthenticationMethod"
>
> struct ofono_lte {
> const struct ofono_lte_driver *driver;
> @@ -50,13 +55,82 @@ struct ofono_lte {
> DBusMessage *pending;
> struct ofono_lte_default_attach_info pending_info;
> struct ofono_lte_default_attach_info info;
> + const char *prop_changed;
?? What memory location is this const char pointing to?Quoted 1 line
it is initialized to null with the containing structure.
That is not what I'm asking. This pointer points into data owned by DBusMessage and the semantics of whether it is valid or not are not enforced. Avoid that at all cost...
Quoted 2 lines
What about reading also the previous key?
Ideally you shouldn't change the key in the first place. But if you are, then yes you need to be able to read legacy settings versions in order to be backwards-compatible.
Quoted 9 lines
You do realize you're never actually calling into the driver method, right? So none of these changes actually go out to the modem. Have you
actually tested any of this?Yes, it works. Actually the only call is when the APN is set, as mentioned in the lte-api.txt.
No, it really doesn't...
Quoted 7 lines
And at that point all parameters are also set in the module. It is not possible to set separately protocol and apn, and
auth_method, username, and password.
For ublox modules, theauth_methodis also part of the APN name.So we kept the call into the module when the APN is set, and previously to it all other parameters are set.
You simply cannot do that. You cannot assume that the client knows how your API is implemented underneath. So if they set the APN first and then change the username, that has to work. This is why the default_attach_info contains everything. If anything is changed the entire structure is sent to the modem and every parameter is updated.
Quoted 7 lines
You have also mentioned that somewhere we should also verify that with
AUTH_NONEthere are no user/pwd.
This also can only be verified at the end.Any suggestions to improve this, given these limitations?
See above. Any parameter change has to trigger set_default_attach_info() call. If something is invalid, then you have to return a D-Bus error.
For example, if my method is set to 'none' and I try to do LongTermEvolution.SetProperty("DefaultUsername", "foo") that should return an error.
Quoted 49 lines
> + return dbus_message_ref(msg);;
> }
>
> static DBusMessage *lte_set_property(DBusConnection *conn,
> - DBusMessage *msg, void *data)
> + DBusMessage *msg,
void *data)
> {
> struct ofono_lte *lte = data;
> DBusMessageIter iter;
> DBusMessageIter var;
> const char *property;
> const char *str;
> + enum ofono_gprs_auth_method auth_method;
> + enum ofono_gprs_proto proto;
> +
> + if (lte->driver->set_default_attach_info == NULL)
> + return __ofono_error_not_implemented(msg);
> +
> + if (lte->pending)
> + return __ofono_error_busy(msg);
>
> if (!dbus_message_iter_init(msg, &iter))
> return __ofono_error_invalid_args(msg);
> @@ -192,13 +428,58 @@ static DBusMessage
*lte_set_property(DBusConnection *conn,
>
> dbus_message_iter_recurse(&iter, &var);
>
> - if (!strcmp(property, DEFAULT_APN_KEY)) {
> + lte->prop_changed=property;
> +
> + if (!strcmp(property, LTE_PROTO)) {
> +
> + if (dbus_message_iter_get_arg_type(&var) !=
DBUS_TYPE_STRING)
> + return __ofono_error_invalid_args(msg);
> +
> + dbus_message_iter_get_basic(&var, &str);
> +
> + if (gprs_proto_from_string(str, &proto))
> + return lte_set_proto(lte, conn, msg, proto);
The return from this callback is always supposed to be a method_return
or NULL if the method_return will be done asynchronously (in your case
always) You're somehow returning the method_call itself...Quoted 2 lines
I am not sure I follow you, but you suggested to restructure the code, so I will come back on this later.
You need to understand the semantics of GDBus. GDBUS_ASYNC_METHOD() callback can only return the D-Bus method_return for message or NULL if the method return will be generated asynchronously. You cannot return the message itself. While this may 'work' the behavior is undefined.
Quoted 10 lines
> +struct ofono_modem *ofono_lte_get_modem(const struct ofono_lte *lte) > +{ > + return __ofono_atom_get_modem(lte->atom); > +} > \ No newline at end of file Fix this.?
You have no newline after the last '}' and git complains. If git complains I cannot apply the patch...
Quoted 11 lines
I agree it is unrelated, I will post a separate post, but I turn on
NEED_THREADS, and the build fails. Looking at theg_threaddocumentations, nowadays it has to come out of the code:|g_thread_init| has been deprecated since version 2.32 and should not be used in newly-written code.
This function is no longer necessary. The GLib threading system is automatically initialized at the start of your program.
Okay, please send this as a separate patch. We might need to remove this configure option as well.
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Quoted 73 lines · Denis Kenzior
Hi Giacinto,
Quoted 1 line
so, first the documentation?
Correct. Whenever you touch something that affects the D-Bus API, it is really preferable to have the D-Bus API changes in the preceding commit.
That way the reviewers can cross-reference what is being proposed to
the actual implementation. Anything that breaks the D-Bus API can also be spotted much earlier.oFono's D-Bus API is stable. That means we can add new things, but we cannot change existing ones as that will break existing clients.
We also cannot break existing settings, as that would break oFono installations on existing devices if they are upgraded.
This is a handicap that we have to live with right now.
<snip>
Quoted 3 lines
So there can be no unification with the GPRS naming now that the D-Bus API is set?
I'm afraid not. But I'm not sure why this is a problem?
Quoted 17 lines
> +#define LTE_PROTO "Protocol" > +#define LTE_USERNAME "Username" > +#define LTE_PASSWORD "Password" > +#define LTE_AUTH_METHOD "AuthenticationMethod" > > struct ofono_lte { > const struct ofono_lte_driver *driver; > @@ -50,13 +55,82 @@ struct ofono_lte { > DBusMessage *pending; > struct ofono_lte_default_attach_info pending_info; > struct ofono_lte_default_attach_info info; > + const char *prop_changed; ?? What memory location is this const char pointing to?Quoted 1 line
it is initialized to null with the containing structure.
That is not what I'm asking. This pointer points into data owned by DBusMessage and the semantics of whether it is valid or not are not enforced. Avoid that at all cost...
Quoted 2 lines
What about reading also the previous key?
Ideally you shouldn't change the key in the first place. But if you are, then yes you need to be able to read legacy settings versions in order to be backwards-compatible.
Quoted 9 lines
You do realize you're never actually calling into the driver method, right? So none of these changes actually go out to the modem. Have you
actually tested any of this?Yes, it works. Actually the only call is when the APN is set, as mentioned in the lte-api.txt.
No, it really doesn't...
Quoted 5 lines
And at that point all parameters are also set in the module. It is not possible to set separately protocol and apn, and
auth_method, username, and password.
For ublox modules, theauth_methodis also part of the APN name.
Quoted 9 lines
Quoted 2 lines
So we kept the call into the module when the APN is set, and previously to it all other parameters are set.
You simply cannot do that. You cannot assume that the client knows how your API is implemented underneath. So if they set the APN first and then change the username, that has to work. This is why the
default_attach_infocontains everything. If anything is changed the entire structure is sent to the modem and every parameter is updated.
Hi Denis,
I had a look at this all, and I have a problem. I cannot check the parameters as they are entered one by one.
Example: if I blank user/pwd when the authentication is changed to NONE, then if changed again to CHAP, the module will reject it. Shall I store the parameters, or keep them also in case of error?
Another way would be to have a SetParameters() function, and set them all together, including the APN, and not allowing writing them separately, apart from the APN which already exists.
I don't really like it, either.
Or introduce an atom function that is called before modem->set_online(true)?
thanks,
Giacinto
Quoted 110 lines
Quoted 8 lines
You have also mentioned that somewhere we should also verify that with
AUTH_NONEthere are no user/pwd.
This also can only be verified at the end.Any suggestions to improve this, given these limitations?
See above. Any parameter change has to trigger
set_default_attach_info()call. If something is invalid, then you have to return a D-Bus error.For example, if my method is set to 'none' and I try to do
LongTermEvolution.SetProperty("DefaultUsername", "foo")that should return an error.Quoted 6 lines
> + return dbus_message_ref(msg);; > } > > static DBusMessage *lte_set_property(DBusConnection *conn, > - DBusMessage *msg, void*data)
Quoted 31 lines
> + DBusMessage *msg, void *data) > { > struct ofono_lte *lte = data; > DBusMessageIter iter; > DBusMessageIter var; > const char *property; > const char *str; > + enum ofono_gprs_auth_method auth_method; > + enum ofono_gprs_proto proto; > + > + if (lte->driver->set_default_attach_info == NULL) > + return __ofono_error_not_implemented(msg); > + > + if (lte->pending) > + return __ofono_error_busy(msg); > > if (!dbus_message_iter_init(msg, &iter)) > return __ofono_error_invalid_args(msg); > @@ -192,13 +428,58 @@ static DBusMessage *lte_set_property(DBusConnection *conn, > > dbus_message_iter_recurse(&iter, &var); > > - if (!strcmp(property, DEFAULT_APN_KEY)) { > + lte->prop_changed=property; > + > + if (!strcmp(property, LTE_PROTO)) { > + > + if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)Quoted 8 lines
> + return __ofono_error_invalid_args(msg); > + > + dbus_message_iter_get_basic(&var, &str); > + > + if (gprs_proto_from_string(str, &proto)) > + return lte_set_proto(lte, conn, msg, proto); The return from this callback is always supposed to be a
method_returnQuoted 1 line
or NULL if the
method_returnwill be done asynchronously (in yourcase
Quoted 5 lines
always) You're somehow returning the
method_callitself...I am not sure I follow you, but you suggested to restructure the code, so I will come back on this later.
You need to understand the semantics of GDBus.
GDBUS_ASYNC_METHOD()callback can only return the D-Busmethod_returnfor message or NULL if the method return will be generated asynchronously. You cannot return the message itself. While this may 'work' the behavior is undefined.Quoted 1 line
> +struct
ofono_modem*ofono_lte_get_modem(const structofono_lte*lte)
Quoted 9 lines
> +{ > + return __ofono_atom_get_modem(lte->atom); > +} > \ No newline at end of file Fix this.?
You have no newline after the last '}' and git complains. If git complains I cannot apply the patch...
Quoted 11 lines
I agree it is unrelated, I will post a separate post, but I turn on
NEED_THREADS, and the build fails. Looking at theg_threaddocumentations, nowadays it has to come out of the code:|g_thread_init| has been deprecated since version 2.32 and should not be used in newly-written code.
This function is no longer necessary. The GLib threading system is automatically initialized at the start of your program.
Okay, please send this as a separate patch. We might need to remove this configure option as well.
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Giacinto,
Quoted 5 lines
I had a look at this all, and I have a problem. I cannot check the parameters as they are entered one by one.
Example: if I blank user/pwd when the authentication is changed to NONE, then if changed again to CHAP, the module will reject it. Shall I store the parameters, or keep them also in case of error?
So in the case of ConnectionContext the parameters are not sent out to the driver until context activation is attempted. Hence all the settings are immediate and the activation fails or it succeeds.
However, in the LongTermEvolution driver setup the settings are immediate. Thus the D-Bus API you propose is thus not really suitable and needs to be modified. Since we're kind of stuck with the 'DefaultAccessPointName' property at this point, the only two ways out of this I can think of are:
- Have the driver handle this. So if PAP/CHAP is selected but username or password are invalid, default to no authentication. The assumption will be that eventually valid parameters are given.
Or perhaps we only call out into the driver method once the parameters in their entirety are valid, accepting whatever the user puts in as long as the individual property input is valid according to core validity checks.
....
Quoted 6 lines
Another way would be to have a
SetParameters()function, and set them all together, including the APN, and not allowing writing them separately, apart from the APN which already exists.
I don't really like it, either.
As you point out, this is the second alternative. AuthenticationMethod, Username & Password would need to be set via a method call and optionally exposed as [readonly] properties. Protocol could still be handled as per DefaultAccessPointName or inside the aforementioned method call.
Quoted 2 lines
Or introduce an atom function that is called before
modem->set_online(true)?
This might be trickier, but could also work...
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Denis,
Quoted 18 lines · Denis Kenzior
Hi Giacinto,
Quoted 5 lines
I had a look at this all, and I have a problem. I cannot check the parameters as they are entered one by one.
Example: if I blank user/pwd when the authentication is changed to NONE, then if changed again to CHAP, the module will reject it. Shall I store the parameters, or keep them also in case of error?So in the case of ConnectionContext the parameters are not sent out to the driver until context activation is attempted. Hence all the settings are immediate and the activation fails or it succeeds.
However, in the LongTermEvolution driver setup the settings are immediate. Thus the D-Bus API you propose is thus not really suitable and needs to be modified. Since we're kind of stuck with the 'DefaultAccessPointName' property at this point, the only two ways out of this I can think of are:
Quoted 9 lines
- Have the driver handle this. So if PAP/CHAP is selected but username or password are invalid, default to no authentication. The assumption will be that eventually valid parameters are given.
Or perhaps we only call out into the driver method once the parameters in their entirety are valid, accepting whatever the user puts in as long as the individual property input is valid according to core validity checks.
We cannot change the external API, but internally we are free to rearrange the code.
how do you feel about the proposal below for a second set of functions, to override the existing ones
for newer lte atoms?
in src/lte.c
static DBusMessage *lte_set_property(DBusConnection *conn, DBusMessage *msg, void *data)
{
[...]
if (lte->driver->set_property) lte->driver->set_property(...);
else if (lte->driver->set_default_attach_info) lte->driver->set_default_attach_info(...);
else
return __ofono_error_not_implemented(msg);
[...]
in src/modem.c:
static void sim_state_watch(enum ofono_sim_state new_state, void *user) {
[...]
case OFONO_SIM_STATE_READY:modem_change_state(modem, MODEM_STATE_OFFLINE);
ofono_lte_set_reginfo(modem);
/* Modem is always online, proceed to online state. */ if (modem_is_always_online(modem) == TRUE) set_online(modem, TRUE);
if (modem->online == TRUE) modem_change_state(modem, MODEM_STATE_ONLINE); else if (modem->get_online) modem->driver->set_online(modem, 1, common_online_cb, modem);
modem->get_online = FALSE;
break;
}
I see that if(modem_is_always_online) maybe it will come too late, but in that case also the current solution
with set_default_attach_info suffers from the same limitation, so no regression.
Of course then, again in src/lte.c, the function ofono_lte_set_reginfo will look for an lte atom, if present will call it without parameter for sending the AT+CGDCONT and AT+CGAUTH to the modem.
Would this work for you?
Quoted 15 lines
....
Quoted 6 lines
Another way would be to have a
SetParameters()function, and set them all together, including the APN, and not allowing writing them separately, apart from the APN which already exists.
I don't really like it, either.As you point out, this is the second alternative. AuthenticationMethod, Username & Password would need to be set via a method call and optionally exposed as [readonly] properties. Protocol could still be handled as per DefaultAccessPointName or inside the aforementioned method call.
Quoted 9 lines
Quoted 1 line
Or introduce an atom function that is called before
modem->set_online(true)?Quoted 1 line
This might be trickier, but could also work...
Regards,
-Denis
Regards,
Giacinto
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Giacinto,
Quoted 6 lines
static DBusMessage *lte_set_property(DBusConnection *conn, DBusMessage *msg, void *data)
{
[...]
if (lte->driver->set_property)lte->driver->set_property(...);
What is this buying you?
Quoted 8 lines
else if (
lte->driver->set_default_attach_info)lte->driver->set_default_attach_info(...);
else
return__ofono_error_not_implemented(msg);
[...]in
src/modem.c:
Quoted 7 lines
static void
sim_state_watch(enum ofono_sim_state new_state, void *user){
[...]
caseOFONO_SIM_STATE_READY:modem_change_state(modem, MODEM_STATE_OFFLINE);
ofono_lte_set_reginfo(modem);
How does this help you? You might be in the OFFLINE state for a while and the LTE settings might still be messed with in that time.
Quoted 13 lines
/* Modem is always online, proceed to online state. */ if (
modem_is_always_online(modem)== TRUE)set_online(modem, TRUE);if (
modem->online== TRUE)modem_change_state(modem, MODEM_STATE_ONLINE); else if (modem->get_online)modem->driver->set_online(modem, 1, common_online_cb, modem);
modem->get_online= FALSE;
Quoted 7 lines
break;
}I see that
if(modem_is_always_online)maybe it will come too late, but in that case also the current solution
withset_default_attach_infosuffers from the same limitation, so no regression.
The modem_is_always_online case is a bit strange, it is for really primitive devices which likely won't have an LTE atom anyway.
Quoted 7 lines
Of course then, again in
src/lte.c, the functionofono_lte_set_reginfowill look for an lte atom, if present will call it without parameter for sending the AT+CGDCONT and AT+CGAUTH to the modem.Would this work for you?
I don't see how this helps.
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Denis,
sorry for writing on top, but I don't see a good place in the middle.
The idea would be to just store the values in the driver but not in the module,
and then send them before attaching, so that the verification can be consistent and all,
just like for the gprs-context atom.
so the idea would be to check if a new method, that I have tentatively called set_property(),
exists. If so, use the reviewed stile above, otherwise fallback to the current function.
Giacinto
Quoted 68 lines · Denis Kenzior
Hi Giacinto,
Quoted 6 lines
static DBusMessage *lte_set_property(DBusConnection *conn, DBusMessage *msg, void *data)
{
[...]
if (lte->driver->set_property)lte->driver->set_property(...);What is this buying you?
Quoted 8 lines
else if (
lte->driver->set_default_attach_info)lte->driver->set_default_attach_info(...);
else
return__ofono_error_not_implemented(msg);
[...]in
src/modem.c:Quoted 7 lines
static void
sim_state_watch(enum ofono_sim_state new_state, void *user){
[...]
caseOFONO_SIM_STATE_READY:modem_change_state(modem, MODEM_STATE_OFFLINE);
ofono_lte_set_reginfo(modem);How does this help you? You might be in the OFFLINE state for a while and the LTE settings might still be messed with in that time.
Quoted 13 lines
/* Modem is always online, proceed to online state. */ if (
modem_is_always_online(modem)== TRUE)set_online(modem, TRUE);if (
modem->online== TRUE)modem_change_state(modem, MODEM_STATE_ONLINE); else if (modem->get_online)modem->driver->set_online(modem, 1, common_online_cb, modem);
modem->get_online= FALSE;Quoted 7 lines
break;
}I see that
if(modem_is_always_online)maybe it will come too late, but in that case also the current solution
withset_default_attach_infosuffers from the same limitation, so no regression.The
modem_is_always_onlinecase is a bit strange, it is for really primitive devices which likely won't have an LTE atom anyway.Quoted 7 lines
Of course then, again in
src/lte.c, the functionofono_lte_set_reginfowill look for an lte atom, if present will call it without parameter for sending the AT+CGDCONT and AT+CGAUTH to the modem.Would this work for you?
I don't see how this helps.
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Giacinto,
Quoted 5 lines
The idea would be to just store the values in the driver but not in the module,
and then send them before attaching, so that the verification can be consistent and all,
just like for the gprs-context atom.
Yes, but that is not what you outlined in the code. You were watching for SIM_STATE_READY which only means just that.
Also note that we can bring the modem online even in pre_sim state (e.g. for emergency calls), in which case the lte atom doesn't exist yet.
Quoted 6 lines
so the idea would be to check if a new method, that I have tentatively called
set_property(),
exists. If so, use the reviewed stile above, otherwise fallback to the current function.
I don't see what set_property is buying you. Anyway, feel free to come up with a more detailed proposal, but my impression is that this approach will quickly become way too complicated.
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
hi Denis,
Quoted 8 lines · On Thu, 20 Sep 2018, 18:31 Denis Kenzior, <[email protected]> wrote:
Hi Giacinto,
Quoted 5 lines
The idea would be to just store the values in the driver but not in the module,
and then send them before attaching, so that the verification can be consistent and all,
just like for the gprs-context atom.
Quoted 6 lines
Yes, but that is not what you outlined in the code. You were watching for
SIM_STATE_READYwhich only means just that.Also note that we can bring the modem online even in
pre_simstate (e.g. for emergency calls), in which case the lte atom doesn't exist yet.
where should a hook be placed then?
this looked to me a good place, just before bringing it online. if there is no atom, no config and everything is ok anyway.
Quoted 11 lines
Quoted 6 lines
so the idea would be to check if a new method, that I have tentatively called
set_property(),
exists. If so, use the reviewed stile above, otherwise fallback to the current function.I don't see what
set_propertyis buying you. Anyway, feel free to come up with a more detailed proposal, but my impression is that this approach will quickly become way too complicated.
I think now i got you. The existing function could be used, but the driver only stores the values internally because it knows it will ve called later for sending the commands.
Quoted 3 lines
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Hi Giacinto,
Quoted 17 lines · Giacinto Cifelli
hi Denis,
On Thu, 20 Sep 2018, 18:31 Denis Kenzior, <[email protected] <mailto:[email protected]>> wrote:
Hi Giacinto,
> The idea would be to just store the values in the driver but not
in the
> module,
> and then send them before attaching, so that the verification can be > consistent and all,
> just like for the gprs-context atom.Yes, but that is not what you outlined in the code. You were watching for
SIM_STATE_READYwhich only means just that.
Quoted 8 lines
Also note that we can bring the modem online even in
pre_simstate (e.g.
for emergency calls), in which case the lte atom doesn't exist yet.where should a hook be placed then?
this looked to me a good place, just before bringing it online. if there is no atom, no config and everything is ok anyway.
That's kind of the problem, there is no good place. The only thing you can do is have the core apply settings, if available, just prior to the set_online driver call. However, it is tricky to do so:
- We're in pre-sim state and go online for emergency calls. This is okay as no LTE atom is created. If a SIM is initialized / inserted at this point, the modem can re-connect with a proper default settings. The LTE atom creation and modem performing a re-connect is now a race. Admittedly the solution we have today also suffers from this problem, so maybe there's not much we can do here.
- We're offline and going online. You need to perform the online operation as a transaction. First setting the default attach details and then actually setting the modem online. We can't do it simultaneously, as again we cannot assume the multiplexing / queueing behavior of the driver. This could perhaps be made to work, but there may be additional issues that are discovered as we go along. Only way to find out is to prototype it.
Quoted 10 lines
>
> so the idea would be to check if a new method, that I have
tentatively
> calledset_property(),
> exists. If so, use the reviewed stile above, otherwise fallback
to the
> current function.
>
Quoted 9 lines
I don't see what
set_propertyis buying you. Anyway, feel free to come up with a more detailed proposal, but my impression is that this approach will quickly become way too complicated.I think now i got you. The existing function could be used, but the driver only stores the values internally because it knows it will ve called later for sending the commands.
Or we simply cache the values in the lte atom and call the driver method only when appropriate.
Regards,
-Denis
Re: [PATCH 2/7] extended support for LTE and NR. Some minor fixes. part 2 of 7
Quoted 42 lines · Denis Kenzior
Hi Giacinto,
Quoted 11 lines · Giacinto Cifelli
hi Denis,
On Thu, 20 Sep 2018, 18:31 Denis Kenzior, <[email protected] <mailto:[email protected]>> wrote:
Hi Giacinto,
> The idea would be to just store the values in the driver but not
in the
> module,
> and then send them before attaching, so that the verification canbe
Quoted 4 lines
> consistent and all,
> just like for the gprs-context atom.Yes, but that is not what you outlined in the code. You were
watching
Quoted 10 lines
for
SIM_STATE_READYwhich only means just that.Also note that we can bring the modem online even in
pre_simstate (e.g.
for emergency calls), in which case the lte atom doesn't exist yet.where should a hook be placed then?
this looked to me a good place, just before bringing it online. if there is no atom, no config and everything is ok anyway.That's kind of the problem, there is no good place. The only thing you can do is have the core apply settings, if available, just prior to the
set_onlinedriver call. However, it is tricky to do so:- We're in pre-sim state and go online for emergency calls. This is okay as no LTE atom is created. If a SIM is initialized / inserted at this point, the modem can re-connect with a proper default settings. The LTE atom creation and modem performing a re-connect is now a race. Admittedly the solution we have today also suffers from this problem, so maybe there's not much we can do here.
Quoted 8 lines
- We're offline and going online. You need to perform the online operation as a transaction. First setting the default attach details and then actually setting the modem online. We can't do it simultaneously, as again we cannot assume the multiplexing / queueing behavior of the driver. This could perhaps be made to work, but there may be additional issues that are discovered as we go along. Only way to find out is to prototype it.
ok, the AT driver is piping the commands, and I am going to implement it for it.
Admittedly, for another driver could be more difficult (MBIM also pipes them),
but there is still the possibility to set directly the parameters as they are today,
not implementing this function in the atom (NULL function or simply returning).
Quoted 16 lines
Quoted 11 lines
>
> so the idea would be to check if a new method, that I have
tentatively
> calledset_property(),
> exists. If so, use the reviewed stile above, otherwise fallback
to the
> current function.
>I don't see what
set_propertyis buying you. Anyway, feel free tocome
Quoted 4 lines
up with a more detailed proposal, but my impression is that this approach will quickly become way too complicated.
Quoted 8 lines
Quoted 4 lines
I think now i got you. The existing function could be used, but the driver only stores the values internally because it knows it will ve called later for sending the commands.
Or we simply cache the values in the lte atom and call the driver method only when appropriate.
I believe it is better to call the atom and let it decide what to do, in part to mitigate the issues above.
Quoted 3 lines
Regards,
-Denis
with this, I am good to go, I will try to prototype this new behavior.
Regards.
Giacinto
PATCH 3/7 extended support for LTE and NR. Some minor fixes. part 3 of 7
In reply to Giacinto Cifelli--- drivers/atmodem/atutil.h | 14 + drivers/atmodem/cbs.c | 1 + drivers/atmodem/gprs-context.c | 2 + drivers/atmodem/gprs.c | 554 ++++++++++++++++-- drivers/atmodem/lte.c | 283 ++++++++- drivers/atmodem/network-registration.c | 134 +++-- drivers/atmodem/sim.c | 10 +- drivers/atmodem/sms.c | 21 +- drivers/atmodem/vendor.h | 1 + drivers/gemaltomodem/gemaltomodem.c | 5 +- drivers/gemaltomodem/gemaltomodem.h | 19 +- drivers/gemaltomodem/gprs-context-wwan.c | 445 ++++++++++++++ drivers/gemaltomodem/voicecall.c | 965 +++++++++++++++++++++++++++++++ drivers/mbimmodem/gprs-context.c | 2 + drivers/mbimmodem/mbim.c | 3 + drivers/mbimmodem/mbimmodem.c | 2 +- drivers/rilmodem/call-forwarding.c | 2 +- drivers/rilmodem/network-registration.c | 2 +- 18 files changed, 2343 insertions(+), 122 deletions(-) create mode 100644 drivers/gemaltomodem/gprs-context-wwan.c create mode 100644 drivers/gemaltomodem/voicecall.c
drivers/atmodem/atutil.h +14 -0
@@ -115,6 +115,20 @@ static inline int at_util_convert_signal_strength(int strength)return result; } +static inline int at_util_convert_signal_strength_cesq (int strength_GSM,int strength_UTRAN,int strength_EUTRAN) +{ +int result =-1 ; + +if (strength_GSM !=99 ) + result = (strength_GSM *100 ) /63 ; +else if (strength_UTRAN !=255 ) + result = (strength_UTRAN *100 ) /96 ; +else if (strength_EUTRAN !=255 ) + result = (strength_EUTRAN *100 ) /97 ; + +return result; +} + #define CALLBACK_WITH_FAILURE(cb, args...) \ do { \ struct ofono_error cb_e; \
drivers/atmodem/cbs.c +1 -0
@@ -166,6 +166,7 @@ static void at_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,switch (data->vendor) {case OFONO_VENDOR_GOBI :case OFONO_VENDOR_QUALCOMM_MSM : +case OFONO_VENDOR_GEMALTO :g_at_chat_send (data->chat,"AT+CSCB=0" , none_prefix,NULL ,NULL ,NULL );break ;
drivers/atmodem/gprs-context.c +2 -0
@@ -304,6 +304,8 @@ static void at_gprs_activate_primary(struct ofono_gprs_context *gc,snprintf (buf + len,sizeof (buf) - len -3 ,",\"PAP:%s\"" , ctx->apn);break ; +default : +break ; }break ;default :
drivers/atmodem/gprs.c +494 -60
718 lines not on this page · raw message
drivers/atmodem/lte.c +271 -12
334 lines not on this page · raw message
drivers/atmodem/network-registration.c +101 -33
239 lines not on this page · raw message
drivers/atmodem/sim.c +5 -5
@@ -66,7 +66,7 @@ static const char *oercn_prefix[] = { "_OERCN:", NULL };static const char *cpinr_prefixes[] = {"+CPINR:" ,"+CPINRE:" ,NULL };static const char *epin_prefix[] = {"*EPIN:" ,NULL };static const char *simcom_spic_prefix[] = {"+SPIC:" ,NULL }; -static const char *cinterion_spic_prefix[] = {"^SPIC:" ,NULL }; +static const char *gemalto_spic_prefix[] = {"^SPIC:" ,NULL };static const char *pct_prefix[] = {"#PCT:" ,NULL };static const char *pnnm_prefix[] = {"+PNNM:" ,NULL };static const char *qpinc_prefix[] = {"+QPINC:" ,NULL };
@@ -1110,7 +1110,7 @@ error:CALLBACK_WITH_FAILURE (cb,NULL , cbd->data); } -static void cinterion_spic_cb (gboolean ok,GAtResult *result, +static void gemalto_spic_cb (gboolean ok,GAtResult *result,gpointer user_data) {struct cb_data *cbd = user_data;
@@ -1227,9 +1227,9 @@ static void at_pin_retries_query(struct ofono_sim *sim, upincnt_cb, cbd, g_free) > 0)return ;break ; -case OFONO_VENDOR_CINTERION : -if (g_at_chat_send (sd->chat,"AT^SPIC" , cinterion_spic_prefix, - cinterion_spic_cb, cbd, g_free) >0 ) +case OFONO_VENDOR_GEMALTO : +if (g_at_chat_send (sd->chat,"AT^SPIC" , gemalto_spic_prefix, + gemalto_spic_cb, cbd, g_free) >0 )return ;break ;default :
drivers/atmodem/sms.c +14 -7
@@ -219,10 +219,16 @@ static void at_cmgs(struct ofono_sms *sms, const unsigned char *pdu,char buf[512 ];int len; -if (mms) { -snprintf (buf,sizeof (buf),"AT+CMMS=%d" , mms); -g_at_chat_send (data->chat, buf, none_prefix, -NULL ,NULL ,NULL ); +switch (data->vendor) { +case OFONO_VENDOR_GEMALTO : +break ; +default : +if (mms) { +snprintf (buf,sizeof (buf),"AT+CMMS=%d" , mms); +g_at_chat_send (data->chat, buf, none_prefix, +NULL ,NULL ,NULL ); + } +break ; } len =snprintf (buf,sizeof (buf),"AT+CMGS=%d\r" , tpdu_len);
@@ -329,7 +335,7 @@ static inline void at_ack_delivery(struct ofono_sms *sms)/* We must acknowledge the PDU using CNMA */ if (data->cnma_ack_pdu) {switch (data->vendor) { -case OFONO_VENDOR_CINTERION : +case OFONO_VENDOR_GEMALTO :snprintf (buf,sizeof (buf),"AT+CNMA=1" );break ;default :
@@ -411,10 +417,10 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data) goto err;switch (data->vendor) { -case OFONO_VENDOR_CINTERION : +case OFONO_VENDOR_GEMALTO :if (!g_at_result_iter_next_number (&iter, &tpdu_len)) {/* -* Some cinterions modems (ALS3,PLS8...), act in +* Some Gemalto modems (ALS3,PLS8...), act in * accordance with 3GPP 27.005. So we need to skip * the first (<alpha>) field * \r\n+CMT: ,23\r\nCAFECAFECAFE... ...\r\n
@@ -455,6 +461,7 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)if (data->vendor !=OFONO_VENDOR_SIMCOM )at_ack_delivery (sms); +return ; err:ofono_error ("Unable to parse CMT notification" );
drivers/atmodem/vendor.h +1 -0
@@ -49,4 +49,5 @@ enum ofono_vendor {OFONO_VENDOR_UBLOX_TOBY_L2 ,OFONO_VENDOR_CINTERION ,OFONO_VENDOR_XMM , + OFONO_VENDOR_GEMALTO, };
drivers/gemaltomodem/gemaltomodem.c +4 -1
@@ -35,13 +35,16 @@static int gemaltomodem_init (void ) {gemalto_location_reporting_init (); - +gemaltowwan_gprs_context_init (); +gemalto_voicecall_init ();return 0 ; }static void gemaltomodem_exit (void ) {gemalto_location_reporting_exit (); +gemaltowwan_gprs_context_exit (); +gemalto_voicecall_exit (); } OFONO_PLUGIN_DEFINE(gemaltomodem, "Gemalto modem driver", VERSION,
drivers/gemaltomodem/gemaltomodem.h +18 -1
@@ -19,7 +19,24 @@* */ -#include <drivers/atmodem/atutil.h> +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <glib.h> +#include <gatchat.h> + +#define OFONO_API_SUBJECT_TO_CHANGE +#include <ofono/plugin.h> +#include <ofono/types.h> + +#include <drivers/atmodem/atmodem.h> extern void gemalto_location_reporting_init ();extern void gemalto_location_reporting_exit (); + +extern void gemaltowwan_gprs_context_init (); +extern void gemaltowwan_gprs_context_exit (); + +extern void gemalto_voicecall_init (); +extern void gemalto_voicecall_exit ();
drivers/gemaltomodem/gprs-context-wwan.c new file +445 -0
445 lines not on this page · raw message
drivers/gemaltomodem/voicecall.c new file +965 -0
965 lines not on this page · raw message
drivers/mbimmodem/gprs-context.c +2 -0
@@ -75,6 +75,8 @@ static uint32_t auth_method_to_auth_protocol(enum ofono_gprs_auth_method method)return 2 ;/* MBIMAuthProtocolChap */ case OFONO_GPRS_AUTH_METHOD_PAP :return 1 ;/* MBIMAuthProtocolPap */ +default : +return 0 ; }return 0 ;
drivers/mbimmodem/mbim.c +3 -0
@@ -781,6 +781,9 @@ static bool open_read_handler(struct l_io *io, void *user_data)/* Grab OPEN_DONE Status field */ if (l_get_le32 (buf) !=0 ) {close (fd); +if (device->disconnect_handler) + device->disconnect_handler (device->ready_data); + device->is_ready = false;return false; }
drivers/mbimmodem/mbimmodem.c +1 -1
@@ -33,7 +33,7 @@ static int mbimmodem_init(void)mbim_devinfo_init ();mbim_sim_init ();mbim_netreg_init (); -mbim_sms_exit (); +mbim_sms_init ();mbim_gprs_init ();mbim_gprs_context_init ();return 0 ;
drivers/rilmodem/call-forwarding.c +1 -1
@@ -38,7 +38,7 @@#include <ofono/call-forwarding.h> #include "common.h" -#pragma GCC diagnostic ignored "-Wrestrict" +//#pragma GCC diagnostic ignored "-Wrestrict" #include "gril.h"
drivers/rilmodem/network-registration.c +1 -1
@@ -37,7 +37,7 @@#include <ofono/modem.h> #include <ofono/netreg.h> -#pragma GCC diagnostic ignored "-Wrestrict" +//#pragma GCC diagnostic ignored "-Wrestrict" #include <gril/gril.h>
Signature · 1 line
1.9.1
Re: [PATCH 3/7] extended support for LTE and NR. Some minor fixes. part 3 of 7
Hi Giacinto,
Quoted 20 lines · Giacinto Cifelli
--- drivers/atmodem/atutil.h | 14 + drivers/atmodem/cbs.c | 1 + drivers/atmodem/gprs-context.c | 2 + drivers/atmodem/gprs.c | 554 ++++++++++++++++-- drivers/atmodem/lte.c | 283 ++++++++- drivers/atmodem/network-registration.c | 134 +++-- drivers/atmodem/sim.c | 10 +- drivers/atmodem/sms.c | 21 +- drivers/atmodem/vendor.h | 1 + drivers/gemaltomodem/gemaltomodem.c | 5 +- drivers/gemaltomodem/gemaltomodem.h | 19 +- drivers/gemaltomodem/gprs-context-wwan.c | 445 ++++++++++++++ drivers/gemaltomodem/voicecall.c | 965 +++++++++++++++++++++++++++++++ drivers/mbimmodem/gprs-context.c | 2 + drivers/mbimmodem/mbim.c | 3 + drivers/mbimmodem/mbimmodem.c | 2 +- drivers/rilmodem/call-forwarding.c | 2 +- drivers/rilmodem/network-registration.c | 2 +- 18 files changed, 2343 insertions(+), 122 deletions(-)
Quoted 3 lines
create mode 100644
drivers/gemaltomodem/gprs-context-wwan.ccreate mode 100644drivers/gemaltomodem/voicecall.c
I'm not going to even bother looking at this until it is broken up properly and actually has a commit description that is longer than an empty string.
Regards,
-Denis
PATCH 4/7 extended support for LTE and NR. Some minor fixes. part 4 of 7
In reply to Giacinto Cifelli--- doc/emergency-call-handling.txt | 2 +- doc/lte-api.txt | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-)
doc/emergency-call-handling.txt +1 -1
@@ -14,7 +14,7 @@ What oFono will do: - Post online atoms will be created. - Upon reception of Dial request, Emergency mode is activated. - Once the call is ended, Emergency mode is deactivated. - - Modem remains in online mode with full funcationality. + - Modem remains in online mode with full functionality. Case 2: Call in SIM Present and PIN required state
doc/lte-api.txt +36 -1
@@ -25,11 +25,46 @@ Signals PropertyChanged(string property, variant value) This signal indicates a changed value of the given property. -Properties string DefaultAccessPointName [readwrite] +Properties string Protocol [readwrite] + + Holds the protocol for this context. Valid values + are: "ip", "ipv6" and "dual". + + string AccessPointName [readwrite] On LongTermEvolution, contexts activate automatically. This property allows selection of an APN to be used on next automatic activation. + By setting this property AT+CGDCONT is sent, + followed by AT+CGAUTH if needed. Setting this property to an empty string clears the default APN from the modem. + + string AuthenticationMethod [readwrite] + + Sets the Method used for the authentication + for the default APN. + The authentication information is sent to the module + when the AccessPointName property is set + + Available values are "none", "pap" and "chap". + Default is "none". + + "pap" and "chap" authentication methods require + both Username and Password set to nonempty values + + string Username [readwrite] + + Holds the username to be used for authentication + purposes. + The authentication information is sent to the module + when the AccessPointName property is set + + string Password [readwrite] + + Holds the password to be used for authentication + purposes. + The authentication information is sent to the module + when the AccessPointName property is set +
Signature · 1 line
1.9.1
PATCH 5/7 extended support for LTE and NR. Some minor fixes. part 5 of 7
In reply to Giacinto Cifelli--- gatchat/gatmux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
gatchat/gatmux.c +2 -2
@@ -30,8 +30,8 @@#include <string.h> #include <alloca.h> -#pragma GCC diagnostic ignored "-Wpragmas" -#pragma GCC diagnostic ignored "-Wcast-function-type" +//#pragma GCC diagnostic ignored "-Wpragmas" +//#pragma GCC diagnostic ignored "-Wcast-function-type" #include <glib.h>
Signature · 1 line
1.9.1
PATCH 6/7 extended support for LTE and NR. Some minor fixes. part 6 of 7
In reply to Giacinto Cifelli--- Makefile.am | 2 ++ 1 file changed, 2 insertions(+)
Makefile.am +2 -0
@@ -397,6 +397,8 @@ builtin_modules += gemaltomodem builtin_sources += drivers/atmodem/atutil.h \ drivers/gemaltomodem/gemaltomodem.h \ drivers/gemaltomodem/gemaltomodem.c \ + drivers/gemaltomodem/gprs-context-wwan.c \ + drivers/gemaltomodem/voicecall.c \ drivers/gemaltomodem/location-reporting.c builtin_modules += xmm7modem
Signature · 1 line
1.9.1
PATCH 7/7 extended support for LTE and NR. Some minor fixes. part 7 of 7
In reply to Giacinto Cifelli--- AUTHORS | 3 +++ 1 file changed, 3 insertions(+)
AUTHORS +3 -0
@@ -137,3 +137,6 @@ Varun Gargi <[email protected]> Florent Beillonnet <[email protected]> Martin Hundebøll <[email protected]> Julien Tournier <[email protected]> +Sebastian Arnd <[email protected]> +Giacinto Cifelli <[email protected]> +Martin Baschin <[email protected]>
Signature · 1 line
1.9.1
Quoted 10 lines · Giacinto Cifelli
--- include/gprs-context.h | 1 + include/lte.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)include/gprs-context.h +0
-0
include/gprs-context.h enum ofono_gprs_context_type { · line 60
Quoted 4 lines
include/gprs-context.h +1
-0@@ -57,6 +57,7 @@ enum ofono_gprs_context_type {enum ofono_gprs_auth_method {OFONO_GPRS_AUTH_METHOD_CHAP =0 ,OFONO_GPRS_AUTH_METHOD_PAP , +OFONO_GPRS_AUTH_METHOD_NONE ,
I think there should be OFONO_GPRS_AUTH_METHOD_ANY (or OFONO_GPRS_AUTH_METHOD_PAP_CHAP) here as well, for completeness. Many modems support that too (and we had to add it in our fork).
Quoted 18 lines
include/gprs-context.h +0
-0};struct ofono_gprs_primary_context {include/lte.h +1
-0@@ -3,6 +3,7 @@* oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. +* Copyright (C) 2018 Gemalto M2M * * 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 @@ -28,14 +29,18 @@ extern "C" {#include <ofono/types.h>
include/lte.h extern "C" { · line 38
Quoted 10 lines
include/lte.h +4
-2-struct ofono_lte ; -struct ofono_lte_default_attach_info {char apn[OFONO_GPRS_MAX_APN_LENGTH +1 ]; +enum ofono_gprs_proto proto; +enum ofono_gprs_auth_method auth_method; +char username[OFONO_GPRS_MAX_USERNAME_LENGTH +1 ]; +char password[OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ]; };
This is starting to look suspiciously similar to struct ofono_gprs_primary_context (the only thing left is cid). Is it really necessary to maintain two copies of essentially the same structure or is there some room for unification here?
Cheers,
-Slava
Quoted 6 lines · Slava Monich
Quoted 5 lines · Giacinto Cifelli
--- include/gprs-context.h | 1 + include/lte.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
Quoted 15 lines
include/gprs-context.h enum ofono_gprs_context_type { · line 60
Quoted 9 lines
include/gprs-context.h +1
-0@@ -57,6 +57,7 @@ enum ofono_gprs_context_type {enum ofono_gprs_auth_method {OFONO_GPRS_AUTH_METHOD_CHAP =0 ,OFONO_GPRS_AUTH_METHOD_PAP , +OFONO_GPRS_AUTH_METHOD_NONE ,I think there should be
OFONO_GPRS_AUTH_METHOD_ANY(orOFONO_GPRS_AUTH_METHOD_PAP_CHAP) here as well, for completeness. Many modems support that too (and we had to add it in our fork).
I agree. Let me collect all comments, then I will also add it. I would favour also renumbering with NONE on top, but I am not sure of the side effects everywhere, in case the values are used directly in commands.
Quoted 21 lines
Quoted 9 lines
include/gprs-context.h +0
-0};struct ofono_gprs_primary_context {include/lte.h +0
-0include/lte.h line 8
Quoted 6 lines
include/lte.h +1
-0@@ -3,6 +3,7 @@* oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. +* Copyright (C) 2018 Gemalto M2M * * This program is free software; you can redistribute it and/or modify
Quoted 5 lines
include/lte.h +0
-0* it under the terms of the GNU General Public License version 2 as @@ -28,14 +29,18 @@ extern "C" {#include <ofono/types.h>
Quoted 16 lines
include/lte.h extern "C" { · line 38
Quoted 9 lines
include/lte.h +4
-2-struct ofono_lte ; -struct ofono_lte_default_attach_info {char apn[OFONO_GPRS_MAX_APN_LENGTH +1 ]; +enum ofono_gprs_proto proto; +enum ofono_gprs_auth_method auth_method; +char username[OFONO_GPRS_MAX_USERNAME_LENGTH +1 ]; +char password[OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ]; };This is starting to look suspiciously similar to struct
ofono_gprs_primary_context(the only thing left is cid). Is it really necessary to maintain two copies of essentially the same structure or is there some room for unification here?
There is a lot of duplication between gprs and lte, yes, if you look in the rest of the patches there is a lot in common.
I havent found a way to do it smoothly. I even had to copy the gprs_proto_to/from_string, gprs_auth_method_to/from_string in src/gprs.c in src/lte.c, because I could not export them in common.c (without removing the enums).
If there is a smart way to do it, I am more than willing to recraft the code. Like this every change is to be duplicated.
Quoted 3 lines
Cheers,
-Slava
Regards,
Giacinto
_______________________________________________
Quoted 4 lines
ofono mailing list
ofono(a)ofono.org
https://lists.ofono.org/mailman/listinfo/ofono
Hi Giacinto,
Quoted 3 lines
I would favour also renumbering with NONE on top, but I am not sure of the side effects everywhere, in case the values are used directly in commands.
Actually there is no problem doing that. The internal API is not stable. Besides, it will give all the guys who insist on maintaining out-of-tree plugins some extra work ;)
Regards,
-Denis
Quoted 10 lines · Denis Kenzior
Hi Giacinto,
Quoted 3 lines
I would favour also renumbering with NONE on top, but I am not sure of the side effects everywhere, in case the values are used directly in commands.
Actually there is no problem doing that. The internal API is not stable. Besides, it will give all the guys who insist on maintaining out-of-tree plugins some extra work ;)
Anything in include is external API. We do maintain not just out-of-tree, but binary plugins. Backward (binary!) compatibility a must for us. Please do not break it.
-Slava
Hi Slava,
Quoted 3 lines
Anything in include is external API. We do maintain not just out-of-tree, but binary plugins. Backward (binary!) compatibility a must for us. Please do not break it.
That is why we have 'OFONO_API_SUBJECT_TO_CHANGE' as a reminder. We mean it. D-Bus API is stable, we never made any guarantees about the internal APIs.
Regards,
-Denis
Quoted 10 lines · Denis Kenzior
Hi Slava,
Quoted 3 lines
Anything in include is external API. We do maintain not just out-of-tree, but binary plugins. Backward (binary!) compatibility a must for us. Please do not break it.
That is why we have '
OFONO_API_SUBJECT_TO_CHANGE' as a reminder. We mean it. D-Bus API is stable, we never made any guarantees about the internal APIs.
I understand that! It makes things easier for you guys.
But we had to avoid certain compile-time dependencies in ofono, and a straightforward (and perhaps the only) way to achieve that was to use binary plugins. For us plugin API is not subject to change (plugins don't necessarily get upgraded together with ofono), meaning more changes between our fork and upstream in case if upstream breaks it, more maintenance work and more room for errors. Obviously, I would like to keep differences to a minimum.
I'm just humbly asking - if there's a way to keep plugin API backward compatible, please do it that way. There is at least one person in the world who would appreciate it.
Cheers,
-Slava
Quoted 22 lines · Slava Monich
Quoted 10 lines · Denis Kenzior
Hi Slava,
Quoted 3 lines
Anything in include is external API. We do maintain not just out-of-tree, but binary plugins. Backward (binary!) compatibility a must for us. Please do not break it.
That is why we have '
OFONO_API_SUBJECT_TO_CHANGE' as a reminder. We mean it. D-Bus API is stable, we never made any guarantees about the internal APIs.I understand that! It makes things easier for you guys.
But we had to avoid certain compile-time dependencies in ofono, and a straightforward (and perhaps the only) way to achieve that was to use binary plugins. For us plugin API is not subject to change (plugins don't necessarily get upgraded together with ofono), meaning more changes between our fork and upstream in case if upstream breaks it, more maintenance work and more room for errors. Obviously, I would like to keep differences to a minimum.
Quoted 5 lines
I'm just humbly asking - if there's a way to keep plugin API backward compatible, please do it that way. There is at least one person in the world who would appreciate it.
Hi Slava,
this special case will not be backward compatible.
This enum for the authentication methods is handled through switch/cases in the code, and some of them miss default. so an additional value will give an unpredictable behavior (depending also on how the switch has been optimized by the compiler).
Do you think it still makes sense to add an OFONO_GPRS_AUTH_METHOD_ANY ? It looks like Denis will not take it anyway if it is not explained clearly what it is for and how it is used. I have to say, I cannot see its benefit either.
Quoted 6 lines
Cheers,
-Slava
_______________________________________________
ofono mailing list
ofono(a)ofono.org
https://lists.ofono.org/mailman/listinfo/ofono
BR,
Giacinto
Quoted 22 lines · Slava Monich
Quoted 10 lines · Denis Kenzior
Hi Slava,
Quoted 3 lines
Anything in include is external API. We do maintain not just out-of-tree, but binary plugins. Backward (binary!) compatibility a must for us. Please do not break it.
That is why we have '
OFONO_API_SUBJECT_TO_CHANGE' as a reminder. We mean it. D-Bus API is stable, we never made any guarantees about the internal APIs.I understand that! It makes things easier for you guys.
But we had to avoid certain compile-time dependencies in ofono, and a straightforward (and perhaps the only) way to achieve that was to use binary plugins. For us plugin API is not subject to change (plugins don't necessarily get upgraded together with ofono), meaning more changes between our fork and upstream in case if upstream breaks it, more maintenance work and more room for errors. Obviously, I would like to keep differences to a minimum.
Quoted 4 lines
I'm just humbly asking - if there's a way to keep plugin API backward compatible, please do it that way. There is at least one person in the world who would appreciate it.
Actually, in our fork we have already modified enum ofono_gprs_auth_method and that's what we have there:
enum ofono_gprs_auth_method {
OFONO_GPRS_AUTH_METHOD_ANY = 0,
OFONO_GPRS_AUTH_METHOD_NONE,
OFONO_GPRS_AUTH_METHOD_CHAP,
OFONO_GPRS_AUTH_METHOD_PAP,
};
(ANY = PAP_CHAP, and don't ask me why we added new values to the beginning of the enum - it was before we started using binary plugins). I would be more than happy if upstream started to use the same enum!
Cheers,
-Slava
Hi Slava,
Quoted 9 lines
Quoted 9 lines
I understand that! It makes things easier for you guys.
But we had to avoid certain compile-time dependencies in ofono, and a straightforward (and perhaps the only) way to achieve that was to use binary plugins. For us plugin API is not subject to change (plugins don't necessarily get upgraded together with ofono), meaning more changes between our fork and upstream in case if upstream breaks it, more maintenance work and more room for errors. Obviously, I would like to keep differences to a minimum.
So I sympathize, but really it might also be a hint to finally start getting things upstream.
Quoted 5 lines
Quoted 5 lines
I'm just humbly asking - if there's a way to keep plugin API backward compatible, please do it that way. There is at least one person in the world who would appreciate it.
The problem is, the next time this comes up there may be no way to avoid it... Or we break binary compatibility inadvertently. It is just not something we're going to be looking out for.
Quoted 10 lines
Actually, in our fork we have already modified enum
ofono_gprs_auth_methodand that's what we have there:enum
ofono_gprs_auth_method{
OFONO_GPRS_AUTH_METHOD_ANY= 0,
OFONO_GPRS_AUTH_METHOD_NONE,
OFONO_GPRS_AUTH_METHOD_CHAP,
OFONO_GPRS_AUTH_METHOD_PAP,
};
So you already made life very hard for yourself ;)
Quoted 5 lines
(ANY =
PAP_CHAP, and don't ask me why we added new values to the beginning of the enum - it was before we started using binary plugins). I would be more than happy if upstream started to use the same enum!
That assumes that we should support your METHOD_ANY thing. I've not heard any good arguments for that yet...
Regards,
-Denis
Quoted 8 lines · Denis Kenzior
Quoted 5 lines
(ANY =
PAP_CHAP, and don't ask me why we added new values to the beginning of the enum - it was before we started using binary plugins). I would be more than happy if upstream started to use the same enum!That assumes that we should support your
METHOD_ANYthing. I've not heard any good arguments for that yet...
At least one Chinese modem I dealt with had AT+ EGPAU = <op>,<cid>, <proto> where <proto> is 0 for PAP, 1 for CHAP, 2 for NONE and 3 for PAP_CHAP. Also, Android RIL interface has value 3 reserved for PAP&CHAP (see ril.h for older Androids and ApnAuthType in binder radio interface for Android 8+). To me that sounds like a valid use case.
-Slava
Hi Slava,
Quoted 7 lines · Slava Monich
Quoted 6 lines · Denis Kenzior
Quoted 5 lines
(ANY =
PAP_CHAP, and don't ask me why we added new values to the beginning of the enum - it was before we started using binary plugins). I would be more than happy if upstream started to use the same enum!
Quoted 8 lines
Quoted 2 lines
That assumes that we should support your
METHOD_ANYthing. I've not heard any good arguments for that yet...At least one Chinese modem I dealt with had AT+ EGPAU = <op>,<cid>, <proto> where <proto> is 0 for PAP, 1 for CHAP, 2 for NONE and 3 for
PAP_CHAP. Also, Android RIL interface has value 3 reserved for PAP&CHAP (seeril.hfor older Androids and ApnAuthType in binder radio interface for Android 8+). To me that sounds like a valid use case.
So I went in and checked (someone can correct me if I'm wrong)
- The three-four generations of Intel modems I checked do not support this
- QMI doesn't support this
- MBIM doesn't support this (but supports MSChap/MSChapV2, funnily enough)
- 3GPP doesn't support this
- Telit doesn't support this
- Model Broadband Provider Info doesn't support this
Are you sure it isn't some weird vendor feature where they try all possibilities one at a time? E.g. it tries CHAP first, then tries PAP, then tries None?
And how do you plan on supporting this on modems that physically do not support such an enumeration? What would be the exact semantics? Is this modem supported by oFono upstream?
This conversation is moot until you introduce support for such a modem or more specific information is introduced. And until / unless this happens, we're not introducing random enumerations into the D-Bus API that we have to live with for a long time.
Regards,
-Denis
Hi Slava,
Quoted 6 lines · Slava Monich
Quoted 5 lines · Giacinto Cifelli
---
include/gprs-context.h| 1 +
include/lte.h | 11 +++++++++--2 files changed, 10 insertions(+), 2 deletions(-)
Quoted 13 lines
include/gprs-context.h enum ofono_gprs_context_type { · line 60
Quoted 9 lines
include/gprs-context.h +1
-0@@ -57,6 +57,7 @@ enum ofono_gprs_context_type { enum ofono_gprs_auth_method { OFONO_GPRS_AUTH_METHOD_CHAP = 0, OFONO_GPRS_AUTH_METHOD_PAP, + OFONO_GPRS_AUTH_METHOD_NONE,I think there should be
OFONO_GPRS_AUTH_METHOD_ANY(orOFONO_GPRS_AUTH_METHOD_PAP_CHAP) here as well, for completeness. Many modems support that too (and we had to add it in our fork).
There is no such thing in 3GPP, so how does that work?
And by the way, none of the provisioning databases I'm aware of have this possibility and CHAP is actually a sane default. While there are probably 2 providers left on this planet that might still insist on PAP, the 3GPP specs actually mandate CHAP anyway.
Quoted 25 lines
Quoted 25 lines
include/gprs-context.h +0
-0}; struct ofono_gprs_primary_context {include/lte.h +1
-0@@ -3,6 +3,7 @@ * oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. + * Copyright (C) 2018 Gemalto M2M * * This program is free software; you can redistribute it and/ormodify
* it under the terms of the GNU General Public License version 2 asinclude/lte.h +2
-2@@ -28,14 +29,18 @@ extern "C" { #include <ofono/types.h> -struct ofono_lte ; - struct ofono_lte_default_attach_info { char apn[OFONO_GPRS_MAX_APN_LENGTH + 1]; + enum ofono_gprs_proto proto; + enum ofono_gprs_auth_method auth_method;
Quoted 9 lines
include/lte.h extern "C" { · line 38
Quoted 3 lines
include/lte.h +2
-0+ char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1]; + char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1]; };This is starting to look suspiciously similar to struct
ofono_gprs_primary_context(the only thing left is cid). Is it really necessary to maintain two copies of essentially the same structure or is there some room for unification here?
I don't really see a problem here. One is active context details, the other is default attach details. But if OFONO_GPRS_* defines are going to be used in multiple include/ofono files, then these defines should be moved to types.h.
Regards,
-Denis
Hi Giacinto,
Your patch series has 7 commits with the same header. That is nonsense. Each commit header should be specific to what is contained inside and preferably followed by a commit description.
Read any one of the many 'How to submit a kernel patch' howtos in order to understand the best practices here. oFono does not use Signed-off-by lines and a few things are different, but the commit header/description requirements and the overall patch submission process are the same.
Quoted 4 lines · Giacinto Cifelli
--- include/gprs-context.h | 1 + include/lte.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
This really should be two patches because you're changing unrelated things.
include/gprs-context.h enum ofono_gprs_context_type { · line 60
Quoted 10 lines
include/gprs-context.h +1
-0@@ -57,6 +57,7 @@ enum ofono_gprs_context_type {enum ofono_gprs_auth_method {OFONO_GPRS_AUTH_METHOD_CHAP =0 ,OFONO_GPRS_AUTH_METHOD_PAP , +OFONO_GPRS_AUTH_METHOD_NONE ,
So strictly speaking we already support NONE as a method if username is empty. I don't have a problem with this change, but it does imply that you need to fix up the existing code depending on this enumeration to behave properly.
Quoted 16 lines
include/gprs-context.h +0
-0};struct ofono_gprs_primary_context {include/lte.h +1
-0@@ -3,6 +3,7 @@* oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. +* Copyright (C) 2018 Gemalto M2M * * 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
include/lte.h extern "C" { · line 32
Quoted 5 lines
include/lte.h +0
-2@@ -28,14 +29,18 @@ extern "C" {#include <ofono/types.h> -struct ofono_lte ; -
So why are you changing the order seemingly randomly? And anyway, this is wrong. See doc/coding-style.txt item M9.
include/lte.h extern "C" { · line 37
Quoted 6 lines
include/lte.h +4
-0struct ofono_lte_default_attach_info {char apn[OFONO_GPRS_MAX_APN_LENGTH +1 ]; +enum ofono_gprs_proto proto; +enum ofono_gprs_auth_method auth_method; +char username[OFONO_GPRS_MAX_USERNAME_LENGTH +1 ]; +char password[OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ];
Okay, but you might want to start at the D-Bus API level first...
Quoted 10 lines
include/lte.h +2
-0};typedef void (*ofono_lte_cb_t )(const struct ofono_error *error,void *data); +struct ofono_lte ; +struct ofono_lte_driver {const char *name;int (*probe)(struct ofono_lte *lte,unsigned int vendor,void *data);
include/lte.h void ofono_lte_set_data(struct ofono_lte *lte, void *data); · line 73
Quoted 8 lines
include/lte.h +2
-0@@ -61,6 +66,8 @@ void ofono_lte_set_data(struct ofono_lte *lte, void *data);void *ofono_lte_get_data (const struct ofono_lte *lte); +struct ofono_modem *ofono_lte_get_modem (const struct ofono_lte *lte); + > #ifdef __cplusplus }#endif
Regards,
-Denis
Quoted 11 lines · Denis Kenzior
Hi Giacinto,
Your patch series has 7 commits with the same header. That is nonsense. Each commit header should be specific to what is contained inside and preferably followed by a commit description.
Read any one of the many 'How to submit a kernel patch' howtos in order to understand the best practices here. oFono does not use Signed-off-by lines and a few things are different, but the commit header/description requirements and the overall patch submission process are the same.
Hi Denis,
I will break down things further. This series of patches is only the first one to support our modules.
I have submitted this first part also to gather comments.
From the ./HACKING file I understood that the requirement is to split according to the top-level directories only, and to make sure not to break compilation.
Definitely I will add more comments to the commits, too.
Quoted 9 lines · Giacinto Cifelli
Quoted 4 lines
--- include/gprs-context.h | 1 + include/lte.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)This really should be two patches because you're changing unrelated things.
well, this is the interesting part of this series of patches. What the lte atom does is really parallel to the gprs-context, at the end is a big code duplication.
Isn't there a smart way to reduce this?
Quoted 16 lines
include/gprs-context.h enum ofono_gprs_context_type { · line 60
Quoted 10 lines
include/gprs-context.h +1
-0@@ -57,6 +57,7 @@ enum ofono_gprs_context_type {enum ofono_gprs_auth_method {OFONO_GPRS_AUTH_METHOD_CHAP =0 ,OFONO_GPRS_AUTH_METHOD_PAP , +OFONO_GPRS_AUTH_METHOD_NONE ,So strictly speaking we already support NONE as a method if username is empty. I don't have a problem with this change, but it does imply that you need to fix up the existing code depending on this enumeration to behave properly.
already fixed in the rest of this patch series. But this implies that I will have to submit again a multi-part patch for this change.
Quoted 26 lines
Quoted 8 lines
include/gprs-context.h +0
-0};struct ofono_gprs_primary_context {include/lte.h +0
-0include/lte.h line 8
Quoted 6 lines
include/lte.h +1
-0@@ -3,6 +3,7 @@* oFono - Open Source Telephony * * Copyright (C) 2016 Endocode AG. All rights reserved. +* Copyright (C) 2018 Gemalto M2M * * This program is free software; you can redistribute it and/or modify
include/lte.h extern "C" { · line 32
Quoted 7 lines
include/lte.h +0
-2* it under the terms of the GNU General Public License version 2 as @@ -28,14 +29,18 @@ extern "C" {#include <ofono/types.h> -struct ofono_lte ; -So why are you changing the order seemingly randomly? And anyway, this is wrong. See
doc/coding-style.txtitem M9.
Quoted 9 lines
include/lte.h extern "C" { · line 37
Quoted 6 lines
include/lte.h +4
-0struct ofono_lte_default_attach_info {char apn[OFONO_GPRS_MAX_APN_LENGTH +1 ]; +enum ofono_gprs_proto proto; +enum ofono_gprs_auth_method auth_method; +char username[OFONO_GPRS_MAX_USERNAME_LENGTH +1 ]; +char password[OFONO_GPRS_MAX_PASSWORD_LENGTH +1 ];Okay, but you might want to start at the D-Bus API level first...
this means submitting a patch for the D-Bus API before the others ? In any case it has to go with the rest if it has to compile. I still haven't figured out completely how to split properly to ensure compilation.
Quoted 16 lines
include/lte.h extern "C" { · line 40
Quoted 3 lines
include/lte.h +0
-0}; typedef void (*ofono_lte_cb_t)(const struct ofono_error *error, void*data);
include/lte.h extern "C" {
Quoted 6 lines
include/lte.h +2
-0+struct ofono_lte ; +struct ofono_lte_driver {const char *name; int (*probe)(struct ofono_lte *lte, unsigned int vendor, void*data);
include/lte.h void ofono_lte_set_data(struct ofono_lte *lte, void
Quoted 1 line
include/lte.h +0
-0@@ -61,6 +66,8 @@ void ofono_lte_set_data(struct ofono_lte *lte, void*data);
Quoted 3 lines
include/lte.h +0
-0void *ofono_lte_get_data (const struct ofono_lte *lte);
Quoted 9 lines
include/lte.h void ofono_lte_set_data(struct ofono_lte *lte, void *data);
Quoted 5 lines
include/lte.h +2
-0+struct ofono_modem *ofono_lte_get_modem (const struct ofono_lte *lte); + > #ifdef __cplusplus }#endif Regards,
-Denis
Regards,
Giacinto
Hi Giacinto,
Quoted 3 lines
From the ./HACKING file I understood that the requirement is to split according to the top-level directories only, and to make sure not to break compilation.
The rule provides a baseline minimum. It also implies that sometimes breaking compilation is inevitable. So long as the entire series is results in a clean build, that is fine. Other projects are stricter here in order to not break 'git bisect' functionality. But we are not.
Quoted 1 line
Definitely I will add more comments to the commits, too.
Don't be afraid to do that. The more commits and the smaller the patches, the easier it is to review things. In fact, as a rule of thumb, it is much faster to get 10 small patches upstream than 1 big patch.
Quoted 3 lines
well, this is the interesting part of this series of patches. What the lte atom does is really parallel to the gprs-context, at the end is a big code duplication.
I see them as related but the gprs change itself can stand on its own. Also much of the duplicated code can be factored out into common.c
A good rule of thumb is to ask yourself this question: "Are these changes useful just by themselves?" If the answer is yes, then you should separate them into a distinct commit. And this is part of the reason why it is easier to get upstream when it is broken down into smaller chunks. Even if some part of the series is controversial, the other parts might not be and could easily be applied right away.
Quoted 1 line
Isn't there a smart way to reduce this?
Are you referring to the number of commits? Why would you want to?
... or code duplication? In which case yes, you need to factor things out into common.c.
Quoted 3 lines
already fixed in the rest of this patch series. But this implies that I will have to submit again a multi-part patch for this change.
Which is why a few days ago I suggested you start with a small subset to learn the process. It is far easier to re-factor smaller chunks than 3-4k of code.
Quoted 2 lines
this means submitting a patch for the D-Bus API before the others ?
Yes, preferably.
Quoted 4 lines
In any case it has to go with the rest if it has to compile. I still haven't figured out completely how to split properly to ensure compilation.
Browse git history and see how this is done if you're not sure. Our git history tends to be quite clean. But in general, this is a practical skill and like anything will take some time to get comfortable with.
Regards,
-Denis