diff --git a/dev_evdev.c b/dev_evdev.c index 210fbfd..1a8e247 100644 --- a/dev_evdev.c +++ b/dev_evdev.c @@ -56,7 +56,7 @@ void dev_evdev_close(struct libevdev* out_evdev) { int dev_evdev_open( const uinput_filters_t *const in_filters, - struct libevdev* out_evdev + struct libevdev* *const out_evdev ) { int res = -ENOENT; @@ -114,7 +114,7 @@ int dev_evdev_open( open_fds[open_sysfs_idx] = fd; } - if (libevdev_new_from_fd(fd, &out_evdev) != 0) { + if (libevdev_new_from_fd(fd, out_evdev) != 0) { fprintf(stderr, "Cannot initialize libevdev from this device (%s) -- Skipping.\n", path); open_fds[open_sysfs_idx] = -1; close(fd); @@ -122,11 +122,13 @@ int dev_evdev_open( } // try to open the device - if (!ev_matches(out_evdev, in_filters)) { - libevdev_free(out_evdev); + if (!ev_matches(*out_evdev, in_filters)) { + libevdev_free(*out_evdev); open_fds[open_sysfs_idx] = -1; close(fd); continue; + } else { + printf("post-ev_matches: %s\n", libevdev_get_name(*out_evdev)); } // the device has been found diff --git a/dev_evdev.h b/dev_evdev.h index 628c1e2..2343382 100644 --- a/dev_evdev.h +++ b/dev_evdev.h @@ -4,7 +4,7 @@ int dev_evdev_open( const uinput_filters_t *const in_filters, - struct libevdev* out_evdev + struct libevdev* *const out_evdev ); void dev_evdev_close(struct libevdev* out_evdev); diff --git a/dev_in.c b/dev_in.c index b24728e..1c6d87f 100644 --- a/dev_in.c +++ b/dev_in.c @@ -100,7 +100,7 @@ int open_device( const uinput_filters_t *const in_filters, dev_in_ev_t *const out_dev ) { - int res = dev_evdev_open(in_filters, out_dev->evdev); + int res = dev_evdev_open(in_filters, &out_dev->evdev); if (res != 0) { fprintf(stderr, "Unable to open the specified device: %d\n", res); goto open_device_err;