From 43084b4caadb88e49c0fe3bb7670dafd61dea7a7 Mon Sep 17 00:00:00 2001 From: Ismo Puustinen Date: Wed, 12 Dec 2012 09:44:56 +0200 Subject: [PATCH] resource-asm: improve SLP interoperability. --- src/plugins/plugin-resource-asm.c | 36 +++++++++++++++++++---------------- src/plugins/resource-asm/asm-bridge.c | 3 +++ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/plugins/plugin-resource-asm.c b/src/plugins/plugin-resource-asm.c index 8a489f4..2ee7935 100644 --- a/src/plugins/plugin-resource-asm.c +++ b/src/plugins/plugin-resource-asm.c @@ -170,12 +170,12 @@ static void dump_incoming_msg(lib_to_asm_t *msg, asm_data_t *ctx) { MRP_UNUSED(ctx); - mrp_log_info(" --> client id: %u", msg->instance_id); - mrp_log_info(" --> data handle: %d", msg->handle); - mrp_log_info(" --> request id: 0x%04x", msg->request_id); - mrp_log_info(" --> sound event: 0x%04x", msg->sound_event); - mrp_log_info(" --> system resource: 0x%04x", msg->system_resource); - mrp_log_info(" --> state: 0x%04x", msg->sound_state); + mrp_log_info(" --> client id: %u", msg->instance_id); + mrp_log_info(" --> data handle: %d", msg->handle); + mrp_log_info(" --> request id: 0x%04x", msg->request_id); + mrp_log_info(" --> sound event: 0x%04x", msg->sound_event); + mrp_log_info(" --> system resource: 0x%04x", msg->system_resource); + mrp_log_info(" --> state: 0x%04x", msg->sound_state); #ifdef USE_SECURITY { int n_cookie = msg->n_cookie_bytes; @@ -196,13 +196,13 @@ static void dump_outgoing_msg(asm_to_lib_t *msg, asm_data_t *ctx) { MRP_UNUSED(ctx); - mrp_log_info(" <-- client id: %u", msg->instance_id); - mrp_log_info(" <-- alloc handle: %d", msg->alloc_handle); - mrp_log_info(" <-- command handle: %d", msg->cmd_handle); - mrp_log_info(" <-- sound command: 0x%04x", msg->result_sound_command); - mrp_log_info(" <-- state: 0x%04x", msg->result_sound_state); - mrp_log_info(" <-- check privilege: %s", - msg->check_privilege ? "TRUE" : "FALSE"); + mrp_log_info(" <-- client id: %u", msg->instance_id); + mrp_log_info(" <-- alloc handle: %d", msg->alloc_handle); + mrp_log_info(" <-- command handle: %d", msg->cmd_handle); + mrp_log_info(" <-- sound command: 0x%04x", msg->result_sound_command); + mrp_log_info(" <-- state: 0x%04x", msg->result_sound_state); + mrp_log_info(" <-- check privilege: %s", + msg->check_privilege ? "TRUE" : "FALSE"); } #if 0 @@ -309,7 +309,7 @@ static void event_cb(uint32_t request_id, mrp_resource_set_t *set, void *data) d->rtype = request_type_server_event; dump_outgoing_msg(&reply, ctx); - mrp_transport_senddata(d->ctx->t, &reply, TAG_ASM_TO_LIB); + mrp_transport_senddata(ctx->t, &reply, TAG_ASM_TO_LIB); break; } case request_type_release: @@ -334,7 +334,7 @@ static void event_cb(uint32_t request_id, mrp_resource_set_t *set, void *data) d->request_id = 0; dump_outgoing_msg(&reply, ctx); - mrp_transport_senddata(d->ctx->t, &reply, TAG_ASM_TO_LIB); + mrp_transport_senddata(ctx->t, &reply, TAG_ASM_TO_LIB); break; } case request_type_server_event: @@ -371,7 +371,8 @@ static void event_cb(uint32_t request_id, mrp_resource_set_t *set, void *data) /* FIXME: the player-player case needs to be solved here? */ reply.event_source = ASM_EVENT_SOURCE_OTHER_PLAYER_APP; - mrp_transport_senddata(d->ctx->t, &reply, TAG_ASM_TO_LIB_CB); + dump_outgoing_msg(reply, ctx); + mrp_transport_senddata(ctx->t, &reply, TAG_ASM_TO_LIB_CB); break; } @@ -532,6 +533,9 @@ static asm_to_lib_t *process_msg(lib_to_asm_t *msg, asm_data_t *ctx) else { /* a normal resource request */ + /* we have to do a separate resource set for each request + * (even originating from the same client), since they are + * of the same resource type (audio_playback). */ d->rset = mrp_resource_set_create(ctx->resource_client, 0, 0, event_cb, d); diff --git a/src/plugins/resource-asm/asm-bridge.c b/src/plugins/resource-asm/asm-bridge.c index 16d8e23..900630a 100644 --- a/src/plugins/resource-asm/asm-bridge.c +++ b/src/plugins/resource-asm/asm-bridge.c @@ -462,8 +462,11 @@ int main (int argc, char **argv) mrp_io_watch_t *iow = NULL; mrp_io_event_t events = MRP_IO_EVENT_IN; + /* asm_cb_msgid isn't used for anything, but the clients still check it */ + int asm_snd_msgid = msgget((key_t)4102, 0666 | IPC_CREAT); int asm_rcv_msgid = msgget((key_t)2014, 0666 | IPC_CREAT); + int asm_cb_msgid = msgget((key_t)2014, 0666 | IPC_CREAT); mrp_htbl_config_t watches_conf; -- 2.7.4