sim800: add support for sim800 modem.
PATCH 1/3 sim800: add support for sim800 modem.
--- plugins/sim900.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 9 deletions(-)
plugins/sim900.c +80 -9
@@ -24,6 +24,7 @@#endif #include <errno.h> +#include <string.h> #include <stdlib.h> #include <glib.h> #include <gatchat.h>
@@ -60,13 +61,59 @@ static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ",static const char *none_prefix[] = {NULL }; +typedef enum type { +SIM800 , +SIM900 , +SIM_UNKNOWN , +}type_t ; +struct sim900_data {GIOChannel *device;GAtMux *mux;GAtChat * dlcs[NUM_DLC ];guint frame_size; +type_t modem_type; }; +static void set_modem_type (struct ofono_modem *modem) +{ +struct sim900_data *data =ofono_modem_get_data (modem); +const char *path =ofono_modem_get_path (modem); + +if (strstr (path,"sim800" )) + data->modem_type =SIM800 ; +else if (strstr (path,"sim900" )) + data->modem_type =SIM900 ; +else + data->modem_type =SIM_UNKNOWN ; + +} + +static void mux_ready_notify (GAtResult *result,gpointer user_data) +{ +struct ofono_modem *modem = user_data; +struct sim900_data *data =ofono_modem_get_data (modem); +struct ofono_gprs *gprs =NULL ; +struct ofono_gprs_context *gc; +static int notified =0 ; + +if (!notified) { +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , + data->dlcs[SMS_DLC ]); + + + gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL ) +return ; + + gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM , +"atmodem" , data->dlcs[GPRS_DLC ]); +if (gc) +ofono_gprs_add_context (gprs, gc); + } + +} +static int sim900_probe (struct ofono_modem *modem) {struct sim900_data *data;
@@ -79,6 +126,7 @@ static int sim900_probe(struct ofono_modem *modem)ofono_modem_set_data (modem, data); +set_modem_type (modem);return 0 ; }
@@ -111,6 +159,7 @@ static GAtChat *open_device(struct ofono_modem *modem,GHashTable *options; device =ofono_modem_get_string (modem, key); +if (device ==NULL )return NULL ;
@@ -232,6 +281,11 @@ static void setup_internal_mux(struct ofono_modem *modem) goto error; } } +if (data->modem_type ==SIM800 ) { +for (i =0 ; i<NUM_DLC ; i++) { +g_at_chat_register (data->dlcs[i],"SMS Ready" , mux_ready_notify, FALSE, modem,NULL ); + } + }ofono_modem_set_powered (modem, TRUE);
@@ -353,18 +407,20 @@ static void sim900_post_sim(struct ofono_modem *modem)DBG ("%p" , modem); -ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); -ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , +if (data->modem_type !=SIM800 ) { +ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , data->dlcs[SMS_DLC ]); - gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); -if (gprs ==NULL ) -return ; + gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL ) +return ; - gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM_SIM900 , + gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM_SIM900 ,"atmodem" , data->dlcs[GPRS_DLC ]); -if (gc) -ofono_gprs_add_context (gprs, gc); +if (gc) +ofono_gprs_add_context (gprs, gc); + } }static void sim900_post_online (struct ofono_modem *modem)
@@ -391,9 +447,24 @@ static struct ofono_modem_driver sim900_driver = { .post_online = sim900_post_online, }; + +static struct ofono_modem_driver sim800_driver = { + .name ="sim800" , + .probe = sim900_probe, + .remove = sim900_remove, + .enable = sim900_enable, + .disable = sim900_disable, + .pre_sim = sim900_pre_sim, + .post_sim = sim900_post_sim, + .post_online = sim900_post_online, +}; +static int sim900_init (void ) { -return ofono_modem_driver_register (&sim900_driver); +int ret =0 ; + ret =ofono_modem_driver_register (&sim800_driver); + ret +=ofono_modem_driver_register (&sim900_driver); +return ret; }static void sim900_exit (void )
Signature · 1 line
2.7.4
PATCH 2/3 sim800: add documentation and modify AUTHORS file
--- AUTHORS | 1 + doc/sim800-modem.txt | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 doc/sim800-modem.txt
AUTHORS +1 -0
@@ -138,3 +138,4 @@ Florent Beillonnet <[email protected]> Martin Hundebøll <[email protected]> Julien Tournier <[email protected]> Nandini Rebello <[email protected]> +Clement Viel <[email protected]>
doc/sim800-modem.txt new file +11 -0
@@ -0,0 +1,11 @@ +SIM800 modem usage +=================== + +To enable SIM800 module support you need to put the following +udev rule into appropriate file in /{etc,lib}/udev/rules.d: + +KERNEL=="ttyS2", ENV{OFONO_DRIVER}="sim800" + +Sim800 driver code is merged with sim900's. So, to add modifications to sim800 driver, sim900.c file must be edited +accordingly. +To differentiate the two modems, developpers must use the "modem_type" field of sim900_data structure.
Signature · 1 line
2.7.4
Re: [PATCH 2/3] sim800: add documentation and modify AUTHORS file
Hi Clement,
Quoted 2 lines · Clement Viel
--- AUTHORS | 1 +
Please don't include AUTHORS changes. One of the maintainers will take care of it.
Quoted 20 lines
doc/sim800-modem.txt | 11 +++++++++++ 2 files changed, 12 insertions(+)create mode 100644
doc/sim800-modem.txtAUTHORS +1
-0@@ -138,3 +138,4 @@ Florent Beillonnet <[email protected]> Martin Hundebøll <[email protected]> Julien Tournier <[email protected]> Nandini Rebello <[email protected]> +Clement Viel <[email protected]>doc/sim800-modem.txt new file +1
-0@@ -0,0 +1,11 @@ +SIM800 modem usage
doc/sim800-modem.txt line 11
Quoted 10 lines
doc/sim800-modem.txt new file +10
-0+=================== + +To enable SIM800 module support you need to put the following +udev rule into appropriate file in /{etc,lib}/udev/rules.d: + +KERNEL=="ttyS2", ENV{OFONO_DRIVER}="sim800" + +Sim800 driver code is merged with sim900's. So, to add modifications to sim800 driver, sim900.c file must be edited +accordingly. +To differentiate the two modems, developpers must use the "modem_type" field of sim900_data
typo
structure.
Quoted 1 line
Also, we can't have people hand-editing driver code to distinguish between one device and another. You've already went to the trouble of creating a separate sim800 driver (which I do not think is the right approach at all), why not take advantage of that fact with an appropriate probe() function or something?
Anyway, I still think you should be querying +CGMM or ATI or whatever to figure out the modem model automatically and not rely on the user to set this up.
Regards,
-Denis
Re: [PATCH 2/3] sim800: add documentation and modify AUTHORS file
Hi Denis,
Quoted 42 lines · Denis Kenzior
Hi Clement,
Quoted 2 lines · Clement Viel
--- AUTHORS | 1 +Please don't include AUTHORS changes. One of the maintainers will take care of it.
Quoted 30 lines
doc/sim800-modem.txt | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 doc/sim800-modem.txtAUTHORS +1
-0@@ -138,3 +138,4 @@ Florent Beillonnet <[email protected]> Martin Hundebøll <[email protected]> Julien Tournier <[email protected]> Nandini Rebello <[email protected]> +Clement Viel <[email protected]>doc/sim800-modem.txt new file +11
-0@@ -0,0 +1,11 @@ +SIM800 modem usage +=================== + +To enable SIM800 module support you need to put the following +udev rule into appropriate file in /{etc,lib}/udev/rules.d: + +KERNEL=="ttyS2", ENV{OFONO_DRIVER}="sim800" + +Sim800 driver code is merged with sim900's. So, to add modifications to sim800 driver, sim900.c file must be edited +accordingly. +To differentiate the two modems, developpers must use the "modem_type"Quoted 1 line
field of
sim900_datatypo
Quoted 8 lines
structure.
Quoted 1 line
Also, we can't have people hand-editing driver code to distinguish between one device and another. You've already went to the trouble of creating a separate sim800 driver (which I do not think is the right approach at all), why not take advantage of that fact with an appropriate
probe()function or something?
These indications were targeting developpers to warn them about the fact that sim800 and sim900 drivers are merged. I'll remove these lines
Quoted 4 lines
Anyway, I still think you should be querying +CGMM or ATI or whatever to figure out the modem model automatically and not rely on the user to set this up.
Yep this will be done.
Quoted 2 lines
Regards,
-Denis
Regards
Clem
PATCH 3/3 sim800: add udev detection
In reply to Clement Viel--- plugins/udevng.c | 1 + 1 file changed, 1 insertion(+)
plugins/udevng.c +1 -0
@@ -1300,6 +1300,7 @@ static struct { { "calypso", setup_serial_modem }, { "cinterion", setup_serial_modem }, { "nokiacdma", setup_serial_modem }, + { "sim800", setup_serial_modem }, { "sim900", setup_serial_modem }, { "wavecom", setup_wavecom }, { "tc65", setup_tc65 },
Signature · 1 line
2.7.4
Hi all,
I sent these patches 2 weeks ago and did not receive any feedback. It's not urgent at all, I was just wandering whether they'll be reviewed so I can move on :-)
Regards
Quoted 163 lines · Clement Viel
--- plugins/sim900.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 9 deletions(-)plugins/sim900.c +80
-10@@ -24,6 +24,7 @@#endif #include <errno.h> +#include <string.h> #include <stdlib.h> #include <glib.h> #include <gatchat.h> @@ -60,13 +61,59 @@ static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ",static const char *none_prefix[] = {NULL }; +typedef enum type { +SIM800 , +SIM900 , +SIM_UNKNOWN , +}type_t ; +struct sim900_data {GIOChannel *device;GAtMux *mux;GAtChat * dlcs[NUM_DLC ];guint frame_size; +type_t modem_type; }; +static void set_modem_type (struct ofono_modem *modem) +{ +struct sim900_data *data =ofono_modem_get_data (modem); +const char *path =ofono_modem_get_path (modem); + +if (strstr (path,"sim800" )) + data->modem_type =SIM800 ; +else if (strstr (path,"sim900" )) + data->modem_type =SIM900 ; +else + data->modem_type =SIM_UNKNOWN ; + +} + +static void mux_ready_notify (GAtResult *result,gpointer user_data) +{ +struct ofono_modem *modem = user_data; +struct sim900_data *data =ofono_modem_get_data (modem); +struct ofono_gprs *gprs =NULL ; +struct ofono_gprs_context *gc; +static int notified =0 ; + +if (!notified) { +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , + data->dlcs[SMS_DLC ]); + + + gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL ) +return ; + + gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM , +"atmodem" , data->dlcs[GPRS_DLC ]); +if (gc) +ofono_gprs_add_context (gprs, gc); + } + +} +static int sim900_probe (struct ofono_modem *modem) {struct sim900_data *data;@@ -79,6 +126,7 @@ static int sim900_probe(struct ofono_modem *modem)ofono_modem_set_data (modem, data); +set_modem_type (modem);return 0 ; }@@ -111,6 +159,7 @@ static GAtChat *open_device(struct ofono_modem *modem,GHashTable *options; device =ofono_modem_get_string (modem, key); +if (device ==NULL )return NULL ;@@ -232,6 +281,11 @@ static void setup_internal_mux(struct ofono_modem *modem) goto error; } } +if (data->modem_type ==SIM800 ) { +for (i =0 ; i<NUM_DLC ; i++) { +g_at_chat_register (data->dlcs[i],"SMS Ready" , mux_ready_notify, FALSE, modem,NULL ); + } + }ofono_modem_set_powered (modem, TRUE);@@ -353,18 +407,20 @@ static void sim900_post_sim(struct ofono_modem *modem)DBG ("%p" , modem); -ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); -ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , +if (data->modem_type !=SIM800 ) { +ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , data->dlcs[SMS_DLC ]); - gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); -if (gprs ==NULL ) -return ; + gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL ) +return ; - gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM_SIM900 , + gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM_SIM900 ,"atmodem" , data->dlcs[GPRS_DLC ]); -if (gc) -ofono_gprs_add_context (gprs, gc); +if (gc) +ofono_gprs_add_context (gprs, gc); + } }static void sim900_post_online (struct ofono_modem *modem)@@ -391,9 +447,24 @@ static struct ofono_modem_driver sim900_driver = { .post_online = sim900_post_online, }; + +static struct ofono_modem_driver sim800_driver = { + .name ="sim800" , + .probe = sim900_probe, + .remove = sim900_remove, + .enable = sim900_enable, + .disable = sim900_disable, + .pre_sim = sim900_pre_sim, + .post_sim = sim900_post_sim, + .post_online = sim900_post_online, +}; +static int sim900_init (void ) { -return ofono_modem_driver_register (&sim900_driver); +int ret =0 ; + ret =ofono_modem_driver_register (&sim800_driver); + ret +=ofono_modem_driver_register (&sim900_driver); +return ret; }static void sim900_exit (void ) --2.7.4
Signature · 4 lines
---- Clement Viel Tel : +33688431961 -----
Hi Clement,
Quoted 36 lines · Clement Viel
--- plugins/sim900.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 9 deletions(-)plugins/sim900.c +10
-0@@ -24,6 +24,7 @@#endif #include <errno.h> +#include <string.h> #include <stdlib.h> #include <glib.h> #include <gatchat.h> @@ -60,13 +61,59 @@ static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ",static const char *none_prefix[] = {NULL }; +typedef enum type { +SIM800 , +SIM900 , +SIM_UNKNOWN , +}type_t ; +struct sim900_data {GIOChannel *device;GAtMux *mux;GAtChat * dlcs[NUM_DLC ];guint frame_size; +type_t modem_type; }; +static void set_modem_type (struct ofono_modem *modem) +{
plugins/sim900.c static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ", · line 89
Quoted 10 lines
plugins/sim900.c +10
-0+struct sim900_data *data =ofono_modem_get_data (modem); +const char *path =ofono_modem_get_path (modem); + +if (strstr (path,"sim800" )) + data->modem_type =SIM800 ; +else if (strstr (path,"sim900" )) + data->modem_type =SIM900 ; +else + data->modem_type =SIM_UNKNOWN ; +
You can't really rely on the modem path for this. Either query the model directly or set the type based on the driver selected.
And no empty lines at the end of the function please
Quoted 15 lines
plugins/sim900.c +15
-0+} + +static void mux_ready_notify (GAtResult *result,gpointer user_data) +{ +struct ofono_modem *modem = user_data; +struct sim900_data *data =ofono_modem_get_data (modem); +struct ofono_gprs *gprs =NULL ; +struct ofono_gprs_context *gc; +static int notified =0 ; + +if (!notified) { +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , + data->dlcs[SMS_DLC ]); + +
plugins/sim900.c static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ", · line 114
Quoted 10 lines
plugins/sim900.c +10
-0+ gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL ) +return ; + + gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM , +"atmodem" , data->dlcs[GPRS_DLC ]); +if (gc) +ofono_gprs_add_context (gprs, gc); + } +
The indentation and stule is all wrong here.
Quoted 14 lines
plugins/sim900.c +3
-0+} +static int sim900_probe (struct ofono_modem *modem) {struct sim900_data *data;@@ -79,6 +126,7 @@ static int sim900_probe(struct ofono_modem *modem)ofono_modem_set_data (modem, data); +set_modem_type (modem);return 0 ; }
plugins/sim900.c static GAtChat *open_device(struct ofono_modem *modem, · line 162
Quoted 4 lines
plugins/sim900.c +1
-0@@ -111,6 +159,7 @@ static GAtChat *open_device(struct ofono_modem *modem,GHashTable *options; device =ofono_modem_get_string (modem, key); +
This change is spurious and should not be part of this commit
plugins/sim900.c static void setup_internal_mux(struct ofono_modem *modem) · line 288
Quoted 12 lines
plugins/sim900.c +5
-0if (device ==NULL )return NULL ;@@ -232,6 +281,11 @@ static void setup_internal_mux(struct ofono_modem *modem) goto error; } } +if (data->modem_type ==SIM800 ) { +for (i =0 ; i<NUM_DLC ; i++) { +g_at_chat_register (data->dlcs[i],"SMS Ready" , mux_ready_notify, FALSE, modem,NULL ); + } + }
Why do you want this notification on all ports? Isn't one enough?
Quoted 19 lines
plugins/sim900.c +5
-5ofono_modem_set_powered (modem, TRUE);@@ -353,18 +407,20 @@ static void sim900_post_sim(struct ofono_modem *modem)DBG ("%p" , modem); -ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); -ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , +if (data->modem_type !=SIM800 ) { +ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , data->dlcs[SMS_DLC ]); - gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); -if (gprs ==NULL ) -return ; + gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL )
plugins/sim900.c static void sim900_post_sim(struct ofono_modem *modem) · line 423
Quoted 10 lines
plugins/sim900.c +5
-3+return ; - gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM_SIM900 , + gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM_SIM900 ,"atmodem" , data->dlcs[GPRS_DLC ]); -if (gc) -ofono_gprs_add_context (gprs, gc); +if (gc) +ofono_gprs_add_context (gprs, gc); + }
Som SIM800 doesn't get any of these atoms?
Quoted 16 lines
plugins/sim900.c +9
-0}static void sim900_post_online (struct ofono_modem *modem)@@ -391,9 +447,24 @@ static struct ofono_modem_driver sim900_driver = { .post_online = sim900_post_online, }; + +static struct ofono_modem_driver sim800_driver = { + .name ="sim800" , + .probe = sim900_probe, + .remove = sim900_remove, + .enable = sim900_enable, + .disable = sim900_disable, + .pre_sim = sim900_pre_sim, + .post_sim = sim900_post_sim,
plugins/sim900.c static struct ofono_modem_driver sim900_driver = { · line 467
Quoted 10 lines
plugins/sim900.c +7
-1+ .post_online = sim900_post_online, +}; +static int sim900_init (void ) { -return ofono_modem_driver_register (&sim900_driver); +int ret =0 ; + ret =ofono_modem_driver_register (&sim800_driver); + ret +=ofono_modem_driver_register (&sim900_driver); +return ret;
This doesn't really work this way. The init function should either register all drivers successfully or fail.
plugins/sim900.c static struct ofono_modem_driver sim900_driver = { · line 470
Quoted 4 lines
plugins/sim900.c +0
-0}static void sim900_exit (void )
Regards,
-Denis
Hi Denis,
Thanks for the quick review !
Quoted 49 lines · Denis Kenzior
Hi Clement,
Quoted 32 lines · Clement Viel
--- plugins/sim900.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 9 deletions(-)plugins/sim900.c +10
-0@@ -24,6 +24,7 @@#endif #include <errno.h> +#include <string.h> #include <stdlib.h> #include <glib.h> #include <gatchat.h> @@ -60,13 +61,59 @@ static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ",static const char *none_prefix[] = {NULL }; +typedef enum type { +SIM800 , +SIM900 , +SIM_UNKNOWN , +}type_t ; +struct sim900_data {GIOChannel *device;GAtMux *mux;GAtChat * dlcs[NUM_DLC ];guint frame_size; +type_t modem_type; }; +static void set_modem_type (struct ofono_modem *modem) +{plugins/sim900.c static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ", · line 86
Quoted 10 lines
plugins/sim900.c +10
-0+struct sim900_data *data =ofono_modem_get_data (modem); +const char *path =ofono_modem_get_path (modem); + +if (strstr (path,"sim800" )) + data->modem_type =SIM800 ; +else if (strstr (path,"sim900" )) + data->modem_type =SIM900 ; +else + data->modem_type =SIM_UNKNOWN ; +You can't really rely on the modem path for this. Either query the model directly or set the type based on the driver selected.
Quoted 1 line
And no empty lines at the end of the function please
I'll go with the CGMM way.
Quoted 46 lines
Quoted 16 lines
plugins/sim900.c +15
-0+} + +static void mux_ready_notify (GAtResult *result,gpointer user_data) +{ +struct ofono_modem *modem = user_data; +struct sim900_data *data =ofono_modem_get_data (modem); +struct ofono_gprs *gprs =NULL ; +struct ofono_gprs_context *gc; +static int notified =0 ; + +if (!notified) { +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , + data->dlcs[SMS_DLC ]); + +plugins/sim900.c static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "SMS: ", · line 114
Quoted 10 lines
plugins/sim900.c +10
-0+ gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL ) +return ; + + gc =ofono_gprs_context_create (modem,OFONO_VENDOR_SIMCOM , +"atmodem" , data->dlcs[GPRS_DLC ]); +if (gc) +ofono_gprs_add_context (gprs, gc); + } +The indentation and stule is all wrong here.
Quoted 11 lines
plugins/sim900.c +3
-0+} +static int sim900_probe (struct ofono_modem *modem) {struct sim900_data *data;@@ -79,6 +126,7 @@ static int sim900_probe(struct ofono_modem *modem)ofono_modem_set_data (modem, data); +set_modem_type (modem);return 0 ; }plugins/sim900.c static GAtChat *open_device(struct ofono_modem *modem, · line 161
Quoted 3 lines
plugins/sim900.c +1
-0@@ -111,6 +159,7 @@ static GAtChat *open_device(struct ofono_modem *modem,GHashTable *options; device =ofono_modem_get_string (modem, key); +This change is spurious and should not be part of this commit
Quoted 13 lines
plugins/sim900.c static void setup_internal_mux(struct ofono_modem *modem) · line 288
Quoted 11 lines
plugins/sim900.c +5
-0if (device ==NULL )return NULL ;@@ -232,6 +281,11 @@ static void setup_internal_mux(struct ofono_modem *modem) goto error; } } +if (data->modem_type ==SIM800 ) { +for (i =0 ; i<NUM_DLC ; i++) { +g_at_chat_register (data->dlcs[i],"SMS Ready" , mux_ready_notify, FALSE, modem,NULL ); + } + }Why do you want this notification on all ports? Isn't one enough?
These URC's are sent on all channels so I am catching them all to ensure all channels are now ready.
Quoted 17 lines
Quoted 17 lines
plugins/sim900.c +7
-6ofono_modem_set_powered (modem, TRUE);@@ -353,18 +407,20 @@ static void sim900_post_sim(struct ofono_modem *modem)DBG ("%p" , modem); -ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); -ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , +if (data->modem_type !=SIM800 ) { +ofono_phonebook_create (modem,0 ,"atmodem" , data->dlcs[VOICE_DLC ]); +ofono_sms_create (modem,OFONO_VENDOR_SIMCOM ,"atmodem" , data->dlcs[SMS_DLC ]); - gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); -if (gprs ==NULL ) -return ; + gprs =ofono_gprs_create (modem,0 ,"atmodem" , data->dlcs[GPRS_DLC ]); +if (gprs ==NULL ) +return ; - gc = ofono_gprs_context_create(modem, OFONO_VENDOR_SIMCOM_SIM900, + gc = ofono_gprs_context_create(modem, OFONO_VENDOR_SIMCOM_SIM900,
Quoted 8 lines
plugins/sim900.c static void sim900_post_sim(struct ofono_modem *modem) · line 423
Quoted 6 lines
plugins/sim900.c +3
-2"atmodem", data->dlcs[GPRS_DLC]); -if (gc) -ofono_gprs_add_context (gprs, gc); +if (gc) +ofono_gprs_add_context (gprs, gc); + }Som SIM800 doesn't get any of these atoms?
SIM800 get these atoms by antoher way : the function setup_internal_mux registers the callback for SMS_READY URC. This is the callback that will call these atoms. The Sim800 must respect this order when using these atoms else all the interfaces won't be up even if the AT commands returned OK.
Quoted 29 lines
Quoted 15 lines
plugins/sim900.c +9
-0}static void sim900_post_online (struct ofono_modem *modem)@@ -391,9 +447,24 @@ static struct ofono_modem_driver sim900_driver = { .post_online = sim900_post_online, }; + +static struct ofono_modem_driver sim800_driver = { + .name ="sim800" , + .probe = sim900_probe, + .remove = sim900_remove, + .enable = sim900_enable, + .disable = sim900_disable, + .pre_sim = sim900_pre_sim, + .post_sim = sim900_post_sim,plugins/sim900.c static struct ofono_modem_driver sim900_driver = { · line 466
Quoted 10 lines
plugins/sim900.c +7
-1+ .post_online = sim900_post_online, +}; +static int sim900_init (void ) { -return ofono_modem_driver_register (&sim900_driver); +int ret =0 ; + ret =ofono_modem_driver_register (&sim800_driver); + ret +=ofono_modem_driver_register (&sim900_driver); +return ret;This doesn't really work this way. The init function should either register all drivers successfully or fail.
Quoted 6 lines
plugins/sim900.c static struct ofono_modem_driver sim900_driver = {
Quoted 3 lines
plugins/sim900.c +0
-0}static void sim900_exit (void )Regards,
-Denis
I'll add those remarks on the new patchset ( and i hope this one will be the one)!
Regards
Clem