libfmjni: Improve and fix FM jni logs

* Log cur_fm_state as Debug instead of Error
 * Log successful and state logs as Debug and Info instead of Error
 * Log step by step firmware download as Info and Debug
 * Fix logging of the is_rds_support
 * Add __func__ name for the cur_fm_state logs
 * Add a cur_fm_state log for Stop_Scan_Seek
 * Add missing LOG_TAG for all sources using ALOG*
 * Avoid double log on error in IsRdsSupport
 * Fix typos, relevant warnings and cleanup related sources

Change-Id: I2abe77c6f00c02ef106b569bef5db6b366e76df1
This commit is contained in:
AdrianDC
2015-12-30 18:31:39 +01:00
committed by Michael Bestas
parent 172afb463a
commit 589a1dd62c
7 changed files with 58 additions and 44 deletions

View File

@@ -27,6 +27,8 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define LOG_TAG "android_hardware_fm"
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -163,7 +165,7 @@ int FmRadioController ::Pwr_Up(int freq)
ALOGI("%s,[freq=%d]\n", __func__, freq);
property_get("qcom.bluetooth.soc", value, NULL);
ALOGD("BT soc is %s\n", value);
ALOGD("BT soc is '%s'\n", value);
if (fd_driver < 0) {
ret = open_dev();
if (ret != FM_SUCCESS) {
@@ -173,7 +175,7 @@ int FmRadioController ::Pwr_Up(int freq)
}
if (cur_fm_state == FM_OFF) {
ALOGE("cur_fm_state = %d\n",cur_fm_state);
ALOGD("%s: cur_fm_state = %d\n", __func__, cur_fm_state);
if (strcmp(value, "rome") != 0) {
ret = FmIoctlsInterface::start_fm_patch_dl(fd_driver);
if (ret != FM_SUCCESS) {
@@ -284,7 +286,7 @@ int FmRadioController ::Pwr_Down()
V4L2_CID_PRV_STATE, FM_DEV_NONE);
}
if(event_listener_thread != 0) {
ALOGD("%s, event_listener_thread canceeled\n", __func__);
ALOGD("%s, event_listener_thread cancelled\n", __func__);
event_listener_canceled = true;
pthread_join(event_listener_thread, NULL);
}
@@ -333,7 +335,7 @@ int FmRadioController :: Seek(int dir)
struct timespec ts;
if (cur_fm_state != FM_ON) {
ALOGE("%s error Fm state: %d\n", __func__,cur_fm_state);
ALOGE("%s error Fm state: %d\n", __func__, cur_fm_state);
return FM_FAILURE;
}
@@ -383,7 +385,7 @@ bool FmRadioController ::IsRds_support
)
{
is_rds_support = true;
ALOGI("is_rds_support: \n", is_rds_support);
ALOGI("is_rds_support: %d\n", is_rds_support);
return is_rds_support;
}
@@ -392,12 +394,12 @@ int FmRadioController ::MuteOn()
{
int ret;
ALOGE("cur_fm_state = %d\n", cur_fm_state);
ALOGD("%s: cur_fm_state = %d\n", __func__, cur_fm_state);
if((cur_fm_state != FM_OFF) &&
(cur_fm_state != FM_ON_IN_PROGRESS)) {
ret = FmIoctlsInterface::set_control(fd_driver,
V4L2_CID_AUDIO_MUTE, MUTE_L_R_CHAN);
ALOGE("CMD executed mute\n");
ALOGI("CMD executed mute\n");
}else {
ret = FM_FAILURE;
}
@@ -409,12 +411,12 @@ int FmRadioController ::MuteOff()
{
int ret;
ALOGE("cur_fm_state = %d\n", cur_fm_state);
ALOGD("%s: cur_fm_state = %d\n", __func__, cur_fm_state);
if((cur_fm_state != FM_OFF) &&
(cur_fm_state != FM_ON_IN_PROGRESS)) {
ret = FmIoctlsInterface::set_control(fd_driver,
V4L2_CID_AUDIO_MUTE, UNMUTE_L_R_CHAN);
ALOGE("CMD executed for unmute\n");
ALOGI("CMD executed for unmute\n");
}else {
ret = FM_FAILURE;
}
@@ -456,8 +458,9 @@ int FmRadioController :: Stop_Scan_Seek
(
)
{
int ret;
int ret;
ALOGD("%s: cur_fm_state = %d\n", __func__, cur_fm_state);
if((cur_fm_state == SEEK_IN_PROGRESS) ||
(cur_fm_state == SCAN_IN_PROGRESS)) {
ret = FmIoctlsInterface::set_control(fd_driver,
@@ -616,7 +619,7 @@ int FmRadioController :: SetDeConstant
{
int ret;
ALOGE("cur_fm_state: %d, emphasis: %d\n", cur_fm_state, emphasis);
ALOGD("cur_fm_state: %d, emphasis: %ld\n", cur_fm_state, emphasis);
if(cur_fm_state == FM_ON) {
switch(emphasis) {
case DE_EMP75:
@@ -686,7 +689,7 @@ int FmRadioController :: GetStationList
freq |= tmpFreqByte2;
ALOGI(" freq: %d", freq);
real_freq = (freq * FREQ_MULTIPLEX) + lowBand;
ALOGI(" real_freq: %d", real_freq);
ALOGI("real_freq: %f", real_freq);
if ( (real_freq < lowBand ) || (real_freq > highBand) ) {
ALOGI("Frequency out of band limits");
} else {
@@ -741,7 +744,7 @@ int FmRadioController ::ScanList
return FM_FAILURE;
}
} else {
ALOGI("Scanlist: not proper state %d\n",cur_fm_state );
ALOGI("Scanlist: not proper state %d\n", cur_fm_state);
return FM_FAILURE;
}
return FM_SUCCESS;
@@ -798,7 +801,7 @@ int FmRadioController :: EnableRDS
{
int ret = FM_FAILURE;
ALOGE("%s:cur_fm_state = %d\n", __func__, cur_fm_state);
ALOGD("%s: cur_fm_state = %d\n", __func__, cur_fm_state);
if (cur_fm_state == FM_ON) {
ret = FmIoctlsInterface::set_control(fd_driver,
V4L2_CID_PRV_RDSON, 1);
@@ -818,7 +821,7 @@ int FmRadioController :: EnableRDS
rds_enabled = 1;
EnableAF();
} else {
ALOGE("%s:not in proper state cur_fm_state = %d\n", cur_fm_state);
ALOGE("%s: not in proper state cur_fm_state = %d\n", __func__, cur_fm_state);
return ret;
}
return ret;
@@ -833,7 +836,7 @@ int FmRadioController :: DisableRDS
{
int ret = FM_FAILURE;
ALOGE("%s:cur_fm_state = %d\n", __func__, cur_fm_state);
ALOGD("%s: cur_fm_state = %d\n", __func__, cur_fm_state);
if (cur_fm_state == FM_ON) {
ret = FmIoctlsInterface::set_control(fd_driver,
V4L2_CID_PRV_RDSON, 2);
@@ -845,7 +848,7 @@ int FmRadioController :: DisableRDS
rds_enabled = 0;
DisableAF();
} else {
ALOGE("%s:not in proper state cur_fm_state = %d\n", cur_fm_state);
ALOGE("%s: not in proper state cur_fm_state = %d\n", __func__, cur_fm_state);
ret = FM_FAILURE;
}
return ret;