mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +00:00
libril: handle Samsung proprietary commands
Change-Id: Ief8402c8e75c677c7f2e32794f13867b924b209f
This commit is contained in:
parent
0063444a40
commit
d53206c5bd
3 changed files with 192 additions and 7 deletions
69
ril/libril/include/telephony/ril_commands_vendor.h
Normal file
69
ril/libril/include/telephony/ril_commands_vendor.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* //device/libs/telephony/ril_commands.h
|
||||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
{RIL_OEM_REQUEST_BASE, NULL}, // RIL_OEM_REQUEST_BASE should be defined as 10000 in ril.h
|
||||
{10001, NULL},
|
||||
{RIL_REQUEST_GET_CELL_BROADCAST_CONFIG, NULL},
|
||||
{10003, NULL},
|
||||
{10004, NULL},
|
||||
{RIL_REQUEST_SEND_ENCODED_USSD, NULL},
|
||||
{RIL_REQUEST_SET_PDA_MEMORY_STATUS, NULL},
|
||||
{RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO, NULL},
|
||||
{RIL_REQUEST_GET_PHONEBOOK_ENTRY, NULL},
|
||||
{RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY, NULL},
|
||||
{RIL_REQUEST_DIAL_VIDEO_CALL, NULL},
|
||||
{RIL_REQUEST_CALL_DEFLECTION, NULL},
|
||||
{RIL_REQUEST_READ_SMS_FROM_SIM, NULL},
|
||||
{RIL_REQUEST_USIM_PB_CAPA, NULL},
|
||||
{RIL_REQUEST_LOCK_INFO, NULL},
|
||||
{10015, NULL},
|
||||
{RIL_REQUEST_DIAL_EMERGENCY, NULL},
|
||||
{RIL_REQUEST_GET_STOREAD_MSG_COUNT, NULL},
|
||||
{RIL_REQUEST_STK_SIM_INIT_EVENT, NULL},
|
||||
{RIL_REQUEST_GET_LINE_ID, NULL},
|
||||
{RIL_REQUEST_SET_LINE_ID, NULL},
|
||||
{RIL_REQUEST_GET_SERIAL_NUMBER, NULL},
|
||||
{RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER, NULL},
|
||||
{RIL_REQUEST_GET_BARCODE_NUMBER, NULL},
|
||||
{RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP, NULL},
|
||||
{RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF, NULL},
|
||||
{RIL_REQUEST_SIM_TRANSMIT_BASIC, NULL},
|
||||
{RIL_REQUEST_SIM_OPEN_CHANNEL, NULL},
|
||||
{RIL_REQUEST_SIM_CLOSE_CHANNEL, NULL},
|
||||
{RIL_REQUEST_SIM_TRANSMIT_CHANNEL, NULL},
|
||||
{RIL_REQUEST_SIM_AUTH, NULL},
|
||||
{RIL_REQUEST_PS_ATTACH, NULL},
|
||||
{RIL_REQUEST_PS_DETACH, NULL},
|
||||
{RIL_REQUEST_ACTIVATE_DATA_CALL, NULL},
|
||||
{RIL_REQUEST_CHANGE_SIM_PERSO, NULL},
|
||||
{RIL_REQUEST_ENTER_SIM_PERSO, NULL},
|
||||
{RIL_REQUEST_GET_TIME_INFO, NULL},
|
||||
{RIL_REQUEST_OMADM_SETUP_SESSION, NULL},
|
||||
{RIL_REQUEST_OMADM_SERVER_START_SESSION, NULL},
|
||||
{RIL_REQUEST_OMADM_CLIENT_START_SESSION, NULL},
|
||||
{RIL_REQUEST_OMADM_SEND_DATA, NULL},
|
||||
{RIL_REQUEST_CDMA_GET_DATAPROFILE, NULL},
|
||||
{RIL_REQUEST_CDMA_SET_DATAPROFILE, NULL},
|
||||
{RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES, NULL},
|
||||
{RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES, NULL},
|
||||
{RIL_REQUEST_SEND_SMS_COUNT, NULL},
|
||||
{RIL_REQUEST_SEND_SMS_MSG, NULL},
|
||||
{RIL_REQUEST_SEND_SMS_MSG_READ_STATUS, NULL},
|
||||
{RIL_REQUEST_MODEM_HANGUP, NULL},
|
||||
{RIL_REQUEST_SET_SIM_POWER, NULL},
|
||||
{RIL_REQUEST_SET_PREFERRED_NETWORK_LIST, NULL},
|
||||
{RIL_REQUEST_GET_PREFERRED_NETWORK_LIST, NULL},
|
||||
{RIL_REQUEST_HANGUP_VT, NULL},
|
55
ril/libril/include/telephony/ril_unsol_commands_vendor.h
Normal file
55
ril/libril/include/telephony/ril_unsol_commands_vendor.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* //device/libs/telephony/ril_unsol_commands.h
|
||||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
{SAMSUNG_UNSOL_RESPONSE_BASE, NULL, WAKE_PARTIAL}, // SAMSUNG_UNSOL_RESPONSE_BASE should be defined as 11000 in ril.h
|
||||
{RIL_UNSOL_RELEASE_COMPLETE_MESSAGE, NULL, WAKE_PARTIAL}, // 11001
|
||||
{RIL_UNSOL_STK_SEND_SMS_RESULT, NULL, WAKE_PARTIAL}, // 11002
|
||||
{RIL_UNSOL_STK_CALL_CONTROL_RESULT, NULL, WAKE_PARTIAL}, // 11003
|
||||
{RIL_UNSOL_DUN_CALL_STATUS, NULL, WAKE_PARTIAL}, // 11004
|
||||
{11005, NULL, WAKE_PARTIAL},
|
||||
{11006, NULL, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_O2_HOME_ZONE_INFO, NULL, WAKE_PARTIAL}, // 11007
|
||||
{RIL_UNSOL_DEVICE_READY_NOTI, NULL, WAKE_PARTIAL}, // 11008
|
||||
{RIL_UNSOL_GPS_NOTI, NULL, WAKE_PARTIAL}, // 11009
|
||||
{RIL_UNSOL_AM, NULL, WAKE_PARTIAL}, // 11010
|
||||
{RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL, NULL, WAKE_PARTIAL}, // 11011
|
||||
{RIL_UNSOL_DATA_SUSPEND_RESUME, NULL, WAKE_PARTIAL}, // 11012
|
||||
{RIL_UNSOL_SAP, NULL, WAKE_PARTIAL}, // 11013
|
||||
{11014, NULL, WAKE_PARTIAL},
|
||||
{RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE, NULL, WAKE_PARTIAL}, // 11015
|
||||
{RIL_UNSOL_HSDPA_STATE_CHANGED, NULL, WAKE_PARTIAL}, // 11016
|
||||
{RIL_UNSOL_WB_AMR_STATE, NULL, WAKE_PARTIAL}, // 11017
|
||||
{RIL_UNSOL_TWO_MIC_STATE, NULL, WAKE_PARTIAL}, // 11018
|
||||
{RIL_UNSOL_DHA_STATE, NULL, WAKE_PARTIAL}, // 11019
|
||||
{RIL_UNSOL_UART, NULL, WAKE_PARTIAL}, // 11020
|
||||
{RIL_UNSOL_RESPONSE_HANDOVER, NULL, WAKE_PARTIAL}, // 11021
|
||||
{RIL_UNSOL_IPV6_ADDR, NULL, WAKE_PARTIAL}, // 11022
|
||||
{RIL_UNSOL_NWK_INIT_DISC_REQUEST, NULL, WAKE_PARTIAL}, // 11023
|
||||
{RIL_UNSOL_RTS_INDICATION, NULL, WAKE_PARTIAL}, // 11024
|
||||
{RIL_UNSOL_OMADM_SEND_DATA, NULL, WAKE_PARTIAL}, // 11025
|
||||
{RIL_UNSOL_DUN, NULL, WAKE_PARTIAL}, // 11026
|
||||
{RIL_UNSOL_SYSTEM_REBOOT, NULL, WAKE_PARTIAL}, // 11027
|
||||
{RIL_UNSOL_VOICE_PRIVACY_CHANGED, NULL, WAKE_PARTIAL}, // 11028
|
||||
{RIL_UNSOL_UTS_GETSMSCOUNT, NULL, WAKE_PARTIAL}, // 11029
|
||||
{RIL_UNSOL_UTS_GETSMSMSG, NULL, WAKE_PARTIAL}, // 11030
|
||||
{RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS, NULL, WAKE_PARTIAL}, // 11031
|
||||
{RIL_UNSOL_MIP_CONNECT_STATUS, NULL, WAKE_PARTIAL}, // 11032
|
||||
#ifdef RIL_UNSOL_SNDMGR_WB_AMR_REPORT
|
||||
{RIL_UNSOL_SNDMGR_WB_AMR_REPORT, NULL, WAKE_PARTIAL}, // 20017
|
||||
#endif
|
||||
#ifdef RIL_UNSOL_SNDMGR_CLOCK_CTRL
|
||||
{RIL_UNSOL_SNDMGR_CLOCK_CTRL, NULL, WAKE_PARTIAL}, // 20022
|
||||
#endif
|
|
@ -209,6 +209,14 @@ static UnsolResponseInfo s_unsolResponses[] = {
|
|||
#include "ril_unsol_commands.h"
|
||||
};
|
||||
|
||||
static CommandInfo s_commands_v[] = {
|
||||
#include <telephony/ril_commands_vendor.h>
|
||||
};
|
||||
|
||||
static UnsolResponseInfo s_unsolResponses_v[] = {
|
||||
#include <telephony/ril_unsol_commands_vendor.h>
|
||||
};
|
||||
|
||||
char * RIL_getServiceName() {
|
||||
return ril_service_name;
|
||||
}
|
||||
|
@ -248,6 +256,18 @@ addRequestToList(int serial, int slotId, int request) {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
CommandInfo *pCI = NULL;
|
||||
if (request > RIL_OEM_REQUEST_BASE) {
|
||||
int index = request - RIL_OEM_REQUEST_BASE;
|
||||
RLOGD("processCommandBuffer: samsung request=%d, index=%d",
|
||||
request, index);
|
||||
if (index < (int32_t)NUM_ELEMS(s_commands_v))
|
||||
pCI = &(s_commands_v[index]);
|
||||
} else {
|
||||
if (request < (int32_t)NUM_ELEMS(s_commands))
|
||||
pCI = &(s_commands[request]);
|
||||
}
|
||||
|
||||
pRI = (RequestInfo *)calloc(1, sizeof(RequestInfo));
|
||||
if (pRI == NULL) {
|
||||
RLOGE("Memory allocation failed for request %s", requestToString(request));
|
||||
|
@ -255,7 +275,7 @@ addRequestToList(int serial, int slotId, int request) {
|
|||
}
|
||||
|
||||
pRI->token = serial;
|
||||
pRI->pCI = &(s_commands[request]);
|
||||
pRI->pCI = pCI;
|
||||
pRI->socket_id = socket_id;
|
||||
|
||||
ret = pthread_mutex_lock(pendingRequestsMutexHook);
|
||||
|
@ -469,11 +489,20 @@ RIL_register (const RIL_RadioFunctions *callbacks) {
|
|||
assert(i == s_commands[i].requestNumber);
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)NUM_ELEMS(s_commands_v); i++) {
|
||||
assert(i + RIL_OEM_REQUEST_BASE == s_commands[i].requestNumber);
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses); i++) {
|
||||
assert(i + RIL_UNSOL_RESPONSE_BASE
|
||||
== s_unsolResponses[i].requestNumber);
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses_v); i++) {
|
||||
assert(i + SAMSUNG_UNSOL_RESPONSE_BASE
|
||||
== s_unsolResponses[i].requestNumber);
|
||||
}
|
||||
|
||||
radio::registerService(&s_callbacks, s_commands);
|
||||
RLOGI("RILHIDL called registerService");
|
||||
|
||||
|
@ -752,7 +781,8 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
|
|||
int ret;
|
||||
bool shouldScheduleTimeout = false;
|
||||
RIL_SOCKET_ID soc_id = RIL_SOCKET_1;
|
||||
|
||||
UnsolResponseInfo *pRI = NULL;
|
||||
int32_t pRI_elements;
|
||||
#if defined(ANDROID_MULTI_SIM)
|
||||
soc_id = socket_id;
|
||||
#endif
|
||||
|
@ -765,9 +795,40 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
|
|||
}
|
||||
|
||||
unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE;
|
||||
pRI = s_unsolResponses;
|
||||
pRI_elements = (int32_t)NUM_ELEMS(s_unsolResponses);
|
||||
|
||||
if ((unsolResponseIndex < 0)
|
||||
|| (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) {
|
||||
/* Hack to include Samsung responses */
|
||||
if (unsolResponse > SAMSUNG_UNSOL_RESPONSE_BASE) {
|
||||
pRI = s_unsolResponses_v;
|
||||
pRI_elements = (int32_t)NUM_ELEMS(s_unsolResponses_v);
|
||||
|
||||
/*
|
||||
* Some of the vendor response codes cannot be found by calculating their index anymore,
|
||||
* because they have an even higher offset and are not ordered in the array.
|
||||
* Example: RIL_UNSOL_SNDMGR_WB_AMR_REPORT = 20017, but it's at index 33 in the vendor
|
||||
* response array.
|
||||
* Thus, look through all the vendor URIs (Unsol Response Info) and pick the correct index.
|
||||
* This has a cost of O(N).
|
||||
*/
|
||||
int pRI_index;
|
||||
for (pRI_index = 0; pRI_index < pRI_elements; pRI_index++) {
|
||||
if (pRI[pRI_index].requestNumber == unsolResponse) {
|
||||
unsolResponseIndex = pRI_index;
|
||||
}
|
||||
}
|
||||
|
||||
RLOGD("SAMSUNG: unsolResponse=%d, unsolResponseIndex=%d", unsolResponse, unsolResponseIndex);
|
||||
}
|
||||
|
||||
if (unsolResponseIndex >= 0 && unsolResponseIndex < pRI_elements) {
|
||||
pRI = &pRI[unsolResponseIndex];
|
||||
} else {
|
||||
RLOGE("could not map unsolResponse=%d to %s response array (index=%d)", unsolResponse,
|
||||
pRI == s_unsolResponses ? "AOSP" : "Samsung", unsolResponseIndex);
|
||||
}
|
||||
|
||||
if (pRI == NULL || pRI->responseFunction == NULL) {
|
||||
RLOGE("unsupported unsolicited response code %d", unsolResponse);
|
||||
return;
|
||||
}
|
||||
|
@ -775,7 +836,7 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
|
|||
// Grab a wake lock if needed for this reponse,
|
||||
// as we exit we'll either release it immediately
|
||||
// or set a timer to release it later.
|
||||
switch (s_unsolResponses[unsolResponseIndex].wakeType) {
|
||||
switch (pRI->wakeType) {
|
||||
case WAKE_PARTIAL:
|
||||
grabPartialWakeLock();
|
||||
shouldScheduleTimeout = true;
|
||||
|
@ -792,7 +853,7 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
|
|||
|
||||
int responseType;
|
||||
if (s_callbacks.version >= 13
|
||||
&& s_unsolResponses[unsolResponseIndex].wakeType == WAKE_PARTIAL) {
|
||||
&& pRI->wakeType == WAKE_PARTIAL) {
|
||||
responseType = RESPONSE_UNSOLICITED_ACK_EXP;
|
||||
} else {
|
||||
responseType = RESPONSE_UNSOLICITED;
|
||||
|
@ -802,7 +863,7 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
|
|||
int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
|
||||
assert(rwlockRet == 0);
|
||||
|
||||
ret = s_unsolResponses[unsolResponseIndex].responseFunction(
|
||||
ret = pRI->responseFunction(
|
||||
(int) soc_id, responseType, 0, RIL_E_SUCCESS, const_cast<void*>(data),
|
||||
datalen);
|
||||
|
||||
|
|
Loading…
Reference in a new issue