d->rtype = request_type_server_event;
reply.instance_id = d->pid;
- reply.check_privilege = FALSE;
+ reply.check_privilege = TRUE;
reply.alloc_handle = d->handle;
reply.cmd_handle = d->handle;
d->rtype = request_type_server_event;
reply.instance_id = d->pid;
- reply.check_privilege = FALSE;
+ reply.check_privilege = TRUE;
reply.alloc_handle = d->handle;
reply.cmd_handle = d->handle;
reply = mrp_allocz(sizeof(asm_to_lib_t));
reply->instance_id = pid;
- reply->check_privilege = FALSE;
+ reply->check_privilege = TRUE;
reply->alloc_handle = msg->handle;
reply->cmd_handle = msg->handle;
client = create_client(pid);
mrp_htbl_insert(ctx->clients, u_to_p(pid), client);
}
-#if 1
+#if 0
else {
/* From Murphy point of view this is actually an error case,
* since the application can only belong to one class. This is
break;
case ASM_EVENT_EARJACK_UNPLUG:
mrp_log_info("earjack unplug event");
+ resource = "player";
+ shared = TRUE;
break;
case ASM_EVENT_ALARM:
shared = FALSE;
shared = FALSE;
break;
case ASM_EVENT_MONITOR:
+ mrp_log_info("monitor request");
+ resource = "player";
+ shared = TRUE;
break;
case ASM_EVENT_RICH_CALL:
resource = "phone";
break;
}
case ASM_STATE_STOP:
+ case ASM_STATE_PAUSE:
{
d->rtype = request_type_release;
if (ret < 0) {
/* FIXME: proper error handling */
mrp_log_error("error receiving a message: '%s'!", strerror(errno));
+ if (errno == E2BIG) {
+
+ /* remove message from queue */
+ msgrcv(asm_rcv_msgid, &msg, sizeof(msg.data), 0, MSG_NOERROR);
+ }
continue;
}
{
int i;
- mrp_log_info(" cookie: ")
- for (i = 0; i < COOKIE_SIZE, i++) {
+ mrp_log_info(" cookie: ");
+ for (i = 0; i < COOKIE_SIZE; i++) {
mrp_log_info("0x%02x ", msg->data.cookie[i]);
}
mrp_log_info("\n");
{
lib_to_asm_t res;
uint8_t cookie_arr[] = {};
+ uint8_t *cookie = cookie_arr;
int cookie_len = 0;
dump_msg(msg, ctx);
res.system_resource = msg->data.system_resource;
#ifdef USE_SECURITY
{
- cookie_len = strlen(msg->data.cookie);
- cookie_arr = msg->data.cookie;
-
- res.n_cookie_bytes = cookie_len;
- res.cookie = cookie_arr;
+ cookie_len = COOKIE_SIZE;
+ cookie = msg->data.cookie;
}
#endif
res.n_cookie_bytes = cookie_len;
- res.cookie = cookie_arr;
+ res.cookie = cookie;
if (!mrp_transport_senddata(ctx->mt, &res, lib_to_asm_descr.tag)) {
mrp_log_error("Failed to send message to murphy");
wr_fd = open(wr_filename, O_NONBLOCK | O_WRONLY);
if (wr_fd < 0) {
- mrp_log_error("failed to open file '%s' for writing", wr_filename);
+ mrp_log_error("failed to open file '%s' for writing: '%s'", wr_filename,
+ strerror(errno));
goto error;
}
msg->instance_id, msg->handle);
rd_fd = open(wr_filename, O_NONBLOCK | O_RDONLY);
if (rd_fd < 0) {
- mrp_log_error("failed to open file '%s' for reading", rd_filename);
+ mrp_log_error("failed to open file '%s' for reading: '%s'",
+ rd_filename, strerror(errno));
goto error;
}
void *res;
int pipes[2];
int thread_arg[2];
- mrp_io_watch_t *iow;
+ mrp_io_watch_t *iow = NULL;
mrp_io_event_t events = MRP_IO_EVENT_IN;
int asm_snd_msgid = msgget((key_t)4102, 0666 | IPC_CREAT);
/* create a pipe for communicating with the ASM thread */
- pipe(pipes);
+ if (pipe(pipes) == -1) {
+ goto end;
+ }
/* pass the message queue and the pipe writing end to the thread */