aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-11-02 22:46:35 -0700
committerpx4dev <px4@purgatory.org>2012-11-03 01:14:24 -0700
commite36bd4b2431ee659f473ca807e9a9fcef8c2e894 (patch)
tree1497164c3d077a8049fe4172d0c65f3ebcde3da3
parentc8e90688b0e7a4b92a5f5067f3d74b085cc8e82b (diff)
downloadpx4-firmware-e36bd4b2431ee659f473ca807e9a9fcef8c2e894.tar.gz
px4-firmware-e36bd4b2431ee659f473ca807e9a9fcef8c2e894.tar.bz2
px4-firmware-e36bd4b2431ee659f473ca807e9a9fcef8c2e894.zip
Fix transmit error reporting.
-rw-r--r--apps/systemlib/hx_stream.c11
-rw-r--r--apps/systemlib/hx_stream.h3
2 files changed, 6 insertions, 8 deletions
diff --git a/apps/systemlib/hx_stream.c b/apps/systemlib/hx_stream.c
index 7ee9888ea..aabb786d4 100644
--- a/apps/systemlib/hx_stream.c
+++ b/apps/systemlib/hx_stream.c
@@ -186,10 +186,8 @@ hx_stream_send(hx_stream_t stream,
const uint8_t *p = (const uint8_t *)data;
unsigned resid = count;
- if (resid > HX_STREAM_MAX_FRAME) {
- errno = EINVAL;
- return -1;
- }
+ if (resid > HX_STREAM_MAX_FRAME)
+ return -EINVAL;
/* start the frame */
hx_tx_raw(stream, FBO);
@@ -214,10 +212,11 @@ hx_stream_send(hx_stream_t stream,
/* check for transmit error */
if (stream->txerror) {
stream->txerror = false;
- return -1;
+ return -EIO;
}
- return -1;
+ perf_count(stream->pc_tx_frames);
+ return 0;
}
void
diff --git a/apps/systemlib/hx_stream.h b/apps/systemlib/hx_stream.h
index ac3b3e99d..128689953 100644
--- a/apps/systemlib/hx_stream.h
+++ b/apps/systemlib/hx_stream.h
@@ -102,8 +102,7 @@ __EXPORT extern void hx_stream_set_counters(hx_stream_t stream,
* @param stream A handle returned from hx_stream_init.
* @param data Pointer to the data to send.
* @param count The number of bytes to send.
- * @return Zero on success, nonzero with errno
- * set on error.
+ * @return Zero on success, -errno on error.
*/
__EXPORT extern int hx_stream_send(hx_stream_t stream,
const void *data,