summaryrefslogtreecommitdiff
path: root/src/mm_radio_priv_hal.c
diff options
context:
space:
mode:
authorGilbok Lee <gilbok.lee@samsung.com>2017-02-20 20:33:12 +0900
committerGilbok Lee <gilbok.lee@samsung.com>2017-02-20 20:33:12 +0900
commit6ebdd69081e06c5888eefe785f0c2c37062c483f (patch)
treebec89585bfcd3622a54fa440b91883abae758d9b /src/mm_radio_priv_hal.c
parent684952d47398be7a40eb4a0137a307ccefc32cf7 (diff)
downloadlibmm-radio-6ebdd69081e06c5888eefe785f0c2c37062c483f.tar.gz
libmm-radio-6ebdd69081e06c5888eefe785f0c2c37062c483f.tar.bz2
libmm-radio-6ebdd69081e06c5888eefe785f0c2c37062c483f.zip
Add more logs for debugging
[Version] 0.2.21 [Profile] Mobile, Wearable [Issue Type] Add log Change-Id: Id832b06d265300d31ea918cc4a7bfb67bf7929f5
Diffstat (limited to 'src/mm_radio_priv_hal.c')
-rw-r--r--src/mm_radio_priv_hal.c60
1 files changed, 38 insertions, 22 deletions
diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c
index ae5bca3..82afebb 100644
--- a/src/mm_radio_priv_hal.c
+++ b/src/mm_radio_priv_hal.c
@@ -169,7 +169,7 @@ int _mmradio_apply_region(mm_radio_t *radio, MMRadioRegionType region, bool upda
}
}
- MMRADIO_LOG_DEBUG("setting region - country: %d, de-emphasis: %d, band range: %d ~ %d KHz",
+ MMRADIO_LOG_INFO("setting region - country: %d, de-emphasis: %d, band range: %d ~ %d KHz",
radio->region_setting.country, radio->region_setting.deemphasis,
radio->region_setting.band_min, radio->region_setting.band_max);
@@ -249,7 +249,7 @@ int _mmradio_realize(mm_radio_t *radio)
ret = pthread_mutex_init(&radio->seek_cancel_mutex, NULL);
if (ret < 0) {
- MMRADIO_LOG_DEBUG("Mutex creation failed %d", ret);
+ MMRADIO_LOG_ERROR("Mutex creation failed %d", ret);
return MM_ERROR_RADIO_INTERNAL;
}
@@ -357,6 +357,18 @@ int _mmradio_destroy(mm_radio_t *radio)
MMRADIO_LOG_ERROR("mmradio hal interface deinit failed");
return ret;
}
+
+ /* destroy command lock */
+ ret = pthread_mutex_destroy(&radio->cmd_lock);
+ if (ret) {
+ MMRADIO_LOG_ERROR("mutex destroy failed\n");
+ }
+
+ ret = pthread_mutex_destroy(&radio->volume_lock);
+ if (ret) {
+ MMRADIO_LOG_ERROR("volume mutex destroy failed\n");
+ }
+
#ifdef TIZEN_FEATURE_SOUND_FOCUS
ret = mmradio_sound_focus_deregister(&radio->sound_focus);
if (ret) {
@@ -379,7 +391,7 @@ int _mmradio_set_frequency(mm_radio_t *radio, int freq)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_FREQ);
- MMRADIO_LOG_DEBUG("Setting %d frequency", freq);
+ MMRADIO_LOG_INFO("Setting %d frequency", freq);
radio->freq = freq;
@@ -415,6 +427,7 @@ int _mmradio_get_frequency(mm_radio_t *radio, int *pFreq)
}
/* update freq in handle */
+ MMRADIO_LOG_INFO("Updating %d frequency", freq);
radio->freq = freq;
*pFreq = (int)radio->freq;
@@ -442,6 +455,7 @@ int _mmradio_mute(mm_radio_t *radio)
}
radio->is_muted = TRUE;
+ MMRADIO_LOG_INFO("Radio mute state [%d]", radio->is_muted);
MMRADIO_LOG_FLEAVE();
return ret;
@@ -465,7 +479,7 @@ int _mmradio_unmute(mm_radio_t *radio)
}
radio->is_muted = FALSE;
-
+ MMRADIO_LOG_INFO("Radio mute state [%d]", radio->is_muted);
MMRADIO_LOG_FLEAVE();
return ret;
@@ -515,7 +529,7 @@ int _mmradio_start(mm_radio_t *radio)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_START);
- MMRADIO_LOG_DEBUG("now tune to frequency : %d", radio->freq);
+ MMRADIO_LOG_INFO("now tune to frequency : %d", radio->freq);
#ifdef TIZEN_FEATURE_SOUND_FOCUS
if (radio->sound_focus.handle > 0) {
@@ -691,7 +705,7 @@ int _mmradio_seek(mm_radio_t *radio, MMRadioSeekDirectionType direction)
radio->seek_unmute = TRUE;
}
- MMRADIO_LOG_DEBUG("trying to seek. direction[0:UP/1:DOWN) %d", direction);
+ MMRADIO_LOG_INFO("trying to seek. direction[0:UP/1:DOWN) %d", direction);
radio->seek_direction = direction;
ret = pthread_create(&radio->seek_thread, NULL, (void *)__mmradio_seek_thread, (void *)radio);
@@ -732,9 +746,9 @@ void _mmradio_seek_cancel(mm_radio_t *radio)
ret = pthread_mutex_trylock(&radio->seek_cancel_mutex);
MMRADIO_LOG_DEBUG("try lock ret: %s (%d)", strerror_r(ret, str_error, sizeof(str_error)), ret);
if (ret == EBUSY) { /* it was already locked by other */
- MMRADIO_LOG_DEBUG("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT");
+ MMRADIO_LOG_WARNING("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT");
} else if (ret == 0) {
- MMRADIO_LOG_DEBUG("trylock is successful. unlock now");
+ MMRADIO_LOG_INFO("trylock is successful. unlock now");
pthread_mutex_unlock(&radio->seek_cancel_mutex);
} else {
MMRADIO_LOG_ERROR("trylock is failed but Not EBUSY. ret: %d", ret);
@@ -787,7 +801,7 @@ int _mmradio_start_scan(mm_radio_t *radio)
scan_tr_id = pthread_create(&radio->scan_thread, NULL, (void *)__mmradio_scan_thread, (void *)radio);
if (scan_tr_id != 0) {
- MMRADIO_LOG_DEBUG("failed to create thread : scan");
+ MMRADIO_LOG_ERROR("failed to create thread : scan");
return MM_ERROR_RADIO_NOT_INITIALIZED;
}
@@ -814,9 +828,9 @@ int _mmradio_stop_scan(mm_radio_t *radio)
ret = pthread_mutex_trylock(&radio->seek_cancel_mutex);
MMRADIO_LOG_DEBUG("try lock ret: %s (%d)", strerror_r(ret, str_error, sizeof(str_error)), ret);
if (ret == EBUSY) { /* it was already locked by other */
- MMRADIO_LOG_DEBUG("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT");
+ MMRADIO_LOG_WARNING("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT");
} else if (ret == 0) {
- MMRADIO_LOG_DEBUG("trylock is successful. unlock now");
+ MMRADIO_LOG_INFO("trylock is successful. unlock now");
pthread_mutex_unlock(&radio->seek_cancel_mutex);
} else {
MMRADIO_LOG_ERROR("trylock is failed but Not EBUSY. ret: %d", ret);
@@ -888,7 +902,7 @@ void __mmradio_scan_thread(mm_radio_t *radio)
pthread_mutex_lock(&radio->seek_cancel_mutex);
if (radio->stop_scan) {
- MMRADIO_LOG_DEBUG("scan was canceled");
+ MMRADIO_LOG_INFO("scan was canceled");
pthread_mutex_unlock(&radio->seek_cancel_mutex);
goto FINISHED;
}
@@ -919,11 +933,11 @@ void __mmradio_scan_thread(mm_radio_t *radio)
continue;
prev_freq = param.radio_scan.frequency = (int)freq;
- MMRADIO_LOG_DEBUG("scanning : new frequency : [%d]", param.radio_scan.frequency);
+ MMRADIO_LOG_INFO("scanning : new frequency : [%d]", param.radio_scan.frequency);
/* drop if max freq is scanned */
if (param.radio_scan.frequency == radio->region_setting.band_max) {
- MMRADIO_LOG_DEBUG("%d freq is dropping...and stopping scan", param.radio_scan.frequency);
+ MMRADIO_LOG_WARNING("%d freq is dropping...and stopping scan", param.radio_scan.frequency);
break;
}
@@ -1028,7 +1042,7 @@ void __mmradio_seek_thread(mm_radio_t *radio)
MMRADIO_LOG_DEBUG("seek start");
if (radio->seek_cancel) {
- MMRADIO_LOG_DEBUG("seek was canceled so we return failure to application");
+ MMRADIO_LOG_INFO("seek was canceled so we return failure to application");
pthread_mutex_unlock(&radio->seek_cancel_mutex);
goto SEEK_FAILED;
}
@@ -1051,7 +1065,7 @@ void __mmradio_seek_thread(mm_radio_t *radio)
/* if same freq is found, ignore it and search next one. */
if (freq == radio->prev_seek_freq) {
- MMRADIO_LOG_DEBUG("It's same with previous found one. So, trying next one.");
+ MMRADIO_LOG_WARNING("It's same with previous found one. So, trying next one.");
goto SEEK_FAILED;
}
@@ -1079,7 +1093,7 @@ void __mmradio_seek_thread(mm_radio_t *radio)
}
param.radio_scan.frequency = radio->prev_seek_freq = (int)freq;
- MMRADIO_LOG_DEBUG("seeking : new frequency : [%d]", param.radio_scan.frequency);
+ MMRADIO_LOG_INFO("seeking : new frequency : [%d]", param.radio_scan.frequency);
MMRADIO_POST_MSG(radio, MM_MESSAGE_RADIO_SEEK_FINISH, &param);
}
@@ -1141,7 +1155,7 @@ static int __mmradio_check_state(mm_radio_t *radio, MMRadioCommand command)
radio_state = __mmradio_get_state(radio);
- MMRADIO_LOG_DEBUG("incomming command : %d current state : %d", command, radio_state);
+ MMRADIO_LOG_INFO("incomming command : %d current state : %d", command, radio_state);
switch (command) {
case MMRADIO_COMMAND_CREATE:
@@ -1326,7 +1340,7 @@ static int __mmradio_get_state(mm_radio_t *radio)
{
MMRADIO_CHECK_INSTANCE(radio);
- MMRADIO_LOG_DEBUG("radio state : current : [%d] old : [%d] pending : [%d]",
+ MMRADIO_LOG_INFO("radio state : current : [%d] old : [%d] pending : [%d]",
radio->current_state, radio->old_state, radio->pending_state);
return radio->current_state;
@@ -1344,6 +1358,7 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
MMRADIO_LOG_FENTER();
MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
+ MMRADIO_LOG_INFO("focus_state [%d]", focus_state);
mmradio_get_sound_focus_reason(focus_state, reason_for_change, FALSE, &event_source, &postMsg);
radio->sound_focus.event_src = event_source;
@@ -1396,6 +1411,7 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t
MMRADIO_LOG_FENTER();
MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
+ MMRADIO_LOG_INFO("focus_state [%d]", focus_state);
mmradio_get_sound_focus_reason(focus_state, reason_for_change, TRUE, &event_source, &postMsg);
radio->sound_focus.event_src = event_source;
@@ -1444,7 +1460,7 @@ static void __mmradio_volume_changed_cb(volume_type_t type, unsigned int volume,
int ret = MM_ERROR_NONE;
MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio);
if (type == VOLUME_TYPE_MEDIA) {
- MMRADIO_LOG_DEBUG("Change FM Radio volume to %d", volume);
+ MMRADIO_LOG_INFO("Change FM Radio volume to %d", volume);
ret = __mmradio_set_media_volume(radio, volume);
if (ret != MM_ERROR_NONE)
MMRADIO_LOG_ERROR("__mmradio_set_media_volume error");
@@ -1504,7 +1520,7 @@ int _mmradio_set_volume(mm_radio_t *radio, float volume)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_VOLUME);
- MMRADIO_LOG_DEBUG("Setting %f volume", volume);
+ MMRADIO_LOG_INFO("Setting %f volume", volume);
MMRADIO_VOLUME_LOCK(radio);
radio->local_volume = volume;
@@ -1556,7 +1572,7 @@ static int __mmradio_set_media_volume(mm_radio_t *radio, unsigned int level)
MMRADIO_CHECK_INSTANCE(radio);
MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_VOLUME);
- MMRADIO_LOG_DEBUG("Setting %d volume", level);
+ MMRADIO_LOG_INFO("Setting %d volume", level);
MMRADIO_VOLUME_LOCK(radio);
radio->media_volume = level;