diff options
author | Alexander Hofbauer <alex@derhofbauer.at> | 2010-11-22 15:38:04 +0100 |
---|---|---|
committer | Alexander Hofbauer <alex@derhofbauer.at> | 2010-11-23 20:26:42 +0100 |
commit | bf591d8700b903ce5fb9de54523ca6f193479fa8 (patch) | |
tree | 0784e9b64947959e2b072b558177b766c56fe8e8 | |
parent | 76e1a7bfbf7317789e49721abf1b37eded14208b (diff) | |
download | android_hardware_ril-froyo-stable.tar.gz android_hardware_ril-froyo-stable.tar.bz2 android_hardware_ril-froyo-stable.zip |
Handle newer libhtc_ril.so releasesfroyo-stablefroyo
Querying available networks returns five strings per network instead of
four which breaks that functionality in RILJ. This fix most likely
appiles to every library since Hero.
Disabled per default, define BOARD_USE_NEW_LIBRIL_HTC if you are
building with libhtc_ril.so libraries version 2 and above.
Change-Id: I910d0e34c95b2b46c1d66adf0ca9f116dbf39c04
-rw-r--r-- | libril/Android.mk | 3 | ||||
-rw-r--r-- | libril/ril.cpp | 32 | ||||
-rw-r--r-- | libril/ril_commands.h | 2 |
3 files changed, 34 insertions, 3 deletions
diff --git a/libril/Android.mk b/libril/Android.mk index cba6c88..731f6ed 100644 --- a/libril/Android.mk +++ b/libril/Android.mk @@ -14,6 +14,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 6edb342..bb96b6a 100644 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -209,6 +209,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); @@ -1284,8 +1286,16 @@ responseInts(Parcel &p, void *response, size_t responselen) { return 0; } -/** response is a char **, pointing to an array of char *'s */ 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 */ +static int responseStrings(Parcel &p, void *response, size_t responselen, bool network_search) { int numStrings; if (response == NULL && responselen != 0) { @@ -1304,11 +1314,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]); } @@ -2239,7 +2267,7 @@ static void listenCallback (int fd, short flags, void *param) { LOGE("Error on accept() errno:%d", errno); /* start listening for new connections again */ rilEventAddWakeup(&s_listen_event); - return; + return; } /* check the credential of the other side and only accept socket from diff --git a/libril/ril_commands.h b/libril/ril_commands.h index e07dd43..f6de7c4 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}, |