From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont <remi@remlab.net>
To: ofono@ofono.org
Subject: Re: [PATCH 11/15] emulator: Register mandatory AT command handlers
Date: Wed, 07 Jul 2010 12:48:21 +0200 [thread overview]
Message-ID: <174dc33a040610bec69295a72eb488ea@chewa.net> (raw)
In-Reply-To: <1278496912-13777-12-git-send-email-zhenhua.zhang@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2939 bytes --]
On Wed, 7 Jul 2010 18:01:48 +0800, Zhenhua Zhang <zhenhua.zhang@intel.com>
wrote:
> +static void cfun_cb(GAtServerRequestType type, GAtResult *cmd,
> + gpointer user_data)
> +{
> + struct ofono_emulator *e = user_data;
> + char buf[50];
> +
> + switch (type) {
> + case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
> + ofono_emulator_send_info(e, "+CFUN: (0-1)", TRUE);
> + ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
> + break;
> + case G_AT_SERVER_REQUEST_TYPE_QUERY:
> + snprintf(buf, sizeof(buf), "+CFUN: %d", e->modem_mode);
> + ofono_emulator_send_info(e, buf, TRUE);
> + ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
> + break;
Does not make much sense. If mode is 0, the device has functionality
minimum, meaning usually power off or close to that. oFono does not run in
such stage, so it won't be there to answer CFUN: 0.
> + case G_AT_SERVER_REQUEST_TYPE_SET:
> + {
> + GAtResultIter iter;
> + int mode;
> +
> + g_at_result_iter_init(&iter, cmd);
> + g_at_result_iter_next(&iter, "+CFUN=");
> +
> + if (g_at_result_iter_next_number(&iter, &mode) == FALSE)
> + goto error;
> +
> + if (mode != 0 && mode != 1)
> + goto error;
> +
> + DBG("set CFUN to %d", mode);
> +
> + e->modem_mode = mode;
> + g_timeout_add_seconds(1, send_ok, e);
> + break;
> + }
I might be missing something, but it does not look like AT+CFUN=0 will
power off the system, which is more or less what it is expected to do.
> +static void cops_cb(GAtServerRequestType type, GAtResult *result,
> + gpointer user_data)
> +{
> + struct ofono_emulator *e = user_data;
> + char buf[50];
> +
> + switch (type) {
> + case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
> + ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
> + break;
> + case G_AT_SERVER_REQUEST_TYPE_QUERY:
> + snprintf(buf, sizeof(buf), "+COPS: %d", e->modem_cops);
> + ofono_emulator_send_info(e, buf, TRUE);
> + ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
> + break;
> + case G_AT_SERVER_REQUEST_TYPE_SET:
> + {
> + GAtResultIter iter;
> + int mode;
> +
> + g_at_result_iter_init(&iter, result);
> + g_at_result_iter_next(&iter, "+COPS=");
> +
> + if (g_at_result_iter_next_number(&iter, &mode) == FALSE)
> + goto error;
> +
> + if (mode < 0 || mode > 2)
> + goto error;
> +
> + DBG("set GPRS cops status %d", mode);
> +
> + e->modem_cops = mode;
> + ofono_emulator_send_final(e, G_AT_SERVER_RESULT_OK);
You won't get away with this. You're supposed to register/unregister/etc
from the network here.
Similarly, AT+CGATT is wrong, GPRS should be attached/detached. Yes, that
means you may have to tear down someone else's GPRS context, which may seem
evil.
Last, AT+CPIN should at the very least return PIN READY when appropriate,
if I read the spec right.
--
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis
next prev parent reply other threads:[~2010-07-07 10:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-07 10:01 [0/15] Implement DUN server in oFono Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 01/15] dun_gw: Fix license header Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 02/15] watch: Simplify ofono_watchlist remove item Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 03/15] emulator: Add status watches for ofono emulator Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 04/15] emulator: Add get properities for emulator Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 05/15] gprs: Rename status_watch to netreg_status_watch Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 06/15] emulator: Add emulator status watches in gprs atom Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 07/15] emulator: Add emulator status watches in netreg Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 08/15] emulator: Add APIs to send GAtServer result Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 09/15] emulator: Implement dialing up for DUN Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 10/15] emulator: Add emulator dial up support in GPRS Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 11/15] emulator: Register mandatory AT command handlers Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 12/15] emulator: Watch GPRS status changes Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 13/15] emulator: Watch netreg " Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 14/15] gprs: Add DUN +CGATT support in gprs atom Zhenhua Zhang
2010-07-07 10:01 ` [PATCH 15/15] gprs: Add DUN +CGDCONT " Zhenhua Zhang
2010-07-07 10:48 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont [this message]
2010-07-07 11:12 ` [PATCH 11/15] emulator: Register mandatory AT command handlers Marcel Holtmann
2010-07-08 2:31 ` Zhang, Zhenhua
2010-07-08 6:46 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-07-08 13:26 ` Marcel Holtmann
2010-07-08 14:23 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-07-08 14:30 ` Denis Kenzior
2010-07-07 10:08 ` [PATCH 0/15] Implement DUN server in oFono Zhang, Zhenhua
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=174dc33a040610bec69295a72eb488ea@chewa.net \
--to=remi@remlab.net \
--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