xmm6262: Update using 4.3 libril.cpp

Change-Id: Ib884b46448b633b862cadb0f067e3180531858ae
tirimbino
Ethan Chen 11 years ago
parent 727dea780a
commit d6e3065985
  1. 75
      ril/xmm6262/libril/ril.cpp
  2. 4
      ril/xmm6262/libril/ril_commands.h

@ -337,7 +337,7 @@ issueLocalRequest(int request, void *data, int len) {
/* Hack to include Samsung requests */
if (request > 10000) {
index = request - 10000 + RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE;
RLOGE("SAMSUNG: request=%d, index=%d", request, index);
RLOGD("SAMSUNG: request=%d, index=%d", request, index);
pRI->pCI = &(s_commands[index]);
} else {
pRI->pCI = &(s_commands[request]);
@ -379,8 +379,9 @@ processCommandBuffer(void *buffer, size_t buflen) {
}
/* Hack to include Samsung requests */
//if (request < 1 || request >= (int32_t)NUM_ELEMS(s_commands)) {
if (request < 1 || ((request > RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE) && (request < RIL_REQUEST_GET_CELL_BROADCAST_CONFIG)) || request > RIL_REQUEST_HANGUP_VT) {
if (request < 1 || ((request > RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE) &&
(request < RIL_REQUEST_GET_CELL_BROADCAST_CONFIG)) ||
request > RIL_REQUEST_HANGUP_VT) {
RLOGE("unsupported request code %d token %d", request, token);
// FIXME this should perhaps return a response
return 0;
@ -393,7 +394,8 @@ processCommandBuffer(void *buffer, size_t buflen) {
/* Hack to include Samsung requests */
if (request > 10000) {
index = request - 10000 + RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE;
RLOGE("processCommandBuffer: samsung request=%d, index=%d", request, index);
RLOGD("processCommandBuffer: samsung request=%d, index=%d",
request, index);
pRI->pCI = &(s_commands[index]);
} else {
pRI->pCI = &(s_commands[request]);
@ -1103,6 +1105,7 @@ dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI) {
goto invalid;
}
{
RIL_CDMA_BroadcastSmsConfigInfo cdmaBci[num];
RIL_CDMA_BroadcastSmsConfigInfo *cdmaBciPtrs[num];
@ -1138,6 +1141,7 @@ dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI) {
memset(cdmaBci, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo));
memset(cdmaBciPtrs, 0, num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *));
#endif
}
return;
@ -1241,7 +1245,6 @@ invalid:
}
// For backwards compatibility in RIL_REQUEST_SETUP_DATA_CALL.
// Version 4 of the RIL interface adds a new PDP type parameter to support
// IPv6 and dual-stack PDP contexts. When dealing with a previous version of
@ -1324,7 +1327,6 @@ static void dispatchCdmaSubscriptionSource(Parcel& p, RequestInfo *pRI) {
RIL_onRequestComplete(pRI, RIL_E_SUCCESS, &cdmaSubscriptionSource, sizeof(int));
}
static int
blockingWrite(int fd, const void *buffer, size_t len) {
size_t writeOffset = 0;
@ -1453,7 +1455,7 @@ responseIntsGetPreferredNetworkType(Parcel &p, void *response, size_t responsele
startResponse;
for (int i = 0 ; i < numInts ; i++) {
if (i == 0 && p_int[0] == 7) {
RLOGE("REQUEST_GET_PREFERRED_NETWORK_TYPE: NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF");
RLOGD("REQUEST_GET_PREFERRED_NETWORK_TYPE: NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF");
p_int[0] = 0;
}
appendPrintBuf("%s%d,", printBuf, p_int[i]);
@ -1496,13 +1498,13 @@ static int responseStringsNetworks(Parcel &p, void *response, size_t responselen
p.writeInt32 (0);
} else {
char **p_cur = (char **) response;
int j = 0;
numStrings = responselen / sizeof(char *);
p.writeInt32 ((numStrings / inQANElements) * outQANElements);
/* each string*/
startResponse;
int j=0;
for (int i = 0 ; i < numStrings ; i++) {
/* Samsung is sending 5 elements, upper layer expects 4.
Drop every 5th element here */
@ -2097,8 +2099,6 @@ static int responseRilSignalStrength(Parcel &p,
return RIL_ERRNO_INVALID_RESPONSE;
}
RLOGE("responseRilSignalStrength()");
if (responselen >= sizeof (RIL_SignalStrength_v5)) {
RIL_SignalStrength_v6 *p_cur = ((RIL_SignalStrength_v6 *) response);
@ -2117,7 +2117,7 @@ static int responseRilSignalStrength(Parcel &p,
p.writeInt32(p_cur->GW_SignalStrength.bitErrorRate);
/* cdmaDbm */
//RLOGD("cdmaDbm (raw)=%d", p_cur->CDMA_SignalStrength.dbm);
RLOGD("cdmaDbm (raw)=%d", p_cur->CDMA_SignalStrength.dbm);
cdmaDbm = p_cur->CDMA_SignalStrength.dbm & 0xFF;
if (cdmaDbm < 0) {
cdmaDbm = 99;
@ -2131,7 +2131,7 @@ static int responseRilSignalStrength(Parcel &p,
p.writeInt32(p_cur->CDMA_SignalStrength.ecio);
/* evdoDbm */
//RLOGD("evdoDbm (raw)=%d", p_cur->EVDO_SignalStrength.dbm);
RLOGD("evdoDbm (raw)=%d", p_cur->EVDO_SignalStrength.dbm);
evdoDbm = p_cur->EVDO_SignalStrength.dbm & 0xFF;
if (evdoDbm < 0) {
evdoDbm = 99;
@ -2147,28 +2147,43 @@ static int responseRilSignalStrength(Parcel &p,
p.writeInt32(p_cur->EVDO_SignalStrength.signalNoiseRatio);
if (responselen >= sizeof (RIL_SignalStrength_v6)) {
/* lteSignalStrength */
p.writeInt32(p_cur->LTE_SignalStrength.signalStrength);
/*
* ril version <=6 receives negative values for rsrp
* workaround for backward compatibility
* Fixup LTE for backwards compatibility
*/
p_cur->LTE_SignalStrength.rsrp =
((s_callbacks.version <= 6) && (p_cur->LTE_SignalStrength.rsrp < 0 )) ?
-(p_cur->LTE_SignalStrength.rsrp) : p_cur->LTE_SignalStrength.rsrp;
if (s_callbacks.version <= 6) {
// signalStrength: -1 -> 99
if (p_cur->LTE_SignalStrength.signalStrength == -1) {
p_cur->LTE_SignalStrength.signalStrength = 99;
}
// rsrp: -1 -> INT_MAX all other negative value to positive.
// So remap here
if (p_cur->LTE_SignalStrength.rsrp == -1) {
p_cur->LTE_SignalStrength.rsrp = INT_MAX;
} else if (p_cur->LTE_SignalStrength.rsrp < -1) {
p_cur->LTE_SignalStrength.rsrp = -p_cur->LTE_SignalStrength.rsrp;
}
// rsrq: -1 -> INT_MAX
if (p_cur->LTE_SignalStrength.rsrq == -1) {
p_cur->LTE_SignalStrength.rsrq = INT_MAX;
}
// Not remapping rssnr is already using INT_MAX
/* lteRsrp */
// cqi: -1 -> INT_MAX
if (p_cur->LTE_SignalStrength.cqi == -1) {
p_cur->LTE_SignalStrength.cqi = INT_MAX;
}
}
p.writeInt32(p_cur->LTE_SignalStrength.signalStrength);
p.writeInt32(p_cur->LTE_SignalStrength.rsrp);
/* lteRsrq */
p.writeInt32(p_cur->LTE_SignalStrength.rsrq);
/* lteRssnr */
p.writeInt32(p_cur->LTE_SignalStrength.rssnr);
/* lteCqi */
p.writeInt32(p_cur->LTE_SignalStrength.cqi);
} else {
memset(&p_cur->LTE_SignalStrength, sizeof (RIL_LTE_SignalStrength), 0);
p.writeInt32(99);
p.writeInt32(INT_MAX);
p.writeInt32(INT_MAX);
p.writeInt32(INT_MAX);
p.writeInt32(INT_MAX);
}
startResponse;
@ -2448,7 +2463,6 @@ static int responseCellInfoList(Parcel &p, void *response, size_t responselen)
return 0;
}
static void triggerEvLoop() {
int ret;
if (!pthread_equal(pthread_self(), s_tid_dispatch)) {
@ -2500,7 +2514,6 @@ static int responseSimStatus(Parcel &p, void *response, size_t responselen) {
}
if (responselen == sizeof (RIL_CardStatus_v6)) {
RLOGE("RIL_CardStatus_v6");
RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response);
p.writeInt32(p_cur->card_state);
@ -2511,7 +2524,6 @@ static int responseSimStatus(Parcel &p, void *response, size_t responselen) {
sendSimStatusAppInfo(p, p_cur->num_applications, p_cur->applications);
} else if (responselen == sizeof (RIL_CardStatus_v5)) {
RLOGE("RIL_CardStatus_v5");
RIL_CardStatus_v5 *p_cur = ((RIL_CardStatus_v5 *) response);
p.writeInt32(p_cur->card_state);
@ -2523,9 +2535,6 @@ static int responseSimStatus(Parcel &p, void *response, size_t responselen) {
sendSimStatusAppInfo(p, p_cur->num_applications, p_cur->applications);
} else {
RLOGE("responseSimStatus: A RilCardStatus_v6 or _v5 expected\n");
RLOGE("responselen=%d", responselen);
RLOGE("RIL_CardStatus_v5=%d", sizeof (RIL_CardStatus_v5));
RLOGE("RIL_CardStatus_v6=%d", sizeof (RIL_CardStatus_v6));
return RIL_ERRNO_INVALID_RESPONSE;
}
@ -2647,7 +2656,7 @@ static void processWakeupCallback(int fd, short flags, void *param) {
char buff[16];
int ret;
ALOGV("processWakeupCallback");
RLOGV("processWakeupCallback");
/* empty our wakeup socket out */
do {

@ -122,9 +122,9 @@
{RIL_REQUEST_ISIM_AUTHENTICATION, dispatchString, responseString},
{RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, dispatchStrings, responseVoid},
{RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, dispatchString, responseSIM_IO},
{RIL_REQUEST_VOICE_RADIO_TECH, dispatchVoiceRadioTech, responseInts}, // 108
{RIL_REQUEST_VOICE_RADIO_TECH, dispatchVoiceRadioTech, responseInts},
{RIL_REQUEST_GET_CELL_INFO_LIST, dispatchVoid, responseCellInfoList},
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, dispatchInts, responseVoid}, // 110
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, dispatchInts, responseVoid},
{0, NULL, NULL}, // 10001
{RIL_REQUEST_GET_CELL_BROADCAST_CONFIG, dispatchVoid, responseVoid},
{0, NULL, NULL}, // 10003

Loading…
Cancel
Save