* [PATCH 0/1] Add faked sim driver for hfp modem @ 2010-08-30 9:50 Zhenhua Zhang 2010-08-30 9:50 ` [PATCH 1/1] hfp: Add faked sim driver to support SIM ready Zhenhua Zhang 0 siblings, 1 reply; 6+ messages in thread From: Zhenhua Zhang @ 2010-08-30 9:50 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 170 bytes --] Hi, The hfp modem driver doesn't work after recent sim related changes. So that I fake a sim driver for hfpmodem. Please review it. Thanks! Regards, Zhenhua ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] hfp: Add faked sim driver to support SIM ready 2010-08-30 9:50 [PATCH 0/1] Add faked sim driver for hfp modem Zhenhua Zhang @ 2010-08-30 9:50 ` Zhenhua Zhang 2010-08-30 19:33 ` Gustavo F. Padovan 2010-08-30 19:50 ` Denis Kenzior 0 siblings, 2 replies; 6+ messages in thread From: Zhenhua Zhang @ 2010-08-30 9:50 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 5764 bytes --] HFP modem doesn't have IMSI at all. In order to notify SIM ready to the core, we create a special sim driver with a faked IMSI number. --- Makefile.am | 3 +- drivers/hfpmodem/hfpmodem.c | 2 + drivers/hfpmodem/hfpmodem.h | 3 + drivers/hfpmodem/sim.c | 114 +++++++++++++++++++++++++++++++++++++++++++ plugins/hfp.c | 6 ++ 5 files changed, 127 insertions(+), 1 deletions(-) create mode 100644 drivers/hfpmodem/sim.c diff --git a/Makefile.am b/Makefile.am index f31180e..a1ec0e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -187,7 +187,8 @@ builtin_sources += drivers/atmodem/atutil.h \ drivers/hfpmodem/hfpmodem.c \ drivers/hfpmodem/voicecall.c \ drivers/hfpmodem/network-registration.c \ - drivers/hfpmodem/call-volume.c + drivers/hfpmodem/call-volume.c \ + drivers/hfpmodem/sim.c builtin_modules += mbmmodem builtin_sources += drivers/atmodem/atutil.h \ diff --git a/drivers/hfpmodem/hfpmodem.c b/drivers/hfpmodem/hfpmodem.c index 4471a7b..ecbabe3 100644 --- a/drivers/hfpmodem/hfpmodem.c +++ b/drivers/hfpmodem/hfpmodem.c @@ -44,6 +44,7 @@ static int hfpmodem_init(void) hfp_voicecall_init(); hfp_netreg_init(); hfp_call_volume_init(); + hfp_sim_init(); return 0; } @@ -53,6 +54,7 @@ static void hfpmodem_exit(void) hfp_voicecall_exit(); hfp_netreg_exit(); hfp_call_volume_exit(); + hfp_sim_exit(); } OFONO_PLUGIN_DEFINE(hfpmodem, "Hands-Free Profile Driver", VERSION, diff --git a/drivers/hfpmodem/hfpmodem.h b/drivers/hfpmodem/hfpmodem.h index bf5d563..631f773 100644 --- a/drivers/hfpmodem/hfpmodem.h +++ b/drivers/hfpmodem/hfpmodem.h @@ -80,3 +80,6 @@ extern void hfp_call_volume_exit(); extern void hfp_voicecall_init(); extern void hfp_voicecall_exit(); + +extern void hfp_sim_init(); +extern void hfp_sim_exit(); diff --git a/drivers/hfpmodem/sim.c b/drivers/hfpmodem/sim.c new file mode 100644 index 0000000..e42cfb9 --- /dev/null +++ b/drivers/hfpmodem/sim.c @@ -0,0 +1,114 @@ +/* + * + * oFono - Open Source Telephony + * + * Copyright (C) 2008-2010 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#define _GNU_SOURCE +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#include <glib.h> + +#include <ofono/log.h> +#include <ofono/modem.h> +#include <ofono/sim.h> + +#include "gatchat.h" +#include "gatresult.h" +#include "hfpmodem.h" + +static void hfp_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb, + void *data) +{ + struct ofono_error error; + const char *imsi = "1234567890123456"; + + DBG("%s", imsi); + + /* + * Return the faked IMSI since HFP doesn't have IMSI. + */ + error.type = OFONO_ERROR_TYPE_NO_ERROR; + cb(&error, imsi, data); +} + +static void hfp_sim_read_binary(struct ofono_sim *sim, int fileid, + int start, int length, + ofono_sim_read_cb_t cb, void *data) +{ + DBG(""); + + CALLBACK_WITH_FAILURE(cb, NULL, 0, data); +} + +static void hfp_sim_read_info(struct ofono_sim *sim, int fileid, + ofono_sim_file_info_cb_t cb, + void *data) +{ + DBG(""); + + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data); +} + +static int hfp_sim_probe(struct ofono_sim *sim, unsigned int vendor, + void *data) +{ + ofono_sim_register(sim); + + return 0; +} + +static void hfp_sim_remove(struct ofono_sim *sim) +{ +} + +static struct ofono_sim_driver driver = { + .name = "hfpmodem", + .probe = hfp_sim_probe, + .remove = hfp_sim_remove, + .read_file_info = hfp_sim_read_info, + .read_file_transparent = hfp_sim_read_binary, + .read_file_linear = NULL, + .read_file_cyclic = NULL, + .write_file_transparent = NULL, + .write_file_linear = NULL, + .write_file_cyclic = NULL, + .read_imsi = hfp_read_imsi, + .query_passwd_state = NULL, + .send_passwd = NULL, + .reset_passwd = NULL, + .lock = NULL, + .change_passwd = NULL, + .query_locked = NULL, +}; + +void hfp_sim_init() +{ + ofono_sim_driver_register(&driver); +} + +void hfp_sim_exit() +{ + ofono_sim_driver_unregister(&driver); +} diff --git a/plugins/hfp.c b/plugins/hfp.c index 9a892db..612fe0d 100644 --- a/plugins/hfp.c +++ b/plugins/hfp.c @@ -40,6 +40,7 @@ #include <ofono/netreg.h> #include <ofono/voicecall.h> #include <ofono/call-volume.h> +#include <ofono/sim.h> #include <drivers/hfpmodem/hfpmodem.h> @@ -649,12 +650,17 @@ static int hfp_disable(struct ofono_modem *modem) static void hfp_pre_sim(struct ofono_modem *modem) { struct hfp_data *data = ofono_modem_get_data(modem); + struct ofono_sim *sim; DBG("%p", modem); ofono_voicecall_create(modem, 0, "hfpmodem", data); ofono_netreg_create(modem, 0, "hfpmodem", data); ofono_call_volume_create(modem, 0, "hfpmodem", data); + sim = ofono_sim_create(modem, 0, "hfpmodem", data); + + if (sim) + ofono_sim_inserted_notify(sim, TRUE); } static void hfp_post_sim(struct ofono_modem *modem) -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] hfp: Add faked sim driver to support SIM ready 2010-08-30 9:50 ` [PATCH 1/1] hfp: Add faked sim driver to support SIM ready Zhenhua Zhang @ 2010-08-30 19:33 ` Gustavo F. Padovan 2010-08-30 19:50 ` Denis Kenzior 1 sibling, 0 replies; 6+ messages in thread From: Gustavo F. Padovan @ 2010-08-30 19:33 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 5268 bytes --] Hi Zhenhua, * Zhenhua Zhang <zhenhua.zhang@intel.com> [2010-08-30 17:50:17 +0800]: > HFP modem doesn't have IMSI at all. In order to notify SIM ready to the > core, we create a special sim driver with a faked IMSI number. > --- > Makefile.am | 3 +- > drivers/hfpmodem/hfpmodem.c | 2 + > drivers/hfpmodem/hfpmodem.h | 3 + > drivers/hfpmodem/sim.c | 114 +++++++++++++++++++++++++++++++++++++++++++ > plugins/hfp.c | 6 ++ > 5 files changed, 127 insertions(+), 1 deletions(-) > create mode 100644 drivers/hfpmodem/sim.c > > diff --git a/Makefile.am b/Makefile.am > index f31180e..a1ec0e7 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -187,7 +187,8 @@ builtin_sources += drivers/atmodem/atutil.h \ > drivers/hfpmodem/hfpmodem.c \ > drivers/hfpmodem/voicecall.c \ > drivers/hfpmodem/network-registration.c \ > - drivers/hfpmodem/call-volume.c > + drivers/hfpmodem/call-volume.c \ > + drivers/hfpmodem/sim.c > > builtin_modules += mbmmodem > builtin_sources += drivers/atmodem/atutil.h \ > diff --git a/drivers/hfpmodem/hfpmodem.c b/drivers/hfpmodem/hfpmodem.c > index 4471a7b..ecbabe3 100644 > --- a/drivers/hfpmodem/hfpmodem.c > +++ b/drivers/hfpmodem/hfpmodem.c > @@ -44,6 +44,7 @@ static int hfpmodem_init(void) > hfp_voicecall_init(); > hfp_netreg_init(); > hfp_call_volume_init(); > + hfp_sim_init(); > > return 0; > } > @@ -53,6 +54,7 @@ static void hfpmodem_exit(void) > hfp_voicecall_exit(); > hfp_netreg_exit(); > hfp_call_volume_exit(); > + hfp_sim_exit(); > } > > OFONO_PLUGIN_DEFINE(hfpmodem, "Hands-Free Profile Driver", VERSION, > diff --git a/drivers/hfpmodem/hfpmodem.h b/drivers/hfpmodem/hfpmodem.h > index bf5d563..631f773 100644 > --- a/drivers/hfpmodem/hfpmodem.h > +++ b/drivers/hfpmodem/hfpmodem.h > @@ -80,3 +80,6 @@ extern void hfp_call_volume_exit(); > > extern void hfp_voicecall_init(); > extern void hfp_voicecall_exit(); > + > +extern void hfp_sim_init(); > +extern void hfp_sim_exit(); > diff --git a/drivers/hfpmodem/sim.c b/drivers/hfpmodem/sim.c > new file mode 100644 > index 0000000..e42cfb9 > --- /dev/null > +++ b/drivers/hfpmodem/sim.c > @@ -0,0 +1,114 @@ > +/* > + * > + * oFono - Open Source Telephony > + * > + * Copyright (C) 2008-2010 Intel Corporation. All rights reserved. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA > + * > + */ > + > +#ifdef HAVE_CONFIG_H > +#include <config.h> > +#endif > + > +#define _GNU_SOURCE > +#include <string.h> > +#include <stdlib.h> > +#include <stdio.h> > + > +#include <glib.h> > + > +#include <ofono/log.h> > +#include <ofono/modem.h> > +#include <ofono/sim.h> > + > +#include "gatchat.h" > +#include "gatresult.h" > +#include "hfpmodem.h" > + > +static void hfp_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb, > + void *data) > +{ > + struct ofono_error error; > + const char *imsi = "1234567890123456"; > + > + DBG("%s", imsi); > + > + /* > + * Return the faked IMSI since HFP doesn't have IMSI. > + */ > + error.type = OFONO_ERROR_TYPE_NO_ERROR; > + cb(&error, imsi, data); > +} > + > +static void hfp_sim_read_binary(struct ofono_sim *sim, int fileid, > + int start, int length, > + ofono_sim_read_cb_t cb, void *data) > +{ > + DBG(""); > + > + CALLBACK_WITH_FAILURE(cb, NULL, 0, data); > +} > + > +static void hfp_sim_read_info(struct ofono_sim *sim, int fileid, > + ofono_sim_file_info_cb_t cb, > + void *data) > +{ > + DBG(""); > + > + CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL, data); > +} > + > +static int hfp_sim_probe(struct ofono_sim *sim, unsigned int vendor, > + void *data) > +{ > + ofono_sim_register(sim); > + > + return 0; > +} > + > +static void hfp_sim_remove(struct ofono_sim *sim) > +{ > +} > + > +static struct ofono_sim_driver driver = { > + .name = "hfpmodem", > + .probe = hfp_sim_probe, > + .remove = hfp_sim_remove, > + .read_file_info = hfp_sim_read_info, > + .read_file_transparent = hfp_sim_read_binary, > + .read_file_linear = NULL, > + .read_file_cyclic = NULL, > + .write_file_transparent = NULL, > + .write_file_linear = NULL, > + .write_file_cyclic = NULL, > + .read_imsi = hfp_read_imsi, > + .query_passwd_state = NULL, > + .send_passwd = NULL, > + .reset_passwd = NULL, > + .lock = NULL, > + .change_passwd = NULL, > + .query_locked = NULL, You don't need to add the NULL funcions here. -- Gustavo F. Padovan ProFUSION embedded systems - http://profusion.mobi ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] hfp: Add faked sim driver to support SIM ready 2010-08-30 9:50 ` [PATCH 1/1] hfp: Add faked sim driver to support SIM ready Zhenhua Zhang 2010-08-30 19:33 ` Gustavo F. Padovan @ 2010-08-30 19:50 ` Denis Kenzior 2010-08-30 23:54 ` Marcel Holtmann 2010-08-31 0:58 ` Zhang, Zhenhua 1 sibling, 2 replies; 6+ messages in thread From: Denis Kenzior @ 2010-08-30 19:50 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 391 bytes --] Hi Zhenhua, On 08/30/2010 04:50 AM, Zhenhua Zhang wrote: > HFP modem doesn't have IMSI at all. In order to notify SIM ready to the > core, we create a special sim driver with a faked IMSI number. Can you try after commit 88024972df46d4ababbaf39354615e8a8d603cfc? I added magic which will skip sim_ready stuff completely for modems that do not add a sim atom. Regards, -Denis ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] hfp: Add faked sim driver to support SIM ready 2010-08-30 19:50 ` Denis Kenzior @ 2010-08-30 23:54 ` Marcel Holtmann 2010-08-31 0:58 ` Zhang, Zhenhua 1 sibling, 0 replies; 6+ messages in thread From: Marcel Holtmann @ 2010-08-30 23:54 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 441 bytes --] Hi Denis, > > HFP modem doesn't have IMSI at all. In order to notify SIM ready to the > > core, we create a special sim driver with a faked IMSI number. > > Can you try after commit 88024972df46d4ababbaf39354615e8a8d603cfc? I > added magic which will skip sim_ready stuff completely for modems that > do not add a sim atom. I would really prefer this. I think faked IMSI's are not a good idea at all. Regards Marcel ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 1/1] hfp: Add faked sim driver to support SIM ready 2010-08-30 19:50 ` Denis Kenzior 2010-08-30 23:54 ` Marcel Holtmann @ 2010-08-31 0:58 ` Zhang, Zhenhua 1 sibling, 0 replies; 6+ messages in thread From: Zhang, Zhenhua @ 2010-08-31 0:58 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 541 bytes --] Hi, Denis, Denis Kenzior wrote: > Hi Zhenhua, > > On 08/30/2010 04:50 AM, Zhenhua Zhang wrote: >> HFP modem doesn't have IMSI at all. In order to notify SIM ready to >> the core, we create a special sim driver with a faked IMSI number. > > Can you try after commit 88024972df46d4ababbaf39354615e8a8d603cfc? I > added magic which will skip sim_ready stuff completely for modems > that do not add a sim atom. Yes. Your patch works well and fixes the problem in a generic way. > Regards, > -Denis Regards, Zhenhua ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-08-31 0:58 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-08-30 9:50 [PATCH 0/1] Add faked sim driver for hfp modem Zhenhua Zhang 2010-08-30 9:50 ` [PATCH 1/1] hfp: Add faked sim driver to support SIM ready Zhenhua Zhang 2010-08-30 19:33 ` Gustavo F. Padovan 2010-08-30 19:50 ` Denis Kenzior 2010-08-30 23:54 ` Marcel Holtmann 2010-08-31 0:58 ` Zhang, Zhenhua
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.