Skip to content

Commit

Permalink
Merge pull request apache#4 from mlaz/mynewt_mcumgr
Browse files Browse the repository at this point in the history
OMP_OIC_RESOURCE_NAME now defined on mynewt-core/oicmgr side, invalid log show timeout fixed.
  • Loading branch information
vrahane committed Aug 30, 2019
2 parents 7b88944 + d32b291 commit 6fd13ad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 46 deletions.
1 change: 1 addition & 0 deletions cmd/log_mgmt/src/log_mgmt.c
Expand Up @@ -317,6 +317,7 @@ log_mgmt_show(struct mgmt_ctxt *ctxt)
/* Log list fully iterated. */
if (name_len != 0) {
/* Client specified log name, but the log wasn't found. */
cbor_encoder_close_container(&ctxt->encoder, &logs);
return MGMT_ERR_ENOENT;
} else {
break;
Expand Down
3 changes: 0 additions & 3 deletions omp/port/mynewt/src/mynewt_omp.c
Expand Up @@ -78,9 +78,6 @@ omp_impl_process_request_packet(struct omp_state *omgr_st, void *req_buf)
}

rc = omp_process_mgmt_hdr(&req_hdr, &rsp_hdr, &ctxt);
/* if (err != 0) { */
/* rc = MGMT_ERR_EINVAL; */
/* } */

cbor_encoder_close_container(streamer->rsp_encoder, &ctxt.encoder);
if (rc != 0) {
Expand Down
33 changes: 14 additions & 19 deletions omp/src/omp.c
Expand Up @@ -110,8 +110,8 @@ omp_process_mgmt_hdr(struct mgmt_hdr *req_hdr,
struct mgmt_ctxt *ctxt)
{
int rc = 0;
bool rsp_hdr_filled = true;
const struct mgmt_handler *handler;
mgmt_handler_fn *handler_fn = NULL;

handler = mgmt_find_handler(req_hdr->nh_group, req_hdr->nh_id);
if (handler == NULL) {
Expand All @@ -121,34 +121,29 @@ omp_process_mgmt_hdr(struct mgmt_hdr *req_hdr,

switch (req_hdr->nh_op) {
case MGMT_OP_READ:
if (handler->mh_read == NULL) {
rc = MGMT_ERR_ENOENT;
} else {
rsp_hdr->nh_op = MGMT_OP_READ_RSP;
rc = handler->mh_read(ctxt);
}
rsp_hdr->nh_op = MGMT_OP_READ_RSP;
handler_fn = handler->mh_read;
break;

case MGMT_OP_WRITE:
if (handler->mh_write == NULL) {
rc = MGMT_ERR_ENOENT;
} else {
rsp_hdr->nh_op = MGMT_OP_WRITE_RSP;
rc = handler->mh_write(ctxt);
}
rsp_hdr->nh_op = MGMT_OP_WRITE_RSP;
handler_fn = handler->mh_write;
break;

default:
rc = MGMT_ERR_EINVAL;
rsp_hdr_filled = false;
goto done;
break;
}

if (handler_fn) {
rc = handler_fn(ctxt);
} else {
rc = MGMT_ERR_ENOTSUP;
}

/* Encode the MGMT header in the response. */
done:

if (rc != 0) {
if (rsp_hdr_filled) {
if (handler_fn) {
rc = omp_send_err_rsp(&ctxt->encoder, rsp_hdr, rc);
}
} else {
Expand All @@ -158,5 +153,5 @@ omp_process_mgmt_hdr(struct mgmt_hdr *req_hdr,
}
}

return rc;
return mgmt_err_from_cbor(rc);
}
24 changes: 0 additions & 24 deletions omp/syscfg.yml

This file was deleted.

0 comments on commit 6fd13ad

Please sign in to comment.