libfmjni: Resolve property isolation issues
* Set system instead of vendor properties for FM init on devices that don't use firmware download. * Shut the radio down properly while we are at it. Change-Id: I8f77a4f822ec8c609fe3526d7e96ea19d46cb1f8
This commit is contained in:
@@ -117,7 +117,11 @@ typedef unsigned long ULINT;
|
||||
//STRING LITERALS
|
||||
const char *const FM_MODE_PROP = "vendor.hw.fm.mode";
|
||||
const char *const FM_VERSION_PROP = "vendor.hw.fm.version";
|
||||
#ifndef QCOM_NO_FM_FIRMWARE
|
||||
const char *const FM_INIT_PROP = "vendor.hw.fm.init";
|
||||
#else
|
||||
const char *const FM_INIT_PROP = "hw.fm.init";
|
||||
#endif
|
||||
const char *const FM_INTERNAL_ANTENNA_PROP = "vendor.hw.fm.internal_antenna";
|
||||
const char *const SCRIPT_START_PROP = "ctl.start";
|
||||
const char *const SCRIPT_STOP_PROP = "ctl.stop";
|
||||
|
||||
@@ -42,15 +42,14 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
int FmIoctlsInterface :: start_fm_patch_dl
|
||||
(
|
||||
UINT fd
|
||||
UINT fd __unused
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
#ifndef QCOM_NO_FM_FIRMWARE
|
||||
int init_success = 0;
|
||||
char versionStr[MAX_VER_STR_LEN] = {'\0'};
|
||||
#ifndef QCOM_NO_FM_FIRMWARE
|
||||
char prop_value[PROPERTY_VALUE_MAX] = {'\0'};
|
||||
#endif
|
||||
struct v4l2_capability cap;
|
||||
|
||||
ALOGI("%s: start_fm_patch_dl = %d\n", __func__, fd);
|
||||
@@ -73,7 +72,6 @@ int FmIoctlsInterface :: start_fm_patch_dl
|
||||
ALOGD("set FM_INIT_PROP done");
|
||||
if(ret != PROP_SET_SUCC)
|
||||
return FM_FAILURE;
|
||||
#ifndef QCOM_NO_FM_FIRMWARE
|
||||
ret = property_set(SCRIPT_START_PROP, SOC_PATCH_DL_SCRPT);
|
||||
if(ret != PROP_SET_SUCC)
|
||||
return FM_FAILURE;
|
||||
@@ -86,13 +84,6 @@ int FmIoctlsInterface :: start_fm_patch_dl
|
||||
usleep(INIT_WAIT_TIMEOUT);
|
||||
}
|
||||
}
|
||||
#else
|
||||
ret = property_set(FM_INIT_PROP, "1");
|
||||
usleep(INIT_WAIT_TIMEOUT);
|
||||
if(ret != PROP_SET_SUCC)
|
||||
return FM_FAILURE;
|
||||
init_success = 1;
|
||||
#endif
|
||||
if(!init_success) {
|
||||
property_set(SCRIPT_STOP_PROP, SOC_PATCH_DL_SCRPT);
|
||||
return FM_FAILURE;
|
||||
@@ -103,6 +94,14 @@ int FmIoctlsInterface :: start_fm_patch_dl
|
||||
}else {
|
||||
return FM_FAILURE;
|
||||
}
|
||||
#else
|
||||
ret = property_set(FM_INIT_PROP, "1");
|
||||
usleep(INIT_WAIT_TIMEOUT);
|
||||
if (ret != PROP_SET_SUCC)
|
||||
return FM_FAILURE;
|
||||
else
|
||||
return FM_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
int FmIoctlsInterface :: close_fm_patch_dl
|
||||
@@ -110,9 +109,9 @@ int FmIoctlsInterface :: close_fm_patch_dl
|
||||
void
|
||||
)
|
||||
{
|
||||
#ifndef QCOM_NO_FM_FIRMWARE
|
||||
int ret;
|
||||
|
||||
#ifndef QCOM_NO_FM_FIRMWARE
|
||||
ret = property_set(SCRIPT_STOP_PROP, SOC_PATCH_DL_SCRPT);
|
||||
if(ret != PROP_SET_SUCC) {
|
||||
return FM_FAILURE;
|
||||
@@ -120,7 +119,11 @@ int FmIoctlsInterface :: close_fm_patch_dl
|
||||
return FM_SUCCESS;
|
||||
}
|
||||
#else
|
||||
return FM_SUCCESS;
|
||||
ret = property_set(FM_INIT_PROP, "0");
|
||||
if (ret != PROP_SET_SUCC)
|
||||
return FM_FAILURE;
|
||||
else
|
||||
return FM_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -267,6 +267,12 @@ exit:
|
||||
close_fd:
|
||||
event_listener_canceled = true;
|
||||
pthread_join(event_listener_thread, NULL);
|
||||
if (strcmp(value, "rome") != 0) {
|
||||
ret = FmIoctlsInterface::close_fm_patch_dl();
|
||||
if (ret != FM_SUCCESS) {
|
||||
ALOGE("FM patch downloader close failed: %d\n", ret);
|
||||
}
|
||||
}
|
||||
close(fd_driver);
|
||||
fd_driver = -1;
|
||||
set_fm_state(FM_OFF);
|
||||
@@ -278,6 +284,9 @@ close_fd:
|
||||
int FmRadioController ::Pwr_Down()
|
||||
{
|
||||
int ret = 0;
|
||||
char value[PROPERTY_VALUE_MAX] = {'\0'};
|
||||
|
||||
property_get("vendor.bluetooth.soc", value, NULL);
|
||||
|
||||
if((cur_fm_state != FM_OFF)) {
|
||||
Stop_Scan_Seek();
|
||||
@@ -290,6 +299,12 @@ int FmRadioController ::Pwr_Down()
|
||||
event_listener_canceled = true;
|
||||
pthread_join(event_listener_thread, NULL);
|
||||
}
|
||||
if (strcmp(value, "rome") != 0) {
|
||||
ret = FmIoctlsInterface::close_fm_patch_dl();
|
||||
if (ret != FM_SUCCESS) {
|
||||
ALOGE("FM patch downloader close failed: %d\n", ret);
|
||||
}
|
||||
}
|
||||
ALOGD("%s, [ret=%d]\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user