Hi all,
I'm looking at Android jellybean's audio architecture. I did some modification on the audio_hw.c by adding additional function in adev_open as shown below:
static int adev_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
struct omap_audio_device *adev;
int ret, i;
pthread_mutexattr_t mta;
char modem[PROPERTY_VALUE_MAX];
..........
..........
..........
*device = &adev->hw_device.common;
gpio_monitor thread(adev); //newly added function
return 0;
}
static void gpio_monitor thread(struct omap_audio_device *adev) {
int ret
ret = pthread_create(&gpio_thread,NULL, gpio_monitor_handler(adev),(void*)msg);
if (ret != 0){
ALOGD("fail to create gpio_monitor_thread=%d",ret);
}
}
gpio_monitor thread is a function that create pthread, gpio_monitor handler, to poll the status of an gpio pin. When there is any status change on the GPIO pin, the gpio_monitor handler will change the audio_routing by using the set_route_by_array function.
After these implementation is done, I got "AudioPolicyService not published, waiting..., Waiting for service media.audio_policy..." message while booting and the device just hang at the startup screen. May anyone advice me on this? Thanks,