From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/2] Add: n900modem driver
Date: Tue, 17 Aug 2010 14:19:47 -0500 [thread overview]
Message-ID: <4C6AE0D3.5090903@gmail.com> (raw)
In-Reply-To: <1281724314-19465-2-git-send-email-Pekka.Pessi@nokia.com>
[-- Attachment #1: Type: text/plain, Size: 3387 bytes --]
Hi Pekka,
On 08/13/2010 01:31 PM, Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
>
> The N900 modem is based on isimodem. It works natively on N900 with Maemo or
> Meego kernel.
>
> The configuration option --disable-n900modem can be used to disable it (if,
> for instance, using ofono with Maemo 5 userspace).
Just had a quick look and this caught my eye:
> +static int n900modem_init(void)
> +{
> + isi_devinfo_init();
> + isi_phonebook_init();
> + isi_netreg_init();
> + isi_voicecall_init();
> + isi_sms_init();
> + isi_cbs_init();
> + isi_sim_init();
> + isi_ssn_init();
> + isi_ussd_init();
> + isi_call_forwarding_init();
> + isi_call_settings_init();
> + isi_call_barring_init();
> + isi_call_meter_init();
> + isi_radio_settings_init();
> +
> + ofono_modem_driver_register(&driver);
> +
> + return 0;
> +}
> +
> +static void n900modem_exit(void)
> +{
> + ofono_modem_driver_unregister(&driver);
> +
> + isi_devinfo_exit();
> + isi_phonebook_exit();
> + isi_netreg_exit();
> + isi_voicecall_exit();
> + isi_sms_exit();
> + isi_cbs_exit();
> + isi_sim_exit();
> + isi_ssn_exit();
> + isi_ussd_exit();
> + isi_call_forwarding_exit();
> + isi_call_settings_exit();
> + isi_call_barring_exit();
> + isi_call_meter_exit();
> + isi_radio_settings_exit();
> +}
> +
Why are we doing this inside n900modem? Can't we simply:
1. Make isimodem/isimodem.c register these (just like atmodem, stemodem,
mbmmodem, etc does)
2. Rip out the actual modem driver out of isimodem/isimodem.c
3. Have plugins/n900.c contain the modem driver?
> +OFONO_PLUGIN_DEFINE(n900modem, "Nokia N900 modem driver", VERSION,
> + OFONO_PLUGIN_PRIORITY_HIGH, n900modem_init, n900modem_exit)
> diff --git a/plugins/usbpnmodem.c b/plugins/usbpnmodem.c
> index 68beb6f..9fcf0c8 100644
> --- a/plugins/usbpnmodem.c
> +++ b/plugins/usbpnmodem.c
> @@ -39,9 +39,22 @@
>
> static GPhonetNetlink *link = NULL;
>
> +static int match_ifname(char const *name, char const *ifname)
> +{
> + size_t namelen = strlen(name);
> +
> + if (strncmp(name, ifname, namelen) != 0)
> + return FALSE;
> +
> + if (ifname[namelen + strspn(ifname + namelen, "0123456789")] != '\0')
> + return FALSE;
> +
> + return TRUE;
> +}
> +
> /*
> * Add or remove isimodems
> - * when usbpn* phonet interfaces are added/removed
> + * when usbpn* or phonet* phonet interfaces are added/removed
> */
> static void usbpn_status_cb(GIsiModem *idx,
> GPhonetLinkState st,
> @@ -50,15 +63,25 @@ static void usbpn_status_cb(GIsiModem *idx,
> {
> struct ofono_modem *modem;
> int error;
> + char const *driver;
> + uint8_t address = 0;
>
> DBG("Phonet link %s (%u) is %s",
> ifname, g_isi_modem_index(idx),
> st == PN_LINK_REMOVED ? "removed" :
> st == PN_LINK_DOWN ? "down" : "up");
>
> - /* Expect phonet interface name usbpn<idx> */
> - if (strncmp(ifname, "usbpn", 5) ||
> - ifname[5 + strspn(ifname + 5, "0123456789")])
> + if (match_ifname("usbpn", ifname)) {
> + driver = "isimodem";
> + address = PN_DEV_PC;
> + } else if (strcmp("phonet0", ifname) == 0) {
> +#if HAVE_N900MODEM
> + driver = "n900modem";
> +#else
> + driver = "isimodem";
> +#endif
And this really needs to go...
> + address = PN_DEV_SOS;
> + } else
> return;
Regards,
-Denis
next prev parent reply other threads:[~2010-08-17 19:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-13 18:31 [PATCH 1/2] Add --disable-n900modem to the configure script Pekka.Pessi
2010-08-13 18:31 ` [PATCH 2/2] Add: n900modem driver Pekka.Pessi
2010-08-17 19:19 ` Denis Kenzior [this message]
2010-08-30 14:23 ` Aki Niemi
2010-08-30 21:03 ` Denis Kenzior
2010-08-30 21:28 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-09-01 8:32 ` Pekka Pessi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C6AE0D3.5090903@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox