summaryrefslogtreecommitdiffstats
path: root/ahl-binding
diff options
context:
space:
mode:
authorTai Vuong <tvuong@audiokinetic.com>2017-12-22 15:08:51 -0500
committerTai Vuong <tvuong@audiokinetic.com>2017-12-22 15:08:51 -0500
commitad756056a4052e6eb128072d7852c0dbf0c0ed59 (patch)
treeedf187400d71f8f1516d8561bb2ef4a881f65c57 /ahl-binding
parentf0958e2755d7200d71421397ac3b040d23035f09 (diff)
SPEC-1207 Several improvement on AHL error messages, this required a lot of changes in the code, please review carefully and decide if you want to include now or after CES
Change-Id: If1aacecdd2aa9afd3ce4314c3b6334f9334faff4 Signed-off-by: Tai Vuong <tvuong@audiokinetic.com>
Diffstat (limited to 'ahl-binding')
-rw-r--r--ahl-binding/ahl-binding.c110
-rw-r--r--ahl-binding/ahl-config.c10
-rw-r--r--ahl-binding/ahl-deviceenum.c11
3 files changed, 71 insertions, 60 deletions
diff --git a/ahl-binding/ahl-binding.c b/ahl-binding/ahl-binding.c
index 841182e..a8b7702 100644
--- a/ahl-binding/ahl-binding.c
+++ b/ahl-binding/ahl-binding.c
@@ -347,6 +347,7 @@ PUBLIC int AhlBindingInit()
#ifndef AHL_DISCONNECT_POLICY
// Policy initialization
+ AFB_DEBUG("Audio high-level policy initialization");
err = Policy_Init();
if(err == AHL_POLICY_REJECT) {
//Error messages already reported inside PolicyInit
@@ -368,7 +369,7 @@ PUBLIC int AhlBindingInit()
json_object *pInPolicyEndpointJ = NULL;
err = EndpointInfoToJSON(pCurEndpointInfo, &pInPolicyEndpointJ);
if (err) {
- AFB_ERROR("Unable to Create Endpoint Json object error:%s ",wrap_json_get_error_string(err));
+ AFB_ERROR("Unable to create source endpoint JSON object from endpoint info for endpoint_id:%d error:%s ",pCurEndpointInfo->endpointID, wrap_json_get_error_string(err));
return AHL_FAIL;
}
else
@@ -376,13 +377,13 @@ PUBLIC int AhlBindingInit()
json_object * pOutPolicyEndpointJ = NULL;
err = Policy_Endpoint_Init(pInPolicyEndpointJ,&pOutPolicyEndpointJ);
if (err == AHL_POLICY_REJECT) {
- AFB_WARNING("Policy endpoint properties initalization failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
+ AFB_WARNING("Policy source endpoint properties initalization failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
// continue
}
json_object_put(pInPolicyEndpointJ);
err = UpdateEndpointInfo(pCurEndpointInfo,pOutPolicyEndpointJ);
if (err) {
- AFB_ERROR("Policy endpoint properties update failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
+ AFB_ERROR("Policy source endpoint properties update failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
return AHL_FAIL;
}
// json_object_put(pOutPolicyEndpointJ);
@@ -398,7 +399,7 @@ PUBLIC int AhlBindingInit()
json_object *pInPolicyEndpointJ = NULL;
err = EndpointInfoToJSON(pCurEndpointInfo, &pInPolicyEndpointJ);
if (err) {
- AFB_ERROR("Unable to Create Endpoint Json object error:%s ",wrap_json_get_error_string(err));
+ AFB_ERROR("Unable to create sink endpoint JSON object from endpoint info for endpoint_id:%d error:%s ",pCurEndpointInfo->endpointID, wrap_json_get_error_string(err));
return AHL_FAIL;
}
else
@@ -406,13 +407,13 @@ PUBLIC int AhlBindingInit()
json_object *pOutPolicyEndpointJ = NULL;
err = Policy_Endpoint_Init(pInPolicyEndpointJ,&pOutPolicyEndpointJ);
if (err == AHL_POLICY_REJECT) {
- AFB_WARNING("Policy endpoint properties initalization failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
+ AFB_WARNING("Policy sink endpoint properties initalization failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
// continue
}
json_object_put(pInPolicyEndpointJ);
err = UpdateEndpointInfo(pCurEndpointInfo,pOutPolicyEndpointJ);
if (err) {
- AFB_ERROR("Policy endpoint properties update failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
+ AFB_ERROR("Policy sink endpoint properties update failed for endpoint_id :%d type:%d",pCurEndpointInfo->endpointID, pCurEndpointInfo->type);
return AHL_FAIL;
}
//json_object_put(pOutPolicyEndpointJ);
@@ -429,7 +430,7 @@ PUBLIC int AhlBindingInit()
AFB_ERROR("Unable to create Active Stream List");
return AHL_FAIL;
}
- AFB_DEBUG("Audio high-level Binding success");
+ AFB_DEBUG("Audio high-level binding initialization success");
return AHL_SUCCESS;
}
@@ -465,7 +466,7 @@ PUBLIC void audiohlapi_get_endpoints(struct afb_req req)
RoleInfoT * pRole = GetRole(audioRole);
if ( pRole == NULL )
{
- afb_req_fail_f(req, "Invalid arguments", "Requested audio role does not exist in current configuration -> %s", json_object_get_string(queryJ));
+ afb_req_fail_f(req, "Invalid arguments", "Requested audio role:%s does not exist in current configuration -> %s", audioRole, json_object_get_string(queryJ));
return;
}
else
@@ -584,14 +585,14 @@ PUBLIC void audiohlapi_stream_open(struct afb_req req)
err = StreamInfoToJSON(pStreamInfo,&pPolicyStreamJ);
if (err)
{
- afb_req_fail(req, "Audio policy violation", "Unable to get JSON object for Policy_OpenStream");
+ afb_req_fail(req, "Cannot convert stream info to JSON", "Unable to get JSON object for Policy_OpenStream");
return;
}
int policyAllowed = Policy_OpenStream(pPolicyStreamJ);
if (policyAllowed == AHL_POLICY_REJECT)
{
- afb_req_fail(req, "Audio policy violation", "Open stream not allowed in current context");
+ afb_req_fail_f(req, "Audio policy violation", "Open stream for role: %s on endpoint_id:%d not allowed in current context",pRole->pRoleName,pEndpointInfo->endpointID);
return;
}
#endif
@@ -602,13 +603,13 @@ PUBLIC void audiohlapi_stream_open(struct afb_req req)
pStreamInfo->streamStateEvent = afb_daemon_make_event(streamEventName);
err = !afb_event_is_valid(pStreamInfo->streamStateEvent);
if (err) {
- afb_req_fail(req, "Stream event creation failure", "Could not create stream specific state change event");
+ afb_req_fail_f(req, "Stream event creation failure", "Could not create stream specific state change event: %s",streamEventName);
return;
}
err = afb_req_subscribe(req,pStreamInfo->streamStateEvent);
if (err) {
- afb_req_fail(req, "Stream event subscription failure", "Could not subscribe to stream specific state change event");
+ afb_req_fail_f(req, "Stream event subscription failure", "Could not subscribe to stream specific state change event for event name: %s",streamEventName);
return;
}
@@ -641,11 +642,12 @@ PUBLIC void audiohlapi_stream_close(struct afb_req req)
AHLClientCtxT * pClientCtx = afb_req_context_get(req); // Retrieve client-specific data structure
if (pClientCtx == NULL)
{
- afb_req_fail(req, "Bad state", "No client context associated with the request (is there an opened stream by this client?)");
+ afb_req_fail(req, "Missing client info context", "No client context associated with the request (is there an opened stream by this client?)");
return;
}
if (streamID == AHL_UNDEFINED) {
+ AFB_DEBUG("StreamID not specified. Closing all stream for client");
err = CloseAllClientStreams(pClientCtx,&req);
if (err) {
afb_req_fail(req, "Error closing streams", "Streams cannot close");
@@ -653,6 +655,7 @@ PUBLIC void audiohlapi_stream_close(struct afb_req req)
}
}
else {
+ AFB_DEBUG("Closing streamID:%d",streamID);
err = CloseStream(pClientCtx,streamID,&req);
if (err) {
afb_req_fail_f(req, "Error closing stream", "Specified stream cannot close stream_id -> %d",streamID);
@@ -675,7 +678,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
int iStreamAccessControl = CheckStreamAccessControl( in_pClientCtx, streamID );
if (iStreamAccessControl == AHL_ACCESS_CONTROL_DENIED)
{
- afb_req_fail(*pReq, "Access control denied", "Set stream state not allowed in current client context");
+ afb_req_fail_f(*pReq, "Access control denied", "Current client is not the owner of streamID:%d", streamID);
return AHL_FAIL;
}
@@ -686,7 +689,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
int err = StreamInfoToJSON(pStreamInfo, &pPolicyStreamJ);
if (err == AHL_POLICY_UTIL_FAIL)
{
- afb_req_fail(*pReq, "Audio policy violation", "Unable to get JSON object for Policy_SetStreamState");
+ afb_req_fail_f(*pReq, "JSON packaging error", "Unable to create stream JSON object for Policy_SetStreamState for streamID:%d",streamID);
return AHL_FAIL;
}
@@ -696,7 +699,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
int policyAllowed = Policy_SetStreamState(pPolicyStreamJ);
if (policyAllowed == AHL_POLICY_REJECT)
{
- afb_req_fail(*pReq, "Audio policy violation", "Change stream state not allowed in current context");
+ afb_req_fail_f(*pReq, "Audio policy violation", "Change stream state not allowed by policy in current context for streamID:%d",streamID);
return AHL_FAIL;
}
#else
@@ -710,7 +713,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
int err = StreamInfoToJSON(pStreamInfo, &pPolicyStreamJ);
if (err == AHL_POLICY_UTIL_FAIL)
{
- afb_req_fail((*pReq), "Audio policy violation", "Unable to get JSON object for Policy_SetStreamMute");
+ afb_req_fail_f((*pReq), "JSON packaging error", "Unable to create stream JSON object for Policy_SetStreamMute for streamID:%d",streamID);
return AHL_FAIL;
}
@@ -720,7 +723,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
int policyAllowed = Policy_SetStreamMute(pPolicyStreamJ);
if (policyAllowed == AHL_POLICY_REJECT)
{
- afb_req_fail(*pReq, "Audio policy violation", "Mute stream not allowed in current context");
+ afb_req_fail_f(*pReq, "Audio policy violation", "Mute stream not allowed by policy in current context for streamID:%d",streamID);
return AHL_FAIL;
}
#else
@@ -749,7 +752,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
AHLClientCtxT * pClientCtx = afb_req_context_get(req); // Retrieve client-specific data structure
if (pClientCtx == NULL)
{
- afb_req_fail(req, "Bad state", "No client context associated with the request (is there an opened stream by this client?)");
+ afb_req_fail(req, "Missing client info context", "No client context associated with the request (is there an opened stream by this client?)");
return;
}
@@ -761,6 +764,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
streamID_t curStreamID = g_array_index(pClientCtx->pStreamAccessList,streamID_t,i);
err = SetStreamState(pClientCtx,&req,curStreamID,streamStateStr,iMuteValue);
if (err) {
+ // Error displayed within SetStreamState
return;
}
}
@@ -769,6 +773,7 @@ static int SetStreamState(AHLClientCtxT * in_pClientCtx,struct afb_req * pReq, s
else {
err = SetStreamState(pClientCtx,&req,streamID,streamStateStr,iMuteValue);
if (err) {
+ // Error displayed within SetStreamState
return;
}
}
@@ -819,7 +824,7 @@ PUBLIC void audiohlapi_volume(struct afb_req req)
EndpointInfoT * pEndpointInfo = GetEndpointInfo(endpointID,endpointType);
if (pEndpointInfo == NULL)
{
- afb_req_fail_f(req, "Endpoint not found", "Endpoint information not found for id:%d type%d",endpointID,endpointType);
+ afb_req_fail_f(req, "Endpoint not found", "Endpoint information not found for endpoint_id:%d type:%d",endpointID,endpointType);
return;
}
@@ -829,7 +834,7 @@ PUBLIC void audiohlapi_volume(struct afb_req req)
err = EndpointInfoToJSON(pEndpointInfo, &pPolicyEndpointJ);
if (err == AHL_POLICY_UTIL_FAIL)
{
- afb_req_fail(req, "Audio policy violation", "Unable to get JSON object for Policy_SetVolume");
+ afb_req_fail_f(req, "JSON packaging error", "Unable to create endpoint JSON object for Policy_SetVolume for endpoint_id:%d type:%d",endpointID,endpointType);
return;
}
@@ -840,13 +845,13 @@ PUBLIC void audiohlapi_volume(struct afb_req req)
int policyAllowed = Policy_SetVolume(pPolicyEndpointJ,&pPolicyVolumeReply);
if (!policyAllowed)
{
- afb_req_fail(req, "Audio policy violation", "Set volume not allowed in current context");
+ afb_req_fail_f(req, "Audio policy violation", "Set volume not allowed by policy in current context for endpoint_id:%d type:%d",endpointID,endpointType);
return;
}
err = wrap_json_unpack(pPolicyVolumeReply,"{s:i}","volume",&pEndpointInfo->iVolume);
if (err) {
- afb_req_fail_f(req, "Invalid policy reply", "Policy volume change reply not a valid json object=%s", json_object_get_string(pPolicyVolumeReply));
+ afb_req_fail_f(req, "Invalid policy reply", "Policy volume change reply for endpoint_id:%d type:%d not a valid JSON object=%s", endpointID,endpointType,json_object_get_string(pPolicyVolumeReply));
return;
}
#else
@@ -908,7 +913,7 @@ PUBLIC void audiohlapi_property(struct afb_req req)
EndpointInfoT * pEndpointInfo = GetEndpointInfo(endpointID,endpointType);
if (pEndpointInfo == NULL)
{
- afb_req_fail_f(req, "Endpoint not found", "Endpoint information not found for id:%d type%d",endpointID,endpointType);
+ afb_req_fail_f(req, "Endpoint not found", "Endpoint information not found for id:%d type:%d",endpointID,endpointType);
return;
}
@@ -918,7 +923,7 @@ PUBLIC void audiohlapi_property(struct afb_req req)
err = EndpointInfoToJSON(pEndpointInfo, &pPolicyEndpointJ);
if (err == AHL_POLICY_UTIL_FAIL)
{
- afb_req_fail(req, "property fail", "Unable to get JSON object for Policy_SetProperty");
+ afb_req_fail_f(req, "JSON packaging error", "Unable to create endpoint JSON object for Policy_SetProperty for endpoint_id:%d type:%d",endpointID,endpointType);
return;
}
@@ -931,14 +936,14 @@ PUBLIC void audiohlapi_property(struct afb_req req)
int policyAllowed = Policy_SetProperty(pPolicyEndpointJ,&pPropertyReply);
if (!policyAllowed)
{
- afb_req_fail(req, "Policy Reject Set Property Control", "Policy Reject Set Property Control");
+ afb_req_fail_f(req, "Policy violation", "Policy rejected set property control in current context for endpointID: %d type:%d",endpointID,endpointType);
return;
}
json_object * pPropReplyValue = NULL;
err = wrap_json_unpack(pPropertyReply,"{s:o}","value",&pPropReplyValue);
if (err) {
- afb_req_fail_f(req, "property fail", "Policy Property value not a valid json object=%s", json_object_get_string(pPropertyReply));
+ afb_req_fail_f(req, "JSON parse error", "Policy returned property value for endpointID:%d type:%d not a valid JSON object=%s", endpointID,endpointType,json_object_get_string(pPropertyReply));
return;
}
if (pEndpointInfo->pPropTable && pPropReplyValue) {
@@ -956,7 +961,7 @@ PUBLIC void audiohlapi_property(struct afb_req req)
// Retrieve cached property value
json_object * propertyValJ = (json_object *)g_hash_table_lookup(pEndpointInfo->pPropTable,propertyName);
if (propertyValJ == NULL) {
- afb_req_fail_f(req, "audiohlapi_property", "Property information not found: %s",propertyName);
+ afb_req_fail_f(req, "Property information not found", "Property information not found for property:%s endpointID:%d type:%d",propertyName,endpointID,endpointType);
return;
}
@@ -1039,26 +1044,27 @@ PUBLIC void audiohlapi_post_action(struct afb_req req)
}
if (!iActionFound) {
- afb_req_fail_f(req, "Event not found for audio role", "Event -> %s not found for role:%s",actionName,audioRole);
+ afb_req_fail_f(req, "Action not found for audio role", "Action -> %s not found for role:%s",actionName,audioRole);
return;
}
-#ifndef AHL_DISCONNECT_POLICY
- // Call policy to allow custom policy actions in current context (e.g. cancel playback)
- json_object * pActionInfo = NULL;
- err = wrap_json_pack(&pActionInfo, "{s:s,s:s,s?s,s?o}", "action_name", &actionName,"audio_role",&audioRole,"media_name",&mediaName,"action_context",&actionContext);
- if (err) {
- afb_req_fail_f(req, "Invalid arguments", "Could not create action JSON object arguments");
- return;
- }
- json_object_get(pActionInfo);
- int policyAllowed = Policy_PostAction(pActionInfo);
- if (!policyAllowed)
- {
- afb_req_fail(req, "Audio policy violation", "Post sound action not allowed in current context");
- return;
- }
-#endif
+ // Disable this to avoid problems (temporary solution)
+// #ifndef AHL_DISCONNECT_POLICY
+// // Call policy to allow custom policy actions in current context (e.g. cancel playback)
+// json_object * pActionInfo = NULL;
+// err = wrap_json_pack(&pActionInfo, "{s:s,s:s,s?s,s?o}", "action_name", &actionName,"audio_role",&audioRole,"media_name",&mediaName,"action_context",&actionContext);
+// if (err) {
+// afb_req_fail_f(req, "Invalid arguments", "Could not create action JSON object arguments");
+// return;
+// }
+// json_object_get(pActionInfo);
+// int policyAllowed = Policy_PostAction(pActionInfo);
+// if (!policyAllowed)
+// {
+// afb_req_fail_f(req, "Audio policy violation", "Post sound action not allowed by policy in current context for action:%s and audiorole:%s",actionName,audioRole);
+// return;
+// }
+// #endif
afb_req_success(req, NULL, "Posted sound action");
}
@@ -1088,7 +1094,7 @@ PUBLIC void audiohlapi_event_subscription(struct afb_req req)
json_object * jEvent = json_object_array_get_idx(eventArrayJ,i);
pEventName = (char *)json_object_get_string(jEvent);
if(pEventName == NULL) {
- afb_req_fail(req, "failed", "Invalid event");
+ afb_req_fail(req, "JSON arguments parse error", "Empty event");
return;
}
else if(!strcasecmp(pEventName, AHL_ENDPOINT_PROPERTY_EVENT)) {
@@ -1110,7 +1116,7 @@ PUBLIC void audiohlapi_event_subscription(struct afb_req req)
afb_req_unsubscribe(req, g_AHLCtx.policyCtx.postActionEvent);
}
else {
- afb_req_fail(req, "failed", "Invalid event");
+ afb_req_fail_f(req, "JSON arguments parse error", "Invalid event:%s",pEventName);
return;
}
}
@@ -1128,7 +1134,7 @@ PUBLIC void audiohlapi_raise_event(json_object * pEventDataJ)
int err = wrap_json_unpack(pEventDataJ,"{s:s}","event_name", &pEventName);
if(err)
{
- AFB_ERROR("Unable to retrieve event name");
+ AFB_ERROR("Unable to retrieve event name %s",json_object_get_string(pEventDataJ));
return;
}
@@ -1146,7 +1152,7 @@ PUBLIC void audiohlapi_raise_event(json_object * pEventDataJ)
"audio_role", &pAudioRole);
if(err)
{
- AFB_ERROR("Unable to unpack property event");
+ AFB_ERROR("Unable to unpack property event for event: %s",pEventName);
return;
}
RoleInfoT * pRole = GetRole(pAudioRole);
@@ -1170,7 +1176,7 @@ PUBLIC void audiohlapi_raise_event(json_object * pEventDataJ)
g_hash_table_insert(pEndpointInfo->pPropTable, pPropertyName, json_object_new_string(json_object_get_string(propValueJ)));
break;
default:
- AFB_ERROR("Invalid property argument Property value not a valid json object query=%s", json_object_get_string(propValueJ));
+ AFB_ERROR("Invalid property argument property value not a valid JSON object query=%s", json_object_get_string(propValueJ));
return ;
}
}
@@ -1226,7 +1232,7 @@ PUBLIC void audiohlapi_raise_event(json_object * pEventDataJ)
"state_event", &streamEvent);
if(err)
{
- AFB_ERROR("Unable to unpack stream event data");
+ AFB_ERROR("Unable to unpack stream event data for event %s",pEventName);
return;
}
@@ -1265,6 +1271,6 @@ PUBLIC void audiohlapi_raise_event(json_object * pEventDataJ)
afb_event_push(pStreamInfo->streamStateEvent,pEventDataJ);
}
else {
- AFB_ERROR("Unknown event name");
+ AFB_ERROR("Unknown event name %s",pEventName);
}
} \ No newline at end of file
diff --git a/ahl-binding/ahl-config.c b/ahl-binding/ahl-config.c
index 42c836d..0bd16f2 100644
--- a/ahl-binding/ahl-config.c
+++ b/ahl-binding/ahl-config.c
@@ -147,6 +147,7 @@ int ParseHLBConfig() {
pHAL = (char *)json_object_get_string(jHAL);
char * pHALName = g_strdup( pHAL );
g_ptr_array_add( g_AHLCtx.policyCtx.pHALList, pHALName );
+ AFB_INFO("High-level binding add dependency on HAL: %s", pHALName);
// Set dependency on HAL specified
err = afb_daemon_require_api_v2(pHAL,1) ;
@@ -183,7 +184,10 @@ int ParseHLBConfig() {
if (err) {
AFB_ERROR("Invalid audio role configuration : %s", json_object_to_json_string(jAudioRole));
return AHL_FAIL;
- }
+ }
+
+ AFB_DEBUG("Parsing configuration audio role: %s", pRoleName);
+
if (jOutputDevices)
{
json_type jTypeOutputDevices = json_object_get_type(jOutputDevices);
@@ -224,7 +228,7 @@ int ParseHLBConfig() {
if (iNumInDevices) {
err = EnumerateDevices(jInputDevices,pRoleName,ENDPOINTTYPE_SOURCE,pRoleInfo->pSourceEndpoints);
if (err) {
- AFB_ERROR("Invalid input devices : %s", json_object_to_json_string(jInputDevices));
+ AFB_ERROR("Invalid input devices for role %s : %s", pRoleName, json_object_to_json_string(jInputDevices));
return AHL_FAIL;
}
}
@@ -233,7 +237,7 @@ int ParseHLBConfig() {
if (iNumOutDevices) {
err = EnumerateDevices(jOutputDevices,pRoleName,ENDPOINTTYPE_SINK,pRoleInfo->pSinkEndpoints);
if (err) {
- AFB_ERROR("Invalid output devices : %s", json_object_to_json_string(jOutputDevices));
+ AFB_ERROR("Invalid output devices for role %s: %s", pRoleName, json_object_to_json_string(jOutputDevices));
return AHL_FAIL;
}
}
diff --git a/ahl-binding/ahl-deviceenum.c b/ahl-binding/ahl-deviceenum.c
index 43e5af5..75b0715 100644
--- a/ahl-binding/ahl-deviceenum.c
+++ b/ahl-binding/ahl-deviceenum.c
@@ -237,6 +237,7 @@ void TermEndpointInfo( gpointer data )
int EnumerateDevices(json_object * in_jDeviceArray, char * in_pAudioRole, EndpointTypeT in_deviceType, GPtrArray * out_pEndpointArray) {
g_assert_nonnull(in_jDeviceArray);
+ g_assert_nonnull(in_pAudioRole);
int iNumberDevices = json_object_array_length(in_jDeviceArray);
// Parse and validate list of available devices
@@ -249,7 +250,7 @@ int EnumerateDevices(json_object * in_jDeviceArray, char * in_pAudioRole, Endpoi
json_object * jDevice = json_object_array_get_idx(in_jDeviceArray,i);
if (jDevice == NULL) {
- AFB_WARNING("Invalid device array -> %s",json_object_to_json_string(in_jDeviceArray));
+ AFB_WARNING("Invalid device array for audiorole:%s -> %s",in_pAudioRole,json_object_to_json_string(in_jDeviceArray));
continue;
}
// strip domain name from URI
@@ -258,7 +259,7 @@ int EnumerateDevices(json_object * in_jDeviceArray, char * in_pAudioRole, Endpoi
err = SeparateDomainFromDeviceURI(pFullDeviceURICopy,&pDeviceURIDomain,&pDeviceURIPCM);
if (err)
{
- AFB_WARNING("Invalid device URI string -> %s",pFullDeviceURICopy);
+ AFB_WARNING("Invalid device URI string -> %s for audiorole:%s",pFullDeviceURICopy,in_pAudioRole);
continue;
}
@@ -289,13 +290,13 @@ int EnumerateDevices(json_object * in_jDeviceArray, char * in_pAudioRole, Endpoi
err = snd_pcm_open(&pPcmHandle, pEndpointInfo->gsDeviceURI, streamType, 0);
if (err < 0)
{
- AFB_NOTICE("Alsa PCM device was not found -> %s", pEndpointInfo->gsDeviceURI);
+ AFB_NOTICE("Alsa PCM device was not found -> %s for audiorole:%s", pEndpointInfo->gsDeviceURI,in_pAudioRole);
continue;
}
err = FillALSAPCMInfo(pPcmHandle,pEndpointInfo);
if (err) {
- AFB_WARNING("Unable to retrieve PCM information for PCM -> %s",pEndpointInfo->gsDeviceURI);
+ AFB_WARNING("Unable to retrieve PCM information for PCM -> %s for audiorole:%s",pEndpointInfo->gsDeviceURI,in_pAudioRole);
snd_pcm_close(pPcmHandle);
continue;
}
@@ -318,7 +319,7 @@ int EnumerateDevices(json_object * in_jDeviceArray, char * in_pAudioRole, Endpoi
}
else {
// Unknown domain
- AFB_WARNING("Unknown domain in device URI string -> %s",pFullDeviceURI);
+ AFB_WARNING("Unknown domain in device URI string -> %s for audiorole:%s",pFullDeviceURI,in_pAudioRole);
continue;
}