loc_api_v02: Initialize the QMI notifier before looking for service
Looking for a service results in opening and closing the IPC Router socket. This in turn involves IPC Router to trigger loading & unloading the modem. Sometimes this causes the race condition between modem unload and modem coming out of reset. CRs-fixed: 384906 Change-Id: I61767d3eeab5867f64f94c5d4cdee4272de2dc44
This commit is contained in:
parent
f2738552cc
commit
72e3b852de
1 changed files with 22 additions and 32 deletions
|
@ -1543,6 +1543,8 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
uint32_t num_services = 0, num_entries = 0;
|
uint32_t num_services = 0, num_entries = 0;
|
||||||
qmi_client_error_type rc = QMI_NO_ERR;
|
qmi_client_error_type rc = QMI_NO_ERR;
|
||||||
bool nosignal = false;
|
bool nosignal = false;
|
||||||
|
qmi_client_os_params os_params;
|
||||||
|
int timeout = 0;
|
||||||
|
|
||||||
// Get the service object for the qmiLoc Service
|
// Get the service object for the qmiLoc Service
|
||||||
qmi_idl_service_object_type locClientServiceObject =
|
qmi_idl_service_object_type locClientServiceObject =
|
||||||
|
@ -1557,18 +1559,6 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the service addressing information
|
|
||||||
rc = qmi_client_get_service_list( locClientServiceObject, NULL, NULL,
|
|
||||||
&num_services);
|
|
||||||
LOC_LOGV("%s:%d]: qmi_client_get_service_list() first try rc %d, "
|
|
||||||
"num_services %d", __func__, __LINE__, rc, num_services);
|
|
||||||
|
|
||||||
if (rc != QMI_NO_ERR) {
|
|
||||||
// bummer, service list is not up.
|
|
||||||
// We need to try again after a timed wait
|
|
||||||
qmi_client_os_params os_params;
|
|
||||||
int timeout = 0;
|
|
||||||
|
|
||||||
// register for service notification
|
// register for service notification
|
||||||
rc = qmi_client_notifier_init(locClientServiceObject, &os_params, ¬ifier);
|
rc = qmi_client_notifier_init(locClientServiceObject, &os_params, ¬ifier);
|
||||||
notifierInitFlag = (NULL != notifier);
|
notifierInitFlag = (NULL != notifier);
|
||||||
|
@ -1582,21 +1572,21 @@ static locClientStatusEnumType locClientQmiCtrlPointInit(
|
||||||
|
|
||||||
do {
|
do {
|
||||||
QMI_CCI_OS_SIGNAL_CLEAR(&os_params);
|
QMI_CCI_OS_SIGNAL_CLEAR(&os_params);
|
||||||
/* If service is not up wait on a signal until the service is up
|
|
||||||
* or a timeout occurs. */
|
|
||||||
QMI_CCI_OS_SIGNAL_WAIT(&os_params, LOC_CLIENT_SERVICE_TIMEOUT_UNIT);
|
|
||||||
nosignal = QMI_CCI_OS_SIGNAL_TIMED_OUT(&os_params);
|
|
||||||
|
|
||||||
// get the service addressing information
|
// get the service addressing information
|
||||||
rc = qmi_client_get_service_list(locClientServiceObject, NULL, NULL,
|
rc = qmi_client_get_service_list(locClientServiceObject, NULL, NULL,
|
||||||
&num_services);
|
&num_services);
|
||||||
|
/* If service is not up wait on a signal until the service is up
|
||||||
|
* or a timeout occurs. */
|
||||||
|
if (rc != QMI_NO_ERR) {
|
||||||
|
QMI_CCI_OS_SIGNAL_WAIT(&os_params, LOC_CLIENT_SERVICE_TIMEOUT_UNIT);
|
||||||
|
nosignal = QMI_CCI_OS_SIGNAL_TIMED_OUT(&os_params);
|
||||||
|
}
|
||||||
|
|
||||||
timeout += LOC_CLIENT_SERVICE_TIMEOUT_UNIT;
|
timeout += LOC_CLIENT_SERVICE_TIMEOUT_UNIT;
|
||||||
|
|
||||||
LOC_LOGV("%s:%d]: qmi_client_get_service_list() rc %d, nosignal %d, "
|
LOC_LOGV("%s:%d]: qmi_client_get_service_list() rc %d, nosignal %d, "
|
||||||
"total timeout %d", __func__, __LINE__, rc, nosignal, timeout);
|
"total timeout %d", __func__, __LINE__, rc, nosignal, timeout);
|
||||||
} while (timeout < LOC_CLIENT_SERVICE_TIMEOUT_TOTAL && nosignal && rc != QMI_NO_ERR);
|
} while (timeout < LOC_CLIENT_SERVICE_TIMEOUT_TOTAL && nosignal && rc != QMI_NO_ERR);
|
||||||
}
|
|
||||||
|
|
||||||
if (0 == num_services || rc != QMI_NO_ERR) {
|
if (0 == num_services || rc != QMI_NO_ERR) {
|
||||||
if (!nosignal) {
|
if (!nosignal) {
|
||||||
|
|
Loading…
Reference in a new issue