Created
December 18, 2011 15:17
-
-
Save drewis/1493678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libril/Android.mk b/libril/Android.mk | |
index 5c96ec9..fee6107 100644 | |
--- a/libril/Android.mk | |
+++ b/libril/Android.mk | |
@@ -16,6 +16,9 @@ LOCAL_SHARED_LIBRARIES := \ | |
libhardware_legacy | |
LOCAL_CFLAGS := | |
+ifdef BOARD_USE_NEW_LIBRIL_HTC | |
+LOCAL_CFLAGS += -DNEW_LIBRIL_HTC | |
+endif | |
LOCAL_MODULE:= libril | |
diff --git a/libril/ril.cpp b/libril/ril.cpp | |
index d1d5d3b..618ea99 100644 | |
--- a/libril/ril.cpp | |
+++ b/libril/ril.cpp | |
@@ -210,6 +210,8 @@ static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI); | |
static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI); | |
static int responseInts(Parcel &p, void *response, size_t responselen); | |
static int responseStrings(Parcel &p, void *response, size_t responselen); | |
+static int responseStringsNetworks(Parcel &p, void *response, size_t responselen); | |
+static int responseStrings(Parcel &p, void *response, size_t responselen, bool network_search); | |
static int responseString(Parcel &p, void *response, size_t responselen); | |
static int responseVoid(Parcel &p, void *response, size_t responselen); | |
static int responseCallList(Parcel &p, void *response, size_t responselen); | |
@@ -1324,6 +1326,14 @@ responseInts(Parcel &p, void *response, size_t responselen) { | |
return 0; | |
} | |
+static int responseStrings(Parcel &p, void *response, size_t responselen) { | |
+ return responseStrings(p, response, responselen, false); | |
+} | |
+ | |
+static int responseStringsNetworks(Parcel &p, void *response, size_t responselen) { | |
+ return responseStrings(p, response, responselen, true); | |
+} | |
+ | |
/** response is a char **, pointing to an array of char *'s | |
The parcel will begin with the version */ | |
static int responseStringsWithVersion(int version, Parcel &p, void *response, size_t responselen) { | |
@@ -1332,7 +1342,7 @@ static int responseStringsWithVersion(int version, Parcel &p, void *response, si | |
} | |
/** response is a char **, pointing to an array of char *'s */ | |
-static int responseStrings(Parcel &p, void *response, size_t responselen) { | |
+static int responseStrings(Parcel &p, void *response, size_t responselen, bool network_search) { | |
int numStrings; | |
if (response == NULL && responselen != 0) { | |
@@ -1351,11 +1361,29 @@ static int responseStrings(Parcel &p, void *response, size_t responselen) { | |
char **p_cur = (char **) response; | |
numStrings = responselen / sizeof(char *); | |
+#ifdef NEW_LIBRIL_HTC | |
+ if (network_search == true) { | |
+ // we only want four entries for each network | |
+ p.writeInt32 (numStrings - (numStrings / 5)); | |
+ } else { | |
+ p.writeInt32 (numStrings); | |
+ } | |
+ int sCount = 0; | |
+#else | |
p.writeInt32 (numStrings); | |
+#endif | |
/* each string*/ | |
startResponse; | |
for (int i = 0 ; i < numStrings ; i++) { | |
+#ifdef NEW_LIBRIL_HTC | |
+ sCount++; | |
+ // ignore the fifth string that is returned by newer HTC libhtc_ril.so. | |
+ if (network_search == true && sCount % 5 == 0) { | |
+ sCount = 0; | |
+ continue; | |
+ } | |
+#endif | |
appendPrintBuf("%s%s,", printBuf, (char*)p_cur[i]); | |
writeStringToParcel (p, p_cur[i]); | |
} | |
@@ -1365,7 +1393,6 @@ static int responseStrings(Parcel &p, void *response, size_t responselen) { | |
return 0; | |
} | |
- | |
/** | |
* NULL strings are accepted | |
* FIXME currently ignores responselen | |
diff --git a/libril/ril_commands.h b/libril/ril_commands.h | |
index 68a8b31..349ec57 100644 | |
--- a/libril/ril_commands.h | |
+++ b/libril/ril_commands.h | |
@@ -62,7 +62,7 @@ | |
{RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, dispatchVoid, responseInts}, | |
{RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, dispatchVoid, responseVoid}, | |
{RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, dispatchString, responseVoid}, | |
- {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , dispatchVoid, responseStrings}, | |
+ {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , dispatchVoid, responseStringsNetworks}, | |
{RIL_REQUEST_DTMF_START, dispatchString, responseVoid}, | |
{RIL_REQUEST_DTMF_STOP, dispatchVoid, responseVoid}, | |
{RIL_REQUEST_BASEBAND_VERSION, dispatchVoid, responseString}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment