From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v3 2/2] huawei: add gprs context
Date: Wed, 19 May 2010 08:44:38 -0500 [thread overview]
Message-ID: <201005190844.38234.denkenz@gmail.com> (raw)
In-Reply-To: <20100519140659.3163.1433.stgit@potku.valot.fi>
[-- Attachment #1: Type: text/plain, Size: 2393 bytes --]
Hi Kalle,
> + ret = at_util_parse_reg_unsolicited(result, "+CGREG:", &status,
> + NULL, NULL, NULL,
> + OFONO_VENDOR_HUAWEI);
No mixing of tabs & spaces for indentation
> +
> + if (ret == FALSE)
> + return;
> +
> + ofono_gprs_status_notify(gprs, status);
> +}
> +
> +static inline void report_signal_strength(struct ofono_netreg *netreg,
> + int strength)
And here
> +{
> + DBG("%d", strength);
> +
> + if (strength == 99)
> + strength = -1;
> + else
> + strength = (strength * 100) / 31;
> +
> + ofono_netreg_strength_notify(netreg, strength);
> +}
You might really want to make this into an atutil function instead of copy-
pasting it around.
> +
> +static void huawei_rssi_notify(GAtResult *result, gpointer user_data)
> +{
> + struct ofono_netreg *netreg = user_data;
> + GAtResultIter iter;
> + int strength;
> +
> + g_at_result_iter_init(&iter, result);
> +
> + if (!g_at_result_iter_next(&iter, "^RSSI:"))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &strength))
> + return;
> +
> + report_signal_strength(netreg, strength);
> +}
> +
> static void huawei_post_sim(struct ofono_modem *modem)
> {
> struct huawei_data *data = ofono_modem_get_data(modem);
> + struct ofono_gprs_context *gc;
> + struct ofono_netreg *netreg;
> + struct ofono_gprs *gprs;
>
> DBG("%p", modem);
>
> - ofono_netreg_create(modem, OFONO_VENDOR_HUAWEI, "atmodem", data->chat);
> + netreg = ofono_netreg_create(modem, OFONO_VENDOR_HUAWEI, "atmodem",
> + data->chat);
Again with mixed indentation
> ofono_sms_create(modem, OFONO_VENDOR_QUALCOMM_MSM, "atmodem",
> data->chat); +
> + gprs = ofono_gprs_create(modem, OFONO_VENDOR_HUAWEI, "atmodem",
> + data->chat);
And here
> + gc = ofono_gprs_context_create(modem, 0, "atmodem", data->chat);
> +
> + if (gprs && gc) {
> + ofono_gprs_add_context(gprs, gc);
> +
> + /* huawei has a separate channel for CGREG notifications */
> + g_at_chat_register(data->event, "+CGREG:",
> + huawei_cgreg_notify, FALSE, gprs, NULL);
And here
> +
> + /* huawei uses non-standard "^RSSI:18" strings */
> + g_at_chat_register(data->event, "^RSSI:",
> + huawei_rssi_notify, FALSE, netreg, NULL);
And here
> + }
> }
>
> static struct ofono_modem_driver huawei_driver = {
Regards,
-Denis
next prev parent reply other threads:[~2010-05-19 13:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 14:06 [PATCH v3 0/2] Huawei GPRS support Kalle Valo
2010-05-19 14:06 ` [PATCH v3 1/2] huawei: detect SecondaryDevice which is used for events Kalle Valo
2010-05-19 13:40 ` Denis Kenzior
2010-05-20 7:15 ` Kalle Valo
2010-05-19 14:06 ` [PATCH v3 2/2] huawei: add gprs context Kalle Valo
2010-05-19 13:44 ` Denis Kenzior [this message]
2010-05-20 7:35 ` Kalle Valo
2010-08-04 19:59 ` Inaky Perez-Gonzalez
2010-08-05 5:54 ` Kalle Valo
2010-08-05 17:29 ` Inaky Perez-Gonzalez
2010-08-06 7:26 ` Kalle Valo
2010-08-11 4:56 ` Inaky Perez-Gonzalez
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=201005190844.38234.denkenz@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 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.