Skip to content

Commit

Permalink
Merge "Handle newer libhtc_ril.so releases" into gingerbread
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperb1iss authored and Gerrit Code Review committed Jan 4, 2011
2 parents 2bd92a4 + 9010281 commit 97d65bf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions libril/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 30 additions & 2 deletions libril/ril.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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]);
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libril/ril_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 97d65bf

Please sign in to comment.