diff --git a/dev_hidraw.c b/dev_hidraw.c index 8fe005d..f8d2e6a 100644 --- a/dev_hidraw.c +++ b/dev_hidraw.c @@ -56,8 +56,6 @@ int dev_hidraw_open( ) { int res = -ENOENT; - - char path[MAX_PATH_LEN] = "\0"; DIR *d; @@ -75,7 +73,7 @@ int dev_hidraw_open( // try to open the device, if it cannot be opened to go the next int fd = open(path, O_RDWR); - if (fd != 0) { + if (fd < 0) { //fprintf(stderr, "Cannot open %s, device skipped.\n", path); continue; } diff --git a/dev_iio.c b/dev_iio.c index 4d81ef8..8888d14 100644 --- a/dev_iio.c +++ b/dev_iio.c @@ -384,8 +384,8 @@ int dev_iio_open( //printf("Testing for device %s\n", path); // try to open the device, if it cannot be opened to go the next - int fd = dev_iio_create(path, out_dev); - if (fd != 0) { + const int iio_creation_res = dev_iio_create(path, out_dev); + if (iio_creation_res != 0) { //fprintf(stderr, "Cannot open %s, device skipped.\n", path); continue; } diff --git a/input_dev.h b/input_dev.h index ed597a8..e6e830d 100644 --- a/input_dev.h +++ b/input_dev.h @@ -28,7 +28,7 @@ typedef enum input_dev_type { typedef struct hidraw_filters { const int16_t pid; const int16_t vid; - const uint16_t rdesc_size; + const uint16_t rdesc_size; // wc -c < /sys/class/hidraw/hidraw0/device/report_descriptor } hidraw_filters_t; typedef struct uinput_filters {