Check for error properly

This commit is contained in:
Denis 2023-11-12 16:06:44 +01:00
parent 8fc9226406
commit 82f32823b0
No known key found for this signature in database
GPG key ID: DD9B63F805CF5C03
3 changed files with 8 additions and 7 deletions

View file

@ -113,10 +113,11 @@ static void* iio_read_thread_func(void* ptr) {
continue;
}
const int res = dev_iio_read(ctx->iio_dev, msg->ev, msg->ev_size, &msg->ev_count);
if (res == 0) {
} else if (res == -ENOMEM) {
rc = dev_iio_read(ctx->iio_dev, msg->ev, msg->ev_size, &msg->ev_count);
if (rc == 0) {
fprintf(stderr, "Error: reading %s: %d\n", dev_iio_get_name(ctx->iio_dev), rc);
break;
} else if (rc == -ENOMEM) {
fprintf(stderr, "Error: out-of-memory will skip the current frame.\n");
continue;
}
@ -274,7 +275,7 @@ static void input_iio(
}
sprintf(path, "%s%s", iio_path, dir->d_name);
printf("testing %s", path);
printf("testing %s\n", path);
// check if that has been already opened
// open_sysfs

View file

@ -2,7 +2,7 @@
#include "queue.h"
#undef INCLUDE_INPUT_DEBUG
#define INCLUDE_INPUT_DEBUG
#define INPUT_DEV_CTRL_FLAG_EXIT 0x00000001U

View file

@ -39,7 +39,7 @@
#define GYRO_DEADZONE 1 // degrees/s to count as zero movement
#undef INCLUDE_TIMESTAMP
#define INCLUDE_OUTPUT_DEBUG
#undef INCLUDE_OUTPUT_DEBUG
typedef enum output_dev_type {
output_dev_gamepad,