summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hillenbrand <codeworkx@cyanogenmod.org>2013-05-29 18:42:43 +0200
committerDaniel Hillenbrand <codeworkx@cyanogenmod.org>2013-05-29 18:42:43 +0200
commited177c0f9b377673842b2ec41e0a2aa7ceeb73f6 (patch)
treed7eb7b1f0c01b7e02ad2c64e99407f4798530aa4
parent0641411c681ca67a26b212538955e9e08206216d (diff)
downloaddevice_samsung_omap4-common-ed177c0f9b377673842b2ec41e0a2aa7ceeb73f6.zip
device_samsung_omap4-common-ed177c0f9b377673842b2ec41e0a2aa7ceeb73f6.tar.gz
device_samsung_omap4-common-ed177c0f9b377673842b2ec41e0a2aa7ceeb73f6.tar.bz2
omap4-common: fix getting preferred network type
NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF Change-Id: If7c35ca1d52f6f151733c5c0463401b7725aed3e
-rwxr-xr-xlibril/ril.cpp36
-rw-r--r--libril/ril_commands.h2
2 files changed, 37 insertions, 1 deletions
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},