From eb8a2bb1f3e43f9feff400a15e9191ef2777d1dd Mon Sep 17 00:00:00 2001 From: Dmitry Simonenko Date: Tue, 15 Nov 2016 14:27:08 +0300 Subject: [PATCH] soprano: remake fe ready reader to parse header --- lib/so_feread.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/so_feread.c b/lib/so_feread.c index 13586d7f..98ece84d 100644 --- a/lib/so_feread.c +++ b/lib/so_feread.c @@ -14,12 +14,18 @@ #include #include #include +#include #include int so_feread_ready(uint8_t *data, uint32_t size, int *status) { - if (so_unlikely(size != 1)) + soheader_t *header = (soheader_t*)data; + uint32_t len; + int rc = so_read(&len, &data, &size); + if (rc != 0) return -1; - *status = data[0]; + if (len != 1) + return -1; + *status = header->data[0]; return 0; }