From ed177c0f9b377673842b2ec41e0a2aa7ceeb73f6 Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Wed, 29 May 2013 18:42:43 +0200 Subject: omap4-common: fix getting preferred network type NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF Change-Id: If7c35ca1d52f6f151733c5c0463401b7725aed3e --- libril/ril.cpp | 36 ++++++++++++++++++++++++++++++++++++ libril/ril_commands.h | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/libril/ril.cpp b/libril/ril.cpp index e3c4dc4..36e64b3 100755 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -208,6 +208,7 @@ static void dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI); 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 responseIntsGetPreferredNetworkType(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); @@ -1263,6 +1264,41 @@ responseInts(Parcel &p, void *response, size_t responselen) { return 0; } +static int +responseIntsGetPreferredNetworkType(Parcel &p, void *response, size_t responselen) { + int numInts; + + if (response == NULL && responselen != 0) { + ALOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + if (responselen % sizeof(int) != 0) { + ALOGE("invalid response length %d expected multiple of %d\n", + (int)responselen, (int)sizeof(int)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + int *p_int = (int *) response; + + numInts = responselen / sizeof(int *); + p.writeInt32 (numInts); + + /* each int*/ + startResponse; + for (int i = 0 ; i < numInts ; i++) { + if (i == 0 && p_int[0] == 7) { + ALOGE("REQUEST_GET_PREFERRED_NETWORK_TYPE: NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF"); + p_int[0] = 0; + } + appendPrintBuf("%s%d,", printBuf, p_int[i]); + p.writeInt32(p_int[i]); + } + removeLastChar; + closeResponse; + + return 0; +} + /** 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) { diff --git a/libril/ril_commands.h b/libril/ril_commands.h index 51897b1..25bce64 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -88,7 +88,7 @@ {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, dispatchInts, responseVoid}, {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, responseVoid}, {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, dispatchInts, responseVoid}, - {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, responseInts}, + {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, responseIntsGetPreferredNetworkType}, {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, dispatchVoid, responseCellList}, {RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, dispatchInts, responseVoid}, -- cgit v1.1