From 5dcc1231bd8895cc3364b573116f5b91ef41e327 Mon Sep 17 00:00:00 2001 From: laforge Date: Tue, 31 Jul 2007 07:29:00 +0000 Subject: in some cases the Qualcomm chip in the HTC Universal switches to V0 mode behind our backs. We need support for "0" instead of "OK" in the synchronous initial command and in the alive check. Note that this nearly duplicates the "OK" check in atcmd.c. (Philip Zabel) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2580 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/gsmd.c | 6 ++++-- src/gsmd/vendor_qc.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c index 99945c3..519d553 100644 --- a/src/gsmd/gsmd.c +++ b/src/gsmd/gsmd.c @@ -62,7 +62,8 @@ static int gsmd_alive_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) { struct gsmd_alive_priv *alp = ctx; - if (!strcmp(resp, "OK")) + if (!strcmp(resp, "OK") || + ((alp->gsmd->flags & GSMD_FLAG_V0) && resp[0] == '0')) alp->alive_responded = 1; return 0; } @@ -199,7 +200,8 @@ static int firstcmd_atcb(struct gsmd_atcmd *cmd, void *ctx, char *resp) { struct gsmd *gsmd = ctx; - if (strcmp(resp, "OK")) { + if (strcmp(resp, "OK") && + (!(gsmd->flags & GSMD_FLAG_V0) || resp[0] != '0')) { gsmd_log(GSMD_FATAL, "response '%s' to initial command invalid", resp); exit(5); } diff --git a/src/gsmd/vendor_qc.c b/src/gsmd/vendor_qc.c index 2bb74bb..a4a65ce 100644 --- a/src/gsmd/vendor_qc.c +++ b/src/gsmd/vendor_qc.c @@ -81,6 +81,9 @@ static int qc_detect(struct gsmd *g) { /* FIXME: do actual detection of vendor if we have multiple vendors */ /* open /proc/cpuinfo and check for HTC Universal? */ + + /* The Qualcomm chip switches to V0 mode in the strangest places */ + g->flags |= GSMD_FLAG_V0; return 1; } -- cgit v1.2.3