From f241b6dc5d1b9fd70423ec4a71f83bcc02c41785 Mon Sep 17 00:00:00 2001 From: Jaska Uimonen Date: Tue, 16 Sep 2014 09:18:05 +0300 Subject: [PATCH] fix changed genivi-audio-manager dbus interface Change-Id: Iff1b358b1f6b2b0edf5d23111e532669b4220f02 --- murphy/audiomgr.c | 1 + murphy/audiomgr.h | 4 +-- murphy/dbusif.c | 82 ++++++++++++++++++++++++++++++++++++++++++------------- 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/murphy/audiomgr.c b/murphy/audiomgr.c index dd31ee0..023da30 100644 --- a/murphy/audiomgr.c +++ b/murphy/audiomgr.c @@ -224,6 +224,7 @@ void fill_am_data_and_register(struct userdata *u, mir_node *node, pa_audiomgr * rd->name = pa_xstrdup(node->amname); rd->domain = am->domain.id; rd->class = 0x43; + rd->state = 1; rd->volume = 32767; rd->visible = node->visible; rd->avail.status = AS_AVAILABLE; diff --git a/murphy/audiomgr.h b/murphy/audiomgr.h index da6c45e..b9368dd 100644 --- a/murphy/audiomgr.h +++ b/murphy/audiomgr.h @@ -71,7 +71,7 @@ struct am_nodereg_data { const char *name; am_uint16_t domain; am_uint16_t class; - am_uint16_t state; /* 1=on, 2=off */ + am_int32_t state; /* 1=on, 2=off */ am_int16_t volume; am_bool_t visible; struct { @@ -94,7 +94,7 @@ struct am_connect_data { am_uint16_t connection; am_uint16_t source; am_uint16_t sink; - am_int16_t format; + am_int32_t format; }; struct am_ack_data { diff --git a/murphy/dbusif.c b/murphy/dbusif.c index 3477ba0..f3df76d 100644 --- a/murphy/dbusif.c +++ b/murphy/dbusif.c @@ -1,5 +1,5 @@ /* - * module-murphy-ivi -- PulseAudio module for providing audio routing support + * Module-murphy-ivi -- PulseAudio module for providing audio routing support * Copyright (c) 2012, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it @@ -38,11 +38,11 @@ #define AUDIOMGR_DBUS_INTERFACE "org.genivi.audiomanager" #define AUDIOMGR_DBUS_PATH "/org/genivi/audiomanager" -#define AUDIOMGR_DBUS_ROUTE_NAME "RoutingInterface" -#define AUDIOMGR_DBUS_ROUTE_PATH "RoutingInterface" +#define AUDIOMGR_DBUS_ROUTE_NAME "routinginterface" +#define AUDIOMGR_DBUS_ROUTE_PATH "routinginterface" -#define AUDIOMGR_DBUS_CONTROL_NAME "ControlInterface" -#define AUDIOMGR_DBUS_CONTROL_PATH "ControlInterface" +#define AUDIOMGR_DBUS_CONTROL_NAME "controlinterface" +#define AUDIOMGR_DBUS_CONTROL_PATH "controlinterface" #define PULSE_DBUS_INTERFACE "org.genivi.pulse" #define PULSE_DBUS_PATH "/org/genivi/pulse" @@ -608,6 +608,7 @@ bool pa_routerif_register_domain(struct userdata *u, const char *dbus_path; const char *dbus_if; int success; + uint16_t error = 0; pa_assert(u); pa_assert(dr); @@ -641,7 +642,7 @@ bool pa_routerif_register_domain(struct userdata *u, success = success && dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_STRING, &dr->node_name); success = success && dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_BOOLEAN, &dr->early); success = success && dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_BOOLEAN, &dr->complete); - success = success && dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_UINT16 , &dr->state); + success = success && dbus_message_iter_append_basic(&sub_iter, DBUS_TYPE_INT16 , &dr->state); success = success && dbus_message_iter_close_container(&iter, &sub_iter); @@ -649,6 +650,9 @@ bool pa_routerif_register_domain(struct userdata *u, success = success && dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING , &dbus_path); success = success && dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING , &dbus_if); + success = success && dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16, &dr->domain_id); + success = success && dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16, &error); + if (!success) { pa_log("%s: Failed to build D-Bus message to register", __FILE__); goto getout; @@ -825,12 +829,12 @@ static bool build_sound_properties(DBusMessageIter *mit, #define CONT_APPEND(i,t,v) dbus_message_iter_append_basic(i, t, v) #define CONT_CLOSE(p,c) dbus_message_iter_close_container(p, c) - if (!CONT_OPEN(mit, DBUS_TYPE_ARRAY, "(nn)", &ait)) + if (!CONT_OPEN(mit, DBUS_TYPE_ARRAY, "(in)", &ait)) return false; for (i = 1; i < 3; i++) { if (! CONT_OPEN (&ait, DBUS_TYPE_STRUCT, NULL, &sit) || - ! CONT_APPEND (&sit, DBUS_TYPE_INT16, &i ) || + ! CONT_APPEND (&sit, DBUS_TYPE_INT32, &i ) || ! CONT_APPEND (&sit, DBUS_TYPE_INT16, &zero ) || ! CONT_CLOSE (&ait, &sit) ) { @@ -858,11 +862,11 @@ static bool build_connection_formats(DBusMessageIter *mit, #define CONT_APPEND(t,v) dbus_message_iter_append_basic(&ait, t, v) #define CONT_CLOSE dbus_message_iter_close_container(mit, &ait) - if (!CONT_OPEN(DBUS_TYPE_ARRAY, "n")) + if (!CONT_OPEN(DBUS_TYPE_ARRAY, "i")) return false; for (i = 1; i < 2; i++) { - if (!CONT_APPEND(DBUS_TYPE_INT16, &i)) + if (!CONT_APPEND(DBUS_TYPE_INT32, &i)) return false; } @@ -876,6 +880,42 @@ static bool build_connection_formats(DBusMessageIter *mit, return true; } +static bool build_notification_properties(DBusMessageIter *mit, + struct am_nodereg_data *rd) +{ + static int16_t zero; + + DBusMessageIter ait, sit; + int i; + +#define CONT_OPEN(p,t,s,c) dbus_message_iter_open_container(p, t, s, c) +#define CONT_APPEND(i,t,v) dbus_message_iter_append_basic(i, t, v) +#define CONT_CLOSE(p,c) dbus_message_iter_close_container(p, c) + + if (!CONT_OPEN(mit, DBUS_TYPE_ARRAY, "(iin)", &ait)) + return false; + + for (i = 1; i < 3; i++) { + if (! CONT_OPEN (&ait, DBUS_TYPE_STRUCT, NULL, &sit) || + ! CONT_APPEND (&sit, DBUS_TYPE_INT32, &i ) || + ! CONT_APPEND (&sit, DBUS_TYPE_INT32, &i ) || + ! CONT_APPEND (&sit, DBUS_TYPE_INT16, &zero ) || + ! CONT_CLOSE (&ait, &sit) ) + { + return false; + } + } + + if (!CONT_CLOSE(mit, &ait)) + return false; + +#undef CONT_CLOSE +#undef CONT_APPEND +#undef CONT_OPEN + + return true; +} + bool pa_routerif_register_node(struct userdata *u, am_method m, am_nodereg_data *rd) @@ -920,18 +960,20 @@ bool pa_routerif_register_node(struct userdata *u, ! CONT_APPEND ( DBUS_TYPE_UINT16 , &rd->id ) || ! CONT_APPEND ( DBUS_TYPE_STRING , &rd->name ) || ! CONT_APPEND ( DBUS_TYPE_UINT16 , &rd->domain ) || - ! CONT_APPEND ( DBUS_TYPE_UINT16 , &rd->class ) || + ! CONT_APPEND ( DBUS_TYPE_INT32 , &rd->class ) || ! CONT_APPEND ( DBUS_TYPE_INT16 , &rd->volume ) || ! CONT_APPEND ( DBUS_TYPE_BOOLEAN, &rd->visible ) || ! CONT_OPEN_1 ( DBUS_TYPE_STRUCT , NULL ) || - ! CONT_APPEND_1 ( DBUS_TYPE_INT16 , &rd->avail.status) || - ! CONT_APPEND_1 ( DBUS_TYPE_INT16 , &rd->avail.reason) || + ! CONT_APPEND_1 ( DBUS_TYPE_INT32 , &rd->avail.status) || + ! CONT_APPEND_1 ( DBUS_TYPE_INT32 , &rd->avail.reason) || ! CONT_CLOSE_1 || ! CONT_APPEND ( DBUS_TYPE_INT16 , &rd->mute ) || ! CONT_APPEND ( DBUS_TYPE_INT16 , &rd->mainvol ) || ! build_sound_properties(&cit, rd) || ! build_connection_formats(&cit, rd) || - ! build_sound_properties(&cit, rd) || + ! build_sound_properties(&cit, rd) || + ! build_notification_properties(&cit, rd) || + ! build_notification_properties(&cit, rd) || ! CONT_CLOSE )) || (!strcmp(method, AUDIOMGR_REGISTER_SOURCE) && (! CONT_OPEN ( DBUS_TYPE_STRUCT , NULL ) || @@ -939,17 +981,19 @@ bool pa_routerif_register_node(struct userdata *u, ! CONT_APPEND ( DBUS_TYPE_UINT16 , &rd->domain ) || ! CONT_APPEND ( DBUS_TYPE_STRING , &rd->name ) || ! CONT_APPEND ( DBUS_TYPE_UINT16 , &rd->class ) || - ! CONT_APPEND ( DBUS_TYPE_UINT16 , &rd->state ) || + ! CONT_APPEND ( DBUS_TYPE_INT32 , &rd->state ) || ! CONT_APPEND ( DBUS_TYPE_INT16 , &rd->volume ) || ! CONT_APPEND ( DBUS_TYPE_BOOLEAN, &rd->visible ) || ! CONT_OPEN_1 ( DBUS_TYPE_STRUCT , NULL ) || - ! CONT_APPEND_1 ( DBUS_TYPE_INT16 , &rd->avail.status) || - ! CONT_APPEND_1 ( DBUS_TYPE_INT16 , &rd->avail.reason) || + ! CONT_APPEND_1 ( DBUS_TYPE_INT32 , &rd->avail.status) || + ! CONT_APPEND_1 ( DBUS_TYPE_INT32 , &rd->avail.reason) || ! CONT_CLOSE_1 || ! CONT_APPEND ( DBUS_TYPE_UINT16 , &rd->interrupt ) || ! build_sound_properties(&cit, rd) || ! build_connection_formats(&cit, rd) || - ! build_sound_properties(&cit, rd) || + ! build_sound_properties(&cit, rd) || + ! build_notification_properties(&cit, rd) || + ! build_notification_properties(&cit, rd) || ! CONT_CLOSE ))) { pa_log("%s: failed to build message for AudioManager '%s'", @@ -1216,7 +1260,7 @@ static bool routerif_connect(struct userdata *u, DBusMessage *msg) DBUS_TYPE_UINT16, &ac.connection, DBUS_TYPE_UINT16, &ac.source, DBUS_TYPE_UINT16, &ac.sink, - DBUS_TYPE_INT16 , &ac.format, + DBUS_TYPE_INT32 , &ac.format, DBUS_TYPE_INVALID); if (!success) { pa_log("%s: got broken connect message from AudioManager. " -- 2.7.4