From 75073d0a8478441cc97a6efa10b566c5fb1dac81 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 17 Apr 2020 20:57:17 +0100 Subject: New upstream version 1.4.0 --- src/hid_linux.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/hid_linux.c') diff --git a/src/hid_linux.c b/src/hid_linux.c index c7cabc9..99c5afb 100644 --- a/src/hid_linux.c +++ b/src/hid_linux.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "fido.h" @@ -98,7 +99,6 @@ get_usage_info(const struct hidraw_report_descriptor *hrd, uint32_t *usage_page, static int get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) { - int r; int s = -1; int fd; int ok = -1; @@ -108,7 +108,7 @@ get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) return (-1); } - if ((r = ioctl(fd, HIDIOCGRDESCSIZE, &s)) < 0 || s < 0 || + if (ioctl(fd, HIDIOCGRDESCSIZE, &s) < 0 || s < 0 || (unsigned)s > HID_MAX_DESCRIPTOR_SIZE) { fido_log_debug("%s: ioctl HIDIOCGRDESCSIZE", __func__); goto fail; @@ -116,7 +116,7 @@ get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) hrd->size = s; - if ((r = ioctl(fd, HIDIOCGRDESC, hrd)) < 0) { + if (ioctl(fd, HIDIOCGRDESC, hrd) < 0) { fido_log_debug("%s: ioctl HIDIOCGRDESC", __func__); goto fail; } @@ -240,7 +240,7 @@ fail: } int -fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) +fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) { struct udev *udev = NULL; struct udev_enumerate *udev_enum = NULL; @@ -267,6 +267,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) udev_list_entry_foreach(udev_entry, udev_list) { if (copy_info(&devlist[*olen], udev, udev_entry) == 0) { + devlist[*olen].io = (fido_dev_io_t) { + fido_hid_open, + fido_hid_close, + fido_hid_read, + fido_hid_write, + }; if (++(*olen) == ilen) break; } -- cgit v1.2.3