[PATCH] fix V0 mode support for qualcomm chip (htc universal)

Philipp Zabel philipp.zabel at gmail.com
Wed Jun 13 21:46:18 CEST 2007


Hi,

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 (twice), maybe this warrants
a function like

int gsmd_response_is_ok (struct gsmd *gsmd, char *resp)
{
	return (!strcmp(resp, "OK") ||
		((gsmd->flags & GSMD_FLAG_V0) && resp[0] == '0'));
}

regards
Philipp

Index: gsm/src/gsmd/vendor_qc.c
===================================================================
--- gsm.orig/src/gsmd/vendor_qc.c	2007-06-13 20:13:47.000000000 +0200
+++ gsm/src/gsmd/vendor_qc.c	2007-06-13 20:45:19.000000000 +0200
@@ -81,6 +88,9 @@
 {
 	/* 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;
 }
 
Index: gsm/src/gsmd/gsmd.c
===================================================================
--- gsm.orig/src/gsmd/gsmd.c	2007-06-13 20:13:47.000000000 +0200
+++ gsm/src/gsmd/gsmd.c	2007-06-13 20:49:54.000000000 +0200
@@ -62,7 +62,8 @@
 {
 	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;
 }
@@ -201,7 +202,8 @@
 {
 	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);
 	}




More information about the gsmd-devel mailing list