Check for error properly
This commit is contained in:
parent
8fc9226406
commit
82f32823b0
3 changed files with 8 additions and 7 deletions
11
input_dev.c
11
input_dev.c
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "queue.h"
|
||||
|
||||
#undef INCLUDE_INPUT_DEBUG
|
||||
#define INCLUDE_INPUT_DEBUG
|
||||
|
||||
#define INPUT_DEV_CTRL_FLAG_EXIT 0x00000001U
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue