diff options
author | Simon Wilson <simonwilson@google.com> | 2011-07-26 20:12:51 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-07-29 14:55:57 -0700 |
commit | a25a688a9f15cb8e89fb5dc04ca97576701eb380 (patch) | |
tree | 7e42dca53317b1ea6c78b9384e8403cab4ced84e /audio/ril_interface.c | |
parent | 94f92f176c0ba63c616e7e70f3808d704209a7c2 (diff) | |
download | device_samsung_tuna-a25a688a9f15cb8e89fb5dc04ca97576701eb380.zip device_samsung_tuna-a25a688a9f15cb8e89fb5dc04ca97576701eb380.tar.gz device_samsung_tuna-a25a688a9f15cb8e89fb5dc04ca97576701eb380.tar.bz2 |
audio: use per-device maximum RIL volume
The maguro and toro devices have different radios, each
supporting a different maximum volume. Determine the maximum
volume for the device from the ro.config.vc_call_vol_steps
property and use that to calculate the volume to send to
the RIL.
Change-Id: I02921ed41ddbae90f8d3a149c05d37d3e87deab0
Diffstat (limited to 'audio/ril_interface.c')
-rw-r--r-- | audio/ril_interface.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/audio/ril_interface.c b/audio/ril_interface.c index 6bc0127..8793fae 100644 --- a/audio/ril_interface.c +++ b/audio/ril_interface.c @@ -18,11 +18,16 @@ /*#define LOG_NDEBUG 0*/ #include <dlfcn.h> +#include <stdlib.h> #include <utils/Log.h> +#include <cutils/properties.h> #include "ril_interface.h" +#define VOLUME_STEPS_DEFAULT "5" +#define VOLUME_STEPS_PROPERTY "ro.config.vc_call_vol_steps" + /* Function pointers */ void *(*_ril_open_client)(void); int (*_ril_close_client)(void *); @@ -47,6 +52,8 @@ static int ril_connect_if_required(struct ril_handle *ril) int ril_open(struct ril_handle *ril) { + char property[PROPERTY_VALUE_MAX]; + if (!ril) return -1; @@ -81,6 +88,13 @@ int ril_open(struct ril_handle *ril) return -1; } + property_get(VOLUME_STEPS_PROPERTY, property, VOLUME_STEPS_DEFAULT); + ril->volume_steps_max = atoi(property); + /* this catches the case where VOLUME_STEPS_PROPERTY does not contain + an integer */ + if (ril->volume_steps_max == 0) + ril->volume_steps_max = atoi(VOLUME_STEPS_DEFAULT); + return 0; } @@ -100,12 +114,13 @@ int ril_close(struct ril_handle *ril) } int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type, - int volume) + float volume) { if (ril_connect_if_required(ril)) return 0; - return _ril_set_call_volume(ril->client, sound_type, volume); + return _ril_set_call_volume(ril->client, sound_type, + (int)(volume * ril->volume_steps_max)); } int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path) |